setDomain(1); $acces_j = $dom_1->getJoin($PMBuserid,8,'bulletin_notice'); $q = "select count(1) from bulletins $acces_j where bulletin_id=".$expl_bulletin; $r = mysql_query($q, $dbh); if(mysql_result($r,0,0)==0) { $acces_m=0; } } if ($acces_m==0) { if (!$expl_id) { error_message('', htmlentities($dom_1->getComment('mod_bull_error'), ENT_QUOTES, $charset), 1, ''); } else { error_message('', htmlentities($dom_1->getComment('mod_expl_error'), ENT_QUOTES, $charset), 1, ''); } } else { // le form d'exemplaire renvoit : // Je nettoie ce qui me parait devoir etre nettoye // $bul_id // $id_form // $org_cb // $expl_id // $expl_bulletin // $expl_typdoc $expl_cote = clean_string($expl_cote); // $expl_section // $expl_statut // $expl_location // $expl_codestat $expl_note = clean_string($expl_note); $expl_comment = clean_string($f_ex_comment); $expl_prix = clean_string($expl_prix); // $expl_owner //Verification des champs personalises $p_perso=new parametres_perso("expl"); $nberrors=$p_perso->check_submited_fields(); if ($nberrors) { error_message_history($msg["notice_champs_perso"],$p_perso->error_message,1); exit(); } // controle sur le nouveau code barre si applicable : if($org_cb != $f_ex_cb) { // si le nouveau code-barre est deja utilise, on reste sur l'ancien $requete = "SELECT expl_id FROM exemplaires WHERE expl_cb='$f_ex_cb'"; $myQuery = mysql_query($requete, $dbh); if(!($result=mysql_result($myQuery, 0, 0))) { $expl_cb = $f_ex_cb; } else { // Verif si expl_id est celui poste if($expl_id == $result[0]) { $expl_cb = $org_cb; } else { //Erreur: code barre deja existant error_message_history($msg[301],$msg[303],1); exit(); } } } else { $expl_cb = $f_ex_cb; } // on prepare la date de creation ou modification $expl_date = today(); // on recupere les valeurs $formlocid="f_ex_section".$expl_location ; $expl_section=$$formlocid ; if(!is_numeric($f_ex_nbparts) || !$f_ex_nbparts) $f_ex_nbparts=1; $transfert_origine=""; if($expl_id){ $rqt = "SELECT id_transfert FROM transferts, transferts_demande WHERE num_transfert=id_transfert and etat_transfert=0 AND num_expl='".$expl_id."' " ; $res = mysql_query ( $rqt ); if (!mysql_num_rows($res)){ // pas de transfert en cours, on met à jour transfert_location_origine $transfert_origine= ", transfert_location_origine='$expl_location', transfert_statut_origine='$expl_statut' "; } }else{ // en création $transfert_origine= ", transfert_location_origine='$expl_location', transfert_statut_origine='$expl_statut' "; } // preparation de la requete if($expl_id) { $audit=new audit(); $audit->get_old_infos("SELECT expl_statut, expl_location, transfert_location_origine, transfert_statut_origine, expl_owner FROM exemplaires WHERE expl_cb='$expl_cb' "); // update de l'exemplaire // on prepare la requete $values = "expl_cb='$expl_cb'"; $values .= ", expl_typdoc='$expl_typdoc'"; $values .= ", expl_cote='$expl_cote'"; $values .= ", expl_section='$expl_section'"; $values .= ", expl_statut='$expl_statut'"; $values .= ", expl_location='$expl_location' $transfert_origine "; $values .= ", expl_codestat='$expl_codestat'"; $values .= ", expl_note='$expl_note'"; $values .= ", expl_comment='$expl_comment'"; $values .= ", expl_prix='$expl_prix'"; $values .= ", expl_owner='$expl_owner'"; $values .= ", type_antivol='$type_antivol'"; $values .= ", expl_nbparts='$f_ex_nbparts'"; $requete = "UPDATE exemplaires SET $values WHERE expl_id=$expl_id AND expl_notice=0 LIMIT 1"; $myQuery = mysql_query($requete, $dbh); $audit->get_new_infos("SELECT expl_statut, expl_location, transfert_location_origine, transfert_statut_origine, expl_owner FROM exemplaires WHERE expl_cb='$expl_cb' "); $audit->save_info_modif(AUDIT_EXPL, $expl_id,"bul_expl_update.inc.php"); } else { // insertion d'un nouvel exemplaire $values = "expl_cb='$expl_cb'"; $values .= ", expl_notice='0'"; $values .= ", expl_bulletin='$expl_bulletin'"; $values .= ", expl_typdoc='$expl_typdoc'"; $values .= ", expl_cote='$expl_cote'"; $values .= ", expl_section='$expl_section'"; $values .= ", expl_statut='$expl_statut'"; $values .= ", expl_location='$expl_location' $transfert_origine "; $values .= ", expl_codestat='$expl_codestat'"; $values .= ", expl_note='$expl_note'"; $values .= ", expl_comment='$expl_comment'"; $values .= ", expl_prix='$expl_prix'"; $values .= ", expl_owner='$expl_owner'"; $values .= ", type_antivol='$type_antivol'"; $values .= ", expl_nbparts='$f_ex_nbparts'"; $requete = "INSERT INTO exemplaires set $values , create_date=sysdate() "; $myQuery = mysql_query($requete, $dbh); $expl_id=mysql_insert_id(); audit::insert_creation(AUDIT_EXPL, $expl_id) ; } //Insertion des champs personalises $p_perso->rec_fields_perso($expl_id); // Mise a jour de la table notices_mots_global_index pour toutes les notices en relation avec l'exemplaire $req_maj="SELECT bulletin_notice,num_notice, analysis_notice FROM bulletins LEFT JOIN analysis ON analysis_bulletin=bulletin_id WHERE bulletin_id='".$expl_bulletin."'"; $res_maj=mysql_query($req_maj); if($res_maj && mysql_num_rows($res_maj)){ $first=true;//Pour la premiere ligne de résultat on doit indexer aussi la notice de périodique et de bulletin au besoin while ( $ligne=mysql_fetch_object($res_maj) ) { if($first){ if($ligne->bulletin_notice){ notice::majNoticesMotsGlobalIndex($ligne->bulletin_notice,'expl'); } if($ligne->num_notice){ notice::majNoticesMotsGlobalIndex($ligne->num_notice,'expl'); } } if($ligne->analysis_notice){ notice::majNoticesMotsGlobalIndex($ligne->analysis_notice,'expl'); } $first=false; } } $id_form = md5(microtime()); print "
".$msg[maj_encours]."
"; $retour = "./catalog.php?categ=serials&sub=view&sub=bulletinage&action=view&bul_id=$expl_bulletin"; if ($pointage) { $templates=" "; } else { print "
"; } } ?>