=TO_DAYS('".$date_deb."'),1,0) as OK"; $resultatdate=mysql_query($rqt_date); $res=mysql_fetch_object($resultatdate) ; $date_courante = $date_deb ; while ($res->OK) { $rqt_date = "select dayofweek('".$date_courante."') as jour"; $resultatdate=mysql_query($rqt_date); $res=mysql_fetch_object($resultatdate) ; $jour = "j".$res->jour ; // OK : traitement if ($$jour) { $rqt_date = "update ouvertures set ouvert=$ouverture, commentaire='$commentaire' where date_ouverture='$date_courante' and num_location=$loc "; $resultatdate=mysql_query($rqt_date); if (!mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=$ouverture, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$loc "; $resultatdate=mysql_query($rqt_date); if (!mysql_affected_rows()) die ("insert into ouvertures failes") ; } if (is_array($duplicate_locs)) { foreach ($duplicate_locs as $duplicate_loc) { $rqt_date = "update ouvertures set ouvert=$ouverture, commentaire='$commentaire' where date_ouverture='$date_courante' and num_location=$duplicate_loc "; $resultatdate=mysql_query($rqt_date); if (!mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=$ouverture, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$duplicate_loc "; $resultatdate=mysql_query($rqt_date); if (!mysql_affected_rows()) die ("insert into ouvertures failes") ; } } } } $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=mysql_query($rqt_date); $res=mysql_fetch_object($resultatdate) ; $date_courante=$res->date_courante ; } } 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=mysql_query($rqt_date); if (!mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=0, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$loc "; $resultatdate=mysql_query($rqt_date); if (!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=mysql_query($rqt_date); if (!mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=0, date_ouverture='$date_courante', commentaire='$commentaire', num_location=$duplicate_loc "; $resultatdate=mysql_query($rqt_date); if (!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=mysql_query($rqt_date); if (!mysql_affected_rows()) { $rqt_date = "insert into ouvertures set ouvert=if('".$action."'='O', 1, 0), date_ouverture='$date', commentaire='', num_location=$loc "; $resultatdate=mysql_query($rqt_date); if (!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'] = "" ; $admin_layout = str_replace('!!menu_sous_rub!!', $msg["calendrier_edition"], $admin_layout); print $admin_layout; echo pmb_bidi(calendar_gestion($date, 0, "", "", 1, $loc)); break; case "consulter": default: $params['link_on_day'] = $base_url ; $admin_layout = str_replace('!!menu_sous_rub!!', $msg["calendrier_consulter"], $admin_layout); print $admin_layout; print "
"; $result=mysql_query("select location_libelle,name from docs_location where idlocation=$loc",$dbh); if(mysql_num_rows($result) == 1) { $admin_calendrier_form=str_replace('!!biblio_name!!',mysql_result($result,0,"name"),$admin_calendrier_form); $admin_calendrier_form=str_replace('!!localisation!!',$msg[empr_location].' : '.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); } $result=mysql_query("select idlocation, location_libelle from docs_location where idlocation not in($loc)",$dbh); while ($row = mysql_fetch_object($result)) { $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=mysql_query($rqt_date); $resdate=mysql_fetch_object($resultatdate); $annee = $resdate->annee ; } else $annee = substr($date, 0,4); } $gg = ''; $dd = ''; echo "\n"; echo "