You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2017-12-14 06:46:27

ultraelephant
Guest
Registered: 2017-12-14
Posts: 3

Behaviors Bug/Feature with task to do

Hello,

Found out that with "Block the solving/closing of a the ticket if task do to" option set to "Yes" you can't solve/close ticket, but you can post a solution (that will close ticket anyway).

I don't know if is it bug or is it feature by design, but if you what to block solution posting while that option is turned on I made a little fix:

Change condition in file /inc/ticket.class.php from

if ($config->getField('is_tickettasktodo')
          && (isset($ticket->input['status'])
              && in_array($ticket->input['status'], array_merge(Ticket::getSolvedStatusArray(),
                                                                Ticket::getclosedStatusArray())))) {

         foreach($DB->request(['FROM'  => 'glpi_tickettasks',
                               'WHERE' => ['tickets_id' => $ticket->getField('id')]]) as $task) {

            if ($task['state'] == 1) {
               Session::addMessageAfterRedirect(__("You cannot solve/close a ticket with task do to",
                                                'behaviors'), true, ERROR);
               unset($ticket->input['status']);
            }
         }
      }
   }

to

if ($config->getField('is_tickettasktodo')
                  && (isset($ticket->input['status'])
              && in_array($ticket->input['status'], array_merge(Ticket::getSolvedStatusArray(),
                                                                Ticket::getclosedStatusArray()))) || (isset($ticket->input['solution']))) {


         foreach($DB->request(['FROM'  => 'glpi_tickettasks',
                               'WHERE' => ['tickets_id' => $ticket->getField('id')]]) as $task) {

            if ($task['state'] == 1) {
               Session::addMessageAfterRedirect(__("You cannot solve/close a ticket with task do to",
                                                'behaviors'), true, ERROR);
               unset($ticket->input['status']);
               unset($ticket->input['solution']);
               unset($ticket->input['solutiontypes_id']);
            }
         }
      }
   }

Last edited by ultraelephant (2017-12-14 06:54:46)

Offline

#2 2018-01-03 10:21:24

KKAdmin
Guest
From: Germany
Registered: 2010-03-05
Posts: 744

Re: Behaviors Bug/Feature with task to do


You can mark this threat as [resolved] in subject of your threat. (This is only available edit of the first post.) It is good for users who help others to quickly see which post is still open.
##############################################
GLPI 9.2.3 /Ubuntu 16.04.4 LTS
Apache/2.4.18 (Ubuntu) - PHP 7.0.30-0ubuntu0.16.04.1 - MySQL 5.7.22-0ubuntu0.16.04.1

Offline

#3 2018-01-08 20:05:50

yllen
GLPI-DEV
From: Sillery (51)
Registered: 2008-01-14
Posts: 14,127

Re: Behaviors Bug/Feature with task to do

New version published for this issue: https://forge.glpi-project.org/projects/behaviors/files


CentOS 6.5 - CentOS 7
PHP 5.6 - PHP 7 - MySQL 5.6  + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)

Offline

Board footer

Powered by FluxBB