Skip to content

Commit

Permalink
tweak(Sales Documents) Reversal process streamlined UI
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusweiss committed Sep 13, 2024
1 parent e77b600 commit 1d25a6e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
21 changes: 12 additions & 9 deletions tine20/Sales/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,13 @@ class Sales_Config extends Tinebase_Config_Abstract
],
[
'id' => Sales_Model_Document_Abstract::STATUS_REVERSAL,
//_('Reversal (booked, open)')
'value' => 'Reversal (booked, open)',
//_('Reversal (booked, closed)')
'value' => 'Reversal (booked, closed)',
'icon' => null,
Sales_Model_Document_Status::FLD_BOOKED => true,
Sales_Model_Document_Status::FLD_CLOSED => false,
Sales_Model_Document_Status::FLD_CLOSED => true,
Sales_Model_Document_Status::FLD_REVERSAL => true,
Sales_Model_Document_Status::FLD_IS_USER_TYPE => false,
'system' => true
],
],
Expand Down Expand Up @@ -575,12 +576,13 @@ class Sales_Config extends Tinebase_Config_Abstract
'system' => true
], [
'id' => Sales_Model_Document_Abstract::STATUS_REVERSAL,
//_('Reversal (booked, open)')
'value' => 'Reversal (booked, open)',
//_('Reversal (booked, closed)')
'value' => 'Reversal (booked, closed)',
'icon' => null,
Sales_Model_Document_Status::FLD_BOOKED => true,
Sales_Model_Document_Status::FLD_CLOSED => false,
Sales_Model_Document_Status::FLD_CLOSED => true,
Sales_Model_Document_Status::FLD_REVERSAL => true,
Sales_Model_Document_Status::FLD_IS_USER_TYPE => false,
'system' => true
],
],
Expand Down Expand Up @@ -693,12 +695,13 @@ class Sales_Config extends Tinebase_Config_Abstract
'system' => true
], [
'id' => Sales_Model_Document_Abstract::STATUS_REVERSAL,
//_('Reversal (booked, open)')
'value' => 'Reversal (booked, open)',
//_('Reversal (booked, closed)')
'value' => 'Reversal (booked, closed)',
'icon' => null,
Sales_Model_Document_Status::FLD_BOOKED => true,
Sales_Model_Document_Status::FLD_CLOSED => false,
Sales_Model_Document_Status::FLD_CLOSED => true,
Sales_Model_Document_Status::FLD_REVERSAL => true,
Sales_Model_Document_Status::FLD_IS_USER_TYPE => false,
'system' => true
],
],
Expand Down
2 changes: 1 addition & 1 deletion tine20/Sales/Model/Document/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract class Sales_Model_Document_Abstract extends Tinebase_Record_NewAbstract
{
public const MODEL_NAME_PART = 'Document_Abstract'; // als konkrete document_types gibt es Offer, Order, Delivery, Invoice (keine Gutschrift!)

public const STATUS_REVERSAL = 'reversal';
public const STATUS_REVERSAL = 'REVERSAL';

public const FLD_ID = 'id';
public const FLD_DOCUMENT_NUMBER = 'document_number'; // kommt aus incrementable, in config einstellen welches incrementable fuer dieses model da ist!
Expand Down
2 changes: 2 additions & 0 deletions tine20/Sales/Model/Document/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class Sales_Model_Document_Status extends Tinebase_Config_KeyFieldRecord
public const FLD_BOOKED = 'booked';
public const FLD_CLOSED = 'closed';
public const FLD_REVERSAL = 'reversal';
public const FLD_IS_USER_TYPE = 'is_user_type';

protected $_additionalValidators = [
self::FLD_BOOKED => ['allowEmpty' => true ],
self::FLD_CLOSED => ['allowEmpty' => true ],
self::FLD_REVERSAL => ['allowEmpty' => true ],
self::FLD_IS_USER_TYPE => ['allowEmpty' => true ],
];
}
13 changes: 7 additions & 6 deletions tine20/Tinebase/js/widgets/keyfield/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,7 @@ Tine.Tinebase.widgets.keyfield.ComboBox = Ext.extend(Ext.form.ComboBox, {
}

this.store = Tine.Tinebase.widgets.keyfield.StoreMgr.get(this.app, this.keyFieldName);

// filter for userType if records contain is_user_type (NOTE: keyFieldRecord Models are not announce yet)
if(this.store.getAt(0)?.json.hasOwnProperty('is_user_type')) {
this.store.filterBy((r) => {return !!+r.json.is_user_type});
}


if (this.sortBy) {
this.store.sort(this.sortBy);
}
Expand Down Expand Up @@ -158,6 +153,12 @@ Tine.Tinebase.widgets.keyfield.ComboBox = Ext.extend(Ext.form.ComboBox, {
},

doQuery: function() {

// filter for userType if records contain is_user_type (NOTE: keyFieldRecord Models are not announce yet)
this.store.filterBy((r) => {
return ! (r.json.hasOwnProperty('is_user_type') && +r.json.is_user_type === 0)
});

this.onLoad();
}
});
Expand Down

0 comments on commit 1d25a6e

Please sign in to comment.