diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 39f6fd8..2a1d8cc 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -41,7 +41,7 @@ "billing_type_is_template": { "description": "What kind of bill is it?", "name": "billing_type_is_template", - "type": "TINYINT", + "type": "TINYINT(1)", "null": false } } @@ -659,7 +659,7 @@ }, "billing_bill_subscription_account": { "name": "billing_bill_subscription_account", - "type": "TINYINT(1)", + "type": "INT", "null": true, "default": null, "foreignTable": "account", diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 2a4b676..fedf72f 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -37,6 +37,7 @@ use Modules\Media\Models\UploadStatus; use Modules\SupplierManagement\Models\NullSupplier; use Modules\SupplierManagement\Models\SupplierMapper; use phpOMS\Autoloader; +use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\ISO639x1Enum; use phpOMS\Localization\Money; use phpOMS\Message\Http\HttpRequest; diff --git a/Models/Bill.php b/Models/Bill.php index 407496b..f9ab7da 100755 --- a/Models/Bill.php +++ b/Models/Bill.php @@ -622,13 +622,13 @@ class Bill implements \JsonSerializable /** * Add Bill element. * - * @param mixed $element Bill element + * @param BillElement $element Bill element * * @return void * * @since 1.0.0 */ - public function addElement($element) : void + public function addElement(BillElement $element) : void { $this->elements[] = $element; } @@ -713,13 +713,13 @@ class Bill implements \JsonSerializable /** * Get media file by type * - * @param null|int $type Media type + * @param int $type Media type * * @return Media * * @since 1.0.0 */ - public function getFileByType(int $type = null) : Media + public function getFileByType(int $type) : Media { foreach ($this->media as $file) { if ($file->type->getId() === $type) { diff --git a/Models/BillElementMapper.php b/Models/BillElementMapper.php index 4c0d420..9b6eb3a 100755 --- a/Models/BillElementMapper.php +++ b/Models/BillElementMapper.php @@ -66,7 +66,7 @@ final class BillElementMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const BELONGS_TO = [ diff --git a/Models/BillMapper.php b/Models/BillMapper.php index 043b2e1..a241f87 100755 --- a/Models/BillMapper.php +++ b/Models/BillMapper.php @@ -86,7 +86,7 @@ class BillMapper extends DataMapperFactory /** * Has many relation. * - * @var array + * @var array * @since 1.0.0 */ public const HAS_MANY = [ @@ -113,7 +113,7 @@ class BillMapper extends DataMapperFactory /** * Has one relation. * - * @var array + * @var array * @since 1.0.0 */ public const OWNS_ONE = [ @@ -130,7 +130,7 @@ class BillMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const BELONGS_TO = [ diff --git a/Models/BillType.php b/Models/BillType.php index 12daebf..c295115 100755 --- a/Models/BillType.php +++ b/Models/BillType.php @@ -54,6 +54,8 @@ class BillType implements \JsonSerializable */ protected string | BaseStringL11n $l11n; + public bool $isTemplate = false; + /** * Constructor. * @@ -94,7 +96,8 @@ class BillType implements \JsonSerializable if ($l11n instanceof BaseStringL11n) { $this->l11n = $l11n; } elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) { - $this->l11n->content = $l11n; + $this->l11n->content = $l11n; + $this->l11n->setLanguage($lang); } else { $this->l11n = new BaseStringL11n(); $this->l11n->content = $l11n; @@ -110,6 +113,10 @@ class BillType implements \JsonSerializable */ public function getL11n() : string { + if (!isset($this->l11n)) { + return ''; + } + return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n; } diff --git a/Models/BillTypeL11nMapper.php b/Models/BillTypeL11nMapper.php index ac4bf90..be7f67b 100755 --- a/Models/BillTypeL11nMapper.php +++ b/Models/BillTypeL11nMapper.php @@ -59,7 +59,7 @@ final class BillTypeL11nMapper extends DataMapperFactory /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = BaseStringL11n::class; diff --git a/Models/BillTypeMapper.php b/Models/BillTypeMapper.php index 3aa8d0c..c907924 100755 --- a/Models/BillTypeMapper.php +++ b/Models/BillTypeMapper.php @@ -40,12 +40,13 @@ final class BillTypeMapper extends DataMapperFactory 'billing_type_template' => ['name' => 'billing_type_template', 'type' => 'int', 'internal' => 'template'], 'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'], 'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'], + 'billing_type_is_template' => ['name' => 'billing_type_is_template', 'type' => 'bool', 'internal' => 'isTemplate'], ]; /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ public const OWNS_ONE = [ @@ -58,7 +59,7 @@ final class BillTypeMapper extends DataMapperFactory /** * Has many relation. * - * @var array + * @var array * @since 1.0.0 */ public const HAS_MANY = [ @@ -74,7 +75,7 @@ final class BillTypeMapper extends DataMapperFactory /** * Belongs to. * - * @var array + * @var array * @since 1.0.0 */ /* @@ -89,7 +90,7 @@ final class BillTypeMapper extends DataMapperFactory /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = BillType::class; diff --git a/Models/PurchaseBillMapper.php b/Models/PurchaseBillMapper.php index 433e095..7f6d6c2 100755 --- a/Models/PurchaseBillMapper.php +++ b/Models/PurchaseBillMapper.php @@ -32,7 +32,7 @@ final class PurchaseBillMapper extends BillMapper /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = Bill::class; diff --git a/Models/SalesBillMapper.php b/Models/SalesBillMapper.php index 80f3e66..1422226 100755 --- a/Models/SalesBillMapper.php +++ b/Models/SalesBillMapper.php @@ -32,7 +32,7 @@ final class SalesBillMapper extends BillMapper /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = Bill::class; diff --git a/Models/StockBillMapper.php b/Models/StockBillMapper.php index 934c5f1..7a74349 100755 --- a/Models/StockBillMapper.php +++ b/Models/StockBillMapper.php @@ -29,7 +29,7 @@ final class StockBillMapper extends BillMapper /** * Model to use by the mapper. * - * @var string + * @var class-string * @since 1.0.0 */ public const MODEL = Bill::class; diff --git a/info.json b/info.json index 63015f3..006de7b 100755 --- a/info.json +++ b/info.json @@ -20,6 +20,7 @@ "Admin": "1.0.0", "Sales": "1.0.0", "Media": "1.0.0", + "Calendar": "1.0.0", "ItemManagement": "1.0.0", "ClientManagement": "1.0.0", "SupplierManagement": "1.0.0"