diff --git a/ajax/output/getEntityData.php b/ajax/output/getEntityData.php index 25a0da7f825e34c4c431c93ec9f582e224261b35..01c822a9ea01dd2dbf0ecd39cc3f44f93004e8ac 100644 --- a/ajax/output/getEntityData.php +++ b/ajax/output/getEntityData.php @@ -1,25 +1,28 @@ <?php use QUI\ERP\Output\Output as ERPOutput; +use QUI\Utils\Security\Orthos; /** - * Returns the invoice templates + * Returns basic entity data used in OutputDialog * + * @param string|int $entityId + * @param string $entityType * @return array|false - Entity data or false */ QUI::$Ajax->registerFunction( 'package_quiqqer_erp_ajax_output_getEntityData', - function ($entityId, $provider) { - $OutputProvider = ERPOutput::getOutputProviderByPackage($provider); + function ($entityId, $entityType) { + $OutputProvider = ERPOutput::getOutputProviderByEntityType(Orthos::clear($entityType)); if (empty($OutputProvider)) { return false; } return [ - 'email' => $OutputProvider::getEmailAddress($entityId) + 'email' => $OutputProvider::getEmailAddress(Orthos::clear($entityId)) ]; }, - ['entityId', 'provider'], + ['entityId', 'entityType'], 'Permission::checkAdminUser' ); diff --git a/bin/backend/controls/OutputDialog.js b/bin/backend/controls/OutputDialog.js index 026793324429947ad11f941185246806e326a6f4..980848f91f23aa8629264edfb89fab5b5adb9cb2 100644 --- a/bin/backend/controls/OutputDialog.js +++ b/bin/backend/controls/OutputDialog.js @@ -35,7 +35,10 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ '$onOpen', '$onOutputChange', '$onPrintFinish', - '$getPreview' + '$getPreview', + '$onChangeToEmail', + '$onChangeToPDF', + '$onChangeToPrint' ], options: { @@ -62,10 +65,10 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ } }); - this.$Output = null; - this.$Preview = null; - this.$cutomerMail = null; - this.$Template = null; + this.$Output = null; + this.$Preview = null; + this.$customerMail = null; + this.$Template = null; this.$Mail = { subject: false, @@ -252,7 +255,7 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ self.$renderPreview(); // Customer data - self.$cutomerMail = EntityData.email; + self.$customerMail = EntityData.email; self.$onOutputChange(); self.Loader.hide(); @@ -494,8 +497,8 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ Submit.setAttribute('text', QUILocale.get(lg, 'controls.OutputDialog.data.output.email.btn')); Submit.setAttribute('textimage', 'fa fa-envelope-o'); - if (this.$cutomerMail && Recipient.value === '') { - Recipient.value = this.$cutomerMail; + if (this.$customerMail && Recipient.value === '') { + Recipient.value = this.$customerMail; } Recipient.focus(); @@ -511,9 +514,10 @@ define('package/quiqqer/erp/bin/backend/controls/OutputDialog', [ return new Promise(function (resolve, reject) { QUIAjax.get('package_quiqqer_erp_ajax_output_getEntityData', resolve, { - 'package': 'quiqqer/erp', - entityId : self.getAttribute('entityId'), - onError : reject + 'package' : 'quiqqer/erp', + entityId : self.getAttribute('entityId'), + entityType: self.getAttribute('entityType'), + onError : reject }) }); },