Re: [Glpi-dev] Search by date

2011-09-13 Thread MoYo

Hi,

small changes done on patch and applied on 0.83.

Thanks

Regards

Julien

Le 06/09/2011 11:19, David DURIEUX a écrit :

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  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  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
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


Re: [Glpi-dev] Search by date

2011-09-06 Thread David DURIEUX
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  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  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
>>Glpi-dev@gna.org
>>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 "".$LANG['calendar'][16]."";
+  echo "".$LANG['calendar'][27]."";
   echo "".$LANG['calendar'][17]."";
 
   if ($with_time) {
@@ -3071,12 +3072,29 @@ class Html {
  echo "- $i ".$LANG['calendar'][12]."";
   }
 
+  $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 "";
+ echo $LANG['calendar'][$lang_key]."";
+  }
+  
   for ($i=1 ; $i<=10 ; $i++) {
  $val = '-'.$i.'WEEK';
  echo "";
  echo "- $i ".$LANG['calendar'][13]."";
   }
 
+  $val = "BEGINMONTH";
+  echo "";
+  echo $LANG['calendar'][25]."";
+  
   for ($i=1 ; $i<=12 ; $i++) {
  $val = '-'.$i.'MONTH';
  echo "";
@@ -3088,6 +3106,10 @@ class Html {
  echo "";
  echo "- $i ".$LANG['calendar'][15]."";
   }
+  
+  $val = "BEGINYEAR";
+  echo "";
+  echo $LANG['calendar'][26]."";
 
   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] = "Ven

Re: [Glpi-dev] Search by date

2011-09-06 Thread David DURIEUX
This is the patch for GLPI 0.83 devel

Thanks!

David Durieux

Le Mon, 5 Sep 2011 15:35:05 +0200
David DURIEUX  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
>Glpi-dev@gna.org
>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]."";
   }
 
+  $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 "";
+ echo $LANG['calendar'][$lang_key]."";
+  }
+  
   for ($i=1 ; $i<=10 ; $i++) {
  $val = '-'.$i.'WEEK';
  echo "";
  echo "- $i ".$LANG['calendar'][13]."";
   }
 
+  $val = "BEGINMONTH";
+  echo "";
+  echo $LANG['calendar'][25]."";
+  
   for ($i=1 ; $i<=12 ; $i++) {
  $val = '-'.$i.'MONTH';
  echo "";
@@ -3088,6 +3105,10 @@ class Html {
  echo "";
  echo "- $i ".$LANG['calendar'][15]."";
   }
+  
+  $val = "BEGINYEAR";
+  echo "";
+  echo $LANG['calendar'][26]."";
 
   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
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


Re: [Glpi-dev] Search by date

2011-09-05 Thread Franci González
It sounds practical.

2011/9/5 David DURIEUX 

> 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
> Glpi-dev@gna.org
> https://mail.gna.org/listinfo/glpi-dev
>



-- 
Francisco M. González
___
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev


[Glpi-dev] Search by date

2011-09-05 Thread David DURIEUX
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
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev