mirror of
https://github.com/itflow-org/itflow
synced 2026-12-05 18:49:01 +00:00
Warranty lookup by serial number: Admin > Warranty Lookup sets up Dell with a TechDirect key, HP with a Warranty API key and Lenovo through its support site with no key, each with Save and test; the search button beside Warranty expires on the asset form fills the empty warranty and purchase dates and offers the maker's date beside one already set, and Bulk Action > Look Up Warranty on Assets fills many at once with each answer listed and noted in the asset's history; database 4.4.4; 26.12.6 changelog
This commit is contained in:
33
admin/database_updates/4.4.4.php
Normal file
33
admin/database_updates/4.4.4.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* ITFlow - Database update to version 4.4.4 (from 4.4.3)
|
||||
* Included by admin/database_updates.php - do not access directly
|
||||
*
|
||||
* Warranty lookup (functions/warranty.php) - an asset's warranty end and purchase date filled from
|
||||
* its serial number, by its manufacturer (Admin > Warranty Lookup):
|
||||
* settings.config_warranty_dell_client_id / _secret - a Dell TechDirect Warranty API key; the
|
||||
* secret sealed (secretSeal(), 'warranty')
|
||||
* settings.config_warranty_hp_client_id / _secret - an HP Warranty API key, the same
|
||||
* settings.config_warranty_lenovo - Lenovo serials looked up on Lenovo's support site, which needs
|
||||
* no key; on by default
|
||||
*
|
||||
* Re-runnable: each column is added only where it isn't there.
|
||||
*/
|
||||
|
||||
defined('FROM_DB_UPDATER') || die("Direct file access is not allowed");
|
||||
|
||||
$itflow_warranty_columns = [
|
||||
['config_warranty_dell_client_id', "varchar(200) DEFAULT NULL"],
|
||||
['config_warranty_dell_client_secret', "text DEFAULT NULL"],
|
||||
['config_warranty_hp_client_id', "varchar(200) DEFAULT NULL"],
|
||||
['config_warranty_hp_client_secret', "text DEFAULT NULL"],
|
||||
['config_warranty_lenovo', "tinyint(1) NOT NULL DEFAULT 1"],
|
||||
];
|
||||
foreach ($itflow_warranty_columns as [$itflow_column, $itflow_definition]) {
|
||||
$itflow_column_exists = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'settings' AND COLUMN_NAME = '$itflow_column' LIMIT 1");
|
||||
if (!$itflow_column_exists || mysqli_num_rows($itflow_column_exists) === 0) {
|
||||
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$itflow_column` $itflow_definition");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user