This is the patch for GLPI 0.83 devel
Thanks!
David Durieux
Le Mon, 5 Sep 2011 15:35:05 +0200
David DURIEUX <[email protected]> a écrit:
>hello
>
>On search by date, we can search with a date, since xx hours, days...
>
>I propose to be able to find since last monday or sunday or... or since
>begin of this month. Goal is to use it in bookmark to have, for
>example, all tickets open this week or month.
>
>Is this query is fine for you?
>
>If yes I can propose a patch.
>
>David
>
>_______________________________________________
>Glpi-dev mailing list
>[email protected]
>https://mail.gna.org/listinfo/glpi-dev
diff --git a/inc/html.class.php b/inc/html.class.php
index b37f1d8..dbde158 100644
--- a/inc/html.class.php
+++ b/inc/html.class.php
@@ -3071,12 +3071,29 @@ class Html {
echo "- $i ".$LANG['calendar'][12]."</option>";
}
+ $list = array();
+ $list[18] = "LASTSUNDAY";
+ $list[19] = "LASTMONDAY";
+ $list[20] = "LASTTUESDAY";
+ $list[21] = "LASTWEDNESDAY";
+ $list[22] = "LASTTHURSDAY";
+ $list[23] = "LASTFRIDAY";
+ $list[24] = "LASTSATURDAY";
+ foreach ($list as $lang_key=>$val) {
+ echo "<option value='$val' ".($value===$val?'selected':'').">";
+ echo $LANG['calendar'][$lang_key]."</option>";
+ }
+
for ($i=1 ; $i<=10 ; $i++) {
$val = '-'.$i.'WEEK';
echo "<option value='$val' ".($value===$val?'selected':'').">";
echo "- $i ".$LANG['calendar'][13]."</option>";
}
+ $val = "BEGINMONTH";
+ echo "<option value='$val' ".($value===$val?'selected':'').">";
+ echo $LANG['calendar'][25]."</option>";
+
for ($i=1 ; $i<=12 ; $i++) {
$val = '-'.$i.'MONTH';
echo "<option value='$val' ".($value===$val?'selected':'').">";
@@ -3088,6 +3105,10 @@ class Html {
echo "<option value='$val' ".($value===$val?'selected':'').">";
echo "- $i ".$LANG['calendar'][15]."</option>";
}
+
+ $val = "BEGINYEAR";
+ echo "<option value='$val' ".($value===$val?'selected':'').">";
+ echo $LANG['calendar'][26]."</option>";
if ($with_future) {
if ($with_time) {
diff --git a/inc/search.class.php b/inc/search.class.php
index 9131e66..e880ae8 100644
--- a/inc/search.class.php
+++ b/inc/search.class.php
@@ -2542,6 +2542,41 @@ class Search {
$val = date($format_use, mktime ($hour, $minute, $second, $month, $day, $year));
}
}
+ if (strstr($val,'BEGIN')) {
+ $begin = str_replace("BEGIN", "", $val);
+ $hour = 0;
+ $minute = 0;
+ $second = 0;
+ $month = date("n");
+ $day = date("j");
+ $year = date("Y");
+
+ switch ($begin) {
+
+ case "YEAR":
+ $month = 1;
+ $day = 1;
+ break;
+
+ case "MONTH":
+ $day = 1;
+ break;
+
+ }
+ $val = date($format_use, mktime ($hour, $minute, $second, $month, $day, $year));
+ }
+ if (strstr($val,'LAST')) {
+ $lastday = str_replace("LAST", "", $val);
+ $lastday = ucfirst(Toolbox::strtolower($lastday));
+ $hour = 0;
+ $minute = 0;
+ $second = 0;
+ $month = date("n", strtotime("last ".$lastday));
+ $day = date("j", strtotime("last ".$lastday));
+ $year = date("Y", strtotime("last ".$lastday));
+
+ $val = date($format_use, mktime ($hour, $minute, $second, $month, $day, $year));
+ }
break;
}
}
diff --git a/locales/fr_FR.php b/locales/fr_FR.php
index bcad8d3..7ac6f6a 100644
--- a/locales/fr_FR.php
+++ b/locales/fr_FR.php
@@ -136,6 +136,16 @@ $LANG['calendar'][14] = "mois"; // singular (plural) like month(s)
$LANG['calendar'][15] = "année(s)";
$LANG['calendar'][16] = "Maintenant";
$LANG['calendar'][17] = "Spécifier une date";
+$LANG['calendar'][18] = "Dimanche dernier";
+$LANG['calendar'][19] = "Lundi dernier";
+$LANG['calendar'][20] = "Mardi dernier";
+$LANG['calendar'][21] = "Mercredi dernier";
+$LANG['calendar'][22] = "Jeudi dernier";
+$LANG['calendar'][23] = "Vendredi dernier";
+$LANG['calendar'][24] = "Samedi dernier";
+$LANG['calendar'][25] = "Début du mois";
+$LANG['calendar'][26] = "Début de l'année";
+$LANG['calendar'][27] = "Depuis";
$LANG['calendarD'][0] = "D";
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev