diff --git a/Admin/Install/db.json b/Admin/Install/db.json index f934ac2..142d2a6 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -40,5 +40,45 @@ "null": false } } + }, + "exchange_log": { + "name": "exchange_log", + "fields": { + "exchange_log_id": { + "name": "exchange_log_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "exchange_log_message": { + "name": "exchange_log_message", + "type": "TEXT", + "null": false + }, + "exchange_log_fields": { + "name": "exchange_log_fields", + "type": "TEXT", + "null": false + }, + "exchange_log_type": { + "name": "exchange_log_type", + "type": "TINYINT", + "null": false + }, + "exchange_log_time": { + "name": "exchange_log_time", + "type": "DATETIME", + "null": false + }, + "exchange_log_exchange": { + "name": "exchange_log_exchange", + "type": "INT", + "default": null, + "null": true, + "foreignTable": "exchange", + "foreignKey": "exchange_id" + } + } } } \ No newline at end of file diff --git a/Interfaces/GSD/Model/ExchangeType.php b/Interfaces/GSD/Model/ExchangeType.php new file mode 100755 index 0000000..5661953 --- /dev/null +++ b/Interfaces/GSD/Model/ExchangeType.php @@ -0,0 +1,47 @@ + ['name' => 'AdressRowId', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'NAME1' => ['name' => 'NAME1', 'type' => 'string', 'internal' => 'name1'], 'NAME2' => ['name' => 'NAME2', 'type' => 'string', 'internal' => 'name2'], diff --git a/Interfaces/GSD/Model/GSDArticle.php b/Interfaces/GSD/Model/GSDArticle.php index 95da32a..892a622 100755 --- a/Interfaces/GSD/Model/GSDArticle.php +++ b/Interfaces/GSD/Model/GSDArticle.php @@ -38,7 +38,7 @@ final class GSDArticle * @var \DateTime * @since 1.0.0 */ - private \DateTime $createdAt; + private \DateTimeImmutable $createdAt; /** * Article number. @@ -135,7 +135,7 @@ final class GSDArticle */ public function __construct() { - $this->createdAt = new \DateTime('now'); + $this->createdAt = new \DateTimeImmutable('now'); } /** diff --git a/Interfaces/GSD/Model/GSDArticleMapper.php b/Interfaces/GSD/Model/GSDArticleMapper.php index 97a55d7..97b7704 100755 --- a/Interfaces/GSD/Model/GSDArticleMapper.php +++ b/Interfaces/GSD/Model/GSDArticleMapper.php @@ -34,7 +34,7 @@ final class GSDArticleMapper extends DataMapperAbstract */ protected static array $columns = [ 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'Artikelnummer' => ['name' => 'Artikelnummer', 'type' => 'string', 'internal' => 'number'], 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], diff --git a/Interfaces/GSD/Model/GSDCostCenter.php b/Interfaces/GSD/Model/GSDCostCenter.php index 12dd03d..dff7e4b 100755 --- a/Interfaces/GSD/Model/GSDCostCenter.php +++ b/Interfaces/GSD/Model/GSDCostCenter.php @@ -46,7 +46,7 @@ final class GSDCostCenter implements \JsonSerializable * @var \DateTime * @since 1.0.0 */ - protected \DateTime $createdAt; + protected \DateTimeImmutable $createdAt; /** * Description. @@ -71,7 +71,7 @@ final class GSDCostCenter implements \JsonSerializable */ public function __construct() { - $this->createdAt = new \DateTime('now'); + $this->createdAt = new \DateTimeImmutable('now'); } /** @@ -79,7 +79,7 @@ final class GSDCostCenter implements \JsonSerializable * * @since 1.0.0 */ - public function getCreatedAt() : \DateTime + public function getCreatedAt() : \DateTimeInterface { return $this->createdAt ?? new \DateTime(); } diff --git a/Interfaces/GSD/Model/GSDCostCenterMapper.php b/Interfaces/GSD/Model/GSDCostCenterMapper.php index d8004db..4c41134 100755 --- a/Interfaces/GSD/Model/GSDCostCenterMapper.php +++ b/Interfaces/GSD/Model/GSDCostCenterMapper.php @@ -34,7 +34,7 @@ final class GSDCostCenterMapper extends DataMapperAbstract */ protected static array $columns = [ 'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'KST' => ['name' => 'KST', 'type' => 'string', 'internal' => 'costcenter'], 'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'], diff --git a/Interfaces/GSD/Model/GSDCostObject.php b/Interfaces/GSD/Model/GSDCostObject.php index 7320b0a..3242489 100755 --- a/Interfaces/GSD/Model/GSDCostObject.php +++ b/Interfaces/GSD/Model/GSDCostObject.php @@ -46,7 +46,7 @@ final class GSDCostObject implements \JsonSerializable * @var \DateTime * @since 1.0.0 */ - protected \DateTime $createdAt; + protected \DateTimeImmutable $createdAt; /** * Description. @@ -71,7 +71,7 @@ final class GSDCostObject implements \JsonSerializable */ public function __construct() { - $this->createdAt = new \DateTime('now'); + $this->createdAt = new \DateTimeImmutable('now'); } /** @@ -79,7 +79,7 @@ final class GSDCostObject implements \JsonSerializable * * @since 1.0.0 */ - public function getCreatedAt() : \DateTime + public function getCreatedAt() : \DateTimeInterface { return $this->createdAt ?? new \DateTime(); } diff --git a/Interfaces/GSD/Model/GSDCostObjectMapper.php b/Interfaces/GSD/Model/GSDCostObjectMapper.php index 6ebfcfa..8829e9c 100755 --- a/Interfaces/GSD/Model/GSDCostObjectMapper.php +++ b/Interfaces/GSD/Model/GSDCostObjectMapper.php @@ -34,7 +34,7 @@ final class GSDCostObjectMapper extends DataMapperAbstract */ protected static array $columns = [ 'ROW_ID' => ['name' => 'ROW_ID', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'KTR' => ['name' => 'KTR', 'type' => 'string', 'internal' => 'costobject'], 'Bezeichnung' => ['name' => 'Bezeichnung', 'type' => 'string', 'internal' => 'description'], diff --git a/Interfaces/GSD/Model/GSDCustomer.php b/Interfaces/GSD/Model/GSDCustomer.php index ea4bbb7..1426a10 100755 --- a/Interfaces/GSD/Model/GSDCustomer.php +++ b/Interfaces/GSD/Model/GSDCustomer.php @@ -46,7 +46,7 @@ final class GSDCustomer * @var \DateTime * @since 1.0.0 */ - protected \DateTime $createdAt; + protected \DateTimeImmutable $createdAt; /** * Customer number @@ -138,7 +138,7 @@ final class GSDCustomer public function __construct() { $this->addr = new GSDAddress(); - $this->createdAt = new \DateTime('now'); + $this->createdAt = new \DateTimeImmutable('now'); } /** diff --git a/Interfaces/GSD/Model/GSDCustomerMapper.php b/Interfaces/GSD/Model/GSDCustomerMapper.php index 3f8267c..a841b0c 100755 --- a/Interfaces/GSD/Model/GSDCustomerMapper.php +++ b/Interfaces/GSD/Model/GSDCustomerMapper.php @@ -34,7 +34,7 @@ final class GSDCustomerMapper extends DataMapperAbstract */ protected static array $columns = [ 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'Kundennummer' => ['name' => 'Kundennummer', 'type' => 'string', 'internal' => 'number'], 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], diff --git a/Interfaces/GSD/Model/GSDSupplier.php b/Interfaces/GSD/Model/GSDSupplier.php index 0a74e45..96b8b1e 100755 --- a/Interfaces/GSD/Model/GSDSupplier.php +++ b/Interfaces/GSD/Model/GSDSupplier.php @@ -46,7 +46,7 @@ final class GSDSupplier * @var \DateTime * @since 1.0.0 */ - protected \DateTime $createdAt; + protected \DateTimeImmutable $createdAt; /** * Customer number @@ -114,7 +114,7 @@ final class GSDSupplier public function __construct() { $this->addr = new GSDAddress(); - $this->createdAt = new \DateTime('now'); + $this->createdAt = new \DateTimeImmutable('now'); } /** diff --git a/Interfaces/GSD/Model/GSDSupplierMapper.php b/Interfaces/GSD/Model/GSDSupplierMapper.php index 6a8cfb4..d989dce 100755 --- a/Interfaces/GSD/Model/GSDSupplierMapper.php +++ b/Interfaces/GSD/Model/GSDSupplierMapper.php @@ -34,7 +34,7 @@ final class GSDSupplierMapper extends DataMapperAbstract */ protected static array $columns = [ 'row_id' => ['name' => 'row_id', 'type' => 'int', 'internal' => 'id'], - 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTime', 'internal' => 'createdAt', 'readonly' => true], + 'row_create_time' => ['name' => 'row_create_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'row_create_user' => ['name' => 'row_create_user', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true], 'LieferantenNummer' => ['name' => 'LieferantenNummer', 'type' => 'string', 'internal' => 'number'], 'Info' => ['name' => 'Info', 'type' => 'string', 'internal' => 'info'], diff --git a/Models/ExchangeLog.php b/Models/ExchangeLog.php new file mode 100644 index 0000000..30d044f --- /dev/null +++ b/Models/ExchangeLog.php @@ -0,0 +1,200 @@ +createdAt = new \DateTimeImmutableImmutable('now'); + } + + /** + * Get type. + * + * @return int + * + * @since 1.0.0 + */ + public function getType() : int + { + return $this->type; + } + + /** + * Set type. + * + * @param int $type Exchange type + * + * @return void + * + * @since 1.0.0 + */ + public function setType(int $type) : void + { + $this->type = $type; + } + + /** + * Get id + * + * @return int + * + * @since 1.0.0 + */ + public function getId() : int + { + return $this->id; + } + + /** + * @return string + * + * @since 1.0.0 + */ + public function getMessage() : string + { + return $this->message; + } + + /** + * Set message + * + * @param string $message Log message + * + * @return void + * + * @since 1.0.0 + */ + public function setMessage(string $title) : void + { + $this->message = $message; + } + + /** + * Get fields. + * + * @return array + * + * @since 1.0.0 + */ + public function getFields() : array + { + return $this->fields; + } + + /** + * Set fields. + * + * @param array $fields Exchange fields + * + * @return void + * + * @since 1.0.0 + */ + public function setFields(array $fields) : void + { + $this->fields = $fields; + } + + /** + * Get created at. + * + * @return array + * + * @since 1.0.0 + */ + public function getCreatedAt() : \DateTimeInterfaceInterface + { + return $this->createdAt; + } + + /** + * {@inheritdoc} + */ + public function toArray() : array + { + return [ + 'id' => $this->id, + 'message' => $this->message, + 'type' => $this->type, + 'fields' => $this->fields, + 'datetime' => $this->createdAt, + ]; + } + + /** + * {@inheritdoc} + */ + public function jsonSerialize() + { + return $this->toArray(); + } +} diff --git a/Models/ExchangeLogMapper.php b/Models/ExchangeLogMapper.php new file mode 100644 index 0000000..0b1f269 --- /dev/null +++ b/Models/ExchangeLogMapper.php @@ -0,0 +1,66 @@ + + * @since 1.0.0 + */ + protected static array $columns = [ + 'exchange_log_id' => ['name' => 'exchange_log_id', 'type' => 'int', 'internal' => 'id'], + 'exchange_log_message' => ['name' => 'exchange_log_message', 'type' => 'string', 'internal' => 'message'], + 'exchange_log_fields' => ['name' => 'exchange_log_fields', 'type' => 'Json', 'internal' => 'fields'], + 'exchange_log_type' => ['name' => 'exchange_log_type', 'type' => 'int', 'internal' => 'type'], + 'exchange_log_time' => ['name' => 'exchange_log_time', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'], + ]; + + /** + * Model to use by the mapper. + * + * @var string + * @since 1.0.0 + */ + protected static string $model = ExchangeLog::class; + + /** + * Primary table. + * + * @var string + * @since 1.0.0 + */ + protected static string $table = 'exchange_log'; + + /** + * Primary field name. + * + * @var string + * @since 1.0.0 + */ + protected static string $primaryField = 'exchange_log_id'; +} \ No newline at end of file diff --git a/Models/ExchangeType.php b/Models/ExchangeType.php old mode 100755 new mode 100644 index 06fc2d8..a82c4f3 --- a/Models/ExchangeType.php +++ b/Models/ExchangeType.php @@ -27,21 +27,7 @@ use phpOMS\Stdlib\Base\Enum; */ abstract class ExchangeType extends Enum { - public const CUSTOMER = 1; + public const IMPORT = 1; - public const SUPPLIER = 2; - - public const ARTICLE = 3; - - public const BOOKING = 4; - - public const ACCOUNT = 5; - - public const ADDRESS = 6; - - public const COSTCENTER = 7; - - public const COSTOBJECT = 8; - - public const INVOICE = 9; + public const EXPORT = 2; }