Skip to content

Commit

Permalink
Massive action for closed ticketfixed #4967
Browse files Browse the repository at this point in the history
  • Loading branch information
moyooo committed Jun 1, 2015
1 parent 8813bff commit 7204055
Showing 1 changed file with 38 additions and 28 deletions.
66 changes: 38 additions & 28 deletions inc/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -809,6 +816,7 @@ function prepareInputForUpdate($input) {
}



//// check mandatory fields
// First get ticket template associated : entity and type/category
if (isset($input['entities_id'])) {
Expand Down Expand Up @@ -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 = '';
Expand Down

0 comments on commit 7204055

Please sign in to comment.