$requete = "select expl_id, expl_cb from exemplaires where expl_cb='{$cb}' or expl_id='{$expl_id}'"; $result = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { $expl_id = pmb_mysql_result($result, 0, 0); $cb = pmb_mysql_result($result, 0, 1); } } $requete = "select 1 from pret where pret_idexpl='{$expl_id}' "; $result = @pmb_mysql_query($requete); if (pmb_mysql_num_rows($result)) { // gestion erreur prêt en cours error_message($msg[416], $msg[impossible_expl_del_pret], 1, "./catalog.php?categ=isbd&id={$id}"); } else { //archivage if ($pmb_archive_warehouse) { exemplaire::save_to_agnostic_warehouse(array(0 => $expl_id), $pmb_archive_warehouse); } // nettoyage doc. à ranger $requete_suppr = "delete from resa_ranger where resa_cb in (select expl_cb from exemplaires where expl_id='" . $expl_id . "') "; $result_suppr = pmb_mysql_query($requete_suppr, $dbh); $requete = "DELETE FROM exemplaires WHERE expl_cb='{$cb}' or expl_id='{$expl_id}'"; $result = @pmb_mysql_query($requete, $dbh); audit::delete_audit(AUDIT_EXPL, $expl_id); $query_caddie = "select caddie_id from caddie_content, caddie where type='EXPL' and object_id ='{$expl_id}' and caddie_id=idcaddie "; $result_caddie = @pmb_mysql_query($query_caddie, $dbh); while ($cad = pmb_mysql_fetch_object($result_caddie)) { $req_suppr_caddie = "delete from caddie_content where caddie_id = '{$cad->caddie_id}' and object_id ='{$expl_id}' "; @pmb_mysql_query($req_suppr_caddie, $dbh); } //Supression des champs perso if ($expl_id) {
function del_item_base($item = 0, $forcage = array()) { global $dbh; if (!$item) { return CADDIE_ITEM_NULL; } switch ($this->type) { case "EXPL": if (!$this->verif_expl_item($item)) { if ($forcage['source_id']) { exemplaire::save_to_agnostic_warehouse(array(0 => $item), $forcage['source_id']); } if (exemplaire::del_expl($item)) { return CADDIE_ITEM_SUPPR_BASE_OK; } else { return 0; } } else { return CADDIE_ITEM_EXPL_PRET; } break; case "BULL": if (!$this->verif_bull_item($item, $forcage)) { // aucun prêt d'exemplaire de ce bulletin en cours, on supprime : $myBulletinage = new bulletinage($item); $myBulletinage->delete(); return CADDIE_ITEM_SUPPR_BASE_OK; } else { return CADDIE_ITEM_BULL_USED; } break; case "NOTI": if (!$this->verif_noti_item($item, $forcage)) { if ($forcage['source_id']) { notice::save_to_agnostic_warehouse(array(0 => $item), $forcage['source_id']); } $requete = "SELECT niveau_biblio, niveau_hierar FROM notices WHERE notice_id='" . $item . "'"; $res = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($res) && pmb_mysql_result($res, 0, 0) == "s" && pmb_mysql_result($res, 0, 1) == "1") { $myBulletinage = new serial($item); $myBulletinage->serial_delete(); } else { notice::del_notice($item); } return CADDIE_ITEM_SUPPR_BASE_OK; } else { return CADDIE_ITEM_NOTI_USED; } break; } return CADDIE_ITEM_OK; }