本文整理汇总了PHP中Reservation::is_reserved方法的典型用法代码示例。如果您正苦于以下问题:PHP Reservation::is_reserved方法的具体用法?PHP Reservation::is_reserved怎么用?PHP Reservation::is_reserved使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reservation
的用法示例。
在下文中一共展示了Reservation::is_reserved方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace
//.........这里部分代码省略.........
$doc_item->update(array('id' => $document['assocID'], 'itemtype' => $type, 'items_id' => $newitem_id), false);
}
}
// Contracts
if ($model->fields["replace_contracts"] && in_array($type, $CFG_GLPI["contract_types"])) {
$contract_item = new Contract_Item();
foreach (self::getAssociatedContracts($olditem) as $contract) {
$contract_item->update(array('id' => $contract['id'], 'itemtype' => $type, 'items_id' => $newitem_id), false);
}
}
// Infocoms
if ($model->fields["replace_infocoms"] && in_array($type, $CFG_GLPI["infocom_types"])) {
$infocom = new Infocom();
if ($overwrite) {
// Delete current Infocoms of new item
if ($infocom->getFromDBforDevice($type, $newitem_id)) {
//Do not log infocom deletion in the new item's history
$infocom->dohistory = false;
$infocom->deleteFromDB(1);
}
}
// Update current Infocoms of old item
if ($infocom->getFromDBforDevice($type, $olditem_id)) {
$infocom->update(array('id' => $infocom->getID(), 'itemtype' => $type, 'items_id' => $newitem_id), false);
}
}
// Reservations
if ($model->fields["replace_reservations"] && in_array($type, $CFG_GLPI["reservation_types"])) {
$resaitem = new ReservationItem();
if ($overwrite) {
// Delete current reservation of new item
$resa_new = new Reservation();
$resa_new->getFromDB($newitem_id);
if ($resa_new->is_reserved()) {
$resa_new = new ReservationItem();
$resa_new->getFromDBbyItem($type, $newitem_id);
if (count($resa_new->fields)) {
$resa_new->deleteFromDB(1);
}
}
}
// Update old reservation for attribute to new item
$resa_old = new Reservation();
$resa_old->getFromDB($olditem_id);
if ($resa_old->is_reserved()) {
$resa_old = new ReservationItem();
$resa_old->getFromDBbyItem($type, $olditem_id);
if (count($resa_old->fields)) {
$resa_old->update(array('id' => $resa_old->getID(), 'itemtype' => $type, 'items_id' => $newitem_id), false);
}
}
}
// User
if ($model->fields["replace_users"] && in_array($type, $CFG_GLPI["linkuser_types"])) {
$data = array();
$data['id'] = $newitem->getID();
if ($newitem->isField('users_id') && ($overwrite || empty($data['users_id']))) {
$data['users_id'] = $olditem->getField('users_id');
}
if ($newitem->isField('contact') && ($overwrite || empty($data['contact']))) {
$data['contact'] = $olditem->getField('contact');
}
if ($newitem->isField('contact_num') && ($overwrite || empty($data['contact_num']))) {
$data['contact_num'] = $olditem->getField('contact_num');
}
$newitem->update($data, false);