本文整理汇总了PHP中Infocom::deleteFromDB方法的典型用法代码示例。如果您正苦于以下问题:PHP Infocom::deleteFromDB方法的具体用法?PHP Infocom::deleteFromDB怎么用?PHP Infocom::deleteFromDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Infocom
的用法示例。
在下文中一共展示了Infocom::deleteFromDB方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replace
//.........这里部分代码省略.........
if ($model->fields["replace_serial"]) {
if ($overwrite || empty($newitem->fields['serial'])) {
$newitem->update(array('id' => $newitem_id, 'serial' => $olditem->getField('serial')), false);
}
}
// General Informations - OTHERSERIAL
if ($model->fields["replace_otherserial"]) {
if ($overwrite || empty($newitem->fields['otherserial'])) {
$newitem->update(array('id' => $newitem_id, 'otherserial' => $olditem->getField('otherserial')), false);
}
}
// Documents
if ($model->fields["replace_documents"] && in_array($type, $CFG_GLPI["document_types"])) {
$doc_item = new Document_Item();
foreach (self::getAssociatedDocuments($olditem) as $document) {
$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);
}
}