= $d) && ($ck_date_debut < $ck_date_fin) ) { foreach($location as $resa_loc_retrait=>$resa_qty) { $r = new resa_planning(); $r->resa_idempr=$_SESSION['id_empr_session']; $r->resa_idnotice=$id_notice; $r->resa_idbulletin=$id_bulletin; $r->resa_date_debut=$resa_deb; $r->resa_date_fin=$resa_fin; $r->resa_qty = $resa_qty; $r->resa_remaining_qty = $resa_qty; $r->resa_loc_retrait = $resa_loc_retrait; $r->save(); } print resa_planning(FALSE); } else { print resa_planning(); } } } else { //Sinon, suppression éventuelle et affichage des prévisions de l'emprunteur if ($delete) { resa_planning::delete($id_resa); } print "

".$msg['empr_bt_show_resa_planning']."

"; $q3 = "SELECT id_resa, resa_idempr, resa_idnotice, resa_idbulletin,resa_date_debut, resa_date_fin, "; $q3.= "if(resa_date_fin < sysdate() or resa_date_fin='0000-00-00',1,0) as resa_perimee, resa_validee, resa_confirmee, "; $q3.= "resa_qty, resa_loc_retrait, location_libelle "; $q3.= "FROM resa_planning left join docs_location on resa_loc_retrait=idlocation "; $q3.= "WHERE resa_idempr=".$_SESSION['id_empr_session']." "; $q3.= "and resa_remaining_qty!=0 "; $q3.= "ORDER by resa_date_debut asc, resa_date_fin asc"; $r3 = @pmb_mysql_query($q3, $dbh); if(pmb_mysql_num_rows($r3)) { $tableau_resa=""; $tableau_resa.=''; while ($resa = pmb_mysql_fetch_array($r3)) { $id_resa = $resa['id_resa']; $resa_idempr = $resa['resa_idempr']; $resa_idnotice = $resa['resa_idnotice']; $resa_idbulletin = $resa['resa_idbulletin']; $resa_date_debut = formatdate($resa['resa_date_debut']); $resa_date_fin = formatdate($resa['resa_date_fin']); $resa_qty =$resa['resa_qty']; $resa_loc_retrait = $resa['location_libelle']; if ($resa_idnotice) { // affiche la notice correspondant à la réservation $requete = "SELECT * FROM notices WHERE notice_id='".$resa_idnotice."' "; $res = @pmb_mysql_query($requete, $dbh); $obj=pmb_mysql_fetch_object($res); $notice = new notice($obj); $titre = pmb_bidi($notice->print_resume(1,$css)); } else { // c'est un bulletin donc j'affiche le nom de périodique et le nom du bulletin (date ou n°) $requete = "SELECT bulletin_id, bulletin_numero, bulletin_notice, mention_date, date_date, date_format(date_date, '".$msg["format_date_sql"]."') as aff_date_date FROM bulletins WHERE bulletin_id='$resa_idbulletin'"; $res = pmb_mysql_query($requete, $dbh); $obj = pmb_mysql_fetch_object($res) ; $notice3 = new notice($obj->bulletin_notice); $titre=pmb_bidi($notice3->print_resume(1,$css)); // affichage de la mention de date utile : mention_date si existe, sinon date_date if ($obj->mention_date) { $titre.= pmb_bidi("(".$obj->mention_date.")\n"); } elseif ($obj->date_date) { $titre.= pmb_bidi("(".$obj->aff_date_date.")\n"); } } $txt_dates = $msg['resa_planning_date_debut'].$resa_date_debut.'
'; $txt_dates.= $msg['resa_planning_date_fin'].$resa_date_fin.'
'; if ($resa['resa_perimee']) { $txt_dates.= $msg['resa_planning_overtime']; } else { $txt_dates.= $msg['resa_planning_attente_validation'] ; } $link_del="".$msg['resa_effacer_resa'].""; if ($parity++ % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $tableau_resa.=""; } $tableau_resa.="
'.$msg['resa_planning_title'].''.$msg['resa_planning_dates'].' '.$msg['resa_planning_qty'].''.$msg['resa_planning_loc_retrait'].'
$titre$txt_dates$resa_qty ".htmlentities($resa_loc_retrait,ENT_QUOTES,$charset)." $txt_statut$link_del
"; print $tableau_resa; } print "

".$msg["empr_resa_how_to"]."
"; } } // fonction de pose de réservation en planning function resa_planning($deb=TRUE) { global $dbh,$msg,$charset; global $id_notice,$id_bulletin ; global $liens_opac ; global $form_resa_dates, $form_resa_ok ; global $popup_resa, $opac_max_resa; global $resa_deb,$resa_fin; print "

".$msg['resa_resa_titre_add']."

"; if ($deb) { // test au cas où tentative de passer une résa hors URL de résa autorisée... $requete_resa = "SELECT count(1) FROM resa_planning WHERE resa_idnotice='$id_notice' and resa_idbulletin='$id_bulletin'"; $result_resa = pmb_mysql_query($requete_resa,$dbh); if ($result_resa) { $nb_resa_encours = pmb_mysql_result($result_resa, 0, 0) ; } else { $nb_resa_encours = 0; } if ($opac_max_resa && $nb_resa_encours>=$opac_max_resa) { $id_notice = 0; $id_bulletin = 0 ; } } if (!$id_notice && !$id_bulletin) { return $msg['resa_planning_unknown_record'] ; } $tab_loc_retrait = resa_planning::get_available_locations($_SESSION['id_empr_session'],$id_notice,$id_bulletin); if(count($tab_loc_retrait)>=1) { $form_loc_retrait = ''; foreach($tab_loc_retrait as $k=>$v) { $form_loc_retrait.= ''; $form_loc_retrait.= ''; $form_loc_retrait.=''; } $form_loc_retrait.= '
'.$msg['resa_planning_loc_retrait'].''.$msg['resa_planning_qty_requested'].'
'.htmlentities($v['location_libelle'],ENT_QUOTES,$charset).'
'; } else { return $msg['resa_planning_no_item_available'] ; } $form_resa_dates = str_replace ('!!resa_loc_retrait!!',$form_loc_retrait,$form_resa_dates); print $form_resa_dates ; if ($id_notice) { $opac_notices_depliable = 0 ; $liens_opac = array() ; $ouvrage_resa = aff_notice($id_notice, 1) ; } else { $ouvrage_resa = bulletin_affichage_reduit($id_bulletin,1) ; } if (!$deb) { $form_resa_ok = str_replace('!!date_deb!!', formatdate($resa_deb), $form_resa_ok); $form_resa_ok = str_replace('!!date_fin!!', formatdate($resa_fin), $form_resa_ok); print $form_resa_ok; } print $ouvrage_resa ; //Affichage des previsions sur le document courant par le lecteur courant $q3 = "SELECT id_resa, resa_idnotice, resa_idbulletin, resa_date_debut, resa_date_fin, "; $q3.= "if(resa_date_fin < sysdate() or resa_date_fin='0000-00-00',1,0) as resa_perimee, resa_validee, resa_confirmee, "; $q3.= "resa_qty, resa_loc_retrait, location_libelle "; $q3.= "FROM resa_planning left join docs_location on resa_loc_retrait=idlocation "; $q3.= "WHERE id_resa not in (select resa_planning_id_resa from resa where resa_idempr=".$_SESSION['id_empr_session'].") "; $q3.= "and resa_idempr='".$_SESSION['id_empr_session']."' and resa_idnotice=$id_notice and resa_idbulletin=$id_bulletin "; $q3.= "ORDER by resa_date_debut asc, resa_date_fin asc"; $r3 = @pmb_mysql_query($q3, $dbh); if(pmb_mysql_num_rows($r3)) { $tableau_resa = '

'.$msg['resa_planning_current'].'

'; $tableau_resa.= ''; $tableau_resa.=''; while ($resa = pmb_mysql_fetch_array($r3)) { $id_resa = $resa['id_resa']; $resa_idnotice = $resa['resa_idnotice']; $resa_idbulletin = $resa['resa_idbulletin']; $resa_date_debut = formatdate($resa['resa_date_debut']); $resa_date_fin = formatdate($resa['resa_date_fin']); $resa_qty =$resa['resa_qty']; $resa_loc_retrait = $resa['location_libelle']; $txt_dates = $msg['resa_planning_date_debut'].$resa_date_debut.'
'; $txt_dates.= $msg['resa_planning_date_fin'].$resa_date_fin.'
'; if ($resa['resa_perimee']) { $txt_dates.= $msg['resa_planning_overtime']; } else { $txt_dates.= $msg['resa_planning_attente_validation'] ; } if ($parity++ % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $tableau_resa.=""; } $tableau_resa.="
'.$msg['resa_planning_dates'].' '.$msg['resa_planning_qty'].''.$msg['resa_planning_loc_retrait'].'
$txt_dates$resa_qty ".htmlentities($resa_loc_retrait,ENT_QUOTES,$charset)."
"; print $tableau_resa; } }