titre = stripslashes($tit); $sug->editeur = stripslashes($edi); $sug->auteur = stripslashes($aut); $sug->code = stripslashes($cod); $sug->num_notice=$id_notice; $pri = str_replace(',','.',$pri); if (is_numeric($pri)) $sug->prix = $pri; $sug->url_suggestion = stripslashes($url_sug); $sug->commentaires = stripslashes($com); $sug->commentaires_gestion = stripslashes($com_gestion); $sug->nb=$nombre_expl; $sug->date_publi = $date_publi; $sug->sugg_src = $sug_src; $q = "select count(1) from docs_location where idlocation = '".$sugg_location_id."' "; $r = pmb_mysql_query($q); if ($sugg_location_id && pmb_mysql_result($r, 0, 0)) { $sug->sugg_location=$sugg_location_id; } else { $sug->sugg_location=0; } // chargement de la PJ $explnum_doc = ""; if($_FILES['piece_jointe_sug']['name']){ $explnum_doc = new explnum_doc(); $explnum_doc->load_file($_FILES['piece_jointe_sug']); $explnum_doc->analyse_file(); } if (!$id_sug) { $sug->statut = $sug_map->getFirstStateId(); $sug->date_creation = today(); if ($num_categ && suggestions_categ::exists($num_categ)) { $sug->num_categ=$num_categ; } else { $sug->num_categ='1'; } $sug->save($explnum_doc); $sug_orig = new suggestions_origine($orig, $sug->id_suggestion); $sug_orig->type_origine = $typ; $sug_orig->save(); } else { if ($num_categ && suggestions_categ::exists($num_categ)) { $sug->num_categ=$num_categ; } $sug->save($explnum_doc); if($creator_orig_id){ $sug_orig = new suggestions_origine($creator_orig_id, $sug->id_suggestion); $sug_orig->type_origine = $typ; $sug_orig->save(); } } } //Fusionne les suggestions cochées //En cours/Validées function sug_fusChk(){ global $dbh; global $msg, $charset; global $error; global $current_module; global $chk; global $bt_fusVal, $script; global $sug_map; $tab_enc = array(); $tab_val = array(); foreach($chk as $key=>$id_sug) { $sug = new suggestions($id_sug); $state_name = $sug_map->getStateNameFromId($sug->statut); $merge=$sug_map->getState_MERGE($state_name); if ($merge == 'FROM') $tab_enc[] = $sug; if ($merge == 'TO') $tab_val[] = $sug; } $titre = htmlentities($msg['acquisition_sug_fus'].' : '.$msg['acquisition_sug'], ENT_QUOTES, $charset); $action ="./acquisition.php?categ=sug&action=fusVal"; print "

$titre

