Skip to content
Code-Schnipsel Gruppen Projekte
Commit 0ee1ce40 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

refactor: moved QUI\ERP\Accounting\Invoice\Articles\* to ERP

Übergeordneter 11a4d2cd
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
......@@ -225,7 +225,7 @@ public function __construct($attributes = [])
*
* @return ArticleView
*/
public function getView()
public function getView(): ArticleView
{
return new ArticleView($this);
}
......@@ -233,7 +233,7 @@ public function getView()
/**
* Return the Article ID
*
* @return mixed|string
* @return string|int
*/
public function getId()
{
......@@ -247,7 +247,7 @@ public function getId()
/**
* Return the Article Number
*
* @return mixed|string
* @return int|string
*/
public function getArticleNo()
{
......@@ -263,7 +263,7 @@ public function getArticleNo()
*
* @return string
*/
public function getTitle()
public function getTitle(): string
{
if (isset($this->attributes['title'])) {
return $this->attributes['title'];
......@@ -277,7 +277,7 @@ public function getTitle()
*
* @return null|QUI\Projects\Media\Image
*/
public function getImage()
public function getImage(): ?QUI\Projects\Media\Image
{
if (isset($this->attributes['image'])) {
try {
......@@ -322,7 +322,7 @@ public function getImage()
*
* @return string
*/
public function getDescription()
public function getDescription(): string
{
if (isset($this->attributes['description'])) {
return $this->attributes['description'];
......@@ -336,7 +336,7 @@ public function getDescription()
*
* @return QUI\ERP\Money\Price
*/
public function getUnitPrice()
public function getUnitPrice(): Price
{
$unitPrice = 0;
......@@ -370,7 +370,7 @@ public function getUnitPriceUnRounded(): Price
*
* @return QUI\ERP\Money\Price
*/
public function getSum()
public function getSum(): Price
{
$this->calc();
......@@ -434,7 +434,7 @@ public function getVat()
/**
* @return null|QUI\Interfaces\Users\User
*/
public function getUser()
public function getUser(): ?QUI\Interfaces\Users\User
{
return $this->User;
}
......@@ -455,7 +455,7 @@ public function setUser(QUI\Interfaces\Users\User $User)
*
* @return QUI\ERP\Currency\Currency|null
*/
public function getCurrency()
public function getCurrency(): ?QUI\ERP\Currency\Currency
{
return $this->Currency;
}
......@@ -489,7 +489,7 @@ public function getQuantity()
*
* @return Price
*/
public function getPrice()
public function getPrice(): Price
{
$this->calc();
......@@ -499,7 +499,7 @@ public function getPrice()
/**
* @return bool
*/
public function displayPrice()
public function displayPrice(): bool
{
return $this->displayPrice;
}
......@@ -509,7 +509,7 @@ public function displayPrice()
/**
* Set a discount to the article
*
* @param int $discount
* @param int|float $discount
* @param int $discountType - default = complement
*
* @todo überdenken, ganzer artikel ist eigentlich nicht änderbar
......@@ -533,7 +533,7 @@ public function setDiscount($discount, $discountType = Calc::CALCULATION_COMPLEM
*
* @return ArticleDiscount|null
*/
public function getDiscount()
public function getDiscount(): ?ArticleDiscount
{
if ($this->Discount) {
$this->Discount->setArticle($this);
......@@ -547,7 +547,7 @@ public function getDiscount()
*
* @return bool
*/
public function hasDiscount()
public function hasDiscount(): bool
{
return !!$this->getDiscount();
}
......@@ -558,7 +558,7 @@ public function hasDiscount()
* @param null|Calc|QUI\ERP\User $Instance
* @return self
*/
public function calc($Instance = null)
public function calc($Instance = null): Article
{
if ($this->calculated) {
return $this;
......@@ -608,7 +608,7 @@ public function calc($Instance = null)
*
* @return array
*/
public function toArray()
public function toArray(): array
{
$vat = $this->getVat();
$discount = '';
......@@ -678,7 +678,7 @@ public function toArray()
* @param string $key
* @return mixed|null
*/
public function getCustomField($key)
public function getCustomField(string $key)
{
if (isset($this->customFields[$key])) {
return $this->customFields[$key];
......@@ -690,7 +690,7 @@ public function getCustomField($key)
/**
* @return array
*/
public function getCustomFields()
public function getCustomFields(): array
{
return $this->customFields;
}
......@@ -698,7 +698,7 @@ public function getCustomFields()
/**
* @return array
*/
public function getCustomData()
public function getCustomData(): array
{
return $this->customData;
}
......
......@@ -27,17 +27,17 @@ public function __construct($attributes = []);
/**
* @return ArticleView
*/
public function getView();
public function getView(): ArticleView;
/**
* @return string
*/
public function getTitle();
public function getTitle(): string;
/**
* @return string
*/
public function getDescription();
public function getDescription(): string;
/**
* @return integer|float
......@@ -62,11 +62,12 @@ public function getQuantity();
/**
* @return array
*/
public function toArray();
public function toArray(): array;
/**
* is the price displayed or not
*
* @return bool
*/
public function displayPrice();
public function displayPrice(): bool;
}
<?php
/**
* This file contains QUI\ERP\Accounting\Invoice\Articles\Article
*/
namespace QUI\ERP\Accounting\Articles;
use QUI;
/**
* Article
* An temporary invoice article
*
* - Freier Artikel
*
* @package QUI\ERP\Accounting\Invoice
*/
class Article extends QUI\ERP\Accounting\Article
{
/**
* @inheritdoc
* @return array
*/
public function toArray(): array
{
return \array_merge(parent::toArray(), [
'class' => \get_class($this),
'control' => 'package/quiqqer/erp/bin/backend/controls/articles/Article'
]);
}
}
<?php
/**
* This file contains QUI\ERP\Accounting\Articles\Text
*/
namespace QUI\ERP\Accounting\Articles;
use QUI;
use QUI\ERP\Money\Price;
/**
* Article Text
*
* - An article containing only text
* - Can be used as an information item on an invoice
* - Does not have any values
*
* - Ein Artikel welcher nur Text beinhaltet
* - Kann als Informationsposition auf einer Rechnung verwendet werden
* - Besitzt keine Werte
*
* @package QUI\ERP\Accounting\Invoice
*/
class Text extends QUI\ERP\Accounting\Article
{
protected $displayPrice = false;
/**
* @inheritdoc
* @return QUI\ERP\Money\Price
*/
public function getUnitPrice(): Price
{
return new Price(0, QUI\ERP\Defaults::getCurrency());
}
/**
* @inheritdoc
* @return QUI\ERP\Money\Price
*/
public function getSum(): Price
{
return new Price(0, QUI\ERP\Defaults::getCurrency());
}
/**
* @inheritdoc
* @return bool
*/
public function getQuantity()
{
return 1;
}
/**
* @return bool
*/
public function displayPrice(): bool
{
return false;
}
/**
* @inheritdoc
* @return array
*/
public function toArray(): array
{
return \array_merge(parent::toArray(), [
'class' => \get_class($this),
'control' => 'package/quiqqer/erp/bin/backend/controls/articles/Text',
'displayPrice' => $this->displayPrice()
]);
}
}
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren