fusioninventory / fusioninventory-for-glpi

FusionInventory plugin for GLPI
http://www.FusionInventory.org/
GNU Affero General Public License v3.0
361 stars 148 forks source link

Get computers linked to printers #3246

Open FLD83 opened 2 years ago

FLD83 commented 2 years ago

Hi everybody,

With Fusioninventory 9.5+3.0 plugin for GLPI and Fusioninventory agent 2.5 i got my printer from computer

image and for this i use this rules : rules.txt (Rename it to xml) But the same printer could be install on different computer ! On each computer inventory the link between printer and computer are changed and i don't see how to fix it ! I thinks it is because this part of code or this one :

 if (count($a_printers) || count($db_printers)) {
    if (count($db_printers) != 0) {
       // Delete printers links in DB
       foreach ($db_printers as $idtmp => $data) {
          $computer_Item->delete(['id'=>$idtmp], 1);
       }
    }
    if (count($a_printers) != 0) {
       foreach ($a_printers as $printers_id) {
          $input['entities_id'] = $entities_id;
          $input['computers_id']   = $computers_id;
          $input['itemtype']       = 'Printer';
          $input['items_id']       = $printers_id;
          $input['is_dynamic']     = 1;
          $input['_no_history']    = $no_history;
          $this->computerItemAdd($input, $no_history);
       }

/**

} }

I have try to make some change but it doesn't work !!

FLD83 commented 2 years ago

@ddurieux I have reopen a new issue because the previous one will be closed could you mark it to feature please ! Thanks