Skip to content

Commit

Permalink
Merge pull request #1645 from fbomj/batteries_refactoring
Browse files Browse the repository at this point in the history
Batteries refactoring
  • Loading branch information
fbomj authored Oct 25, 2024
2 parents f0f4e88 + 429328e commit 344f371
Show file tree
Hide file tree
Showing 22 changed files with 314 additions and 22 deletions.
6 changes: 6 additions & 0 deletions config/computer/plugins.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
<category>hardware</category>
<available>ports</available>
</plugin>
<plugin id="cd_batteries">
<label>g(1428)</label>
<system>1</system>
<category>hardware</category>
<available>batteries</available>
</plugin>

<!-- SOFTWARE -->
<plugin id="cd_softwares">
Expand Down
17 changes: 8 additions & 9 deletions files/ocsbase.sql
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,18 @@ DROP TABLE IF EXISTS `batteries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `batteries` (
`ID` int NOT NULL AUTO_INCREMENT,
`ID` int NOT NULL AUTO_INCREMENT,
`HARDWARE_ID` int NOT NULL,
`LOCATION` varchar(255) DEFAULT NULL,
`MANUFACTURER` varchar(255) DEFAULT NULL,
`MANUFACTUREDATE` varchar(10) DEFAULT NULL,
`SERIALNUMBER` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`CHEMISTRY` varchar(20) DEFAULT NULL,
`CYCLES` int DEFAULT NULL,
`DESCRIPTION` varchar(10) DEFAULT "N/A",
`DESIGNCAPACITY` varchar(10) DEFAULT NULL,
`DESIGNVOLTAGE` varchar(20) DEFAULT NULL,
`SBDSVERSION` varchar(255) DEFAULT NULL,
`MAXERROR` int DEFAULT NULL,
`OEMSPECIFIC` varchar(255) DEFAULT NULL,
`ESTIMATEDCHARGEREMAINING` varchar(255) DEFAULT NULL,
`MANUFACTURER` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`SERIALNUMBER` varchar(255) DEFAULT NULL,
`STATUS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `HARDWARE_ID` (`HARDWARE_ID`),
KEY `NAME` (`NAME`),
Expand Down
17 changes: 8 additions & 9 deletions files/ocsbase_new.sql
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,18 @@ DROP TABLE IF EXISTS `batteries`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `batteries` (
`ID` int NOT NULL AUTO_INCREMENT,
`ID` int NOT NULL AUTO_INCREMENT,
`HARDWARE_ID` int NOT NULL,
`LOCATION` varchar(255) DEFAULT NULL,
`MANUFACTURER` varchar(255) DEFAULT NULL,
`MANUFACTUREDATE` varchar(10) DEFAULT NULL,
`SERIALNUMBER` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`CHEMISTRY` varchar(20) DEFAULT NULL,
`CYCLES` int DEFAULT NULL,
`DESCRIPTION` varchar(10) DEFAULT "N/A",
`DESIGNCAPACITY` varchar(10) DEFAULT NULL,
`DESIGNVOLTAGE` varchar(20) DEFAULT NULL,
`SBDSVERSION` varchar(255) DEFAULT NULL,
`MAXERROR` int DEFAULT NULL,
`OEMSPECIFIC` varchar(255) DEFAULT NULL,
`ESTIMATEDCHARGEREMAINING` varchar(255) DEFAULT NULL,
`MANUFACTURER` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`SERIALNUMBER` varchar(255) DEFAULT NULL,
`STATUS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `HARDWARE_ID` (`HARDWARE_ID`),
KEY `NAME` (`NAME`),
Expand Down
23 changes: 23 additions & 0 deletions files/update/7080.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
UNLOCK TABLES;

DROP TABLE `batteries`;

CREATE TABLE `batteries` (
`ID` int NOT NULL AUTO_INCREMENT,
`HARDWARE_ID` int NOT NULL,
`CHEMISTRY` varchar(20) DEFAULT NULL,
`CYCLES` int DEFAULT NULL,
`DESCRIPTION` varchar(10) DEFAULT "N/A",
`DESIGNCAPACITY` varchar(10) DEFAULT NULL,
`DESIGNVOLTAGE` varchar(20) DEFAULT NULL,
`ESTIMATEDCHARGEREMAINING` varchar(255) DEFAULT NULL,
`MANUFACTURER` varchar(255) DEFAULT NULL,
`NAME` varchar(255) DEFAULT NULL,
`SERIALNUMBER` varchar(255) DEFAULT NULL,
`STATUS` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `HARDWARE_ID` (`HARDWARE_ID`),
KEY `NAME` (`NAME`),
KEY `MANUFACTURER` (`MANUFACTURER`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;

68 changes: 68 additions & 0 deletions plugins/computer_detail/cd_batteries/cd_batteries.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/*
* Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
* See the Contributors file for more details about them.
*
* This file is part of OCSInventory-NG/OCSInventory-ocsreports.
*
* OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
* it and/or modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the License,
* or (at your option) any later version.
*
* OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
if (AJAX) {
parse_str($protectedPost['ocs']['0'], $params);
$protectedPost += $params;

ob_start();
}
print_item_header($l->g(1428));
if (!isset($protectedPost['SHOW'])) {
$protectedPost['SHOW'] = 'NOSHOW';
}
$form_name = "affich_batteries";
$table_name = $form_name;
$tab_options = $protectedPost;
$tab_options['form_name'] = $form_name;
$tab_options['table_name'] = $table_name;
echo open_form($form_name, '', '', 'form-horizontal');
$list_fields = array($l->g(1800) => 'CHEMISTRY',
$l->g(1801) => 'CYCLES',
$l->g(1802) => 'DESCRIPTION',
$l->g(1803) . " (Wh)" => 'DESIGNCAPACITY',
$l->g(1804) . " (V)"=> 'DESIGNVOLTAGE',
$l->g(1805) . " (%)"=> 'ESTIMATEDCHARGEREMAINING',
$l->g(1806) => 'MANUFACTURER',
$l->g(1807) => 'NAME',
$l->g(1808) => 'SERIALNUMBER',
$l->g(1809) => 'STATUS');


if (isset($show_all_column)) {
$list_col_cant_del = $list_fields;
} else {
$list_col_cant_del = array($l->g(1800) => $l->g(1800));
}

$default_fields = $list_fields;
$queryDetails = "SELECT * FROM batteries WHERE (hardware_id=$systemid)";
ajaxtab_entete_fixe($list_fields,$default_fields,$tab_options,$list_col_cant_del);
echo close_form();

if (AJAX) {
ob_end_clean();
tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options);
ob_start();
}

?>
11 changes: 11 additions & 0 deletions plugins/language/br_BR/br_BR.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,17 @@
1702 Nova aba
1703 Adicionar pacotes selecionados

1800 Quimica
1801 Ciclo
1802 Descrição
1803 Capaciclade
1804 Capaciclade voltagem
1805 Charge estimado restante
1806 Fabricante
1807 Nome
1808 Número de série
1809 Status

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERRO:
2002 ERRO: LINHA
Expand Down
12 changes: 12 additions & 0 deletions plugins/language/cs_CZ/cs_CZ.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,18 @@
1418 Země
1419 Hledat ve sloupci
1420 Přizpůsobení tématu vzhledu
1428 baterie

1800 chemie
1801 cykly
1802 popis
1803 konstrukční kapacita
1804 kapacita
1805 odhadovaný zbývající poplatek
1806 výrobce
1807 jméno
1808 sériové číslo
1809 životní úroveň

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 CHYBA:
Expand Down
12 changes: 12 additions & 0 deletions plugins/language/de_DE/de_DE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,7 @@

1419 Suche in Spalte
1420 Benutzerdefiniertes Thema für die Oberfläche
1428 Batterien
1449 Generelle Einstellungen
1459 Zeitspanne zwischen einem CVE Scan
1460 CVE-Sucheinstellungen
Expand Down Expand Up @@ -1396,6 +1397,17 @@
1700 Erweiterte Einstellungen
1703 Ausgewählte Pakete hinzufügen

1800 Chemie
1801 Zyklen
1802 Beschreibung
1803 Designkapazität
1804 Designspannung
1805 geschätzte verbleibende Ladung
1806 Hersteller
1807 Name
1808 Seriennummer
1809 Status

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 Fehler:
2002 Fehler: Zeile
Expand Down
11 changes: 11 additions & 0 deletions plugins/language/en_GB/en_GB.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,17 @@
1702 New tab
1703 Add selected packages

1800 Chemistry
1801 Cycles
1802 Description
1803 Design capacity
1804 Design voltage
1805 Estimated charge remaining
1806 Manufacturer
1807 Name
1808 Serial number
1809 Status

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERROR:
2002 ERROR: line
Expand Down
11 changes: 11 additions & 0 deletions plugins/language/es_ES/es_ES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,17 @@
1702 Nueva pestaña
1703 Añadir paquetes seleccionados

1800 Química
1801 Ciclos
1802 Descripción
1803 Capacidad de diseño
1804 Tensión de diseño
1805 Carga restante estimada
1806 Fabricante
1807 Nombre
1808 Número de serie
1809 Estado

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 <b>ERROR:</b>
2002 <b>ERROR:</b> línea
Expand Down
13 changes: 12 additions & 1 deletion plugins/language/fr_FR/fr_FR.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,17 @@
1701 Onglet disponible
1702 Nouvel onglet

1800 Type de batterie
1801 Cycles
1802 Description
1803 Capacité nominale
1804 Capacité
1805 Temps restant pour la charge
1806 Constructeur
1807 Nom
1808 Numéro de série
1809 Etat

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERREUR:
2002 ERREUR: ligne
Expand Down Expand Up @@ -1916,4 +1927,4 @@
9990 Télécharger la liste des réseaux SNMP
9991 Génère les fichiers SNMP

10000 Échec de la mise à jour des données administratives : les simples et doubles guillements ne sont pas autorisés dans la valeur
10000 Échec de la mise à jour des données administratives : les simples et doubles guillements ne sont pas autorisés dans la valeur
12 changes: 12 additions & 0 deletions plugins/language/it_IT/it_IT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,18 @@
1411 Nome visualizzato
1412 Modifica profilo
1413 Nuova etichetta
1428 Batterie

1800 Chimica
1801 Cicli
1802 Descrizione
1803 Capacità progettuale
1804 Tensione di progetto
1805 Costo rimanente stimato
1806 Fabbricante
1807 Nome
1808 Numero di serie
1809 Stato

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERRORE:
Expand Down
11 changes: 11 additions & 0 deletions plugins/language/ja_JP/ja_JP.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,17 @@
1702 New tab
1703 Add selected packages

1800 化学
1801 周波
1802 叙述
1803 設計能力
1804 設計電圧
1805 推定残量
1806 製造者
1807 名前
1808 連番
1809 状態

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 エラー:
2002 エラー: 行
Expand Down
12 changes: 12 additions & 0 deletions plugins/language/nl_NL/nl_NL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1362,6 +1362,18 @@
1702 Nieuw tabblad
1703 Geselecteerde pakketten toevoegen

1800 Chemie
1801 Cycli
1802 Benaming
1803 Ontwerp capaciteit
1804 Ontwerp spanning
1805 Geschatte resterende lading
1806 Fabrikant
1807 Naam
1808 Serienummer
1809 Status


2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 FOUT:
2002 FOUT: regel
Expand Down
12 changes: 12 additions & 0 deletions plugins/language/pl_PL/pl_PL.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,18 @@
1325 screen horizontal / vertical
1326 Shared
1327 Local / Networks
1428 akumulator

1800 Chemia
1801 okres
1802 oznaczenie
1803 Pojemność projektowa
1804 Napięcie projektowe
1805 Szacowany pozostały poziom naładowania
1806 fabrykant
1807 marka
1808 Numer seryjny
1809 Status

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERROR:
Expand Down
12 changes: 12 additions & 0 deletions plugins/language/pt_PT/pt_PT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1282,6 +1282,18 @@
1326 Shared
1327 Local / Networks

1428 Bateria

1800 Química
1801 Ciclos
1802 Descrição
1803 Capacidade de projeto
1804 Tensão de projeto
1805 Carga estimada restante
1806 Fabricante
1807 Nome
1808 Número de série
1809 Status

2000 * SETUP voices 2000-2200 * (2000-2029 Common voices *** 2030-2200 Setup voices)
2001 ERROR:
Expand Down
Loading

0 comments on commit 344f371

Please sign in to comment.