You are not logged in.
In version 0.84 of GLPI is possible to assign a ticket to a location, and even, you can create a rule to define the location of the ticket automatically from the location of the requester.
But, see my situation:
I have a ticket template that is mandatory to set the location. If do I create a rule for automatic setting the location, it is only processed at the time the ticket is sent, but if I do not select the locale is not possible to create the ticket. So, the ticket can only be created if the location is selected manually.
To work around this, I created a patch for the file inc/ticket.class.php that modifies a part of the method showForm() order for the location be automatically set when the requester is selected.
I wish the project coordinators think of the possibility of including this little feature in new versions.
See bellow the patch generated:
--- inc/ticket.class.php 2013-09-04 15:42:49.000000000 -0300
+++ inc/ticket.class.php 2013-09-06 17:00:02.205105783 -0300
@@ -4329,6 +4329,12 @@
echo "<td>";
echo $tt->getBeginHiddenFieldValue('locations_id');
if ($canupdate) {
+ if (!$ID && $values["_users_id_requester"] > 0){
+ $requester = new User();
+ $requester->getFromDB($values["_users_id_requester"]);
+ $this->fields['locations_id'] = $requester->fields['locations_id'];
+ unset($requester);
+ }
Location::dropdown(array('value' => $this->fields['locations_id'],
'entity' => $this->fields['entities_id']));
} else {
Note: the patch was generated to 0.84.1 version.
Best Regards,
Antonio Franco
Offline
I made this change also for the simplified interface.
Below the new patch:
--- inc/ticket.class.php 2013-09-04 15:42:49.000000000 -0300
+++ inc/ticket.class.php 2013-09-10 12:16:02.516372443 -0300
@@ -3412,6 +3412,12 @@
echo "<tr class='tab_bg_1'><td>";
printf(__('%1$s%2$s'), __('Location'), $tt->getMandatoryMark('locations_id'));
echo "</td><td>";
+ if (!$values['locations_id'] && $values["_users_id_requester"] > 0){
+ $requester = new User();
+ $requester->getFromDB($values["_users_id_requester"]);
+ $values['locations_id'] = $requester->fields['locations_id'];
+ unset($requester);
+ }
Location::dropdown(array('value' => $values["locations_id"]));
echo "</td></tr>";
}
@@ -4329,6 +4335,12 @@
echo "<td>";
echo $tt->getBeginHiddenFieldValue('locations_id');
if ($canupdate) {
+ if (!$ID && $values["_users_id_requester"] > 0){
+ $requester = new User();
+ $requester->getFromDB($values["_users_id_requester"]);
+ $this->fields['locations_id'] = $requester->fields['locations_id'];
+ unset($requester);
+ }
Location::dropdown(array('value' => $this->fields['locations_id'],
'entity' => $this->fields['entities_id']));
} else {
Best regards,
Antonio
Offline