function glpiuImportPrinters($mode, $start = 0)
{
    global $PRINTERSLIST, $UC_OCSIDS, $UC_NAMES, $CFG_GLPI, $LANG;
    $DBocs = new DBocs($_SESSION["ocsservers_id"]);
    $DB = new DB();
    $noPort = 0;
    $numrows = 0;
    $UC_OCSIDS = array();
    // Correspondance UC ocs/glpi
    // Recherche les ports
    $query_ports = "select distinct hardware.NAME as UC_Name, hardware.DEVICEID, printers.NAME, printers.PORT, printers.DRIVER from printers " . "inner join hardware on hardware.ID = printers.HARDWARE_ID  where  printers.DRIVER <> '' order by hardware.DEVICEID, printers.NAME, printers.PORT, printers.DRIVER";
    $result_ports = $DBocs->query($query_ports) or die($DBocs->error());
    if ($DBocs->numrows($result_ports) > 0) {
        // Récupère les UC dans GLPI
        $query_UC = "select distinct glpi_id, ocs_id from glpi_ocs_link order by glpi_id";
        $result_UC = $DB->query($query_UC) or die($DB->error());
        if ($DB->numrows($result_UC) > 0) {
            while ($data = $DB->fetch_array($result_UC)) {
                $UC_OCSIDS[$data["ocs_id"]] = array('glpi_id' => $data["glpi_id"], 'UC_Name' => '', 'driver' => '');
            }
        }
        unset($result_UC);
        // Recherche les UC liés à une imprimante dans OCS
        $query_UC = "select distinct hardware.NAME as UC_Name, hardware.ID as ocs_id from hardware " . "inner join printers on printers.HARDWARE_ID = hardware.ID order by hardware.DEVICEID, hardware.NAME";
        $result_UC = $DBocs->query($query_UC) or die($DBocs->error());
        if ($DBocs->numrows($result_UC) > 0) {
            while ($data = $DBocs->fetch_array($result_UC)) {
                if (array_key_exists($data["ocs_id"], $UC_OCSIDS)) {
                    $UC_OCSIDS[$data["ocs_id"]]['UC_Name'] = strtoupper($data["UC_Name"]);
                }
            }
        }
        unset($result_UC);
        // Suppression des UC sans imprimante
        // création d'une table des UC avec nom pour clé
        foreach ($UC_OCSIDS as $ocs_id => &$item) {
            if ($item['UC_Name'] === '') {
                unset($UC_OCSIDS[$ocs_id]);
            } else {
                $UC_NAMES[$item['UC_Name']] = array('glpi_id' => $item["glpi_id"], 'ocs_id' => $ocs_id);
            }
        }
        unset($UC_OCSIDS);
        // Création des imprimantes
        while ($data = $DBocs->fetch_array($result_ports)) {
            glpiuInsertPrinter($data["PORT"], $data["NAME"], $data["UC_Name"], $data["DRIVER"]);
        }
        unset($result_ports);
        unset($UC_NAMES);
        // Si en mode action, suppression des imprimantes
        /*if ($mode == 1 && count($PRINTERSLIST) > 0)
        		{
        		processObjects(PRINTER_TYPE, DELETE_ACTION);
        		}*/
        // Récupère les imprimantes dans GLPI
        $printer_names = array();
        if (count($PRINTERSLIST) > 0) {
            $query_PRN = "select distinct ID, name from glpi_printers where deleted='0' ";
            $result_PRN = $DB->query($query_PRN) or die($DB->error());
            if ($DB->numrows($result_PRN) > 0) {
                while ($data = $DB->fetch_array($result_PRN)) {
                    $printer_names[$data["name"]] = $data["ID"];
                }
            }
        }
        // Complétion des imprimantes et suppression de celles à ne pas importer
        $numrows = 0;
        foreach ($PRINTERSLIST as $prn_no => &$printer) {
            if ($printer->portType <= PORT_TYPE_USB) {
                $printer->getName();
                if ($printer->server != '' && !isset($printer_names[$printer->name])) {
                    $numrows++;
                } else {
                    unset($PRINTERSLIST[$prn_no]);
                }
            } else {
                unset($PRINTERSLIST[$prn_no]);
            }
        }
        unset($printer_names);
        // Importation
        if ($mode == 1 && isset($_POST['toimport'])) {
            foreach ($_POST['toimport'] as $prn_no => $val) {
                if ($val == "on") {
                    $PRINTERSLIST[$prn_no]->addToDB();
                    unset($PRINTERSLIST[$prn_no]);
                    $numrows--;
                }
            }
        }
        unset($_POST['toimport']);
        // Affichage
        echo "<div align='center'>";
        if ($numrows) {
            $readOnly = !haveRight("ocsng", "w");
            $parameters = "objectType=" . PRINTER_TYPE . "&amp;actionId=" . IMPORT_PRINTERS_ACTION;
            printPager($start, $numrows, $_SERVER["PHP_SELF"], $parameters);
            // delete end
            array_splice($PRINTERSLIST, $start + $_SESSION["glpilist_limit"]);
            // delete begin
            if ($start > 0) {
                array_splice($PRINTERSLIST, 0, $start);
            }
            echo "<form method='post' name='printer_form' id='printer_form' action='" . $_SERVER["PHP_SELF"] . "'>";
            echo "<a href='" . $_SERVER["PHP_SELF"] . "' onclick= \"if ( markAllRows('printer_form') ) return false;\">" . $LANG["buttons"][18] . "</a>&nbsp;/&nbsp;<a href='" . $_SERVER["PHP_SELF"] . "' onclick= \"if ( unMarkAllRows('printer_form') ) return false;\">" . $LANG["buttons"][19] . "</a>";
            echo "<input type='hidden' name='objectType' value='" . PRINTER_TYPE . "'>";
            echo "<input type='hidden' name='actionId' value='" . IMPORT_PRINTERS_ACTION . "'>";
            echo "<table class='tab_cadre'>";
            if (!$readOnly) {
                echo "<tr class='tab_bg_1'><th colspan=8><input class='submit' type='submit' name='do_action' value='" . $LANG["buttons"][37] . "'></th></tr>" . chr(10);
            }
            echo '<tr><th></th><th>Type</th><th>IP</th><th>Nom</th><th width="150px">Port</th><th>Serveurs</th><th>Files d\'impression</th><th>Erreurs</th></tr>' . chr(10);
            foreach ($PRINTERSLIST as &$printer) {
                $printer->display();
            }
            if (!$readOnly) {
                echo "<tr class='tab_bg_1'><th colspan=8><input  class='submit' type='submit' name='do_action' value='" . $LANG["buttons"][37] . "'></th></tr>" . chr(10);
            }
            echo "</table>";
            //echo '<br>'.$numrows.'<br>';
            echo "</form>";
            printPager($start, $numrows, $_SERVER["PHP_SELF"], $parameters);
        } else {
            echo "<strong>" . $LANG["ocsng"][9] . "<br>";
            echo "<a href='../index.php'>" . $LANG["buttons"][13] . "</a></strong>";
        }
        echo "</div>";
    }
    return $numrows;
}