Skip to content

Commit

Permalink
Merge pull request #6 from evarisk-charles/add_tasks_columns_dictiona…
Browse files Browse the repository at this point in the history
…ries

#3 [Mod] add: create table + insert dictionary
  • Loading branch information
evarisk-charles authored Aug 9, 2024
2 parents 7c9d772 + 0bd90f0 commit a7b08d4
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 4 deletions.
56 changes: 53 additions & 3 deletions core/modules/moddigikanban.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,38 @@ function __construct($db)
$conf->digikanban=new stdClass();
$conf->digikanban->enabled=0;
}
$this->dictionaries=array();

$this->dictionaries = [
'langs' => 'digikanban@digikanban',
'tabname' => [
MAIN_DB_PREFIX . 'c_tasks_columns',
],
'tablib' => [
'TasksColumns',
],
'tabsql' => [
'SELECT t.rowid as rowid, t.ref, t.label, t.lowerpercent, t.upperpercent, t.position, t.active FROM ' . MAIN_DB_PREFIX . 'c_tasks_columns as t',
],
'tabsqlsort' => [
'position ASC',
],
'tabfield' => [
'ref,label,lowerpercent,upperpercent,position',
],
'tabfieldvalue' => [
'ref,label,lowerpercent,upperpercent,position',
],
'tabfieldinsert' => [
'ref,label,lowerpercent,upperpercent,position',
],
'tabrowid' => [
'rowid',
],
'tabcond' => [
$conf->digikanban->enabled,
]
];

/* Example:
if (! isset($conf->digikanban->enabled)) $conf->digikanban->enabled=0; // This is to avoid warnings
$this->dictionaries=array(
Expand Down Expand Up @@ -375,7 +406,6 @@ function init($options='')
{
global $conf, $langs;
$langs->load('digikanban@digikanban');
$sqlm = array();

dol_include_once('/digikanban/class/digikanban.class.php');
$digikanban = new digikanban($this->db);
Expand All @@ -385,7 +415,27 @@ function init($options='')

$digikanban->initThedigikanbanModule($this->version);

return $this->_init($sqlm, $options);
if ($this->error > 0) {
setEventMessages('', $this->errors, 'errors');
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

$sql = [];
$result = $this->_load_tables('/digikanban/sql/');

if ($result < 0) {
return -1;
} // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')

dolibarr_set_const($this->db, 'DIGIKANBAN_VERSION', $this->version, 'chaine', 0, '', $conf->entity);
dolibarr_set_const($this->db, 'DIGIKANBAN_DB_VERSION', $this->version, 'chaine', 0, '', $conf->entity);

// Permissions
$this->remove($options);

$result = $this->_init($sql, $options);

return $result;
}

/**
Expand Down
25 changes: 24 additions & 1 deletion langs/fr_FR/digikanban.lang
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,27 @@ FieldsToShowWhenHoveringATask=Champs à afficher lors du <b>survol</b> du tâche

showtaskinfirstcolomn=Afficher les tâches qui n'ont pas de statut dans la première colonne
OtherContact=Autres contributeurs
MaximumNumberOfContactsToDisplayNextToThePrimaryUser=Nombre maximum de contacts à afficher à côté de l'utilisateur principal
MaximumNumberOfContactsToDisplayNextToThePrimaryUser=Nombre maximum de contacts à afficher à côté de l'utilisateur principal

#
# Config page - Page d'administration
#

# Data - Donnée
ColumnsManagement = Gestion des colonnes
ColumnList = Liste des colonnes

# Dictionaries - Dictionnaires
TasksColumns = Colonnes des tâches
Backlog = À Planifier
ToDo = À Faire
InProgress = En Cours
InReview = À Controler
Done = Fait
BacklogDescription = Toutes les tâches et idées qui doivent être faites, mais qui ne sont pas encore planifiées pour être travaillées.
ToDoDescription = Les tâches qui sont prêtes à être commencées. Ces tâches sont souvent tirées du backlog et priorisées pour être les prochaines à être traitées.
InProgressDescription = Les tâches qui sont actuellement en train d'être travaillées. Cela permet de visualiser ce qui est en cours de réalisation.
InReviewDescription = Les tâches qui ont été complétées mais qui nécessitent une vérification ou une approbation avant d'être considérées comme terminées.
DoneDescription = Les tâches qui ont été complètement terminées et validées. Cela permet de suivre les progrès et de voir ce qui a été accompli.
Lowerpercent = Pourcentage bas
Upperpercent = Pourcentage haut
22 changes: 22 additions & 0 deletions sql/data.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Copyright (C) 2024 EVARISK <[email protected]>
--
-- This program 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 3 of the License, or
-- (at your option) any later version.
--
-- This program 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 this program. If not, see https://www.gnu.org/licenses/.

-- 1.0.0

INSERT INTO `llx_c_tasks_columns` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `lowerpercent`, `upperpercent`, `position`) VALUES(1, 0, 'Backlog', 'Backlog', 'BacklogDescription', 1, '0', '20', 1);
INSERT INTO `llx_c_tasks_columns` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `lowerpercent`, `upperpercent`, `position`) VALUES(2, 0, 'ToDo', 'ToDo', 'ToDoDescription', 1, '21', '40', 10);
INSERT INTO `llx_c_tasks_columns` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `lowerpercent`, `upperpercent`, `position`) VALUES(3, 0, 'InProgress', 'InProgress', 'InProgressDescription', 1, '41', '60', 20);
INSERT INTO `llx_c_tasks_columns` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `lowerpercent`, `upperpercent`, `position`) VALUES(4, 0, 'InReview', 'InReview', 'InReviewDescription', 1, '61', '80', 30);
INSERT INTO `llx_c_tasks_columns` (`rowid`, `entity`, `ref`, `label`, `description`, `active`, `lowerpercent`, `upperpercent`, `position`) VALUES(5, 0, 'Done', 'Done', 'DoneDescription', 1, '81', '100', 40);
Empty file added sql/index.php
Empty file.
26 changes: 26 additions & 0 deletions sql/llx_c_tasks_columns.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-- Copyright (C) 2024 EVARISK <[email protected]>
--
-- This program 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 3 of the License, or
-- (at your option) any later version.
--
-- This program 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 this program. If not, see https://www.gnu.org/licenses/.

CREATE TABLE llx_c_tasks_columns(
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
entity integer default 1,
ref varchar(128),
label varchar(255),
description text,
active tinyint(4) DEFAULT 1,
lowerpercent double(5,2) DEFAULT NULL,
upperpercent double(5,2) DEFAULT NULL,
position integer DEFAULT 0
) ENGINE=innodb;
14 changes: 14 additions & 0 deletions sql/update.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Copyright (C) 2024 EVARISK <[email protected]>
--
-- This program 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 3 of the License, or
-- (at your option) any later version.
--
-- This program 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 this program. If not, see https://www.gnu.org/licenses/.

0 comments on commit a7b08d4

Please sign in to comment.