Added entities and properties for some future features.

This commit is contained in:
Jan Böhmer 2019-08-12 15:47:57 +02:00
parent bcdba8b3e0
commit 7826e3d2ad
49 changed files with 1477 additions and 362 deletions

View file

@ -32,8 +32,7 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Form\BaseEntityAdminForm;
use App\Services\EntityExporter;
use App\Services\EntityImporter;

View file

@ -31,9 +31,8 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\NamedDBElement;
use App\Entity\StructuralDBElement;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
use App\Form\BaseEntityAdminForm;
use App\Form\ImportType;
use App\Services\EntityExporter;

View file

@ -32,8 +32,8 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Category;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category;
use App\Form\BaseEntityAdminForm;
use App\Form\CategoryAdminForm;
use App\Services\EntityExporter;

View file

@ -32,9 +32,9 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Device;
use App\Entity\Devices\Device;
use App\Form\BaseEntityAdminForm;
use App\Services\EntityExporter;
use App\Services\EntityImporter;

View file

@ -32,9 +32,9 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Footprint;
use App\Entity\Parts\Footprint;
use App\Form\BaseEntityAdminForm;
use App\Services\EntityExporter;
use App\Services\EntityImporter;

View file

@ -32,10 +32,10 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Manufacturer;
use App\Entity\Supplier;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Supplier;
use App\Form\BaseEntityAdminForm;
use App\Form\CompanyForm;
use App\Services\EntityExporter;

View file

@ -31,9 +31,9 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Storelocation;
use App\Entity\Parts\Storelocation;
use App\Form\BaseEntityAdminForm;
use App\Form\StorelocationAdminForm;
use App\Services\EntityExporter;

View file

@ -32,9 +32,9 @@
namespace App\Controller\AdminPages;
use App\Entity\AttachmentType;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Supplier;
use App\Entity\Parts\Supplier;
use App\Form\BaseEntityAdminForm;
use App\Form\CompanyForm;
use App\Services\EntityExporter;

View file

@ -32,7 +32,7 @@
namespace App\Controller;
use App\Entity\Attachment;
use App\Entity\Attachments\Attachment;
use App\Services\AttachmentHelper;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;

View file

@ -30,8 +30,8 @@
namespace App\Controller;
use App\Entity\Category;
use App\Entity\Part;
use App\Entity\Parts\Category;
use App\Entity\Parts\Part;
use App\Form\PartType;
use App\Services\AttachmentFilenameService;
use App\Services\AttachmentHelper;

View file

@ -29,12 +29,12 @@
namespace App\Controller;
use App\Entity\Category;
use App\Entity\Parts\Category;
use App\Entity\Device;
use App\Entity\Footprint;
use App\Entity\Manufacturer;
use App\Entity\Storelocation;
use App\Entity\Supplier;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Helpers\TreeViewNode;
use App\Services\ToolsTreeBuilder;
use App\Services\TreeBuilder;

View file

@ -29,9 +29,9 @@
namespace App\Controller;
use App\Entity\AttachmentType;
use App\Entity\Footprint;
use App\Entity\User;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Footprint;
use App\Entity\UserSystem\User;
use App\Form\BaseEntityAdminForm;
use App\Form\UserAdminForm;
use App\Form\UserSettingsType;

View file

@ -21,8 +21,10 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Attachments;
use App\Entity\Base\DBElement;
use App\Entity\Base\NamedDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Intl\Exception\NotImplementedException;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,10 +50,12 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Attachments;
use App\Entity\Base\NamedDBElement;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
/**
* @ORM\MappedSuperclass()
@ -32,7 +63,7 @@ use Doctrine\ORM\Mapping as ORM;
abstract class AttachmentContainingDBElement extends NamedDBElement
{
/**
* @var
* @var Attachment[]
* //TODO
* //@ORM\OneToMany(targetEntity="Attachment", mappedBy="element")
*

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,8 +50,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Attachments;
use App\Entity\Base\StructuralDBElement;
use App\Validator\Constraints\NoneOfItsChildren;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

View file

@ -29,7 +29,7 @@
*
*/
namespace App\Entity;
namespace App\Entity\Attachments;
use Doctrine\ORM\Mapping as ORM;
@ -43,7 +43,7 @@ class PartAttachment extends Attachment
/**
*
* @ORM\ManyToOne(targetEntity="Part", inversedBy="attachments")
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="attachments")
* @ORM\JoinColumn(name="element_id", referencedColumnName="id").
*/
protected $element;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,8 +50,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Base;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,7 +50,7 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Base;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,7 +50,7 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Base;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

