/** * Display content of Tab * * @param $ID of the item * @param $tab number of the tab * * @return true if handled (for class stack) */ function showTabContent($ID, $tab) { global $CFG_GLPI; if (!$this->isNewID($ID)) { switch ($tab) { case -1: // All $this->showChildren($ID); EntityData::showStandardOptions($this); Profile_User::showForEntity($this); $collection = new RuleRightCollection(); if ($collection->canList()) { $ldaprule = new RuleRight(); $ldaprule->showAndAddRuleForm($this); } $collection = new RuleOcsCollection(); if ($collection->canList()) { $ocsrule = new RuleOcs(); $ocsrule->showAndAddRuleForm($this); } $collection = new RuleMailCollectorCollection(); if ($collection->canList()) { $mailcollector = new RuleMailCollector(); $mailcollector->showAndAddRuleForm($this); } Document::showAssociated($this); EntityData::showNotificationOptions($this); EntityData::showHelpdeskOptions($this); EntityData::showInventoryOptions($this); Plugin::displayAction($this, $tab); break; case 2: EntityData::showStandardOptions($this); break; case 3: Profile_User::showForEntity($this); break; case 4: $collection = new RuleRightCollection(); if ($collection->canList()) { $ldaprule = new RuleRight(); $ldaprule->showAndAddRuleForm($this); } $collection = new RuleOcsCollection(); if ($collection->canList()) { $ocsrule = new RuleOcs(); $ocsrule->showAndAddRuleForm($this); } $collection = new RuleMailCollectorCollection(); if ($collection->canList()) { $mailcollector = new RuleMailCollector(); $mailcollector->showAndAddRuleForm($this); } break; case 5: EntityData::showAdvancedOptions($this); break; case 6: Document::showAssociated($this); break; case 7: EntityData::showNotificationOptions($this); break; case 8: EntityData::showHelpdeskOptions($this); break; case 9: EntityData::showInventoryOptions($this); break; case 10: showNotesForm(getItemTypeFormURL('EntityData'), 'EntityData', $_POST["id"]); break; default: if (!Plugin::displayAction($this, $tab)) { $this->showChildren($ID); } return false; } } return false; }
/** * Do automatic transfer if option is enable * * @param $line_links array : data from glpi_ocslinks table * @param $line_ocs array : data from ocs tables * * @return nothing **/ static function transferComputer($line_links, $line_ocs) { global $DB, $DBocs, $CFG_GLPI; // Get all rules for the current ocsservers_id $rules = new RuleOcsCollection($line_links["ocsservers_id"]); $data = array(); $data = $rules->processAllRules(array(), array(), $line_links["ocsid"]); // If entity is changing move items to the new entities_id if (isset($data['entities_id']) && $data['entities_id'] != $line_links['entities_id']) { if (!isCommandLine() && !haveAccessToEntity($data['entities_id'])) { displayRightError(); } $transfer = new Transfer(); $transfer->getFromDB($CFG_GLPI['transfers_id_auto']); $item_to_transfer = array("Computer" => array($line_links['computers_id'] => $line_links['computers_id'])); $transfer->moveItems($item_to_transfer, $data['entities_id'], $transfer->fields); } // Update TAG self::updateTag($line_links, $line_ocs); }