if ($id_notice) { $display = new mono_display($id_notice, 6, '', 0, '', '', '', 0, 1, 1, 1); print $display->result; } else { if ($id_bulletin) { $bull = new bulletinage($id_bulletin); $bull->make_display(); print $bull->display; } } print "<script type='text/javascript' src='./javascript/tablist.js'></script>\n"; $form_resa_dates = str_replace('!!resa_date_debut!!', formatdate(today()), $form_resa_dates); $form_resa_dates = str_replace('!!resa_date_fin!!', formatdate(today()), $form_resa_dates); $form_resa_dates = str_replace('!!resa_deb!!', today(), $form_resa_dates); $form_resa_dates = str_replace('!!resa_fin!!', today(), $form_resa_dates); $tab_loc_retrait = resa_planning::get_available_locations($id_empr, $id_notice, $id_bulletin); if (count($tab_loc_retrait) >= 1) { $form_loc_retrait = '<table ><tbody><tr><th>' . $msg['resa_planning_loc_retrait'] . '</th><th>' . $msg['resa_planning_qty_requested'] . '</th></tr>'; foreach ($tab_loc_retrait as $k => $v) { $form_loc_retrait .= '<tr><td width="50%">' . htmlentities($v['location_libelle'], ENT_QUOTES, $charset) . '</td>'; $form_loc_retrait .= '<td><select name="location[' . $v['location_id'] . ']">'; for ($i = 0; $i < $v['location_nb'] * 1 + 1; $i++) { $form_loc_retrait .= '<option value=' . $i . '>' . $i . '</option>'; } $form_loc_retrait .= '</select></td>'; $form_loc_retrait .= '</tr>'; } $form_loc_retrait .= '</tbody></table>'; } else { error_message($msg[350], $msg['resa_planning_no_item_available'], 1, "./circ.php?categ=resa_planning&resa_action=search_resa&mode=0&id_empr={$id_empr}&groupID={$groupID}"); break;
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 "<h3><span>" . $msg['resa_resa_titre_add'] . "</span></h3>"; 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 = '<table ><tbody><tr><th>' . $msg['resa_planning_loc_retrait'] . '</th><th>' . $msg['resa_planning_qty_requested'] . '</th></tr>'; foreach ($tab_loc_retrait as $k => $v) { $form_loc_retrait .= '<tr><td width="50%">' . htmlentities($v['location_libelle'], ENT_QUOTES, $charset) . '</td>'; $form_loc_retrait .= '<td><select name="location[' . $v['location_id'] . ']">'; for ($i = 0; $i < $v['location_nb'] * 1 + 1; $i++) { $form_loc_retrait .= '<option value=' . $i . '>' . $i . '</option>'; } $form_loc_retrait .= '</select></td>'; $form_loc_retrait .= '</tr>'; } $form_loc_retrait .= '</tbody></table>'; } 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 = '<h3>' . $msg['resa_planning_current'] . '</h3>'; $tableau_resa .= '<table class="tab_resa_planning">'; $tableau_resa .= '<tr><th>' . $msg['resa_planning_dates'] . '</th> <th>' . $msg['resa_planning_qty'] . '</th><th>' . $msg['resa_planning_loc_retrait'] . '</th></tr>'; 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 . '<br />'; $txt_dates .= $msg['resa_planning_date_fin'] . $resa_date_fin . '<br />'; 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 .= "<tr class='{$pair_impair}'>\n\t\t\t\t<td>{$txt_dates}</td><td>{$resa_qty}</td>\n\t\t\t\t<td>" . htmlentities($resa_loc_retrait, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t</tr>"; } $tableau_resa .= "</table>"; print $tableau_resa; } }