本文整理汇总了PHP中Commande::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Commande::delete方法的具体用法?PHP Commande::delete怎么用?PHP Commande::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commande
的用法示例。
在下文中一共展示了Commande::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete order
*
* @param int $id Order ID
*
* @url DELETE order/{id}
*
* @return array
*/
function delete($id)
{
if (!DolibarrApiAccess::$user->rights->commande->supprimer) {
throw new RestException(401);
}
$result = $this->commande->fetch($id);
if (!$result) {
throw new RestException(404, 'Order not found');
}
if (!DolibarrApi::_checkAccessToResource('commande', $this->commande->id)) {
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
}
if (!$this->commande->delete(DolibarrApiAccess::$user)) {
throw new RestException(500, 'Error when delete order : ' . $this->commande->error);
}
return array('success' => array('code' => 200, 'message' => 'Order deleted'));
}
示例2: testCommandeDelete
/**
* testCommandeDelete
*
* @param int $id Id of order
* @return void
*
* @depends testCommandeOther
* The depends says test is run only if previous is ok
*/
public function testCommandeDelete($id)
{
global $conf, $user, $langs, $db;
$conf = $this->savconf;
$user = $this->savuser;
$langs = $this->savlangs;
$db = $this->savdb;
$localobject = new Commande($this->savdb);
$result = $localobject->fetch($id);
$result = $localobject->delete($user);
print __METHOD__ . " id=" . $id . " result=" . $result . "\n";
$this->assertLessThan($result, 0);
return $result;
}
示例3: count
$row = $db->fetch_array($resql);
$db->begin();
$db->query("DELETE FROM " . MAIN_DB_PREFIX . "commandedet WHERE rowid = {$row['0']};");
$db->commit();
} else {
$db->begin();
$db->query("delete from " . MAIN_DB_PREFIX . "commandedet where rowid='{$id}'");
$db->commit();
}
$sql = "SELECT count(*) FROM " . MAIN_DB_PREFIX . "commandedet where fk_commande={$placeid}";
$resql = $db->query($sql);
$row = $db->fetch_array($resql);
if ($row[0] == 0) {
$object = new Commande($db);
$ret = $object->fetch($placeid);
$result = $object->delete($user);
}
}
if ($action == "q") {
$db->begin();
$db->query("update " . MAIN_DB_PREFIX . "commandedet set qty='{$number}', total_ht=subprice*qty, total_tva=total_ht*tva_tx/100, total_ttc=total_ht+total_tva where rowid='{$id}'");
$db->commit();
}
if ($action == "p") {
$db->begin();
$db->query("update " . MAIN_DB_PREFIX . "commandedet set price='{$number}', remise=remise_percent*price/100, subprice=(price-remise)/(tva_tx/100+1), total_ht=subprice*qty, total_tva=total_ht*tva_tx/100, total_ttc=total_ht+total_tva where rowid='{$id}'");
$db->commit();
}
if ($action == "d") {
$db->begin();
$db->query("update " . MAIN_DB_PREFIX . "commandedet set remise_percent='{$number}', remise=remise_percent*price/100, subprice=(price-remise)/(tva_tx/100+1), total_ht=subprice*qty, total_tva=total_ht*tva_tx/100, total_ttc=total_ht+total_tva where rowid='{$id}'");