Example #1
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;
 }
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: modele_main.inc.php,v 1.1 2007-05-07 10:29:08 gueluneau Exp $
require_once $class_path . "/abts_modeles.class.php";
$modele = new abts_modele($modele_id);
if (!$modele_id) {
    $modele->set_perio($serial_id);
}
$modele->proceed();