From 2444667f189cba24240f902c6c516b059c8c3e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Tue, 10 Dec 2024 17:17:57 +0100 Subject: [PATCH] tweak(Sales) add eInvoice ref fields to contracts --- tine20/Sales/Model/Contract.php | 30 +++++++++++++++++++++++++-- tine20/Sales/Setup/Update/17.php | 1 + tine20/Sales/js/ContractEditDialog.js | 6 +++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/tine20/Sales/Model/Contract.php b/tine20/Sales/Model/Contract.php index 3771804c07..f6ef2910d6 100644 --- a/tine20/Sales/Model/Contract.php +++ b/tine20/Sales/Model/Contract.php @@ -31,7 +31,11 @@ class Sales_Model_Contract extends Tinebase_Record_Abstract * */ const RELATION_TYPE_RESPONSIBLE = 'RESPONSIBLE'; - + + public const FLD_BUYER_REFERENCE = 'buyer_reference'; // varchar 255 + public const FLD_PURCHASE_ORDER_REFERENCE = 'purchase_order_reference'; + public const FLD_PROJECT_REFERENCE = 'project_reference'; + /** * holds the configuration object (must be declared in the concrete class) * @@ -45,7 +49,7 @@ class Sales_Model_Contract extends Tinebase_Record_Abstract * @var array */ protected static $_modelConfiguration = array( - self::VERSION => 11, + self::VERSION => 12, 'recordName' => 'Contract', // gettext('GENDER_Contract') 'recordsName' => 'Contracts', // ngettext('Contract', 'Contracts', n) 'hasRelations' => TRUE, @@ -214,6 +218,28 @@ class Sales_Model_Contract extends Tinebase_Record_Abstract ) ) ), + self::FLD_BUYER_REFERENCE => [ + self::LABEL => 'Buyer Reference', //_('Buyer Reference') + self::TYPE => self::TYPE_STRING, + self::LENGTH => 255, + self::NULLABLE => true, + self::QUERY_FILTER => true, + self::SHY => true, + ], + self::FLD_PURCHASE_ORDER_REFERENCE => [ + self::LABEL => 'Purchase Order Reference', // _('Purchase Order Reference') + self::TYPE => self::TYPE_STRING, + self::LENGTH => 255, + self::NULLABLE => true, + self::QUERY_FILTER => true, + ], + self::FLD_PROJECT_REFERENCE => [ + self::LABEL => 'Project Reference', // _('Project Reference') + self::TYPE => self::TYPE_STRING, + self::LENGTH => 255, + self::NULLABLE => true, + self::QUERY_FILTER => true, + ], 'contact_external' => array( 'type' => 'virtual', 'config' => array( diff --git a/tine20/Sales/Setup/Update/17.php b/tine20/Sales/Setup/Update/17.php index f0defca850..136c2ba607 100644 --- a/tine20/Sales/Setup/Update/17.php +++ b/tine20/Sales/Setup/Update/17.php @@ -826,6 +826,7 @@ public function update028(): void { Setup_SchemaTool::updateSchema([ Sales_Model_Invoice::class, + Sales_Model_Contract::class, ]); $this->addApplicationUpdate(Sales_Config::APP_NAME, '17.28', self::RELEASE017_UPDATE028); diff --git a/tine20/Sales/js/ContractEditDialog.js b/tine20/Sales/js/ContractEditDialog.js index 1b9f25db5a..ef293028dd 100644 --- a/tine20/Sales/js/ContractEditDialog.js +++ b/tine20/Sales/js/ContractEditDialog.js @@ -267,7 +267,11 @@ Tine.Sales.ContractEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, { modelUnique: true, ref: '../../../../../customerPicker', fieldLabel: this.app.i18n._('Customer') - }], [ Tine.widgets.form.RecordPickerManager.get('Sales', 'Address', { + }], [ + this.fieldManager('buyer_reference', { columnWidth: 0.5 }), + this.fieldManager('purchase_order_reference', { columnWidth: 0.25 }), + this.fieldManager('project_reference', { columnWidth: 0.25 }) + ], [ Tine.widgets.form.RecordPickerManager.get('Sales', 'Address', { fieldLabel: this.app.i18n._('Billing Address'), name: 'billing_address_id', ref: '../../../../../addressPicker',