Commit 0b2ef3f5 authored by Johan Cwiklinski's avatar Johan Cwiklinski Committed by Johan Cwiklinski

Add active status on suppliers

parent 3915a6fb
......@@ -175,12 +175,23 @@ class Supplier extends CommonDBTM {
Html::autocompletionTextField($this, "country");
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Active')."</td>";
echo "<td>";
Dropdown::showYesNo('is_active', $this->fields['is_active']);
echo "</td></tr>";
$this->showFormButtons($options);
return true;
}
static function dropdown($options = []) {
$condition = ['is_active' => true];
$options['condition'] = (isset($options['condition']) ? $options['condition'] + $condition : $condition);
return Dropdown::show(get_called_class(), $options);
}
/**
* @see CommonDBTM::getSpecificMassiveActions()
......
......@@ -8377,13 +8377,15 @@ CREATE TABLE `glpi_suppliers` (
`email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`date_mod` datetime DEFAULT NULL,
`date_creation` datetime DEFAULT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `name` (`name`),
KEY `entities_id` (`entities_id`),
KEY `suppliertypes_id` (`suppliertypes_id`),
KEY `is_deleted` (`is_deleted`),
KEY `date_mod` (`date_mod`),
KEY `date_creation` (`date_creation`)
KEY `date_creation` (`date_creation`),
KEY `is_active` (`is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
......
......@@ -75,6 +75,25 @@ function update94to95() {
}
/** /Encrypted FS support */
/** Suppliers restriction */
if (!$DB->fieldExists('glpi_suppliers', 'is_active')) {
$migration->addField(
'glpi_suppliers',
'is_active',
'bool',
['value' => 0]
);
$migration->addKey('glpi_suppliers', 'is_active');
$migration->addPostQuery(
$DB->buildUpdate(
'glpi_suppliers',
['is_active' => 1],
[true]
)
);
}
/** /Suppliers restriction */
// ************ Keep it at the end **************
$migration->executeMigration();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment