Классы PurchCopying & SalesCopying
метод setRefCustVendCreditInvoicingTable (и в 4 и в 2009)
Выглядит типа так...
X++:
protected void setRefCustVendCreditInvoicingTable(SalesTable _salesTable,
CustInvoiceJour _custInvoiceJour)
{
CustVendCreditInvoicingTable custVendCreditInvoicingTable;
;
if(CustParameters::find().CreditInvoicing)
{
custVendCreditInvoicingTable = CustVendCreditInvoicingTable::findRefId(_salesTable.TableId,
_salesTable.RecId,
true);
if(custVendCreditInvoicingTable)
{
if(_custInvoiceJour)
{
custVendCreditInvoicingTable.CustVendCorrectedInvoiceId = _custInvoiceJour.InvoiceId;
custVendCreditInvoicingTable.update();
}
}
else
{
if(_custInvoiceJour)
{
custVendCreditInvoicingTable.CustVendInvoiceAccount = _salesTable.InvoiceAccount;
custVendCreditInvoicingTable.AccountType = LedgerJournalACType::Cust;
custVendCreditInvoicingTable.CustVendCorrectedInvoiceId = _custInvoiceJour.InvoiceId;
custVendCreditInvoicingTable.RefTableId = _salesTable.TableId;
custVendCreditInvoicingTable.RefRecId = _salesTable.RecId;
custVendCreditInvoicingTable.insert();
}
}
}
}
Вот эти проверки "
if(_custInvoiceJour)" внесены внурь "поглубжее" с целью оптимизировать производительность?

Особенно учитывая как в методе
Copy() всё это вызывается без всяких проверок...