本文整理匯總了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);
}
}