Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2019-09-16 22:04:59 +02:00
parent f7c2f1032f
commit 21a81486df
24 changed files with 64 additions and 84 deletions

View file

@ -41,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* @Route("/attachment_type") * @Route("/attachment_type")

View file

@ -108,7 +108,9 @@ abstract class BaseAdminController extends AbstractController
$this->addFlash('success', $this->translator->trans('entity.created_flash')); $this->addFlash('success', $this->translator->trans('entity.created_flash'));
return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]); return $this->redirectToRoute($this->route_base . '_edit', ['id' => $new_entity->getID()]);
} elseif ($form->isSubmitted() && ! $form->isValid()) { }
if ($form->isSubmitted() && ! $form->isValid()) {
$this->addFlash('error', $this->translator->trans('entity.created_flash.invalid')); $this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
} }

View file

@ -32,7 +32,6 @@
namespace App\Controller\AdminPages; namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Form\AdminPages\CategoryAdminForm; use App\Form\AdminPages\CategoryAdminForm;
use App\Services\EntityExporter; use App\Services\EntityExporter;
@ -42,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* @Route("/category") * @Route("/category")

View file

@ -32,7 +32,6 @@
namespace App\Controller\AdminPages; namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\PriceInformations\Currency; use App\Entity\PriceInformations\Currency;
use App\Form\AdminPages\CurrencyAdminForm; use App\Form\AdminPages\CurrencyAdminForm;
use App\Services\EntityExporter; use App\Services\EntityExporter;
@ -42,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* @Route("/currency") * @Route("/currency")

View file

@ -32,8 +32,6 @@
namespace App\Controller\AdminPages; namespace App\Controller\AdminPages;
use App\Entity\Attachments\AttachmentType;
use App\Entity\Devices\Device; use App\Entity\Devices\Device;
use App\Form\AdminPages\BaseEntityAdminForm; use App\Form\AdminPages\BaseEntityAdminForm;
use App\Services\EntityExporter; use App\Services\EntityExporter;
@ -43,7 +41,6 @@ use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* @Route("/device") * @Route("/device")

View file

@ -30,15 +30,11 @@
namespace App\Controller; namespace App\Controller;
use App\Entity\Base\NamedDBElement;
use App\Entity\Base\StructuralDBElement;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
use App\Form\AttachmentFormType;
use App\Form\Part\PartBaseType; use App\Form\Part\PartBaseType;
use App\Services\AttachmentHelper; use App\Services\AttachmentHelper;
use App\Services\PricedetailHelper; use App\Services\PricedetailHelper;
use App\Services\StructuralElementRecursionHelper;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
@ -177,7 +173,9 @@ class PartController extends AbstractController
$this->addFlash('success', $translator->trans('part.created_flash')); $this->addFlash('success', $translator->trans('part.created_flash'));
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
} elseif ($form->isSubmitted() && ! $form->isValid()) { }
if ($form->isSubmitted() && ! $form->isValid()) {
$this->addFlash('error', $translator->trans('part.created_flash.invalid')); $this->addFlash('error', $translator->trans('part.created_flash.invalid'));
} }

View file

