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 2014-12-03 16:06:11

info@drobny.it
Member
Registered: 2014-12-03
Posts: 3

Create tickets from recurrent tickets not working

I'm using GLPI 0.84.3 in Ubuntu server 14.04 and during test I found, that no actual tickets will be created from recurrent tickets.
The following bugfix should repair this issue.
edit /usr/share/glpi/inc/ticketrecurrent.class.php

static function cronTicketRecurrent($task)
...
SELECT * 
FROM `glpi_ticketrecurrents` 
WHERE 
    (`glpi_ticketrecurrents`.`next_creation_date` < NOW()
    OR `glpi_ticketrecurrents`.`next_creation_date` IS NULL) 
AND `glpi_ticketrecurrents`.`is_active` = 1 
AND 
    (`glpi_ticketrecurrents`.`end_date` IS NULL 
    OR `glpi_ticketrecurrents`.`end_date` > NOW())

Change: Adding "OR `glpi_ticketrecurrents`.`next_creation_date` IS NULL", because recurrent tickets have a "null" create date upon creation.

static function createTicket($data)
...
// Set date to creation date
if(is_null($data['next_creation_date'])) $data['next_creation_date'] = 'now';
$createtime    = strtotime($data['next_creation_date']) + $data['create_before']; 
...
// Set entity
$input['entities_id'] = $data['entities_id'];
$input['_auto_import'] = true;
$input['name'] = $data['name'];

Changes:
Altered next_creation_date to "now" to get a valid timestring in the next step.
Use data-name to name the ticket.

function computeNextCreationDate($begin_date, $end_date, $periodicity, $create_before, $calendars_id)
...
if (empty($begin_date) || $begin_date == 'NULL')
...
if ($now >= $timestart) { 

Change:
$begin_date wasn't a comparison but an assignment
now vs. timestart starts even when they both are equal (now)

Offline

#2 2014-12-11 17:04:42

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Create tickets from recurrent tickets not working

Have you define begin_date for ticket recurrent ?
This date is needed to define the start date


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#3 2014-12-11 17:29:57

info@drobny.it
Member
Registered: 2014-12-03
Posts: 3

Re: Create tickets from recurrent tickets not working

Yes, I created a valid recurrent ticket.
(Even if I didn't, there isn't any hint or rule that states your fact. The best would be to abort the creation process until all field match their rules (e.g. "not empty/null").)
As you can see in my post, the problem didn't arise from an empty begin_date, but from an empty next_creation_date.
("because recurrent tickets have a "null" create date upon creation" or better "have a null next creation date")

Offline

Board footer

Powered by FluxBB