diff --git a/admin/about.php b/admin/about.php
index 1d88a59..8598451 100644
--- a/admin/about.php
+++ b/admin/about.php
@@ -16,9 +16,9 @@
*/
/**
- * \file diffusion/admin/about.php
- * \ingroup diffusion
- * \brief About page of Diffusion module.
+ * \file dynamicsprices/admin/about.php
+ * \ingroup dynamicsprices
+ * \brief About page of DynamicsPrices module.
*/
// Load Dolibarr environment
@@ -51,27 +51,27 @@
}
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
-require_once '../lib/diffusion.lib.php';
-require_once '../core/modules/modDiffusion.class.php';
+require_once '../lib/dynamicsprices.lib.php';
+require_once '../core/modules/modDynamicsPrices.class.php';
// Load translations required by this page.
-$langs->loadLangs(array('admin', 'diffusion@diffusion'));
+$langs->loadLangs(array('admin', 'dynamicsprices@dynamicsprices'));
// Restrict access to administrators only.
if (empty($user->admin)) {
accessforbidden();
}
-$moduleDescriptor = new modDiffusion($db);
-$title = $langs->trans('DiffusionAbout');
+$moduleDescriptor = new modDynamicsPrices($db);
+$title = $langs->trans('LMDB_AboutTitle');
llxHeader('', $title);
print load_fiche_titre($title, '', 'info');
-$head = diffusionAdminPrepareHead();
-print dol_get_fiche_head($head, 'about', $title, -1, 'diffusion@diffusion');
+$head = dynamicspricesAdminPrepareHead();
+print dol_get_fiche_head($head, 'about', $title, -1, 'dynamicsprices@dynamicsprices');
-print '
'.$langs->trans('DiffusionAboutPage').'
';
+print ''.$langs->trans('LMDB_AboutDescription').'
';
print '
';
print '';
@@ -80,11 +80,11 @@
print '
';
print '
';
print '
';
-print '| '.$langs->trans('DiffusionAboutGeneral').' |
';
-print '| '.$langs->trans('DiffusionAboutVersion').' | '.dol_escape_htmltag($moduleDescriptor->version).' |
';
-print '| '.$langs->trans('DiffusionAboutFamily').' | '.dol_escape_htmltag($moduleDescriptor->family).' |
';
-print '| '.$langs->trans('DiffusionAboutDescription').' | '.dol_escape_htmltag($langs->trans($moduleDescriptor->description)).' |
';
-print '| '.$langs->trans('DiffusionAboutMaintainer').' | '.dol_escape_htmltag($moduleDescriptor->editor_name).' |
';
+print '| '.$langs->trans('LMDB_AboutGeneral').' |
';
+print '| '.$langs->trans('LMDB_AboutVersion').' | '.dol_escape_htmltag($moduleDescriptor->version).' |
';
+print '| '.$langs->trans('LMDB_AboutFamily').' | '.dol_escape_htmltag($moduleDescriptor->family).' |
';
+print '| '.$langs->trans('LMDB_AboutModuleDescription').' | '.dol_escape_htmltag($langs->trans($moduleDescriptor->description)).' |
';
+print '| '.$langs->trans('LMDB_AboutMaintainer').' | '.dol_escape_htmltag($moduleDescriptor->editor_name).' |
';
print '
';
print '
';
print '
';
@@ -93,10 +93,10 @@
print '
';
diff --git a/core/modules/modDynamicsPrices.class.php b/core/modules/modDynamicsPrices.class.php
index 9b4bd00..1eef3d8 100644
--- a/core/modules/modDynamicsPrices.class.php
+++ b/core/modules/modDynamicsPrices.class.php
@@ -550,6 +550,10 @@ public function init($options = '')
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')
}
+ $result = $this->ensureCommercialCategoryColumns();
+ if ($result < 0) {
+ return -1;
+ }
// Create product/service extrafield during init.
include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@@ -636,6 +640,39 @@ private function columnExists($tableName, $columnName)
return ($resql && $this->db->num_rows($resql) > 0);
}
+ /**
+ * Add and populate code_commercial_category columns for module dictionaries.
+ *
+ * @return int
+ */
+ private function ensureCommercialCategoryColumns()
+ {
+ $queries = array();
+
+ if (!$this->columnExists(MAIN_DB_PREFIX."c_coefprice", 'code_commercial_category')) {
+ $queries[] = "ALTER TABLE ".MAIN_DB_PREFIX."c_coefprice ADD COLUMN code_commercial_category VARCHAR(50) DEFAULT NULL";
+ }
+ if (!$this->columnExists(MAIN_DB_PREFIX."c_margin_on_cost", 'code_commercial_category')) {
+ $queries[] = "ALTER TABLE ".MAIN_DB_PREFIX."c_margin_on_cost ADD COLUMN code_commercial_category VARCHAR(50) DEFAULT NULL";
+ }
+ if ($this->columnExists(MAIN_DB_PREFIX."c_coefprice", 'fk_nature')) {
+ $queries[] = "UPDATE ".MAIN_DB_PREFIX."c_coefprice SET code_commercial_category = fk_nature WHERE (code_commercial_category IS NULL OR code_commercial_category = '') AND fk_nature IS NOT NULL AND fk_nature <> ''";
+ }
+ if ($this->columnExists(MAIN_DB_PREFIX."c_margin_on_cost", 'code_nature')) {
+ $queries[] = "UPDATE ".MAIN_DB_PREFIX."c_margin_on_cost SET code_commercial_category = code_nature WHERE (code_commercial_category IS NULL OR code_commercial_category = '') AND code_nature IS NOT NULL AND code_nature <> ''";
+ }
+
+ foreach ($queries as $sql) {
+ $resql = $this->db->query($sql);
+ if (!$resql) {
+ $this->error = $this->db->lasterror();
+ return -1;
+ }
+ }
+
+ return 1;
+ }
+
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
diff --git a/langs/de_DE/dynamicsprices.lang b/langs/de_DE/dynamicsprices.lang
index 13ae59c..2fbc710 100644
--- a/langs/de_DE/dynamicsprices.lang
+++ b/langs/de_DE/dynamicsprices.lang
@@ -83,3 +83,13 @@ LMDB_AboutDescription = Allgemeine Informationen zum DynamicsPrices-Modul.
LMDB_AboutGeneral = Allgemeine Informationen
LMDB_AboutResources = Ressourcen
+
+LMDB_AboutVersion = Version
+LMDB_AboutFamily = Familie
+LMDB_AboutModuleDescription = Beschreibung
+LMDB_AboutMaintainer = Maintainer
+LMDB_AboutDocumentation = Dokumentation
+LMDB_AboutDocumentationLink = README öffnen
+LMDB_AboutSupport = Support
+LMDB_AboutSupportValue = Kontaktieren Sie den Maintainer für Support.
+LMDB_AboutContact = Kontakt
\ No newline at end of file
diff --git a/langs/en_US/dynamicsprices.lang b/langs/en_US/dynamicsprices.lang
index f3f1cb4..d90feb7 100644
--- a/langs/en_US/dynamicsprices.lang
+++ b/langs/en_US/dynamicsprices.lang
@@ -83,3 +83,13 @@ LMDB_AboutDescription = General information about DynamicsPrices module.
LMDB_AboutGeneral = General information
LMDB_AboutResources = Resources
+
+LMDB_AboutVersion = Version
+LMDB_AboutFamily = Family
+LMDB_AboutModuleDescription = Description
+LMDB_AboutMaintainer = Maintainer
+LMDB_AboutDocumentation = Documentation
+LMDB_AboutDocumentationLink = Open README
+LMDB_AboutSupport = Support
+LMDB_AboutSupportValue = Contact the maintainer for support.
+LMDB_AboutContact = Contact
\ No newline at end of file
diff --git a/langs/es_ES/dynamicsprices.lang b/langs/es_ES/dynamicsprices.lang
index 38af6ee..883f8b7 100644
--- a/langs/es_ES/dynamicsprices.lang
+++ b/langs/es_ES/dynamicsprices.lang
@@ -83,3 +83,13 @@ LMDB_AboutDescription = Información general sobre el módulo DynamicsPrices.
LMDB_AboutGeneral = Información general
LMDB_AboutResources = Recursos
+
+LMDB_AboutVersion = Versión
+LMDB_AboutFamily = Familia
+LMDB_AboutModuleDescription = Descripción
+LMDB_AboutMaintainer = Mantenedor
+LMDB_AboutDocumentation = Documentación
+LMDB_AboutDocumentationLink = Abrir README
+LMDB_AboutSupport = Soporte
+LMDB_AboutSupportValue = Contacte al mantenedor para soporte.
+LMDB_AboutContact = Contacto
\ No newline at end of file
diff --git a/langs/fr_FR/dynamicsprices.lang b/langs/fr_FR/dynamicsprices.lang
index aeae0a7..3dff546 100644
--- a/langs/fr_FR/dynamicsprices.lang
+++ b/langs/fr_FR/dynamicsprices.lang
@@ -85,3 +85,13 @@ LMDB_AboutDescription = Informations generales sur le module DynamicsPrices.
LMDB_AboutGeneral = Informations generales
LMDB_AboutResources = Ressources
+
+LMDB_AboutVersion = Version
+LMDB_AboutFamily = Famille
+LMDB_AboutModuleDescription = Description
+LMDB_AboutMaintainer = Mainteneur
+LMDB_AboutDocumentation = Documentation
+LMDB_AboutDocumentationLink = Ouvrir le README
+LMDB_AboutSupport = Support
+LMDB_AboutSupportValue = Contactez le mainteneur pour le support.
+LMDB_AboutContact = Contact
\ No newline at end of file
diff --git a/langs/it_IT/dynamicsprices.lang b/langs/it_IT/dynamicsprices.lang
index ba72872..4a8a5cd 100644
--- a/langs/it_IT/dynamicsprices.lang
+++ b/langs/it_IT/dynamicsprices.lang
@@ -83,3 +83,13 @@ LMDB_AboutDescription = Informazioni generali sul modulo DynamicsPrices.
LMDB_AboutGeneral = Informazioni generali
LMDB_AboutResources = Risorse
+
+LMDB_AboutVersion = Versione
+LMDB_AboutFamily = Famiglia
+LMDB_AboutModuleDescription = Descrizione
+LMDB_AboutMaintainer = Manutentore
+LMDB_AboutDocumentation = Documentazione
+LMDB_AboutDocumentationLink = Apri README
+LMDB_AboutSupport = Supporto
+LMDB_AboutSupportValue = Contattare il manutentore per il supporto.
+LMDB_AboutContact = Contatto
\ No newline at end of file