diff --git a/Admin/Install/Media.install.json b/Admin/Install/Media.install.json new file mode 100644 index 0000000..cb52c65 --- /dev/null +++ b/Admin/Install/Media.install.json @@ -0,0 +1,9 @@ +[ + { + "type": "collection", + "create_directory": true, + "name": "SupplierManagement", + "virtualPath": "/Modules", + "user": 1 + } +] \ No newline at end of file diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php new file mode 100644 index 0000000..588295c --- /dev/null +++ b/Admin/Install/Media.php @@ -0,0 +1,43 @@ + __DIR__ . '/Media.install.json']); + } +} diff --git a/Admin/Install/db.json b/Admin/Install/db.json index dfa1e7d..f080d42 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -107,5 +107,31 @@ "foreignKey": "suppliermgmt_supplier_id" } } + }, + "suppliermgmt_supplier_note": { + "name": "suppliermgmt_supplier_note", + "fields": { + "suppliermgmt_supplier_note_id": { + "name": "suppliermgmt_supplier_note_id", + "type": "INT", + "null": false, + "primary": true, + "autoincrement": true + }, + "suppliermgmt_supplier_note_dst": { + "name": "suppliermgmt_supplier_note_dst", + "type": "INT", + "null": false, + "foreignTable": "editor_doc", + "foreignKey": "editor_doc_id" + }, + "suppliermgmt_supplier_note_src": { + "name": "suppliermgmt_supplier_note_src", + "type": "INT", + "null": false, + "foreignTable": "suppliermgmt_supplier", + "foreignKey": "suppliermgmt_supplier_id" + } + } } } \ No newline at end of file diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 82d475d..ab4ba4a 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -197,4 +197,26 @@ final class ApiController extends Controller $this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Image', 'Image successfully updated', $uploaded); } + + /** + * Api method to create item files + * + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return void + * + * @api + * + * @since 1.0.0 + */ + public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : void + { + $request->setData('virtualpath', '/Modules/SupplierManagement/' . $request->getData('id'), true); + $this->app->moduleManager->get('Editor')->apiEditorCreate($request, $response, $data); + + $model = $response->get($request->uri->__toString())['response']; + $this->createModelRelation($request->header->account, $request->getData('id'), $model->getId(), SupplierMapper::class, 'notes', '', $request->getOrigin()); + } } diff --git a/Models/Supplier.php b/Models/Supplier.php index 98dc900..67c5fdf 100755 --- a/Models/Supplier.php +++ b/Models/Supplier.php @@ -16,6 +16,7 @@ namespace Modules\SupplierManagement\Models; use Modules\Admin\Models\Address; use Modules\Admin\Models\NullAddress; +use Modules\Editor\Models\EditorDoc; use Modules\Media\Models\Media; use Modules\Profile\Models\ContactElement; use Modules\Profile\Models\NullContactElement; @@ -53,6 +54,14 @@ class Supplier public Profile $profile; + /** + * Files. + * + * @var EditorDoc[] + * @since 1.0.0 + */ + private array $notes = []; + private array $files = []; private array $contactElements = []; @@ -193,6 +202,32 @@ class Supplier $this->info = $info; } + /** + * Add doc to item + * + * @param EditorDoc $note Note + * + * @return void + * + * @since 1.0.0 + */ + public function addNote(EditorDoc $note) : void + { + $this->notes[] = $note; + } + + /** + * Get notes + * + * @return EditorDoc[] + * + * @since 1.0.0 + */ + public function getNotes() : array + { + return $this->notes; + } + /** * Get media. * diff --git a/Models/SupplierMapper.php b/Models/SupplierMapper.php index 2d8aaa2..26f2f56 100755 --- a/Models/SupplierMapper.php +++ b/Models/SupplierMapper.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Modules\SupplierManagement\Models; use Modules\Admin\Models\AddressMapper; +use Modules\Editor\Models\EditorDocMapper; use Modules\Media\Models\MediaMapper; use Modules\Profile\Models\ContactElementMapper; use Modules\Profile\Models\ProfileMapper; @@ -102,6 +103,12 @@ final class SupplierMapper extends DataMapperAbstract 'external' => 'suppliermgmt_supplier_media_dst', 'self' => 'suppliermgmt_supplier_media_src', ], + 'notes' => [ + 'mapper' => EditorDocMapper::class, /* mapper of the related object */ + 'table' => 'suppliermgmt_supplier_note', /* table of the related object, null if no relation table is used (many->1) */ + 'external' => 'suppliermgmt_supplier_note_dst', + 'self' => 'suppliermgmt_supplier_note_src', + ], 'contactElements' => [ 'mapper' => ContactElementMapper::class, 'table' => 'suppliermgmt_supplier_contactelement', diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php old mode 100755 new mode 100644 index 1e51c08..9220701 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -4,7 +4,7 @@ * * PHP Version 8.0 * - * @package Modules\SupplierManagement + * @package Modules\Localization * @copyright Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 @@ -14,23 +14,33 @@ declare(strict_types=1); return ['SupplierManagement' => [ 'Accounting' => 'Buchhaltung', + 'Addition' => '', 'Address' => 'Addresse', 'Addresses' => 'Addressen', 'AreaManager' => 'Area Manager', 'Articlegroup' => 'Artikelgruppe', + 'Articles' => '', + 'Balance' => '', 'Bonus' => 'Bonus', 'Business' => 'Business', + 'CLV' => '', + 'Calendar' => '', 'City' => 'Stadt', 'Client' => 'Kunde', 'Clients' => 'Kunden', 'Contact' => 'Kontakt', 'Country' => 'Land', + 'Created' => '', + 'CreditRating' => '', 'Creditcard' => 'Kreditkarte', + 'DSO' => '', + 'DUE' => '', 'Date' => 'Datum', 'Default' => 'Standard', 'Delivery' => 'Lieferung', 'Discount' => 'Rabatt', 'DiscountP' => 'Rabatt %', + 'Documents' => '', 'Email' => 'Email', 'Fax' => 'Fax', 'Files' => 'Dateien', @@ -39,31 +49,51 @@ return ['SupplierManagement' => [ 'ID' => 'ID', 'Info' => 'Info', 'Invoice' => 'Rechnung', + 'Invoices' => '', 'IsDefault' => 'Ist Standard?', + 'LastContact' => '', + 'LastOrder' => '', 'Log' => 'Log', 'Logs' => 'Logs', + 'MRR' => '', + 'MTDSales' => '', + 'Main' => '', + 'Margin' => '', 'Master' => 'Master', + 'Messages' => '', + 'Modified' => '', + 'Modules' => '', 'Name' => 'Name', 'Name1' => 'Name1', 'Name2' => 'Name2', 'Name3' => 'Name3', + 'Net' => '', + 'Notes' => '', + 'Number' => '', 'Office' => 'Büro', 'Payment' => 'Zahlung', 'PaymentTerm' => 'Zahlungsziel', + 'Permission' => '', 'Phone' => 'Telefon', + 'Postal' => '', 'Price' => 'Preis', 'Prices' => 'Preise', 'Private' => 'Privat', 'Productgroup' => 'Produktgruppe', + 'Profile' => '', 'Purchase' => 'Einkauf', 'Quantity' => 'Anzahl', + 'RecentInvoices' => '', 'Sales' => 'Umsatz', 'Segment' => 'Segment', + 'Segments' => '', 'Subtype' => 'Untergruppe', 'Supplier' => 'Lieferant', 'Suppliers' => 'Lieferanten', 'Support' => 'Support', + 'Tags' => '', 'Type' => 'Typ', 'Wire' => 'Wire', + 'YTDSales' => '', 'Zip' => 'Postleitzahl', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php old mode 100755 new mode 100644 index 495d6a6..a916327 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -4,7 +4,7 @@ * * PHP Version 8.0 * - * @package Modules\SupplierManagement + * @package Modules\Localization * @copyright Dennis Eichhorn * @license OMS License 1.0 * @version 1.0.0 @@ -13,45 +13,87 @@ declare(strict_types=1); return ['SupplierManagement' => [ - 'Accounting' => 'Accounting', - 'Address' => 'Address', - 'Addresses' => 'Addresses', - 'Articlegroup' => 'Articlegroup', - 'City' => 'City', - 'Contact' => 'Contact', - 'Country' => 'Country', - 'Creditcard' => 'Creditcard', - 'Date' => 'Date', - 'Default' => 'Default', - 'Delivery' => 'Delivery', - 'Email' => 'Email', - 'Fax' => 'Fax', - 'Files' => 'Files', - 'Freightage' => 'Freightage', - 'Group' => 'Group', - 'Info' => 'Info', - 'Invoice' => 'Invoice', - 'IsDefault' => 'Is default', - 'Log' => 'Log', - 'Logs' => 'Logs', - 'Master' => 'Master', - 'Name' => 'Name', - 'Name1' => 'Name1', - 'Name2' => 'Name2', - 'Name3' => 'Name3', - 'Office' => 'Office', - 'Payment' => 'Payment', - 'PaymentTerm' => 'Payment Term', - 'Phone' => 'Phone', - 'Productgroup' => 'Productgroup', - 'Purchase' => 'Purchase', - 'Sales' => 'Sales', - 'Segment' => 'Segment', - 'Subtype' => 'Subtype', - 'Supplier' => 'Supplier', - 'Suppliers' => 'Suppliers', - 'Support' => 'Support', - 'Type' => 'Type', - 'Wire' => 'Wire', - 'Zip' => 'Zip', + 'Accounting' => 'Accounting', + 'Addition' => 'Addition', + 'Address' => 'Address', + 'Addresses' => 'Addresses', + 'AreaManager' => 'Area Manager', + 'Articlegroup' => 'Articlegroup', + 'Articles' => 'Articles', + 'Balance' => 'Balance', + 'Bonus' => 'Bonus', + 'Business' => 'Business', + 'CLV' => 'CLV', + 'Calendar' => 'Calendar', + 'City' => 'City', + 'Client' => 'Client', + 'Clients' => 'Clients', + 'Contact' => 'Contact', + 'Country' => 'Country', + 'Created' => 'Created', + 'CreditRating' => 'Credit Rating', + 'Creditcard' => 'Creditcard', + 'DSO' => 'DSO', + 'DUE' => 'Due', + 'Date' => 'Date', + 'Default' => 'Default', + 'Delivery' => 'Delivery', + 'Discount' => 'Discount', + 'DiscountP' => 'Discount %', + 'Documents' => 'Documents', + 'Email' => 'Email', + 'Fax' => 'Fax', + 'Files' => 'Files', + 'Freightage' => 'Freightage', + 'Group' => 'Group', + 'ID' => 'ID', + 'Info' => 'Info', + 'Invoice' => 'Invoice', + 'Invoices' => 'Invoices', + 'IsDefault' => 'Is default', + 'LastContact' => 'Last Contact', + 'LastOrder' => 'Last Order', + 'Log' => 'Log', + 'Logs' => 'Logs', + 'MRR' => 'MRR', + 'MTDSales' => 'MTD Sales', + 'Main' => 'Main', + 'Margin' => 'Margin', + 'Master' => 'Master', + 'Messages' => 'Messages', + 'Modified' => 'Modified', + 'Modules' => 'Modules', + 'Name' => 'Name', + 'Name1' => 'Name1', + 'Name2' => 'Name2', + 'Name3' => 'Name3', + 'Net' => 'Net', + 'Notes' => 'Notes', + 'Number' => 'Number', + 'Office' => 'Office', + 'Payment' => 'Payment', + 'PaymentTerm' => 'Payment Term', + 'Permission' => 'Permission', + 'Phone' => 'Phone', + 'Postal' => 'Postal', + 'Price' => 'Price', + 'Prices' => 'Prices', + 'Private' => 'Private', + 'Productgroup' => 'Productgroup', + 'Profile' => 'Profile', + 'Purchase' => 'Purchase', + 'Quantity' => 'Quantity', + 'RecentInvoices' => 'Recent Invoices', + 'Sales' => 'Sales', + 'Segment' => 'Segment', + 'Segments' => 'Segments', + 'Subtype' => 'Subtype', + 'Supplier' => 'Supplier', + 'Suppliers' => 'Suppliers', + 'Support' => 'Support', + 'Tags' => 'Tags', + 'Type' => 'Type', + 'Wire' => 'Wire', + 'YTDSales' => 'YTD Sales', + 'Zip' => 'Zip', ]]; diff --git a/Theme/Backend/supplier-profile.tpl.php b/Theme/Backend/supplier-profile.tpl.php index 3e7b8f7..3499c54 100755 --- a/Theme/Backend/supplier-profile.tpl.php +++ b/Theme/Backend/supplier-profile.tpl.php @@ -22,6 +22,8 @@ $countries = \phpOMS\Localization\ISO3166NameEnum::getConstants(); * @var \Modules\SupplierManagement\Models\Supplier $supplier */ $supplier = $this->getData('supplier'); +$notes = $supplier->getNotes(); +$files = $supplier->getFiles(); $newestInvoices = $this->getData('newestInvoices') ?? []; $monthlyPurchaseCosts = $this->getData('monthlyPurchaseCosts') ?? []; @@ -126,7 +128,7 @@ echo $this->getData('nav')->render();
| = $this->getHtml('YTDSales'); ?>: | ||||||||||||||||||||
| = $this->getHtml('MTDSales'); ?>:
@@ -143,7 +145,7 @@ echo $this->getData('nav')->render();
-
|