好vtiger。 API创建PurchaseOrder

时间:2018-06-18 19:43:13

标签: php vtiger vtigercrm

有一个问题,我第二天感到困惑。

$purchaseOrders = new PurchaseOrder();
$lists = new ItemLists();

$lists->productid->set(201);
$lists->hdnGrandTotal->set($balance);
$lists->hdnSubTotal->set($balance);
$lists->quantity->set(1);
$lists->listprice->set($balance);
$arrayDataLineItems = [];
$arrayDataLineItems[] = $lists;

$purchaseOrders->dataLineItems->set($arrayDataLineItems);
$purchaseOrders->subject->set($data['caseId']);
$purchaseOrders->purchaseorderNo->set('PO');
$purchaseOrders->vendorid->set($getVendor->id->getCrmValue());
$purchaseOrders->postatus->set('Created');
$purchaseOrders->bill_street->set($getVendor->street->getCrmValue());
$purchaseOrders->ship_street->set($getVendor->street->getCrmValue());
$purchaseOrders->productid->set(201);
$purchaseOrders->balance->set($balance);
$purchaseOrders->assignedUserId->set(6);
$purchaseOrders->conversion_rate->set(1);
$purchaseOrders->currency_id->set('21x1');
$purchaseOrders->hdnTaxType->set('group');

$purchaseOrders->terms_conditions->set('SEE FULL TERMS OF SERVICE AT https://www.salvagedata.com/about/service-terms/');

$valueMapPurchase = $purchaseOrders->toCrmMap();
$crmPurchase = $api->doCreate(PurchaseOrder::getModuleName(),$valueMapPurchase);

有这样的代码。它不会添加PurchaseOrder,甚至不会返回任何错误。当我进行错误检查时,它只返回Null。请帮助,我脑子里没有任何东西不能攀爬,因为它可以纠正。

现在我有数据库mysql 5.6

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

$po = Vtiger_Record_Model::getCleanInstance('PurchaseOrder');
$po->set('subject', 'my po');
$po->set('assigned_user_id', 1);
//set other variables as needed...
$po->save();