$_SESSION['glpi_massiveaction']['items'][$key] = $key; } } $_SESSION['glpi_massiveaction']['item_count'] = count($_SESSION['glpi_massiveaction']['items']); glpi_header($_SERVER['PHP_SELF'] . '?multiple_actions=1'); } else { if (count($_SESSION['glpi_massiveaction']['items']) > 0) { $key = array_pop($_SESSION['glpi_massiveaction']['items']); //Try to get the OCS server whose machine belongs $query = "SELECT `ocsservers_id`, `id`\n FROM `glpi_ocslinks`\n WHERE `computers_id` = '{$key}'"; $result = $DB->query($query); if ($DB->numrows($result) == 1) { $data = $DB->fetch_assoc($result); if ($data['ocsservers_id'] != -1) { //Force update of the machine OcsServer::updateComputer($data['id'], $data['ocsservers_id'], 1, 1); } } glpi_header($_SERVER['PHP_SELF'] . '?multiple_actions=1'); } else { $REDIRECT = $_SESSION['glpi_massiveaction']['REDIRECT']; unset($_SESSION['glpi_massiveaction']); glpi_header($REDIRECT); } } break; case "compute_software_category": $softcatrule = new RuleSoftwareCategoryCollection(); $soft = new Software(); foreach ($_POST["item"] as $key => $val) { if ($val == 1) {
function synchroOCS($p_xml) { global $DB; $ptais = new PluginFusioninventoryAgentsInventoryState(); $this->setXML($p_xml); $query = "SELECT *\n\t\tFROM glpi_ocs_link\n\t\tWHERE ocs_deviceid='" . $this->sxml->DEVICEID . "'"; $result = $DB->query($query); if ($DB->numrows($result) == 1) { $line = $DB->fetch_assoc($result); $ptais->changeStatus($line['glpi_id'], 5); OcsServer::updateComputer($line['ID'], $line['ocs_server_id'], 1); $ptais->changeStatus($line['glpi_id'], 6); } }
-------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- define('GLPI_ROOT', '..'); include GLPI_ROOT . "/inc/includes.php"; checkRight("ocsng", "w"); commonHeader($LANG['ocsng'][0], $_SERVER['PHP_SELF'], "utils", "ocsng", "sync"); $display_list = true; if (isset($_SESSION["ocs_update"]['computers'])) { if ($count = count($_SESSION["ocs_update"]['computers'])) { $percent = min(100, round(100 * ($_SESSION["ocs_update_count"] - $count) / $_SESSION["ocs_update_count"], 0)); $key = array_pop($_SESSION["ocs_update"]['computers']); $action = OcsServer::updateComputer($key, $_SESSION["ocsservers_id"], 2); OcsServer::manageImportStatistics($_SESSION["ocs_update"]['statistics'], $action['status']); OcsServer::showStatistics($_SESSION["ocs_update"]['statistics']); displayProgressBar(400, $percent); glpi_header($_SERVER['PHP_SELF']); } else { OcsServer::showStatistics($_SESSION["ocs_update"]['statistics'], true); unset($_SESSION["ocs_update"]); $display_list = false; echo "<div class='center b'><br>"; echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a></div>"; } } if (!isset($_POST["update_ok"])) { if (!isset($_GET['check'])) { $_GET['check'] = 'all';
} else { if (isset($_POST["unlock_field"])) { $computer->check($_POST['id'], 'w'); if (isset($_POST["lockfield"]) && count($_POST["lockfield"])) { foreach ($_POST["lockfield"] as $key => $val) { OcsServer::deleteInOcsArray($_POST["id"], $key, "computer_update"); } } glpi_header($_SERVER['HTTP_REFERER']); } else { if (isset($_POST["force_ocs_resynch"])) { $computer->check($_POST['id'], 'w'); //Get the ocs server id associated with the machine $ocsservers_id = OcsServer::getByMachineID($_POST["id"]); //Update the computer OcsServer::updateComputer($_POST["resynch_id"], $ocsservers_id, 1, 1); glpi_header($_SERVER['HTTP_REFERER']); } else { //print computer informations commonHeader($LANG['Menu'][0], $_SERVER['PHP_SELF'], "inventory", "computer"); //show computer form to add $computer->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"])); commonFooter(); } } } } } } } }