> aucune info de gestion : liste simple if (!defined('GESTION_INFO_GESTION')) define ('GESTION_INFO_GESTION', 1); // pour traitement des prévisions if (!defined('LECTEUR_INFO_GESTION')) define ('LECTEUR_INFO_GESTION', 2); // pour affichage en fiche lecteur if (!defined('EDIT_INFO_GESTION')) define ('EDIT_INFO_GESTION', 3); // pour affichage en édition function planning_list($idnotice=0, $idbulletin=0, $idempr=0, $order='', $where='', $info_gestion=NO_INFO_GESTION, $url_gestion='', $ancre='') { global $dbh,$msg,$charset; global $montrerquoi, $f_loc_empr, $f_loc_ret ; global $current_module ; global $pdflettreresa_priorite_email_manuel; global $pmb_lecteurs_localises, $deflt2docs_location; global $pmb_location_resa_planning, $pmb_location_reservation,$deflt_docs_location, $deflt_resas_location; global $tdoc; if($info_gestion == GESTION_INFO_GESTION) { $list_resa_planning_circ_ui = new list_resa_planning_circ_ui(); return $list_resa_planning_circ_ui->get_display_list(); } $q_loc = 'select idlocation, location_libelle FROM docs_location order by location_libelle'; $r_loc = pmb_mysql_query($q_loc,$dbh); //Tableau + selecteur de localisations emprunteurs / nb de previsions $tab_loc_empr = array(); $sel_loc_empr = ''; if(!isset($f_loc_empr)) { $f_loc_empr=$deflt2docs_location; } if($pmb_lecteurs_localises) { $sel_loc_empr = ''; } //Tableau + selecteur de localisation de retrait / nb de previsions $tab_loc_ret = array(); $sel_loc_ret = ''; if(!isset($f_loc_ret)) { if($deflt_resas_location) { $f_loc_ret=$deflt_resas_location; } else { $f_loc_ret=$deflt_docs_location; } } if($pmb_location_resa_planning) { $sel_loc_ret = ''; } $aff_final = ""; $clause = ''; switch ($info_gestion) { case NO_INFO_GESTION: default: $clause .= " AND resa_planning.resa_remaining_qty!=0 "; break; } if (!$order) { $order="empr_nom, empr_prenom, tit, resa_idnotice, resa_date " ; } $nb_prev=0; $q = "select resa_planning.id_resa, resa_planning.resa_idnotice, resa_planning.resa_idbulletin, resa_planning.resa_date, resa_planning.resa_date_debut, resa_planning.resa_date_fin, resa_planning.resa_validee, resa_planning.resa_confirmee, resa_planning.resa_idempr, resa_planning.resa_qty, resa_planning.resa_remaining_qty, resa_planning.resa_loc_retrait, "; $q.= "trim(concat(if(series_m.serie_name <>'', if(notices_m.tnvol <>'', concat(series_m.serie_name,', ',notices_m.tnvol,'. '), concat(series_m.serie_name,'. ')), if(notices_m.tnvol <>'', concat(notices_m.tnvol,'. '),'')), if(series_s.serie_name <>'', if(notices_s.tnvol <>'', concat(series_s.serie_name,', ',notices_s.tnvol,'. '), series_s.serie_name), if(notices_s.tnvol <>'', concat(notices_s.tnvol,'. '),'')), ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $q.= "concat(empr_nom,', ',empr_prenom) as empr_nom_prenom, id_empr, empr_cb, empr_location, "; $q.= "if(resa_planning.resa_date_fin>=sysdate() or resa_planning.resa_date_fin='0000-00-00',0,1) as perimee, "; $q.= "date_format(resa_planning.resa_date_debut, '".$msg['format_date']."') as aff_resa_date_debut, "; $q.= "if(resa_planning.resa_date_fin='0000-00-00', '', date_format(resa_planning.resa_date_fin, '".$msg['format_date']."')) as aff_resa_date_fin, "; $q.= "date_format(resa_planning.resa_date, '".$msg['format_date']."') as aff_resa_date, " ; $q.= "ifnull(notices_m.typdoc,notices_s.typdoc) as typdoc "; $q.= "FROM resa_planning "; $q.= "LEFT JOIN notices as notices_m on resa_idnotice = notices_m.notice_id "; $q.= "LEFT JOIN series as series_m on notices_m.tparent_id = series_m.serie_id "; $q.= "LEFT JOIN bulletins on resa_idbulletin = bulletins.bulletin_id "; $q.= "LEFT JOIN notices as notices_s on bulletin_notice = notices_s.notice_id "; if ($montrerquoi!='toresa') { $q.= "LEFT JOIN series as series_s on notices_s.tparent_id = series_s.serie_id, "; } else { $q.= "LEFT JOIN series as series_s on notices_s.tparent_id = series_s.serie_id "; $q.= "JOIN resa on resa.resa_planning_id_resa = resa_planning.id_resa, "; } $q.= "empr "; $q.= "WHERE resa_planning.resa_idempr = id_empr "; if ($clause) $q.= $clause; if ($idnotice) $q.= "and notices_m.notice_id = '".$idnotice."' "; if ($idbulletin) $q.= "and bulletin_id = '".$idbulletin."' "; if ($idempr) $q.= "and id_empr = '".$idempr."' "; $q.= "order by ".$order; $r = pmb_mysql_query($q,$dbh) or die("Erreur SQL !=$q"); $nb_prev = pmb_mysql_num_rows($r); if (!$nb_prev) { switch ($info_gestion) { case NO_INFO_GESTION: default: return ''; } return $aff_final ; } //Entete Tableau $aff_final .= "
'.htmlentities($msg['empr_nom_prenom'], ENT_QUOTES, $charset).' | '.($pmb_lecteurs_localises ? ''.htmlentities($msg['resa_planning_loc_empr'], ENT_QUOTES, $charset).' | ' :''); $aff_final .= ''.htmlentities($msg['374'], ENT_QUOTES, $charset).' | '.htmlentities($msg['resa_planning_date_debut'], ENT_QUOTES, $charset).' | '.htmlentities($msg['resa_planning_date_fin'], ENT_QUOTES, $charset).' | '; $aff_final .= '|
---|---|---|---|---|---|
empr_cb)."\">".htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset)." | "; } else { $aff_final .= ''.htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset).' | '; } //Localisation lecteur if ($pmb_lecteurs_localises) { $aff_final.= ''.$tab_loc_empr[$data->empr_location].' | '; } //Date prevision $aff_final.= ''.$data->aff_resa_date.' | '; $aff_final.= "".$data->aff_resa_date_debut.' | '; $aff_final.= "".$data->aff_resa_date_fin." | "; $aff_final.= "
".$msg['resa_planning_date_debut']." ".formatdate($resa_date_debut)." ".$msg['resa_planning_date_fin']." ".formatdate($resa_date_fin)." " ; if (!$resa['perimee']) { if ($resa['resa_validee']) { $message_resa.= " ".$msg['resa_validee'] ; } else { $message_resa.= " ".$msg['resa_attente_validation']." " ; } } else { $message_resa.= " ".$msg['resa_overtime']." " ; } $message_resa.= "" ; } } return $message_resa; } function alert_empr_resa_planning($id_resa=0, $id_empr_concerne=0) { global $msg; global $pdflettreresa_priorite_email_manuel; if ($pdflettreresa_priorite_email_manuel==3) return ; if(!count($id_resa)) return; $tmp_id_resa =implode(",",$id_resa); $query = "select distinct "; $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, "; $query .= "date_format(resa_date_fin, '".$msg["format_date"]."') as aff_resa_date_fin, "; $query .= "date_format(resa_date_debut, '".$msg["format_date"]."') as aff_resa_date_debut, "; $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, "; $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, "; $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice "; $query .= "from (((resa_planning LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), empr "; $query .= "where id_resa in (".$tmp_id_resa.") and resa_validee=1 and resa_idempr=id_empr"; if ($id_empr_concerne) $query .= "and id_empr=$id_empr_concerne "; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { while ($o=pmb_mysql_fetch_object($result)) { if (($pdflettreresa_priorite_email_manuel==1 || $pdflettreresa_priorite_email_manuel==2) && $o->empr_mail) { $mail_reader_resa_planning = new mail_reader_resa_planning(); $res_envoi = $mail_reader_resa_planning->send_mail($o); if (!$res_envoi || $pdflettreresa_priorite_email_manuel==2) { print ""; } } elseif ($pdflettreresa_priorite_email_manuel!=3) { print ""; } $rqt_maj = "update resa_planning set resa_confirmee=1 where id_resa in (".$tmp_id_resa.") and resa_validee=1 " ; pmb_mysql_query($rqt_maj); } } }