@ -178,7 +178,7 @@ class PartListsController extends AbstractController
/** /**
* @Route("/parts/search/{keyword}", name="parts_search") * @Route("/parts/search/{keyword}", name="parts_search")
*/ */
public function showSearch(Request $request, DataTableFactory $dataTable, string $keyword = "") public function showSearch(Request $request, DataTableFactory $dataTable, string $keyword = '')
{ {
$search = $keyword; $search = $keyword;

View file

@ -34,7 +34,6 @@ namespace App\Controller;
use App\Entity\UserSystem\User; use App\Entity\UserSystem\User;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class RedirectController extends AbstractController class RedirectController extends AbstractController
{ {
@ -52,11 +51,9 @@ class RedirectController extends AbstractController
//Check if a user has set a preferred language setting: //Check if a user has set a preferred language setting:
$user = $this->getUser(); $user = $this->getUser();
if ($user instanceof User) { if (($user instanceof User) && !empty($user->getLanguage())) {
if(!empty($user->getLanguage())) {
$locale = $user->getLanguage(); $locale = $user->getLanguage();
} }
}
//$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri()); //$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri());
$new_url = $request->getUriForPath('/' . $locale . $request->getPathInfo()); $new_url = $request->getUriForPath('/' . $locale . $request->getPathInfo());

View file

@ -23,11 +23,9 @@ declare(strict_types=1);
namespace App\Entity\Attachments; namespace App\Entity\Attachments;
use App\Entity\Base\DBElement;
use App\Entity\Base\NamedDBElement; use App\Entity\Base\NamedDBElement;
use App\Validator\Constraints\Selectable; use App\Validator\Constraints\Selectable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Class Attachment. * Class Attachment.
@ -52,7 +50,7 @@ abstract class Attachment extends NamedDBElement
* @var string The filename using the %BASE% variable * @var string The filename using the %BASE% variable
* @ORM\Column(type="string", name="filename") * @ORM\Column(type="string", name="filename")
*/ */
protected $path = ""; protected $path = '';
/** /**
* ORM mapping is done in sub classes (like PartAttachment) * ORM mapping is done in sub classes (like PartAttachment)
@ -101,8 +99,8 @@ abstract class Attachment extends NamedDBElement
{ {
//return static::isUrl($this->getPath()); //return static::isUrl($this->getPath());
//Treat all pathes without a filepath as external //Treat all pathes without a filepath as external
return (strpos($this->getPath(), "%MEDIA%") === false) return (strpos($this->getPath(), '%MEDIA%') === false)
&& (strpos($this->getPath(), "%BASE") === false); && (strpos($this->getPath(), '%BASE') === false);
} }
/******************************************************************************** /********************************************************************************
@ -270,7 +268,7 @@ abstract class Attachment extends NamedDBElement
//Only set if the URL is not empty //Only set if the URL is not empty
if (!empty($url)) { if (!empty($url)) {
if (strpos($url, '%BASE%') !== false || strpos($url, '%MEDIA%') !== false) { if (strpos($url, '%BASE%') !== false || strpos($url, '%MEDIA%') !== false) {
throw new \InvalidArgumentException("You can not reference internal files via the url field! But nice try!"); throw new \InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
} }
$this->path = $url; $this->path = $url;

View file

@ -56,7 +56,6 @@ use App\Entity\Base\NamedDBElement;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Exception;
/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()

View file

@ -56,7 +56,6 @@ use App\Entity\Base\StructuralDBElement;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use s9e\TextFormatter\Configurator\RendererGenerators\PHP\XPathConvertor\Convertors\SingleByteStringManipulation;
/** /**
* Class AttachmentType. * Class AttachmentType.

View file

@ -52,7 +52,7 @@ class PartAttachment extends Attachment
public function setElement(AttachmentContainingDBElement $element): Attachment public function setElement(AttachmentContainingDBElement $element): Attachment
{ {
if (!$element instanceof Part) { if (!$element instanceof Part) {
throw new \InvalidArgumentException("The element associated with a PartAttachment must be a Part!"); throw new \InvalidArgumentException('The element associated with a PartAttachment must be a Part!');
} }
$this->element = $element; $this->element = $element;

View file

@ -142,7 +142,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
* *
* @throws \InvalidArgumentException if there was an error * @throws \InvalidArgumentException if there was an error
*/ */
public function isChildOf(StructuralDBElement $another_element) public function isChildOf(StructuralDBElement $another_element) : bool
{ {
$class_name = \get_class($this); $class_name = \get_class($this);

View file

@ -61,7 +61,6 @@ declare(strict_types=1);
namespace App\Entity\Parts; namespace App\Entity\Parts;
use App\Entity\Attachments\Attachment;
use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Devices\Device; use App\Entity\Devices\Device;
use App\Entity\Parts\PartTraits\AdvancedPropertyTrait; use App\Entity\Parts\PartTraits\AdvancedPropertyTrait;
@ -70,11 +69,8 @@ use App\Entity\Parts\PartTraits\BasicPropertyTrait;
use App\Entity\Parts\PartTraits\InstockTrait; use App\Entity\Parts\PartTraits\InstockTrait;
use App\Entity\Parts\PartTraits\ManufacturerTrait; use App\Entity\Parts\PartTraits\ManufacturerTrait;
use App\Entity\Parts\PartTraits\OrderTrait; use App\Entity\Parts\PartTraits\OrderTrait;
use App\Entity\PriceInformations\Orderdetail;
use App\Security\Annotations\ColumnSecurity; use App\Security\Annotations\ColumnSecurity;
use App\Validator\Constraints\Selectable;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
@ -116,6 +112,18 @@ class Part extends AttachmentContainingDBElement
*/ */
protected $lastModified; protected $lastModified;
/***************************************************************
* Overriden properties
* (They are defined here and not in a trait, to avoid conflicts)
****************************************************************/
/**
* @var string The name of this part
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="name")
*/
protected $name = '';
/** /**
* @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=false) * @ORM\OneToMany(targetEntity="App\Entity\Attachments\PartAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=false)
* @ColumnSecurity(type="collection", prefix="attachments") * @ColumnSecurity(type="collection", prefix="attachments")

View file

@ -40,13 +40,6 @@ use App\Validator\Constraints\Selectable;
trait BasicPropertyTrait trait BasicPropertyTrait
{ {
/**
* @var string The name of this part
* @ORM\Column(type="string")
* @ColumnSecurity(prefix="name")
*/
protected $name = '';
/** /**
* @var string A text describing what this part does * @var string A text describing what this part does
* @ORM\Column(type="text") * @ORM\Column(type="text")
@ -182,7 +175,7 @@ trait BasicPropertyTrait
* @param Category $category The new category of this part * @param Category $category The new category of this part
* @return self * @return self
*/ */
public function setCategory(Category $category): Part public function setCategory(Category $category): self
{ {
$this->category = $category; $this->category = $category;
return $this; return $this;
@ -196,7 +189,7 @@ trait BasicPropertyTrait
* *
* @return self * @return self
*/ */
public function setFootprint(?Footprint $new_footprint): Part public function setFootprint(?Footprint $new_footprint): self
{ {
$this->footprint = $new_footprint; $this->footprint = $new_footprint;
return $this; return $this;

View file

@ -33,7 +33,6 @@ namespace App\Entity\Parts\PartTraits;
use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\MeasurementUnit;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot; use App\Entity\Parts\PartLot;
use App\Security\Annotations\ColumnSecurity; use App\Security\Annotations\ColumnSecurity;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
@ -181,7 +180,7 @@ trait InstockTrait
/** /**
* Set the minimum amount of parts that have to be instock. * Set the minimum amount of parts that have to be instock.
* See getPartUnit() for the associated unit. * See getPartUnit() for the associated unit.
* @param int $new_minamount the new count of parts which should be in stock at least * @param float $new_minamount the new count of parts which should be in stock at least
* @return self * @return self
*/ */
public function setMinAmount(float $new_minamount): self public function setMinAmount(float $new_minamount): self

View file

@ -73,7 +73,7 @@ trait ManufacturerTrait
* @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""}) * @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""})
* @ColumnSecurity(type="string", prefix="status", placeholder="") * @ColumnSecurity(type="string", prefix="status", placeholder="")
*/ */
protected $manufacturing_status = ""; protected $manufacturing_status = '';
/** /**
* Get the link to the website of the article on the manufacturers website * Get the link to the website of the article on the manufacturers website

View file

@ -158,7 +158,7 @@ trait OrderTrait
* *
* @param bool $new_manual_order the new "manual_order" attribute * @param bool $new_manual_order the new "manual_order" attribute
* @param int $new_order_quantity the new order quantity * @param int $new_order_quantity the new order quantity
* @param int|null $new_order_orderdetails_id * the ID of the new order orderdetails * @param Orderdetail|null $new_order_orderdetail * the ID of the new order orderdetails
* * or Zero for "no order orderdetails" * * or Zero for "no order orderdetails"
* * or NULL for automatic order orderdetails * * or NULL for automatic order orderdetails
* (if the part has exactly one orderdetails, * (if the part has exactly one orderdetails,
@ -167,7 +167,7 @@ trait OrderTrait
* *
* @return self * @return self
*/ */
public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): Part public function setManualOrder(bool $new_manual_order, int $new_order_quantity = 1, ?Orderdetail $new_order_orderdetail = null): self
{ {
//Assert::greaterThan($new_order_quantity, 0, 'The new order quantity must be greater zero. Got %s!'); //Assert::greaterThan($new_order_quantity, 0, 'The new order quantity must be greater zero. Got %s!');

View file

@ -62,7 +62,6 @@ declare(strict_types=1);
namespace App\Entity\Parts; namespace App\Entity\Parts;
use App\Entity\Base\PartsContainingDBElement; use App\Entity\Base\PartsContainingDBElement;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**

View file

@ -117,14 +117,16 @@ class Supplier extends Company
protected $parts; protected $parts;
/** /**
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
* @return ?Currency * @return ?Currency
*/ */
public function getDefaultCurrency() public function getDefaultCurrency() : ?Currency
{ {
return $this->default_currency; return $this->default_currency;
} }
/** /**
* Sets the default currency.
* @param ?Currency $default_currency * @param ?Currency $default_currency
* @return Supplier * @return Supplier
*/ */
@ -135,16 +137,17 @@ class Supplier extends Company
} }
/** /**
* @return ?string * Gets the shipping costs for an order with this supplier, given in base currency.
* @return string|null A bcmath string with the shipping costs
*/ */
public function getShippingCosts() : ?string public function getShippingCosts() : ?string
{ {
dump($this);
return $this->shipping_costs; return $this->shipping_costs;
} }
/** /**
* @param ?string $shipping_costs * Sets the shipping costs for an order with this supplier.
* @param string|null $shipping_costs A bcmath string with the shipping costs.
* @return Supplier * @return Supplier
*/ */
public function setShippingCosts(?string $shipping_costs) : Supplier public function setShippingCosts(?string $shipping_costs) : Supplier

View file

@ -34,7 +34,6 @@ namespace App\Entity\PriceInformations;
use App\Entity\Base\StructuralDBElement; use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use s9e\TextFormatter\Configurator\TemplateNormalizations\AbstractChooseOptimization;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;

View file

@ -68,9 +68,6 @@ use App\Entity\Parts\Supplier;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
use Exception;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Constraints as Assert;
/** /**
@ -110,7 +107,7 @@ class Orderdetail extends DBElement
* @var string * @var string
* @ORM\Column(type="string") * @ORM\Column(type="string")
*/ */
protected $supplierpartnr = ""; protected $supplierpartnr = '';
/** /**
* @var bool * @var bool
@ -123,7 +120,7 @@ class Orderdetail extends DBElement
* @ORM\Column(type="string") * @ORM\Column(type="string")
* @Assert\Url() * @Assert\Url()
*/ */
protected $supplier_product_url = ""; protected $supplier_product_url = '';
public function __construct() public function __construct()
{ {
@ -205,8 +202,8 @@ class Orderdetail extends DBElement
return $this->supplier_product_url; return $this->supplier_product_url;
} }
if ($this->supplier === null) { if ($this->getSupplier() === null) {
return ""; return '';
} }
return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr); // maybe an automatic url is available... return $this->getSupplier()->getAutoProductUrl($this->supplierpartnr); // maybe an automatic url is available...
@ -282,10 +279,12 @@ class Orderdetail extends DBElement
/** /**
* Sets a new part with which this orderdetail is associated * Sets a new part with which this orderdetail is associated
* @param Part $part * @param Part $part
* @return Orderdetail
*/ */
public function setPart(Part $part) public function setPart(Part $part) : Orderdetail
{ {
$this->part = $part; $this->part = $part;
return $this;
} }
/** /**
@ -330,12 +329,11 @@ class Orderdetail extends DBElement
* Set this to "", if the function getSupplierProductURL should return the automatic generated URL. * Set this to "", if the function getSupplierProductURL should return the automatic generated URL.
* @param $new_url string The new URL for the supplier URL. * @param $new_url string The new URL for the supplier URL.
* @return Orderdetail * @return Orderdetail
* @return Orderdetail
*/ */
public function setSupplierProductUrl(string $new_url) public function setSupplierProductUrl(string $new_url) : Orderdetail
{ {
//Only change the internal URL if it is not the auto generated one //Only change the internal URL if it is not the auto generated one
if ($new_url == $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) { if ($new_url === $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) {
return $this; return $this;
} }

View file

@ -96,7 +96,7 @@ class Pricedetail extends DBElement
* @ORM\Column(type="decimal", precision=11, scale=5) * @ORM\Column(type="decimal", precision=11, scale=5)
* @Assert\Positive() * @Assert\Positive()
*/ */
protected $price = "0.0"; protected $price = '0.0';
/** /**
* @var ?Currency The currency used for the current price information. * @var ?Currency The currency used for the current price information.
@ -210,12 +210,10 @@ class Pricedetail extends DBElement
*/ */
public function getPriceRelatedQuantity(): float public function getPriceRelatedQuantity(): float
{ {
if ($this->orderdetail && $this->orderdetail->getPart()) { if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
if (!$this->orderdetail->getPart()->useFloatAmount()) {
$tmp = round($this->price_related_quantity); $tmp = round($this->price_related_quantity);
return $tmp < 1 ? 1 : $tmp; return $tmp < 1 ? 1 : $tmp;
} }
}
return $this->price_related_quantity; return $this->price_related_quantity;
} }
@ -227,18 +225,16 @@ class Pricedetail extends DBElement
* *
* The amount is measured in part unit. * The amount is measured in part unit.
* *
* @return int the minimum discount quantity * @return float the minimum discount quantity
* *
* @see Pricedetail::setMinDiscountQuantity() * @see Pricedetail::setMinDiscountQuantity()
*/ */
public function getMinDiscountQuantity(): float public function getMinDiscountQuantity(): float
{ {
if ($this->orderdetail && $this->orderdetail->getPart()) { if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
if (!$this->orderdetail->getPart()->useFloatAmount()) {
$tmp = round($this->min_discount_quantity); $tmp = round($this->min_discount_quantity);
return $tmp < 1 ? 1 : $tmp; return $tmp < 1 ? 1 : $tmp;
} }
}
return $this->min_discount_quantity; return $this->min_discount_quantity;
} }
@ -264,7 +260,7 @@ class Pricedetail extends DBElement
* @param Orderdetail $orderdetail * @param Orderdetail $orderdetail
* @return $this * @return $this
*/ */
public function setOrderdetail(Orderdetail $orderdetail) public function setOrderdetail(Orderdetail $orderdetail) : self
{ {
$this->orderdetail = $orderdetail; $this->orderdetail = $orderdetail;
return $this; return $this;
@ -311,7 +307,7 @@ class Pricedetail extends DBElement
* If 100pcs costs 20$, you have to set the price to 20$ and the price related * If 100pcs costs 20$, you have to set the price to 20$ and the price related
* quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically. * quantity to 100. The single price (20$/100 = 0.2$) will be calculated automatically.
* *
* @param int $new_price_related_quantity the price related quantity * @param float $new_price_related_quantity the price related quantity
* *
* @return self * @return self
*/ */
@ -337,7 +333,7 @@ class Pricedetail extends DBElement
* (Each of this examples would be an own Pricedetails-object. * (Each of this examples would be an own Pricedetails-object.
* So the orderdetails would have three Pricedetails for one supplier.) * So the orderdetails would have three Pricedetails for one supplier.)
* *
* @param int $new_min_discount_quantity the minimum discount quantity * @param float $new_min_discount_quantity the minimum discount quantity
* *
* @return self * @return self
*/ */

View file

@ -182,22 +182,22 @@ class User extends NamedDBElement implements UserInterface, HasPermissionsInterf
* @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", fetch="EAGER") * @ORM\ManyToOne(targetEntity="App\Entity\PriceInformations\Currency", fetch="EAGER")
* @ORM\JoinColumn(name="currency_id", referencedColumnName="id") * @ORM\JoinColumn(name="currency_id", referencedColumnName="id")
*/ */
protected $currency = ""; protected $currency = '';
/** /**
* @ORM\Column(type="text", name="config_image_path") * @ORM\Column(type="text", name="config_image_path")
*/ */
protected $image_path = ""; protected $image_path = '';
/** /**
* @ORM\Column(type="text", name="config_instock_comment_w") * @ORM\Column(type="text", name="config_instock_comment_w")
*/ */
protected $instock_comment_w = ""; protected $instock_comment_w = '';
/** /**
* @ORM\Column(type="text", name="config_instock_comment_a") * @ORM\Column(type="text", name="config_instock_comment_a")
*/ */
protected $instock_comment_a = ""; protected $instock_comment_a = '';
public function __construct() public function __construct()
{ {