.
* ---------------------------------------------------------------------
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
/**
* PassiveDCEquipment Class
**/
class PassiveDCEquipment extends CommonDBTM {
use Glpi\Features\DCBreadcrumb;
// From CommonDBTM
public $dohistory = true;
static $rightname = 'datacenter';
static function getTypeName($nb = 0) {
return _n('Passive device', 'Passive devices', $nb);
}
function defineTabs($options = []) {
$ong = [];
$this->addDefaultFormTab($ong)
->addImpactTab($ong, $options)
->addStandardTab('Infocom', $ong, $options)
->addStandardTab('Contract_Item', $ong, $options)
->addStandardTab('Document_Item', $ong, $options)
->addStandardTab('Ticket', $ong, $options)
->addStandardTab('Item_Problem', $ong, $options)
->addStandardTab('Change_Item', $ong, $options)
->addStandardTab('Log', $ong, $options);
return $ong;
}
function showForm($ID, $options = []) {
$rand = mt_rand();
$tplmark = $this->getAutofillMark('name', $options);
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "
";
echo " | ";
echo "";
$objectName = autoName(
$this->fields["name"],
"name",
(isset($options['withtemplate']) && ( $options['withtemplate']== 2)),
$this->getType(),
$this->fields["entities_id"]
);
Html::autocompletionTextField(
$this,
'name',
[
'value' => $objectName,
'rand' => $rand
]
);
echo " | ";
echo " | ";
echo "";
State::dropdown([
'value' => $this->fields["states_id"],
'entity' => $this->fields["entities_id"],
'condition' => ['is_visible_passivedcequipment' => 1],
'rand' => $rand]
);
echo " |
\n";
$this->showDcBreadcrumb();
echo "";
echo " | ";
echo "";
Location::dropdown([
'value' => $this->fields["locations_id"],
'entity' => $this->fields["entities_id"],
'rand' => $rand
]);
echo " | ";
echo " | ";
echo "";
PassiveDCEquipmentType::dropdown([
'value' => $this->fields["passivedcequipmenttypes_id"],
'rand' => $rand
]);
echo " |
\n";
echo "";
echo " | ";
echo "";
User::dropdown([
'name' => 'users_id_tech',
'value' => $this->fields["users_id_tech"],
'right' => 'own_ticket',
'entity' => $this->fields["entities_id"],
'rand' => $rand
]);
echo " | ";
echo " | ";
echo "";
Manufacturer::dropdown([
'value' => $this->fields["manufacturers_id"],
'rand' => $rand
]);
echo " |
\n";
echo "";
echo " | ";
echo "";
Group::dropdown([
'name' => 'groups_id_tech',
'value' => $this->fields['groups_id_tech'],
'entity' => $this->fields['entities_id'],
'condition' => ['is_assign' => 1],
'rand' => $rand
]);
echo " | ";
echo " | ";
echo "";
PassiveDCEquipmentModel::dropdown([
'value' => $this->fields["passivedcequipmentmodels_id"],
'rand' => $rand
]);
echo " |
\n";
echo "";
echo " | ";
echo "";
Html::autocompletionTextField($this, 'serial', ['rand' => $rand]);
echo " | ";
echo " | ";
echo "";
$objectName = autoName($this->fields["otherserial"], "otherserial",
(isset($options['withtemplate']) && ($options['withtemplate'] == 2)),
$this->getType(), $this->fields["entities_id"]);
Html::autocompletionTextField(
$this,
'otherserial',
[
'value' => $objectName,
'rand' => $rand
]
);
echo " |
\n";
echo "";
echo " | ";
echo "";
echo " |
";
$this->showFormButtons($options);
return true;
}
function rawSearchOptions() {
$tab = [];
$tab[] = [
'id' => 'common',
'name' => __('Characteristics')
];
$tab[] = [
'id' => '1',
'table' => $this->getTable(),
'field' => 'name',
'name' => __('Name'),
'datatype' => 'itemlink',
'massiveaction' => false, // implicit key==1
'autocomplete' => true,
];
$tab[] = [
'id' => '2',
'table' => $this->getTable(),
'field' => 'id',
'name' => __('ID'),
'massiveaction' => false, // implicit field is id
'datatype' => 'number'
];
$tab[] = [
'id' => '4',
'table' => 'glpi_passivedcequipmenttypes',
'field' => 'name',
'name' => _n('Type', 'Types', 1),
'datatype' => 'dropdown'
];
$tab[] = [
'id' => '5',
'table' => $this->getTable(),
'field' => 'serial',
'name' => __('Serial number'),
'datatype' => 'string',
'autocomplete' => true,
];
$tab[] = [
'id' => '6',
'table' => $this->getTable(),
'field' => 'otherserial',
'name' => __('Inventory number'),
'datatype' => 'string',
'autocomplete' => true,
];
$tab = array_merge($tab, Location::rawSearchOptionsToAdd());
$tab[] = [
'id' => '19',
'table' => $this->getTable(),
'field' => 'date_mod',
'name' => __('Last update'),
'datatype' => 'datetime',
'massiveaction' => false
];
$tab[] = [
'id' => '23',
'table' => 'glpi_manufacturers',
'field' => 'name',
'name' => Manufacturer::getTypeName(1),
'datatype' => 'dropdown'
];
$tab[] = [
'id' => '31',
'table' => 'glpi_states',
'field' => 'completename',
'name' => __('Status'),
'datatype' => 'dropdown',
'condition' => ['is_visible_passivedcequipment' => 1]
];
$tab[] = [
'id' => '24',
'table' => 'glpi_users',
'field' => 'name',
'linkfield' => 'users_id_tech',
'name' => __('Technician in charge of the hardware'),
'datatype' => 'dropdown',
'right' => 'own_ticket'
];
$tab[] = [
'id' => '40',
'table' => 'glpi_passivedcequipmentmodels',
'field' => 'name',
'name' => _n('Model', 'Models', 1),
'datatype' => 'dropdown'
];
$tab[] = [
'id' => '49',
'table' => 'glpi_groups',
'field' => 'completename',
'linkfield' => 'groups_id_tech',
'name' => __('Group in charge of the hardware'),
'condition' => ['is_assign' => 1],
'datatype' => 'dropdown'
];
$tab[] = [
'id' => '50',
'table' => $this->getTable(),
'field' => 'template_name',
'name' => __('Template name'),
'datatype' => 'text',
'massiveaction' => false,
'nosearch' => true,
'nodisplay' => true,
'autocomplete' => true,
];
$tab[] = [
'id' => '121',
'table' => $this->getTable(),
'field' => 'date_creation',
'name' => __('Creation date'),
'datatype' => 'datetime',
'massiveaction' => false
];
$tab[] = [
'id' => '80',
'table' => 'glpi_entities',
'field' => 'completename',
'name' => Entity::getTypeName(1),
'datatype' => 'dropdown'
];
$tab = array_merge($tab, Datacenter::rawSearchOptionsToAdd(get_class($this)));
return $tab;
}
static function getIcon() {
return "fas fa-th-list";
}
}