Ok, here is the solution for this problem:

Added two new fields in DB:
ALTER TABLE `glpi_tickettasks`  ADD COLUMN `date_mod` TIMESTAMP NULL DEFAULT 
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `users_id_tech`;
ALTER TABLE `glpi_ticketfollowups`      ADD COLUMN `date_mod` TIMESTAMP NULL 
DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER `requesttypes_id`;

Set them to default values:
update glpi_tickettasks set date_mod = glpi_tickettasks.date ;
update glpi_ticketfollowups set date_mod = glpi_ticketfollowups.date ;

patch file "inc\notificationtargetticket.class.php"
function getDatasForObject()
line 379:

- $restrict .= " ORDER BY `date` DESC, `id` ASC";
-
-         //Task infos
-         $tasks = getAllDatasFromTable('glpi_tickettasks',$restrict);
-
-         foreach ($tasks as $task) {
+ $restrict .= " ORDER BY `date_mod` DESC, `id` ASC";
+
+         //Task infos
+         $tasks = getAllDatasFromTable('glpi_tickettasks',$restrict);
+
+        foreach ($tasks as $task) {

And tada, the "LAST 1" keyword returns the most recently modified task (or 
follow-up)

Regards,

Olivier MORON 
Miscellaneous Program Member

RAYNET SNC 
Tel : +33 4 76 33 49 52
Fax: +33 4 76 70 56 63



-----Original Message-----
From: Moron, Olivier 
Sent: Friday, March 22, 2013 10:48 AM
To: Liste de diffusion des developpeurs GLPI
Subject: RE: Request for new TAGs for notification templates

There is a problem with what I want to achieve....
I would like to have the latest modified and not the latest in the 'date' DESC 
(i.e. this is not the same when you update a task or followup).

The idea is to send only the task that has been assigned to a technician to 
him/her, and not the complete set of tasks. This is OK with LAST 1 when the 
task is the latest, but if it is needed to update the description of the task 
(I mean during ticket life cycle), then the technician will receive a 
notification with the latest created task in it and not the real latest 
modified task in it....

I believe the problem is because in the DB, only the creation date is stored, 
and not the modification date of the followups and tasks...


Olivier MORON 
Miscellaneous Program Member

RAYNET SNC 
Tel : +33 4 76 33 49 52
Fax: +33 4 76 70 56 63



-----Original Message-----
From: glpi-dev-boun...@gna.org [mailto:glpi-dev-boun...@gna.org] On Behalf Of 
Alexandre Delaunay
Sent: Friday, March 22, 2013 10:12 AM
To: Liste de diffusion des developpeurs GLPI
Subject: Re: [Glpi-dev] Request for new TAGs for notification templates

This loop is not referenced in in the 'List of available tags'
I checked in 0.78/0.80 versions, it is also available.

An explanation of implementation is available in the pdf documentation page 158 
(https://forge.indepnet.net/attachments/download/1152/glpidoc-0.83.1.pdf)

Regards.

----- Mail original -----
> Dear Alexandre,
> 
> Thank you,
> 
> but in my 0.80.2 and 0.83.7 I can't see these...in the 'List of available
> tags'
> 
> For which version are these available?
> Regards,
> 
> Olivier MORON
> Miscellaneous Program Member
> 
> RAYNET SNC
> Tel : +33 4 76 33 49 52
> Fax: +33 4 76 70 56 63
> 
> 
> 
> -----Original Message-----
> From: glpi-dev-boun...@gna.org [mailto:glpi-dev-boun...@gna.org] On Behalf Of
> Alexandre Delaunay
> Sent: Friday, March 22, 2013 9:39 AM
> To: Liste de diffusion des developpeurs GLPI
> Subject: Re: [Glpi-dev] Request for new TAGs for notification templates
> 
> Hello
> 
> You can already do this with the foreach tag :
> 
> ##FOREACH LAST Xfollowups##
> ##FOREACH LAST Xtasks##
> 
> Where X is the number of the last items you want.
> 
> 
> Example :
> 
> ##FOREACH LAST 1followups##
>    ##followup.author##
>    ##followup.date##
>    ##followup.description##
>    ##followup.isprivate##
>    ##followup.requesttype##
> ##ENDFOREACHfollowups##
> 
> 
> and
> 
> 
> ##FOREACH LAST 1tasks##
>    ##task.author##
>    ##task.begin##
>    ##task.category##
>    ##task.date##
>    ##task.description##
>    ##task.end##
>    ##task.isprivate##
>    ##task.status##
>    ##task.time##
>    ##task.user##
> ##ENDFOREACHtasks##
> 
> Regards
> 
> ----- Mail original -----
> > Dear all,
> > 
> > I propose to add a set of TAGs for the notification templates, the purpose
> > of
> > these will be to have the possibility to get the latest added or modified
> > 'Follow-up' or the latest added or modified 'Task'.
> > 
> > ##followup.latest.author##
> > ##followup.latest.date##
> > ##followup.latest.description##
> > ##followup.latest.isprivate##
> > ##followup.latest.requesttype##
> > 
> > ##task.latest.author##
> > ##task.latest.begin##
> > ##task.latest.category##
> > ##task.latest.date##
> > ##task.latest.description##
> > ##task.latest.end##
> > ##task.latest.isprivate##
> > ##task.latest.status##
> > ##task.latest.time##
> > ##task.latest.user##
> > 
> > This will give the possibility to send notifications which will contain
> > only
> > the concerned follow-up or task to receivers.
> > 
> > Thank you,
> > Regards,
> > 
> > Olivier MORON
> > Miscellaneous Program Member
> > 
> > RAYNET SNC
> > Tel : +33 4 76 33 49 52
> > Fax: +33 4 76 70 56 63
> > 
> > 
> > 
> > -----Original Message-----
> > From: glpi-dev-boun...@gna.org [mailto:glpi-dev-boun...@gna.org] On Behalf
> > Of
> > David DURIEUX
> > Sent: Wednesday, March 20, 2013 4:44 PM
> > To: glpi-dev@gna.org
> > Subject: Re: [Glpi-dev] 0.84- patch qui remplace is_array qui est un peu
> > lent
> > 
> > Faudrait faire pareil dans la même classe pour
> > clean_cross_side_scripting_deep
> > 
> > J'avais zappé dans le patch
> > 
> > David
> > 
> > 
> > Le Wed, 20 Mar 2013 16:41:14 +0100
> > David DURIEUX <d.duri...@siprossii.com> a écrit:
> > 
> > >Bonjour,
> > >
> > >is_array est un peu lent, voici un patch qui empeche son utilisation.
> > >
> > >is_array :
> > >24924 call de la fonction addslashes_deep (dans un inventaire fusion)
> > >1067086 ms d'execution
> > >1088283 cpu ticks
> > >2678352 mémoire
> > >
> > >sans is_array :
> > >24924 call de la fonction addslashes_deep (dans un inventaire fusion)
> > >940770 ms d'execution (88%)
> > >948907 cpu ticks (97%)
> > >2674864 mémoire
> > >
> > >
> > >
> > >Cordialement,
> > >--
> > >David DURIEUX
> > >Tel : +33 (0)4.82.53.30.53
> > >Mail : d.duri...@siprossii.com
> > >Site Web : http://www.siprossii.com/
> > >
> > >SIPROSSII
> > >Les Lafôrets
> > >69430 Beaujeu
> > >FRANCE
> > 
> > _______________________________________________
> > 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
> _______________________________________________
> 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

Reply via email to