First off all, this is my first email an approach to de glpi development
list, so I want to give my best regards and thank every one in this
list and in the GLPI Proyect for the great job you have made.
We have been using GLPI in our company for more than six months and it
has been a great success.
Recently my chief manager and some helpdesk users complained that GLPI
was not sending emails when the tickets were assigned to a technician or
a group at the time it was created.
However this works OK if the ticket is created and then edited to be
assigned to a person o group by entering the "Tracking" page.
After following the source in helpdesk.php and tracking.form.php I found
in the first case the ticket was created by a call to the add() method
in the Job class, and in the second case the update() method from Job is
called an this is responsible for sending the emails to the new assigned
users.
To fix this problem I created the tiny attached patch on helpdesk.php.
The patch works as follow:
When the "assign" or "assign_group" are not empty o 0 (default value) I
save those values in the $updates array and clean the values.
Then the add() method on the new Job is called as previously; but on
success I load the just created ticket from the DB, change the needed
values from the track->fields array and call the update() method to make
the ticket assignment and email sending.
I'm not just using the $_POST array to take in count any change
configured to be made on ticket creation by some "Rules".
It's full tested on GLPI 0.72 (and now in 0.72.3), and it's working
perfectly for us so I wanted to share it with the community in case
anybody found it useful.
Best regards
Luis
diff -ru --ignore-all-space glpi-072/front/helpdesk.php glpi/front/helpdesk.php
--- glpi-072/front/helpdesk.php 2009-07-15 16:15:26.000000000 -0300
+++ glpi/front/helpdesk.php 2009-11-07 16:36:45.029331130 -0200
@@ -34,7 +34,7 @@
// ----------------------------------------------------------------------
-$NEEDED_ITEMS=array("user","group","tracking","document","computer","printer","networking","peripheral","monitor","software","infocom","phone","rulesengine","rule.tracking","planning");
+$NEEDED_ITEMS=array("user","group","tracking","document","computer","printer","networking","peripheral","monitor","software","enterprise","document","infocom","phone","rulesengine","rule.tracking","planning");
define('GLPI_ROOT', '..');
include (GLPI_ROOT . "/inc/includes.php");
@@ -153,8 +153,26 @@
$track=new Job();
if (isset($_POST["priority"]) && $post_ticket){
+ $updates = array();
+ if (isset($_POST["assign"]) && $_POST["assign"]) {
+ $updates["assign"] = $_POST["assign"];
+ $_POST["assign"] = 0;
+ }
+ if (isset($_POST["assign_group"]) && $_POST["assign_group"]) {
+ $updates["assign_group"] = $_POST["assign_group"];
+ $_POST["assign_group"] = 0;
+ }
if ($newID=$track->add($_POST)){
logEvent($newID, "tracking", 4, "tracking",
$_SESSION["glpiname"]." ".$LANG['log'][20]." $newID.");
+ if (!empty($updates)) {
+ $updates['update'] = true;
+ $track->getFromDB($newID);
+ $updates = array_merge($track->fields, $updates);
+ unset($updates['date_mod']);
+ unset($updates['closedate']);
+ $result = $track->update($updates);
+ logEvent($newID, "tracking", 4, "tracking", $_SESSION["glpiname"]."
".$LANG['log'][21]);
+ }
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
_______________________________________________
Glpi-dev mailing list
Glpi-dev@gna.org
https://mail.gna.org/listinfo/glpi-dev