Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 function serial_delete()
 {
     global $dbh;
     global $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     $requete = "SELECT bulletin_id,num_notice from bulletins WHERE bulletin_notice='" . $this->serial_id . "' ";
     $myQuery1 = pmb_mysql_query($requete, $dbh);
     if ($myQuery1 && pmb_mysql_num_rows($myQuery1)) {
         while ($bul = pmb_mysql_fetch_object($myQuery1)) {
             $bulletin = new bulletinage($bul->bulletin_id);
             $bulletin->delete();
         }
     }
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $this->serial_id;
             @unlink($img);
         }
     }
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->serial_id, 0);
     }
     // élimination des docs numériques
     $req_explNum = "select explnum_id from explnum where explnum_notice='" . $this->serial_id . "' ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     $requete = "DELETE FROM responsability WHERE responsability_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($requete, $dbh);
     // suppression des entrées dans les caddies
     $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='" . $this->serial_id . "' ";
     @pmb_mysql_query($requete, $dbh);
     //élimination des champs persos
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($this->serial_id);
     // suppression des audits
     audit::delete_audit(AUDIT_NOTICE, $this->serial_id);
     // suppression des categories
     $rqt_del = "delete from notices_categories where notcateg_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des bannettes
     $rqt_del = "delete from bannette_contenu where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     // suppression des avis
     $rqt_del = "delete from avis where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($rqt_del, $dbh);
     //suppression des langues
     $query = "delete from notices_langues where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // suppression index global
     $query = "delete from notices_global_index where num_notice='" . $this->serial_id . "' ";
     @pmb_mysql_query($query, $dbh);
     // Effacement des occurences de la notice ds la table notices_mots_global_index :
     $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_fields_global_index :
     $requete = "DELETE FROM notices_fields_global_index WHERE id_notice=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $query = "UPDATE suggestions set num_notice = 0 where num_notice=" . $this->serial_id;
     @pmb_mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $this->serial_id . "' and type_ligne in ('1','5') ";
     @pmb_mysql_query($requete, $dbh);
     // liens entre notices
     $requete = "DELETE FROM notices_relations WHERE linked_notice='" . $this->serial_id . "' OR num_notice='" . $this->serial_id . "' ";
     pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $this->serial_id;
     @pmb_mysql_query($requete, $dbh);
     // suppression des modeles
     $requete = "SELECT modele_id from abts_modeles WHERE num_notice='" . $this->serial_id . "' ";
     $result_modele = pmb_mysql_query($requete, $dbh);
     while ($modele = pmb_mysql_fetch_object($result_modele)) {
         $mon_modele = new abts_modele($modele->modele_id);
         $mon_modele->delete();
     }
     // Suppression des etats de collections
     $collstate = new collstate(0, $this->serial_id);
     $collstate->delete();
     //si intégré depuis une source externe, on suprrime aussi la référence
     $query = "delete from notices_externes where num_notice=" . $this->serial_id;
     @pmb_mysql_query($query, $dbh);
     // on supprime la notice
     $requete = "DELETE FROM notices WHERE notice_id='" . $this->serial_id . "' ";
     pmb_mysql_query($requete, $dbh);
     $result = pmb_mysql_affected_rows($dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = pmb_mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = pmb_mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $this->serial_id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         pmb_mysql_query($requete, $dbh);
     }
     $req = "delete from notices_authperso where notice_authperso_notice_num=" . $this->serial_id;
     pmb_mysql_query($req, $dbh);
     return $result;
 }
Ejemplo n.º 3
0
    $acces_j = $dom_1->getJoin($PMBuserid, 8, 'bulletin_notice');
    $q = "select count(1) from bulletins {$acces_j} where bulletin_id = {$bul_id} ";
    $r = mysql_query($q, $dbh);
    if (mysql_result($r, 0, 0) == 0) {
        $acces_m = 0;
    }
}
if ($acces_m == 0) {
    error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, '');
} else {
    print "<div class=\"row\"><div class=\"msg-perio\">" . $msg['catalog_notices_suppression'] . "</div></div>";
    $sql_circ = mysql_query("select 1 from serialcirc_expl,exemplaires,bulletins where num_serialcirc_expl_id =expl_id and expl_bulletin=bulletin_id and bulletin_id={$bul_id} ");
    if (mysql_num_rows($sql_circ)) {
        // gestion erreur: circulation en cours
        error_message($msg[416], $msg["serialcirc_bull_no_del"], 1, "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}");
    } else {
        $requete = "select 1 from pret, exemplaires, bulletins where bulletin_id='{$bul_id}' ";
        $requete .= "and pret_idexpl=expl_id and expl_bulletin=bulletin_id ";
        $result = @mysql_query($requete);
        if (mysql_num_rows($result)) {
            // gestion erreur pret en cours
            error_message($msg[416], $msg[impossible_bull_del_pret], 1, "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}");
        } else {
            $myBulletinage = new bulletinage($bul_id);
            $myBulletinage->delete();
            $retour = "./catalog.php?categ=serials&sub=view&serial_id=" . $myBulletinage->bulletin_notice;
            // form de retour vers la page de gestion du periodique chapeau (auto-submit)
            print "\n\t\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t\t</form>\n\t\t\t\t<script type=\"text/javascript\">document.dummy.submit();</script>";
        }
    }
}