=TO_DAYS('".$date_deb."'),1,0) as OK"; $resultatdate=pmb_mysql_query($rqt_date); $res=pmb_mysql_fetch_object($resultatdate) ; $date_courante = $date_deb ; while ($res->OK) { $rqt_date = "select dayofweek('".$date_courante."') as jour"; $resultatdate=pmb_mysql_query($rqt_date); $res=pmb_mysql_fetch_object($resultatdate) ; $jour = "j".$res->jour ; // OK : traitement if (!empty(${$jour})) { calendar_open_or_close_date($date_courante, $ouverture, $commentaire); } $rqt_date = "select if(to_days(date_add('".$date_courante."', INTERVAL 1 DAY))<=TO_DAYS('".$date_fin."'),1,0) as OK, date_add('".$date_courante."', INTERVAL 1 DAY) as date_courante, dayofweek(date_add('".$date_courante."', INTERVAL 1 DAY)) as jour"; $resultatdate=pmb_mysql_query($rqt_date); $res=pmb_mysql_fetch_object($resultatdate) ; $date_courante=$res->date_courante ; } } elseif($date_deb != "0000-00-00") { //Date précise $date_courante = $date_deb; calendar_open_or_close_date($date_courante, $ouverture, $commentaire); } } if ($faire=="commentaire" && $annee_mois && ($loc!="")) { for ($i=1; $i<=31; $i++) { $i_2 = substr("0".$i, -2) ; $var_jour_comment = "comment_".$i_2 ; $commentaire = ${$var_jour_comment} ; if ($commentaire) { $date_courante = $annee_mois."-".$i_2; $rqt_date = "update ouvertures set commentaire='$commentaire' where date_ouverture='$date_courante' and num_location=$loc"; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=0, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$loc "; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) die ("insert into ouvertures failed") ; } if (is_array($duplicate_locs)) { foreach ($duplicate_locs as $duplicate_loc) { $rqt_date = "update ouvertures set commentaire='$commentaire' where date_ouverture='$date_courante' and num_location=$duplicate_loc"; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=0, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$duplicate_loc "; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) die ("insert into ouvertures failed") ; } } } } } } if (($action=="O" || $action=="F") && $date && $loc!="") { $rqt_date = "update ouvertures set ouvert=if(ouvert=0, 1, 0) where date_ouverture='$date' and num_location=$loc "; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=if('".$action."'='O', 1, 0), date_ouverture='$date', commentaire='', num_location=$loc "; $resultatdate=pmb_mysql_query($rqt_date); if (!pmb_mysql_affected_rows()) die ("insert into ouvertures failes") ; } } if (!$book_location_id) { if (!$loc) $loc = $deflt2docs_location; } else { $loc = $book_location_id; } switch ($sub) { case "edition": $params['link_on_day'] = "" ; echo pmb_bidi(admin_calendar_gestion($date, 0, "", "", 1, $loc)); break; case "consulter": default: $params['link_on_day'] = $base_url ; print "
"; $result=pmb_mysql_query("select location_libelle,name from docs_location where idlocation=$loc",$dbh); if(pmb_mysql_num_rows($result) == 1) { $admin_calendrier_form=str_replace('!!biblio_name!!',pmb_mysql_result($result,0,"name"),$admin_calendrier_form); $admin_calendrier_form=str_replace('!!localisation!!',$msg['empr_location'].' : '.pmb_mysql_result($result,0,"location_libelle"),$admin_calendrier_form); $admin_calendrier_form=str_replace('!!book_location_id!!',$loc,$admin_calendrier_form); } else { $admin_calendrier_form=str_replace('!!biblio_name!!','',$admin_calendrier_form); $admin_calendrier_form=str_replace('!!localisation!!',' ',$admin_calendrier_form); $admin_calendrier_form=str_replace('!!book_location_id!!','',$admin_calendrier_form); } $liste_input_loc_ids=array(); $result=pmb_mysql_query("select idlocation, location_libelle from docs_location where idlocation not in($loc)",$dbh); $duplicate_form = ''; while ($row = pmb_mysql_fetch_object($result)) { $duplicate_form .= ""; $liste_input_loc_ids[] = "dup_".$row->idlocation; } if (trim($duplicate_form)) { $duplicate_form .= " "; } $admin_calendrier_form = str_replace("!!duplicate_location!!", $duplicate_form, $admin_calendrier_form); echo pmb_bidi($admin_calendrier_form) ; if (!$annee) { if (!$date) { $rqt_date = "select date_format(CURDATE(),'%Y') as annee "; $resultatdate=pmb_mysql_query($rqt_date); $resdate=pmb_mysql_fetch_object($resultatdate); $annee = $resdate->annee ; } else $annee = substr($date, 0,4); } $gg = ''; $dd = ''; echo "\n"; echo "