= $d) && ($ck_date_debut < $ck_date_fin) ) { foreach($location as $resa_loc_retrait=>$resa_qty) { if($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(); } } alert_mail_users_pmb($id_notice, $id_bulletin, $_SESSION["id_empr_session"],0,1) ; print resa_planning(2, $id_notice, $id_bulletin, $resa_deb, $resa_fin); } else { print resa_planning(1, $id_notice, $id_bulletin); } } } else { //Sinon, suppression éventuelle et affichage des prévisions de l'emprunteur if ($delete && $id_resa_planning) { $q = "SELECT resa_idnotice, resa_idbulletin FROM resa_planning WHERE id_resa=".$id_resa_planning; $r = @pmb_mysql_query($q); if(pmb_mysql_num_rows($r)) { $row = pmb_mysql_fetch_object($r); $id_notice = $row->resa_idnotice; $id_bulletin = $row->resa_idbulletin; } resa_planning::delete($id_resa_planning); if ($id_notice || $id_bulletin) { alert_mail_users_pmb($id_notice, $id_bulletin, $_SESSION["id_empr_session"],1,1) ; } } print '

'.$msg['empr_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); if(pmb_mysql_num_rows($r3)) { $tableau_resa = ''; $tableau_resa.=''; while ($resa = pmb_mysql_fetch_array($r3)) { $id_resa_planning = $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 $notice = new notice($resa_idnotice); $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); $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.")"); } elseif ($obj->date_date) { $titre.= pmb_bidi("(".$obj->aff_date_date.")"); } } $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($step=1, $id_notice=0, $id_bulletin=0, $resa_deb='',$resa_fin='') { global $msg,$charset; global $liens_opac ; global $form_resa_planning_add, $form_resa_planning_confirm ; global $popup_resa, $opac_max_resa; if ($step==1) { // 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); 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_planning_add = str_replace ('!!resa_loc_retrait!!',$form_loc_retrait,$form_resa_planning_add); $form_resa_planning_add = str_replace ('!!id_notice!!',$id_notice,$form_resa_planning_add); $form_resa_planning_add = str_replace ('!!id_bulletin!!',$id_bulletin,$form_resa_planning_add); print $form_resa_planning_add ; if ($id_notice) { $opac_notices_depliable = 1 ; $liens_opac = array() ; $ouvrage_resa = aff_notice($id_notice, 1) ; } else { $ouvrage_resa = bulletin_affichage_reduit($id_bulletin,1) ; } if ($step==2) { $form_resa_planning_confirm = str_replace('!!date_deb!!', formatdate($resa_deb), $form_resa_planning_confirm); $form_resa_planning_confirm = str_replace('!!date_fin!!', formatdate($resa_fin), $form_resa_planning_confirm); print $form_resa_planning_confirm; } 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); 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; } }