Skip to content

Commit

Permalink
Tweak C_Tax window; Fix: always filter C_Tax by org; tweak logging
Browse files Browse the repository at this point in the history
also make orgId non-null to reduce FUD and because we always have it anyways

#11130
  • Loading branch information
metas-ts committed Jun 25, 2021
1 parent 20d803f commit 697ea11
Show file tree
Hide file tree
Showing 4 changed files with 232 additions and 25 deletions.
@@ -0,0 +1,213 @@

-- 2021-06-21T10:33:17.580Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=20,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=573764
;

-- 2021-06-21T10:33:17.604Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=30,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2254
;

-- 2021-06-21T10:33:17.610Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=40,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=573974
;

-- 2021-06-21T10:33:17.614Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=50,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=573975
;

-- 2021-06-21T10:33:17.619Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=60,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3695
;

-- 2021-06-21T10:33:17.624Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=70,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2250
;

-- 2021-06-21T10:33:17.629Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=80,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2252
;

-- 2021-06-21T10:33:17.634Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=90,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=573976
;

-- 2021-06-21T10:33:17.638Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=100,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=574444
;

-- 2021-06-21T10:33:17.642Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=110,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3054
;

-- 2021-06-21T10:33:17.647Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=120,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=574445
;

-- 2021-06-21T10:33:17.651Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsSelectionColumn='Y', SelectionColumnSeqNo=130,Updated=TO_TIMESTAMP('2021-06-21 12:33:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2242
;

-- 2021-06-21T10:33:47.806Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET FilterOperator='B',Updated=TO_TIMESTAMP('2021-06-21 12:33:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3054
;

-- 2021-06-21T10:33:58.909Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsShowFilterInline='Y', FilterOperator='B',Updated=TO_TIMESTAMP('2021-06-21 12:33:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=574444
;

-- 2021-06-21T10:34:05.997Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsShowFilterInline='Y',Updated=TO_TIMESTAMP('2021-06-21 12:34:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3054
;

-- 2021-06-21T10:36:45.950Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsShowFilterInline='N',Updated=TO_TIMESTAMP('2021-06-21 12:36:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3054
;

-- 2021-06-21T10:36:57.937Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET IsShowFilterInline='N',Updated=TO_TIMESTAMP('2021-06-21 12:36:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=574444
;

-- 2021-06-21T10:39:08.998Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field (AD_Tab_ID,IsDisplayed,DisplayLength,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,IsActive,Created,CreatedBy,IsReadOnly,Updated,UpdatedBy,Help,AD_Field_ID,IsDisplayedGrid,AD_Column_ID,Description,Name,AD_Org_ID,EntityType) VALUES (174,'N',14,'N','N','N','N',0,'Y',TO_TIMESTAMP('2021-06-21 12:39:08','YYYY-MM-DD HH24:MI:SS'),100,'N',TO_TIMESTAMP('2021-06-21 12:39:08','YYYY-MM-DD HH24:MI:SS'),100,'"Reihenfolge" bestimmt die Reihenfolge der Einträge',649735,'N',574445,'Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst','Reihenfolge',0,'D')
;

-- 2021-06-21T10:39:08.999Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language, t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y'AND (l.IsSystemLanguage='Y') AND t.AD_Field_ID=649735 AND NOT EXISTS (SELECT 1 FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;

-- 2021-06-21T10:39:09.032Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select update_FieldTranslation_From_AD_Name_Element(566)
;

-- 2021-06-21T10:39:09.060Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
DELETE FROM AD_Element_Link WHERE AD_Field_ID=649735
;

-- 2021-06-21T10:39:09.062Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
/* DDL */ select AD_Element_Link_Create_Missing_Field(649735)
;

-- 2021-06-21T10:39:59.555Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=110, AD_UI_ElementGroup_ID=540519,Updated=TO_TIMESTAMP('2021-06-21 12:39:59','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=585274
;

-- 2021-06-21T10:40:12.749Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=120, AD_UI_ElementGroup_ID=540519,Updated=TO_TIMESTAMP('2021-06-21 12:40:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=585275
;

-- 2021-06-21T10:41:03.889Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=40,Updated=TO_TIMESTAMP('2021-06-21 12:41:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584459
;

-- 2021-06-21T10:41:10.519Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNo=30,Updated=TO_TIMESTAMP('2021-06-21 12:41:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584674
;

-- 2021-06-21T10:41:44.488Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_UI_Element (UpdatedBy,AD_UI_Element_ID,Help,AD_Client_ID,CreatedBy,SeqNo,SeqNoGrid,IsDisplayed_SideList,SeqNo_SideList,AD_Org_ID,AD_UI_ElementType,IsAllowFiltering,MultiLine_LinesCount,IsMultiLine,Description,AD_UI_ElementGroup_ID,Name,AD_Field_ID,AD_Tab_ID,Created,Updated,IsActive,IsAdvancedField,IsDisplayed,IsDisplayedGrid) VALUES (100,586801,'"Reihenfolge" bestimmt die Reihenfolge der Einträge',0,100,20,0,'N',0,0,'F','N',0,'N','Zur Bestimmung der Reihenfolge der Einträge; die kleinste Zahl kommt zuerst',545777,'SeqNo',649735,174,TO_TIMESTAMP('2021-06-21 12:41:44','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2021-06-21 12:41:44','YYYY-MM-DD HH24:MI:SS'),'Y','N','Y','N')
;

---
-- 2021-06-21T10:43:14.473Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=50, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=586801
;

-- 2021-06-21T10:43:14.479Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=60, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584680
;

-- 2021-06-21T10:43:14.484Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=70, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584681
;

-- 2021-06-21T10:43:14.489Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=80, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=585278
;

-- 2021-06-21T10:43:14.496Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=90, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584679
;

-- 2021-06-21T10:43:14.501Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=100, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584676
;

-- 2021-06-21T10:43:14.505Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=110, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584460
;

-- 2021-06-21T10:43:14.510Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=120, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=584675
;

-- 2021-06-21T10:43:14.515Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=130, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=585274
;

-- 2021-06-21T10:43:14.519Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=140, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=585275
;

-- 2021-06-21T10:43:14.522Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=150, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544924
;

-- 2021-06-21T10:43:14.526Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_UI_Element SET SeqNoGrid=160, IsDisplayedGrid='Y',Updated=TO_TIMESTAMP('2021-06-21 12:43:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_UI_Element_ID=544930
;

-- 2021-06-21T10:44:35.192Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Column SET AD_Reference_ID=11, DefaultValue='0', FilterOperator='E',Updated=TO_TIMESTAMP('2021-06-21 12:44:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=574445
;

-- 2021-06-21T10:44:39.731Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO t_alter_column values('c_tax','SeqNo','NUMERIC(10)',null,'0')
;

-- 2021-06-21T10:44:40.053Z
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE C_Tax SET SeqNo=0 WHERE SeqNo IS NULL
;

select migrationscript_ignore('43-de.metas.acct/5594890_sys_gh11130_tweak_tax_window.sql');
Expand Up @@ -102,6 +102,7 @@ public class InvoiceLineBL implements IInvoiceLineBL
private final IOrgDAO orgDAO = Services.get(IOrgDAO.class);
private final IPricingBL pricingBL = Services.get(IPricingBL.class);
private final IPriceListBL priceListBL = Services.get(IPriceListBL.class);
private final IPriceListDAO priceListDAO = Services.get(IPriceListDAO.class);
private final ITaxBL taxBL = Services.get(ITaxBL.class);

@Override
Expand Down Expand Up @@ -156,7 +157,7 @@ public boolean setTaxBasedOnShipment(final org.compiere.model.I_C_InvoiceLine il
@Override
public boolean setTaxForInvoiceLine(
final org.compiere.model.I_C_InvoiceLine il,
final OrgId orgId,
@NonNull final OrgId orgId,
final Timestamp taxDate,
final CountryId countryFromId,
final BPartnerLocationId partnerLocationId,
Expand Down Expand Up @@ -276,15 +277,14 @@ private TaxCategoryId getTaxCategoryFromProductPrice(
final org.compiere.model.I_C_InvoiceLine invoiceLine,
final I_C_Invoice invoice)
{
final IPriceListDAO priceListDAO = Services.get(IPriceListDAO.class);

final ZoneId timeZone = orgDAO.getTimeZone(OrgId.ofRepoId(invoice.getAD_Org_ID()));
final Boolean processedPLVFiltering = null; // task 09533: the user doesn't know about PLV's processed flag, so we can't filter by it

final PriceListId priceListId = PriceListId.ofRepoId(invoice.getM_PriceList_ID());

final I_M_PriceList_Version priceListVersion = priceListDAO.retrievePriceListVersionOrNull(
priceListId,
TimeUtil.asZonedDateTime(invoice.getDateInvoiced()),
TimeUtil.asZonedDateTime(invoice.getDateInvoiced(), timeZone),
processedPLVFiltering);
Check.errorIf(priceListVersion == null, "Missing PLV for M_PriceList and DateInvoiced of {}", invoice);

Expand Down
Expand Up @@ -41,7 +41,7 @@
@Value
public class TaxQuery
{
@Nullable
@NonNull
OrgId orgId;

@Nullable
Expand All @@ -66,7 +66,7 @@ public class TaxQuery
TaxCategoryId taxCategoryId;

@Builder
public TaxQuery(@Nullable final OrgId orgId,
public TaxQuery(@NonNull final OrgId orgId,
@Nullable final WarehouseId warehouseId,
@Nullable final CountryId fromCountryId,
@Nullable final Timestamp dateOfInterest,
Expand All @@ -90,14 +90,5 @@ public TaxQuery(@Nullable final OrgId orgId,
}
this.isSoTrx = isSoTrx;
this.taxCategoryId = taxCategoryId;
validate();
}

private void validate()
{
if (orgId == null && warehouseId == null)
{
throw new AdempiereException("At least one of the given orgId or warehouseId needs to be non-empty: " + this);
}
}
}
Expand Up @@ -254,7 +254,7 @@ public Tax getBy(@NonNull final TaxQuery taxQuery)
final Timestamp dateOfInterest = taxQuery.getDateOfInterest();
final OrgId orgId = taxQuery.getOrgId();

if (bpartnerId != null && orgId != null && retrieveIsTaxExemptSmallBusiness(bpartnerId, dateOfInterest))
if (bpartnerId != null && retrieveIsTaxExemptSmallBusiness(bpartnerId, dateOfInterest))
{
final TaxId exemptTax = retrieveExemptTax(orgId);
return getTaxById(exemptTax);
Expand All @@ -268,15 +268,15 @@ public Tax getBy(@NonNull final TaxQuery taxQuery)
final boolean multipleTaxesWithSameSeq = Objects.equals(firstTax.getSeqNo(), secondTax.getSeqNo());
if (multipleTaxesWithSameSeq)
{
throw new AdempiereException("Multiple taxes have the same seqNo: " + firstTax.getTaxId() + " and " + secondTax.getTaxId())
throw new AdempiereException("Multiple taxes have the same seqNo: C_Tax_ID=" + TaxId.toRepoId(firstTax.getTaxId()) + " and C_Tax_ID=" + TaxId.toRepoId(secondTax.getTaxId()))
.appendParametersToMessage()
.setParameter("taxQuery", taxQuery);
}
Loggables.withLogger(logger, Level.INFO).addLog("Multiple C_Tax records {} match the search criteria. Returning the first record based on seqNo.", getTaxIds(taxes));
}
else if (taxes.size() == 1)
{
Loggables.withLogger(logger, Level.DEBUG).addLog("Exact match found: {}", taxes.get(0).getTaxId().getRepoId());
Loggables.withLogger(logger, Level.DEBUG).addLog("Exact match found: C_Tax_ID={}", taxes.get(0).getTaxId().getRepoId());
}
return taxes.isEmpty() ? null : taxes.get(0);
}
Expand Down Expand Up @@ -327,20 +327,20 @@ private IQueryBuilder<I_C_Tax> getTaxQueryBuilder(@NonNull final TaxQuery taxQue
loggable.addLog("AD_Org_ID={} based on warehouse", warehouseOrgId.getRepoId());
orgId = warehouseOrgId;
}

final CountryId warehouseCountryId = warehouseBL.getCountryId(warehouseId);
if (warehouseCountryId != null)
{
loggable.addLog("C_Country_ID={} based on warehouse", warehouseCountryId.getRepoId());
countryId = warehouseCountryId;
}
}
else if (orgId != null)
else
{
loggable.addLog("Effective AD_Org_ID={} (or any)", orgId);
loggable.addLog("Effective AD_Org_ID={} (or any)", orgId.getRepoId());
queryBuilder.addInArrayFilter(I_C_Tax.COLUMNNAME_AD_Org_ID, orgId, OrgId.ANY);
countryId = bPartnerOrgBL.getOrgCountryId(orgId);
loggable.addLog("C_Country_ID={} based on organization", countryId.getRepoId());
loggable.addLog("C_Country_ID={} based on AD_Org_ID={}", countryId.getRepoId(), orgId.getRepoId());
}
if (countryId == null)
{
Expand All @@ -350,16 +350,19 @@ else if (orgId != null)
}
}

final boolean euOneStopShop = orgId != null && orgDAO.isEUOneStopShop(orgId);
if (orgId == null || !euOneStopShop)
final boolean euOneStopShop = orgDAO.isEUOneStopShop(orgId);
if (!euOneStopShop)
{
queryBuilder.addEqualsFilter(I_C_Tax.COLUMNNAME_C_Country_ID, countryId);
}
else
{
loggable.addLog(" AD_Org_ID={} has IsEUOneStopShop=Y; -> don't filter by C_Country_ID", orgId.getRepoId());
loggable.addLog(" AD_Org_ID={} has IsEUOneStopShop=Y; -> don't filter by origin C_Country_ID", orgId.getRepoId());
}

loggable.addLog("Effective AD_Org_ID={} (or any)", orgId.getRepoId());
queryBuilder.addInArrayFilter(I_C_Tax.COLUMNNAME_AD_Org_ID, orgId, OrgId.ANY);

final Timestamp dateOfInterest = taxQuery.getDateOfInterest();
queryBuilder.addCompareFilter(I_C_Tax.COLUMNNAME_ValidFrom, Operator.LESS_OR_EQUAL, dateOfInterest);
queryBuilder.addCompareFilter(I_C_Tax.COLUMNNAME_ValidTo, Operator.GREATER_OR_EQUAL, dateOfInterest);
Expand Down

0 comments on commit 697ea11

Please sign in to comment.