Page 1 of 1

LISE Smarty tag in an UDT

Posted: Fri Apr 26, 2024 1:42 pm
by webform
I have an UDT which gets data from one LISE Instance while presave to another LISE Instance, but it's not working (Server Error 500):

Code: Select all

$item = $params['item_object'];

$id = $item->project;
$smarty_data = "{LISEProjects action='detail' item='".$id."' template_detail='foo'}";

//Save To LISE Instance
$item->project_name = $smarty->display('eval:'.$smarty_data);
The offending line seems to be the LISE tag. But if i do a plain UDT this works:

Code: Select all

$id = isset($params['id']) ? $params['id'] : '';
$smarty_data = "{LISEProjects action='detail' item='".$id."' template_detail='foo'}";
$smarty->display('eval:'.$smarty_data);
Maybe an UDT with a LISE instance presaving to another LISE instance is not possible?

Re: LISE Smarty tag in an UDT

Posted: Fri Apr 26, 2024 1:51 pm
by Jo Morg
webform wrote: Fri Apr 26, 2024 1:42 pm I have an UDT which gets data from one LISE Instance while presave to another LISE Instance, but it's not working (Server Error 500)
[...]
Maybe an UDT with a LISE instance presaving to another LISE instance is not possible?
First of all check your PHP error log, a Server Error 500 is a PHP issue and determining which and where is the 1s step.

Re: LISE Smarty tag in an UDT

Posted: Fri Apr 26, 2024 2:05 pm
by webform
Doh! I totally forgot to check the error log. Sadly it didn't contains much info, so it's no help at all:

Code: Select all

[26/Apr/2024:15:36:59 +0200] "POST /admin/moduleinterface.php" 500

Re: LISE Smarty tag in an UDT

Posted: Fri Apr 26, 2024 2:15 pm
by Jo Morg
I suspect that's the apache access log, not the php error log

Re: LISE Smarty tag in an UDT

Posted: Mon Apr 29, 2024 9:39 am
by webform
Finally succeed in finding the error in the php error log:

Code: Select all

PHP Notice: Trying to access array offset on value of type null in /lib/smarty/sysplugins/smarty_resource_recompiled.php(52) : eval()'d code on line 18\n
My UDT set as a LISE PreItem Save:

Code: Select all

$item = $params['item_object'];

$id = $item->project; //Value (Item ID from another LISE Instance) is from a Custom Field From Smarty
$smarty_data = "{LISEProjects action='detail' item='".$id."' template_detail='foo'}";

//Save To LISE Instance
$item->project_name = $smarty->display('eval:'.$smarty_data);