Closed matDOTviguier closed 12 months ago
Can you please specify the dolibarr version in which you have encountered this problem ?
12.04, Nicolas. I cannot figure why it fails. I mean by spending not enough time on it. I'll try to debug again next week.
Hello matDOTviguier, I cannot reproduce the bug on version 12.0.4
1/ Open the API EXPLORER
2/ Type a POST content like this :
3/ Read the log via :
4/ Search Line containing "M1" and relative to your action.
Mine is :
INSERT INTO llx_ticket(ref,track_id,fk_soc,fk_project,origin_email,fk_user_create,fk_user_assign,subject,message,fk_statut,resolution,progress,timing,type_code,category_code,severity_code,datec,date_read,date_close,entity,notify_tiers_at_create) VALUES ( 'TS2101-0119', '7sjze638vxeqwpr8', null, null, NULL, 1, NULL, 'S1', 'M1', 0, NULL, 0, NULL, NULL, NULL, NULL, '2021-01-20 14:17:37', NULL, NULL, 1, 1)
5/ Now, try to select in db :
SELECT * from llx_ticket WHERE llx_ticket.ref='TS2101-0119'
6/ No data, you can see here (heidiSQL client, but ... any works) :
7/ Apache log says :
[Wed Jan 20 14:27:31.287005 2021] [php7:error] [pid 7243] [client 92.131.160.175:49286] PHP Recoverable fatal error: Object of class Closure could not be converted to string in /var/www/html/erp.service-informatique.fr/htdocs/includes/r estler/framework/Luracast/Restler/AutoLoader.php on line 266, referer: https://erp.service-informatique.fr/api/index.php/explorer/
PS : DateTime doesn't match, it's because of a replay of the action in order to catch the log. Intial log was about Gigs !
And the function that throw the error is :
private function loadLastResort($className, $loader = null) {
$loaders = array_unique(static::$rogueLoaders); <==== LINE 266
if (isset($loader)) {
if (false === array_search($loader, $loaders))
static::$rogueLoaders[] = $loader;
return $this->loadThisLoader($className, $loader);
}
foreach ($loaders as $loader)
if (false !== $file = $this->loadThisLoader($className, $loader))
return $file;
return false;
}
The API is unfortunately still in alpha state. We need more tests. If you want we can get together and write some tests 😃 It would be really nice to get an overview of what is working and not. When I wrote a python program to sync into dolibarr I found that the API is not covering more than half of what I wanted so I interfaced directly with the db in some cases which is not optimal.
I'm yours ! I'm facing the same problem. Python server-side code, SPA in frontend. I need to launch a test server with the nightly and replicated db. This is the first step here. I come back asap.
Due to time to market restrictions, i have to bypass the option of the API. I have done a complete sqldiff in order to guess what "Crate a ticket" means ... and rewrote it from 0. Old school Python <=> db action
I found no documentation with the API and what works, and what doesn't work.
I tried this on v14, I have got fatal errors because one external module autoload files which conflicts with restler when calling call_trigger
@matDOTviguier look at https://github.com/Luracast/Restler/pull/515/files
@frederic34 so, the 14 is not ready to ticket via API ?
Still present in v16?
Hello,
I'm facing the same issue on V16.0.4 and found that is unfortuantely related to the automatic email when you assign an user. I have an external module which trigger an email when an user is assign, if I uncheck this module, the ticket is correctly created by the API, if I activate the module, I got same error as @matDOTviguier during the CMailFile action.
I don't know if that should be resolved or if somebody has an idea ?
restler autoloader may remove your autoload and then is unable to find the right files to load https://github.com/Dolibarr/dolibarr/blob/969ecf6dccde96d6a6acf535ac5ff850fe58a940/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php#L78
public static function thereCanBeOnlyOne() {
@frederic34
Merci ! Too complex for me....I deep dived a little bit in this Autoload, but except that the error is somewhere into the declaration of my new cMailFile. (trigger of the custom module) ..I have no clue how to fix it.
As the module works well with a UI ticket creation....that may be too complex for me
Fred
Hi, same issue V17.0.1
Hi, if I remove this option (Notify ticket creation to this e-mail address) inside the ticket mdoule the PUSH of ticket works!
Correct, the issue happens only if notification is on.
Unfortunately, Without this option, that make less sense to push tickets by API.
Fred
Le mar. 23 mai 2023, 19:25, Fado84 @.***> a écrit :
Hi, if I remove this option (Notify ticket creation to this e-mail address) inside the ticket mdoule the PUSH of ticket works!
— Reply to this email directly, view it on GitHub https://github.com/Dolibarr/dolibarr/issues/15707#issuecomment-1559863440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX4STMUWZGJCQEP2LKIBS7LXHTXJVANCNFSM4USEIHEA . You are receiving this because you commented.Message ID: @.***>
Hello,
Is it still the case ?
I'm closing the issue, you can ask to re-open it if needed.
Bug
No API POST on tickets have no effect in Database at all.
Environment
Seem to be environment independant
Expected and actual behavior
Expected, a new row in ticket table. Actual behavior, none. Get a 500 error.
Steps to reproduce the behavior
Explore the API once connected, send the data by :
{ "subject": "S1", "message": "M1" }
No TS2012-0086, no mail, no action ...