taxtank-core 2.1.46 → 2.1.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27630,9 +27630,9 @@ class TransactionBaseFilterForm extends FormGroup {
27630
27630
  if (value.tankType) {
27631
27631
  collection = collection.filterBy('tankType', value.tankType);
27632
27632
  }
27633
- const businesses = value.businesses instanceof Array ? value.businesses : [value.businesses];
27634
- if (businesses?.length) {
27635
- collection = collection.filterBy('business.id', businesses.map(business => business.id));
27633
+ const businessIds = this.getBusinessIds();
27634
+ if (businessIds.length) {
27635
+ collection = collection.filterBy('business.id', businessIds);
27636
27636
  }
27637
27637
  if (value.properties?.length) {
27638
27638
  collection = collection.filterBy('property.id', value.properties.map(property => property.id));
@@ -27658,8 +27658,9 @@ class TransactionBaseFilterForm extends FormGroup {
27658
27658
  if (value.properties?.length) {
27659
27659
  rules = rules.filterByProperties(value.properties);
27660
27660
  }
27661
- if (value.businesses?.length) {
27662
- rules = rules.filterBy('business.id', value.businesses.map(business => business.id));
27661
+ const businessIds = this.getBusinessIds();
27662
+ if (businessIds.length) {
27663
+ rules = rules.filterBy('business.id', businessIds);
27663
27664
  }
27664
27665
  return rules;
27665
27666
  }
@@ -27675,11 +27676,18 @@ class TransactionBaseFilterForm extends FormGroup {
27675
27676
  if (value.properties?.length) {
27676
27677
  reminders = reminders.filterByProperties(value.properties);
27677
27678
  }
27678
- if (value.businesses?.length) {
27679
- reminders = reminders.filterBy('business.id', value.businesses.map(business => business.id));
27679
+ const businessIds = this.getBusinessIds();
27680
+ if (businessIds.length) {
27681
+ reminders = reminders.filterBy('business.id', businessIds);
27680
27682
  }
27681
27683
  return reminders;
27682
27684
  }
27685
+ getBusinessIds() {
27686
+ if (!this.value.businesses) {
27687
+ return [];
27688
+ }
27689
+ return (this.value.businesses instanceof Array ? this.value.businesses : [this.value.businesses]).map(b => b.id);
27690
+ }
27683
27691
  }
27684
27692
 
27685
27693
  class DepreciationForm extends TransactionBaseForm {