Closed marekpierog closed 2 years ago
Hello,
The entry_date
field should be using the date and time directly from the session in GLPI but that format does not look right. It should look similar to 2022-05-23 19:09:36
. In your GLPI, can you enable debug mode for your user then click the bug icon in the top right to open the debug panel, navigate to the Session tab, and check the value of glpi_currenttime
?
For fields like last_inventory
, it should be the timestamp received directly from Jamf in the format. I'll have to look into that more to see if some conversions are missing.
Hi, time format @ GLPI seems to be fine:
glpi_currenttime | => | 2022-05-24 20:02:21 |
---|
Sorry for the long delay, I was busy with core GLPI development work. Can you test the fixes done in #109? It should fix the handling of UTC dates coming from Jamf.
[2022-06-09 10:44:33] glpisqllog.ERROR: DBmysql::query() in /var/www/html/src/DBmysql.php line 370
*** MySQL query error:
SQL: UPDATE `glpi_plugin_jamf_devices` SET `itemtype` = 'Phone', `items_id` = '196', `activation_lock_enabled` = '0', `last_inventory` = '06-06-2022 10:08:58', `entry_date` = '26-09-2019 10:43:36', `enroll_date` = '15-03-2021 14:35:19', `jamf_items_id` = '1', `udid` = '2792f4bd88d0015b2733bd***************', `managed` = '1', `supervised` = '1', `sync_date` = '2022-06-09 10:44:26' WHERE `itemtype` = 'Phone' AND `items_id` = '196'
Error: Incorrect datetime value: '06-06-2022 10:08:58' for column 'last_inventory' at row 1
Backtrace :
src/DBmysql.php:1453
src/DBmysql.php:1491 DBmysql->updateOrDie()
marketplace/jamf/inc/devicesync.class.php:297 DBmysql->updateOrInsert()
marketplace/jamf/inc/devicesync.class.php:250 PluginJamfDeviceSync->finalizeSync()
marketplace/jamf/inc/mobilesync.class.php:810 PluginJamfDeviceSync::sync()
marketplace/jamf/ajax/import.php:63 PluginJamfMobileSync::import()
{"user":"7@glpi"}
Unfortunately datetime is still in a format unaccepted by mySQL
I made an adjustment to force Y-M-D date format when syncing instead of using the user preference for date format (which should only be used for display). The change was made in the same linked pull request.
Can confirm - it works after applying this PR. Thank you!
After a device from JAMF is discovered and clicking on import the following error apears:
GLPI: 10.0.0 Plugin: 3.0.0 PHP: 8.1.2 mySQL: 8.0.29 OS: Ubuntu 22.04 LTS