cconard96 / jamf

JAMF Plugin for GLPI
GNU General Public License v2.0
6 stars 5 forks source link

Import working if Sync General not activated / SQL Error / Default Settings cannot be saved #124

Closed FlorentDerangere closed 6 months ago

FlorentDerangere commented 1 year ago

Describe the bug I have this 3 errors.

1/Not possible to activatate this image If i have those parameter activated i cannot import computer and i have this type of errors

php-error:

[2023-07-05 12:15:23] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "default_manufacturer" in /var/www/glpi/plugins/jamf/inc/computersync.class.php at line 74 Backtrace : plugins/jamf/inc/devicesync.class.php:243 PluginJamfComputerSync->syncGeneral() plugins/jamf/inc/computersync.class.php:663 PluginJamfDeviceSync::sync() plugins/jamf/ajax/import.php:65 PluginJamfComputerSync::import()

[2023-07-05 12:15:23] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "default_status" in /var/www/glpi/plugins/jamf/inc/computersync.class.php at line 80 Backtrace : plugins/jamf/inc/devicesync.class.php:243 PluginJamfComputerSync->syncGeneral() plugins/jamf/inc/computersync.class.php:663 PluginJamfDeviceSync::sync() plugins/jamf/ajax/import.php:65 PluginJamfComputerSync::import()

sql-error: [2023-07-05 12:18:38] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/src/DBmysql.php line 370 MySQL query error: SQL: SELECT FROM glpi_plugin_jamf_extensionattributes WHERE jamf_id = '3' AND itemtype = 'PluginJamfComputer' AND jamf_type = 'Computer' LIMIT 1 Error: Unknown column 'itemtype' in 'where clause' Backtrace : src/DBmysqlIterator.php:112 src/DBmysql.php:1056 DBmysqlIterator->execute() src/CommonDBTM.php:577 DBmysql->request() plugins/jamf/inc/computersync.class.php:292 CommonDBTM->find() plugins/jamf/inc/devicesync.class.php:248 PluginJamfComputerSync->syncExtensionAttributes() plugins/jamf/inc/computersync.class.php:663 PluginJamfDeviceSync::sync() plugins/jamf/ajax/import.php:65 PluginJamfComputerSync::import() {"user":"2@CSI-GLPI","mem_usage":"0.000\", 2.69Mio)"} [2023-07-05 12:18:38] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/src/DBmysql.php line 370 ** MySQL query error: SQL: INSERT INTO glpi_devicefirmwares (designation, manufacturers_id, entities_id, is_recursive, date_creation, date_mod) VALUES ('8422.121.1', NULL, '0', '1', '2023-07-05 12:17:24', '2023-07-05 12:17:24') Error: Column 'manufacturers_id' cannot be null Backtrace : src/DBmysql.php:1320 src/CommonDBTM.php:721 DBmysql->insert() src/CommonDBTM.php:1326 CommonDBTM->addToDB() plugins/jamf/inc/sync.class.php:216 CommonDBTM->add() plugins/jamf/inc/computersync.class.php:477 PluginJamfSync->applyDesiredState() plugins/jamf/inc/devicesync.class.php:251 PluginJamfComputerSync->syncComponents() plugins/jamf/inc/computersync.class.php:663 PluginJamfDeviceSync::sync() plugins/jamf/ajax/import.php:65 PluginJamfComputerSync::import() {"user":"2@CSI-GLPI","mem_usage":"0.014\", 2.79Mio)"} [2023-07-05 12:18:38] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/src/DBmysql.php line 370 MySQL query error: SQL: INSERT INTO glpi_items_devicefirmwares (itemtype, items_id, devicefirmwares_id, is_deleted, is_dynamic, entities_id, is_recursive, locations_id) VALUES ('Computer', '453', '-1', '0', '1', '0', '1', '0') Error: Out of range value for column 'devicefirmwares_id' at row 1 Backtrace : src/DBmysql.php:1320 src/CommonDBTM.php:721 DBmysql->insert() src/CommonDBTM.php:1326 CommonDBTM->addToDB() plugins/jamf/inc/sync.class.php:216 CommonDBTM->add() plugins/jamf/inc/computersync.class.php:490 PluginJamfSync->applyDesiredState() plugins/jamf/inc/devicesync.class.php:251 PluginJamfComputerSync->syncComponents() plugins/jamf/inc/computersync.class.php:663 PluginJamfDeviceSync::sync() plugins/jamf/ajax/import.php:65 PluginJamfComputerSync::import() {"user":"2@CSI-GLPI","mem_usage":"0.001\", 2.80Mio)"} [2023-07-05 12:18:38] glpisqllog.ERROR: DBmysql::query() in /var/www/glpi/src/DBmysql.php line 370 *** MySQL query error: SQL: UPDATE glpi_plugin_jamf_devices SET itemtype = 'Computer', items_id = '453', activation_lock_enabled = '0', entry_date = '2023-06-05T13:55:05.351+0000', jamf_items_id = '791', udid = '5D04032E-9D30-566F-AFB4-8F447F43F2ED', managed = '1', supervised = '1', sync_date = '2023-07-05 12:17:24' WHERE itemtype = 'Computer' AND items_id = '453' Error: Incorrect datetime value: '2023-06-05T13:55:05.351+0000' for column db_glpi.glpi_plugin_jamf_devices.entry_date at row 1

2/I cannot save this parameter in the config interfaces

image

For information i have only this parameter in the dbsql for jamf + jjsserver + jssuser + jsspassword image

System Specifications (please complete the following information):

Thanks for your help

GitSweetDragon commented 10 months ago

Hello @cconard96, is'it normal we can't set computer in "Default Settings" ? only ipad, iphone and appleTv ? and it's onmy sync logiciel and phone for me, nothing else

cconard96 commented 10 months ago

Hello @cconard96, is'it normal we can't set computer in "Default Settings" ? only ipad, iphone and appleTv ? and it's onmy sync logiciel and phone for me, nothing else

This plugin initially released with support for mobile devices only. It wasn't until version 2.1.0 that Computer support was added. The option for a default computer type was overlooked. I am still looking for contributors for this plugin. If someone wants to make a pull request to add this option, I'll review and merge it.

GitSweetDragon commented 10 months ago

i have this error for exemple (i remove true udid value)

Unable to create new element or update existing one - Erreur durant l'éxecution de la requête : UPDATE glpi_plugin_jamf_devices SET itemtype = 'Computer', items_id = '4', activation_lock_enabled = '0', entry_date = '2023-01-04T13:09:42.300+0000', jamf_items_id = '56', udid = '0000000-XXXX-XXX-XXXX-XXXX', managed = '1', supervised = '1', sync_date = '2023-09-29 11:37:50' WHERE itemtype = 'Computer' AND items_id = '4' - L'erreur est Incorrect datetime value: '2023-01-04T13:09:42.300+0000' for column db_glpi.glpi_plugin_jamf_devices.entry_date at row 1

cconard96 commented 10 months ago

I am aware of various issues with syncing, but I have not had the time to sit down and focus on this plugin. When I started this plugin, I was working in a school district that needed it. Since then, I've left that job and got contracted to work on GLPI itself/official plugins full time. While I do still have access to a Jamf server which Jamf graciously provides to developers for free, I don't have the same kind of time/motivation that I had for this personal plugin.

cconard96 commented 6 months ago

I cannot recreate the import/update issue in the latest 3.0.1 version.