@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | |
32 | 32 | require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; |
33 | -require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit |
|
33 | +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit |
|
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; |
35 | 35 | |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | abstract class ModelePDFCommandes extends CommonDocGenerator |
41 | 41 | { |
42 | - var $error=''; |
|
42 | + var $error = ''; |
|
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Return list of active generation modules |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | * @param integer $maxfilenamelength Max length of value to show |
49 | 49 | * @return array List of templates |
50 | 50 | */ |
51 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
51 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
52 | 52 | { |
53 | 53 | global $conf; |
54 | 54 | |
55 | - $type='order'; |
|
56 | - $liste=array(); |
|
55 | + $type = 'order'; |
|
56 | + $liste = array(); |
|
57 | 57 | |
58 | 58 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
59 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
59 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
60 | 60 | |
61 | 61 | return $liste; |
62 | 62 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | abstract class ModeleNumRefCommandes |
73 | 73 | { |
74 | - var $error=''; |
|
74 | + var $error = ''; |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Return if a module can be used or not |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param Object $object Object we need next value for |
125 | 125 | * @return string Valeur |
126 | 126 | */ |
127 | - function getNextValue($objsoc,$object) |
|
127 | + function getNextValue($objsoc, $object) |
|
128 | 128 | { |
129 | 129 | global $langs; |
130 | 130 | return $langs->trans("NotAvailable"); |
@@ -140,10 +140,18 @@ |
||
140 | 140 | global $langs; |
141 | 141 | $langs->load("admin"); |
142 | 142 | |
143 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
144 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
145 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
146 | - if ($this->version) return $this->version; |
|
143 | + if ($this->version == 'development') { |
|
144 | + return $langs->trans("VersionDevelopment"); |
|
145 | + } |
|
146 | + if ($this->version == 'experimental') { |
|
147 | + return $langs->trans("VersionExperimental"); |
|
148 | + } |
|
149 | + if ($this->version == 'dolibarr') { |
|
150 | + return DOL_VERSION; |
|
151 | + } |
|
152 | + if ($this->version) { |
|
153 | + return $this->version; |
|
154 | + } |
|
147 | 155 | return $langs->trans("NotAvailable"); |
148 | 156 | } |
149 | 157 | } |
150 | 158 | \ No newline at end of file |
@@ -37,9 +37,9 @@ |
||
37 | 37 | /** |
38 | 38 | * Return list of active generation modules |
39 | 39 | * |
40 | - * @param DoliDB $db Database handler |
|
41 | - * @param integer $maxfilenamelength Max length of value to show |
|
42 | - * @return array List of templates |
|
40 | + * @param DoliDB $db Database handler |
|
41 | + * @param integer $maxfilenamelength Max length of value to show |
|
42 | + * @return array List of templates |
|
43 | 43 | */ |
44 | 44 | static function liste_modeles($db,$maxfilenamelength=0) |
45 | 45 | { |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct($db) |
42 | 42 | { |
43 | - global $langs,$conf; |
|
43 | + global $langs,$conf; |
|
44 | 44 | |
45 | - $this->db = $db; |
|
45 | + $this->db = $db; |
|
46 | 46 | |
47 | 47 | // Id for module (must be unique). |
48 | 48 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
@@ -77,28 +77,28 @@ discard block |
||
77 | 77 | array('INCOTERM_ACTIVATE', 'chaine', 0, 'Description de INCOTERM_ACTIVATE') |
78 | 78 | ); |
79 | 79 | |
80 | - $this->tabs = array(); |
|
80 | + $this->tabs = array(); |
|
81 | 81 | |
82 | - // Dictionaries |
|
82 | + // Dictionaries |
|
83 | 83 | if (! isset($conf->incoterm->enabled)) |
84 | - { |
|
85 | - $conf->incoterm=new stdClass(); |
|
86 | - $conf->incoterm->enabled=0; |
|
87 | - } |
|
84 | + { |
|
85 | + $conf->incoterm=new stdClass(); |
|
86 | + $conf->incoterm->enabled=0; |
|
87 | + } |
|
88 | 88 | $this->dictionaries=array( |
89 | 89 | 'langs'=>'incoterm', |
90 | - 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | - 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | - 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | - 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | - 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | - 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | - 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | - 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
98 | - 'tabcond'=>array($conf->incoterm->enabled) |
|
90 | + 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | + 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | + 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | + 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | + 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | + 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | + 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | + 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
98 | + 'tabcond'=>array($conf->incoterm->enabled) |
|
99 | 99 | ); |
100 | 100 | |
101 | - $this->boxes = array(); // List of boxes |
|
101 | + $this->boxes = array(); // List of boxes |
|
102 | 102 | $r=0; |
103 | 103 | |
104 | 104 | // Permissions |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * \ingroup mymodule |
26 | 26 | * \brief Description and activation file for module MyModule |
27 | 27 | */ |
28 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
28 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
29 | 29 | |
30 | 30 | |
31 | 31 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | function __construct($db) |
42 | 42 | { |
43 | - global $langs,$conf; |
|
43 | + global $langs, $conf; |
|
44 | 44 | |
45 | 45 | $this->db = $db; |
46 | 46 | |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | |
53 | 53 | // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' |
54 | 54 | $this->family = "srm"; |
55 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
55 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
56 | 56 | $this->description = "Incoterm management"; |
57 | 57 | $this->version = 'dolibarr'; |
58 | 58 | // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) |
61 | 61 | $this->special = 0; |
62 | - $this->picto='generic'; |
|
62 | + $this->picto = 'generic'; |
|
63 | 63 | |
64 | 64 | $this->module_parts = array(); |
65 | 65 | $this->dirs = array(); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $this->config_page_url = array(); |
68 | 68 | |
69 | 69 | // Dependencies |
70 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | - $this->phpmin = array(5,0); // Minimum version of PHP required by module |
|
73 | - $this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module |
|
70 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
71 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
72 | + $this->phpmin = array(5, 0); // Minimum version of PHP required by module |
|
73 | + $this->need_dolibarr_version = array(3, 0); // Minimum version of Dolibarr required by module |
|
74 | 74 | $this->langfiles = array("incoterm"); |
75 | 75 | |
76 | 76 | $this->const = array( |
@@ -80,33 +80,33 @@ discard block |
||
80 | 80 | $this->tabs = array(); |
81 | 81 | |
82 | 82 | // Dictionaries |
83 | - if (! isset($conf->incoterm->enabled)) |
|
83 | + if (!isset($conf->incoterm->enabled)) |
|
84 | 84 | { |
85 | - $conf->incoterm=new stdClass(); |
|
86 | - $conf->incoterm->enabled=0; |
|
85 | + $conf->incoterm = new stdClass(); |
|
86 | + $conf->incoterm->enabled = 0; |
|
87 | 87 | } |
88 | - $this->dictionaries=array( |
|
88 | + $this->dictionaries = array( |
|
89 | 89 | 'langs'=>'incoterm', |
90 | - 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | - 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | - 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | - 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | - 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | - 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | - 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | - 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
90 | + 'tabname'=>array(MAIN_DB_PREFIX."c_incoterms"), // List of tables we want to see into dictonnary editor |
|
91 | + 'tablib'=>array("Incoterms"), // Label of tables |
|
92 | + 'tabsql'=>array('SELECT rowid, code, libelle, active FROM '.MAIN_DB_PREFIX.'c_incoterms'), // Request to select fields |
|
93 | + 'tabsqlsort'=>array("rowid ASC"), // Sort order |
|
94 | + 'tabfield'=>array("code,libelle"), // List of fields (result of select to show dictionary) |
|
95 | + 'tabfieldvalue'=>array("code,libelle"), // List of fields (list of fields to edit a record) |
|
96 | + 'tabfieldinsert'=>array("code,libelle"), // List of fields (list of fields for insert) |
|
97 | + 'tabrowid'=>array("rowid"), // Name of columns with primary key (try to always name it 'rowid') |
|
98 | 98 | 'tabcond'=>array($conf->incoterm->enabled) |
99 | 99 | ); |
100 | 100 | |
101 | - $this->boxes = array(); // List of boxes |
|
102 | - $r=0; |
|
101 | + $this->boxes = array(); // List of boxes |
|
102 | + $r = 0; |
|
103 | 103 | |
104 | 104 | // Permissions |
105 | - $this->rights = array(); // Permission array used by this module |
|
106 | - $r=0; |
|
105 | + $this->rights = array(); // Permission array used by this module |
|
106 | + $r = 0; |
|
107 | 107 | |
108 | 108 | // Main menu entries |
109 | - $this->menus = array(); // List of menus to add |
|
110 | - $r=0; |
|
109 | + $this->menus = array(); // List of menus to add |
|
110 | + $r = 0; |
|
111 | 111 | } |
112 | 112 | } |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * Return list of active generation modules |
42 | 42 | * |
43 | - * @param DoliDB $db Database handler |
|
44 | - * @param integer $maxfilenamelength Max length of value to show |
|
45 | - * @return array List of templates |
|
43 | + * @param DoliDB $db Database handler |
|
44 | + * @param integer $maxfilenamelength Max length of value to show |
|
45 | + * @return array List of templates |
|
46 | 46 | */ |
47 | 47 | static function liste_modeles($db,$maxfilenamelength=0) |
48 | 48 | { |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | |
179 | 179 | // If selected modele is a filename template (then $modele="modelname:filename") |
180 | 180 | $tmp=explode(':',$modele,2); |
181 | - if (! empty($tmp[1])) |
|
182 | - { |
|
183 | - $modele=$tmp[0]; |
|
184 | - $srctemplatepath=$tmp[1]; |
|
185 | - } |
|
181 | + if (! empty($tmp[1])) |
|
182 | + { |
|
183 | + $modele=$tmp[0]; |
|
184 | + $srctemplatepath=$tmp[1]; |
|
185 | + } |
|
186 | 186 | |
187 | 187 | // Search template files |
188 | 188 | $file=''; $classname=''; $filefound=0; |
@@ -190,21 +190,21 @@ discard block |
||
190 | 190 | if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
191 | 191 | foreach($dirmodels as $reldir) |
192 | 192 | { |
193 | - foreach(array('doc','pdf') as $prefix) |
|
194 | - { |
|
195 | - $file = $prefix."_".$modele.".modules.php"; |
|
196 | - |
|
197 | - // On verifie l'emplacement du modele |
|
198 | - $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
199 | - if (file_exists($file)) |
|
200 | - { |
|
201 | - $filefound=1; |
|
202 | - $classname=$prefix.'_'.$modele; |
|
203 | - break; |
|
204 | - } |
|
205 | - } |
|
206 | - if ($filefound) break; |
|
207 | - } |
|
193 | + foreach(array('doc','pdf') as $prefix) |
|
194 | + { |
|
195 | + $file = $prefix."_".$modele.".modules.php"; |
|
196 | + |
|
197 | + // On verifie l'emplacement du modele |
|
198 | + $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
199 | + if (file_exists($file)) |
|
200 | + { |
|
201 | + $filefound=1; |
|
202 | + $classname=$prefix.'_'.$modele; |
|
203 | + break; |
|
204 | + } |
|
205 | + } |
|
206 | + if ($filefound) break; |
|
207 | + } |
|
208 | 208 | |
209 | 209 | // Charge le modele |
210 | 210 | if ($filefound) |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | abstract class ModelePDFFicheinter extends CommonDocGenerator |
36 | 36 | { |
37 | - var $error=''; |
|
37 | + var $error = ''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @param integer $maxfilenamelength Max length of value to show |
45 | 45 | * @return array List of templates |
46 | 46 | */ |
47 | - static function liste_modeles($db,$maxfilenamelength=0) |
|
47 | + static function liste_modeles($db, $maxfilenamelength = 0) |
|
48 | 48 | { |
49 | 49 | global $conf; |
50 | 50 | |
51 | - $type='ficheinter'; |
|
52 | - $liste=array(); |
|
51 | + $type = 'ficheinter'; |
|
52 | + $liste = array(); |
|
53 | 53 | |
54 | 54 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
55 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
55 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
56 | 56 | |
57 | 57 | return $liste; |
58 | 58 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | abstract class ModeleNumRefFicheinter |
67 | 67 | { |
68 | - var $error=''; |
|
68 | + var $error = ''; |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Return if a module can be used or not |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | * @param int $hideref Hide ref |
155 | 155 | * @return int 0 if KO, 1 if OK |
156 | 156 | */ |
157 | -function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) |
|
157 | +function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) |
|
158 | 158 | { |
159 | - global $conf,$langs,$user; |
|
159 | + global $conf, $langs, $user; |
|
160 | 160 | $langs->load("ficheinter"); |
161 | 161 | |
162 | - $error=0; |
|
162 | + $error = 0; |
|
163 | 163 | |
164 | - $srctemplatepath=''; |
|
164 | + $srctemplatepath = ''; |
|
165 | 165 | |
166 | 166 | // Positionne modele sur le nom du modele de fichinter a utiliser |
167 | - if (! dol_strlen($modele)) |
|
167 | + if (!dol_strlen($modele)) |
|
168 | 168 | { |
169 | - if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
169 | + if (!empty($conf->global->FICHEINTER_ADDON_PDF)) |
|
170 | 170 | { |
171 | 171 | $modele = $conf->global->FICHEINTER_ADDON_PDF; |
172 | 172 | } |
@@ -177,29 +177,29 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // If selected modele is a filename template (then $modele="modelname:filename") |
180 | - $tmp=explode(':',$modele,2); |
|
181 | - if (! empty($tmp[1])) |
|
180 | + $tmp = explode(':', $modele, 2); |
|
181 | + if (!empty($tmp[1])) |
|
182 | 182 | { |
183 | - $modele=$tmp[0]; |
|
184 | - $srctemplatepath=$tmp[1]; |
|
183 | + $modele = $tmp[0]; |
|
184 | + $srctemplatepath = $tmp[1]; |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | // Search template files |
188 | - $file=''; $classname=''; $filefound=0; |
|
189 | - $dirmodels=array('/'); |
|
190 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
191 | - foreach($dirmodels as $reldir) |
|
188 | + $file = ''; $classname = ''; $filefound = 0; |
|
189 | + $dirmodels = array('/'); |
|
190 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
191 | + foreach ($dirmodels as $reldir) |
|
192 | 192 | { |
193 | - foreach(array('doc','pdf') as $prefix) |
|
193 | + foreach (array('doc', 'pdf') as $prefix) |
|
194 | 194 | { |
195 | 195 | $file = $prefix."_".$modele.".modules.php"; |
196 | 196 | |
197 | 197 | // On verifie l'emplacement du modele |
198 | - $file=dol_buildpath($reldir."core/modules/fichinter/doc/".$file,0); |
|
198 | + $file = dol_buildpath($reldir."core/modules/fichinter/doc/".$file, 0); |
|
199 | 199 | if (file_exists($file)) |
200 | 200 | { |
201 | - $filefound=1; |
|
202 | - $classname=$prefix.'_'.$modele; |
|
201 | + $filefound = 1; |
|
202 | + $classname = $prefix.'_'.$modele; |
|
203 | 203 | break; |
204 | 204 | } |
205 | 205 | } |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | |
216 | 216 | // We save charset_output to restore it because write_file can change it if needed for |
217 | 217 | // output format that does not support UTF8. |
218 | - $sav_charset_output=$outputlangs->charset_output; |
|
218 | + $sav_charset_output = $outputlangs->charset_output; |
|
219 | 219 | if ($obj->write_file($object, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref) > 0) |
220 | 220 | { |
221 | - $outputlangs->charset_output=$sav_charset_output; |
|
221 | + $outputlangs->charset_output = $sav_charset_output; |
|
222 | 222 | |
223 | 223 | // We delete old preview |
224 | 224 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
@@ -228,14 +228,14 @@ discard block |
||
228 | 228 | } |
229 | 229 | else |
230 | 230 | { |
231 | - $outputlangs->charset_output=$sav_charset_output; |
|
232 | - dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
|
231 | + $outputlangs->charset_output = $sav_charset_output; |
|
232 | + dol_print_error($db, "fichinter_pdf_create Error: ".$obj->error); |
|
233 | 233 | return 0; |
234 | 234 | } |
235 | 235 | } |
236 | 236 | else |
237 | 237 | { |
238 | - print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
|
238 | + print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); |
|
239 | 239 | return 0; |
240 | 240 | } |
241 | 241 | } |
@@ -133,10 +133,18 @@ discard block |
||
133 | 133 | global $langs; |
134 | 134 | $langs->load("admin"); |
135 | 135 | |
136 | - if ($this->version == 'development') return $langs->trans("VersionDevelopment"); |
|
137 | - if ($this->version == 'experimental') return $langs->trans("VersionExperimental"); |
|
138 | - if ($this->version == 'dolibarr') return DOL_VERSION; |
|
139 | - if ($this->version) return $this->version; |
|
136 | + if ($this->version == 'development') { |
|
137 | + return $langs->trans("VersionDevelopment"); |
|
138 | + } |
|
139 | + if ($this->version == 'experimental') { |
|
140 | + return $langs->trans("VersionExperimental"); |
|
141 | + } |
|
142 | + if ($this->version == 'dolibarr') { |
|
143 | + return DOL_VERSION; |
|
144 | + } |
|
145 | + if ($this->version) { |
|
146 | + return $this->version; |
|
147 | + } |
|
140 | 148 | return $langs->trans("NotAvailable"); |
141 | 149 | } |
142 | 150 | } |
@@ -169,8 +177,7 @@ discard block |
||
169 | 177 | if (! empty($conf->global->FICHEINTER_ADDON_PDF)) |
170 | 178 | { |
171 | 179 | $modele = $conf->global->FICHEINTER_ADDON_PDF; |
172 | - } |
|
173 | - else |
|
180 | + } else |
|
174 | 181 | { |
175 | 182 | $modele = 'soleil'; |
176 | 183 | } |
@@ -187,7 +194,9 @@ discard block |
||
187 | 194 | // Search template files |
188 | 195 | $file=''; $classname=''; $filefound=0; |
189 | 196 | $dirmodels=array('/'); |
190 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
197 | + if (is_array($conf->modules_parts['models'])) { |
|
198 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
199 | + } |
|
191 | 200 | foreach($dirmodels as $reldir) |
192 | 201 | { |
193 | 202 | foreach(array('doc','pdf') as $prefix) |
@@ -203,7 +212,9 @@ discard block |
||
203 | 212 | break; |
204 | 213 | } |
205 | 214 | } |
206 | - if ($filefound) break; |
|
215 | + if ($filefound) { |
|
216 | + break; |
|
217 | + } |
|
207 | 218 | } |
208 | 219 | |
209 | 220 | // Charge le modele |
@@ -225,15 +236,13 @@ discard block |
||
225 | 236 | dol_delete_preview($object); |
226 | 237 | |
227 | 238 | return 1; |
228 | - } |
|
229 | - else |
|
239 | + } else |
|
230 | 240 | { |
231 | 241 | $outputlangs->charset_output=$sav_charset_output; |
232 | 242 | dol_print_error($db,"fichinter_pdf_create Error: ".$obj->error); |
233 | 243 | return 0; |
234 | 244 | } |
235 | - } |
|
236 | - else |
|
245 | + } else |
|
237 | 246 | { |
238 | 247 | print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file); |
239 | 248 | return 0; |
@@ -32,64 +32,64 @@ discard block |
||
32 | 32 | class modWorkflow extends DolibarrModules |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
35 | + /** |
|
36 | 36 | * Constructor. Define names, constants, directories, boxes, permissions |
37 | 37 | * |
38 | 38 | * @param DoliDB $db Database handler |
39 | - */ |
|
40 | - function __construct($db) |
|
41 | - { |
|
42 | - $this->db = $db; |
|
43 | - |
|
44 | - // Id for module (must be unique). |
|
45 | - // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
46 | - $this->numero = 6000 ; |
|
47 | - // Key text used to identify module (for permissions, menus, etc...) |
|
48 | - $this->rights_class = 'workflow'; |
|
49 | - |
|
50 | - $this->family = "technic"; |
|
51 | - // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | - // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | - $this->description = "Workflow management"; |
|
55 | - // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
56 | - $this->version = 'dolibarr'; |
|
57 | - // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
58 | - $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | - // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) |
|
60 | - $this->special = 2; |
|
61 | - // Name of png file (without png) used for this module. |
|
62 | - // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
63 | - // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
64 | - $this->picto='technic'; |
|
65 | - |
|
66 | - // Data directories to create when module is enabled |
|
67 | - $this->dirs = array("/workflow/temp"); |
|
68 | - |
|
69 | - // Config pages. Put here list of php page names stored in admmin directory used to setup module. |
|
70 | - $this->config_page_url = array('workflow.php'); |
|
71 | - |
|
72 | - // Dependencies |
|
73 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | - $this->phpmin = array(5,2); // Minimum version of PHP required by module |
|
76 | - $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module |
|
77 | - $this->langfiles = array("@workflow"); |
|
78 | - |
|
79 | - // Constants |
|
80 | - // List of particular constants to add when module is enabled |
|
81 | - //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), |
|
82 | - // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); |
|
83 | - $this->const=array(); |
|
84 | - |
|
85 | - // Boxes |
|
86 | - $this->boxes = array(); |
|
87 | - |
|
88 | - // Permissions |
|
89 | - $this->rights = array(); |
|
90 | - $r=0; |
|
91 | - |
|
92 | - /* |
|
39 | + */ |
|
40 | + function __construct($db) |
|
41 | + { |
|
42 | + $this->db = $db; |
|
43 | + |
|
44 | + // Id for module (must be unique). |
|
45 | + // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
|
46 | + $this->numero = 6000 ; |
|
47 | + // Key text used to identify module (for permissions, menus, etc...) |
|
48 | + $this->rights_class = 'workflow'; |
|
49 | + |
|
50 | + $this->family = "technic"; |
|
51 | + // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
|
52 | + $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | + // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
|
54 | + $this->description = "Workflow management"; |
|
55 | + // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
|
56 | + $this->version = 'dolibarr'; |
|
57 | + // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) |
|
58 | + $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
|
59 | + // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) |
|
60 | + $this->special = 2; |
|
61 | + // Name of png file (without png) used for this module. |
|
62 | + // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
|
63 | + // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
|
64 | + $this->picto='technic'; |
|
65 | + |
|
66 | + // Data directories to create when module is enabled |
|
67 | + $this->dirs = array("/workflow/temp"); |
|
68 | + |
|
69 | + // Config pages. Put here list of php page names stored in admmin directory used to setup module. |
|
70 | + $this->config_page_url = array('workflow.php'); |
|
71 | + |
|
72 | + // Dependencies |
|
73 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | + $this->phpmin = array(5,2); // Minimum version of PHP required by module |
|
76 | + $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module |
|
77 | + $this->langfiles = array("@workflow"); |
|
78 | + |
|
79 | + // Constants |
|
80 | + // List of particular constants to add when module is enabled |
|
81 | + //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), |
|
82 | + // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); |
|
83 | + $this->const=array(); |
|
84 | + |
|
85 | + // Boxes |
|
86 | + $this->boxes = array(); |
|
87 | + |
|
88 | + // Permissions |
|
89 | + $this->rights = array(); |
|
90 | + $r=0; |
|
91 | + |
|
92 | + /* |
|
93 | 93 | $r++; |
94 | 94 | $this->rights[$r][0] = 6001; // id de la permission |
95 | 95 | $this->rights[$r][1] = "Lire les workflow"; // libelle de la permission |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | $this->rights[$r][4] = 'read'; |
99 | 99 | */ |
100 | 100 | |
101 | - // Main menu entries |
|
102 | - $this->menus = array(); // List of menus to add |
|
103 | - $r=0; |
|
104 | - /* |
|
101 | + // Main menu entries |
|
102 | + $this->menus = array(); // List of menus to add |
|
103 | + $r=0; |
|
104 | + /* |
|
105 | 105 | $this->menu[$r]=array('fk_menu'=>0, |
106 | 106 | 'type'=>'top', |
107 | 107 | 'titre'=>'Workflow', |
@@ -128,24 +128,24 @@ discard block |
||
128 | 128 | 'user'=>0); |
129 | 129 | $r++; |
130 | 130 | */ |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | 133 | |
134 | - /** |
|
134 | + /** |
|
135 | 135 | * Function called when module is enabled. |
136 | 136 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
137 | 137 | * It also creates data directories |
138 | 138 | * |
139 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
139 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
140 | 140 | * @return int 1 if OK, 0 if KO |
141 | - */ |
|
142 | - function init($options='') |
|
143 | - { |
|
141 | + */ |
|
142 | + function init($options='') |
|
143 | + { |
|
144 | 144 | // Permissions |
145 | 145 | $this->remove($options); |
146 | 146 | |
147 | 147 | $sql = array(); |
148 | 148 | |
149 | - return $this->_init($sql,$options); |
|
150 | - } |
|
149 | + return $this->_init($sql,$options); |
|
150 | + } |
|
151 | 151 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup workflow |
24 | 24 | * \brief File to describe and activate module Workflow |
25 | 25 | */ |
26 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
26 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | |
44 | 44 | // Id for module (must be unique). |
45 | 45 | // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). |
46 | - $this->numero = 6000 ; |
|
46 | + $this->numero = 6000; |
|
47 | 47 | // Key text used to identify module (for permissions, menus, etc...) |
48 | 48 | $this->rights_class = 'workflow'; |
49 | 49 | |
50 | 50 | $this->family = "technic"; |
51 | 51 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
52 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
52 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
53 | 53 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
54 | 54 | $this->description = "Workflow management"; |
55 | 55 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | // Name of png file (without png) used for this module. |
62 | 62 | // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' |
63 | 63 | // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' |
64 | - $this->picto='technic'; |
|
64 | + $this->picto = 'technic'; |
|
65 | 65 | |
66 | 66 | // Data directories to create when module is enabled |
67 | 67 | $this->dirs = array("/workflow/temp"); |
@@ -70,24 +70,24 @@ discard block |
||
70 | 70 | $this->config_page_url = array('workflow.php'); |
71 | 71 | |
72 | 72 | // Dependencies |
73 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | - $this->phpmin = array(5,2); // Minimum version of PHP required by module |
|
76 | - $this->need_dolibarr_version = array(2,8); // Minimum version of Dolibarr required by module |
|
73 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
74 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
75 | + $this->phpmin = array(5, 2); // Minimum version of PHP required by module |
|
76 | + $this->need_dolibarr_version = array(2, 8); // Minimum version of Dolibarr required by module |
|
77 | 77 | $this->langfiles = array("@workflow"); |
78 | 78 | |
79 | 79 | // Constants |
80 | 80 | // List of particular constants to add when module is enabled |
81 | 81 | //Example: $this->const=array(0=>array('MODULE_MY_NEW_CONST1','chaine','myvalue','This is a constant to add',0), |
82 | 82 | // 1=>array('MODULE_MY_NEW_CONST2','chaine','myvalue','This is another constant to add',0) ); |
83 | - $this->const=array(); |
|
83 | + $this->const = array(); |
|
84 | 84 | |
85 | 85 | // Boxes |
86 | 86 | $this->boxes = array(); |
87 | 87 | |
88 | 88 | // Permissions |
89 | 89 | $this->rights = array(); |
90 | - $r=0; |
|
90 | + $r = 0; |
|
91 | 91 | |
92 | 92 | /* |
93 | 93 | $r++; |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | */ |
100 | 100 | |
101 | 101 | // Main menu entries |
102 | - $this->menus = array(); // List of menus to add |
|
103 | - $r=0; |
|
102 | + $this->menus = array(); // List of menus to add |
|
103 | + $r = 0; |
|
104 | 104 | /* |
105 | 105 | $this->menu[$r]=array('fk_menu'=>0, |
106 | 106 | 'type'=>'top', |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | * @param string $options Options when enabling module ('', 'noboxes') |
140 | 140 | * @return int 1 if OK, 0 if KO |
141 | 141 | */ |
142 | - function init($options='') |
|
142 | + function init($options = '') |
|
143 | 143 | { |
144 | 144 | // Permissions |
145 | 145 | $this->remove($options); |
146 | 146 | |
147 | 147 | $sql = array(); |
148 | 148 | |
149 | - return $this->_init($sql,$options); |
|
149 | + return $this->_init($sql, $options); |
|
150 | 150 | } |
151 | 151 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
150 | 150 | $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'chargesociales'); |
151 | 151 | $this->import_fields_array[$r]=array('t.libelle'=>"Label*",'t.fk_type'=>"Type", |
152 | - 't.amount'=>"Amount*",'t.date_ech'=>"DateDue*",'t.periode'=>"PeriodEndDate*" |
|
152 | + 't.amount'=>"Amount*",'t.date_ech'=>"DateDue*",'t.periode'=>"PeriodEndDate*" |
|
153 | 153 | ); |
154 | 154 | |
155 | 155 | $this->import_convertvalue_array[$r]=array( |
156 | - 't.fk_type'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/sociales/class/cchargesociales.class.php','class'=>'Cchargesociales','method'=>'fetch','element'=>'Cchargesociales') |
|
156 | + 't.fk_type'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/sociales/class/cchargesociales.class.php','class'=>'Cchargesociales','method'=>'fetch','element'=>'Cchargesociales') |
|
157 | 157 | ); |
158 | 158 | $this->import_examplevalues_array[$r]=array('t.libelle'=>"Social/fiscal contribution",'t.fk_type'=>"TAXPRO (must be id or code found into dictionary)", |
159 | - 't.date_ech'=>"2016-01-01", 't.periode'=>"2016-01-01" |
|
159 | + 't.date_ech'=>"2016-01-01", 't.periode'=>"2016-01-01" |
|
160 | 160 | ); |
161 | 161 | |
162 | 162 | // Import Taxes |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
168 | 168 | $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'tva'); |
169 | 169 | $this->import_fields_array[$r]=array('t.datep'=>"DatePayment*",'t.datev'=>"DateValue*",'t.label'=>"Label*",'t.fk_typepayment'=>"PaymentMode*", |
170 | - 't.amount'=>"Amount*",'t.num_payment'=>'Numero' |
|
170 | + 't.amount'=>"Amount*",'t.num_payment'=>'Numero' |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | $this->import_convertvalue_array[$r]=array( |
174 | - 't.fk_typepayment'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/paiement/class/cpaiement.class.php','class'=>'Cpaiement','method'=>'fetch','element'=>'Cpaiement') |
|
174 | + 't.fk_typepayment'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/paiement/class/cpaiement.class.php','class'=>'Cpaiement','method'=>'fetch','element'=>'Cpaiement') |
|
175 | 175 | ); |
176 | 176 | $this->import_examplevalues_array[$r]=array('t.label'=>"VAT Payment 1st quarter 2016",'t.fk_typepayment'=>"CHQ (must be id or code found into dictionary)", |
177 | - 't.datep'=>"2016-04-02", 't.datev'=>"2016-03-31", 't.amount'=>1000, 't.num_payment'=>'123456' |
|
177 | + 't.datep'=>"2016-04-02", 't.datev'=>"2016-03-31", 't.amount'=>1000, 't.num_payment'=>'123456' |
|
178 | 178 | ); |
179 | 179 | |
180 | 180 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
186 | 186 | * It also creates data directories |
187 | 187 | * |
188 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
188 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
189 | 189 | * @return int 1 if OK, 0 if KO |
190 | 190 | */ |
191 | 191 | function init($options='') |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * \ingroup tax |
28 | 28 | * \brief Fichier de description et activation du module Taxe |
29 | 29 | */ |
30 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
30 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
31 | 31 | |
32 | 32 | |
33 | 33 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->family = "financial"; |
52 | 52 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
53 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
54 | 54 | // Module description used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
55 | 55 | $this->description = "Gestion des taxes, charges sociales et dividendes"; |
56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
61 | 61 | $this->special = 0; |
62 | - $this->picto='bill'; |
|
62 | + $this->picto = 'bill'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | 65 | $this->dirs = array("/tax/temp"); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->depends = array(); |
72 | 72 | $this->requiredby = array(); |
73 | 73 | $this->conflictwith = array(); |
74 | - $this->langfiles = array("compta","bills"); |
|
74 | + $this->langfiles = array("compta", "bills"); |
|
75 | 75 | |
76 | 76 | // Constants |
77 | 77 | $this->const = array(); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // Permissions |
83 | 83 | $this->rights = array(); |
84 | 84 | $this->rights_class = 'tax'; |
85 | - $r=0; |
|
85 | + $r = 0; |
|
86 | 86 | |
87 | 87 | $r++; |
88 | 88 | $this->rights[$r][0] = 91; |
@@ -120,60 +120,60 @@ discard block |
||
120 | 120 | // Menus |
121 | 121 | //------- |
122 | 122 | |
123 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
123 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
124 | 124 | |
125 | 125 | |
126 | 126 | // Exports |
127 | 127 | //-------- |
128 | - $r=0; |
|
128 | + $r = 0; |
|
129 | 129 | |
130 | 130 | $r++; |
131 | - $this->export_code[$r]=$this->rights_class.'_'.$r; |
|
132 | - $this->export_label[$r]='Taxes et charges sociales, et leurs reglements'; |
|
133 | - $this->export_permission[$r]=array(array("tax","charges","export")); |
|
134 | - $this->export_fields_array[$r]=array('cc.libelle'=>"Type",'c.rowid'=>"IdSocialContribution",'c.libelle'=>"Label",'c.date_ech'=>'DateDue','c.periode'=>'Period','c.amount'=>"AmountExpected","c.paye"=>"Status",'p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero'); |
|
135 | - $this->export_TypeFields_array[$r]=array('cc.libelle'=>"List:c_chargesociales:libelle:id",'c.libelle'=>"Text",'c.date_ech'=>'Date','c.periode'=>'Period','c.amount'=>"Numeric","c.paye"=>"Boolean",'p.datep'=>'Date','p.amount'=>'Numeric','p.num_paiement'=>'Numeric'); |
|
136 | - $this->export_entities_array[$r]=array('cc.libelle'=>"tax_type",'c.rowid'=>"tax",'c.libelle'=>'tax','c.date_ech'=>'tax','c.periode'=>'tax','c.amount'=>"tax","c.paye"=>"tax",'p.rowid'=>'payment','p.datep'=>'payment','p.amount'=>'payment','p.num_paiement'=>'payment'); |
|
137 | - |
|
138 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
139 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c'; |
|
140 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid'; |
|
141 | - $this->export_sql_end[$r] .=' WHERE c.fk_type = cc.id'; |
|
142 | - $this->export_sql_end[$r] .=' AND c.entity IN ('.getEntity('tax').')'; |
|
131 | + $this->export_code[$r] = $this->rights_class.'_'.$r; |
|
132 | + $this->export_label[$r] = 'Taxes et charges sociales, et leurs reglements'; |
|
133 | + $this->export_permission[$r] = array(array("tax", "charges", "export")); |
|
134 | + $this->export_fields_array[$r] = array('cc.libelle'=>"Type", 'c.rowid'=>"IdSocialContribution", 'c.libelle'=>"Label", 'c.date_ech'=>'DateDue', 'c.periode'=>'Period', 'c.amount'=>"AmountExpected", "c.paye"=>"Status", 'p.rowid'=>'PaymentId', 'p.datep'=>'DatePayment', 'p.amount'=>'AmountPayment', 'p.num_paiement'=>'Numero'); |
|
135 | + $this->export_TypeFields_array[$r] = array('cc.libelle'=>"List:c_chargesociales:libelle:id", 'c.libelle'=>"Text", 'c.date_ech'=>'Date', 'c.periode'=>'Period', 'c.amount'=>"Numeric", "c.paye"=>"Boolean", 'p.datep'=>'Date', 'p.amount'=>'Numeric', 'p.num_paiement'=>'Numeric'); |
|
136 | + $this->export_entities_array[$r] = array('cc.libelle'=>"tax_type", 'c.rowid'=>"tax", 'c.libelle'=>'tax', 'c.date_ech'=>'tax', 'c.periode'=>'tax', 'c.amount'=>"tax", "c.paye"=>"tax", 'p.rowid'=>'payment', 'p.datep'=>'payment', 'p.amount'=>'payment', 'p.num_paiement'=>'payment'); |
|
137 | + |
|
138 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
139 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'c_chargesociales as cc, '.MAIN_DB_PREFIX.'chargesociales as c'; |
|
140 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementcharge as p ON p.fk_charge = c.rowid'; |
|
141 | + $this->export_sql_end[$r] .= ' WHERE c.fk_type = cc.id'; |
|
142 | + $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('tax').')'; |
|
143 | 143 | |
144 | 144 | // Import social contributions |
145 | 145 | $r++; |
146 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
147 | - $this->import_label[$r]="ImportDataset_tax_contrib"; // Translation key |
|
148 | - $this->import_icon[$r]='tax'; |
|
149 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
150 | - $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'chargesociales'); |
|
151 | - $this->import_fields_array[$r]=array('t.libelle'=>"Label*",'t.fk_type'=>"Type", |
|
152 | - 't.amount'=>"Amount*",'t.date_ech'=>"DateDue*",'t.periode'=>"PeriodEndDate*" |
|
146 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
147 | + $this->import_label[$r] = "ImportDataset_tax_contrib"; // Translation key |
|
148 | + $this->import_icon[$r] = 'tax'; |
|
149 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
150 | + $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'chargesociales'); |
|
151 | + $this->import_fields_array[$r] = array('t.libelle'=>"Label*", 't.fk_type'=>"Type", |
|
152 | + 't.amount'=>"Amount*", 't.date_ech'=>"DateDue*", 't.periode'=>"PeriodEndDate*" |
|
153 | 153 | ); |
154 | 154 | |
155 | - $this->import_convertvalue_array[$r]=array( |
|
156 | - 't.fk_type'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/sociales/class/cchargesociales.class.php','class'=>'Cchargesociales','method'=>'fetch','element'=>'Cchargesociales') |
|
155 | + $this->import_convertvalue_array[$r] = array( |
|
156 | + 't.fk_type'=>array('rule'=>'fetchidfromref', 'classfile'=>'/compta/sociales/class/cchargesociales.class.php', 'class'=>'Cchargesociales', 'method'=>'fetch', 'element'=>'Cchargesociales') |
|
157 | 157 | ); |
158 | - $this->import_examplevalues_array[$r]=array('t.libelle'=>"Social/fiscal contribution",'t.fk_type'=>"TAXPRO (must be id or code found into dictionary)", |
|
158 | + $this->import_examplevalues_array[$r] = array('t.libelle'=>"Social/fiscal contribution", 't.fk_type'=>"TAXPRO (must be id or code found into dictionary)", |
|
159 | 159 | 't.date_ech'=>"2016-01-01", 't.periode'=>"2016-01-01" |
160 | 160 | ); |
161 | 161 | |
162 | 162 | // Import Taxes |
163 | 163 | $r++; |
164 | - $this->import_code[$r]=$this->rights_class.'_'.$r; |
|
165 | - $this->import_label[$r]="ImportDataset_tax_vat"; // Translation key |
|
166 | - $this->import_icon[$r]='tax'; |
|
167 | - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon |
|
168 | - $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'tva'); |
|
169 | - $this->import_fields_array[$r]=array('t.datep'=>"DatePayment*",'t.datev'=>"DateValue*",'t.label'=>"Label*",'t.fk_typepayment'=>"PaymentMode*", |
|
170 | - 't.amount'=>"Amount*",'t.num_payment'=>'Numero' |
|
164 | + $this->import_code[$r] = $this->rights_class.'_'.$r; |
|
165 | + $this->import_label[$r] = "ImportDataset_tax_vat"; // Translation key |
|
166 | + $this->import_icon[$r] = 'tax'; |
|
167 | + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon |
|
168 | + $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'tva'); |
|
169 | + $this->import_fields_array[$r] = array('t.datep'=>"DatePayment*", 't.datev'=>"DateValue*", 't.label'=>"Label*", 't.fk_typepayment'=>"PaymentMode*", |
|
170 | + 't.amount'=>"Amount*", 't.num_payment'=>'Numero' |
|
171 | 171 | ); |
172 | 172 | |
173 | - $this->import_convertvalue_array[$r]=array( |
|
174 | - 't.fk_typepayment'=>array('rule'=>'fetchidfromref','classfile'=>'/compta/paiement/class/cpaiement.class.php','class'=>'Cpaiement','method'=>'fetch','element'=>'Cpaiement') |
|
173 | + $this->import_convertvalue_array[$r] = array( |
|
174 | + 't.fk_typepayment'=>array('rule'=>'fetchidfromref', 'classfile'=>'/compta/paiement/class/cpaiement.class.php', 'class'=>'Cpaiement', 'method'=>'fetch', 'element'=>'Cpaiement') |
|
175 | 175 | ); |
176 | - $this->import_examplevalues_array[$r]=array('t.label'=>"VAT Payment 1st quarter 2016",'t.fk_typepayment'=>"CHQ (must be id or code found into dictionary)", |
|
176 | + $this->import_examplevalues_array[$r] = array('t.label'=>"VAT Payment 1st quarter 2016", 't.fk_typepayment'=>"CHQ (must be id or code found into dictionary)", |
|
177 | 177 | 't.datep'=>"2016-04-02", 't.datev'=>"2016-03-31", 't.amount'=>1000, 't.num_payment'=>'123456' |
178 | 178 | ); |
179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @param string $options Options when enabling module ('', 'noboxes') |
189 | 189 | * @return int 1 if OK, 0 if KO |
190 | 190 | */ |
191 | - function init($options='') |
|
191 | + function init($options = '') |
|
192 | 192 | { |
193 | 193 | global $conf; |
194 | 194 | |
@@ -197,6 +197,6 @@ discard block |
||
197 | 197 | |
198 | 198 | $sql = array(); |
199 | 199 | |
200 | - return $this->_init($sql,$options); |
|
200 | + return $this->_init($sql, $options); |
|
201 | 201 | } |
202 | 202 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. |
143 | 143 | * It also creates data directories |
144 | 144 | * |
145 | - * @param string $options Options when enabling module ('', 'noboxes') |
|
145 | + * @param string $options Options when enabling module ('', 'noboxes') |
|
146 | 146 | * @return int 1 if OK, 0 if KO |
147 | 147 | */ |
148 | 148 | function init($options='') |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $this->remove($options); |
154 | 154 | |
155 | 155 | $sql = array( |
156 | - "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity, |
|
157 | - "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
|
156 | + "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[0][2])."' AND type = 'bankaccount' AND entity = ".$conf->entity, |
|
157 | + "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
|
158 | 158 | ); |
159 | 159 | |
160 | 160 | return $this->_init($sql,$options); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * \brief Fichier de description et activation du module Prelevement |
27 | 27 | */ |
28 | 28 | |
29 | -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; |
|
29 | +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $this->family = "financial"; |
51 | 51 | $this->module_position = 520; |
52 | 52 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
53 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
53 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
54 | 54 | $this->description = "Gestion des Prelevements"; |
55 | 55 | |
56 | 56 | // Possible values for version are: 'development', 'experimental', 'dolibarr' or version |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
60 | 60 | $this->special = 0; |
61 | 61 | // Name of png file (without png) used for this module |
62 | - $this->picto='payment'; |
|
62 | + $this->picto = 'payment'; |
|
63 | 63 | |
64 | 64 | // Data directories to create when module is enabled |
65 | - $this->dirs = array("/prelevement/temp","/prelevement/receipts"); |
|
65 | + $this->dirs = array("/prelevement/temp", "/prelevement/receipts"); |
|
66 | 66 | |
67 | 67 | // Dependancies |
68 | - $this->depends = array("modFacture","modBanque"); |
|
68 | + $this->depends = array("modFacture", "modBanque"); |
|
69 | 69 | $this->requiredby = array(); |
70 | 70 | |
71 | 71 | // Config pages |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | // Constants |
75 | 75 | $this->const = array(); |
76 | - $r=0; |
|
76 | + $r = 0; |
|
77 | 77 | |
78 | 78 | $this->const[$r][0] = "BANK_ADDON_PDF"; |
79 | 79 | $this->const[$r][1] = "chaine"; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // Permissions |
90 | 90 | $this->rights = array(); |
91 | 91 | $this->rights_class = 'prelevement'; |
92 | - $r=0; |
|
92 | + $r = 0; |
|
93 | 93 | $r++; |
94 | 94 | $this->rights[$r][0] = 151; |
95 | 95 | $this->rights[$r][1] = 'Read direct debit payment orders'; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | // Menus |
134 | 134 | //------- |
135 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
135 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
136 | 136 | |
137 | 137 | } |
138 | 138 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param string $options Options when enabling module ('', 'noboxes') |
146 | 146 | * @return int 1 if OK, 0 if KO |
147 | 147 | */ |
148 | - function init($options='') |
|
148 | + function init($options = '') |
|
149 | 149 | { |
150 | 150 | global $conf; |
151 | 151 | |
@@ -157,6 +157,6 @@ discard block |
||
157 | 157 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[0][2])."','bankaccount',".$conf->entity.")", |
158 | 158 | ); |
159 | 159 | |
160 | - return $this->_init($sql,$options); |
|
160 | + return $this->_init($sql, $options); |
|
161 | 161 | } |
162 | 162 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class ModelePDFCards |
36 | 36 | { |
37 | - var $error=''; |
|
37 | + var $error = ''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @param integer $maxfilenamelength Max length of value to show |
45 | 45 | * @return array List of templates |
46 | 46 | */ |
47 | - function liste_modeles($db,$maxfilenamelength=0) |
|
47 | + function liste_modeles($db, $maxfilenamelength = 0) |
|
48 | 48 | { |
49 | 49 | global $conf; |
50 | 50 | |
51 | - $type='member'; |
|
52 | - $liste=array(); |
|
51 | + $type = 'member'; |
|
52 | + $liste = array(); |
|
53 | 53 | |
54 | 54 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
55 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
55 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
56 | 56 | |
57 | 57 | return $liste; |
58 | 58 | } |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | * @param string $template pdf generenate document class to use default 'standard' |
71 | 71 | * @return int <0 if KO, >0 if OK |
72 | 72 | */ |
73 | -function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='', $template='standard') |
|
73 | +function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir = '', $template = 'standard') |
|
74 | 74 | { |
75 | - global $conf,$langs; |
|
75 | + global $conf, $langs; |
|
76 | 76 | $langs->load("members"); |
77 | 77 | |
78 | - $error=0; |
|
78 | + $error = 0; |
|
79 | 79 | |
80 | 80 | // Increase limit for PDF build |
81 | - $err=error_reporting(); |
|
81 | + $err = error_reporting(); |
|
82 | 82 | error_reporting(0); |
83 | 83 | @set_time_limit(120); |
84 | 84 | error_reporting($err); |
85 | 85 | |
86 | - $code=''; |
|
87 | - $srctemplatepath=''; |
|
86 | + $code = ''; |
|
87 | + $srctemplatepath = ''; |
|
88 | 88 | |
89 | 89 | // Positionne le modele sur le nom du modele a utiliser |
90 | - if (! dol_strlen($modele)) |
|
90 | + if (!dol_strlen($modele)) |
|
91 | 91 | { |
92 | - if (! empty($conf->global->ADHERENT_CARDS_ADDON_PDF)) |
|
92 | + if (!empty($conf->global->ADHERENT_CARDS_ADDON_PDF)) |
|
93 | 93 | { |
94 | 94 | $code = $conf->global->ADHERENT_CARDS_ADDON_PDF; |
95 | 95 | } |
@@ -98,33 +98,33 @@ discard block |
||
98 | 98 | $code = $modele; |
99 | 99 | } |
100 | 100 | } |
101 | - else $code=$modele; |
|
101 | + else $code = $modele; |
|
102 | 102 | |
103 | 103 | // If selected modele is a filename template (then $modele="modelname:filename") |
104 | - $tmp=explode(':',$template,2); |
|
105 | - if (! empty($tmp[1])) |
|
104 | + $tmp = explode(':', $template, 2); |
|
105 | + if (!empty($tmp[1])) |
|
106 | 106 | { |
107 | - $template=$tmp[0]; |
|
108 | - $srctemplatepath=$tmp[1]; |
|
107 | + $template = $tmp[0]; |
|
108 | + $srctemplatepath = $tmp[1]; |
|
109 | 109 | } |
110 | - else $srctemplatepath=$code; |
|
110 | + else $srctemplatepath = $code; |
|
111 | 111 | |
112 | 112 | // Search template files |
113 | - $file=''; $classname=''; $filefound=0; |
|
114 | - $dirmodels=array('/'); |
|
115 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
116 | - foreach($dirmodels as $reldir) |
|
113 | + $file = ''; $classname = ''; $filefound = 0; |
|
114 | + $dirmodels = array('/'); |
|
115 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
116 | + foreach ($dirmodels as $reldir) |
|
117 | 117 | { |
118 | - foreach(array('doc','pdf') as $prefix) |
|
118 | + foreach (array('doc', 'pdf') as $prefix) |
|
119 | 119 | { |
120 | 120 | $file = $prefix."_".$template.".class.php"; |
121 | 121 | |
122 | 122 | // On verifie l'emplacement du modele |
123 | - $file=dol_buildpath($reldir."core/modules/member/doc/".$file,0); |
|
123 | + $file = dol_buildpath($reldir."core/modules/member/doc/".$file, 0); |
|
124 | 124 | if (file_exists($file)) |
125 | 125 | { |
126 | - $filefound=1; |
|
127 | - $classname=$prefix.'_'.$template; |
|
126 | + $filefound = 1; |
|
127 | + $classname = $prefix.'_'.$template; |
|
128 | 128 | break; |
129 | 129 | } |
130 | 130 | } |
@@ -141,23 +141,23 @@ discard block |
||
141 | 141 | |
142 | 142 | // We save charset_output to restore it because write_file can change it if needed for |
143 | 143 | // output format that does not support UTF8. |
144 | - $sav_charset_output=$outputlangs->charset_output; |
|
144 | + $sav_charset_output = $outputlangs->charset_output; |
|
145 | 145 | if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath) > 0) |
146 | 146 | { |
147 | - $outputlangs->charset_output=$sav_charset_output; |
|
147 | + $outputlangs->charset_output = $sav_charset_output; |
|
148 | 148 | return 1; |
149 | 149 | } |
150 | 150 | else |
151 | 151 | { |
152 | - $outputlangs->charset_output=$sav_charset_output; |
|
153 | - dol_print_error($db,"members_card_pdf_create Error: ".$obj->error); |
|
152 | + $outputlangs->charset_output = $sav_charset_output; |
|
153 | + dol_print_error($db, "members_card_pdf_create Error: ".$obj->error); |
|
154 | 154 | return -1; |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | 158 | else |
159 | 159 | { |
160 | - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); |
|
160 | + dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file)); |
|
161 | 161 | return -1; |
162 | 162 | } |
163 | 163 |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | if (! empty($conf->global->ADHERENT_CARDS_ADDON_PDF)) |
93 | 93 | { |
94 | 94 | $code = $conf->global->ADHERENT_CARDS_ADDON_PDF; |
95 | - } |
|
96 | - else |
|
95 | + } else |
|
97 | 96 | { |
98 | 97 | $code = $modele; |
99 | 98 | } |
99 | + } else { |
|
100 | + $code=$modele; |
|
100 | 101 | } |
101 | - else $code=$modele; |
|
102 | 102 | |
103 | 103 | // If selected modele is a filename template (then $modele="modelname:filename") |
104 | 104 | $tmp=explode(':',$template,2); |
@@ -106,13 +106,16 @@ discard block |
||
106 | 106 | { |
107 | 107 | $template=$tmp[0]; |
108 | 108 | $srctemplatepath=$tmp[1]; |
109 | + } else { |
|
110 | + $srctemplatepath=$code; |
|
109 | 111 | } |
110 | - else $srctemplatepath=$code; |
|
111 | 112 | |
112 | 113 | // Search template files |
113 | 114 | $file=''; $classname=''; $filefound=0; |
114 | 115 | $dirmodels=array('/'); |
115 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
116 | + if (is_array($conf->modules_parts['models'])) { |
|
117 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
118 | + } |
|
116 | 119 | foreach($dirmodels as $reldir) |
117 | 120 | { |
118 | 121 | foreach(array('doc','pdf') as $prefix) |
@@ -128,7 +131,9 @@ discard block |
||
128 | 131 | break; |
129 | 132 | } |
130 | 133 | } |
131 | - if ($filefound) break; |
|
134 | + if ($filefound) { |
|
135 | + break; |
|
136 | + } |
|
132 | 137 | } |
133 | 138 | |
134 | 139 | |
@@ -146,16 +151,13 @@ discard block |
||
146 | 151 | { |
147 | 152 | $outputlangs->charset_output=$sav_charset_output; |
148 | 153 | return 1; |
149 | - } |
|
150 | - else |
|
154 | + } else |
|
151 | 155 | { |
152 | 156 | $outputlangs->charset_output=$sav_charset_output; |
153 | 157 | dol_print_error($db,"members_card_pdf_create Error: ".$obj->error); |
154 | 158 | return -1; |
155 | 159 | } |
156 | - } |
|
157 | - |
|
158 | - else |
|
160 | + } else |
|
159 | 161 | { |
160 | 162 | dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); |
161 | 163 | return -1; |
@@ -176,9 +176,9 @@ |
||
176 | 176 | $this->export_label[$r]='ListTripsAndExpenses'; |
177 | 177 | $this->export_icon[$r]='trip'; |
178 | 178 | $this->export_permission[$r]=array(array("expensereport","export")); |
179 | - $this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref'); |
|
180 | - $this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project'); |
|
181 | - $this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login'); |
|
179 | + $this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref'); |
|
180 | + $this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project'); |
|
181 | + $this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login'); |
|
182 | 182 | $this->export_dependencies_array[$r]=array('expensereport_line'=>'ed.rowid','type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
183 | 183 | |
184 | 184 | $this->export_sql_start[$r]='SELECT DISTINCT '; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * \ingroup expensereport |
24 | 24 | * \brief Description and activation file for module ExpenseReport |
25 | 25 | */ |
26 | -include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php"); |
|
26 | +include_once(DOL_DOCUMENT_ROOT."/core/modules/DolibarrModules.class.php"); |
|
27 | 27 | |
28 | 28 | |
29 | 29 | /** |
@@ -46,32 +46,32 @@ discard block |
||
46 | 46 | $this->family = "hr"; |
47 | 47 | $this->module_position = 40; |
48 | 48 | // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) |
49 | - $this->name = preg_replace('/^mod/i','',get_class($this)); |
|
49 | + $this->name = preg_replace('/^mod/i', '', get_class($this)); |
|
50 | 50 | // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) |
51 | 51 | $this->description = "Manage and claim expense reports (transportation, meal, ...)"; |
52 | 52 | $this->version = 'dolibarr'; |
53 | 53 | $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); |
54 | 54 | $this->special = 0; |
55 | - $this->picto='trip'; |
|
55 | + $this->picto = 'trip'; |
|
56 | 56 | |
57 | 57 | // Data directories to create when module is enabled. |
58 | 58 | $this->dirs = array("/expensereport/temp"); |
59 | - $r=0; |
|
59 | + $r = 0; |
|
60 | 60 | |
61 | 61 | // Config pages. Put here list of php page names stored in admmin directory used to setup module. |
62 | 62 | $this->config_page_url = array('expensereport.php'); |
63 | 63 | |
64 | 64 | // Dependencies |
65 | - $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
65 | + $this->depends = array(); // List of modules id that must be enabled if this module is enabled |
|
66 | 66 | // $this->conflictwith = array("modDeplacement"); // Deactivate for access on old information |
67 | - $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
68 | - $this->phpmin = array(4,3); // Minimum version of PHP required by module |
|
69 | - $this->need_dolibarr_version = array(3,7); // Minimum version of Dolibarr required by module |
|
70 | - $this->langfiles = array("companies","trips"); |
|
67 | + $this->requiredby = array(); // List of modules id to disable if this one is disabled |
|
68 | + $this->phpmin = array(4, 3); // Minimum version of PHP required by module |
|
69 | + $this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module |
|
70 | + $this->langfiles = array("companies", "trips"); |
|
71 | 71 | |
72 | 72 | // Constants |
73 | - $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities') |
|
74 | - $r=0; |
|
73 | + $this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities') |
|
74 | + $r = 0; |
|
75 | 75 | |
76 | 76 | $this->const[$r][0] = "EXPENSEREPORT_ADDON_PDF"; |
77 | 77 | $this->const[$r][1] = "chaine"; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | $this->tabs = array(); |
99 | 99 | |
100 | 100 | // Boxes |
101 | - $this->boxes = array(); // List of boxes |
|
102 | - $r=0; |
|
101 | + $this->boxes = array(); // List of boxes |
|
102 | + $r = 0; |
|
103 | 103 | |
104 | 104 | // Permissions |
105 | - $this->rights = array(); // Permission array used by this module |
|
105 | + $this->rights = array(); // Permission array used by this module |
|
106 | 106 | $this->rights_class = 'expensereport'; |
107 | 107 | |
108 | 108 | $this->rights[$r][0] = 771; |
@@ -163,27 +163,27 @@ discard block |
||
163 | 163 | |
164 | 164 | // Menus |
165 | 165 | //------- |
166 | - $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
166 | + $this->menu = 1; // This module add menu entries. They are coded into menu manager. |
|
167 | 167 | |
168 | 168 | // Exports |
169 | - $r=0; |
|
169 | + $r = 0; |
|
170 | 170 | |
171 | 171 | $r++; |
172 | - $this->export_code[$r]='expensereport_'.$r; |
|
173 | - $this->export_label[$r]='ListTripsAndExpenses'; |
|
174 | - $this->export_icon[$r]='trip'; |
|
175 | - $this->export_permission[$r]=array(array("expensereport","export")); |
|
176 | - $this->export_fields_array[$r]=array('d.rowid'=>"TripId",'d.ref'=>'Ref','d.date_debut'=>'DateStart','d.date_fin'=>'DateEnd','d.date_create'=>'DateCreation','d.date_approve'=>'DateApprove','d.total_ht'=>"TotalHT",'d.total_tva'=>'TotalVAT','d.total_ttc'=>'TotalTTC','d.note_private'=>'NotePrivate','d.note_public'=>'NotePublic','u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>"Login",'ed.rowid'=>'LineId','tf.code'=>'Type','ed.date'=>'Date','ed.tva_tx'=>'VATRate','ed.total_ht'=>'TotalHT','ed.total_tva'=>'TotalVAT','ed.total_ttc'=>'TotalTTC','ed.comments'=>'Comment','p.rowid'=>'ProjectId','p.ref'=>'Ref'); |
|
177 | - $this->export_entities_array[$r]=array('u.lastname'=>'user','u.firstname'=>'user','u.login'=>'user','ed.rowid'=>'expensereport_line','ed.date'=>'expensereport_line','ed.tva_tx'=>'expensereport_line','ed.total_ht'=>'expensereport_line','ed.total_tva'=>'expensereport_line','ed.total_ttc'=>'expensereport_line','ed.comments'=>'expensereport_line','tf.code'=>'expensereport_line','p.project_ref'=>'expensereport_line','p.rowid'=>'project','p.ref'=>'project'); |
|
178 | - $this->export_alias_array[$r]=array('d.rowid'=>"idtrip",'d.type'=>"type",'d.note_private'=>'note_private','d.note_public'=>'note_public','u.lastname'=>'name','u.firstname'=>'firstname','u.login'=>'login'); |
|
179 | - $this->export_dependencies_array[$r]=array('expensereport_line'=>'ed.rowid','type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
180 | - |
|
181 | - $this->export_sql_start[$r]='SELECT DISTINCT '; |
|
182 | - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'expensereport as d, '.MAIN_DB_PREFIX.'user as u,'; |
|
183 | - $this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'expensereport_det as ed LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as tf ON ed.fk_c_type_fees = tf.id'; |
|
184 | - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON ed.fk_projet = p.rowid'; |
|
185 | - $this->export_sql_end[$r] .=' WHERE ed.fk_expensereport = d.rowid AND d.fk_user_author = u.rowid'; |
|
186 | - $this->export_sql_end[$r] .=' AND d.entity IN ('.getEntity('expensereport').')'; |
|
172 | + $this->export_code[$r] = 'expensereport_'.$r; |
|
173 | + $this->export_label[$r] = 'ListTripsAndExpenses'; |
|
174 | + $this->export_icon[$r] = 'trip'; |
|
175 | + $this->export_permission[$r] = array(array("expensereport", "export")); |
|
176 | + $this->export_fields_array[$r] = array('d.rowid'=>"TripId", 'd.ref'=>'Ref', 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.date_create'=>'DateCreation', 'd.date_approve'=>'DateApprove', 'd.total_ht'=>"TotalHT", 'd.total_tva'=>'TotalVAT', 'd.total_ttc'=>'TotalTTC', 'd.note_private'=>'NotePrivate', 'd.note_public'=>'NotePublic', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'ed.rowid'=>'LineId', 'tf.code'=>'Type', 'ed.date'=>'Date', 'ed.tva_tx'=>'VATRate', 'ed.total_ht'=>'TotalHT', 'ed.total_tva'=>'TotalVAT', 'ed.total_ttc'=>'TotalTTC', 'ed.comments'=>'Comment', 'p.rowid'=>'ProjectId', 'p.ref'=>'Ref'); |
|
177 | + $this->export_entities_array[$r] = array('u.lastname'=>'user', 'u.firstname'=>'user', 'u.login'=>'user', 'ed.rowid'=>'expensereport_line', 'ed.date'=>'expensereport_line', 'ed.tva_tx'=>'expensereport_line', 'ed.total_ht'=>'expensereport_line', 'ed.total_tva'=>'expensereport_line', 'ed.total_ttc'=>'expensereport_line', 'ed.comments'=>'expensereport_line', 'tf.code'=>'expensereport_line', 'p.project_ref'=>'expensereport_line', 'p.rowid'=>'project', 'p.ref'=>'project'); |
|
178 | + $this->export_alias_array[$r] = array('d.rowid'=>"idtrip", 'd.type'=>"type", 'd.note_private'=>'note_private', 'd.note_public'=>'note_public', 'u.lastname'=>'name', 'u.firstname'=>'firstname', 'u.login'=>'login'); |
|
179 | + $this->export_dependencies_array[$r] = array('expensereport_line'=>'ed.rowid', 'type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them |
|
180 | + |
|
181 | + $this->export_sql_start[$r] = 'SELECT DISTINCT '; |
|
182 | + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'expensereport as d, '.MAIN_DB_PREFIX.'user as u,'; |
|
183 | + $this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'expensereport_det as ed LEFT JOIN '.MAIN_DB_PREFIX.'c_type_fees as tf ON ed.fk_c_type_fees = tf.id'; |
|
184 | + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet as p ON ed.fk_projet = p.rowid'; |
|
185 | + $this->export_sql_end[$r] .= ' WHERE ed.fk_expensereport = d.rowid AND d.fk_user_author = u.rowid'; |
|
186 | + $this->export_sql_end[$r] .= ' AND d.entity IN ('.getEntity('expensereport').')'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * @param string $options Options |
195 | 195 | * @return int 1 if OK, 0 if KO |
196 | 196 | */ |
197 | - function init($options='') |
|
197 | + function init($options = '') |
|
198 | 198 | { |
199 | 199 | global $conf; |
200 | 200 | |
@@ -206,6 +206,6 @@ discard block |
||
206 | 206 | "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard','expensereport',".$conf->entity.")" |
207 | 207 | ); |
208 | 208 | |
209 | - return $this->_init($sql,$options); |
|
209 | + return $this->_init($sql, $options); |
|
210 | 210 | } |
211 | 211 | } |
@@ -40,9 +40,9 @@ |
||
40 | 40 | /** |
41 | 41 | * Return list of active generation modules |
42 | 42 | * |
43 | - * @param DoliDB $db Database handler |
|
44 | - * @param integer $maxfilenamelength Max length of value to show |
|
45 | - * @return array List of templates |
|
43 | + * @param DoliDB $db Database handler |
|
44 | + * @param integer $maxfilenamelength Max length of value to show |
|
45 | + * @return array List of templates |
|
46 | 46 | */ |
47 | 47 | function liste_modeles($db,$maxfilenamelength=0) |
48 | 48 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class ModelePDFLabels |
36 | 36 | { |
37 | - var $error=''; |
|
37 | + var $error = ''; |
|
38 | 38 | |
39 | 39 | |
40 | 40 | /** |
@@ -44,15 +44,15 @@ discard block |
||
44 | 44 | * @param integer $maxfilenamelength Max length of value to show |
45 | 45 | * @return array List of templates |
46 | 46 | */ |
47 | - function liste_modeles($db,$maxfilenamelength=0) |
|
47 | + function liste_modeles($db, $maxfilenamelength = 0) |
|
48 | 48 | { |
49 | 49 | global $conf; |
50 | 50 | |
51 | - $type='members_labels'; |
|
52 | - $liste=array(); |
|
51 | + $type = 'members_labels'; |
|
52 | + $liste = array(); |
|
53 | 53 | |
54 | 54 | include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
55 | - $liste=getListOfModels($db,$type,$maxfilenamelength); |
|
55 | + $liste = getListOfModels($db, $type, $maxfilenamelength); |
|
56 | 56 | |
57 | 57 | return $liste; |
58 | 58 | } |
@@ -71,26 +71,26 @@ discard block |
||
71 | 71 | * @param string $filename Short file name of PDF output file |
72 | 72 | * @return int <0 if KO, >0 if OK |
73 | 73 | */ |
74 | -function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='', $template='standardlabel', $filename='tmp_address_sheet.pdf') |
|
74 | +function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir = '', $template = 'standardlabel', $filename = 'tmp_address_sheet.pdf') |
|
75 | 75 | { |
76 | - global $conf,$langs; |
|
76 | + global $conf, $langs; |
|
77 | 77 | $langs->load("members"); |
78 | 78 | |
79 | - $error=0; |
|
79 | + $error = 0; |
|
80 | 80 | |
81 | 81 | // Increase limit for PDF build |
82 | - $err=error_reporting(); |
|
82 | + $err = error_reporting(); |
|
83 | 83 | error_reporting(0); |
84 | 84 | @set_time_limit(120); |
85 | 85 | error_reporting($err); |
86 | 86 | |
87 | - $code=''; |
|
88 | - $srctemplatepath=''; |
|
87 | + $code = ''; |
|
88 | + $srctemplatepath = ''; |
|
89 | 89 | |
90 | 90 | // Positionne le modele sur le nom du modele a utiliser |
91 | - if (! dol_strlen($modele)) |
|
91 | + if (!dol_strlen($modele)) |
|
92 | 92 | { |
93 | - if (! empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) |
|
93 | + if (!empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) |
|
94 | 94 | { |
95 | 95 | $code = $conf->global->ADHERENT_ETIQUETTE_TYPE; |
96 | 96 | } |
@@ -99,35 +99,35 @@ discard block |
||
99 | 99 | $code = $modele; |
100 | 100 | } |
101 | 101 | } |
102 | - else $code=$modele; |
|
102 | + else $code = $modele; |
|
103 | 103 | |
104 | 104 | // If selected modele is a filename template (then $modele="modelname:filename") |
105 | - $tmp=explode(':',$template,2); |
|
106 | - if (! empty($tmp[1])) |
|
105 | + $tmp = explode(':', $template, 2); |
|
106 | + if (!empty($tmp[1])) |
|
107 | 107 | { |
108 | - $template=$tmp[0]; |
|
109 | - $srctemplatepath=$tmp[1]; |
|
108 | + $template = $tmp[0]; |
|
109 | + $srctemplatepath = $tmp[1]; |
|
110 | 110 | } |
111 | - else $srctemplatepath=$code; |
|
111 | + else $srctemplatepath = $code; |
|
112 | 112 | |
113 | 113 | dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); |
114 | 114 | |
115 | 115 | // Search template files |
116 | - $file=''; $classname=''; $filefound=0; |
|
117 | - $dirmodels=array('/'); |
|
118 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
119 | - foreach($dirmodels as $reldir) |
|
116 | + $file = ''; $classname = ''; $filefound = 0; |
|
117 | + $dirmodels = array('/'); |
|
118 | + if (is_array($conf->modules_parts['models'])) $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); |
|
119 | + foreach ($dirmodels as $reldir) |
|
120 | 120 | { |
121 | - foreach(array('doc','pdf') as $prefix) |
|
121 | + foreach (array('doc', 'pdf') as $prefix) |
|
122 | 122 | { |
123 | 123 | $file = $prefix."_".$template.".class.php"; |
124 | 124 | |
125 | 125 | // On verifie l'emplacement du modele |
126 | - $file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0); |
|
126 | + $file = dol_buildpath($reldir."core/modules/printsheet/doc/".$file, 0); |
|
127 | 127 | if (file_exists($file)) |
128 | 128 | { |
129 | - $filefound=1; |
|
130 | - $classname=$prefix.'_'.$template; |
|
129 | + $filefound = 1; |
|
130 | + $classname = $prefix.'_'.$template; |
|
131 | 131 | break; |
132 | 132 | } |
133 | 133 | } |
@@ -143,22 +143,22 @@ discard block |
||
143 | 143 | |
144 | 144 | // We save charset_output to restore it because write_file can change it if needed for |
145 | 145 | // output format that does not support UTF8. |
146 | - $sav_charset_output=$outputlangs->charset_output; |
|
146 | + $sav_charset_output = $outputlangs->charset_output; |
|
147 | 147 | if ($obj->write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir, $filename) > 0) |
148 | 148 | { |
149 | - $outputlangs->charset_output=$sav_charset_output; |
|
149 | + $outputlangs->charset_output = $sav_charset_output; |
|
150 | 150 | return 1; |
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
154 | - $outputlangs->charset_output=$sav_charset_output; |
|
155 | - dol_print_error($db,"doc_label_pdf_create Error: ".$obj->error); |
|
154 | + $outputlangs->charset_output = $sav_charset_output; |
|
155 | + dol_print_error($db, "doc_label_pdf_create Error: ".$obj->error); |
|
156 | 156 | return -1; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | else |
160 | 160 | { |
161 | - dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); |
|
161 | + dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file)); |
|
162 | 162 | return -1; |
163 | 163 | } |
164 | 164 |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | if (! empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) |
94 | 94 | { |
95 | 95 | $code = $conf->global->ADHERENT_ETIQUETTE_TYPE; |
96 | - } |
|
97 | - else |
|
96 | + } else |
|
98 | 97 | { |
99 | 98 | $code = $modele; |
100 | 99 | } |
100 | + } else { |
|
101 | + $code=$modele; |
|
101 | 102 | } |
102 | - else $code=$modele; |
|
103 | 103 | |
104 | 104 | // If selected modele is a filename template (then $modele="modelname:filename") |
105 | 105 | $tmp=explode(':',$template,2); |
@@ -107,15 +107,18 @@ discard block |
||
107 | 107 | { |
108 | 108 | $template=$tmp[0]; |
109 | 109 | $srctemplatepath=$tmp[1]; |
110 | + } else { |
|
111 | + $srctemplatepath=$code; |
|
110 | 112 | } |
111 | - else $srctemplatepath=$code; |
|
112 | 113 | |
113 | 114 | dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); |
114 | 115 | |
115 | 116 | // Search template files |
116 | 117 | $file=''; $classname=''; $filefound=0; |
117 | 118 | $dirmodels=array('/'); |
118 | - if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
119 | + if (is_array($conf->modules_parts['models'])) { |
|
120 | + $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); |
|
121 | + } |
|
119 | 122 | foreach($dirmodels as $reldir) |
120 | 123 | { |
121 | 124 | foreach(array('doc','pdf') as $prefix) |
@@ -131,7 +134,9 @@ discard block |
||
131 | 134 | break; |
132 | 135 | } |
133 | 136 | } |
134 | - if ($filefound) break; |
|
137 | + if ($filefound) { |
|
138 | + break; |
|
139 | + } |
|
135 | 140 | } |
136 | 141 | |
137 | 142 | // Charge le modele |
@@ -148,15 +153,13 @@ discard block |
||
148 | 153 | { |
149 | 154 | $outputlangs->charset_output=$sav_charset_output; |
150 | 155 | return 1; |
151 | - } |
|
152 | - else |
|
156 | + } else |
|
153 | 157 | { |
154 | 158 | $outputlangs->charset_output=$sav_charset_output; |
155 | 159 | dol_print_error($db,"doc_label_pdf_create Error: ".$obj->error); |
156 | 160 | return -1; |
157 | 161 | } |
158 | - } |
|
159 | - else |
|
162 | + } else |
|
160 | 163 | { |
161 | 164 | dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); |
162 | 165 | return -1; |