Fixed patch, use this instead previous mail.
Add possibility to search an opened ticket of today for example
Thanks.
David
Le Tue, 6 Sep 2011 10:08:26 +0200
David DURIEUX <[email protected]> a écrit:
>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..c8ab55d 100644
--- a/inc/html.class.php
+++ b/inc/html.class.php
@@ -3055,6 +3055,7 @@ class Html {
$val = 'NOW';
echo "<option value='$val' ".($value===$val?'selected':'').">".$LANG['calendar'][16]."</option>";
+ echo "<option value='TODAY' ".($value==='TODAY'?'selected':'').">".$LANG['calendar'][27]."</option>";
echo "<option value='0' ".($value===0?'selected':'').">".$LANG['calendar'][17]."</option>";
if ($with_time) {
@@ -3071,12 +3072,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 +3106,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..1482a1f 100644
--- a/inc/search.class.php
+++ b/inc/search.class.php
@@ -2542,6 +2542,50 @@ 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));
+ }
+ if ($val == 'TODAY') {
+ $hour = 0;
+ $minute = 0;
+ $second = 0;
+ $month = date("n");
+ $day = date("j");
+ $year = date("Y");
+ $val = date("Y-m-d", mktime ($hour, $minute, $second, $month, $day, $year));
+ }
break;
}
}
diff --git a/locales/fr_FR.php b/locales/fr_FR.php
index bcad8d3..4ab3914 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] = "Aujourd'hui";
$LANG['calendarD'][0] = "D";
_______________________________________________
Glpi-dev mailing list
[email protected]
https://mail.gna.org/listinfo/glpi-dev