/** * @test */ public function addTimeslot() { $pfTimeslot = new PluginFusioninventoryTimeslot(); $input = array('entities_id' => 0, 'is_recursive' => 0, 'name' => 'unitdefault'); $pfTimeslot->add($input); $cnt = countElementsInTable('glpi_plugin_fusioninventory_timeslots'); $this->assertEquals(1, $cnt, "Timeslot may be added"); $GLPIlog = new GLPIlogs(); $GLPIlog->testSQLlogs(); $GLPIlog->testPHPlogs(); }
@link http://www.fusioninventory.org/ @link http://forge.fusioninventory.org/projects/fusioninventory-for-glpi/ @since 2014 ------------------------------------------------------------------------ */ include "../../../inc/includes.php"; Session::checkRight('plugin_fusioninventory_task', READ); if (!isset($_GET["id"])) { $_GET["id"] = ""; } $pfTimeslot = new PluginFusioninventoryTimeslot(); //Add a new timeslot if (isset($_POST["add"])) { $pfTimeslot->check(-1, CREATE, $_POST); if ($newID = $pfTimeslot->add($_POST)) { if ($_SESSION['glpibackcreated']) { Html::redirect($pfTimeslot->getFormURL() . "?id=" . $newID); } } Html::back(); // delete a timeslot } else { if (isset($_POST["delete"])) { $pfTimeslot->check($_POST['id'], DELETE); $ok = $pfTimeslot->delete($_POST); $pfTimeslot->redirectToList(); } else { if (isset($_POST["purge"])) { $pfTimeslot->check($_POST['id'], PURGE); $pfTimeslot->delete($_POST, 1);