From 720405560cd1ff0fe60daae7b5c4f13ee2baa30c Mon Sep 17 00:00:00 2001 From: moyooo Date: Mon, 1 Jun 2015 16:30:32 +0000 Subject: [PATCH] Massive action for closed ticketfixed #4967 --- inc/ticket.class.php | 66 +++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 5a842f8498f..927cff9108c 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -763,40 +763,47 @@ function prepareInputForUpdate($input) { $check_allowed_fields_for_template = false; $allowed_fields = array(); if (!Session::isCron() - && !Session::haveRight(self::$rightname, UPDATE)) { - + && (!Session::haveRight(self::$rightname, UPDATE) + // Closed tickets + || in_array($this->fields['status'],$this->getClosedStatusArray())) + ) { + $allowed_fields = array('id'); $check_allowed_fields_for_template = true; - if ($this->canApprove() - && isset($input["status"])) { + if (in_array($this->fields['status'],$this->getClosedStatusArray())) { $allowed_fields[] = 'status'; - } - // for post-only with validate right or validation created by rules - if (TicketValidation::canValidate($this->fields['id']) - || TicketValidation::canCreate() - || isset($input["_rule_process"])) { - $allowed_fields[] = 'global_validation'; - } - // Manage assign and steal right - if (Session::haveRightsOr(self::$rightname, array(self::ASSIGN, self::STEAL))) { - $allowed_fields[] = '_itil_assign'; - } + } else { + if ($this->canApprove() + && isset($input["status"])) { + $allowed_fields[] = 'status'; + } + // for post-only with validate right or validation created by rules + if (TicketValidation::canValidate($this->fields['id']) + || TicketValidation::canCreate() + || isset($input["_rule_process"])) { + $allowed_fields[] = 'global_validation'; + } + // Manage assign and steal right + if (Session::haveRightsOr(self::$rightname, array(self::ASSIGN, self::STEAL))) { + $allowed_fields[] = '_itil_assign'; + } - // Can only update initial fields if no followup or task already added - if (($this->numberOfFollowups() == 0) - && ($this->numberOfTasks() == 0) - && $this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID())) { - $allowed_fields[] = 'content'; - $allowed_fields[] = 'urgency'; - $allowed_fields[] = 'priority'; // automatic recalculate if user changes urgence - $allowed_fields[] = 'itilcategories_id'; - $allowed_fields[] = 'name'; - } + // Can only update initial fields if no followup or task already added + if (($this->numberOfFollowups() == 0) + && ($this->numberOfTasks() == 0) + && $this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID())) { + $allowed_fields[] = 'content'; + $allowed_fields[] = 'urgency'; + $allowed_fields[] = 'priority'; // automatic recalculate if user changes urgence + $allowed_fields[] = 'itilcategories_id'; + $allowed_fields[] = 'name'; + } - if ($this->canSolve()) { - $allowed_fields[] = 'solutiontypes_id'; - $allowed_fields[] = 'solution'; + if ($this->canSolve()) { + $allowed_fields[] = 'solutiontypes_id'; + $allowed_fields[] = 'solution'; + } } foreach ($allowed_fields as $field) { @@ -809,6 +816,7 @@ function prepareInputForUpdate($input) { } + //// check mandatory fields // First get ticket template associated : entity and type/category if (isset($input['entities_id'])) { @@ -5410,6 +5418,8 @@ static function cronCreateInquest($task) { AND ADDDATE(`glpi_tickets`.`closedate`, INTERVAL $delay DAY)<=NOW() AND `glpi_ticketsatisfactions`.`id` IS NULL ORDER BY `closedate` ASC"; + + Toolbox::logDebug($entity.' '.$rate.' '.$parent.' '.$delay.' '.$type.' '.$max_closedate); $nb = 0; $max_closedate = '';