ocsinventoryng
ocsinventoryng copied to clipboard
Impossible install Ocs Module Glpi 10
Traitement terminé. (0 seconde)
- Erreur durant l'éxecution de la requête : INSERT INTO
glpi_notificationtemplates
VALUES (NULL, 'Computers not imported', 'PluginOcsinventoryngNotimportedcomputer', NOW(), '', NULL, NOW()); - L'erreur est Incorrect integer value: 'Computers not imported' for column 'id' at row 1Dear GLPi user.
For bug reports, you can open an issue here, provide us :
- The version of the plugin 2.0.0.
- The version of your GLPI. 10.0.0
- The steps to reproduce your issue. Installing
Some news ?
Help
Please give us the source version of the plugin & the complete trace into sql-errors & php-errors
hi,
I just stumbled upon it :
https://github.com/pluginsGLPI/ocsinventoryng/blob/ec4dfabed9bfd8ac587a3c2efb4536f09f3fe7aa/hook.php#L2246-L2249
should be :
$query = "INSERT INTO `glpi_notificationtemplates`
VALUES (NULL, 0, 'Computers not imported', 'PluginOcsinventoryngNotimportedcomputer',
NOW(), NULL,
NOW());";
- one double single quote must be remove between NOW() and NULL
- one zero should be added as the second value (to trigger the auto-increment)
what is your glpi_notificationtemplates
structure ?
MariaDB [glpi]> describe glpi_notificationtemplates;
+---------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+----------------+
| date_creation | timestamp | YES | MUL | NULL | |
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | varchar(255) | YES | MUL | NULL | |
| itemtype | varchar(100) | NO | MUL | NULL | |
| date_mod | timestamp | YES | MUL | NULL | |
| comment | mediumtext | YES | | NULL | |
| css | mediumtext | YES | | NULL | |
+---------------+------------------+------+-----+---------+----------------+
7 rows in set (0.001 sec)
In fact your table doesn't respect order of fields of GLPI table
CREATE TABLE glpi_notificationtemplates
(
id
int unsigned NOT NULL AUTO_INCREMENT,
name
varchar(255) DEFAULT NULL,
itemtype
varchar(100) NOT NULL,
date_mod
timestamp NULL DEFAULT NULL,
comment
text,
css
text,
date_creation
timestamp NULL DEFAULT NULL,
PRIMARY KEY (id
),
KEY itemtype
(itemtype
),
KEY date_mod
(date_mod
),
KEY name
(name
),
KEY date_creation
(date_creation
)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
Hello, I had the same problem. I have the same fieldorder with date_creation in first place. It seams to years (using GLPI from 2008) of GLPI update procedures does have other field orders, i exported, dropped the table, created it with the "new order" and imported all entries to get it work (only the glpi_notificationtemplates table) but why don't you use in insert the names so that the order does not matter? It would make the OCS plugin more stable. A few lines later there i the INSERT INTO `glpi_notificationtemplatetranslations'. Also without field names. I did not needed to change the translation table, only the template table, but I hope you do any insert with label name. Maybe there are because of this all the error from other cases....
for line 2246 I would change INSERT INTO... to:
INSERT INTO glpi_notificationtemplates
(id
, name
, itemtype
, date_mod
, comment
, css
,date_creation
, )
for line 2252:
INSERT INTO glpi_notificationtemplatetranslations
(id
, notificationtemplates_id
, language
, subject
, content_text
, content_html
)
I did not dig into other INSERT commands, maybe there is more...
best regards, Boris.
If you are upgrading GLPI from version 9.x to 10.x, adjust the column sequence in the glpi_notificationtemplates table:
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN id int(10) unsigned NOT NULL AUTO_INCREMENT FIRST;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN name varchar(255) AFTER id;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN itemtype varchar(100) NOT NULL AFTER name;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN date_mod timestamp AFTER itemtype;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN comment text AFTER date_mod;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN css text AFTER comment;
ALTER TABLE glpi_notificationtemplates MODIFY COLUMN date_creation timestamp AFTER css;