Показать сообщение отдельно
Старый 28.01.2009, 11:48   #11  
ZVV is offline
ZVV
MCITP
MCP
Oracle
MCBMSS
 
1,006 / 246 (11) ++++++
Регистрация: 13.02.2004
Адрес: Минск
-> ещё забавный код...
Классы 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() всё это вызывается без всяких проверок...
__________________
Zhirenkov Vitaly
За это сообщение автора поблагодарили: kashperuk (5).