public function createFile($name, $data = null) { global $charset, $base_path, $id_rep; if ($this->check_write_permission()) { if ($charset !== 'utf-8') { $name = utf8_decode($name); } $filename = realpath($base_path . "/temp/") . "/webdav_" . md5($name . time()) . "." . extension_fichier($name); $fp = fopen($filename, "w"); if (!$fp) { //on a pas le droit d'écriture throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $filename . ')'); } while ($buf = fread($data, 1024)) { fwrite($fp, $buf); } fclose($fp); $notice_id = $this->notice_id; $bulletin_id = 0; $query = "SELECT CONCAT(niveau_biblio, niveau_hierar) AS niveau FROM notices WHERE notice_id = " . $this->notice_id; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); if ($row->niveau == "b2") { $query = "SELECT bulletin_id FROM bulletins WHERE num_notice = " . $this->notice_id; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $notice_id = 0; $bulletin_id = $row->bulletin_id; } } } $explnum = new \explnum(0, $notice_id, $bulletin_id); $id_rep = $this->parentNode->config['upload_rep']; $explnum->get_file_from_temp($filename, $name, $this->parentNode->config['up_place']); $explnum->params['explnum_statut'] = $this->config['default_docnum_statut']; $explnum->update(); $this->update_notice($this->notice_id); if (file_exists($filename)) { unlink($filename); } } else { //on a pas le droit d'écriture throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $name . ')'); return false; } }
public function createFile($name, $data = null) { global $charset, $base_path, $id_rep; if ($charset !== 'utf-8') { $name = utf8_decode($name); } $filename = tempnam($base_path . "/temp/", "webdav_"); $fp = fopen($filename, "w"); while ($buf = fread($data, 1024)) { fwrite($fp, $buf); } fclose($fp); $explnum = new \explnum(0, $this->notice_id); $id_rep = $this->parentNode->config['upload_rep']; $explnum->get_file_from_temp($filename, $name, $this->parentNode->config['up_place']); $explnum->update(); $this->update_notice($this->notice_id); if (file_exists($filename)) { unlink($filename); } }
function analysis_delete() { global $dbh; global $pmb_synchro_rdf, $pmb_notice_img_folder_id; //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->analysis_id; @unlink($img); } } //synchro rdf if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($this->analysis_id, 0); } //elimination des docs numeriques $req_explNum = "select explnum_id from explnum where explnum_notice=" . $this->analysis_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(); } // suppression des entrees dans les caddies $query_caddie = "select caddie_id from caddie_content, caddie where type='NOTI' and object_id in ({$this->analysis_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 in ({$this->analysis_id}) "; @pmb_mysql_query($req_suppr_caddie, $dbh); } //elimination des champs persos $p_perso = new parametres_perso("notices"); $p_perso->delete_values($this->analysis_id); // on supprime l'entree dans la table 'analysis' $requete = "DELETE FROM analysis WHERE analysis_notice=" . $this->analysis_id; pmb_mysql_query($requete, $dbh); $result = pmb_mysql_affected_rows($dbh); // on supprime la notice du dépouillement $requete = "DELETE FROM notices WHERE notice_id='" . $this->analysis_id . "' "; pmb_mysql_query($requete, $dbh); $result += pmb_mysql_affected_rows($dbh); //suppression des droits d'acces user_notice $requete = "delete from acces_res_1 where res_num=" . $this->analysis_id; @pmb_mysql_query($requete, $dbh); //suppression des droits d'acces empr_notice $requete = "delete from acces_res_2 where res_num=" . $this->analysis_id; @pmb_mysql_query($requete, $dbh); // suppression des audits audit::delete_audit(AUDIT_NOTICE, $this->analysis_id); // suppression des categories $rqt_del = "delete from notices_categories where notcateg_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($rqt_del, $dbh); // suppression des responsabilités $rqt_del = "delete from responsability where responsability_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($rqt_del, $dbh); // suppression des liens $rqt_del = "delete from notices_relations where num_notice='" . $this->analysis_id . "' OR linked_notice='" . $this->analysis_id . "'"; @pmb_mysql_query($rqt_del, $dbh); // suppression des bannettes $rqt_del = "delete from bannette_contenu where num_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($rqt_del, $dbh); // suppression des tags $rqt_del = "delete from tags where num_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($rqt_del, $dbh); // suppression des avis $rqt_del = "delete from avis where num_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($rqt_del, $dbh); //suppression des langues $query = "delete from notices_langues where num_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($query, $dbh); // suppression index global $query = "delete from notices_global_index where num_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($query, $dbh); // suppression notices_mots_global_index $query = "delete from notices_mots_global_index where id_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($query, $dbh); // suppression notices_fields_global_index $query = "delete from notices_fields_global_index where id_notice='" . $this->analysis_id . "' "; @pmb_mysql_query($query, $dbh); //Suppression de la reference a la notice dans la table suggestions $query = "UPDATE suggestions set num_notice = 0 where num_notice=" . $this->analysis_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->analysis_id . "' and type_ligne in ('1','5') "; @pmb_mysql_query($requete, $dbh); //Suppression de la référence de la source si exitante.. $query = "delete from notices_externes where num_notice=" . $this->analysis_id; @pmb_mysql_query($query, $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->analysis_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=" . $id; pmb_mysql_query($req, $dbh); return $result; }
function attach_docnum() { global $dbh, $chk, $ck_index, $pmb_indexation_docnum; for ($i = 0; $i < count($chk); $i++) { //On attache les documents numériques cochés $req = "select explnum_doc_nomfichier as nom ,explnum_doc_mimetype as mime,explnum_doc_data as data,explnum_doc_extfichier as ext\n\t\t\tfrom explnum_doc \n\t\t\tjoin explnum_doc_actions on num_explnum_doc=id_explnum_doc\n\t\t\tjoin demandes_actions on num_action=id_action\n\t\t\twhere id_explnum_doc='" . $chk[$i] . "'\n\t\t\tand num_explnum = 0\n\t\t\tand num_demande='" . $this->id_demande . "'\n\t\t\t"; $res = mysql_query($req, $dbh); if (mysql_num_rows($res)) { $expl = mysql_fetch_object($res); $req = "insert into explnum(explnum_notice,explnum_nom,explnum_nomfichier,explnum_mimetype,explnum_data,explnum_extfichier) values \n\t\t\t\t\t('" . $this->num_notice . "','" . addslashes($expl->nom) . "','" . addslashes($expl->nom) . "','" . addslashes($expl->mime) . "','" . addslashes($expl->data) . "','" . addslashes($expl->ext) . "')"; mysql_query($req, $dbh); $id_explnum = mysql_insert_id(); $req = "update explnum_doc_actions set num_explnum='" . $id_explnum . "' where num_explnum_doc='" . $chk[$i] . "'"; mysql_query($req, $dbh); if ($ck_index[$i] && $pmb_indexation_docnum) { $expl = new explnum($id_explnum); $expl->indexer_docnum(); } } } //On désattache les autres if ($chk) { $req = "select id_explnum_doc from explnum_doc where id_explnum_doc not in ('" . implode('\',\'', $chk) . "')"; $res = mysql_query($req, $dbh); while ($expl = mysql_fetch_object($res)) { $req = "delete e from explnum e \n\t\t\t\t\tjoin explnum_doc_actions on num_explnum=explnum_id \n\t\t\t\t\twhere num_explnum_doc='" . $expl->id_explnum_doc . "'"; mysql_query($req, $dbh); $req = "update explnum_doc_actions set num_explnum='0' where num_explnum_doc='" . $expl->id_explnum_doc . "'"; mysql_query($req, $dbh); } } else { $req = "select id_explnum_doc\n\t\t\t\t\tfrom explnum_doc \n\t\t\t\t\tjoin explnum_doc_actions on num_explnum_doc=id_explnum_doc\n\t\t\t\t\tjoin demandes_actions on num_action=id_action\n\t\t\t\t\twhere num_explnum != 0\n\t\t\t\t\tand num_demande='" . $this->id_demande . "'"; $res = mysql_query($req, $dbh); while ($expl = mysql_fetch_object($res)) { $req = "delete e from explnum e \n\t\t\t\t\tjoin explnum_doc_actions on num_explnum=explnum_id \n\t\t\t\t\twhere num_explnum_doc='" . $expl->id_explnum_doc . "'"; mysql_query($req, $dbh); $req = "update explnum_doc_actions set num_explnum='0' where num_explnum_doc='" . $expl->id_explnum_doc . "'"; mysql_query($req, $dbh); } } }
// +-------------------------------------------------+ // $Id: ana_explnum_update.inc.php,v 1.14 2015-04-03 11:16:27 jpermanne Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // mise à jour de l'entête de page echo str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg[explnum_doc_associe], $serial_header); //verification des droits de modification notice $acces_m = 1; if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_1 = $ac->setDomain(1); $acces_j = $dom_1->getJoin($PMBuserid, 8, 'bulletin_notice'); $q = "select count(1) from bulletins {$acces_j} where bulletin_id=" . $bul_id; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_result($r, 0, 0) == 0) { $acces_m = 0; } } if ($acces_m == 0) { if (!$f_explnum_id) { error_message('', htmlentities($dom_1->getComment('mod_depo_error'), ENT_QUOTES, $charset), 1, ''); } else { error_message('', htmlentities($dom_1->getComment('mod_enum_error'), ENT_QUOTES, $charset), 1, ''); } } else { $retour = "./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$bul_id}"; $explnum = new explnum($f_explnum_id); $explnum->mise_a_jour($f_notice, $f_bulletin, $f_nom, $f_url, $retour, $conservervignette, $f_statut_chk, $f_explnum_statut); }
// +-------------------------------------------------+ // $Id: edit_explnum.inc.php,v 1.15 2009-07-07 13:14:53 kantin Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // gestion des doc numeriques //verification des droits de modification notice $acces_m = 1; if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_1 = $ac->setDomain(1); $acces_m = $dom_1->getRights($PMBuserid, $id, 8); } if ($acces_m == 0) { error_message('', htmlentities($dom_1->getComment('mod_enum_error'), ENT_QUOTES, $charset), 1, ''); } else { require_once "{$include_path}/templates/explnum.tpl.php"; print "<h1>" . $msg[explnum_doc_associe] . "</h1>"; $notice = new mono_display($id, 1, './catalog.php?categ=modif&id=!!id!!', FALSE); print pmb_bidi("<div class=\"row\"><b>" . $notice->header . '</b><br />'); print pmb_bidi($notice->isbd . '</div>'); print "<div class=\"row\">"; $suppr = "./catalog.php?categ=del_explnum&id={$id}&explnum_id={$explnum_id}"; $nex = new explnum($explnum_id, $id, $bulletin_id); $explnum_form = $nex->explnum_form("./catalog.php?categ=explnum_update&sub=update&id={$explnum_id}", "./catalog.php?categ=isbd&id={$id}", $suppr); print $explnum_form; print '</div>'; } ?>
$up_place = 0; $id_rep = 0; $path = ''; $ck_index = 0; if ($deflt_upload_repertoire) { $id_rep = $deflt_upload_repertoire; if ($id_rep) { $r = new upload_folder($id_rep); $path = $r->repertoire_nom; $up_place = 1; } } if ($pmb_indexation_docnum && $pmb_indexation_docnum_default) { $ck_index = 1; } $explnum = new explnum(); // Url de retour après téléchargement du document. $retour = "{$base_path}/catalog/serials/pointage/pointage_exemplarise.php?act=memo_doc_num&id_bull={$id_bull}&bul_id={$bul_id}"; $explnum->mise_a_jour(0, $bul_id, $f_filename, $f_url, $retour, 0, 0, $f_explnum_statut); exit; } else { // Pas de doc numérique, on ferme l'iframe $id_form = md5(microtime()); $templates = str_replace("!!form!!", "<script type='text/javascript'>enregistre('{$id_bull}','{$bul_id}');</script>", $templates); } } else { // Formulaire include "{$include_path}/templates/serials.tpl.php"; abts_pointage::delete_retard($abt_id, $value['date_date'], $numero); if ($nonrecevable) { $value['bul_titre'] = $msg['abonnements_bulletin_non_recevable'];
static function del_notice($id) { global $dbh, $class_path, $pmb_synchro_rdf, $pmb_notice_img_folder_id; //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_" . $id; @unlink($img); } } //synchro_rdf (à laisser en premier : a besoin des éléments de la notice pour retirer du graphe rdf) if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($id, 0); } $p_perso = new parametres_perso("notices"); $p_perso->delete_values($id); $requete = "DELETE FROM notices_categories WHERE notcateg_notice='{$id}'"; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM notices_langues WHERE num_notice='{$id}'"; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM notices WHERE notice_id='{$id}'"; @pmb_mysql_query($requete, $dbh); audit::delete_audit(AUDIT_NOTICE, $id); // Effacement de l'occurence de la notice ds la table notices_global_index : $requete = "DELETE FROM notices_global_index WHERE num_notice=" . $id; @pmb_mysql_query($requete, $dbh); // Effacement des occurences de la notice ds la table notices_mots_global_index : $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=" . $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=" . $id; @pmb_mysql_query($requete, $dbh); $requete = "delete from notices_relations where num_notice='{$id}' OR linked_notice='{$id}' "; @pmb_mysql_query($requete, $dbh); // elimination des docs numeriques $req_explNum = "select explnum_id from explnum where explnum_notice=" . $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(); } // Clean des vedettes notice::delete_vedette_links($id); $requete = "DELETE FROM responsability WHERE responsability_notice='{$id}'"; @pmb_mysql_query($requete, $dbh); $requete = "DELETE FROM bannette_contenu WHERE num_notice='{$id}'"; @pmb_mysql_query($requete, $dbh); $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='" . $id . "' "; @pmb_mysql_query($requete, $dbh); $requete = "delete from analysis where analysis_notice='" . $id . "' "; @pmb_mysql_query($requete, $dbh); $requete = "update bulletins set num_notice=0 where num_notice='" . $id . "' "; @pmb_mysql_query($requete, $dbh); //Suppression de la reference a la notice dans la table suggestions $requete = "UPDATE suggestions set num_notice = 0 where num_notice=" . $id; @pmb_mysql_query($requete, $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='" . $id . "' and type_ligne in ('1','5') "; @pmb_mysql_query($requete, $dbh); //suppression des droits d'acces user_notice $requete = "delete from acces_res_1 where res_num=" . $id; @pmb_mysql_query($requete, $dbh); // suppression des tags $rqt_del = "delete from tags where num_notice=" . $id; @pmb_mysql_query($rqt_del, $dbh); //suppression des avis $requete = "delete from avis where num_notice=" . $id; @pmb_mysql_query($requete, $dbh); //suppression des droits d'acces empr_notice $requete = "delete from acces_res_2 where res_num=" . $id; @pmb_mysql_query($requete, $dbh); // Supression des liens avec les titres uniformes $requete = "DELETE FROM notices_titres_uniformes WHERE ntu_num_notice='{$id}'"; @pmb_mysql_query($requete, $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] == $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); } // Suppression des résas $requete = "DELETE FROM resa WHERE resa_idnotice=" . $id; pmb_mysql_query($requete, $dbh); // Suppression des transferts_demande $requete = "DELETE FROM transferts_demande using transferts_demande, transferts WHERE num_transfert=id_transfert and num_notice=" . $id; pmb_mysql_query($requete, $dbh); // Suppression des transferts $requete = "DELETE FROM transferts WHERE num_notice=" . $id; pmb_mysql_query($requete, $dbh); //si intégré depuis une source externe, on supprime aussi la référence $query = "delete from notices_externes where num_notice=" . $id; @pmb_mysql_query($query, $dbh); $req = "delete from notices_authperso where notice_authperso_notice_num=" . $id; pmb_mysql_query($req, $dbh); //Suppression des emprises liées à la notice $req = "select map_emprise_id from map_emprises where map_emprise_type=11 and map_emprise_obj_num=" . $id; $result = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $query = "delete from map_emprises where map_emprise_obj_num=" . $id . " and map_emprise_type=11"; pmb_mysql_query($query, $dbh); $req_areas = "delete from map_hold_areas where type_obj=11 and id_obj=" . $row->map_emprise_id; pmb_mysql_query($req_areas, $dbh); } $query = "update docwatch_items set item_num_notice=0 where item_num_notice = " . $id; pmb_mysql_query($query, $dbh); // Nettoyage indexation concepts $index_concept = new index_concept($id, TYPE_NOTICE); $index_concept->delete(); }
function get_file_from_temp($filename, $name, $upload_place) { global $base_path; global $ck_index; global $id_rep, $up_place; $up_place = $upload_place; create_tableau_mimetype(); $ck_index = true; //Initialisation des tableaux d'infos $this->infos_docnum = $this->params = array(); $this->infos_docnum["mime"] = trouve_mimetype($filename, extension_fichier($name)); $this->infos_docnum["nom"] = substr($name, 0, strrpos($name, ".")); if (!$this->infos_docnum["nom"]) { $this->infos_docnum["nom"] = $name; } $this->infos_docnum["notice"] = $this->explnum_notice; $this->infos_docnum["bull"] = $this->explnum_bulletin; $this->infos_docnum["url"] = ""; $this->infos_docnum["fic"] = false; $this->infos_docnum["contenu_vignette"] = construire_vignette('', substr($filename, strrpos($filename, "/"))); $this->infos_docnum["userfile_name"] = $name; $this->infos_docnum["userfile_ext"] = extension_fichier($name); if ($up_place && $id_rep != 0) { $upfolder = new upload_folder($id_rep); $chemin_hasher = "/"; if ($upfolder->isHashing()) { $rep = $upfolder->hachage($this->infos_docnum["userfile_name"]); @mkdir($rep); $chemin_hasher = $upfolder->formate_path_to_nom($rep); $file_name = $rep . $this->infos_docnum["userfile_name"]; $chemin = $upfolder->formate_path_to_save($chemin_hasher); } else { $file_name = $upfolder->get_path($this->infos_docnum["userfile_name"]) . $this->infos_docnum["userfile_name"]; $chemin = $upfolder->formate_path_to_save("/"); } $this->infos_docnum["path"] = $chemin; $file_name = $upfolder->encoder_chaine($file_name); if (!$this->explnum_nomfichier) { //Si je suis en création de fichier numérique $nom_tmp = $this->infos_docnum["userfile_name"]; $continue = true; $compte = 1; do { $query = "select explnum_notice,explnum_id from explnum where explnum_nomfichier = '" . addslashes($nom_tmp) . "' AND explnum_repertoire='" . $id_rep . "' AND explnum_path='" . addslashes($this->infos_docnum["path"]) . "'"; $result = mysql_query($query); if (mysql_num_rows($result) && mysql_result($result, 0, 0) != $this->infos_docnum["notice"]) { //Si j'ai déjà un document numérique avec ce fichier pour une autre notice je dois le renommer pour ne pas perdre l'ancien if (preg_match("/^(.+)(\\..+)\$/i", $this->infos_docnum["userfile_name"], $matches)) { $nom_tmp = $matches[1] . "_" . $compte . $matches[2]; } else { $nom_tmp = $this->infos_docnum["userfile_name"] . "_" . $compte; } $compte++; } else { if (mysql_num_rows($result)) { //J'ai déjà ce fichier pour cette notice //Je dois enlever l'ancien document numérique pour ne pas l'avoir en double $old_docnum = new explnum(mysql_result($result, 0, 1)); $old_docnum->delete(); } else { } $continue = false; } } while ($continue); if ($compte != 1) { $this->infos_docnum["userfile_name"] = $nom_tmp; if ($upfolder->isHashing()) { $file_name = $rep . $this->infos_docnum["userfile_name"]; } else { $file_name = $upfolder->get_path($this->infos_docnum["userfile_name"]) . $this->infos_docnum["userfile_name"]; } $file_name = $upfolder->encoder_chaine($file_name); } else { } } else { } rename($filename, $file_name); } else { //enregistrement en base $this->infos_docnum["contenu"] = file_get_contents($filename); } $this->params["maj_mimetype"] = true; $this->params["maj_data"] = true; $this->params["maj_vignette"] = true; }
function delete() { $explnum = new \explnum($this->explnum_id); $explnum->delete(); }
<?php // +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: del_explnum.inc.php,v 1.8 2009-07-03 09:35:43 kantin Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } //verification des droits de modification notice $acces_m = 1; if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_1 = $ac->setDomain(1); $acces_m = $dom_1->getRights($PMBuserid, $id, 8); } if ($acces_m == 0) { error_message('', htmlentities($dom_1->getComment('mod_enum_error'), ENT_QUOTES, $charset), 1, ''); } else { print "<div class=\"row\"><h1>{$msg[313]}</h1></div>"; $expl = new explnum($explnum_id); $expl->delete(); print "<div class='row'><div class='msg-perio'>" . $msg[maj_encours] . "</div></div>"; $id_form = md5(microtime()); $retour = "./catalog.php?categ=isbd&id={$id}"; print "\n\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t</form>\n\t\t<script type=\"text/javascript\">document.dummy.submit();</script>\n\t\t</div>\n\t\t"; }
$ac = new acces(); $dom_1 = $ac->setDomain(1); $acces_j = $dom_1->getJoin($PMBuserid, 8, 'bulletin_notice'); $q = "select count(1) from bulletins {$acces_j} where bulletin_id=" . $bul_id; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_result($r, 0, 0) == 0) { $acces_m = 0; } } if ($acces_m == 0) { if (!$explnum_id) { error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, ''); } else { error_message('', htmlentities($dom_1->getComment('mod_enum_error'), ENT_QUOTES, $charset), 1, ''); } } else { // affichage des infos du bulletinage pour rappel $bulletinage = new bulletinage_display($bul_id); print pmb_bidi("<div class='row'><h2>" . $bulletinage->display . '</h2></div>'); // l'annulation du form renvoit a : $annuler = "./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . $bul_id; $action = "./catalog.php?categ=serials&sub=bulletinage&action=explnum_update"; if ($explnum_id) { $suppr = "./catalog.php?categ=serials&sub=bulletinage&action=explnum_delete&bul_id={$bul_id}&explnum_id={$explnum_id}"; } $explnum = new explnum($explnum_id, 0, $bul_id); print $explnum->explnum_form($action, $annuler, $suppr); } ?>
function export_doc_num($item = 0, $chemin) { global $dbh, $charset, $msg; $pattern_nom_fichier_doc_num = "!!explnumid!!_!!idnotice!!_!!idbulletin!!_!!indicedocnum!!_!!nomdoc!!"; if ($this->type == "NOTI") { $requete = "select explnum_id, explnum_notice as numnotice, explnum_bulletin, explnum_data, explnum_extfichier, explnum_nomfichier, length(explnum_data) as taille "; $requete .= " FROM explnum WHERE "; $requete .= " explnum_notice={$item} "; } elseif ($this->type == "BULL") { $requete = "select explnum_id, bulletin_notice as numnotice, explnum_bulletin, explnum_data, explnum_extfichier, explnum_nomfichier, length(explnum_data) as taille "; $requete .= " FROM explnum JOIN bulletins on bulletin_id=explnum_bulletin WHERE "; $requete .= " explnum_bulletin={$item} "; } else { return; } // pas encore de document numérique attaché à un exemplaire $requete .= " and ((explnum_data is not null and explnum_data!='') OR (explnum_nomfichier is not null and explnum_nomfichier!=''))"; $result = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}"); for ($i = 0; $i < pmb_mysql_num_rows($result); $i++) { $t = pmb_mysql_fetch_object($result); $t->explnum_id = str_pad($t->explnum_id, 6, "0", STR_PAD_LEFT); $t->numnotice = str_pad($t->numnotice, 6, "0", STR_PAD_LEFT); $t->explnum_bulletin = str_pad($t->explnum_bulletin, 6, "0", STR_PAD_LEFT); $nomfic = $pattern_nom_fichier_doc_num; $nomfic = str_replace("!!explnumid!!", str_pad($t->explnum_id, 6, "0", STR_PAD_LEFT), $nomfic); $nomfic = str_replace("!!idnotice!!", str_pad($t->numnotice, 6, "0", STR_PAD_LEFT), $nomfic); $nomfic = str_replace("!!idbulletin!!", str_pad($t->explnum_bulletin, 6, "0", STR_PAD_LEFT), $nomfic); $nomfic = str_replace("!!indicedocnum!!", str_pad($i, 3, "0", STR_PAD_LEFT), $nomfic); $nomfic = str_replace("!!nomdoc!!", $t->explnum_nomfichier, $nomfic); $hf = fopen($chemin . $nomfic, "w"); if ($hf) { $explnum = new explnum($t->explnum_id); fwrite($hf, $explnum->get_file_content()); fclose($hf); $ret .= "<li>" . $msg[caddie_expdocnum_wtrue] . " <a href=\"" . $chemin . $nomfic . "\">" . htmlentities($nomfic, ENT_QUOTES, $charset) . "</a></li>"; } else { $ret .= "<li><i>" . $msg[caddie_expdocnum_wfalse] . " " . htmlentities($nomfic, ENT_QUOTES, $charset) . "</i></li>"; } } if ($ret) { return "<blockquote>" . $msg[caddie_expdocnum_dir] . " " . htmlentities($chemin, ENT_QUOTES, $charset) . "<br /><ul>" . $ret . "</ul></blockquote>"; } else { return; } }
function upload_file() { global $f_fichier, $id_lig, $typ_lig, $id_prod, $no, $base_path; global $id_rep, $path, $up_place, $f_fichier, $f_url, $deflt_upload_repertoire, $pmb_indexation_docnum, $pmb_indexation_docnum_default, $ck_index; switch ($typ_lig) { case '1': //notice //notice case '5': //article $f_notice = $id_prod; $f_bulletin = 0; break; case '2': //bulletin $f_notice = 0; $f_bulletin = $id_prod; break; default: //non catalogué break; } if (($f_notice || $f_bulletin) && $f_fichier) { $up_place = 0; $id_rep = 0; $path = ''; $ck_index = 0; if ($deflt_upload_repertoire) { $id_rep = $deflt_upload_repertoire; if ($id_rep) { $r = new upload_folder($id_rep); $path = $r->repertoire_nom; $up_place = 1; } } if ($pmb_indexation_docnum && $pmb_indexation_docnum_default) { $ck_index = 1; } $explnum = new explnum(); $retour = $base_path . '/acquisition/achats/receptions/receptions_frame.php?action=delivery&no=' . $no . '&id_lig=' . $id_lig . '&typ_lig=' . $typ_lig . '&id_prod=' . $id_prod; $explnum->mise_a_jour($f_notice, $f_bulletin, '', $f_url, $retour, 0, 0); } return; }
function explnum_add_from_url($f_notice_id, $f_bulletin_id, $f_nom, $f_url, $overwrite = true, $source_id = 0, $filename = '', $f_path = '', $f_statut) { global $dbh, $base_path; if ($f_bulletin_id) { $f_notice_id = 0; } else { if (!$f_bulletin_id && $f_notice_id) { $f_bulletin_id = 0; } } if (!$overwrite) { $sql_find = "SELECT count(*) FROM explnum WHERE explnum_notice = " . $f_notice_id . " AND explnum_nom = '" . addslashes($f_nom) . "'"; $res = pmb_mysql_query($sql_find, $dbh); $count = pmb_mysql_result($res, 0, 0); if ($count) { return; } } $sql_delete = "DELETE FROM explnum WHERE explnum_notice = " . $f_notice_id . " AND explnum_nom = '" . addslashes($f_nom) . "' "; pmb_mysql_query($sql_delete, $dbh); $original_filename = basename($f_url); $extension = substr($original_filename, strripos($original_filename, '.') * 1 + 1); $tmp_filename = explnum::static_rename($extension); if ($filename) { $new_filename = $filename; } else { $new_filename = $tmp_filename; } //copie en répertoire temporaire $r = false; if (file_exists($f_url) && filesize($f_url)) { //document en repertoire $r = copy($f_url, $base_path . '/temp/' . $tmp_filename); } else { //url $aCurl = new Curl(); $content = $aCurl->get($f_url); $content = $content->body; $r = file_put_contents("{$base_path}/temp/" . $tmp_filename, $content); } if ($r) { //construction vignette $vignette = construire_vignette('', $tmp_filename); create_tableau_mimetype(); $mimetype = trouve_mimetype("{$base_path}/temp/" . $tmp_filename, $extension); //si la source du connecteur est précisée, on regarde si on a pas un répertoire associé $rep_upload = 0; if ($source_id) { $check_rep = "select rep_upload from connectors_sources where source_id = " . $source_id; $res = pmb_mysql_query($check_rep); if (pmb_mysql_num_rows($res)) { $rep_upload = pmb_mysql_result($res, 0, 0); } } if ($rep_upload != 0) { $upload_folder = new upload_folder($rep_upload); $rep_path = $upload_folder->get_path($new_filename); if ($f_path && file_exists($rep_path . $f_path)) { $rep_path = $rep_path . $f_path . '/'; } if (file_exists($upload_folder->encoder_chaine($rep_path . $new_filename))) { $suffix = 1; $ext = extension_fichier($new_filename); $file = str_replace("." . $ext, "", basename($new_filename)); while (file_exists($upload_folder->encoder_chaine($rep_path . $file . "_" . $suffix . "." . $ext))) { $suffix++; } $new_filename = $file . "_" . $suffix . "." . $ext; } rename("{$base_path}/temp/" . $tmp_filename, $upload_folder->encoder_chaine($rep_path . $new_filename)); $path = $upload_folder->formate_path_to_save($upload_folder->formate_path_to_nom($rep_path)); $insert_sql = "INSERT INTO explnum (explnum_notice, explnum_bulletin, explnum_nom, explnum_nomfichier, explnum_mimetype, explnum_extfichier, explnum_vignette, explnum_repertoire, explnum_path, explnum_docnum_statut) VALUES ("; $insert_sql .= $f_notice_id . ","; $insert_sql .= $f_bulletin_id . ","; $insert_sql .= "'" . addslashes($f_nom) . "',"; $insert_sql .= "'" . addslashes($new_filename) . "',"; $insert_sql .= "'" . addslashes($mimetype) . "',"; $insert_sql .= "'" . addslashes($extension) . "',"; $insert_sql .= "'" . addslashes($vignette) . "',"; $insert_sql .= "'" . addslashes($rep_upload) . "',"; $insert_sql .= "'" . addslashes($path) . "',"; $insert_sql .= $f_statut; $insert_sql .= ")"; } else { $insert_sql = "INSERT INTO explnum (explnum_notice, explnum_bulletin, explnum_nom, explnum_nomfichier, explnum_mimetype, explnum_extfichier, explnum_data, explnum_vignette, explnum_docnum_statut) VALUES ("; $insert_sql .= $f_notice_id . ","; $insert_sql .= $f_bulletin_id . ","; $insert_sql .= "'" . addslashes($f_nom) . "',"; $insert_sql .= "'" . addslashes($new_filename) . "',"; $insert_sql .= "'" . addslashes($mimetype) . "',"; $insert_sql .= "'" . addslashes($extension) . "',"; $insert_sql .= "'" . addslashes($content) . "',"; $insert_sql .= "'" . addslashes($vignette) . "',"; $insert_sql .= $f_statut; $insert_sql .= ")"; } if (pmb_mysql_query($insert_sql, $dbh)) { $docnum_id = pmb_mysql_insert_id($dbh); if ($docnum_id) { $index = new indexation_docnum($docnum_id); $index->indexer(); } } /* $aCurl = new Curl(); $content = $aCurl->get($f_url); $content = $content->body; $origine=str_replace(" ","",microtime()); $origine=str_replace("0.","",$origine); $original_filename = basename($f_url); if( $filename != "") $afilename = $filename; else $afilename = $origine.$original_filename; if (!$original_filename) $original_filename = $afilename; file_put_contents("$base_path/temp/".$afilename, $content); */ /* $vignette = construire_vignette('', $afilename); create_tableau_mimetype(); $afilename_ext=extension_fichier($afilename); $mimetype = trouve_mimetype("$base_path/temp/".$afilename, $afilename_ext); $extension = strrchr($afilename, '.'); //si la source du connecteur est précisée, on regarde si on a pas un répertoire associé if ($source_id){ $check_rep = "select rep_upload from connectors_sources where source_id = ".$source_id; $res = pmb_mysql_query($check_rep); if(pmb_mysql_num_rows($res)){ $rep_upload = pmb_mysql_result($res,0,0); } } */ /* if($rep_upload != 0){ $upload_folder = new upload_folder($rep_upload); $rep_path = $upload_folder->get_path($afilename); if ($f_path && file_exists($rep_path.$f_path)) { $rep_path=$rep_path.$f_path.'/'; } copy("$base_path/temp/".$afilename,$rep_path.$afilename); $path =$upload_folder->formate_path_to_save($upload_folder->formate_path_to_nom($rep_path)); $insert_sql = "INSERT INTO explnum (explnum_notice, explnum_nom, explnum_nomfichier, explnum_mimetype, explnum_extfichier, explnum_vignette, explnum_repertoire, explnum_path) VALUES ("; $insert_sql .= $f_notice_id.","; $insert_sql .= "'".addslashes($f_nom)."',"; $insert_sql .= "'".addslashes($afilename)."',"; $insert_sql .= "'".addslashes($mimetype)."',"; $insert_sql .= "'".addslashes($extension)."',"; $insert_sql .= "'".addslashes($vignette)."',"; $insert_sql .= "'".addslashes($rep_upload)."',"; $insert_sql .= "'".addslashes($path)."'"; $insert_sql .= ")"; }else{ $insert_sql = "INSERT INTO explnum (explnum_notice, explnum_nom, explnum_nomfichier, explnum_mimetype, explnum_extfichier, explnum_data, explnum_vignette) VALUES ("; $insert_sql .= $f_notice_id.","; $insert_sql .= "'".addslashes($f_nom)."',"; $insert_sql .= "'".addslashes($afilename)."',"; $insert_sql .= "'".addslashes($mimetype)."',"; $insert_sql .= "'".addslashes($extension)."',"; $insert_sql .= "'".addslashes($content)."',"; $insert_sql .= "'".addslashes($vignette)."'"; $insert_sql .= ")"; } pmb_mysql_query($insert_sql, $dbh); unlink("$base_path/temp/".$afilename); */ } }
// +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: explnum_create.inc.php,v 1.13 2009-07-07 13:14:53 kantin Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } // gestion des exemplaires numériques //verification des droits de modification notice $acces_m = 1; if ($gestion_acces_active == 1 && $gestion_acces_user_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_1 = $ac->setDomain(1); $acces_m = $dom_1->getRights($PMBuserid, $id, 8); } if ($acces_m == 0) { error_message('', htmlentities($dom_1->getComment('mod_noti_error'), ENT_QUOTES, $charset), 1, ''); } else { require_once "{$include_path}/templates/explnum.tpl.php"; print "<h1>" . $msg[explnum_ajouter_doc] . "</h1>"; $notice = new mono_display($id, 1, './catalog.php?categ=modif&id=!!id!!', FALSE); print pmb_bidi("<div class='row'><b>" . $notice->header . "</b><br />"); print pmb_bidi($notice->isbd . '</div>'); print "<div class=\"row\">"; $nex = new explnum(0, $id, 0); $explnum_form = $nex->explnum_form('./catalog.php?categ=explnum_update&sub=create', "./catalog.php?categ=isbd&id={$id}"); print $explnum_form; print "</div>"; }
function get_next_notice($lender = "", $td = array(), $sd = array(), $keep_expl = false, $params = array()) { global $is_expl_caddie; global $include_path, $lang; global $opac_show_book_pics; global $dbh, $charset; if (!$is_expl_caddie) { $requete_panier = "select count(*) from expl_cart_id"; $res_panier = @pmb_mysql_query($requete_panier); if ($res_panier) { $is_expl_caddie = 2; } else { $is_expl_caddie = 1; } } unset($this->xml_array); $this->xml_array = array(); $this->notice = ""; if ($this->current_notice != -1 && array_search($this->notice_list[$this->current_notice], $this->notice_exporte) !== false) { $this->current_notice++; if ($this->current_notice >= count($this->notice_list)) { $this->current_notice = -1; } return true; } if ($this->current_notice != -1) { //Recuperation des infos de la notice $requete = "select * from notices where notice_id=" . $this->notice_list[$this->current_notice]; $resultat = pmb_mysql_query($requete); $res = pmb_mysql_fetch_object($resultat); if (!$res) { return false; } //Remplissage des champs immediats //Numero unique de la base $this->add_field("001", "", "", $res->notice_id); //Champ de traitement if ($charset == "utf-8") { $encodage = "50 "; } else { $encodage = "0103"; } $c100 = substr($res->create_date, 0, 4) . substr($res->create_date, 5, 2) . substr($res->create_date, 8, 2) . "u u u0frey" . $encodage . " ba"; $this->add_field("100", " ", array("a" => $c100), ""); //Titre $titre[c] = "200"; $titre[ind] = "1 "; $labels = array("a", "c", "d", "e"); $subfields = array(); for ($i = 1; $i < 5; $i++) { $v = ""; eval("\$v=\$res->tit{$i};"); $subfields[$labels[$i - 1]] = $v; } if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') { $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins WHERE num_notice=" . $res->notice_id; $result_bull = pmb_mysql_query($req_bulletin); while ($bull = pmb_mysql_fetch_object($result_bull)) { $subfields["h"] = $bull->bulletin_numero; $subfields["i"] = $bull->bulletin_titre; $subfields["9"] = "id:" . $bull->bulletin_id; } } $this->add_field("200", "1 ", $subfields); //Titres Uniformes $rqt_tu = "select * from notices_titres_uniformes,titres_uniformes where tu_id =ntu_num_tu and ntu_num_notice = '" . $this->notice_list[$this->current_notice] . "' order by ntu_ordre"; $result_tu = pmb_mysql_query($rqt_tu); if (pmb_mysql_num_rows($result_tu)) { while ($row_tu = pmb_mysql_fetch_object($result_tu)) { $subfields = array(); $subfields["9"] = "id:" . $row_tu->tu_id; $subfields["a"] = $row_tu->tu_name; $subfields["u"] = $row_tu->tu_tonalite; $subfields["n"] = $row_tu->tu_comment; $subfields["i"] = $row_tu->ntu_titr; $subfields["k"] = $row_tu->ntu_date; $subfields["l"] = $row_tu->ntu_sous_vedette; $subfields["m"] = $row_tu->ntu_langue; $subfields["q"] = $row_tu->ntu_version; $subfields["w"] = $row_tu->ntu_mention; $rqt_tucomp = "SELECT * FROM tu_distrib WHERE distrib_num_tu='" . $row_tu->tu_id . "' ORDER BY distrib_ordre,distrib_name"; $result_tucomp = pmb_mysql_query($rqt_tucomp); if (pmb_mysql_num_rows($result_tucomp)) { while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) { $subfields["r"][] = $row_tucomp->distrib_name; } } $rqt_tucomp = "SELECT * FROM tu_ref WHERE ref_num_tu='" . $row_tu->tu_id . "' ORDER BY ref_ordre,ref_name"; $result_tucomp = pmb_mysql_query($rqt_tucomp); if (pmb_mysql_num_rows($result_tucomp)) { while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) { $subfields["s"][] = $row_tucomp->ref_name; } } $rqt_tucomp = "SELECT * FROM tu_subdiv WHERE subdiv_num_tu='" . $row_tu->tu_id . "' ORDER BY subdiv_ordre,subdiv_name"; $result_tucomp = pmb_mysql_query($rqt_tucomp); if (pmb_mysql_num_rows($result_tucomp)) { while ($row_tucomp = pmb_mysql_fetch_object($result_tucomp)) { $subfields["j"][] = $row_tucomp->subdiv_name; } } $this->add_field("500", "10", $subfields); } } //Titre du pério pour les notices de bulletin $subfields = array(); if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') { $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1 as titre from bulletins, notices WHERE bulletin_notice=notice_id AND num_notice=" . $res->notice_id; $result_bull = pmb_mysql_query($req_bulletin); while ($bull = pmb_mysql_fetch_object($result_bull)) { $subfields["a"] = $bull->titre; } } $this->add_field("530", " ", $subfields); //Date en 210 pour les notices de bulletin $subfields = array(); if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') { $req_bulletin = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins WHERE num_notice=" . $res->notice_id; $result_bull = pmb_mysql_query($req_bulletin); while ($bull = pmb_mysql_fetch_object($result_bull)) { $subfields["h"] = $bull->date_date; $subfields["d"] = $bull->mention_date; } } $this->add_field("210", " ", $subfields); //isbn $subfields = array(); $subfields["a"] = $res->code; $subfields["d"] = $res->prix; $this->add_field("010", " ", $subfields); // URL $subfields = array(); $subfields["u"] = $res->lien; $subfields["q"] = $res->eformat; $this->add_field("856", " ", $subfields); //Langage $rqttmp_lang = "select type_langue,code_langue from notices_langues where num_notice='{$res->notice_id}' order by ordre_langue "; $restmp_lang = pmb_mysql_query($rqttmp_lang); $ind = "0 "; $subfields_101 = array(); while ($tmp_lang = pmb_mysql_fetch_object($restmp_lang)) { if ($tmp_lang->type_langue) { $ind = "1 "; $subfields_101['c'][] = $tmp_lang->code_langue; } else { $subfields_101['a'][] = $tmp_lang->code_langue; } } $this->add_field('101', $ind, $subfields_101); //Mention d'edition $subfields = array(); $subfields["a"] = $res->mention_edition; $this->add_field("205", " ", $subfields); //Collation $subfields = array(); $subfields["a"] = $res->npages; $subfields["c"] = $res->ill; $subfields["d"] = $res->size; $subfields["e"] = $res->accomp; $this->add_field("215", " ", $subfields); //Notes $subfields = array(); $subfields["a"] = $res->n_gen; $this->add_field("300", " ", $subfields); $subfields["a"] = $res->n_contenu; $this->add_field("327", " ", $subfields); $subfields["a"] = $res->n_resume; $this->add_field("330", " ", $subfields); //Auteurs //Recherche des auteurs; $requete = "select author_id, author_type, author_name, author_rejete, author_date, responsability_fonction, responsability_type \n\t\t\t,author_subdivision, author_lieu,author_ville, author_pays,author_numero,author_web, author_comment\n\t\t\tfrom authors, responsability where responsability_notice=" . $res->notice_id . " and responsability_author=author_id order by responsability_ordre asc"; $resultat = pmb_mysql_query($requete) or die(pmb_mysql_error() . "<br />" . $requete); while ($auth = pmb_mysql_fetch_object($resultat)) { //Si c'est un 70 (individuel) alors on l'exporte $subfields = array(); $attrs = array(); if ($params["include_authorite_ids"]) { $attrs["id"] = $auth->author_id; } if ($auth->author_type == "70") { // Personne physique //Champ = author_type + responsability_type (70 + 0 pour auteur principal = 700 !) $auth_code = $auth->author_type . $auth->responsability_type; $subfields["a"] = $auth->author_name; $subfields["b"] = $auth->author_rejete; $subfields["c"] = $auth->author_comment; //Fonction $subfields["4"] = $auth->responsability_fonction; //Dates if ($auth->author_date != "") { $subfields["f"] = $auth->author_date; } $subfields["N"] = $auth->author_web; $subfields["9"] = "id:" . $auth->author_id; $this->add_field($auth_code, " 1", $subfields, "", $attrs); } elseif ($auth->author_type == "71" || $auth->author_type == "72") { //Collectivité $auth_code = $auth->author_type . $auth->responsability_type; $subfields["a"] = $auth->author_name; $subfields["b"] = $auth->author_subdivision; $subfields["c"] = $auth->author_comment; $subfields["g"] = $auth->author_rejete; $subfields["d"] = $auth->author_numero; //Fonction $subfields["4"] = $auth->responsability_fonction; //Dates if ($auth->author_date != "") { $subfields["f"] = $auth->author_date; } $lieu = $auth->author_lieu; if ($auth->author_ville) { if ($lieu) { $lieu .= "; "; } $lieu .= $auth->author_ville; } if ($auth->author_pays) { if ($lieu) { $lieu .= "; "; } $lieu .= $auth->author_pays; } $subfields["e"] = $lieu; $subfields["K"] = $auth->author_lieu; $subfields["L"] = $auth->author_ville; $subfields["M"] = $auth->author_pays; $subfields["N"] = $auth->author_web; $subfields["9"] = "id:" . $auth->author_id; if ($auth->author_type == "71") { $auth_code = $auth->author_type . $auth->responsability_type; $this->add_field($auth_code, "02", $subfields, "", $attrs); } elseif ($auth->author_type == "72") { $auth_code = "71" . $auth->responsability_type; $this->add_field($auth_code, "12", $subfields, "", $attrs); } } } //Editeurs et date de la notice $c102_export = false; //Le champ 102 n'est pas répétable $requete = "select * from publishers where ed_id =" . $res->ed1_id; $resultat = pmb_mysql_query($requete); $subfields = array(); $attrs = array(); if ($params["include_authorite_ids"]) { $attrs["id"] = $res->ed1_id; } if ($ed1 = pmb_mysql_fetch_object($resultat)) { $subfields["a"] = $ed1->ed_ville; $subfields["b"] = trim($ed1->ed_adr1 . "\n" . $ed1->ed_adr2 . "\n" . $ed1->ed_cp . "\n" . $ed1->ed_ville . "\n" . $ed1->ed_pays); $subfields["c"] = $ed1->ed_name; $subfields["d"] = $res->year; $subfields["z"] = $ed1->ed_pays; if (trim($ed1->ed_pays)) { $parser = new XMLlist("{$include_path}/marc_tables/{$lang}/country.xml"); $parser->analyser(); if ($tmp = array_search(trim($ed1->ed_pays), $parser->table)) { $subfields_102 = array(); $subfields_102["a"] = mb_strtolower($tmp); $this->add_field("102", " ", $subfields_102); $c102_export = true; } } $subfields["9"][] = "id:" . $ed1->ed_id; if (trim($ed1->ed_web)) { $subfields["9"][] = "web:" . $ed1->ed_web; } if (trim($ed1->ed_comment)) { $subfields["9"][] = "comment:" . $ed1->ed_comment; } if (trim($ed1->ed_cp)) { $subfields["9"][] = "cp:" . $ed1->ed_cp; } if (trim($ed1->ed_adr1)) { $subfields["9"][] = "adr1:" . $ed1->ed_adr1; } if (trim($ed1->ed_adr2)) { $subfields["9"][] = "adr2:" . $ed1->ed_adr2; } } elseif ($res->year && $res->niveau_biblio != 'b') { $subfields["d"] = $res->year; } $this->add_field("210", " ", $subfields, "", $attrs); $requete = "select * from publishers where ed_id =" . $res->ed2_id; $resultat = pmb_mysql_query($requete); $subfields = array(); $attrs = array(); if ($params["include_authorite_ids"]) { $attrs["id"] = $res->ed2_id; } if ($ed1 = pmb_mysql_fetch_object($resultat)) { $subfields["a"] = $ed1->ed_ville; $subfields["b"] = trim($ed1->ed_adr1 . "\n" . $ed1->ed_adr2 . "\n" . $ed1->ed_cp . "\n" . $ed1->ed_ville . "\n" . $ed1->ed_pays); $subfields["c"] = $ed1->ed_name; $subfields["d"] = $res->year; $subfields["z"] = $ed1->ed_pays; if (trim($ed1->ed_pays) && !$c102_export) { $parser = new XMLlist("{$include_path}/marc_tables/{$lang}/country.xml"); $parser->analyser(); if ($tmp = array_search(trim($ed1->ed_pays), $parser->table)) { $subfields_102 = array(); $subfields_102["a"] = mb_strtolower($tmp); $this->add_field("102", " ", $subfields_102); } } $subfields["9"][] = "id:" . $ed1->ed_id; if (trim($ed1->ed_web)) { $subfields["9"][] = "web:" . $ed1->ed_web; } if (trim($ed1->ed_comment)) { $subfields["9"][] = "comment:" . $ed1->ed_comment; } if (trim($ed1->ed_cp)) { $subfields["9"][] = "cp:" . $ed1->ed_cp; } if (trim($ed1->ed_adr1)) { $subfields["9"][] = "adr1:" . $ed1->ed_adr1; } if (trim($ed1->ed_adr2)) { $subfields["9"][] = "adr2:" . $ed1->ed_adr2; } } $this->add_field("210", " ", $subfields, "", $attrs); //Collections $requete = "select * from collections where collection_id=" . $res->coll_id; $resultat = pmb_mysql_query($requete); $subfields = array(); $subfields_410 = array(); $subfields_411 = array(); $subfields_s = array(); $attrs = array(); if ($params["include_authorite_ids"]) { $attrs["id"] = $res->coll_id; } if ($col = pmb_mysql_fetch_object($resultat)) { $subfields["a"] = $col->collection_name; $subfields_410["t"] = $col->collection_name; $subfields["v"] = $res->nocoll; $subfields_410["v"] = $res->nocoll; $subfields["x"] = $col->collection_issn; $subfields_410["x"] = $col->collection_issn; $subfields["9"] = "id:" . $res->coll_id; $subfields_410["9"] = "id:" . $res->coll_id; } //Recherche des sous collections $requete = "select * from sub_collections where sub_coll_id=" . $res->subcoll_id; $resultat = pmb_mysql_query($requete); if ($subcol = pmb_mysql_fetch_object($resultat)) { $subfields_s["i"] = $subcol->sub_coll_name; $subfields_411["t"] = $subcol->sub_coll_name; $subfields_s["x"] = $subcol->sub_coll_issn; $subfields_411["x"] = $subcol->sub_coll_issn; $subfields_s["9"] = "id:" . $res->subcoll_id; $subfields_411["9"] = "id:" . $res->subcoll_id; } $attrs2 = array(); if ($params["include_authorite_ids"]) { $attrs2["id"] = $res->subcoll_id; } $this->add_field("225", "2 ", $subfields, "", $attrs); $this->add_field("410", " 0", $subfields_410, "", $attrs); $this->add_field("225", "2 ", $subfields_s, "", $attrs2); $this->add_field("411", " 0", $subfields_411, "", $attrs2); $requete = "select * from series where serie_id=" . $res->tparent_id; $resultat = pmb_mysql_query($requete); $subfields = array(); $attrs = array(); if ($serie = pmb_mysql_fetch_object($resultat)) { $subfields["t"] = $serie->serie_name; $subfields["v"] = $res->tnvol; if ($params["include_authorite_ids"]) { $attrs["id"] = $serie->serie_id; } } $this->add_field("461", " 0", $subfields, '', $attrs); //dewey $subfields = array(); //Recher du code dewey $requete = "select * from indexint where indexint_id=" . $res->indexint; $resultat = pmb_mysql_query($requete); if ($code_dewey = pmb_mysql_fetch_object($resultat)) { $subfields["a"] = $code_dewey->indexint_name; $subfields["l"] = $code_dewey->indexint_comment; $subfields["9"] = "id:" . $code_dewey->indexint_id; $this->add_field("676", " ", $subfields); } //Vignette if ($opac_show_book_pics) { $vignette = get_vignette($this->notice_list[$this->current_notice]); if ($vignette) { $this->add_field("896", " ", array("a" => $vignette)); } } if ($keep_expl) { if ($res->niveau_biblio == 'b' && $res->niveau_hierar == '2') { //Si c'est une notice de bulletin $requete = "SELECT bulletin_id FROM bulletins WHERE num_notice='" . $res->notice_id . "'"; $res_bull = pmb_mysql_query($requete); if (pmb_mysql_num_rows($res_bull)) { $id_bull = pmb_mysql_result($res_bull, 0, 0); if (array_search($id_bull, $this->bulletins_exporte) === false && array_search($id_bull, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $id_bull; } } } else { //Si non //Traitement des exemplaires $this->processing_expl($lender, $td, $sd, $params, $res->notice_id, 0); } } //Mots cles $subfields = array(); $subfields["a"] = $res->index_l; $this->add_field("610", "0 ", $subfields); //Descripteurs $requete = "SELECT libelle_categorie,categories.num_noeud,categories.langue,categories.num_thesaurus FROM categories, notices_categories WHERE notcateg_notice=" . $res->notice_id . " and categories.num_noeud = notices_categories.num_noeud ORDER BY ordre_categorie"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { for ($i = 0; $i < pmb_mysql_num_rows($resultat); $i++) { $subfields = array(); $subfields["9"][] = "id:" . pmb_mysql_result($resultat, $i, 1); $subfields["9"][] = "lang:" . pmb_mysql_result($resultat, $i, 2); $subfields["9"][] = "idthes:" . pmb_mysql_result($resultat, $i, 3); $subfields["a"] = pmb_mysql_result($resultat, $i, 0); $this->add_field("606", " 1", $subfields); } } //Champs perso de notice traite par la table notice_custom $this->processing_cp("notices", $res->notice_id); //Notices liées, relations entre notices if ($params["genere_lien"]) { //On choisit d'exporter les notices mères if ($params["mere"]) { $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where num_notice=" . $res->notice_id . " order by num_notice, rank asc"; $resultat = pmb_mysql_query($requete); while ($notice_fille = pmb_mysql_fetch_object($resultat)) { $requete_mere = "SELECT * FROM notices WHERE notice_id=" . $notice_fille->linked_notice; $resultat_mere = pmb_mysql_query($requete_mere); while ($notice_mere = pmb_mysql_fetch_object($resultat_mere)) { $subfields = array(); $list_titre = array(); $list_auteurs = array(); $list_options = array(); //On recopie les informations de la notice fille if ($params["notice_mere"]) { $subfields["0"] = $notice_mere->notice_id; } $list_titre[] = $notice_mere->tit1 ? $notice_mere->tit1 : " "; //auteur $rqt_aut = "select author_name, author_rejete from responsability join authors on author_id = responsability_author and responsability_notice=" . $notice_mere->notice_id . " where responsability_type != 2 order by responsability_type,responsability_ordre"; $res_aut = pmb_mysql_query($rqt_aut); $mere_aut = array(); while ($mere_aut = pmb_mysql_fetch_object($res_aut)) { $list_auteurs[] = $mere_aut->author_name . ($mere_aut->author_rejete ? ", " . $mere_aut->author_rejete : ""); } $list_options[] = "bl:" . $notice_mere->niveau_biblio . $notice_mere->niveau_hierar; $list_options[] = "id:" . $notice_mere->notice_id; if ($notice_fille->rank) { $list_options[] = "rank:" . $notice_fille->rank; } if ($notice_fille->relation_type) { $list_options[] = "type_lnk:" . $notice_fille->relation_type; } $list_options[] = 'lnk:parent'; $subfields["9"] = $list_options; //Relation avec mono = ISBN if ($notice_mere->niveau_biblio == 'm' && $notice_mere->niveau_hierar == '0') { if ($notice_mere->code) { $subfields["y"] = $notice_mere->code; } $subfields["t"] = $list_titre; $subfields["a"] = $list_auteurs; } //Relation avec pério = ISSN if ($notice_mere->niveau_biblio == 's' && $notice_mere->niveau_hierar == '1') { if ($notice_mere->code) { $subfields["x"] = $notice_mere->code; } $subfields["t"] = $list_titre; } //Relation avec articles if ($notice_mere->niveau_biblio == 'a' && $notice_mere->niveau_hierar == '2') { $req_art = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from analysis join bulletins on bulletin_id=analysis_bulletin join notices on bulletin_notice=notice_id where analysis_notice=" . $notice_mere->notice_id; $result_art = pmb_mysql_query($req_art); while ($notice_art = pmb_mysql_fetch_object($result_art)) { $subfields["d"] = $notice_art->date_date; $subfields["e"] = $notice_art->mention_date; $subfields["v"] = $notice_art->bulletin_numero; if ($notice_art->code) { $subfields["x"] = $notice_art->code; } $list_titre[] = $notice_art->bulletin_titre ? $notice_art->bulletin_titre : " "; $list_titre[] = $notice_art->tit1 ? $notice_art->tit1 : " "; $subfields["t"] = $list_titre; if ($keep_expl && array_search($notice_art->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_art->bulletin_id; } } } //Relation avec bulletins if ($notice_mere->niveau_biblio == 'b' && $notice_mere->niveau_hierar == '2') { $req_bull = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from bulletins join notices on bulletin_notice=notice_id WHERE num_notice=" . $notice_mere->notice_id; $result_bull = pmb_mysql_query($req_bull); while ($notice_bull = pmb_mysql_fetch_object($result_bull)) { $subfields["d"] = $notice_bull->date_date; $subfields["e"] = $notice_bull->mention_date; $subfields["v"] = $notice_bull->bulletin_numero; if ($notice_bull->code) { $subfields["x"] = $notice_bull->code; } $list_titre[] = $notice_bull->bulletin_titre ? $notice_bull->bulletin_titre : " "; $list_titre[] = $notice_bull->tit1 ? $notice_bull->tit1 : " "; $subfields["t"] = $list_titre; if ($keep_expl && array_search($notice_bull->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_bull->bulletin_id; } } } $list_attribut = new XMLlist("{$include_path}/marc_tables/{$lang}/relationtypeup_unimarc.xml"); $list_attribut->analyser(); $table_attribut = $list_attribut->table; //On teste si la relation est spéciale, de type contient dans une boite if ($notice_fille->relation_type == 'd') { $indicateur = "d0"; } else { $indicateur = " "; } $this->add_field($table_attribut[$notice_fille->relation_type], $indicateur, $subfields); //On exporte les notices mères liées if ($params["notice_mere"] && array_search($notice_mere->notice_id, $this->notice_exporte) === false) { $this->notice_list[] = $notice_mere->notice_id; } } } } //On choisit d'exporter les notices filles if ($params["fille"]) { $requete = "SELECT num_notice, linked_notice, relation_type, rank from notices_relations where linked_notice=" . $res->notice_id . " order by num_notice, rank asc"; $resultat = pmb_mysql_query($requete); while ($notice_mere = pmb_mysql_fetch_object($resultat)) { $requete_fille = "SELECT * FROM notices WHERE notice_id=" . $notice_mere->num_notice; $resultat_fille = pmb_mysql_query($requete_fille); while ($notice_fille = pmb_mysql_fetch_object($resultat_fille)) { $subfields = array(); $list_titre = array(); $list_options = array(); //On recopie les informations de la notice fille if ($params["notice_fille"]) { $subfields["0"] = $notice_fille->notice_id; } $list_titre[] = $notice_fille->tit1 ? $notice_fille->tit1 : " "; $list_options[] = "bl:" . $notice_fille->niveau_biblio . $notice_fille->niveau_hierar; $list_options[] = "id:" . $notice_fille->notice_id; if ($notice_mere->rank) { $list_options[] = "rank:" . $notice_mere->rank; } if ($notice_mere->relation_type) { $list_options[] = "type_lnk:" . $notice_mere->relation_type; } $list_options[] = 'lnk:child'; $subfields["9"] = $list_options; //Relation avec mono = ISBN if ($notice_fille->niveau_biblio == 'm' && $notice_fille->niveau_hierar == '0') { if ($notice_fille->code) { $subfields["y"] = $notice_fille->code; } $subfields["t"] = $list_titre; } //Relation avec pério = ISSN if ($notice_fille->niveau_biblio == 's' && $notice_fille->niveau_hierar == '1') { if ($notice_fille->code) { $subfields["x"] = $notice_fille->code; } $subfields["t"] = $list_titre; } //Relation avec articles if ($notice_fille->niveau_biblio == 'a' && $notice_fille->niveau_hierar == '2') { $req_art = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from analysis join bulletins on bulletin_id=analysis_bulletin join notices on bulletin_notice=notice_id where analysis_notice=" . $notice_fille->notice_id; $result_art = pmb_mysql_query($req_art); while ($notice_art = pmb_mysql_fetch_object($result_art)) { $subfields["d"] = $notice_art->date_date; $subfields["e"] = $notice_art->mention_date; $subfields["v"] = $notice_art->bulletin_numero; if ($notice_art->code) { $subfields["x"] = $notice_art->code; } $list_titre[] = $notice_art->bulletin_titre ? $notice_art->bulletin_titre : " "; $list_titre[] = $notice_art->tit1 ? $notice_art->tit1 : " "; $subfields["t"] = $list_titre; if ($keep_expl && array_search($notice_art->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_art->bulletin_id; } } } //Relation avec bulletins if ($notice_fille->niveau_biblio == 'b' && $notice_fille->niveau_hierar == '2') { $req_bull = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero, tit1, code from bulletins join notices on bulletin_notice=notice_id WHERE num_notice=" . $notice_fille->notice_id; $result_bull = pmb_mysql_query($req_bull); while ($notice_bull = pmb_mysql_fetch_object($result_bull)) { $subfields["d"] = $notice_bull->date_date; $subfields["e"] = $notice_bull->mention_date; $subfields["v"] = $notice_bull->bulletin_numero; if ($notice_bull->code) { $subfields["x"] = $notice_bull->code; } $list_titre[] = $notice_bull->bulletin_titre ? $notice_bull->bulletin_titre : " "; $list_titre[] = $notice_bull->tit1 ? $notice_bull->tit1 : " "; $subfields["t"] = $list_titre; if ($keep_expl && array_search($notice_bull->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_bull->bulletin_id; } } } $list_attribut = new XMLlist("{$include_path}/marc_tables/{$lang}/relationtypedown_unimarc.xml"); $list_attribut->analyser(); $table_attribut = $list_attribut->table; //On teste si la relation est spéciale, de type contient dans une boite if ($notice_fille->relation_type == 'd') { $indicateur = "d0"; } else { $indicateur = " "; } $this->add_field($table_attribut[$notice_mere->relation_type], $indicateur, $subfields); //On exporte les notices filles liées if ($params["notice_fille"] && array_search($notice_fille->notice_id, $this->notice_exporte) === false) { $this->notice_list[] = $notice_fille->notice_id; } } } } //On choisit d'exporter les liens vers les périodiques pour les notices d'article if ($params["perio_link"]) { $req_perio_link = "SELECT notice_id, tit1, code from bulletins,analysis,notices WHERE bulletin_notice=notice_id and bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id; $result_perio_link = pmb_mysql_query($req_perio_link); while ($notice_perio_link = pmb_mysql_fetch_object($result_perio_link)) { $subfields_461 = array(); $list_options = array(); if ($params["notice_perio"]) { $subfields_461["0"] = $notice_perio_link->notice_id; } $subfields_461["t"] = $notice_perio_link->tit1 ? $notice_perio_link->tit1 : " "; if ($notice_perio_link->code) { $subfields_461["x"] = $notice_perio_link->code; } $attrs = array("id" => $notice_perio_link->notice_id); $list_options[] = "id:" . $notice_perio_link->notice_id; $list_options[] = 'lnk:perio'; $subfields_461["9"] = $list_options; $this->add_field("461", " ", $subfields_461, '', $attrs); //On exporte les notices de pério liées if ($params["notice_perio"] && array_search($notice_perio_link->notice_id, $this->notice_exporte) === false) { $this->notice_list[] = $notice_perio_link->notice_id; } } } //On génère le bulletinage pour les notices de pério if ($params["bulletinage"]) { $req_bulletinage = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, notices WHERE bulletin_notice = notice_id AND notice_id=" . $res->notice_id; $result_bulletinage = pmb_mysql_query($req_bulletinage); while ($notice_bulletinage = pmb_mysql_fetch_object($result_bulletinage)) { $subfields_462 = array(); $list_options = array(); $attrs = array("id" => $notice_bulletinage->bulletin_id); $subfields_462["d"] = $notice_bulletinage->date_date; $subfields_462["e"] = $notice_bulletinage->mention_date; $subfields_462["v"] = $notice_bulletinage->bulletin_numero; $subfields_462["t"] = $notice_bulletinage->bulletin_titre ? $notice_bulletinage->bulletin_titre : " "; $list_options[] = "id:" . $notice_bulletinage->bulletin_id; $list_options[] = 'lnk:bull'; $subfields_462["9"] = $list_options; $this->add_field("462", " ", $subfields_462, '', $attrs); if ($keep_expl && array_search($notice_bulletinage->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bulletinage->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_bulletinage->bulletin_id; } } } //On choisit d'exporter les liens vers les bulletins pour les notices d'article if ($params["bull_link"]) { $req_bull_link = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, bulletin_numero from bulletins, analysis WHERE bulletin_id=analysis_bulletin and analysis_notice=" . $res->notice_id; $result_bull_link = pmb_mysql_query($req_bull_link); while ($notice_bull_link = pmb_mysql_fetch_object($result_bull_link)) { $subfields_463 = array(); $list_options = array(); $attrs = array("id" => $notice_bull_link->bulletin_id); $subfields_463["d"] = $notice_bull_link->date_date; $subfields_463["e"] = $notice_bull_link->mention_date; $subfields_463["v"] = $notice_bull_link->bulletin_numero; $subfields_463["t"] = $notice_bull_link->bulletin_titre ? $notice_bull_link->bulletin_titre : " "; $list_options[] = "id:" . $notice_bull_link->bulletin_id; $list_options[] = 'lnk:bull'; $subfields_463["9"] = $list_options; $this->add_field("463", " ", $subfields_463, '', $attrs); if ($keep_expl && array_search($notice_bull_link->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_bull_link->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_bull_link->bulletin_id; } } } //On choisit d'exporter les liens vers les articles pour les notices de pério if ($params["art_link"]) { $req_art_link = "SELECT bulletin_id, bulletin_numero, date_date, mention_date, bulletin_titre, analysis_notice, a.tit1 as titre, a.npages as page from notices p left join bulletins on bulletin_notice=p.notice_id left join analysis on analysis_bulletin=bulletin_id join notices a on a.notice_id=analysis_notice WHERE p.notice_id=" . $res->notice_id; $result_art_link = pmb_mysql_query($req_art_link); while ($notice_art_link = pmb_mysql_fetch_object($result_art_link)) { $subfields_464 = array(); $tab_titre = array(); $list_options = array(); $attrs = array("id" => $notice_art_link->analysis_notice); $tab_titre[] = $notice_art_link->titre ? $notice_art_link->titre : " "; $tab_titre[] = $notice_art_link->bulletin_titre ? $notice_art_link->bulletin_titre : " "; if ($params["notice_art"]) { $subfields_464["0"] = $notice_art_link->analysis_notice; } $subfields_464["t"] = $tab_titre; $subfields_464["d"] = $notice_art_link->date_date; $subfields_464["e"] = $notice_art_link->mention_date; $subfields_464["v"] = $notice_art_link->bulletin_numero; $list_options[] = "id:" . $notice_art_link->analysis_notice; $list_options[] = "page:" . $notice_art_link->page; $list_options[] = 'lnk:art'; $subfields_464["9"] = $list_options; $this->add_field("464", " ", $subfields_464, '', $attrs); if ($keep_expl && array_search($notice_art_link->bulletin_id, $this->bulletins_exporte) === false && array_search($notice_art_link->bulletin_id, $this->expl_bulletin_a_exporter) === false) { //Si on exporte les exemplaires on garde l'ID du bulletin pour exporter ses exemplaires $this->expl_bulletin_a_exporter[] = $notice_art_link->bulletin_id; } //On exporte les notices d'articles liées if ($params["notice_art"] && array_search($notice_art_link->analysis_notice, $this->notice_exporte) === false) { $this->notice_list[] = $notice_art_link->analysis_notice; } } } } //Etat de collection if ($res->niveau_biblio == 's' && $res->niveau_hierar == '1') { $req = "SELECT collections_state.*, archempla_libelle, archtype_libelle, archstatut_opac_libelle, archstatut_gestion_libelle, location_libelle FROM collections_state " . "LEFT JOIN arch_emplacement ON archempla_id=collstate_emplacement " . "LEFT JOIN arch_type ON archtype_id=collstate_type " . "LEFT JOIN arch_statut ON archstatut_id=collstate_statut " . "LEFT JOIN docs_location ON idlocation=location_id " . "WHERE id_serial='" . $res->notice_id . "'"; $res_etat = pmb_mysql_query($req); if ($res_etat && pmb_mysql_num_rows($res_etat)) { while ($etat = pmb_mysql_fetch_object($res_etat)) { $subfields = array(); $attrs = array(); $subfields["9"] = "id:" . $etat->collstate_id; $subfields["a"] = $etat->location_libelle; $subfields["b"] = $etat->state_collections; $subfields["c"] = $etat->archempla_libelle; $subfields["d"] = $etat->archtype_libelle; $subfields["e"] = $etat->collstate_origine; $subfields["f"] = $etat->collstate_cote; $subfields["g"] = $etat->collstate_archive; $subfields["h"] = $etat->archstatut_opac_libelle; $subfields["i"] = $etat->collstate_lacune; $subfields["j"] = $etat->collstate_note; $subfields["k"] = $etat->archstatut_gestion_libelle; $this->add_field("950", " ", $subfields, "", $attrs); //Export des cp d'etat de collection $this->processing_cp("collstate", $etat->collstate_id, $etat->collstate_id); } } } //Documents numeriques if ($params['docnum']) { // recuperation des documents numeriques $q = "select explnum_id from explnum where explnum_notice='" . $res->notice_id . "' "; $q .= "union "; $q .= "select explnum_id from explnum, bulletins where bulletin_id = explnum_bulletin and bulletins.num_notice='" . $res->notice_id . "' "; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { while ($row = pmb_mysql_fetch_object($r)) { $subfields_897 = array(); $dn = new explnum($row->explnum_id); if ($dn->isURL()) { //URL $subfields_897['a'] = $dn->explnum_url; $subfields_897['b'] = $dn->explnum_nom; $subfields_897['f'] = ''; $subfields_897['p'] = ''; } elseif ($dn->isEnUpload() && $params['docnum_rep']) { //Répertoire $dest_file = $dn->copy_to($params['docnum_rep'], true); if ($dest_file) { $subfields_897['a'] = $dest_file; $subfields_897['b'] = $dn->explnum_nom ? $dn->explnum_nom : $dn->explnum_nomfichier; $subfields_897['f'] = $dn->explnum_nomfichier; $subfields_897['p'] = ''; } } elseif ($dn->isEnBase() && $params['docnum_rep']) { //Base $dest_file = $dn->copy_to($params['docnum_rep'], true); if ($dest_file) { $subfields_897['a'] = $dest_file; $subfields_897['b'] = $dn->explnum_nom ? $dn->explnum_nom : $dn->explnum_nomfichier; $subfields_897['f'] = $dn->explnum_nomfichier; $subfields_897['p'] = ''; } } if (count($subfields_897)) { $this->add_field('897', ' ', $subfields_897); } } } } //Record field $biblio = $res->niveau_biblio; $hierar = $res->niveau_hierar; if ($biblio == 'b' && $hierar == '2') { //si on a un bulletin on modifie b2 en s2 $biblio = 's'; $hierar = '2'; } $this->xml_array['rs']['value'] = "n"; $this->xml_array['dt']['value'] = $res->typdoc; $this->xml_array['bl']['value'] = $biblio; $this->xml_array['hl']['value'] = $hierar; $this->xml_array['el']['value'] = 1; $this->xml_array['ru']['value'] = "i"; if (array_search($res->notice_id, $this->notice_exporte) === false) { $this->notice_exporte[] = $res->notice_id; } $this->toxml(); $this->current_notice++; if ($this->current_notice >= count($this->notice_list)) { $this->current_notice = -1; } return true; } else { return false; } }
function createFile($name, $data = null) { if ($this->check_write_permission()) { global $base_path; global $id_rep; global $charset; if ($charset !== 'utf-8') { $name = utf8_decode($name); } $filename = realpath($base_path . "/temp/") . "/webdav_" . md5($name . time()) . "." . extension_fichier($name); $fp = fopen($filename, "w"); if (!$fp) { //on a pas le droit d'écriture throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $filename . ')'); } while ($buf = fread($data, 1024)) { fwrite($fp, $buf); } fclose($fp); if (!filesize($filename)) { //Erreur de copie du fichier //unlink($filename); //throw new Sabre_DAV_Exception_FileNotFound('Empty file (filename ' . $filename . ')'); } $notice_id = $this->get_notice_by_meta($name, $filename); $this->update_notice($notice_id); $explnum = new \explnum(0, $notice_id); $id_rep = $this->config['upload_rep']; $explnum->get_file_from_temp($filename, $name, $this->config['up_place']); $explnum->update(); if (file_exists($filename)) { unlink($filename); } } else { //on a pas le droit d'écriture throw new DAV\Exception\Forbidden('Permission denied to create file (filename ' . $name . ')'); } }