displayLastAlert() static public method

static public displayLastAlert ( $itemtype, $items_id ) : nothing
$itemtype
$items_id
return nothing
Example #1
0
 public function testAddDelete()
 {
     $alert = new Alert();
     $nb = countElementsInTable($alert->getTable());
     $comp = getItemByTypeName('Computer', '_test_pc01');
     $date = '2016-09-01 12:34:56';
     // Add
     $id = $alert->add(['itemtype' => $comp->getType(), 'items_id' => $comp->getID(), 'type' => Alert::END, 'date' => $date]);
     $this->assertGreaterThan(0, $id);
     $this->assertGreaterThan($nb, countElementsInTable($alert->getTable()));
     // Getters
     $this->assertFalse(Alert::alertExists($comp->getType(), $comp->getID(), Alert::NOTICE));
     $this->assertEquals($id, Alert::alertExists($comp->getType(), $comp->getID(), Alert::END));
     $this->assertEquals($date, Alert::getAlertDate($comp->getType(), $comp->getID(), Alert::END));
     // Display
     $this->expectOutputString(sprintf('Alert sent on %s', Html::convDateTime($date)));
     Alert::displayLastAlert($comp->getType(), $comp->getID());
     // Delete
     $this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
     $this->assertEquals($nb, countElementsInTable($alert->getTable()));
     // Still true, nothing to delete but no error
     $this->assertTrue($alert->clear($comp->getType(), $comp->getID(), Alert::END));
 }
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     // Restore saved value or override with page parameter
     if (!isset($options['template_preview'])) {
         if (isset($_REQUEST)) {
             $saved = Html::cleanPostForTextArea($_REQUEST);
         }
     }
     foreach ($this->fields as $name => $value) {
         if (isset($saved[$name]) && empty($this->fields[$name])) {
             $this->fields[$name] = $saved[$name];
         }
     }
     echo "<input type='hidden' name='withtemplate' value='" . $options['withtemplate'] . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
         echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     } else {
         Dropdown::show('Software', array('condition' => "`is_template`='0' AND `is_deleted`='0'", 'entity' => $_SESSION['glpiactive_entity'], 'entity_sons' => $_SESSION['glpiactive_entity_recursive'], 'on_change' => 'this.form.submit()', 'value' => $softwares_id));
     }
     echo "</td>";
     echo "<td colspan='2'>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Name'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "") . "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["name"], "name", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'name', array('value' => $objectName));
     echo "</td>";
     echo "<td>" . __('Status') . "</td>";
     echo "<td>";
     State::dropdown(array('value' => $this->fields["states_id"], 'entity' => $this->fields["entities_id"], 'condition' => "`is_visible_softwarelicense`"));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Location') . "</td><td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td>" . __('Publisher') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td >" . __('User') . "</td>";
     echo "<td >";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . sprintf(__('%1$s%2$s'), __('Inventory number'), isset($options['withtemplate']) && $options['withtemplate'] ? "*" : "");
     echo "</td>";
     echo "<td>";
     $objectName = autoName($this->fields["otherserial"], "otherserial", isset($options['withtemplate']) && $options['withtemplate'] == 2, $this->getType(), $this->fields["entities_id"]);
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td><td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='4'>";
     echo "<textarea cols='45' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdownForOneSoftware(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number", array('value' => $this->fields["number"], 'min' => 1, 'max' => 10000, 'step' => 1, 'toadd' => array(-1 => __('Unlimited'))));
     if ($ID > 0) {
         echo "&nbsp;";
         if ($this->fields['is_valid']) {
             echo "<span class='green'>" . _x('adjective', 'Valid') . '<span>';
         } else {
             echo "<span class='red'>" . _x('adjective', 'Invalid') . '<span>';
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateField('expire', array('value' => $this->fields["expire"]));
     if ($ID && is_null($this->fields["expire"])) {
         echo "<br>" . __('Never expire') . "&nbsp;";
         Html::showToolTip(__('On search engine, use "Expiration contains NULL" to search licenses with no expiration date'));
     }
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td><td colspan='2'></td></tr>\n";
     $this->showFormButtons($options);
     return true;
 }
Example #3
0
 /**
  * Show Infocom form for an item (not a standard showForm)
  *
  * @param $item                  CommonDBTM object
  * @param $withtemplate integer  template or basic item (default '')
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $CFG_GLPI;
     // Show Infocom or blank form
     if (!Session::haveRight("infocom", "r")) {
         return false;
     }
     if (!$item) {
         echo "<div class='spaced'>" . __('Requested item not found') . "</div>";
     } else {
         $date_tax = $CFG_GLPI["date_tax"];
         $dev_ID = $item->getField('id');
         $ic = new self();
         $option = "";
         if ($withtemplate == 2) {
             $option = " readonly ";
         }
         if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
             echo "<div class='firstbloc center'>" . __('For this type of item, the financial and administrative information are only a model for the items which you should add.') . "</div>";
         }
         if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
             $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
             if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
                 echo "<div class='spaced b'>";
                 echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
                 echo sprintf(__('%1$s - %2$s'), $item->getTypeName(1), $item->getName()) . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/infocom.form.php", 'add', __('Enable the financial and administrative information'), array('itemtype' => $item->getType(), 'items_id' => $dev_ID));
                 echo "</td></tr></table></div>";
             }
         } else {
             // getFromDBforDevice
             $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
             if ($canedit) {
                 echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
             }
             echo "<div class='spaced'>";
             echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
             echo "<tr><th colspan='4'>" . __('Financial and administrative information') . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Supplier') . "</td>";
             echo "<td>";
             if ($withtemplate == 2) {
                 echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
             } else {
                 Supplier::dropdown(array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
             }
             echo "</td>";
             if (Session::haveRight("budget", "r")) {
                 echo "<td>" . __('Budget') . "</td><td >";
                 Budget::dropdown(array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             // Can edit calendar ?
             $editcalendar = $withtemplate != 2;
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Order number') . "</td>";
             echo "<td >";
             Html::autocompletionTextField($ic, "order_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Order date') . "</td><td>";
             Html::showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             $istemplate = '';
             if ($item->isTemplate() || in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
                 $istemplate = '*';
             }
             echo "<td>" . sprintf(__('%1$s%2$s'), __('Immobilization number'), $istemplate) . "</td>";
             echo "<td>";
             $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
             Html::autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
             echo "</td>";
             echo "<td>" . __('Date of purchase') . "</td><td>";
             Html::showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Invoice number') . "</td>";
             echo "<td>";
             Html::autocompletionTextField($ic, "bill", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Delivery date') . "</td><td>";
             Html::showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Delivery form') . "</td><td>";
             Html::autocompletionTextField($ic, "delivery_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . __('Startup date') . "</td><td>";
             Html::showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Value') . "</td>";
             echo "<td><input type='text' name='value' {$option} value='" . Html::formatNumber($ic->fields["value"], true) . "' size='14'></td>";
             echo "</td>";
             echo "<td>" . __('Date of last physical inventory') . "</td><td>";
             Html::showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Warranty extension value') . "</td>";
             echo "<td><input type='text' {$option} name='warranty_value' value='" . Html::formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>";
             echo "<td rowspan='5'>" . __('Comments') . "</td>";
             echo "<td rowspan='5' class='middle'>";
             echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"];
             echo "</textarea></td></tr>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Account net value') . "</td><td>";
             echo Html::formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n"));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization type') . "</td><td >";
             if ($withtemplate == 2) {
                 echo self::getAmortTypeName($ic->fields["sink_type"]);
             } else {
                 self::dropdownAmortType("sink_type", $ic->fields["sink_type"]);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization duration') . "</td><td>";
             if ($withtemplate == 2) {
                 printf(_n('%d year', '%d years', $ic->fields["sink_time"]), $ic->fields["sink_time"]);
             } else {
                 Dropdown::showNumber("sink_time", array('value' => $ic->fields["sink_time"], 'max' => 15, 'unit' => 'year'));
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Amortization coefficient') . "</td>";
             echo "<td>";
             Html::autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . __('TCO (value + tracking cost)') . "</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . __('Monthly TCO') . "</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             echo "<tr><th colspan='4'>" . __('Warranty information') . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Start date of warranty') . "</td><td>";
             Html::showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar);
             echo "</td>";
             echo "<td>" . __('Warranty duration') . "</td><td>";
             if ($withtemplate == 2) {
                 // -1 = life
                 if ($ic->fields["warranty_duration"] == -1) {
                     _e('Lifelong');
                 } else {
                     printf(_n('%d month', '%d months', $ic->fields["warranty_duration"]), $ic->fields["warranty_duration"]);
                 }
             } else {
                 Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => __('Lifelong')), array('unit' => 'month'));
             }
             $tmpdat = self::getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"], 0, true);
             if ($tmpdat) {
                 echo "<span class='small_space'>" . sprintf(__('Valid to %s'), $tmpdat) . "</span>";
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . __('Warranty information') . "</td>";
             echo "<td >";
             Html::autocompletionTextField($ic, "warranty_info", array('option' => $option));
             echo "</td>";
             if ($CFG_GLPI['use_mailing']) {
                 echo "<td>" . __('Alarms on financial and administrative information') . "</td>";
                 echo "<td>";
                 self::dropdownAlert(array('name' => "alert", 'value' => $ic->fields["alert"]));
                 Alert::displayLastAlert('Infocom', $ic->fields['id']);
                 echo "</td>";
             } else {
                 echo "</td><td colspan='2'>";
             }
             echo "</td></tr>";
             if ($canedit) {
                 echo "<tr>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>";
                 echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n                      class='submit'>";
                 echo "</td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' name='delete' value=\"" . _sx('button', 'Delete permanently') . "\"\n                      class='submit'>";
                 echo "</td></tr>";
                 echo "</table></div>";
                 Html::closeForm();
             } else {
                 echo "</table></div>";
             }
         }
     }
 }
Example #4
0
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td>";
     echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showNumber("number", array('value' => $this->fields["number"], 'min' => 1, 'max' => 10000, 'step' => 1, 'toadd' => array(-1 => __('Unlimited'))));
     if ($ID > 0) {
         echo "&nbsp;";
         if ($this->fields['is_valid']) {
             echo "<span class='green'>" . _x('adjective', 'Valid') . '<span>';
         } else {
             echo "<span class='red'>" . _x('adjective', 'Invalid') . '<span>';
         }
     }
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateField('expire', array('value' => $this->fields["expire"]));
     if ($ID && is_null($this->fields["expire"])) {
         echo "<br>" . __('Never expire') . "&nbsp;";
         Html::showToolTip(__('On search engine, use "Expiration contains NULL" to search licenses with no expiration date'));
     }
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td></tr>\n";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     return true;
 }
Example #5
0
 /**
  * Print the Software / license form
  *
  * @param $ID        integer  Id of the version or the template to print
  * @param $options   array    of possible options:
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if (!Session::haveRight("software", "w")) {
         return false;
     }
     if ($ID < 0) {
         // Create item
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
         $soft = new Software();
         if ($soft->getFromDB($softwares_id) && in_array($_SESSION['glpiactive_entity'], getAncestorsOf('glpi_entities', $soft->getEntityID()))) {
             $options['entities_id'] = $soft->getEntityID();
         }
     }
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . Software::getTypeName(1) . "</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     SoftwareLicenseType::dropdown(array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Serial number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Purchase version') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td>";
     echo "<td>" . __('Inventory number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version in use') . "</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td>";
     echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('quantity', 'Number') . "</td>";
     echo "<td>";
     Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => __('Unlimited')));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Expiration') . "</td>";
     echo "<td>";
     Html::showDateFormItem('expire', $this->fields["expire"]);
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td></tr>\n";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Last update') . "</td>";
         echo "<td>" . ($this->fields["date_mod"] ? Html::convDateTime($this->fields["date_mod"]) : __('Never'));
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Example #6
0
 /**
  * Print the contract form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     $this->initForm($ID, $options);
     $can_edit = $this->can($ID, 'w');
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td><td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Contract type') . "</td><td >";
     ContractType::dropdown(array('value' => $this->fields["contracttypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . _x('phone', 'Number') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "num");
     echo "</td>";
     echo "<td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Start date') . "</td>";
     echo "<td>";
     Html::showDateFormItem("begin_date", $this->fields["begin_date"]);
     echo "</td>";
     echo "<td>" . __('Initial contract period') . "</td><td>";
     Dropdown::showInteger("duration", $this->fields["duration"], 1, 120, 1, array(0 => Dropdown::EMPTY_VALUE), array('unit' => 'month'));
     if (!empty($this->fields["begin_date"])) {
         echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], 0, true);
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Notice') . "</td><td>";
     Dropdown::showInteger("notice", $this->fields["notice"], 0, 120, 1, array(), array('unit' => 'month'));
     if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) {
         echo " -> " . Infocom::getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"], true);
     }
     echo "</td>";
     echo "<td>" . __('Account number') . "</td><td>";
     Html::autocompletionTextField($this, "accounting_number");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Contract renewal period') . "</td><td>";
     Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month'));
     echo "</td>";
     echo "<td>" . __('Invoice period') . "</td>";
     echo "<td>";
     Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => Dropdown::EMPTY_VALUE, 1 => sprintf(_n('%d month', '%d months', 1), 1), 2 => sprintf(_n('%d month', '%d months', 2), 2), 3 => sprintf(_n('%d month', '%d months', 3), 3), 6 => sprintf(_n('%d month', '%d months', 6), 6)), array('unit' => 'month'));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td>" . __('Renewal') . "</td><td>";
     self::dropdownContractRenewal("renewal", $this->fields["renewal"]);
     echo "</td>";
     echo "<td>" . __('Max number of items') . "</td><td>";
     Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => __('Unlimited')));
     echo "</td>";
     echo "</tr>";
     if (Entity::getUsedConfig("use_contracts_alert", $this->fields["entities_id"])) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Email alarms') . "</td>";
         echo "<td>";
         self::dropdownAlert(array('name' => "alert", 'value' => $this->fields["alert"]));
         Alert::displayLastAlert(__CLASS__, $ID);
         echo "</td>";
         echo "<td colspan='2'>&nbsp;</td>";
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'><td class='top'>" . __('Comments') . "</td>";
     echo "<td class='center' colspan='3'>";
     echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . __('Support hours') . "</td>";
     echo "<td colspan='3'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('on week') . "</td>";
     echo "<td colspan='3'>" . __('Start') . "&nbsp;";
     Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]);
     echo "<span class='small_space'>" . __('End') . "</span>&nbsp;";
     Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('on Saturday') . "</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]);
     echo "<span class='small_space'>" . __('Start') . "</span>&nbsp;";
     Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]);
     echo "<span class='small_space'>" . __('End') . "</span>&nbsp;";
     Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Sundays and holidays') . "</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_monday", $this->fields["use_monday"]);
     echo "<span class='small_space'>" . __('Start') . "</span>&nbsp;";
     Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]);
     echo "<span class='small_space'>" . __('End') . "</span>&nbsp;";
     Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Example #7
0
 /**
  * Display for reservation
  *
  * @param $ID              ID of the reservation (empty for create new)
  * @param $options   array of possibles options:
  *     - item  reservation items ID for creation process
  *     - date date for creation process
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     if (!Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
         return false;
     }
     $resa = new self();
     if (!empty($ID)) {
         if (!$resa->getFromDB($ID)) {
             return false;
         }
         if (!$resa->can($ID, UPDATE)) {
             return false;
         }
         // Set item if not set
         if ((!isset($options['item']) || count($options['item']) == 0) && ($itemid = $resa->getField('reservationitems_id'))) {
             $options['item'][$itemid] = $itemid;
         }
     } else {
         $resa->getEmpty();
         $resa->fields["begin"] = $options['begin'];
         if (!isset($options['end'])) {
             $resa->fields["end"] = date("Y-m-d H:00:00", strtotime($resa->fields["begin"]) + HOUR_TIMESTAMP);
         } else {
             $resa->fields["end"] = $options['end'];
         }
     }
     // No item : problem
     if (!isset($options['item']) || count($options['item']) == 0) {
         return false;
     }
     echo "<div class='center'><form method='post' name=form action='reservation.form.php'>";
     if (!empty($ID)) {
         echo "<input type='hidden' name='id' value='{$ID}'>";
     }
     echo "<table class='tab_cadre' width='700px'>";
     echo "<tr><th colspan='2'>" . __('Reserve an item') . "</th></tr>\n";
     // Add Hardware name
     $r = new ReservationItem();
     echo "<tr class='tab_bg_1'><td>" . __('Item') . "</td>";
     echo "<td>";
     foreach ($options['item'] as $itemID) {
         $r->getFromDB($itemID);
         $type = $r->fields["itemtype"];
         $name = NOT_AVAILABLE;
         $item = NULL;
         if ($item = getItemForItemtype($r->fields["itemtype"])) {
             $type = $item->getTypeName();
             if ($item->getFromDB($r->fields["items_id"])) {
                 $name = $item->getName();
             } else {
                 $item = NULL;
             }
         }
         echo "<span class='b'>" . sprintf(__('%1$s - %2$s'), $type, $name) . "</span><br>";
         echo "<input type='hidden' name='items[{$itemID}]' value='{$itemID}'>";
     }
     echo "</td></tr>\n";
     if (!Session::haveRight("reservation", UPDATE) || is_null($item) || !Session::haveAccessToEntity($item->fields["entities_id"])) {
         echo "<input type='hidden' name='users_id' value='" . Session::getLoginUserID() . "'>";
     } else {
         echo "<tr class='tab_bg_2'><td>" . __('By') . "</td>";
         echo "<td>";
         if (empty($ID)) {
             User::dropdown(array('value' => Session::getLoginUserID(), 'entity' => $item->getEntityID(), 'right' => 'all'));
         } else {
             User::dropdown(array('value' => $resa->fields["users_id"], 'entity' => $item->getEntityID(), 'right' => 'all'));
         }
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_2'><td>" . __('Start date') . "</td><td>";
     $rand_begin = Html::showDateTimeField("resa[begin]", array('value' => $resa->fields["begin"], 'timestep' => -1, 'maybeempty' => false));
     echo "</td></tr>\n";
     $default_delay = floor((strtotime($resa->fields["end"]) - strtotime($resa->fields["begin"])) / $CFG_GLPI['time_step'] / MINUTE_TIMESTAMP) * $CFG_GLPI['time_step'] * MINUTE_TIMESTAMP;
     echo "<tr class='tab_bg_2'><td>" . __('Duration') . "</td><td>";
     $rand = Dropdown::showTimeStamp("resa[_duration]", array('min' => 0, 'max' => 24 * HOUR_TIMESTAMP, 'value' => $default_delay, 'emptylabel' => __('Specify an end date')));
     echo "<br><div id='date_end{$rand}'></div>";
     $params = array('duration' => '__VALUE__', 'end' => $resa->fields["end"], 'name' => "resa[end]");
     Ajax::updateItemOnSelectEvent("dropdown_resa[_duration]{$rand}", "date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
     if ($default_delay == 0) {
         $params['duration'] = 0;
         Ajax::updateItem("date_end{$rand}", $CFG_GLPI["root_doc"] . "/ajax/planningend.php", $params);
     }
     Alert::displayLastAlert('Reservation', $ID);
     echo "</td></tr>\n";
     if (empty($ID)) {
         echo "<tr class='tab_bg_2'><td>" . __('Rehearsal') . "</td>";
         echo "<td>";
         $values = array('' => _x('periodicity', 'None'), 'day' => _x('periodicity', 'Daily'), 'week' => _x('periodicity', 'Weekly'), 'month' => _x('periodicity', 'Monthly'));
         $rand = Dropdown::showFromArray('periodicity[type]', $values);
         $field_id = Html::cleanId("dropdown_periodicity[type]{$rand}");
         $params = array('type' => '__VALUE__', 'end' => $resa->fields["end"]);
         Ajax::updateItemOnSelectEvent($field_id, "resaperiodcontent{$rand}", $CFG_GLPI["root_doc"] . "/ajax/resaperiod.php", $params);
         echo "<br><div id='resaperiodcontent{$rand}'></div>";
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_2'><td>" . __('Comments') . "</td>";
     echo "<td><textarea name='comment' rows='8' cols='60'>" . $resa->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     if (empty($ID)) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='2' class='top center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>\n";
     } else {
         if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRightsOr(static::$rightname, array(PURGE, UPDATE))) {
             echo "<tr class='tab_bg_2'>";
             if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRight(static::$rightname, PURGE)) {
                 echo "<td class='top center'>";
                 echo "<input type='submit' name='purge' value=\"" . _sx('button', 'Delete permanently') . "\"\n                      class='submit'>";
                 if ($resa->fields["group"] > 0) {
                     echo "<br><input type='checkbox' name='_delete_group'>&nbsp;" . __s('Delete all rehearsals');
                 }
                 echo "</td>";
             }
             if ($resa->fields["users_id"] == Session::getLoginUserID() || Session::haveRight(static::$rightname, UPDATE)) {
                 echo "<td class='top center'>";
                 echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\"\n                     class='submit'>";
                 echo "</td>";
             }
             echo "</tr>\n";
         }
     }
     echo "</table>";
     Html::closeForm();
     echo "</div>\n";
 }
 /**
  * Print the consumable type form
  *
  * @param $ID        integer ID of the item
  * @param $options   array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  * @return Nothing (display)
  *
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI;
     $this->initForm($ID, $options);
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . "</td>";
     echo "<td>";
     Html::autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . __('Type') . "</td>";
     echo "<td>";
     ConsumableItemType::dropdown(array('value' => $this->fields["consumableitemtypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Reference') . "</td>\n";
     echo "<td>";
     Html::autocompletionTextField($this, "ref");
     echo "</td>";
     echo "<td>" . __('Manufacturer') . "</td>";
     echo "<td>";
     Manufacturer::dropdown(array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Technician in charge of the hardware') . "</td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'own_ticket', 'entity' => $this->fields["entities_id"]));
     echo "</td>";
     echo "<td rowspan='4' class='middle'>" . __('Comments') . "</td>";
     echo "<td class='middle' rowspan='4'>\n             <textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group in charge of the hardware') . "</td>";
     echo "<td>";
     Group::dropdown(array('name' => 'groups_id_tech', 'value' => $this->fields['groups_id_tech'], 'entity' => $this->fields['entities_id'], 'condition' => '`is_assign`'));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Stock location') . "</td>";
     echo "<td>";
     Location::dropdown(array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Alert threshold') . "</td>";
     echo "<td>";
     Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], 0, 100, 1, array('-1' => __('Never')));
     Alert::displayLastAlert('ConsumableItem', $ID);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Print the Software / license form
  *
  * @param $ID Integer : Id of the version or the template to print
  * @param $options array
  *     - target form target
  *     - softwares_id ID of the software for add process
  *
  * @return true if displayed  false if item not found or not right to display
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     $softwares_id = -1;
     if (isset($options['softwares_id'])) {
         $softwares_id = $options['softwares_id'];
     }
     if (!haveRight("software", "w")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
         $this->fields['softwares_id'] = $softwares_id;
         $this->fields['number'] = 1;
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['help'][31] . "&nbsp;:</td>";
     echo "<td>";
     if ($ID > 0) {
         $softwares_id = $this->fields["softwares_id"];
     } else {
         echo "<input type='hidden' name='softwares_id' value='{$softwares_id}'>";
     }
     echo "<a href='software.form.php?id=" . $softwares_id . "'>" . Dropdown::getDropdownName("glpi_softwares", $softwares_id) . "</a>";
     echo "</td>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('SoftwareLicenseType', array('value' => $this->fields["softwarelicensetypes_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['common'][19] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "serial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][1] . "&nbsp;:</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_buy", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_buy"]));
     echo "</td>";
     echo "<td>" . $LANG['common'][20] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "otherserial");
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][2] . "&nbsp;:</td>";
     echo "<td>";
     SoftwareVersion::dropdown(array('name' => "softwareversions_id_use", 'softwares_id' => $this->fields["softwares_id"], 'value' => $this->fields["softwareversions_id_use"]));
     echo "</td>";
     echo "<td rowspan='" . ($ID > 0 ? '4' : '3') . "' class='middle'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center middle' rowspan='" . ($ID > 0 ? '4' : '3') . "'>";
     echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['tracking'][29] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("number", $this->fields["number"], 1, 1000, 1, array(-1 => $LANG['software'][4]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['software'][32] . "&nbsp;:</td>";
     echo "<td>";
     showDateFormItem('expire', $this->fields["expire"]);
     Alert::displayLastAlert('SoftwareLicense', $ID);
     echo "</td></tr>\n";
     if ($ID > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . $LANG['common'][26] . "&nbsp;: </td>";
         echo "<td>" . ($this->fields["date_mod"] ? convDateTime($this->fields["date_mod"]) : $LANG['setup'][307]);
         echo "</td></tr>";
     }
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
 /**
  * Print the cartridge type form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target for the Form
  *     - withtemplate : 1 for newtemplate, 2 for newobject from template
  *
  * @return Nothing (display)
  *
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     // Show CartridgeItem or blank form
     if (!haveRight("cartridge", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td rowspan='7' class='middle right'>" . $LANG['common'][25] . "&nbsp;: </td>";
     echo "<td class='center middle' rowspan='7'>";
     echo "<textarea cols='45' rows='9' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['consumables'][2] . "&nbsp;: </td>";
     echo "<td>";
     autocompletionTextField($this, "ref");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][17] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('CartridgeItemType', array('value' => $this->fields["cartridgeitemtypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][5] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Manufacturer', array('value' => $this->fields["manufacturers_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][10] . "&nbsp;: </td>";
     echo "<td>";
     User::dropdown(array('name' => 'users_id_tech', 'value' => $this->fields["users_id_tech"], 'right' => 'interface', 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['consumables'][36] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::show('Location', array('value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['consumables'][38] . "&nbsp;: </td>";
     echo "<td>";
     Dropdown::showInteger('alarm_threshold', $this->fields["alarm_threshold"], -1, 100);
     Alert::displayLastAlert('CartridgeItem', $ID);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Example #11
0
 /**
  * Show Infocom form for an item (not a standard showForm)
  *
  * @param $item CommonDBTM object
  * @param $withtemplate integer: template or basic item
  **/
 static function showForItem(CommonDBTM $item, $withtemplate = '')
 {
     global $CFG_GLPI, $LANG;
     // Show Infocom or blank form
     if (!haveRight("infocom", "r")) {
         return false;
     }
     if (!$item) {
         echo "<div class='spaced'>" . $LANG['financial'][85] . "</div>";
     } else {
         $date_tax = $CFG_GLPI["date_tax"];
         $dev_ID = $item->getField('id');
         $ic = new self();
         $option = "";
         if ($withtemplate == 2) {
             $option = " readonly ";
         }
         if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
             echo "<div class='firstbloc center'>" . $LANG['financial'][84] . "</div>";
         }
         if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
             $input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
             if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
                 echo "<div class='spaced b'>";
                 echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
                 echo $item->getTypeName() . " - " . $item->getName() . "</th></tr>";
                 echo "<tr class='tab_bg_1'><td class='center'>";
                 echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php?itemtype=" . $item->getType() . "&amp;items_id={$dev_ID}&amp;add=add'>" . $LANG['financial'][68];
                 echo "</a></td></tr></table></div>";
             }
         } else {
             // getFromDBforDevice
             $canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
             if ($canedit) {
                 echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
             }
             echo "<div class='spaced'>";
             echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][3] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][26] . "&nbsp;:</td>";
             echo "<td>";
             if ($withtemplate == 2) {
                 echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
             } else {
                 Dropdown::show('Supplier', array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
             }
             echo "</td>";
             if (haveRight("budget", "r")) {
                 echo "<td>" . $LANG['financial'][87] . "&nbsp;:</td><td >";
                 Dropdown::show('Budget', array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             // Can edit calendar ?
             $editcalendar = $withtemplate != 2;
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][18] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "order_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][28] . "&nbsp;:</td><td>";
             showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][20] . "*&nbsp;:</td>";
             echo "<td>";
             $objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
             autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][14] . "&nbsp;:</td><td>";
             showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][82] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "bill", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][27] . "&nbsp;:</td><td>";
             showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][19] . "&nbsp;:</td><td>";
             autocompletionTextField($ic, "delivery_number", array('option' => $option));
             echo "</td>";
             echo "<td>" . $LANG['financial'][76] . "&nbsp;:</td><td>";
             showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][21] . "&nbsp;:</td>";
             echo "<td><input type='text' name='value' {$option} value='" . formatNumber($ic->fields["value"], true) . "' size='14'></td>";
             echo "</td>";
             echo "<td>" . $LANG['financial'][114] . "&nbsp;:</td><td>";
             showDateFormItem("inventory_date", $ic->fields["inventory_date"], true, $editcalendar);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][78] . "&nbsp;:</td>";
             echo "<td><input type='text' {$option} name='warranty_value' value='" . formatNumber($ic->fields["warranty_value"], true) . "' size='14'></td>";
             echo "<td rowspan='5'>" . $LANG['common'][25] . "&nbsp;:</td>";
             echo "<td rowspan='5' class='middle'>";
             echo "<textarea cols='45' rows='9' name='comment' >" . $ic->fields["comment"];
             echo "</textarea></td></tr>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][81] . "&nbsp;:</td><td>";
             echo formatNumber(self::Amort($ic->fields["sink_type"], $ic->fields["value"], $ic->fields["sink_time"], $ic->fields["sink_coeff"], $ic->fields["warranty_date"], $ic->fields["use_date"], $date_tax, "n"));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][22] . "&nbsp;:</td><td >";
             if ($withtemplate == 2) {
                 echo self::getAmortTypeName($ic->fields["sink_type"]);
             } else {
                 self::dropdownAmortType("sink_type", $ic->fields["sink_type"]);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][23] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 echo $ic->fields["sink_time"];
             } else {
                 Dropdown::showInteger("sink_time", $ic->fields["sink_time"], 0, 15);
             }
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][77] . "&nbsp;:</td>";
             echo "<td>";
             autocompletionTextField($ic, "sink_coeff", array('size' => 14, 'option' => $option));
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][89] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td>";
             if (!in_array($item->getType(), array('Cartridge', 'CartridgeItem', 'Consumable', 'ConsumableItem', 'Software', 'SoftwareLicense'))) {
                 echo "<td>" . $LANG['financial'][90] . "&nbsp;:</td><td>";
                 echo self::showTco($item->getField('ticket_tco'), $ic->fields["value"], $ic->fields["warranty_date"]);
             } else {
                 echo "<td colspan='2'>";
             }
             echo "</td></tr>";
             echo "<tr><th colspan='4'>" . $LANG['financial'][7] . "</th></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][29] . "&nbsp;:</td><td>";
             showDateFormItem("warranty_date", $ic->fields["warranty_date"], true, $editcalendar);
             echo "</td>";
             echo "<td>" . $LANG['financial'][15] . "&nbsp;:</td><td>";
             if ($withtemplate == 2) {
                 // -1 = life
                 if ($ic->fields["warranty_duration"] == -1) {
                     echo $LANG['financial'][2];
                 } else {
                     echo $ic->fields["warranty_duration"];
                 }
             } else {
                 Dropdown::showInteger("warranty_duration", $ic->fields["warranty_duration"], 0, 120, 1, array(-1 => $LANG['financial'][2]));
             }
             if ($ic->fields["warranty_duration"] >= 0) {
                 echo " " . $LANG['financial'][57];
             }
             echo "<span class='small_space'>" . $LANG['financial'][88] . "</span>&nbsp;";
             echo getWarrantyExpir($ic->fields["warranty_date"], $ic->fields["warranty_duration"]);
             echo "</td></tr>";
             echo "<tr class='tab_bg_1'>";
             echo "<td>" . $LANG['financial'][16] . "&nbsp;:</td>";
             echo "<td >";
             autocompletionTextField($ic, "warranty_info", array('option' => $option));
             echo "</td>";
             if ($CFG_GLPI['use_mailing']) {
                 echo "<td>" . $LANG['setup'][247] . "&nbsp;:</td>";
                 echo "<td>";
                 echo self::dropdownAlert("alert", $ic->fields["alert"]);
                 Alert::displayLastAlert('Infocom', $ic->fields['id']);
                 echo "</td>";
             } else {
                 echo "</td><td colspan='2'>";
             }
             echo "</td></tr>";
             if ($canedit) {
                 echo "<tr>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='hidden' name='id' value='" . $ic->fields['id'] . "'>";
                 echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\"\n                      class='submit'>";
                 echo "</td>";
                 echo "<td class='tab_bg_2 center' colspan='2'>";
                 echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\"\n                      class='submit'>";
                 echo "</td></tr>";
                 echo "</table></div></form>";
             } else {
                 echo "</table></div>";
             }
         }
     }
 }
 /**
  * Display for reservation
  *
  * @param $ID ID of the reservation (empty for create new)
  * @param $options array
  *     - item  reservation items ID for creation process
  *     - date date for creation process
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     if (!haveRight("reservation_helpdesk", "1")) {
         return false;
     }
     $resa = new Reservation();
     if (!empty($ID)) {
         if (!$resa->getFromDB($ID)) {
             return false;
         }
         if (!$resa->can($ID, "w")) {
             return false;
         }
         // Set item if not set
         if ((!isset($options['item']) || count($options['item']) == 0) && ($itemid = $resa->getField('reservationitems_id'))) {
             $options['item'][$itemid] = $itemid;
         }
     } else {
         $resa->getEmpty();
         $resa->fields["begin"] = $options['date'] . " 12:00:00";
         $resa->fields["end"] = $options['date'] . " 13:00:00";
     }
     // No item : problem
     if (!isset($options['item']) || count($options['item']) == 0) {
         return false;
     }
     echo "<div class='center'><form method='post' name=form action='reservation.form.php'>";
     if (!empty($ID)) {
         echo "<input type='hidden' name='id' value='{$ID}'>";
     }
     echo "<table class='tab_cadre'>";
     echo "<tr><th colspan='2'>" . $LANG['reservation'][9] . "</th></tr>\n";
     // Add Hardware name
     $r = new ReservationItem();
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][1] . "&nbsp;:</td>";
     echo "<td>";
     foreach ($options['item'] as $itemID) {
         $r->getFromDB($itemID);
         $type = $r->fields["itemtype"];
         $name = NOT_AVAILABLE;
         $item = NULL;
         if (class_exists($r->fields["itemtype"])) {
             $item = new $r->fields["itemtype"]();
             $type = $item->getTypeName();
             if ($item->getFromDB($r->fields["items_id"])) {
                 $name = $item->getName();
             } else {
                 $item = NULL;
             }
         }
         echo "<strong>{$type} - {$name}</strong><br>";
         echo "<input type='hidden' name='items[{$itemID}]' value='{$itemID}'>";
     }
     echo "</td></tr>\n";
     if (!haveRight("reservation_central", "w") || is_null($item) || !haveAccessToEntity($item->fields["entities_id"])) {
         echo "<input type='hidden' name='users_id' value='" . getLoginUserID() . "'>";
     } else {
         echo "<tr class='tab_bg_2'><td>" . $LANG['common'][95] . "&nbsp;:</td>";
         echo "<td>";
         if (empty($ID)) {
             User::dropdown(array('value' => getLoginUserID(), 'entity' => $item->getEntityID(), 'right' => 'all'));
         } else {
             User::dropdown(array('value' => $resa->fields["users_id"], 'entity' => $item->getEntityID(), 'right' => 'all'));
         }
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_2'><td>" . $LANG['search'][8] . "&nbsp;:</td><td>";
     showDateTimeFormItem("begin", $resa->fields["begin"], -1, false);
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_2'><td>" . $LANG['search'][9] . "&nbsp;:</td><td>";
     showDateTimeFormItem("end", $resa->fields["end"], -1, false);
     Alert::displayLastAlert('Reservation', $ID);
     echo "</td></tr>\n";
     if (empty($ID)) {
         echo "<tr class='tab_bg_2'><td>" . $LANG['reservation'][27] . "&nbsp;:</td>";
         echo "<td>";
         echo "<select name='periodicity'>";
         echo "<option value='day'>" . $LANG['reservation'][29] . "</option>\n";
         echo "<option value='week'>" . $LANG['reservation'][28] . "</option>\n";
         echo "</select>";
         Dropdown::showInteger('periodicity_times', 1, 1, 60);
         echo $LANG['reservation'][30];
         echo "</td></tr>\n";
     }
     echo "<tr class='tab_bg_2'><td>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td><textarea name='comment'rows='8' cols='30'>" . $resa->fields["comment"] . "</textarea>";
     echo "</td></tr>\n";
     if (empty($ID)) {
         echo "<tr class='tab_bg_2'>";
         echo "<td colspan='2' class='top center'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>\n";
     } else {
         echo "<tr class='tab_bg_2'>";
         echo "<td class='top center'>";
         echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\" class='submit'>";
         echo "</td><td class='top center'>";
         echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][14] . "\" class='submit'>";
         echo "</td></tr>\n";
     }
     echo "</table></form></div>\n";
 }
 /**
  * Print the contract form
  *
  * @param $ID integer ID of the item
  * @param $options array
  *     - target filename : where to go when done.
  *     - withtemplate boolean : template or basic item
  *
  *@return boolean item found
  *
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     // Show Contract or blank form
     if (!haveRight("contract", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $can_edit = $this->can($ID, 'w');
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['common'][16] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "name");
     echo "</td>";
     echo "<td>" . $LANG['financial'][6] . "&nbsp;:</td><td >";
     Dropdown::show('ContractType', array('value' => $this->fields["contracttypes_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][4] . "&nbsp;:</td>";
     echo "<td>";
     autocompletionTextField($this, "num");
     echo "</td>";
     echo "<td colspan='2'></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][5] . "&nbsp;:</td><td>";
     echo "<input type='text' name='cost' value='" . formatNumber($this->fields["cost"], true) . "' size='14'></td>";
     echo "<td>" . $LANG['search'][8] . "&nbsp;:</td>";
     echo "<td>";
     showDateFormItem("begin_date", $this->fields["begin_date"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][8] . "&nbsp;:</td><td>";
     Dropdown::showInteger("duration", $this->fields["duration"], 0, 120);
     echo " " . $LANG['financial'][57];
     if (!empty($this->fields["begin_date"])) {
         echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"]);
     }
     echo "</td>";
     echo "<td>" . $LANG['financial'][13] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "accounting_number");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][69] . "&nbsp;:</td><td>";
     Dropdown::showInteger("periodicity", $this->fields["periodicity"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6"));
     echo " " . $LANG['financial'][57];
     echo "</td>";
     echo "<td>" . $LANG['financial'][10] . "&nbsp;:</td><td>";
     Dropdown::showInteger("notice", $this->fields["notice"], 0, 120);
     echo " " . $LANG['financial'][57];
     if (!empty($this->fields["begin_date"]) && $this->fields["notice"] > 0) {
         echo " -> " . getWarrantyExpir($this->fields["begin_date"], $this->fields["duration"], $this->fields["notice"]);
     }
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][107] . "&nbsp;:</td><td>";
     self::dropdownContractRenewal("renewal", $this->fields["renewal"]);
     echo "</td>";
     echo "<td>" . $LANG['financial'][11] . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::showInteger("billing", $this->fields["billing"], 12, 60, 12, array(0 => DROPDOWN_EMPTY_VALUE, 1 => "1", 2 => "2", 3 => "3", 6 => "6"));
     echo " " . $LANG['financial'][57];
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['financial'][83] . "&nbsp;:</td><td>";
     Dropdown::showInteger("max_links_allowed", $this->fields["max_links_allowed"], 1, 200, 1, array(0 => $LANG['software'][4]));
     echo "</td>";
     echo "<td>" . $LANG['common'][41] . "</td>";
     echo "<td>";
     self::dropdownAlert("alert", $this->fields["alert"]);
     Alert::displayLastAlert('Contract', $ID);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td class='top'>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td class='center' colspan='3'>";
     echo "<textarea cols='50' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr>";
     echo "<tr class='tab_bg_2'><td>" . $LANG['financial'][59] . "&nbsp;:</td>";
     echo "<td colspan='3'>&nbsp;</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][60] . "&nbsp;:</td>";
     echo "<td colspan='3'>" . $LANG['buttons'][33] . "&nbsp;:&nbsp;";
     Dropdown::showHours("week_begin_hour", $this->fields["week_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("week_end_hour", $this->fields["week_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][61] . "&nbsp;:</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_saturday", $this->fields["use_saturday"]);
     echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("saturday_begin_hour", $this->fields["saturday_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("saturday_end_hour", $this->fields["saturday_end_hour"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . $LANG['financial'][62] . "&nbsp;:</td>";
     echo "<td colspan='3'>";
     Dropdown::showYesNo("use_monday", $this->fields["use_monday"]);
     echo "<span class='small_space'>" . $LANG['buttons'][33] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("monday_begin_hour", $this->fields["monday_begin_hour"]);
     echo "<span class='small_space'>" . $LANG['buttons'][32] . "</span>&nbsp;:&nbsp;";
     Dropdown::showHours("monday_end_hour", $this->fields["monday_end_hour"]);
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }