Bug #5574

Bug to use with GLPi API

Added by verdanatech 8 months ago. Updated 8 months ago.

Status:RejectedStart date:11/21/2018
Priority:NormalDue date:
Assignee:yllen% Done:

0%

Category:-
Target version:2.1.2

Description

we found a BUG when using Beheviors with the GLPi API.
When the call is opened via API and the requester is required, PLUGIN can not recognize the requester coming via API, blocking the creation of the ticket.

We commend the change to 1 file to correct this error.

File: behaviors / inc / ticket.class.php

we inserted a conditional for the plugin to validate the session.use_cookies = 0 variable and accept it for opening API calls.

Resolution:

in beforeAdd(Ticket $ticket) we created a IF to test API interaction:

static function beforeAdd(Ticket $ticket) {
global $DB;

//this line is new 
if (!empty(ini_get('session.use_cookies'))) {
if (!is_array($ticket->input) || !count($ticket->input)) {
// Already cancel by another plugin
return false;
}
$dbu = new DbUtils();
...
...
}
...
...

the file attached

ticket.class.php Magnifier (31.4 KB) verdanatech, 11/21/2018 02:19 PM

History

#1 Updated by yllen 8 months ago

Behaviors must read data from api like it reads data from webservices.
You must put correct value in your json, like core done ('_users_id_requester')

#2 Updated by yllen 8 months ago

  • Status changed from New to Rejected

Also available in: Atom PDF