View file

@ -0,0 +1,65 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
* Part-DB Version 0.4+ "nextgen"
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity\Base;
use Doctrine\ORM\Mapping as ORM;
/**
* Class PartsContainingDBElement.
*
* @ORM\MappedSuperclass()
*/
abstract class PartsContainingDBElement extends StructuralDBElement
{
protected $parts;
}

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,8 +50,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Base;
use App\Entity\Attachments\AttachmentContainingDBElement;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
@ -78,6 +108,13 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
*/
protected $parent_id;
/**
* @var bool If this property is set, this element can not be selected for part properties.
* Useful if this element should be used only for grouping, sorting.
* @ORM\Column(type="boolean")
*/
protected $not_selectable = false;
/**
* @var int
*/

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Devices;
use App\Entity\Base\PartsContainingDBElement;
use Doctrine\ORM\Mapping as ORM;
/**

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,10 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Devices;
use App\Entity\Base\DBElement;
use App\Entity\Parts\Part;
use Doctrine\ORM\Mapping as ORM;
/**
@ -51,7 +82,7 @@ class DevicePart extends DBElement
/**
* @var Part
* @ORM\ManyToOne(targetEntity="Part")
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part")
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
*/
protected $part;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
@ -21,8 +50,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Parts;
use App\Entity\Base\PartsContainingDBElement;
use Doctrine\ORM\Mapping as ORM;
/**

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Parts;
use App\Entity\Base\PartsContainingDBElement;
use Doctrine\ORM\Mapping as ORM;
/**
@ -191,7 +221,7 @@ class Footprint extends PartsContainingDBElement
*
* @return Footprint
*
* @throws Exception if there was an error
* @throws \Exception if there was an error
*/
public function setFilename(string $new_filename): self
{
@ -203,7 +233,7 @@ class Footprint extends PartsContainingDBElement
/**
* Change the 3d model filename of this footprint.
*
* @throws Exception if there was an error
* @throws \Exception if there was an error
*/
public function set3dFilename(string $new_filename): self
{

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Parts;
use App\Entity\Base\Company;
use Doctrine\ORM\Mapping as ORM;
/**

View file

@ -0,0 +1,140 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
namespace App\Entity\Parts;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* This unit represents the unit in which the amount of parts in stock are measured.
* This could be something like N, gramms, meters, etc...
*
* @package App\Entity
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table(name="`measurement_units`")
* @UniqueEntity("unit")
*/
class MeasurementUnit extends StructuralDBElement
{
/**
* @var string The unit symbol that should be used for the Unit. This could be something like "", g (for gramms)
* or m (for meters).
* @ORM\Column(type="string", name="unit", unique=true)
*/
protected $unit;
/**
* @var bool Determines if the amount value associated with this unit should be treated as integer.
* Set to false, to measure continuous sizes likes masses or lengthes.
* @ORM\Column(type="boolean", name="is_integer")
*/
protected $isInteger;
/**
* @var bool Determines if the unit can be used with SI Prefixes (kilo, giga, milli, etc.).
* Useful for sizes like meters.
* @ORM\Column(type="boolean", name="use_si_prefix")
*/
protected $usesSIPrefixes;
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*
*/
public function getIDString(): string
{
return 'MU' . $this->getID();
}
/**
* @return string
*/
public function getUnit(): string
{
return $this->unit;
}
/**
* @param string $unit
* @return MeasurementUnit
*/
public function setUnit(string $unit): MeasurementUnit
{
$this->unit = $unit;
return $this;
}
/**
* @return bool
*/
public function isInteger(): bool
{
return $this->isInteger;
}
/**
* @param bool $isInteger
* @return MeasurementUnit
*/
public function setIsInteger(bool $isInteger): MeasurementUnit
{
$this->isInteger = $isInteger;
return $this;
}
/**
* @return bool
*/
public function isUsesSIPrefixes(): bool
{
return $this->usesSIPrefixes;
}
/**
* @param bool $usesSIPrefixes
* @return MeasurementUnit
*/
public function setUsesSIPrefixes(bool $usesSIPrefixes): MeasurementUnit
{
$this->usesSIPrefixes = $usesSIPrefixes;
return $this;
}
}

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,11 +59,14 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\Parts;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Devices\Device;
use App\Entity\PriceInformations\Orderdetail;
use App\Security\Annotations\ColumnSecurity;
use Doctrine\ORM\Mapping as ORM;
//use Webmozart\Assert\Assert;
use Symfony\Component\Validator\Constraints as Assert;
@ -49,7 +81,7 @@ class Part extends AttachmentContainingDBElement
public const INSTOCK_UNKNOWN = -2;
/**
* @ORM\OneToMany(targetEntity="PartAttachment", mappedBy="element")
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element")
*/
protected $attachments;
@ -89,7 +121,7 @@ class Part extends AttachmentContainingDBElement
/**
* @var Attachment
* @ORM\ManyToOne(targetEntity="Attachment")
* @ORM\ManyToOne(targetEntity="App\Entity\Attachments\Attachment")
* @ORM\JoinColumn(name="id_master_picture_attachement", referencedColumnName="id")
*
* @ColumnSecurity(prefix="attachments", type="object")
@ -98,7 +130,7 @@ class Part extends AttachmentContainingDBElement
/**
* @var Orderdetail[]
* @ORM\OneToMany(targetEntity="Orderdetail", mappedBy="part")
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part")
*
* @ColumnSecurity(prefix="orderdetails", type="object")
*/
@ -106,7 +138,7 @@ class Part extends AttachmentContainingDBElement
/**
* @var Orderdetail
* @ORM\OneToOne(targetEntity="Orderdetail")
* @ORM\OneToOne(targetEntity="App\Entity\PriceInformations\Orderdetail")
* @ORM\JoinColumn(name="order_orderdetails_id", referencedColumnName="id")
*
* @ColumnSecurity(prefix="order", type="object")
@ -150,13 +182,10 @@ class Part extends AttachmentContainingDBElement
protected $description = '';
/**
* @var int
* @ORM\Column(type="integer")
* @Assert\GreaterThanOrEqual(0)
*
* @ColumnSecurity(prefix="instock", type="integer")
* @var ?PartLot[]
* @ORM\OneToMany(targetEntity="PartLot", mappedBy="part")
*/
protected $instock = 0;
protected $partLots;
/**
* @var int
@ -167,6 +196,13 @@ class Part extends AttachmentContainingDBElement
*/
protected $mininstock = 0;
/**
* @var float
* @ORM\Column(type="float")
* @Assert\PositiveOrZero()
*/
protected $minamount;
/**
* @var string
* @ORM\Column(type="text")
@ -204,10 +240,42 @@ class Part extends AttachmentContainingDBElement
/**
* @var string
* @ORM\Column(type="string")
*@ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
* @ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
*/
protected $manufacturer_product_url = '';
/**
* @var string
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="manufacturer", type="string", placeholder="")
*/
protected $manufacturer_product_number;
/**
* @var bool Determines if this part entry needs review (for example, because it is work in progress)
* @ORM\Column(type="boolean")
*/
protected $needs_review = false;
/**
* @var MeasurementUnit The unit in which the part's amount is measured.
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
* @ORM\JoinColumn(name="id_part_unit", referencedColumnName="id", nullable=true)
*/
protected $partUnit;
/**
* @var string A comma seperated list of tags, assocciated with the part.
* @ORM\Column(type="text")
*/
protected $tags;
/**
* @var float|null How much a single part unit weighs in gramms.
* @ORM\Column(type="float", nullable=true)
*/
protected $mass;
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.

View file

@ -0,0 +1,118 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
namespace App\Entity\Parts;
use App\Entity\Base\NamedDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* This entity describes a lot where parts can be stored.
* It is the connection between a part and its store locations.
* @package App\Entity\Parts
* @ORM\Entity()
* @ORM\Table(name="part_lots")
*/
class PartLot extends NamedDBElement
{
/**
* @var string A short description about this lot, shown in table
* @ORM\Column(type="text")
*/
protected $description;
/**
* @var string A comment stored with this lot.
* @ORM\Column(type="text")
*/
protected $comment;
/**
* @var \DateTime Set a time until when the lot must be used.
* Set to null, if the lot can be used indefinitley.
* @ORM\Column(type="datetimetz", name="expiration_date", nullable=true)
*/
protected $expiration_date;
/**
* @var Storelocation The storelocation of this lot
* @ORM\ManyToOne(targetEntity="Storelocation")
* @ORM\JoinColumn(name="id_store_location", referencedColumnName="id")
*/
protected $storage_location;
/**
* @var Part The part that is stored in this lot
* @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots")
* @ORM\JoinColumn(name="id_part", referencedColumnName="id")
*/
protected $part;
/**
* @var bool If this is set to true, the instock amount is marked as not known
* @ORM\Column(type="boolean")
*/
protected $instock_unknown;
/**
* @var int For integer sizes the instock is saved here.
* @ORM\Column(type="integer", nullable=true)
* @Assert\Positive()
*/
protected $instock;
/**
* @var float For continuos sizes (length, volume, etc.) the instock is saved here.
* @ORM\Column(type="float", nullable=true)
*/
protected $amount;
/**
* @var boolean Determines if this lot was manually marked for refilling.
* @ORM\Column(type="boolean")
*/
protected $needs_refill;
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*
*/
public function getIDString(): string
{
return 'PL' . $this->getID();
}
}

View file

@ -0,0 +1,228 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity\Parts;
use App\Entity\Base\PartsContainingDBElement;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Storelocation.
*
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table("`storelocations`")
*/
class Storelocation extends PartsContainingDBElement
{
/**
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="Part", mappedBy="storelocation")
*/
protected $parts;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $is_full;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $only_single_part;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $limit_to_existing_parts;
/**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here
* @ORM\ManyToOne(targetEntity="MeasurementUnit")
* @ORM\JoinColumn(name="storage_type_id", referencedColumnName="id")
*/
protected $storage_type;
/********************************************************************************
*
* Getters
*
*********************************************************************************/
/**
* Get the "is full" attribute.
*
* When this attribute is set, it is not possible to add additional parts or increase the instock of existing parts.
*
* @return bool * true if the storelocation is full
* * false if the storelocation isn't full
*/
public function isFull(): bool
{
return (bool) $this->is_full;
}
/**
* When this property is set, only one part (but many instock) is allowed to be stored in this store location.
*
* @return bool
*/
public function isOnlySinglePart(): bool
{
return $this->only_single_part;
}
/**
* @param bool $only_single_part
* @return Storelocation
*/
public function setOnlySinglePart(bool $only_single_part): Storelocation
{
$this->only_single_part = $only_single_part;
return $this;
}
/**
* When this property is set, it is only possible to increase the instock of parts, that are already stored here.
*
* @return bool
*/
public function isLimitToExistingParts(): bool
{
return $this->limit_to_existing_parts;
}
/**
* @param bool $limit_to_existing_parts
* @return Storelocation
*/
public function setLimitToExistingParts(bool $limit_to_existing_parts): Storelocation
{
$this->limit_to_existing_parts = $limit_to_existing_parts;
return $this;
}
/**
* @return MeasurementUnit|null
*/
public function getStorageType(): ?MeasurementUnit
{
return $this->storage_type;
}
/**
* @param MeasurementUnit|null $storage_type
* @return Storelocation
*/
public function setStorageType(?MeasurementUnit $storage_type): Storelocation
{
$this->storage_type = $storage_type;
return $this;
}
/********************************************************************************
*
* Setters
*
*********************************************************************************/
/**
* Change the "is full" attribute of this storelocation.
*
* "is_full" = true means that there is no more space in this storelocation.
* This attribute is only for information, it has no effect.
*
* @param bool $new_is_full * true means that the storelocation is full
* * false means that the storelocation isn't full
* @return Storelocation
*/
public function setIsFull(bool $new_is_full): Storelocation
{
$this->is_full = $new_is_full;
return $this;
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*/
public function getIDString(): string
{
return 'L'.sprintf('%06d', $this->getID());
}
}

View file

@ -0,0 +1,155 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
/**
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity\Parts;
use App\Entity\Base\Company;
use App\Entity\PriceInformations\Currency;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Supplier.
*
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table("`suppliers`")
*/
class Supplier extends Company
{
/**
* @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent")
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="supplier")
*/
protected $orderdetails;
/**
* @var Currency|null The currency that should be used by default for order informations with this supplier.
* Set to null, to use global base currency.
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency")
* @ORM\JoinColumn(name="default_currency_id", referencedColumnName="id", nullable=true)
*/
protected $default_currency;
/**
* @var float|null The shipping costs that have to be paid, when ordering via this supplier.
* @ORM\Column(name="shipping_costs", nullable=true, type="decimal")
* @Assert\PositiveOrZero()
*/
protected $shipping_costs;
/**
* @return ?Currency
*/
public function getDefaultCurrency()
{
return $this->default_currency;
}
/**
* @param ?Currency $default_currency
* @return Supplier
*/
public function setDefaultCurrency(?Currency $default_currency) : Supplier
{
$this->default_currency = $default_currency;
return $this;
}
/**
* @return ?float
*/
public function getShippingCosts() : ?float
{
return $this->shipping_costs;
}
/**
* @param ?float $shipping_costs
* @return Supplier
*/
public function setShippingCosts(?float $shipping_costs) : Supplier
{
$this->shipping_costs = $shipping_costs;
return $this;
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*/
public function getIDString(): string
{
return 'L'.sprintf('%06d', $this->getID());
}
}

View file

@ -1,36 +0,0 @@
<?php
declare(strict_types=1);
/**
* Part-DB Version 0.4+ "nextgen"
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class PartsContainingDBElement.
*
* @ORM\MappedSuperclass()
*/
abstract class PartsContainingDBElement extends StructuralDBElement
{
protected $parts;
}

View file

@ -0,0 +1,131 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
namespace App\Entity\PriceInformations;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* This entity describes a currency that can be used for price informations.
* @package App\Entity
* @UniqueEntity("iso_code")
* @ORM\Entity()
* @ORM\Table(name="currencies")
*/
class Currency extends StructuralDBElement
{
/**
* @var string The 3 letter ISO code of the currency.
* @ORM\Column(type="string", unique=true, nullable=true)
* @Assert\Currency()
*/
protected $iso_code;
/**
* @var float|null The exchange rate between this currency and the base currency
* (how many base units the current currency is worth)
* @ORM\Column(type="decimal", precision=11, scale=5)
* @Assert\Positive()
*/
protected $exchange_rate;
/**
* Returns the 3 letter ISO code of this currency
* @return string
*/
public function getIsoCode(): string
{
return $this->iso_code;
}
/**
* @param string $iso_code
* @return Currency
*/
public function setIsoCode(string $iso_code): Currency
{
$this->iso_code = $iso_code;
return $this;
}
/**
* Returns the inverse exchange rate (how many of the current currency the base unit is worth)
* @return float|null
*/
public function getInverseExchangeRate(): ?float
{
$tmp = $this->getExchangeRate();
if ($tmp == null) {
return null;
}
return 1 / $tmp;
}
/**
* Returns The exchange rate between this currency and the base currency
* (how many base units the current currency is worth)
* @return float|null
*/
public function getExchangeRate(): ?float
{
return $this->exchange_rate;
}
/**
* @param float|null $exchange_rate
* @return Currency
*/
public function setExchangeRate(?float $exchange_rate): Currency
{
$this->exchange_rate = $exchange_rate;
return $this;
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*
*/
public function getIDString(): string
{
return 'C' . $this->getID();
}
}

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,11 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\PriceInformations;
use App\Entity\Base\DBElement;
use App\Entity\Parts\Part;
use App\Entity\Parts\Supplier;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
use Exception;
@ -46,14 +78,14 @@ class Orderdetail extends DBElement
{
/**
* @var Part
* @ORM\ManyToOne(targetEntity="Part", inversedBy="orderdetails")
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Part", inversedBy="orderdetails")
* @ORM\JoinColumn(name="part_id", referencedColumnName="id")
*/
protected $part;
/**
* @var Supplier
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="orderdetails")
* @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails")
* @ORM\JoinColumn(name="id_supplier", referencedColumnName="id")
*/
protected $supplier;
@ -118,8 +150,6 @@ class Orderdetail extends DBElement
* Get the supplier.
*
* @return Supplier the supplier of this orderdetails
*
* @throws DatabaseException if there was an error
*/
public function getSupplier(): Supplier
{

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,16 +59,19 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\PriceInformations;
use App\Entity\Base\DBElement;
use Doctrine\ORM\Mapping as ORM;
use Webmozart\Assert\Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Class Pricedetail.
*
* @ORM\Entity()
* @ORM\Table("`pricedetails`")
* @UniqueEntity(fields={"orderdetail", "min_discount_quantity"})
*/
class Pricedetail extends DBElement
{
@ -51,14 +83,24 @@ class Pricedetail extends DBElement
protected $orderdetail;
/**
* @var float
* @var float The price related to the detail. (Given in the selected currency)
* @ORM\Column(type="decimal", precision=11, scale=5)
* @Assert\Positive()
*/
protected $price;
/**
* @var ?Currency The currency used for the current price information.
* If this is null, the global base unit is assumed.
* @ORM\ManyToOne(targetEntity="Currency")
* @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true)
*/
protected $currency;
/**
* @var int
* @ORM\Column(type="integer")
* @Assert\Positive()
*/
protected $price_related_quantity;
@ -95,13 +137,18 @@ class Pricedetail extends DBElement
return $this->orderdetail;
}
/**
* Returns the price associated with this pricedetail.
* It is given in current currency and for the price related quantity.
* @return float
*/
public function getPrice() : float
{
return (float) $this->price;
}
/**
* Get the price for a single unit.
* Get the price for a single unit in the currency associated with this price detail.
*
* @param int $multiplier The returned price (float or string) will be multiplied
* with this multiplier.
@ -114,9 +161,7 @@ class Pricedetail extends DBElement
*/
public function getPricePerUnit(int $multiplier = 1) : float
{
$price = ($this->price * $multiplier) / $this->price_related_quantity;
return $price;
return ($this->price * $multiplier) / $this->price_related_quantity;
}
/**
@ -126,7 +171,7 @@ class Pricedetail extends DBElement
*
* @return int the price related quantity
*
* @see Pricedetails::setPriceRelatedQuantity()
* @see Pricedetail::setPriceRelatedQuantity()
*/
public function getPriceRelatedQuantity(): int
{
@ -141,19 +186,40 @@ class Pricedetail extends DBElement
*
* @return int the minimum discount quantity
*
* @see Pricedetails::setMinDiscountQuantity()
* @see Pricedetail::setMinDiscountQuantity()
*/
public function getMinDiscountQuantity(): int
{
return $this->min_discount_quantity;
}
/**
* Returns the currency associated with this price information.
* Returns null, if no specific currency is selected and the global base currency should be assumed.
* @return Currency|null
*/
public function getCurrency(): ?Currency
{
return $this->currency;
}
/********************************************************************************
*
* Setters
*
*********************************************************************************/
/**
* Sets the currency associated with the price informations.
* Set to null, to use the global base currency.
* @param Currency|null $currency
* @return Pricedetail
*/
public function setCurrency(?Currency $currency): Pricedetail
{
$this->currency = $currency;
}
/**
* Set the price.
*
@ -165,9 +231,9 @@ class Pricedetail extends DBElement
*
* @return self
*/
public function setPrice(float $new_price): self
public function setPrice(float $new_price): Pricedetail
{
Assert::natural($new_price, 'The new price must be positive! Got %s!');
//Assert::natural($new_price, 'The new price must be positive! Got %s!');
$this->price = $new_price;
@ -189,8 +255,8 @@ class Pricedetail extends DBElement
*/
public function setPriceRelatedQuantity(int $new_price_related_quantity): self
{
Assert::greaterThan($new_price_related_quantity, 0,
'The new price related quantity must be greater zero! Got %s.');
//Assert::greaterThan($new_price_related_quantity, 0,
// 'The new price related quantity must be greater zero! Got %s.');
$this->price_related_quantity = $new_price_related_quantity;
@ -218,8 +284,8 @@ class Pricedetail extends DBElement
*/
public function setMinDiscountQuantity(int $new_min_discount_quantity): self
{
Assert::greaterThan($new_min_discount_quantity, 0,
'The new minimum discount quantity must be greater zero! Got %s.');
//Assert::greaterThan($new_min_discount_quantity, 0,
// 'The new minimum discount quantity must be greater zero! Got %s.');
$this->min_discount_quantity = $new_min_discount_quantity;

View file

@ -1,121 +0,0 @@
<?php
declare(strict_types=1);
/**
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Storelocation.
*
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table("`storelocations`")
*/
class Storelocation extends PartsContainingDBElement
{
/**
* @ORM\OneToMany(targetEntity="Storelocation", mappedBy="parent")
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="Storelocation", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="Part", mappedBy="storelocation")
*/
protected $parts;
/**
* @var bool
* @ORM\Column(type="boolean")
*/
protected $is_full;
/********************************************************************************
*
* Getters
*
*********************************************************************************/
/**
* Get the "is full" attribute.
*
* "is_full == true" means that there is no more space in this storelocation.
* This attribute is only for information, it has no effect.
*
* @return bool * true if the storelocation is full
* * false if the storelocation isn't full
*/
public function getIsFull(): bool
{
return (bool) $this->is_full;
}
/********************************************************************************
*
* Setters
*
*********************************************************************************/
/**
* Change the "is full" attribute of this storelocation.
*
* "is_full" = true means that there is no more space in this storelocation.
* This attribute is only for information, it has no effect.
*
* @param bool $new_is_full * true means that the storelocation is full
* * false means that the storelocation isn't full
*
* @throws Exception if there was an error
*/
public function setIsFull(bool $new_is_full): self
{
$this->is_full = $new_is_full;
return $this;
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*/
public function getIDString(): string
{
return 'L'.sprintf('%06d', $this->getID());
}
}

View file

@ -1,102 +0,0 @@
<?php
declare(strict_types=1);
/**
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Supplier.
*
* @ORM\Entity(repositoryClass="App\Repository\StructuralDBElementRepository")
* @ORM\Table("`suppliers`")
*/
class Supplier extends Company
{
/**
* @ORM\OneToMany(targetEntity="Supplier", mappedBy="parent")
*/
protected $children;
/**
* @ORM\ManyToOne(targetEntity="Supplier", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
*/
protected $parent;
/**
* @ORM\OneToMany(targetEntity="Orderdetail", mappedBy="supplier")
*/
protected $orderdetails;
/**
* Get all parts from this element.
*
* @return int all parts in a one-dimensional array of Part objects
*
* @throws Exception if there was an error
*/
public function getCountOfPartsToOrder(): int
{
/*
$query = 'SELECT COUNT(*) as count FROM parts '.
'LEFT JOIN device_parts ON device_parts.id_part = parts.id '.
'LEFT JOIN devices ON devices.id = device_parts.id_device '.
'LEFT JOIN orderdetails ON orderdetails.id = parts.order_orderdetails_id '.
'WHERE ((parts.instock < parts.mininstock) OR (parts.manual_order != false) '.
'OR ((devices.order_quantity > 0) '.
'AND ((devices.order_only_missing_parts = false) '.
'OR (parts.instock - device_parts.quantity * devices.order_quantity < parts.mininstock)))) '.
'AND (parts.order_orderdetails_id IS NOT NULL) '.
'AND (orderdetails.id_supplier = ?)';
$query_data = $this->database->query($query, array($this->getID()));
return (int) $query_data[0]['count']; */
//TODO
throw new \Exception('Not implemented yet!');
}
/**
* Returns the ID as an string, defined by the element class.
* This should have a form like P000014, for a part with ID 14.
*
* @return string The ID as a string;
*/
public function getIDString(): string
{
return 'L'.sprintf('%06d', $this->getID());
}
}

View file

@ -1,8 +1,9 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
@ -25,10 +26,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
namespace App\Entity;
namespace App\Entity\UserSystem;
use App\Entity\Base\StructuralDBElement;
use App\Security\Interfaces\HasPermissionsInterface;
use Doctrine\ORM\Mapping as ORM;

View file

@ -1,8 +1,9 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/.
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
@ -25,9 +26,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
namespace App\Entity;
namespace App\Entity\UserSystem;
use Doctrine\ORM\Mapping as ORM;
use Webmozart\Assert\Assert;

View file

@ -1,4 +1,33 @@
<?php
/**
*
* part-db version 0.1
* Copyright (C) 2005 Christoph Lechner
* http://www.cl-projects.de/
*
* part-db version 0.2+
* Copyright (C) 2009 K. Jacobs and others (see authors.php)
* http://code.google.com/p/part-db/
*
* Part-DB Version 0.4+
* Copyright (C) 2016 - 2019 Jan Böhmer
* https://github.com/jbtronics
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
*/
declare(strict_types=1);
@ -30,8 +59,9 @@ declare(strict_types=1);
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
namespace App\Entity;
namespace App\Entity\UserSystem;
use App\Entity\Base\NamedDBElement;
use App\Security\Interfaces\HasPermissionsInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

View file

@ -32,7 +32,7 @@
namespace App\Repository;
use App\Entity\StructuralDBElement;
use App\Entity\Base\StructuralDBElement;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityRepository;

View file

@ -2,7 +2,7 @@
namespace App\Repository;
use App\Entity\User;
use App\Entity\UserSystem\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;

View file

@ -29,8 +29,8 @@
namespace App\Security\EntityListeners;
use App\Entity\Base\DBElement;
use App\Security\Annotations\ColumnSecurity;
use App\Entity\DBElement;
use Doctrine\Common\Annotations\Reader;
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;

View file

@ -29,7 +29,8 @@
namespace App\Security\Interfaces;
use App\Entity\PermissionsEmbed;
use App\Entity\UserSystem\PermissionsEmbed;
interface HasPermissionsInterface
{

View file

@ -32,8 +32,8 @@
namespace App\Security\Voter;
use App\Entity\Attachment;
use App\Entity\User;
use App\Entity\Attachments\Attachment;
use App\Entity\UserSystem\User;
class AttachmentVoter extends ExtendedVoter
{

View file

@ -29,7 +29,7 @@
namespace App\Security\Voter;
use App\Entity\User;
use App\Entity\UserSystem\User;
use App\Services\PermissionResolver;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

View file

@ -2,8 +2,8 @@
namespace App\Security\Voter;
use App\Entity\Part;
use App\Entity\User;
use App\Entity\Parts\Part;
use App\Entity\UserSystem\User;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
/**

View file

@ -32,14 +32,14 @@
namespace App\Security\Voter;
use App\Entity\AttachmentType;
use App\Entity\Category;
use App\Entity\Device;
use App\Entity\Footprint;
use App\Entity\Manufacturer;
use App\Entity\Storelocation;
use App\Entity\Supplier;
use App\Entity\User;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Device\Device;
use App\Entity\Parts\Category;
use App\Entity\Parts\Footprint;
use App\Entity\Parts\Manufacturer;
use App\Entity\Parts\Storelocation;
use App\Entity\Parts\Supplier;
use App\Entity\UserSystem\User;
class StructureVoter extends ExtendedVoter
{

View file

@ -29,7 +29,7 @@
namespace App\Security\Voter;
use App\Entity\User;
use App\Entity\UserSystem\User;
class UserVoter extends ExtendedVoter
{