"; $parity=1; if(count($tab_val) != 0) { //S'il y a des suggestions validées, on ne peut fusionner qu'avec l'une d'elles. foreach($tab_val as $key=>$sug) { $lib_statut = htmlentities($msg['acquisition_sug_val'], ENT_QUOTES, $charset); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" onclick=\"document.getElementById('chk[".$sug->id_suggestion."]').checked = true;\""; print (""); } foreach($tab_enc as $key=>$sug) { $lib_statut = htmlentities($msg['acquisition_sug_enc'], ENT_QUOTES, $charset); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" "; print (""); } } else { //Sinon on peut fusionner avec n'importe quelle suggestion. foreach($tab_val as $key=>$sug) { $lib_statut = htmlentities($msg['acquisition_sug_val'], ENT_QUOTES, $charset); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" onclick=\"document.getElementById('chk[".$sug->id_suggestion."]').checked = true;\""; print (""); } foreach($tab_enc as $key=>$sug) { $lib_statut = htmlentities($msg['acquisition_sug_enc'], ENT_QUOTES, $charset); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = "onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='".$pair_impair."'\" onclick=\"document.getElementById('chk[".$sug->id_suggestion."]').checked = true;\""; print (""); } } print "
".htmlentities($msg['acquisition_sug_dat_cre'], ENT_QUOTES, $charset)." ".htmlentities($msg['acquisition_sug_tit'], ENT_QUOTES, $charset)." ".htmlentities($msg['acquisition_sug_edi'], ENT_QUOTES, $charset)." ".htmlentities($msg['acquisition_sug_aut'], ENT_QUOTES, $charset)." ".htmlentities($msg['acquisition_sug_etat'], ENT_QUOTES, $charset)."  
".formatdate($sug->date_creation)." ".htmlentities($sug->titre, ENT_QUOTES, $charset)." ".htmlentities($sug->editeur, ENT_QUOTES, $charset)." ".htmlentities($sug->auteur, ENT_QUOTES, $charset)." $lib_statut
".formatdate($sug->date_creation)." ".htmlentities($sug->titre, ENT_QUOTES, $charset)." ".htmlentities($sug->editeur, ENT_QUOTES, $charset)." ".htmlentities($sug->auteur, ENT_QUOTES, $charset)." $lib_statut
".formatdate($sug->date_creation)." ".htmlentities($sug->titre, ENT_QUOTES, $charset)." ".htmlentities($sug->editeur, ENT_QUOTES, $charset)." ".htmlentities($sug->auteur, ENT_QUOTES, $charset)." $lib_statut
".formatdate($sug->date_creation)." ".htmlentities($sug->titre, ENT_QUOTES, $charset)." ".htmlentities($sug->editeur, ENT_QUOTES, $charset)." ".htmlentities($sug->auteur, ENT_QUOTES, $charset)." $lib_statut
".$bt_fusVal."
"; print $script; } //Valide la fusion de suggestions function sug_fusVal(){ global $dbh; global $msg, $charset; global $chk, $sug; $fus = new suggestions($chk[0]); $q = suggestions_origine::listOccurences($chk[0], 1); $tab_orig = pmb_mysql_query($q, $dbh); $row_orig = pmb_mysql_fetch_object($tab_orig); $orig = $row_orig->origine; foreach($sug as $key=>$id_sug) { if ($id_sug != $chk[0]){ suggestions::delete($id_sug); suggestions_origine::fusionne($orig, $id_sug, $chk[0]); } } } //Recuperation du statut session d'affichage des suggestions function getSessionSugState() { global $deflt3sug_statut; if ((!isset($_SESSION['sug_statut']) || !$_SESSION['sug_statut']) && $deflt3sug_statut) { $_SESSION['sug_statut']=$deflt3sug_statut; } return $_SESSION['sug_statut']; } //Definition du statut session d'affichage des suggestions function setSessionSugState($statut) { $_SESSION['sug_statut']=$statut; return; } //Catalogue la notice à partir du blob unimarc function save_unimarc_notice(){ global $msg, $idbibli, $id_sug, $dbh; $req_uni = "select notice_unimarc from suggestions where id_suggestion='".$id_sug."'"; $res = pmb_mysql_query($req_uni,$dbh); if(pmb_mysql_num_rows($res)){ $notice_uni = pmb_mysql_result($res,0,0); } $z=new z3950_notice("form"); if($notice_uni) $z->notice = $notice_uni; $ret=$z->insert_in_database(); if ($ret[0]) { if($z->bull_id && $z->perio_id){ $notice_display=new serial_display($ret[1],6); } else $notice_display=new mono_display($ret[1],6); $retour = "
".$msg["z3950_integr_not_ok"]." ".$notice_display->result."
"; if($z->bull_id && $z->perio_id) $url_view = analysis::get_permalink($ret[1], $z->bull_id); else $url_view = notice::get_permalink($ret[1]); $retour .= "
 
"; print $retour; //On attache la notice à la suggestion $req = " update suggestions set num_notice='".$ret[1]."' where id_suggestion='".$id_sug."'"; pmb_mysql_query($req,$dbh); } else if ($ret[1]){ if($z->bull_id && $z->perio_id){ $notice_display=new serial_display($ret[1],6); } else $notice_display=new mono_display($ret[1],6); $retour = "
$msg[540]
".($msg["z3950_integr_not_existait"])."

".$notice_display->result."
"; if($z->bull_id && $z->perio_id) $url_view = analysis::get_permalink($ret[1], $z->bull_id); else $url_view = notice::get_permalink($ret[1]); $retour .= "
 
"; print $retour; //On attache la notice à la suggestion $req = " update suggestions set num_notice='".$ret[1]."' where id_suggestion='".$id_sug."'"; pmb_mysql_query($req,$dbh); } else { $retour = ""; $retour .= form_error_message($msg["connecteurs_cant_integrate_title"], ($ret[1]?$msg["z3950_integr_not_existait"]:$msg["z3950_integr_not_newrate"]), $msg["connecteurs_back_to_list"], "catalog.php?categ=search&mode=7&sub=launch",array("serialized_search"=>$sc->serialize_search())); print $retour; } } /* * Formulaire de validation de la suppression de notice */ function catalog_notice_form(){ global $msg, $chk, $statut; $display = "

".$msg["acquisition_catalog_notice_associee"]."

".$msg["acquisition_catalog_notice_ask"]."
"; if($chk) $display .= ""; $display .= "
"; print $display; } ?>