You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2013-08-14 17:45:30

punkdali
Member
Registered: 2008-03-18
Posts: 17

Computer Link Rule (glpi v .84 and ocs plugin)

Good Day,

I am having trouble importing and linking computers from OCS to glpi. When I tried to test the rule it was not successful.

  • Criterion     Condition     Reason

  • OCSNG server    is    localhost

  • Serial number    is already present in GLPI    Yes


there appears to be an error in the sql.

SELECT `glpi_computers`.`id`
                  FROM `glpi_computers`
                          LEFT JOIN `glpi_plugin_ocsinventoryng_ocslinks`
                             ON (`glpi_computers`.`id` = `glpi_plugin_ocsinventoryng_ocslinks`.`computers_id`)
                  WHERE 1 AND `glpi_computers`.`serial`='abc123' AND `glpi_plugin_ocsinventoryng_ocslinks`.`computers_id` IS NULL
                            AND `glpi_computers`.`entities_id` IN ()
                            AND `glpi_computers`.`is_template` = '0'
                  ORDER BY `glpi_computers`.`is_deleted` ASC

The following line should have an entity inside the parentheses.
AND `glpi_computers`.`entities_id` IN ()

when I turned on debug mode
PHP Notice: Undefined index: params in /usr/share/glpi/inc/ruleimportcomputer.class.php at line 312
PHP Notice: Undefined index: params in /usr/share/glpi/inc/ruleimportcomputer.class.php at line 315
PHP Notice: Trying to get property of non-object in /usr/share/glpi/inc/dbmysql.class.php at line 252
It looks like it comes from line 312:\inc\ruleimportcomputer.class.php
I made the change below and was able to successfully run the rule and the sql looked better.  Not sure this a solution, please advise.

I am still not able to link a computer from OCS to an existing GLPI computer when they share the same serial number; that will take some more time to track down the issue.

-paul


312,313c312,313
<       if (is_array($input['params']['entities_id'])) {
<          $where_entity = implode($input['params']['entities_id'],',');
---
>       if (is_array($input['entities_id'])) {
>          $where_entity = implode($input['entities_id'],',');
315c315
<          $where_entity = $input['params']['entities_id'];
---
>          $where_entity = $input['entities_id'];

Last edited by punkdali (2013-08-14 17:46:08)

Offline

#2 2013-08-14 19:31:18

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Computer Link Rule (glpi v .84 and ocs plugin)

I do not think you fix is the good one.
entities data need to be in $input['params']['entities_id'];


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#3 2013-08-14 20:15:01

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Computer Link Rule (glpi v .84 and ocs plugin)

Think it is a ocs plugin trouble.
I create a ticket on the plugin : https://forge.indepnet.net/issues/4438


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#4 2013-08-14 20:45:53

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Computer Link Rule (glpi v .84 and ocs plugin)


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#5 2013-08-15 15:36:07

punkdali
Member
Registered: 2008-03-18
Posts: 17

Re: Computer Link Rule (glpi v .84 and ocs plugin)

when manually importing the computer via the plugin menu Link new OCSNG computers to existing GLPI computers I am able to link the ocs computer to the existing glpi computer record.

unfortunately when I try to test the rule via the Home >Administration >Rules menu I still get the same php error as before and the sql statement is also still failing.

Rule definition -  /glpi/front/ruleimportcomputer.form.php?id=9
when i click on test  - /glpi/front/popup.php

I'm trying to test the rule because I think that is how the automatic action ocsng will attempt to link the computer. 


-Paul

Offline

#6 2013-08-15 18:47:03

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Computer Link Rule (glpi v .84 and ocs plugin)

Do you try to import the computer to see if the computer is linked ?


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#7 2013-08-15 18:49:11

MoYo
GLPI - Lead
From: Poitiers
Registered: 2004-09-13
Posts: 14,513
Website

Re: Computer Link Rule (glpi v .84 and ocs plugin)

The test could not work because in the normal process 2 rules engine are played :
- First : To assign the entity
- Second : Trying to link to an existgin computer.

And the test could not permit to select entity


MoYo - Julien Dombre - Association INDEPNET
Contribute to GLPI :    Support     Contribute     References     Freshmeat

Offline

#8 2013-08-15 20:10:51

punkdali
Member
Registered: 2008-03-18
Posts: 17

Re: Computer Link Rule (glpi v .84 and ocs plugin)

The automatic action was successful.  It linked the existing glpi computer record to the data in OCS during the automatic action.

Thank you for your help.

-paul

Offline

#9 2014-06-24 00:04:12

rbernier
Member
Registered: 2013-07-16
Posts: 16

Re: Computer Link Rule (glpi v .84 and ocs plugin)

GLPI: 0.84.5
OCS Inventory NG Plugin: 1.0.2

I seem to be having a similar issue, however when I test my rule it works flawlessly. When I attempt to "Link new OCSNG computers to existing GLPI computers" the entries aren't populating like once were in GLPI 0.83. My rule hasn't changed:

Serial Number...        is already present in GLPI....     Yes

OCSNG Link...        Assign...       Link if Possible

In debug mode I get the following error in the link column of the Link OCS to GLPI page:

PHP Notice: Undefined index: entities_id in /var/www/inc/ruleimportcomputer.class.php at line 311
PHP Notice: Undefined index: entities_id in /var/www/inc/ruleimportcomputer.class.php at line 314
PHP Notice: Trying to get property of non-object in /var/www/inc/dbmysql.class.php at line 252

This is happening on computers that I've verified work when I use the Test Rules function.

I verified that those fixes MoYo linked to before are present in the versions of GLPI and the OCS Plugin that I am using. Is there any other information I can provide that might help with the problem?

Last edited by rbernier (2014-06-24 00:18:54)


GLPI: 0.90.4-1 (Remi Repo), CentOS 7

Offline

#10 2015-11-16 23:12:11

rbernier
Member
Registered: 2013-07-16
Posts: 16

Re: Computer Link Rule (glpi v .84 and ocs plugin)

Thought I would post an update about this issue. I've recently upgraded from 0.84.5 to 0.90, and updated all plugins to latest version as well. This problem has gone away and computers are linking correctly based on my rule set.


GLPI: 0.90.4-1 (Remi Repo), CentOS 7

Offline

Board footer

Powered by FluxBB