/** * * * */ public static function TxnDelResponse($requestID, $user, $action, $ID, $extra, &$err, $last_action_time, $last_actionident_time, $xml, $idents, $config = array()) { $Driver = QuickBooks_Driver_Singleton::getInstance(); $Parser = new QuickBooks_XML_Parser($xml); $errnum = 0; $errmsg = ''; $Doc = $Parser->parse($errnum, $errmsg); $Root = $Doc->getRoot(); $List = $Root->getChildAt('QBXML QBXMLMsgsRs TxnDelRs'); $Node = $List; if ($errnum == 0) { $map = array(); $others = array(); QuickBooks_SQL_Schema::mapToSchema(trim(QuickBooks_Utilities::objectToXMLElement($extra['objectType'])), QUICKBOOKS_SQL_SCHEMA_MAP_TO_SQL, $map, $others); $sqlObject = new QuickBooks_SQL_Object($map[0], trim(QuickBooks_Utilities::objectToXMLElement($extra['objectType']))); $table = $sqlObject->table(); $multipart = array("TxnID" => $Node->getChildDataAt("TxnDelRs TxnID")); //$config['delete'] = //Check the delete mode and if desired, just flag them rather than remove the rows. // @todo Fix this wrong delete flag field //mysql_query("UPDATE qb_bill SET qbsql_to_delete = 0, qbsql_flag_deleted = 1 WHERE TxnID = '" . $Node->getChildDataAt('TxnDelRs TxnID') . "' LIMIT 1"); /* if (isset($config['delete']) and $config['delete'] == QUICKBOOKS_SERVER_SQL_DELETE_FLAG) { //@todo Make the Boolean TRUE value used in the QUICKBOOKS_DRIVER_SQL_FIELD_DELETED_FLAG field a constant, // in case the sql driver used uses something other than 1 and 0. $sqlObject->set(QUICKBOOKS_DRIVER_SQL_FIELD_DELETED_FLAG, 1); $sqlObject->set("TxnID", $Node->getChildDataAt("TxnDelRs TxnID")); $Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, $sqlObject, array( $multipart )); //Now Delete/Flag all the children. QuickBooks_Callbacks_SQL_Callbacks::_DeleteChildren($table, $user, $action, $ID, $sqlObject, $extra, $config, true, true); } else { //Otherwise we actually remove the rows. $Driver->delete(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table, array( $multipart )); $sqlObject->set("TxnID", $Node->getChildDataAt("TxnDelRs TxnID")); //Now Delete/Flag all the children. QuickBooks_Callbacks_SQL_Callbacks::_DeleteChildren($table, $user, $action, $ID, $sqlObject, $extra, $config, true, true); } */ } return true; }