本文整理汇总了PHP中QuickBooks_Utilities::objectToAdd方法的典型用法代码示例。如果您正苦于以下问题:PHP QuickBooks_Utilities::objectToAdd方法的具体用法?PHP QuickBooks_Utilities::objectToAdd怎么用?PHP QuickBooks_Utilities::objectToAdd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuickBooks_Utilities
的用法示例。
在下文中一共展示了QuickBooks_Utilities::objectToAdd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mark
public function mark($mark_as, $object_or_action, $ID, $TxnID_or_ListID = null, $errnum = null, $errmsg = null, $mark_as_dequeued = true)
{
$Driver = $this->_driver;
$object = QuickBooks_Utilities::actionToObject($object_or_action);
$table_and_field = array();
// Convert to table and primary key, select qbsql id
QuickBooks_SQL_Schema::mapPrimaryKey($object, QUICKBOOKS_SQL_SCHEMA_MAP_TO_SQL, $table_and_field);
if (!empty($table_and_field[0]) and !empty($table_and_field[1])) {
switch ($mark_as) {
case QuickBooks_Map::MARK_ADD:
$arr = array();
$where = array(array(QUICKBOOKS_DRIVER_SQL_FIELD_ID => $ID));
if ($TxnID_or_ListID) {
$arr[$table_and_field[1]] = $TxnID_or_ListID;
// Get the existing temporary ID
$errnum = null;
$errmsg = null;
$existing = $Driver->fetch($Driver->query("SELECT " . $table_and_field[1] . " FROM " . QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table_and_field[0] . " WHERE " . QUICKBOOKS_DRIVER_SQL_FIELD_ID . " = " . $ID, $errnum, $errmsg));
if (!$existing) {
return false;
}
$existing_TxnID_or_ListID = $existing[$table_and_field[1]];
}
$resync = true;
$discov = true;
if ($errnum) {
$arr[QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_NUMBER] = $errnum;
$arr[QUICKBOOKS_DRIVER_SQL_FIELD_ERROR_MESSAGE] = $errmsg;
// Don't mark it as synced/discovered if there was an error
$resync = false;
$discov = false;
}
/*
if ($mark_as_dequeued)
{
$arr[QUICKBOOKS_DRIVER_SQL_FIELD_ENQUEUE_TIME] = date('Y-m-d H:i:s');
}
*/
$Driver->update(QUICKBOOKS_DRIVER_SQL_PREFIX_SQL . $table_and_field[0], $arr, $where, $resync, $discov);
if ($TxnID_or_ListID) {
$Object = new QuickBooks_SQL_Object($table_and_field[0], '', array());
$Object->set($table_and_field[1], $TxnID_or_ListID);
$action = QuickBooks_Utilities::objectToAdd($object_or_action);
$this->_updateRelatives($table_and_field[0], $action, $Object, $existing_TxnID_or_ListID);
}
break;
}
}
return false;
}