From 959b104b78674966984ac45f79cd08f54ff7906c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Tue, 6 May 2014 13:31:30 +0200 Subject: [PATCH] Fix: the pdf template name for typhon as not correctly set when enabling module. --- htdocs/core/lib/functions2.lib.php | 1 + htdocs/core/modules/modExpedition.class.php | 7 +++---- htdocs/install/mysql/migration/repair.sql | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index e7eb9ccf0b0..256dc205dd0 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1286,6 +1286,7 @@ function getListOfModels($db,$type,$maxfilenamelength=0) $sql.= " WHERE type = '".$type."'"; $sql.= " AND entity IN (0,".(! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)?"1,":"").$conf->entity.")"; + dol_syslog(get_class($this).'::getListOfModels sql='.$sql, LOG_DEBUG); $resql = $db->query($sql); if ($resql) { diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index b14b72ffdc3..9c4a6137d61 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -97,13 +97,13 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $r++; $this->const[$r][0] = "EXPEDITION_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/shipment"; $this->const[$r][3] = ""; $this->const[$r][4] = 0; - + $r++; + $this->const[$r][0] = "LIVRAISON_ADDON_PDF"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "typhon"; @@ -118,7 +118,6 @@ class modExpedition extends DolibarrModules $this->const[$r][4] = 0; $r++; - $r++; $this->const[$r][0] = "LIVRAISON_ADDON_PDF_ODT_PATH"; $this->const[$r][1] = "chaine"; $this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/delivery"; @@ -272,7 +271,7 @@ class modExpedition extends DolibarrModules "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity, "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','shipping',".$conf->entity.")", "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[2][2]."' AND entity = ".$conf->entity, - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[2][2]."','delivery',".$conf->entity.")", + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[3][2]."','delivery',".$conf->entity.")", ); return $this->_init($sql,$options); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index a058588ddef..41b230516d5 100644 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -5,6 +5,7 @@ -- Requests to clean corrupted database + -- delete foreign key that should never exists ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency; ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency; @@ -76,8 +77,9 @@ UPDATE llx_product SET canvas = NULL where canvas = 'service@product'; DELETE FROM llx_boxes where box_id NOT IN (SELECT rowid FROM llx_boxes_def); +update llx_document_model set nom = 'typhon' where (nom = '' OR nom is null) and type = 'delivery'; DELETE FROM llx_document_model WHERE nom ='elevement' AND type='delivery'; -DELETE FROM llx_document_model WHERE nom ='' AND type='delivery'; + -- Fix: It seems this is missing for some users insert into llx_c_actioncomm (id, code, type, libelle, module, position) values ( 1, 'AC_TEL', 'system', 'Phone call' ,NULL, 2); -- GitLab