quickbooks-php
quickbooks-php copied to clipboard
MySQL mirror: no relatives setup for "class"
When a new "class" is created at the same time it's applied to an invoice, the procedure is to generate a fake ListID and use it both in the qb_class and qb_invoice. With other tables, the mirror code will automatically replace the ListID in invoice with the new one that's generated in the linked table. This doesn't happen with Classes.
When I added the relative to the Callbacks.php, it worked fine. Is there a reason the relatives weren't added for "class"?
I had a similar issue with applying a Credit Memo to a newly created a Customer before a sync has been done. (Temporary ListIDs in-use.)
I added a line to the customer
relatives Array in Callbacks.php and it started to work.
The only issue I see now is that when a Credit is removed in QuickBooks, once the sync runs again, that the row in qb_creditmemo_creditmemoline
is not marked as deleted in the qbsql_flag_deleted
column.
The row in qb_creditmemo
does get updated with the qbsql_flag_deleted
column marked as 1
.
I can work around this by relying on the qbsql_flag_deleted
column in the qb_creditmemo
table for that data.
Here's the Array in Callbacks.php where I added one line to get Credits working during the initial Add
of the new items in the sync process.
'customer' => array(
'id_field' => 'ListID',
'relatives' => array(
'estimate' => 'Customer_ListID',
'salesorder' => 'Customer_ListID',
'purchaseorder_purchaseorderline' => 'Customer_ListID',
'invoice' => 'Customer_ListID',
'receivepayment' => 'Customer_ListID',
'purchaseorder' => 'ShipToEntity_ListID',
'salesreceipt' => 'Customer_ListID',
'creditmemo' => 'Customer_ListID' // Added to enable Credit Memo Adding
)
),