diff --git a/ajax/output/getEntityData.php b/ajax/output/getEntityData.php index f5295632d98cc4b9f926d28eff721861d1c4f1c4..f67ad9dd2e501ee8773d94c102ac74dad812ead2 100644 --- a/ajax/output/getEntityData.php +++ b/ajax/output/getEntityData.php @@ -13,13 +13,17 @@ QUI::$Ajax->registerFunction( 'package_quiqqer_erp_ajax_output_getEntityData', - function ($entityId, $entityType) { + function ($entityId, $entityType, $entityPlugin) { $OutputProvider = ERPOutput::getOutputProviderByEntityType(Orthos::clear($entityType)); if (empty($OutputProvider)) { return false; } + if (empty($entityPlugin)) { + $entityPlugin = false; + } + $hideSystemDefaultTemplate = false; try { @@ -38,7 +42,7 @@ function ($entityId, $entityType) { } $Processes = new QUI\ERP\Processes(); - $Entity = $Processes->getEntity($entityId); + $Entity = $Processes->getEntity($entityId, $entityPlugin); return [ 'email' => $OutputProvider::getEmailAddress(Orthos::clear($entityId)), @@ -47,6 +51,6 @@ function ($entityId, $entityType) { 'prefixedNumber' => $Entity->getPrefixedNumber() ]; }, - ['entityId', 'entityType'], + ['entityId', 'entityType', 'entityPlugin'], 'Permission::checkAdminUser' ); diff --git a/bin/backend/controls/OutputDialog.js b/bin/backend/controls/OutputDialog.js index 9e5af3e0dbc84bbdd3dc3dab684c06aea341011a..92885ed543b8a60bf062c93242f9d8b5b17dd571 100644 --- a/bin/backend/controls/OutputDialog.js +++ b/bin/backend/controls/OutputDialog.js @@ -48,6 +48,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ options: { entityId: false, // Clean entity ID WITHOUT prefix and suffix entityType: false, // Entity type (e.g. "Invoice") + entityPlugin: false, comments: false, // Comments as array [must be readble by package/quiqqer/erp/bin/backend/controls/Comments] @@ -161,6 +162,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ new OutputMailEditor({ entityId: self.getAttribute('entityId'), entityType: self.getAttribute('entityType'), + entityPlugin: self.getAttribute('entityPlugin'), mailSubject: self.$Mail.subject, mailContent: self.$Mail.content, @@ -453,6 +455,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ src: URL_OPT_DIR + 'quiqqer/erp/bin/output/backend/print.php?' + Object.toQueryString({ id: entityId, t: self.getAttribute('entityType'), + ep: self.getAttribute('entityPlugin'), oid: self.getId(), tpl: self.$Template.id, tplpr: self.$Template.provider @@ -510,6 +513,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ src: URL_OPT_DIR + 'quiqqer/erp/bin/output/backend/download.php?' + Object.toQueryString({ id: entityId, t: self.getAttribute('entityType'), + ep: self.getAttribute('entityPlugin'), oid: self.getId(), tpl: self.$Template.id, tplpr: self.$Template.provider @@ -629,6 +633,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ 'package': 'quiqqer/erp', entityId: self.getAttribute('entityId'), entityType: self.getAttribute('entityType'), + entityPlugin: self.getAttribute('entityPlugin'), onError: reject }); }); @@ -646,6 +651,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ QUIAjax.get('package_quiqqer_erp_ajax_output_getTemplates', resolve, { 'package': 'quiqqer/erp', entityType: self.getAttribute('entityType'), + entityPlugin: self.getAttribute('entityPlugin'), onError: reject }); }); @@ -664,7 +670,8 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ 'package': 'quiqqer/erp', entity: JSON.encode({ id: self.getAttribute('entityId'), - type: self.getAttribute('entityType') + type: self.getAttribute('entityType'), + plugin: self.getAttribute('entityPlugin') }), template: JSON.encode(self.$Template), onError: reject @@ -686,6 +693,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ 'package': 'quiqqer/erp', entityId: self.getAttribute('entityId'), entityType: self.getAttribute('entityType'), + entityPlugin: self.getAttribute('entityPlugin'), template: self.$Template.id, templateProvider: self.$Template.provider, mailSubject: self.$Mail.subject, diff --git a/src/QUI/ERP/Processes.php b/src/QUI/ERP/Processes.php index 4ca0154089f198dde2ff5ada2c287ed25490a894..8d3196dc685bd535a0a8b7ef92068437147e3dc1 100644 --- a/src/QUI/ERP/Processes.php +++ b/src/QUI/ERP/Processes.php @@ -66,7 +66,7 @@ public function getEntity($entityHash, $entityPlugin = false): ErpEntityInterfac if ( ($entityPlugin === false || $entityPlugin === 'quiqqer/invoice') - && class_exists('QUI\ERP\Accounting\Invoice\Handle') + && class_exists('QUI\ERP\Accounting\Invoice\Handler') ) { try { return QUI\ERP\Accounting\Invoice\Handler::getInstance()->getInvoiceByHash($entityHash);