Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #35 from OPEN-DSI/2022.5.3_rc
Browse files Browse the repository at this point in the history
2022.5.3 rc -> 2022.5.3
  • Loading branch information
kkhelifa-opendsi authored Apr 22, 2024
2 parents be2dde4 + cf2df53 commit 95d8c86
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .easya_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dol_min": 14,
"dol_max": 18
}
10 changes: 9 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co

## [Non Distribué]

## [14.0.2] - 22-09-2023
- Correction du filtre sur les colonnes de type boolean
- Correction des requetes UPDATE et DELETE en prenant en compte l'entité dans les requêtes

## [14.0.1] - 26-02-2024
- Changement de numérotation

## [4.0.59] - 22-09-2023
- Changement de marque Open-DSI > Easya Solutions

Expand Down Expand Up @@ -240,7 +247,8 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
## [4.0.0] - 16-07-2018
- Version initial.

[Non Distribué]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/compare/v4.0.59...HEAD
[Non Distribué]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/compare/14.0.1...HEAD
[14.0.1]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/commits/14.0.1
[4.0.59]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/commits/v4.0.59
[4.0.58]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/commits/v4.0.58
[4.0.57]: https://github.com/OPEN-DSI/dolibarr_module_advancedictionaries/commits/v4.0.57
Expand Down
Empty file added FEATURES.md
Empty file.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.59
14.0.2
42 changes: 29 additions & 13 deletions class/dictionary.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,6 @@ public function createTables()
}
}

if (!$error) {
// Create indexes of the tables
$res = $this->createIndexesTable();
if ($res < 0) {
$error++;
}
}

if (!$error) {
// Create sub dictionary table
foreach ($this->fields as $field) {
Expand Down Expand Up @@ -549,6 +541,15 @@ public function createTables()
}
}

// Todo creation d'un nouveau field avec index
if (!$error) {
// Create indexes of the tables
$res = $this->createIndexesTable();
if ($res < 0) {
$error++;
}
}

if (!$error) {
$this->db->commit();
return 1;
Expand Down Expand Up @@ -1318,12 +1319,15 @@ static function getDictionary($db, $module='', $name='', $old_id=0, $root_path =
$classname = $name . "Dictionary";
$file = "/" . (!empty($root_path) ? $root_path : $module . "/core/dictionaries") . "/" . strtolower($name) . ".dictionary.php";

$included = true;
if (!class_exists($classname, false)) {
dol_include_once($file);
$included = dol_include_once($file);
}

$dictionary = new $classname($db);
if (is_object($dictionary)) $dictionary->root_path = $root_path;
if ($included) {
$dictionary = new $classname($db);
if (is_object($dictionary)) $dictionary->root_path = $root_path;
}

return $dictionary;
}
Expand Down Expand Up @@ -2137,7 +2141,7 @@ public function showInputSearchField($fieldName, $search_filters)
$this->fields[$fieldName]['type'] = $old_type;
return $out;
case 'boolean':
return $form->selectyesno($fieldHtmlName, !empty($search_filters[$fieldName]), 1, false, 1);
return $form->selectyesno($fieldHtmlName, $search_filters[$fieldName] >= 0 && isset($search_filters[$fieldName]) ? !empty($search_filters[$fieldName]) : '', 1, false, 1);
case 'custom':
return $this->showInputSearchCustomField($fieldName);
default: // unknown
Expand Down Expand Up @@ -3517,7 +3521,10 @@ public function update($fieldsValue, $user, $noTrigger = 0)
}
}
$sql .= implode(', ', $set_statement);
$sql .= ' WHERE ' . $cq . $this->dictionary->rowid_field . $cq . ' = ' . $this->id;
$sql .= ' WHERE ' . $cq . $this->dictionary->rowid_field . $cq . ' = ' . $this->id;
if ($this->dictionary->is_multi_entity && $this->dictionary->has_entity) {
$sql .= ' AND ' . $cq . $this->dictionary->entity_field . $cq . ' = ' . $this->old->entity;
}

dol_syslog(__METHOD__, LOG_DEBUG);
if (!empty($set_statement)) {
Expand Down Expand Up @@ -3681,6 +3688,9 @@ public function delete($user, $noTrigger = 0)

// Delete line of dictionary table
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->dictionary->table_name . ' WHERE ' . $cq . $this->dictionary->rowid_field . $cq . ' = ' . $this->id;
if ($this->dictionary->is_multi_entity && $this->dictionary->has_entity) {
$sql .= ' AND ' . $cq . $this->dictionary->entity_field . $cq . ' = ' . $this->entity;
}

dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
Expand Down Expand Up @@ -3750,6 +3760,9 @@ public function active($status, $user, $noTrigger = 0)
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->dictionary->table_name .
' SET ' . $cq . $this->dictionary->active_field . $cq . ' = ' . $this->active .
' WHERE ' . $cq . $this->dictionary->rowid_field . $cq . ' = ' . $this->id;
if ($this->dictionary->is_multi_entity && $this->dictionary->has_entity) {
$sql .= ' AND ' . $cq . $this->dictionary->entity_field . $cq . ' = ' . $this->old->entity;
}

dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
Expand Down Expand Up @@ -3809,6 +3822,9 @@ public function setEntity($user, $entity, $noTrigger = 0)
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->dictionary->table_name .
' SET ' . $cq . $this->dictionary->entity_field . $cq . ' = ' . $this->entity .
' WHERE ' . $cq . $this->dictionary->rowid_field . $cq . ' = ' . $this->id;
if ($this->dictionary->is_multi_entity && $this->dictionary->has_entity) {
$sql .= ' AND ' . $cq . $this->dictionary->entity_field . $cq . ' = ' . $this->old->entity;
}

dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $this->db->query($sql);
Expand Down

0 comments on commit 95d8c86

Please sign in to comment.