本文整理汇总了PHP中Place::free_place方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::free_place方法的具体用法?PHP Place::free_place怎么用?PHP Place::free_place使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::free_place方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateTicket
/**
*
* Update Ticket into Database
* @param array $aryTicket Ticket object
*/
private function UpdateTicket($aryTicket)
{
global $db, $conf;
$function = "UpdateTicket";
$idTicket = -1;
$data = $aryTicket['data'];
$lines = $data['lines'];
$idTicket = $data['id'];
$statut = 0;
if (!$data['customerId']) {
$cash = new Cash($db);
$terminal = $_SESSION['TERMINAL_ID'];
$cash->fetch($terminal);
$socid = $cash->fk_soc;
} else {
$socid = $data['customerId'];
}
if (!$data['employeeId']) {
$employee = $_SESSION['uid'];
} else {
$employee = $data['employeeId'];
}
$object = new Ticket($db);
$object->fetch($idTicket);
$object->type = $data['type'];
$object->socid = $socid;
$object->statut = $data['state'];
$object->fk_cash = $_SESSION['TERMINAL_ID'];
$object->remise_percent = $data['discount_percent'];
$object->remise_absolut = $data['discount_qty'];
$object->mode_reglement_id = $data['payment_type'];
$object->fk_place = $data['id_place'];
$object->note = $data['note'];
$cash = new Cash($db);
$cash->fetch($_SESSION['TERMINAL_ID']);
if ($data['payment_type'] != $cash->fk_modepaycash) {
if ($data['points'] > 0) {
$object->customer_pay = $data['total_with_points'];
} else {
$object->customer_pay = $data['total'];
}
} else {
$object->customer_pay = $data['customerpay'];
}
$data['customerpay'] = $object->customer_pay;
$object->diff_payment = $data['difpayment'];
$object->id_source = $data['idsource'];
$userstatic = new User($db);
$userstatic->fetch($employee);
$db->begin;
$res = $object->update($userstatic->id);
$data['ref'] = $object->ref;
if ($res < 0) {
$db->rollback();
return -5;
} else {
//Adding lines
$idLines = self::addTicketLines($lines, $idTicket);
if ($idLines < 0) {
$db->rollback();
return -2;
} else {
$place = new Place($db);
$place->fetch($object->fk_place);
if ($object->statut != 0) {
//Adding Payments
$payment = self::addPayment($data);
if (!$payment) {
$db->rollback();
return -3;
} else {
if ($object->diff_payment <= 0) {
$object->set_paid($user);
}
}
//Decrease stock
$stock = self::quitSotck($lines);
if ($stock) {
$db->rollback();
return -4;
}
// liberar puesto
$place->free_place();
} else {
// usar puesto
$place->set_place($idTicket);
}
}
}
$db->commit;
return $idTicket;
}
示例2: Place
/**
* Delete ticket and all the lines
* @return number <0 if KO, >0 if OK
*/
function delete_ticket()
{
dol_include_once('/pos/class/place.class.php');
global $user, $langs, $conf, $db;
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "pos_ticketdet WHERE fk_ticket=" . $this->id;
$resql = $this->db->query($sql);
if ($resql) {
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "pos_ticket";
$sql .= " WHERE rowid= " . $this->id;
$sql .= " AND entity = " . $conf->entity;
$resql = $this->db->query($sql);
if ($resql) {
if ($this->statut == 0) {
$place = new Place($db);
$place->fetch($this->fk_place);
$place->free_place();
}
$this->db->commit();
return 1;
} else {
$this->db->rollback();
return -1;
}
} else {
$this->db->rollback();
return -1;
}
}