示例#1
0
     $value['location'] = $f_loc;
     $value['statut_principal'] = $statut_principal;
     $value['statut_others'] = $statut_others;
     $value['comment'] = $comment;
     $groupexpl->save($value);
     $sel_search_form = str_replace("!!bouton_ajouter!!", $bouton_ajouter, $sel_search_form);
     $sel_search_form = str_replace("!!deb_rech!!", htmlentities(stripslashes($f_user_input), ENT_QUOTES, $charset), $sel_search_form);
     print $sel_search_form;
     print $jscript;
     show_results($dbh, $user_input, $nbr_lignes, $page);
     break;
 case "add_expl":
     if ($id_groupexpl) {
         print $jscript;
         $informations = array();
         $groupexpl = new groupexpl($id_groupexpl);
         $exemplaires = explode(",", $expl_list);
         $flag_error = 0;
         if (count($exemplaires)) {
             foreach ($exemplaires as $cb) {
                 $added = $groupexpl->add_expl($cb);
                 if ($added) {
                     $informations[$cb] = $groupexpl->info_message;
                     print "<script type='text/javascript'>\n\t\t\t\t\t\t\tset_parent('groupexpl_name_" . $cb . "','" . $id_groupexpl . "','" . $groupexpl->info['name'] . "');\n\t\t\t\t\t\t</script>";
                 } else {
                     $id_group = $groupexpl->get_id_group_from_cb($cb);
                     $error_html_message = "<a style='cursor:pointer' onclick=\"window.opener.document.location.href='./circ.php?categ=groupexpl&action=form&id=" . $id_group . "'\">" . $groupexpl->get_name_group_from_id($id_group) . "</a>";
                     $informations[$cb] = $groupexpl->error_message . " " . $error_html_message;
                     $flag_error = 1;
                 }
             }
示例#2
0
 function fetch_data()
 {
     global $f_loc, $montrerquoi;
     $f_loc += 0;
     $this->info = array();
     $this->error_message = "";
     $this->info_message = "";
     $req = "select * from groupexpl   ";
     if ($f_loc) {
         $req .= " where groupexpl_location ={$f_loc} ";
     }
     $i = 0;
     $resultat = mysql_query($req);
     if (mysql_num_rows($resultat)) {
         while ($r = mysql_fetch_object($resultat)) {
             $groupexpl = new groupexpl($r->id_groupexpl);
             if ($montrerquoi == "pret" && !$groupexpl->group_is_check_out()) {
                 continue;
             }
             if ($montrerquoi == "error" && !$groupexpl->group_have_error()) {
                 continue;
             }
             $this->info[] = $groupexpl->info;
         }
     }
 }
 function do_form_retour($action_piege = 0, $piege_resa = 0)
 {
     global $msg, $dbh, $form_retour_tpl, $script_magnetique, $pmb_antivol, $deflt_docs_location, $pmb_transferts_actif;
     global $transferts_retour_origine, $transferts_retour_origine_force;
     global $script_antivol_rfid, $pmb_rfid_activate, $pmb_rfid_serveur_url, $transferts_retour_action_defaut;
     global $expl_section, $retour_ok_tpl, $retour_intouvable_tpl, $categ;
     global $pmb_resa_retour_action_defaut, $pmb_hide_retdoc_loc_error;
     global $alert_sound_list, $pmb_play_pret_sound, $pmb_lecteurs_localises;
     global $pmb_resa_planning, $pmb_location_resa_planning;
     global $pmb_pret_groupement;
     global $pmb_expl_show_lastempr;
     global $transferts_retour_action_autorise_autre;
     global $transferts_validation_actif;
     $form_retour_tpl_temp = $form_retour_tpl;
     if (!$this->expl_id) {
         // l'exemplaire est inconnu
         $this->expl_form = "<div class='erreur'>" . $this->expl_cb . "&nbsp;: {$msg[367]}</div>";
         // Ajouter ici la recherche empr
         if ($this->expl_cb) {
             // on a un code-barres, est-ce un cb empr ?
             $query_empr = "select id_empr, empr_cb from empr where empr_cb='" . $this->expl_cb . "' ";
             $result_empr = pmb_mysql_query($query_empr, $dbh);
             if (pmb_mysql_num_rows($result_empr)) {
                 $this->expl_form .= "<script type=\"text/javascript\">document.location='./circ.php?categ=pret&form_cb={$this->expl_cb}'</script>";
             }
         }
         $alert_sound_list[] = "information";
         return false;
     }
     // En  retour de document, si pas en prêt, on n'effectue plus aucun traitement (transfert, résa...)
     $expl_no_checkout = 0;
     $query = "select * from pret where pret_idexpl=" . $this->expl_id;
     $res = pmb_mysql_query($query, $dbh);
     if (!pmb_mysql_num_rows($res) && $categ != "ret_todo" && !$piege_resa && !$action_piege) {
         $alert_sound_list[] = "critique";
         $expl_no_checkout = 1;
     } else {
         $this->expl->expl_location_origine = $this->expl->expl_location;
         // sera recalculer dans si transferts actif
     }
     //	if($pmb_lecteurs_localises) {
     if (!$expl_no_checkout && $this->expl->expl_location != $deflt_docs_location && !$piege_resa && $deflt_docs_location) {
         // l'exemplaire n'appartient pas à cette localisation
         if ($pmb_transferts_actif == "1" && !isset($action_piege)) {
             // transfert actif et pas de forcage effectué
             if (transfert::is_retour_exemplaire_loc_origine($this->expl_id)) {
                 $action_piege = 0;
                 // l'action par défaut résoud le pb
                 //est ce qu'on peut force le retour en local
             } elseif ($transferts_retour_origine == "1" && $transferts_retour_origine_force == "0") {
                 //pas de forcage possible, on interdit le retour
                 $question_form = "<div class='message_important'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "critique";
                 $this->piege = 2;
             } elseif ($transferts_retour_action_autorise_autre == 1) {
                 //formulaire de Quoi faire?
                 $selected[$transferts_retour_action_defaut] = " checked ";
                 $question_form = "\n\t\t\t\t\t\t<form name='piege' method='post' action='" . $this->url . "&form_cb_expl=" . rawurlencode(stripslashes($this->expl_cb)) . "' >\n\t\t\t\t\t\t<div class='message_important'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class='erreur'>\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"0\" {$selected['2']}>&nbsp;" . $msg["transferts_circ_retour_accepter_retour"] . "<br />\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"2\" {$selected['1']}>&nbsp;" . $msg["transferts_circ_retour_changer_loc"] . "&nbsp;" . $this->get_liste_section() . "<br />\n\t\t\t\t\t\t\t<input type=\"radio\" name=\"action_piege\" value=\"3\" {$selected['0']}>&nbsp;" . $msg["transferts_circ_retour_traiter_plus_tard"] . "<br />\n\t\t\t\t\t\t\t<input type=\"submit\" class=\"bouton\" value=\"" . $msg["transferts_circ_retour_exec_action"] . "\" >\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</form>";
                 $alert_sound_list[] = "question";
                 $this->piege = 1;
             } else {
                 $action_piege = 0;
                 $alert_sound_list[] = "information";
             }
             /*
             				}else{
             					$action_piege=1;	
             					$alert_sound_list[]="information";
             				}	*/
         } elseif (!$pmb_transferts_actif) {
             if (!$pmb_hide_retdoc_loc_error) {
                 // pas de message et le retour se fait
             } elseif ($pmb_hide_retdoc_loc_error == 1) {
                 // Message et pas de retour
                 $this->expl_form = "<div class='erreur'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "critique";
                 return false;
             } elseif ($pmb_hide_retdoc_loc_error == 2) {
                 // Message et pas de retour
                 $question_form = "<div class='erreur'><br />" . str_replace("!!lib_localisation!!", $this->info_doc->location, $msg["transferts_circ_retour_emprunt_erreur_localisation"]) . "<br /></div>";
                 $alert_sound_list[] = "information";
             }
         }
     }
     //fin si lecteur localisé
     //	}
     if ($pmb_pret_groupement) {
         if ($id_group = groupexpls::get_group_expl($this->expl_cb)) {
             // ce document appartient à un groupe
             $is_doc_group = 1;
             $groupexpl = new groupexpl($id_group);
             $question_form .= $groupexpl->get_confirm_form($this->expl_cb);
         }
     }
     //affichage de l'erreur de site et eventuellement du formulaire de forcage
     $form_retour_tpl_temp = str_replace('!!html_erreur_site_tpl!!', $question_form, $form_retour_tpl_temp);
     if (!$expl_no_checkout && $pmb_transferts_actif == "1" && !$this->piege) {
         $trans = new transfert();
         $trans->est_retournable($this->expl_id);
         $this->expl->expl_location_origine = $trans->location_origine;
         switch ($action_piege) {
             case '1':
                 //issu d'une autre localisation: accepter le retour
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->calcul_resa();
                 if ($this->flag_resa_is_affecte) {
                     $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
                     global $charset;
                     $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
                     $res = pmb_mysql_query($requete);
                     $message_resa .= "<div class='row'>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . htmlentities(pmb_strtoupper(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
                     $message_resa .= "</div>";
                     $alert_sound_list[] = "information";
                 }
                 if ($this->flag_resa_ici) {
                 } elseif ($this->flag_resa_origine) {
                     //Gen retour sur site origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 } elseif ($this->flag_resa_autre_site) {
                     //Gen retour sur autre site....
                     // Pour l'instant on retourne au site d'origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 } else {
                     // pas de résa on genère un retour au site d'origine
                     $param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     $message_transfert = "<div class='erreur'>" . str_replace("!!lbl_site!!", $this->info_doc->location, $msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                 }
                 $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 break;
             case '3':
                 // A traiter plus tard
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->piege = 1;
                 break;
             case '4':
                 // retour sur le site d'origne, il faut nettoyer
                 $param = $trans->retour_exemplaire_loc_origine($this->expl_id);
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $this->calcul_resa();
                 break;
             case '2':
                 //issu d'une autre localisation: changer la loc, effacer les transfert
                 //$trans->retour_exemplaire_supprime_transfert( $this->expl_id, $param );
                 //change la localisation d'origine
                 $param = $trans->retour_exemplaire_change_localisation($this->expl_id);
                 $rqt = "update transferts_source SET trans_source_numloc=" . $deflt_docs_location . " where trans_source_numexpl=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 // modif de la section, si demandée
                 if ($expl_section && $expl_section != $this->expl->expl_section) {
                     $rqt = "UPDATE exemplaires SET expl_section={$expl_section}, transfert_section_origine={$expl_section} WHERE expl_id=" . $this->expl_id;
                     pmb_mysql_query($rqt);
                 }
                 //
                 $rqt = "UPDATE exemplaires SET transfert_location_origine =" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 // pas de break; on fait le reste du traitement par défaut
             // pas de break; on fait le reste du traitement par défaut
             default:
                 if ($this->expl->pret_idempr) {
                     $message_del_pret = $this->del_pret();
                 }
                 $resa_id = $this->calcul_resa();
                 if ($this->flag_resa_is_affecte) {
                     $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
                     global $charset;
                     $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
                     $res = pmb_mysql_query($requete);
                     $message_resa .= "<div class='row'>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . htmlentities(pmb_strtoupper(pmb_mysql_result($res, 0, 1)), ENT_QUOTES, $charset) . "</a></span><br/>";
                     $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
                     $message_resa .= "</div>";
                     $alert_sound_list[] = "information";
                 }
                 if ($this->flag_resa_ici) {
                 } elseif ($this->flag_resa_origine) {
                     /*
                     					//Gen retour sur site origine
                     					if(!$trans->est_retournable($this->expl_id)) {
                     						// si pas encore généré
                     						$param = $trans->retour_exemplaire_genere_transfert_retour($this->expl_id);
                     						$message_transfert= "<div class='erreur'>" . str_replace("!!lbl_site!!",$this->info_doc->location,$msg["transferts_circ_retour_lbl_transfert"]) . "</div>";
                     					} else {
                     						// le retour est déjà généré
                     						$message_transfert = "<hr /><div class='erreur'>".$msg["transferts_circ_menu_titre"].":</div><div class='message_important'>".
                     			 			str_replace("!!source_location!!", $trans->location_libelle_source,$msg["transferts_circ_retour_a_retourner"])."</div>";							
                     						$alert_sound_list[]="information";
                     					}	*/
                     if ($trans->est_retournable($this->expl_id)) {
                         $num_trans = $trans->retour_exemplaire_genere_transfert_retour_origine($this->expl_id);
                         // netoyer les transferts intermédiaires
                         if ($num_trans) {
                             $message_transfert = "<hr /><div class='erreur'>" . $msg["transferts_circ_menu_titre"] . ":</div><div class='message_important'><br />" . str_replace("!!source_location!!", $trans->location_libelle_origine, $msg["transferts_circ_retour_a_retourner"]) . "<br /><br /></div>";
                             $alert_sound_list[] = "information";
                         }
                     } else {
                         // A ranger
                     }
                 } elseif ($this->flag_resa_autre_site) {
                     // si résa autre site à déja une demande de transfert, ou transfert
                     $req = "select * from transferts, transferts_demande where num_transfert=id_transfert and resa_trans='{$resa_id}' and etat_transfert=0";
                     $r = pmb_mysql_query($req, $dbh);
                     if (!pmb_mysql_num_rows($r)) {
                         $trans->memo_origine($this->expl_id);
                         $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                         pmb_mysql_query($rqt);
                         // cloture des transferts précédant pour ne pas qu'il se retrouve à la fois en envoi et en retour sur le site
                         $rqt = "update transferts,transferts_demande, exemplaires set etat_transfert=1\r\n\t\t\t\t\t\tWHERE id_transfert=num_transfert and num_expl=expl_id  and etat_transfert=0 AND expl_cb='" . $this->expl_cb . "' ";
                         pmb_mysql_query($rqt);
                         //Gen transfert sur site de la résa....
                         $param = $trans->transfert_pour_resa($this->expl_cb, $this->resa_loc_trans, $resa_id);
                         // récupération localisation exemplaire
                         $query = "SELECT location_libelle FROM  docs_location WHERE idlocation=" . $this->resa_loc_trans . " LIMIT 1";
                         $result = pmb_mysql_query($query, $dbh);
                         $info_loc = pmb_mysql_fetch_object($result);
                         if ($transferts_validation_actif) {
                             $message_transfert = "<div class='erreur'><br />" . str_replace("!!site_dest!!", $info_loc->location_libelle, $msg["transferts_circ_transfert_pour_resa"]) . "<br /><br /></div>";
                         } else {
                             $message_transfert = "<div class='erreur'><br />" . str_replace("!!source_location!!", $info_loc->location_libelle, $msg["transferts_circ_retour_lbl_transfert"]) . "<br /><br /></div>";
                         }
                     }
                 } else {
                     // pas de résa.Doit-il être retourné à son site d'origine?
                     if ($trans->est_retournable($this->expl_id)) {
                         $num_trans = $trans->retour_exemplaire_genere_transfert_retour_origine($this->expl_id);
                         // netoyer les transferts intermédiaires
                         if ($num_trans) {
                             $message_transfert = "<hr /><div class='erreur'>" . $msg["transferts_circ_menu_titre"] . ":</div><div class='message_important'><br />" . str_replace("!!source_location!!", $trans->location_libelle_origine, $msg["transferts_circ_retour_a_retourner"]) . "<br /><br /></div>";
                             $alert_sound_list[] = "information";
                         } else {
                             $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                             pmb_mysql_query($rqt);
                         }
                     } else {
                         $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                         pmb_mysql_query($rqt);
                         // A ranger
                     }
                 }
                 $rqt = "UPDATE exemplaires SET expl_location=" . $deflt_docs_location . "  WHERE expl_id=" . $this->expl_id;
                 pmb_mysql_query($rqt);
                 //vérifions s'il y a des réservations prévisionnelles sur ce document..
                 if ($pmb_resa_planning) {
                     $this->calcul_resa_planning();
                     if ($this->flag_resa_planning_is_affecte) {
                         global $charset;
                         $message_resa_planning = "<div class='erreur'>{$msg['resas_planning']}</div>";
                         $message_resa_planning .= "<div class='row'>\n\t\t\t\t\t\t\t<img src='./images/plus.gif' class='img_plus'\n\t\t\t\t\t\t\tonClick=\"\n\t\t\t\t\t\t\t\tvar elt=document.getElementById('erreur-child');\n\t\t\t\t\t\t\t\tvar vis=elt.style.display;\n\t\t\t\t\t\t\t\tif (vis=='block'){\n\t\t\t\t\t\t\t\t\telt.style.display='none';\n\t\t\t\t\t\t\t\t\tthis.src='./images/plus.gif';\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\telt.style.display='block';\n\t\t\t\t\t\t\t\t\tthis.src='./images/minus.gif';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\" /> " . htmlentities($msg['resa_planning_encours'], ENT_QUOTES, $charset) . " <a href='./circ.php?categ=pret&form_cb=" . rawurlencode($reservataire_empr_cb) . "'>" . $reservataire_nom_prenom . "</a><br />";
                         //Affichage des réservations prévisionnelles sur le document courant
                         $q = "SELECT id_resa, resa_idnotice, resa_date, resa_date_debut, resa_date_fin, resa_validee, IF(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, date_format(resa_date_fin, '" . $msg["format_date_sql"] . "') as aff_date_fin, ";
                         $q .= "resa_idempr, concat(lower(empr_prenom), ' ',upper(empr_nom)) as resa_nom, if(resa_idempr!='" . $this->expl->pret_idempr . "', 0, 1) as resa_same ";
                         $q .= "FROM resa_planning left join empr on resa_idempr=id_empr ";
                         $q .= "where resa_idnotice in (select expl_notice from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                         if ($pmb_location_resa_planning) {
                             $q .= "and empr_location in (select expl_location from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                         }
                         $r = pmb_mysql_query($q, $dbh);
                         if (pmb_mysql_num_rows($r)) {
                             $message_resa_planning .= "<div id='erreur-child' class='erreur-child'>";
                             while ($resa = pmb_mysql_fetch_array($r)) {
                                 $id_resa = $resa['id_resa'];
                                 $resa_idempr = $resa['resa_idempr'];
                                 $resa_idnotice = $resa['resa_idnotice'];
                                 $resa_date = $resa['resa_date'];
                                 $resa_date_debut = $resa['resa_date_debut'];
                                 $resa_date_fin = $resa['resa_date_fin'];
                                 $resa_validee = $resa['resa_validee'];
                                 $resa_nom = $resa['resa_nom'];
                                 $resa_same = $resa['resa_same'];
                                 if ($resa_idempr == $id_empr) {
                                     $message_resa_planning .= "<b>" . htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;</b>";
                                 } else {
                                     $message_resa_planning .= htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;";
                                 }
                                 $message_resa_planning .= " &gt;&gt; <b>" . $msg['resa_planning_date_debut'] . "</b> " . formatdate($resa_date_debut) . "&nbsp;<b>" . $msg['resa_planning_date_fin'] . "</b> " . formatdate($resa_date_fin) . "&nbsp;";
                                 if (!$resa['perimee']) {
                                     if ($resa['resa_validee']) {
                                         $message_resa_planning .= " " . $msg['resa_validee'];
                                     } else {
                                         $message_resa_planning .= " " . $msg['resa_attente_validation'] . " ";
                                     }
                                 } else {
                                     $message_resa_planning .= " " . $msg['resa_overtime'] . " ";
                                 }
                                 $message_resa_planning .= "<br />";
                             }
                             //while
                             $message_resa_planning .= "</div></div>";
                             $alert_sound_list[] = "information";
                         }
                     }
                 }
                 break;
         }
     }
     if (!$expl_no_checkout && !$pmb_transferts_actif) {
         if ($this->expl->pret_idempr) {
             $message_del_pret = $this->del_pret();
         }
         $this->calcul_resa();
         if ($this->flag_resa_is_affecte) {
             $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
             global $charset;
             $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
             $res = pmb_mysql_query($requete);
             $message_resa .= "<div class='row'>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . pmb_strtoupper(htmlentities(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
             $message_resa .= "</div>";
             $alert_sound_list[] = "information";
         }
         if ($pmb_resa_planning) {
             $this->calcul_resa_planning();
             if ($this->flag_resa_planning_is_affecte) {
                 global $charset;
                 $message_resa_planning = "<div class='erreur'>{$msg['resas_planning']}</div>";
                 $message_resa_planning .= "<div class='row'>\n\t\t\t\t\t<img src='./images/plus.gif' class='img_plus'\n\t\t\t\t\tonClick=\"\n\t\t\t\t\t\tvar elt=document.getElementById('erreur-child');\n\t\t\t\t\t\tvar vis=elt.style.display;\n\t\t\t\t\t\tif (vis=='block'){\n\t\t\t\t\t\t\telt.style.display='none';\n\t\t\t\t\t\t\tthis.src='./images/plus.gif';\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telt.style.display='block';\n\t\t\t\t\t\t\tthis.src='./images/minus.gif';\n\t\t\t\t\t\t}\n\t\t\t\t\t\" /> " . htmlentities($msg['resa_planning_encours'], ENT_QUOTES, $charset) . " <a href='./circ.php?categ=pret&form_cb=" . rawurlencode($reservataire_empr_cb) . "'>" . $reservataire_nom_prenom . "</a><br />";
                 //Affichage des réservations prévisionnelles sur le document courant
                 $q = "SELECT id_resa, resa_idnotice, resa_date, resa_date_debut, resa_date_fin, resa_validee, IF(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, date_format(resa_date_fin, '" . $msg["format_date_sql"] . "') as aff_date_fin, ";
                 $q .= "resa_idempr, concat(lower(empr_prenom), ' ',upper(empr_nom)) as resa_nom, if(resa_idempr!='" . $this->expl->pret_idempr . "', 0, 1) as resa_same ";
                 $q .= "FROM resa_planning left join empr on resa_idempr=id_empr ";
                 $q .= "where resa_idnotice in (select expl_notice from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                 if ($pmb_location_resa_planning) {
                     $q .= "and empr_location in (select expl_location from exemplaires where expl_cb = '" . $this->expl_cb . "') ";
                 }
                 $r = pmb_mysql_query($q, $dbh);
                 if (pmb_mysql_num_rows($r)) {
                     $message_resa_planning .= "<div id='erreur-child' class='erreur-child'>";
                     while ($resa = pmb_mysql_fetch_array($r)) {
                         $id_resa = $resa['id_resa'];
                         $resa_idempr = $resa['resa_idempr'];
                         $resa_idnotice = $resa['resa_idnotice'];
                         $resa_date = $resa['resa_date'];
                         $resa_date_debut = $resa['resa_date_debut'];
                         $resa_date_fin = $resa['resa_date_fin'];
                         $resa_validee = $resa['resa_validee'];
                         $resa_nom = $resa['resa_nom'];
                         $resa_same = $resa['resa_same'];
                         if ($resa_idempr == $id_empr) {
                             $message_resa_planning .= "<b>" . htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;</b>";
                         } else {
                             $message_resa_planning .= htmlentities($resa_nom, ENT_QUOTES, $charset) . "&nbsp;";
                         }
                         $message_resa_planning .= " &gt;&gt; <b>" . $msg['resa_planning_date_debut'] . "</b> " . formatdate($resa_date_debut) . "&nbsp;<b>" . $msg['resa_planning_date_fin'] . "</b> " . formatdate($resa_date_fin) . "&nbsp;";
                         if (!$resa['perimee']) {
                             if ($resa['resa_validee']) {
                                 $message_resa_planning .= " " . $msg['resa_validee'];
                             } else {
                                 $message_resa_planning .= " " . $msg['resa_attente_validation'] . " ";
                             }
                         } else {
                             $message_resa_planning .= " " . $msg['resa_overtime'] . " ";
                         }
                         $message_resa_planning .= "<br />";
                     }
                     //while
                     $message_resa_planning .= "</div></div>";
                     $alert_sound_list[] = "information";
                 }
             }
         }
     }
     if (!$expl_no_checkout && !$this->piege) {
         if ($this->flag_resa_ici && !$piege_resa) {
             $query = "SELECT empr_location,empr_prenom, empr_nom, empr_cb FROM resa INNER JOIN empr ON resa_idempr = id_empr WHERE id_resa='" . $this->id_resa_to_validate . "'";
             $result = pmb_mysql_query($query, $dbh);
             $empr = @pmb_mysql_fetch_object($result);
             $info_resa = "<div class='message_important'>{$msg['352']}</div>\n\t\t\t<div class='row'>" . $msg[373] . "&nbsp;<strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode($empr->empr_cb) . "'>" . $empr->empr_prenom . "&nbsp;" . $empr->empr_nom . "</a></strong>&nbsp;({$empr->empr_cb} )\n\t\t\t</div>";
             if ($categ == "ret_todo" || $pmb_resa_retour_action_defaut == 1) {
                 $checked[1] = "checked";
             } else {
                 $checked[2] = "checked";
             }
             $question_resa = "\n\t\t\t\t<form name='piege' method='post' action='" . $this->url . "&form_cb_expl=" . rawurlencode($this->expl_cb) . "' >\n\t\t\t\t{$info_resa}\n\t\t\t\t<div class='erreur'>\n\t\t\t\t\t<input type=\"radio\" name=\"piege_resa\" value=\"1\" {$checked['1']} >&nbsp;" . $msg["circ_retour_piege_resa_affecter"] . "<br />\n\t\t\t\t\t<input type=\"radio\" name=\"piege_resa\" value=\"2\" {$checked['2']} >&nbsp;" . $msg["transferts_circ_retour_traiter_plus_tard"] . "<br />\n\t\t\t\t\t<input type=\"submit\" class=\"bouton\" value=\"" . $msg["transferts_circ_retour_exec_action"] . "\" >\n\t\t\t\t</div>\n\t\t\t\t</form>";
             $alert_sound_list[] = "question";
             $this->piege_resa = 1;
         } elseif ($this->flag_resa_ici && $piege_resa == 1) {
             alert_empr_resa($this->affecte_resa());
             $message_resa = "<div class='erreur'>" . $msg["circ_retour_ranger_resa"] . "</div>";
             global $charset;
             $requete = "SELECT empr_cb, empr_nom, empr_prenom, location_libelle, resa_cb FROM resa JOIN empr ON resa_idempr=id_empr JOIN docs_location ON resa_loc_retrait=idlocation  WHERE id_resa=" . $this->id_resa . "";
             $res = pmb_mysql_query($requete);
             $message_resa .= "<div class='row'>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_resa_par"] . " : </strong><a href='./circ.php?categ=pret&form_cb=" . rawurlencode(pmb_mysql_result($res, 0, 0)) . "'>" . htmlentities(pmb_mysql_result($res, 0, 2), ENT_QUOTES, $charset) . " " . mb_strtoupper(htmlentities(pmb_mysql_result($res, 0, 1), ENT_QUOTES, $charset), $charset) . "</a></span><br/>";
             $message_resa .= "<span style='margin-left:2em;'><strong>" . $msg["circ_retour_loc_retrait"] . " : </strong>" . htmlentities(pmb_mysql_result($res, 0, 3), ENT_QUOTES, $charset) . "</span><br/>";
             $message_resa .= "</div>";
             $alert_sound_list[] = "information";
         } elseif ($this->flag_resa_ici) {
             $this->piege_resa = 1;
         }
     }
     if (!$expl_no_checkout && $this->piege || $this->piege_resa && $piege_resa != 1) {
         // il y a des pieges, on marque comme exemplaire à problème dans la localisation qui fait le retour
         $sql = "UPDATE exemplaires set expl_retloc='" . $deflt_docs_location . "' where expl_cb='" . addslashes($this->expl_cb) . "' limit 1";
     } else {
         // pas de pièges, ou pièges résolus, on démarque
         $sql = "UPDATE exemplaires set expl_retloc=0 where expl_cb='" . addslashes($this->expl_cb) . "' limit 1";
     }
     pmb_mysql_query($sql);
     $form_retour_tpl_temp = str_replace('!!piege_resa_ici!!', $question_resa, $form_retour_tpl_temp);
     if ($this->expl->pret_idempr) {
         $this->empr = new emprunteur($this->expl->pret_idempr, "", FALSE, 2);
     }
     if ($pmb_rfid_activate && $pmb_rfid_serveur_url) {
         $form_retour_tpl_temp = str_replace('<!--antivol_script-->', $script_antivol_rfid, $form_retour_tpl_temp);
         $this->cb_tmpl = str_replace("//antivol_test//", "if(0)", $this->cb_tmpl);
     } elseif ($pmb_antivol > 0) {
         // gestion de  l'antivol magnétique 3M
         if ($this->expl->type_antivol == 1) {
             // c'est un support non magnétique (livre, revue...)
             $script_magnetique = str_replace('<!--call_script_magnetique-->', "magnetise('RRR');", $script_magnetique);
         }
         if ($this->expl->type_antivol == 2) {
             //c'est un support magnétique (cassette)
             $script_magnetique = str_replace('<!--call_script_magnetique-->', "magnetise('SSS');", $script_magnetique);
         }
         $form_retour_tpl_temp = str_replace('<!--antivol_script-->', $script_magnetique, $form_retour_tpl_temp);
     }
     if ($this->flag_rendu && $pmb_play_pret_sound) {
         $alert_sound_list[] = "information";
     }
     $form_retour_tpl_temp = str_replace('!!message_del_pret!!', $message_del_pret, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_resa!!', $message_resa, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_resa_planning!!', $message_resa_planning, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!message_transfert!!', $message_transfert, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!libelle!!', $this->expl->libelle, $form_retour_tpl_temp);
     // si la loc à été modifier:
     if ($pmb_transferts_actif) {
         // pour mettre les données modifiées à jour
         $this->fetch_data();
     }
     $form_retour_tpl_temp = str_replace('!!type_doc!!', $this->info_doc->type_doc, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!location!!', $this->info_doc->location, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!section!!', $this->info_doc->section, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!statut!!', $this->info_doc->statut, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_cote!!', $this->expl->expl_cote, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_cb!!', $this->expl_cb, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_owner!!', $this->expl_owner_name, $form_retour_tpl_temp);
     $form_retour_tpl_temp = str_replace('!!expl_id!!', $this->expl_id, $form_retour_tpl_temp);
     if ($this->flag_rendu) {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', $retour_ok_tpl, $form_retour_tpl_temp);
     } elseif ($categ != "ret_todo" && !$piege_resa && !$this->piege) {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', $retour_intouvable_tpl, $form_retour_tpl_temp);
     } else {
         $form_retour_tpl_temp = str_replace('!!message_retour!!', "", $form_retour_tpl_temp);
     }
     //Champs personalisés
     $p_perso = new parametres_perso("expl");
     $perso_aff = "";
     if (!$p_perso->no_special_fields) {
         $perso_ = $p_perso->show_fields($this->expl_id);
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             if ($p["AFF"]) {
                 $perso_aff .= "<br />" . $p["TITRE"] . " " . $p["AFF"];
             }
         }
     }
     if ($perso_aff) {
         $perso_aff = "<div class='row'>" . $perso_aff . "</div>";
     }
     $form_retour_tpl_temp = str_replace('!!perso_aff!!', $perso_aff, $form_retour_tpl_temp);
     if ($this->expl->expl_note) {
         $alert_sound_list[] = "critique";
         $expl_note .= pmb_bidi("<hr /><div class='erreur'>{$msg[377]} :</div><div class='message_important'>" . $this->expl->expl_note . "</div>");
     }
     $form_retour_tpl_temp = str_replace('!!expl_note!!', $expl_note, $form_retour_tpl_temp);
     if ($this->expl->expl_comment) {
         if (!$this->expl->expl_note) {
             $expl_comment .= pmb_bidi("<hr />");
         }
         $expl_comment .= pmb_bidi("<div class='erreur'>{$msg[expl_zone_comment]} :</div><div class='expl_comment'>" . $this->expl->expl_comment . "</div>");
     }
     $form_retour_tpl_temp = str_replace('!!expl_comment!!', $expl_comment, $form_retour_tpl_temp);
     // zone du dernier emrunteur
     if ($pmb_expl_show_lastempr && $this->expl->expl_lastempr) {
         $dernier_empr = "<hr /><div class='row'>{$msg['expl_prev_empr']} ";
         $link = "<a href='./circ.php?categ=pret&form_cb=" . rawurlencode($this->expl->lastempr_cb) . "'>";
         $dernier_empr .= $link . $this->expl->lastempr_prenom . ' ' . $this->expl->lastempr_nom . ' (' . $this->expl->lastempr_cb . ')</a>';
         $dernier_empr .= "</div><hr />";
     }
     $form_retour_tpl_temp = str_replace('!!expl_lastempr!!', $dernier_empr, $form_retour_tpl_temp);
     if ($this->empr) {
         $expl_empr = pmb_bidi($this->empr->fiche_affichage);
     }
     $form_retour_tpl_temp = str_replace('!!expl_empr!!', $expl_empr, $form_retour_tpl_temp);
     $this->expl_form = $form_retour_tpl_temp;
 }
示例#4
0
文件: pret.inc.php 项目: hogsim/PMB
     $rqt_arch = "select resarc_id from resa_archive, resa WHERE id_resa = '" . $statut->id_resa . "' AND resa_arc = resarc_id ";
     $resarc_res = pmb_mysql_query($rqt_arch, $dbh);
     $resarc = pmb_mysql_fetch_object($resarc_res);
     $resarc_id = $resarc->resarc_id;
     // suppression de la resa pour ce lecteur
     del_resa($id_empr, $statut->idnotice, $statut->idbulletin, $statut->expl_cb);
 }
 // ajout du prêt
 del_resa($id_empr, $statut->idnotice, $statut->idbulletin, $statut->expl_cb);
 add_pret($id_empr, $id_expl, $cb_doc, $resarc_id, $short_loan);
 // mise à jour de l'affichage
 if ($pmb_pret_groupement) {
     if ($id_group = groupexpls::get_group_expl($cb_doc)) {
         // ce document appartient à un groupe
         $is_doc_group = 1;
         $groupexpl = new groupexpl($id_group);
         $information_text .= $groupexpl->get_confirm_form($cb_doc);
         $information_group = $groupexpl->get_confirm_form($cb_doc);
         //	$statut->flag+=IS_GROUP; client ne veut pas de comfirmation
     }
 }
 // ajout du bouton d'annulation violente
 $erreur_affichage = $information_group . "<hr />\n\t\t\t\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t<div class='colonne10'><img src='./images/info.png' /></div>\n\t\t\t\t\t\t\t\t\t\t<div class='colonne-suite'>{$titre_prete} : <span class='erreur'>" . $msg[384] . "</span><br />\n\t\t\t\t\t\t\t\t\t\t";
 $erreur_affichage .= get_display_custom_fields($id_empr, $id_expl);
 if ($pmb_play_pret_sound) {
     $alert_sound_list[] = "information";
 }
 $erreur_affichage .= "<input type='button' class='bouton' value='{$msg[76]}' onClick=\"document.location='circ.php?categ=pret&sub=pret_annulation&id_empr=" . $id_empr . "&id_expl=" . $id_expl . "&cb_doc=" . $cb_doc . "&short_loan=" . $short_loan . "'\" />";
 if ($pmb_printer_ticket_url) {
     $erreur_affichage .= "&nbsp;<a href='#' onclick=\"print_ticket('./ajax.php?module=circ&categ=print_pret&sub=one&id_empr=" . $id_empr . "&id_expl=" . $id_expl . "&cb_doc={$cb_doc}'); return false;\"><img src='./images/print.gif' alt='Imprimer...' title='Imprimer...' align='middle' border='0'></a>";
 } else {
示例#5
0
        $groupexpl = new groupexpl($id);
        $groupexpl->delete();
        $groupexpls = new groupexpls();
        print $groupexpls->get_list();
        break;
    case "add_expl":
        $groupexpl = new groupexpl($id);
        $groupexpl->add_expl($form_cb_expl);
        print $groupexpl->get_form();
        break;
    case "search_expl":
        if ($id = groupexpls::get_group_expl($form_cb_expl)) {
            $groupexpl = new groupexpl($id);
            print $groupexpl->get_see_form();
        } else {
            $groupexpls = new groupexpls();
            $groupexpls->set_error_message($msg["groupexpl_list_error_cb_not_in_group"]);
            print $groupexpls->get_list();
        }
        break;
    case "del_expl":
        $groupexpl = new groupexpl($id);
        $groupexpl->del_expl($form_cb_expl);
        print $groupexpl->get_form();
        break;
    case "list":
    default:
        $groupexpls = new groupexpls();
        print $groupexpls->get_list();
        break;
}