analyser(); $clang = $langues->table; $combo = ""; return $combo; } // affichage de la liste lecteurs pour selection function list_empr($cb, $empr_list, $nav_bar, $nb_total=0, $where_intitule="") { global $empr_list_tmpl,$empr_search_cle_tmpl; if ($cb != "") { if ($nb_total>0) $empr_search_cle_tmpl = str_replace("", "(".$nb_total.")", $empr_search_cle_tmpl); $empr_search_cle_tmpl = str_replace("!!cle!!", $cb, $empr_search_cle_tmpl); $empr_search_cle_tmpl = str_replace("!!where_intitule!!", $where_intitule, $empr_search_cle_tmpl); $empr_list_tmpl = str_replace("!!empr_search_cle_tmpl!!", $empr_search_cle_tmpl, $empr_list_tmpl); } else { $empr_list_tmpl = str_replace("!!empr_search_cle_tmpl!!", "", $empr_list_tmpl); } $empr_list_tmpl = str_replace("!!list!!", $empr_list, $empr_list_tmpl); $empr_list_tmpl = str_replace("!!nav_bar!!", $nav_bar, $empr_list_tmpl); print pmb_bidi($empr_list_tmpl); } // form de saisie cb emprunteur function get_cb($title, $message, $title_form, $form_action, $check=0, $cb_initial="", $creation=0) { global $empr_cb_tmpl; global $empr_cb_tmpl_create; global $script1; global $script2; global $deflt2docs_location, $pmb_lecteurs_localises, $empr_location_id, $param_allloc ; if ($cb_initial===0) $cb_initial="" ; if ($creation==1) $empr_cb_tmpl = $empr_cb_tmpl_create; switch ($check) { case '1': // script javascript 1 : checke seulement si le champ contient des trucs $empr_cb_tmpl = str_replace("!!script!!", $script1, $empr_cb_tmpl); break ; case '2': // script javascript 2 : checke si le champ ne contient que de l'alpha $empr_cb_tmpl = str_replace("!!script!!", $script2, $empr_cb_tmpl); break ; case '0': default: // aucun test $empr_cb_tmpl = str_replace("!!script!!", "", $empr_cb_tmpl); break ; } $empr_cb_tmpl = str_replace("!!titre_formulaire!!", $title_form, $empr_cb_tmpl); $empr_cb_tmpl = str_replace("!!form_action!!", $form_action, $empr_cb_tmpl); $empr_cb_tmpl = str_replace("!!title!!", $title, $empr_cb_tmpl); $empr_cb_tmpl = str_replace("!!message!!", $message, $empr_cb_tmpl); $empr_cb_tmpl = str_replace("!!cb_initial!!", (string)$cb_initial, $empr_cb_tmpl); if ($pmb_lecteurs_localises) { if ($empr_location_id) $deflt2docs_location=$empr_location_id; elseif ($param_allloc) $deflt2docs_location=0; $empr_cb_tmpl = str_replace("!!restrict_location!!", docs_location::gen_combo_box_empr($deflt2docs_location), $empr_cb_tmpl); } else $empr_cb_tmpl = str_replace("!!restrict_location!!", "", $empr_cb_tmpl); print pmb_bidi($empr_cb_tmpl); } // form de saisie cb emprunteur function get_login_empr_pret($title, $message, $title_form, $form_action, $check=0, $cb_initial="") { global $login_empr_pret_tmpl; global $script1; global $script2; if ($cb_initial===0) $cb_initial="" ; $login_empr_pret_tmpl = str_replace("!!titre_formulaire!!", $title_form, $login_empr_pret_tmpl); $login_empr_pret_tmpl = str_replace("!!form_action!!", $form_action, $login_empr_pret_tmpl); $login_empr_pret_tmpl = str_replace("!!title!!", $title, $login_empr_pret_tmpl); $login_empr_pret_tmpl = str_replace("!!message!!", $message, $login_empr_pret_tmpl); $login_empr_pret_tmpl = str_replace("!!cb_initial!!", (string)$cb_initial, $login_empr_pret_tmpl); print pmb_bidi($login_empr_pret_tmpl); } // affichage du form emprunteurs (gere modif et creation). function show_empr_form($form_action, $form_cancel, $link, $id, $cb,$duplicate_empr_from_id="") { global $empr_form; global $dbh,$msg,$charset; global $biblio_email; global $aff_list_empr; global $deflt2docs_location; global $pmb_lecteurs_localises ; global $pmb_gestion_abonnement,$pmb_gestion_financiere; global $database_window_title ; global $lang; global $pmb_rfid_activate, $pmb_rfid_serveur_url; global $pmb_opac_view_activate; //Ici on récupère les valeurs des champs personalisés $p_perso=new parametres_perso("empr"); // si $id est fourni, il s'agit d'une modification. on recupere les donnees dans $link if($id) { // modification echo window_title($database_window_title.$msg[55]); $entete=$msg[55]; if ($pmb_rfid_activate==1 && $pmb_rfid_serveur_url) { $script_rfid_encode="if(script_rfid_encode()==false) return false;"; } else $script_rfid_encode=''; $empr_form = str_replace("!!questionrfid!!", $script_rfid_encode, $empr_form); $requete = "SELECT * FROM empr WHERE id_empr='$id' "; $res = mysql_query($requete, $link); if($res) { $empr = mysql_fetch_object($res); } else { error_message( $msg[53], $msg[54], 0); } } else { // création $entete=$msg[15]; $empr_form = str_replace("!!questionrfid!!", '' , $empr_form); } if ($duplicate_empr_from_id) { $empr_form = str_replace("!!id!!", "", $empr_form); $empr_form = str_replace("!!entete!!", $msg["empr_duplicate"], $empr_form); } else { $empr_form = str_replace("!!id!!", $id, $empr_form); $empr_form = str_replace("!!entete!!", $entete, $empr_form); } $empr_form = str_replace("!!form_action!!", $form_action, $empr_form); if($empr->empr_cb) { //Si il y a un code lecteur if (!$duplicate_empr_from_id) $empr_form = str_replace("!!cb!!", $empr->empr_cb, $empr_form); else $empr_form = str_replace("!!cb!!", $cb, $empr_form); $date_adhesion = (!$duplicate_empr_from_id ? $empr->empr_date_adhesion : date('Y-m-d')); $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=".preg_replace('/-/', '', $date_adhesion)."¶m1=form_adhesion¶m2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" "; $adhesion = " "; $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form); $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=".preg_replace('/-/', '', $empr->empr_date_expiration)."¶m1=form_expiration¶m2=form_expiration_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 205, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" "; $expiration = " empr_date_expiration)."' /> "; $empr_form = str_replace("!!expiration!!", $expiration, $empr_form); // ajout ici des trucs sur la relance adhésion $empr_temp = new emprunteur($id, '', FALSE, 0) ; $aff_relance = ""; if ($empr_temp->adhesion_renouv_proche() || $empr_temp->adhesion_depassee()) { if ($empr_temp->adhesion_depassee()) $mess_relance = $msg[empr_date_depassee]; else $mess_relance = $msg[empr_date_renouv_proche]; $rqt="select duree_adhesion from empr_categ where id_categ_empr='$empr_temp->categ'"; $res_dur_adhesion = mysql_query($rqt, $dbh); $row = mysql_fetch_row($res_dur_adhesion); $nb_jour_adhesion_categ = $row[0]; $rqt_date = "select date_add('$empr_temp->date_expiration',INTERVAL 1 DAY) as nouv_date_debut, date_add('$empr_temp->date_expiration',INTERVAL $nb_jour_adhesion_categ DAY) as nouv_date_fin "; $resultatdate=mysql_query($rqt_date) or die ("
$rqt_date ".mysql_error()); $resdate=mysql_fetch_object($resultatdate); $nouv_date_debut = $resdate->nouv_date_debut ; $nouv_date_fin = $resdate->nouv_date_fin ; $nouv_date_debut_formatee = formatdate($nouv_date_debut) ; $nouv_date_fin_formatee = formatdate($nouv_date_fin) ; // on conserve la date d'adhésion initiale $action_prolonger = "this.form.form_expiration.value = '$nouv_date_fin'; this.form.form_expiration_lib.value = '$nouv_date_fin_formatee'; "; $action_relance_courrier = "openPopUp('./pdf.php?pdfdoc=lettre_relance_adhesion&id_empr=$id', 'lettre', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes'); return(false) "; $aff_relance = "
$mess_relance
  "; if ($empr_temp->mail && $biblio_email ) { $action_relance_mail = "if (confirm('".$msg["mail_retard_confirm"]."')) {openPopUp('./mail.php?type_mail=mail_relance_adhesion&id_empr=$id', 'mail', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes'); } return(false) "; $aff_relance .= " "; } $aff_relance .= "
"; if (($pmb_gestion_financiere)&&($pmb_gestion_abonnement)) { $aff_relance.="
 "; $aff_relance.=" "; if ($pmb_gestion_abonnement==2) $aff_relance.=""; $aff_relance.="
"; } } $empr_form = str_replace("!!adhesion_proche_depassee!!", $aff_relance, $empr_form); //Liste des types d'abonnement $list_type_abt=""; if (($pmb_gestion_abonnement==2)&&($pmb_gestion_financiere)) { $requete="select * from type_abts order by type_abt_libelle "; $resultat_abt=mysql_query($requete); $user_loc=$deflt2docs_location; $t_type_abt=array(); while ($res_abt=mysql_fetch_object($resultat_abt)) { $locs=explode(",",$res_abt->localisations); $as=array_search($user_loc,$locs); if ((($as!==false)&&($as!==null))||(!$res_abt->localisations)) { $t_type_abt[]=$res_abt; } } if (count($t_type_abt)) { $list_type_abt="
\n
\n
\n
"; } } $empr_form = str_replace("!!typ_abonnement!!",$list_type_abt,$empr_form); } else { // création de lecteur $empr->empr_date_adhesion = today() ; $empr_form = str_replace('!!cb!!',$cb,$empr_form); $date_clic = "onClick=\"openPopUp('./select.php?what=calendrier&caller=empr_form&date_caller=".preg_replace('/-/', '', $empr->empr_date_adhesion)."¶m1=form_adhesion¶m2=form_adhesion_lib&auto_submit=NO&date_anterieure=YES', 'date_adhesion', 250, 260, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" "; $adhesion = "$msg[1401]$msg[1901] empr_date_adhesion)."'> "; $empr_form = str_replace("!!adhesion!!", $adhesion, $empr_form); $empr_form = str_replace("!!adhesion_proche_depassee!!", "", $empr_form); $empr_form = str_replace("!!expiration!!", "", $empr_form); //Liste des types d'abonnement $list_type_abt=""; if (($pmb_gestion_abonnement==2)&&($pmb_gestion_financiere)) { $requete="select * from type_abts"; $resultat_abt=mysql_query($requete); $user_loc=$deflt2docs_location; $t_type_abt=array(); while ($res_abt=mysql_fetch_object($resultat_abt)) { $locs=explode(",",$res_abt->localisations); $as=array_search($user_loc,$locs); if ((($as!==false)&&($as!==null))||(!$res_abt->localisations)) { $t_type_abt[]=$res_abt; } } if (count($t_type_abt)) { $list_type_abt="
\n
\n
\n
"; } } $empr_form = str_replace("!!typ_abonnement!!",$list_type_abt,$empr_form); } $empr_form = str_replace("!!nom!!", htmlentities($empr->empr_nom ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!prenom!!", htmlentities($empr->empr_prenom ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!adr1!!", htmlentities($empr->empr_adr1 ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!adr2!!", htmlentities($empr->empr_adr2 ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!cp!!", htmlentities($empr->empr_cp ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!ville!!", htmlentities($empr->empr_ville ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!pays!!", htmlentities($empr->empr_pays ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!mail!!", htmlentities($empr->empr_mail ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!tel1!!", htmlentities($empr->empr_tel1 ,ENT_QUOTES, $charset), $empr_form); if(!$empr->empr_sms) $empr_sms_chk=''; else $empr_sms_chk="checked='checked'"; $empr_form = str_replace('!!sms!!', $empr_sms_chk, $empr_form); $empr_form = str_replace("!!tel2!!", htmlentities($empr->empr_tel2 ,ENT_QUOTES, $charset), $empr_form); $empr_form = str_replace("!!prof!!", htmlentities($empr->empr_prof ,ENT_QUOTES, $charset), $empr_form); if ($empr->empr_year != 0) $empr_form = str_replace("!!year!!", htmlentities($empr->empr_year ,ENT_QUOTES, $charset), $empr_form); else $empr_form = str_replace("!!year!!", "", $empr_form); if (!$empr->empr_lang) $empr->empr_lang=$lang; $empr_form = str_replace('!!combo_empr_lang!!', make_empr_lang_combo($empr->empr_lang), $empr_form); if (!$duplicate_empr_from_id) { $empr_form = str_replace('!!empr_login!!', $empr->empr_login, $empr_form); $empr_form = str_replace("!!empr_msg!!", htmlentities($empr->empr_msg ,ENT_QUOTES, $charset), $empr_form); } else { $empr_form = str_replace('!!empr_login!!', "", $empr_form); $empr_form = str_replace("!!empr_msg!!", "", $empr_form); } // on récupère le select catégorie $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle "; $res = mysql_query($requete, $link); $nbr_lignes = mysql_num_rows($res); $categ_content=''; $empr_grille_categ="'; $empr_form = str_replace("!!categ!!", $categ_content, $empr_form); // Ajout des categories et localisations pour edition des grilles $empr_form = str_replace("", $empr_grille_categ, $empr_form); if ($pmb_lecteurs_localises) { $empr_grille_location = docs_location::get_html_select(array(0),array('id'=>0,'msg'=>$msg['all_location']),array('id'=>'empr_grille_location','class'=>'saisie-20em','style'=>'display:none;')); } else { $empr_grille_location=''; } $empr_form = str_replace("", $empr_grille_location, $empr_form); $requete = "SELECT id_categ_empr, libelle, duree_adhesion FROM empr_categ ORDER BY libelle "; $res = mysql_query($requete, $link); $grille_categ=""; $grille_categ.=""; } $empr_form = str_replace("!!categ!!", $categ_content, $empr_form); // on récupère le select statut $requete = "SELECT idstatut, statut_libelle FROM empr_statut ORDER BY statut_libelle "; //Si il n'y a pas de statut on prend celui définit pour l'utilisateur if(!$empr->empr_statut){ global $deflt_empr_statut; $empr->empr_statut=$deflt_empr_statut; } $res = mysql_query($requete, $link); $nbr_lignes = mysql_num_rows($res); for($i=0; $i < $nbr_lignes; $i++) { $row = mysql_fetch_row($res); $statut_content .= ""; } $empr_form = str_replace("!!statut!!", $statut_content, $empr_form); // et le select code stat // on récupère le select cod stat $requete = "SELECT idcode, libelle FROM empr_codestat ORDER BY libelle "; $res = mysql_query($requete, $link); $nbr_lignes = mysql_num_rows($res); for($i=0; $i < $nbr_lignes; $i++) { $row = mysql_fetch_row($res); $cstat_content .= ""; } // mise à jour du sexe switch($empr->empr_sexe) { case 1: $empr_form = str_replace("sexe_select_1", 'selected', $empr_form); break; case 2: $empr_form = str_replace("sexe_select_2", 'selected', $empr_form); break; default: $empr_form = str_replace("sexe_select_0", 'selected', $empr_form); break; } $empr_form = preg_replace("/sexe_select_[0-2]/m", '', $empr_form); $empr_form = str_replace("!!cstat!!", $cstat_content, $empr_form); // mise à jour du groupe $requete = "SELECT id_groupe, libelle_groupe, max(if(empr_id='$id','$id',0)) as inscription FROM groupe left join empr_groupe on id_groupe=groupe_id group by id_groupe, libelle_groupe ORDER BY libelle_groupe "; $groupe_form_aff = gen_liste_multiple ($requete, "id_groupe", "libelle_groupe", "inscription", "id_grp[]", "", $id, 0, $msg[empr_form_aucungroupe], 0,$msg[empr_form_nogroupe], 5) ; $empr_form = str_replace("!!groupe_ajout!!", $groupe_form_aff, $empr_form); $empr_form = str_replace('!!cancel!!',$form_cancel,$empr_form); // ldap MaxMan if ($empr->empr_ldap){ $form_ldap="checked" ; }else{ $form_ldap=""; } //$empr_form = str_replace('!!empr_password!!', $empr_password, $empr_form); $empr_form = str_replace("!!ldap!!",$form_ldap,$empr_form); $empr_form = str_replace('!!empr_password!!', '', $empr_form); if (!$empr->empr_location) $empr->empr_location=$deflt2docs_location ; if ($pmb_lecteurs_localises) { $loc = "
!!localisation!!
"; //$loc = str_replace('!!localisation!!', docs_location::gen_combo_box_empr($empr->empr_location, 0), $loc); $loc = str_replace('!!localisation!!', docs_location::get_html_select(array($empr->empr_location),array(),array('id'=>'empr_location_id','name'=>'empr_location_id')), $loc); } else { $loc = "" ; $empr_form = str_replace('', $loc, $empr_form); } $empr_form = str_replace('', $loc, $empr_form); if($pmb_opac_view_activate ){ $opac_view_tpl = "
!!opac_view!!
"; $opac_view = new opac_view(0,$id); $opac_view_tpl=str_replace("!!opac_view!!",gen_plus("opac_view",$msg["empr_form_opac_view"],$opac_view->do_sel_list(),0),$opac_view_tpl); } $empr_form = str_replace('', $opac_view_tpl, $empr_form); //Champs persos $perso_=$p_perso->show_editable_fields($id); if (count($perso_["FIELDS"])) $perso = "
" ; else $perso=""; $class="colonne2"; for ($i=0; $i"; $perso.="
\n"; $perso.="
"; $perso.=$p["AFF"]."
"; $perso.=""; if ($class=="colonne2") $class="colonne_suite"; else $class="colonne2"; } if ($class=="colonne_suite") $perso.="
 
"; $perso.=$perso_["CHECK_SCRIPTS"]; $empr_form=str_replace("!!champs_perso!!",$perso,$empr_form); print pmb_bidi($empr_form); }