You are not logged in.
Hi,
I observing error in sql-errors.log:
2014-12-16 23:53:40 [@host]
*** MySQL query error:
SQL: SELECT `glpi_documents_items`.`id` AS assocID,
`glpi_entities`.`id` AS entity,
`glpi_documents`.`name` AS assocName,
`glpi_documents`.*
FROM `glpi_documents_items`
LEFT JOIN `glpi_documents`
ON (`glpi_documents_items`.`documents_id`=`glpi_documents`.`id`)
LEFT JOIN `glpi_entities`
ON (`glpi_documents`.`entities_id`=`glpi_entities`.`id`)
WHERE `glpi_documents_items`.`items_id` = \'1196\'
AND `glpi_documents_items`.`itemtype` = \'Ticket\' AND ( `glpi_documents`.`entities_id` IN () )
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') )' at line 11
Backtrace :
inc/ticket.class.php:6093
inc/notificationtemplate.class.php:287 Ticket->convertContentForNotification()
inc/notificationevent.class.php:166 NotificationTemplate->getTemplateByLanguage()
inc/ticket.class.php:1561 NotificationEvent::raiseEvent()
inc/commondbtm.class.php:823 Ticket->post_addItem()
inc/mailcollector.class.php:563 CommonDBTM->add()
inc/mailcollector.class.php:1533 MailCollector->collect()
: MailCollector::cronMailgate()
inc/crontask.class.php:781 call_user_func()
front/cron.php:78 CronTask::launch()
it is caused by undefined variable $_SESSION['glpiactiveentities_string'] in inc/db.function.php.
This error is produced every time cron runs mailgate task from CLI.
It looks that when task is run from CLI, this GUI related variable is not defined. I'm not sure whenever it is caused by my configuration or it is general issue.
I'm proposing small patch bellow to fix this issue. When suitable, incorporate it to next release.
Sincerely yours,
Jirka Novak
*** db.function.php.orig 2014-12-16 20:53:07.796311354 +0100
--- db.function.php 2014-12-16 23:59:28.152467501 +0100
***************
*** 1685,1691 ****
$query .= " IN ('" . implode("','",$value) . "') ";
} else {
if (strlen($value) == 0) {
! $query .= " IN (".$_SESSION['glpiactiveentities_string'].") ";
} else {
$query .= " = '$value' ";
}
--- 1685,1695 ----
$query .= " IN ('" . implode("','",$value) . "') ";
} else {
if (strlen($value) == 0) {
! if (isset($_SESSION['glpiactiveentities_string'])) {
! $query .= " IN (".$_SESSION['glpiactiveentities_string'].") ";
! } else {
! $query .= " IN (SELECT NULL FROM DUAL WHERE 0) ";
! }
} else {
$query .= " = '$value' ";
}
Offline
Version of GLPI used please?
CentOS 6.5 - CentOS 7.x
PHP 5.6 - PHP 7.x - MySQL 5.6 - MariaDB 10.2 + APC + oOPcache
GLPI from 0.72 to dev version
Certifiée ITIL (ITV2F, ITILF, ITILOSA)
Offline
Sorry, I missed this information. I'm using 0.85.1.
Sincerely yours, Jirka Novak
Offline