mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
f7c2f1032f
commit
21a81486df
24 changed files with 64 additions and 84 deletions
|
@ -34,7 +34,6 @@ namespace App\Entity\PriceInformations;
|
|||
|
||||
use App\Entity\Base\StructuralDBElement;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use s9e\TextFormatter\Configurator\TemplateNormalizations\AbstractChooseOptimization;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
|
|
|
@ -68,9 +68,6 @@ use App\Entity\Parts\Supplier;
|
|||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -110,7 +107,7 @@ class Orderdetail extends DBElement
|
|||
* @var string
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
protected $supplierpartnr = "";
|
||||
protected $supplierpartnr = '';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
|
@ -123,7 +120,7 @@ class Orderdetail extends DBElement
|
|||
* @ORM\Column(type="string")
|
||||
* @Assert\Url()
|
||||
*/
|
||||
protected $supplier_product_url = "";
|
||||
protected $supplier_product_url = '';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@ -205,8 +202,8 @@ class Orderdetail extends DBElement
|
|||
return $this->supplier_product_url;
|
||||
}
|
||||
|
||||
if ($this->supplier === null) {
|
||||
return "";
|
||||
if ($this->getSupplier() === null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
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
|
||||
* @param Part $part
|
||||
* @return Orderdetail
|
||||
*/
|
||||
public function setPart(Part $part)
|
||||
public function setPart(Part $part) : Orderdetail
|
||||
{
|
||||
$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.
|
||||
* @param $new_url string The new URL for the supplier URL.
|
||||
* @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
|
||||
if ($new_url == $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) {
|
||||
if ($new_url === $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class Pricedetail extends DBElement
|
|||
* @ORM\Column(type="decimal", precision=11, scale=5)
|
||||
* @Assert\Positive()
|
||||
*/
|
||||
protected $price = "0.0";
|
||||
protected $price = '0.0';
|
||||
|
||||
/**
|
||||
* @var ?Currency The currency used for the current price information.
|
||||
|
@ -210,11 +210,9 @@ class Pricedetail extends DBElement
|
|||
*/
|
||||
public function getPriceRelatedQuantity(): float
|
||||
{
|
||||
if ($this->orderdetail && $this->orderdetail->getPart()) {
|
||||
if (!$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->price_related_quantity);
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
}
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->price_related_quantity);
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
}
|
||||
return $this->price_related_quantity;
|
||||
}
|
||||
|
@ -227,17 +225,15 @@ class Pricedetail extends DBElement
|
|||
*
|
||||
* The amount is measured in part unit.
|
||||
*
|
||||
* @return int the minimum discount quantity
|
||||
* @return float the minimum discount quantity
|
||||
*
|
||||
* @see Pricedetail::setMinDiscountQuantity()
|
||||
*/
|
||||
public function getMinDiscountQuantity(): float
|
||||
{
|
||||
if ($this->orderdetail && $this->orderdetail->getPart()) {
|
||||
if (!$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->min_discount_quantity);
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
}
|
||||
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||
$tmp = round($this->min_discount_quantity);
|
||||
return $tmp < 1 ? 1 : $tmp;
|
||||
}
|
||||
|
||||
return $this->min_discount_quantity;
|
||||
|
@ -264,7 +260,7 @@ class Pricedetail extends DBElement
|
|||
* @param Orderdetail $orderdetail
|
||||
* @return $this
|
||||
*/
|
||||
public function setOrderdetail(Orderdetail $orderdetail)
|
||||
public function setOrderdetail(Orderdetail $orderdetail) : self
|
||||
{
|
||||
$this->orderdetail = $orderdetail;
|
||||
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
|
||||
* 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
|
||||
*/
|
||||
|
@ -337,7 +333,7 @@ class Pricedetail extends DBElement
|
|||
* (Each of this examples would be an own Pricedetails-object.
|
||||
* 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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue