@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | * @return int|object <=0 if KO, Object if OK |
38 | 38 | * @see rebuildObjectSql |
39 | 39 | */ |
40 | -function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='', $addfieldentry=array() ,$delfieldentry='') |
|
40 | +function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = '', $addfieldentry = array(), $delfieldentry = '') |
|
41 | 41 | { |
42 | 42 | global $db, $langs; |
43 | 43 | |
44 | 44 | if (empty($objectname)) return -1; |
45 | - if (empty($readdir)) $readdir=$destdir; |
|
45 | + if (empty($readdir)) $readdir = $destdir; |
|
46 | 46 | |
47 | - if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) |
|
47 | + if (!empty($addfieldentry['arrayofkeyval']) && !is_array($addfieldentry['arrayofkeyval'])) |
|
48 | 48 | { |
49 | 49 | dol_print_error('', 'Bad parameter addfieldentry with a property arrayofkeyval defined but that is not an array.'); |
50 | 50 | return -1; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return -2; |
65 | 65 | } |
66 | 66 | |
67 | - if (! preg_match('/^(price|boolean|sellist|integer|date|timestamp|varchar|double|text|html)/', $addfieldentry['type'])) |
|
67 | + if (!preg_match('/^(price|boolean|sellist|integer|date|timestamp|varchar|double|text|html)/', $addfieldentry['type'])) |
|
68 | 68 | |
69 | 69 | { |
70 | 70 | setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors'); |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - $pathoffiletoeditsrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
76 | - $pathoffiletoedittarget=$destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); |
|
77 | - if (! dol_is_file($pathoffiletoeditsrc)) |
|
75 | + $pathoffiletoeditsrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
76 | + $pathoffiletoedittarget = $destdir.'/class/'.strtolower($objectname).'.class.php'.($readdir != $destdir ? '.new' : ''); |
|
77 | + if (!dol_is_file($pathoffiletoeditsrc)) |
|
78 | 78 | { |
79 | 79 | $langs->load("errors"); |
80 | 80 | setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | try |
88 | 88 | { |
89 | 89 | include_once $pathoffiletoeditsrc; |
90 | - if (class_exists($objectname)) $object=new $objectname($db); |
|
90 | + if (class_exists($objectname)) $object = new $objectname($db); |
|
91 | 91 | else return -4; |
92 | 92 | |
93 | 93 | // Backup old file |
@@ -101,83 +101,83 @@ discard block |
||
101 | 101 | { |
102 | 102 | if (is_array($addfieldentry) && count($addfieldentry)) |
103 | 103 | { |
104 | - $name=$addfieldentry['name']; |
|
104 | + $name = $addfieldentry['name']; |
|
105 | 105 | unset($addfieldentry['name']); |
106 | 106 | |
107 | - $object->fields[$name]=$addfieldentry; |
|
107 | + $object->fields[$name] = $addfieldentry; |
|
108 | 108 | } |
109 | - if (! empty($delfieldentry)) |
|
109 | + if (!empty($delfieldentry)) |
|
110 | 110 | { |
111 | - $name=$delfieldentry; |
|
111 | + $name = $delfieldentry; |
|
112 | 112 | unset($object->fields[$name]); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | dol_sort_array($object->fields, 'position'); |
117 | 117 | |
118 | - $i=0; |
|
118 | + $i = 0; |
|
119 | 119 | $texttoinsert = '// BEGIN MODULEBUILDER PROPERTIES'."\n"; |
120 | - $texttoinsert.= "\t".'/**'."\n"; |
|
121 | - $texttoinsert.= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; |
|
122 | - $texttoinsert.= "\t".' */'."\n"; |
|
123 | - $texttoinsert.= "\t".'public $fields=array('."\n"; |
|
120 | + $texttoinsert .= "\t".'/**'."\n"; |
|
121 | + $texttoinsert .= "\t".' * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.'."\n"; |
|
122 | + $texttoinsert .= "\t".' */'."\n"; |
|
123 | + $texttoinsert .= "\t".'public $fields=array('."\n"; |
|
124 | 124 | |
125 | 125 | if (count($object->fields)) |
126 | 126 | { |
127 | 127 | |
128 | - foreach($object->fields as $key => $val) |
|
128 | + foreach ($object->fields as $key => $val) |
|
129 | 129 | { |
130 | 130 | $i++; |
131 | - $texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; |
|
132 | - $texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).","; |
|
133 | - $texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).","; |
|
134 | - $texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).","; |
|
135 | - $texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).","; |
|
136 | - if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',"; |
|
137 | - if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].","; |
|
138 | - if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].","; |
|
139 | - if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',"; |
|
140 | - if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',"; |
|
141 | - if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; |
|
142 | - if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; |
|
143 | - if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',"; |
|
131 | + $texttoinsert .= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',"; |
|
132 | + $texttoinsert .= " 'enabled'=>".($val['enabled'] != '' ? $val['enabled'] : 1).","; |
|
133 | + $texttoinsert .= " 'visible'=>".($val['visible'] != '' ? $val['visible'] : -1).","; |
|
134 | + $texttoinsert .= " 'position'=>".($val['position'] != '' ? $val['position'] : 50).","; |
|
135 | + $texttoinsert .= " 'notnull'=>".($val['notnull'] != '' ? $val['notnull'] : -1).","; |
|
136 | + if ($val['default']) $texttoinsert .= " 'default'=>'".$val['default']."',"; |
|
137 | + if ($val['index']) $texttoinsert .= " 'index'=>".$val['index'].","; |
|
138 | + if ($val['searchall']) $texttoinsert .= " 'searchall'=>".$val['searchall'].","; |
|
139 | + if ($val['isameasure']) $texttoinsert .= " 'isameasure'=>'".$val['isameasure']."',"; |
|
140 | + if ($val['foreignkey']) $texttoinsert .= " 'foreignkey'=>'".$val['foreignkey']."',"; |
|
141 | + if ($val['help']) $texttoinsert .= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; |
|
142 | + if ($val['comment']) $texttoinsert .= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; |
|
143 | + if ($val['showoncombobox']) $texttoinsert .= " 'showoncombobox'=>'".$val['showoncombobox']."',"; |
|
144 | 144 | if ($val['arrayofkeyval']) |
145 | 145 | { |
146 | - $texttoinsert.= " 'arrayofkeyval'=>array("; |
|
147 | - $i=0; |
|
148 | - foreach($val['arrayofkeyval'] as $key2 => $val2) |
|
146 | + $texttoinsert .= " 'arrayofkeyval'=>array("; |
|
147 | + $i = 0; |
|
148 | + foreach ($val['arrayofkeyval'] as $key2 => $val2) |
|
149 | 149 | { |
150 | - if ($i) $texttoinsert.=", "; |
|
151 | - $texttoinsert.="'".$key2."'=>'".$val2."'"; |
|
150 | + if ($i) $texttoinsert .= ", "; |
|
151 | + $texttoinsert .= "'".$key2."'=>'".$val2."'"; |
|
152 | 152 | $i++; |
153 | 153 | } |
154 | - $texttoinsert.= ")"; |
|
154 | + $texttoinsert .= ")"; |
|
155 | 155 | } |
156 | - $texttoinsert.= "),\n"; |
|
156 | + $texttoinsert .= "),\n"; |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - $texttoinsert.= "\t".');'."\n"; |
|
160 | + $texttoinsert .= "\t".');'."\n"; |
|
161 | 161 | //print ($texttoinsert);exit; |
162 | 162 | |
163 | 163 | if (count($object->fields)) |
164 | 164 | { |
165 | - $typetotypephp=array('integer'=>'integer', 'varchar'=>'string'); |
|
165 | + $typetotypephp = array('integer'=>'integer', 'varchar'=>'string'); |
|
166 | 166 | |
167 | - foreach($object->fields as $key => $val) |
|
167 | + foreach ($object->fields as $key => $val) |
|
168 | 168 | { |
169 | 169 | $i++; |
170 | 170 | //$typephp=$typetotypephp[$val['type']]; |
171 | - $texttoinsert.= "\t".'public $'.$key.";"; |
|
171 | + $texttoinsert .= "\t".'public $'.$key.";"; |
|
172 | 172 | //if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; |
173 | 173 | //if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; |
174 | 174 | //$texttoinsert.= ($val['notnull']?' NOT NULL':''); |
175 | 175 | //if ($i < count($object->fields)) $texttoinsert.=";"; |
176 | - $texttoinsert.= "\n"; |
|
176 | + $texttoinsert .= "\n"; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
180 | - $texttoinsert.= "\t".'// END MODULEBUILDER PROPERTIES'; |
|
180 | + $texttoinsert .= "\t".'// END MODULEBUILDER PROPERTIES'; |
|
181 | 181 | |
182 | 182 | //print($texttoinsert);exit; |
183 | 183 | |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | return $object; |
193 | 193 | } |
194 | - catch(Exception $e) |
|
194 | + catch (Exception $e) |
|
195 | 195 | { |
196 | 196 | print $e->getMessage(); |
197 | 197 | return -5; |
@@ -210,21 +210,21 @@ discard block |
||
210 | 210 | * @return int <=0 if KO, >0 if OK |
211 | 211 | * @see rebuildObjectClass |
212 | 212 | */ |
213 | -function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='', $object=null) |
|
213 | +function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '', $object = null) |
|
214 | 214 | { |
215 | 215 | global $db, $langs; |
216 | 216 | |
217 | 217 | $error = 0; |
218 | 218 | |
219 | 219 | if (empty($objectname)) return -1; |
220 | - if (empty($readdir)) $readdir=$destdir; |
|
220 | + if (empty($readdir)) $readdir = $destdir; |
|
221 | 221 | |
222 | - $pathoffiletoclasssrc=$readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
222 | + $pathoffiletoclasssrc = $readdir.'/class/'.strtolower($objectname).'.class.php'; |
|
223 | 223 | |
224 | 224 | // Edit .sql file |
225 | - $pathoffiletoeditsrc=$readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
|
226 | - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); |
|
227 | - if (! dol_is_file($pathoffiletoeditsrc)) |
|
225 | + $pathoffiletoeditsrc = $readdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
|
226 | + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'.($readdir != $destdir ? '.new' : ''); |
|
227 | + if (!dol_is_file($pathoffiletoeditsrc)) |
|
228 | 228 | { |
229 | 229 | $langs->load("errors"); |
230 | 230 | setEventMessages($langs->trans("ErrorFileNotFound", $pathoffiletoeditsrc), null, 'errors'); |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | // Load object from myobject.class.php |
235 | 235 | try |
236 | 236 | { |
237 | - if (! is_object($object)) |
|
237 | + if (!is_object($object)) |
|
238 | 238 | { |
239 | 239 | include_once $pathoffiletoclasssrc; |
240 | - if (class_exists($objectname)) $object=new $objectname($db); |
|
240 | + if (class_exists($objectname)) $object = new $objectname($db); |
|
241 | 241 | else return -1; |
242 | 242 | } |
243 | 243 | } |
244 | - catch(Exception $e) |
|
244 | + catch (Exception $e) |
|
245 | 245 | { |
246 | 246 | print $e->getMessage(); |
247 | 247 | } |
@@ -251,38 +251,38 @@ discard block |
||
251 | 251 | |
252 | 252 | $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); |
253 | 253 | |
254 | - $i=0; |
|
254 | + $i = 0; |
|
255 | 255 | $texttoinsert = '-- BEGIN MODULEBUILDER FIELDS'."\n"; |
256 | 256 | if (count($object->fields)) |
257 | 257 | { |
258 | - foreach($object->fields as $key => $val) |
|
258 | + foreach ($object->fields as $key => $val) |
|
259 | 259 | { |
260 | 260 | $i++; |
261 | 261 | |
262 | 262 | $type = $val['type']; |
263 | - $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' |
|
263 | + $type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php' |
|
264 | 264 | |
265 | - if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database |
|
266 | - else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database |
|
265 | + if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database |
|
266 | + else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database |
|
267 | 267 | else if ($type == 'link' || $type == 'sellist') $type = 'integer'; |
268 | - $texttoinsert.= "\t".$key." ".$type; |
|
269 | - if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY'; |
|
270 | - if ($key == 'entity') $texttoinsert.= ' DEFAULT 1'; |
|
268 | + $texttoinsert .= "\t".$key." ".$type; |
|
269 | + if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY'; |
|
270 | + if ($key == 'entity') $texttoinsert .= ' DEFAULT 1'; |
|
271 | 271 | else |
272 | 272 | { |
273 | 273 | if ($val['default'] != '') |
274 | 274 | { |
275 | - if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL"; |
|
276 | - else if (preg_match('/varchar/', $type )) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'"; |
|
277 | - else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:''); |
|
275 | + if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL"; |
|
276 | + else if (preg_match('/varchar/', $type)) $texttoinsert .= " DEFAULT '".$db->escape($val['default'])."'"; |
|
277 | + else $texttoinsert .= (($val['default'] > 0) ? ' DEFAULT '.$val['default'] : ''); |
|
278 | 278 | } |
279 | 279 | } |
280 | - $texttoinsert.= (($val['notnull'] > 0)?' NOT NULL':''); |
|
281 | - if ($i < count($object->fields)) $texttoinsert.=", "; |
|
282 | - $texttoinsert.= "\n"; |
|
280 | + $texttoinsert .= (($val['notnull'] > 0) ? ' NOT NULL' : ''); |
|
281 | + if ($i < count($object->fields)) $texttoinsert .= ", "; |
|
282 | + $texttoinsert .= "\n"; |
|
283 | 283 | } |
284 | 284 | } |
285 | - $texttoinsert.= "\t".'-- END MODULEBUILDER FIELDS'; |
|
285 | + $texttoinsert .= "\t".'-- END MODULEBUILDER FIELDS'; |
|
286 | 286 | |
287 | 287 | $contentsql = preg_replace('/-- BEGIN MODULEBUILDER FIELDS.*END MODULEBUILDER FIELDS/ims', $texttoinsert, $contentsql); |
288 | 288 | |
@@ -297,35 +297,35 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | // Edit .key.sql file |
300 | - $pathoffiletoeditsrc=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; |
|
301 | - $pathoffiletoedittarget=$destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); |
|
300 | + $pathoffiletoeditsrc = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'; |
|
301 | + $pathoffiletoedittarget = $destdir.'/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql'.($readdir != $destdir ? '.new' : ''); |
|
302 | 302 | |
303 | 303 | $contentsql = file_get_contents(dol_osencode($pathoffiletoeditsrc), 'r'); |
304 | 304 | |
305 | - $i=0; |
|
305 | + $i = 0; |
|
306 | 306 | $texttoinsert = '-- BEGIN MODULEBUILDER INDEXES'."\n"; |
307 | 307 | if (count($object->fields)) |
308 | 308 | { |
309 | - foreach($object->fields as $key => $val) |
|
309 | + foreach ($object->fields as $key => $val) |
|
310 | 310 | { |
311 | 311 | $i++; |
312 | - if (! empty($val['index'])) |
|
312 | + if (!empty($val['index'])) |
|
313 | 313 | { |
314 | - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; |
|
315 | - $texttoinsert.= "\n"; |
|
314 | + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");"; |
|
315 | + $texttoinsert .= "\n"; |
|
316 | 316 | } |
317 | - if (! empty($val['foreignkey'])) |
|
317 | + if (!empty($val['foreignkey'])) |
|
318 | 318 | { |
319 | - $tmp=explode('.',$val['foreignkey']); |
|
320 | - if (! empty($tmp[0]) && ! empty($tmp[1])) |
|
319 | + $tmp = explode('.', $val['foreignkey']); |
|
320 | + if (!empty($tmp[0]) && !empty($tmp[1])) |
|
321 | 321 | { |
322 | - $texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; |
|
323 | - $texttoinsert.= "\n"; |
|
322 | + $texttoinsert .= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");"; |
|
323 | + $texttoinsert .= "\n"; |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | } |
327 | 327 | } |
328 | - $texttoinsert.= '-- END MODULEBUILDER INDEXES'; |
|
328 | + $texttoinsert .= '-- END MODULEBUILDER INDEXES'; |
|
329 | 329 | |
330 | 330 | $contentsql = preg_replace('/-- BEGIN MODULEBUILDER INDEXES.*END MODULEBUILDER INDEXES/ims', $texttoinsert, $contentsql); |
331 | 331 |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $head[$h][2] = 'general'; |
43 | 43 | $h++; |
44 | 44 | |
45 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
46 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
45 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_MEMBER_ACTIVE)) |
|
46 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
47 | 47 | { |
48 | 48 | $langs->load("ldap"); |
49 | 49 | |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | $h++; |
54 | 54 | } |
55 | 55 | |
56 | - if (! empty($user->rights->adherent->cotisation->lire)) |
|
56 | + if (!empty($user->rights->adherent->cotisation->lire)) |
|
57 | 57 | { |
58 | - $nbSubscription = is_array($object->subscriptions)?count($object->subscriptions):0; |
|
58 | + $nbSubscription = is_array($object->subscriptions) ?count($object->subscriptions) : 0; |
|
59 | 59 | $head[$h][0] = DOL_URL_ROOT.'/adherents/subscription.php?rowid='.$object->id; |
60 | 60 | $head[$h][1] = $langs->trans("Subscriptions"); |
61 | 61 | $head[$h][2] = 'subscription'; |
62 | - if ($nbSubscription > 0) $head[$h][1].= ' <span class="badge">'.$nbSubscription.'</span>'; |
|
62 | + if ($nbSubscription > 0) $head[$h][1] .= ' <span class="badge">'.$nbSubscription.'</span>'; |
|
63 | 63 | $h++; |
64 | 64 | } |
65 | 65 | |
@@ -67,45 +67,45 @@ discard block |
||
67 | 67 | // Entries must be declared in modules descriptor with line |
68 | 68 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
69 | 69 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
70 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member'); |
|
70 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member'); |
|
71 | 71 | |
72 | 72 | $nbNote = 0; |
73 | - if(!empty($object->note)) $nbNote++; |
|
74 | - if(!empty($object->note_private)) $nbNote++; |
|
75 | - if(!empty($object->note_public)) $nbNote++; |
|
73 | + if (!empty($object->note)) $nbNote++; |
|
74 | + if (!empty($object->note_private)) $nbNote++; |
|
75 | + if (!empty($object->note_public)) $nbNote++; |
|
76 | 76 | $head[$h][0] = DOL_URL_ROOT.'/adherents/note.php?id='.$object->id; |
77 | 77 | $head[$h][1] = $langs->trans("Note"); |
78 | 78 | $head[$h][2] = 'note'; |
79 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
79 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
80 | 80 | $h++; |
81 | 81 | |
82 | 82 | // Attachments |
83 | 83 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
84 | 84 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
85 | - $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0,0,0,1,$object,'member'); |
|
86 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
87 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
85 | + $upload_dir = $conf->adherent->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'member'); |
|
86 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
87 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
88 | 88 | $head[$h][0] = DOL_URL_ROOT.'/adherents/document.php?id='.$object->id; |
89 | 89 | $head[$h][1] = $langs->trans('Documents'); |
90 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
90 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
91 | 91 | $head[$h][2] = 'document'; |
92 | 92 | $h++; |
93 | 93 | |
94 | 94 | // Show agenda tab |
95 | - if (! empty($conf->agenda->enabled)) |
|
95 | + if (!empty($conf->agenda->enabled)) |
|
96 | 96 | { |
97 | 97 | $head[$h][0] = DOL_URL_ROOT."/adherents/agenda.php?id=".$object->id; |
98 | 98 | $head[$h][1] = $langs->trans("Events"); |
99 | - if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) |
|
99 | + if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) |
|
100 | 100 | { |
101 | - $head[$h][1].= '/'; |
|
102 | - $head[$h][1].= $langs->trans("Agenda"); |
|
101 | + $head[$h][1] .= '/'; |
|
102 | + $head[$h][1] .= $langs->trans("Agenda"); |
|
103 | 103 | } |
104 | 104 | $head[$h][2] = 'agenda'; |
105 | 105 | $h++; |
106 | 106 | } |
107 | 107 | |
108 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member','remove'); |
|
108 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member', 'remove'); |
|
109 | 109 | |
110 | 110 | return $head; |
111 | 111 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | { |
121 | 121 | global $langs, $conf, $user; |
122 | 122 | |
123 | - $h=0; |
|
123 | + $h = 0; |
|
124 | 124 | $head = array(); |
125 | 125 | |
126 | 126 | $head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id; |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | $head[$h][2] = 'card'; |
129 | 129 | $h++; |
130 | 130 | |
131 | - if ((! empty($conf->ldap->enabled) && ! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
132 | - && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || ! empty($user->admin))) |
|
131 | + if ((!empty($conf->ldap->enabled) && !empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE)) |
|
132 | + && (empty($conf->global->MAIN_DISABLE_LDAP_TAB) || !empty($user->admin))) |
|
133 | 133 | { |
134 | 134 | $langs->load("ldap"); |
135 | 135 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | // Entries must be declared in modules descriptor with line |
144 | 144 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
145 | 145 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
146 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype'); |
|
146 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype'); |
|
147 | 147 | |
148 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype','remove'); |
|
148 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'membertype', 'remove'); |
|
149 | 149 | |
150 | 150 | return $head; |
151 | 151 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // Entries must be declared in modules descriptor with line |
177 | 177 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
178 | 178 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
179 | - complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin'); |
|
179 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin'); |
|
180 | 180 | |
181 | 181 | $head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php'; |
182 | 182 | $head[$h][1] = $langs->trans("ExtraFieldsMember"); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $head[$h][2] = 'website'; |
194 | 194 | $h++; |
195 | 195 | |
196 | - complete_head_from_modules($conf,$langs,'',$head,$h,'member_admin','remove'); |
|
196 | + complete_head_from_modules($conf, $langs, '', $head, $h, 'member_admin', 'remove'); |
|
197 | 197 | |
198 | 198 | return $head; |
199 | 199 | } |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | // Entries must be declared in modules descriptor with line |
247 | 247 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
248 | 248 | // $this->tabs = array('entity:-tabname); to remove a tab |
249 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats'); |
|
249 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats'); |
|
250 | 250 | |
251 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'member_stats','remove'); |
|
251 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'member_stats', 'remove'); |
|
252 | 252 | |
253 | 253 | return $head; |
254 | 254 | } |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | // Entries must be declared in modules descriptor with line |
281 | 281 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
282 | 282 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
283 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription'); |
|
283 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription'); |
|
284 | 284 | |
285 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'subscription','remove'); |
|
285 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'subscription', 'remove'); |
|
286 | 286 | |
287 | 287 | return $head; |
288 | 288 | } |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | |
43 | 43 | if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) |
44 | 44 | { |
45 | - $nbContact = count($object->liste_contact(-1,'internal')) + count($object->liste_contact(-1,'external')); |
|
45 | + $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); |
|
46 | 46 | $head[$h][0] = DOL_URL_ROOT.'/contrat/contact.php?id='.$object->id; |
47 | 47 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
48 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
48 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
49 | 49 | $head[$h][2] = 'contact'; |
50 | 50 | $h++; |
51 | 51 | } |
@@ -54,28 +54,28 @@ discard block |
||
54 | 54 | // Entries must be declared in modules descriptor with line |
55 | 55 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
56 | 56 | // $this->tabs = array('entity:-tabname); to remove a tab |
57 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'contract'); |
|
57 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract'); |
|
58 | 58 | |
59 | 59 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
60 | 60 | { |
61 | 61 | $nbNote = 0; |
62 | - if(!empty($object->note_private)) $nbNote++; |
|
63 | - if(!empty($object->note_public)) $nbNote++; |
|
62 | + if (!empty($object->note_private)) $nbNote++; |
|
63 | + if (!empty($object->note_public)) $nbNote++; |
|
64 | 64 | $head[$h][0] = DOL_URL_ROOT.'/contrat/note.php?id='.$object->id; |
65 | 65 | $head[$h][1] = $langs->trans("Notes"); |
66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
66 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
67 | 67 | $head[$h][2] = 'note'; |
68 | 68 | $h++; |
69 | 69 | } |
70 | 70 | |
71 | 71 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
72 | 72 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
73 | - $upload_dir = $conf->contrat->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
74 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
75 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
73 | + $upload_dir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref); |
|
74 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
75 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
76 | 76 | $head[$h][0] = DOL_URL_ROOT.'/contrat/document.php?id='.$object->id; |
77 | 77 | $head[$h][1] = $langs->trans("Documents"); |
78 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
78 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
79 | 79 | $head[$h][2] = 'documents'; |
80 | 80 | $h++; |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $head[$h][2] = 'info'; |
85 | 85 | $h++; |
86 | 86 | |
87 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'contract','remove'); |
|
87 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'contract', 'remove'); |
|
88 | 88 | |
89 | 89 | return $head; |
90 | 90 | } |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | // Entries must be declared in modules descriptor with line |
111 | 111 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
112 | 112 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
113 | - complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin'); |
|
113 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin'); |
|
114 | 114 | |
115 | 115 | $head[$h][0] = DOL_URL_ROOT.'/contrat/admin/contract_extrafields.php'; |
116 | 116 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | |
126 | 126 | |
127 | - complete_head_from_modules($conf,$langs,null,$head,$h,'contract_admin','remove'); |
|
127 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'contract_admin', 'remove'); |
|
128 | 128 | |
129 | 129 | return $head; |
130 | 130 | } |
@@ -38,22 +38,22 @@ discard block |
||
38 | 38 | { |
39 | 39 | while ($row = $db->fetch_array($resql)) |
40 | 40 | { |
41 | - $_Avery_Labels[$row['code']]['name']=$row['name']; |
|
42 | - $_Avery_Labels[$row['code']]['paper-size']=$row['paper_size']; |
|
43 | - $_Avery_Labels[$row['code']]['orientation']=$row['orientation']; |
|
44 | - $_Avery_Labels[$row['code']]['metric']=$row['metric']; |
|
45 | - $_Avery_Labels[$row['code']]['marginLeft']=$row['leftmargin']; |
|
46 | - $_Avery_Labels[$row['code']]['marginTop']=$row['topmargin']; |
|
47 | - $_Avery_Labels[$row['code']]['marginTop']=$row['topmargin']; |
|
48 | - $_Avery_Labels[$row['code']]['NX']=$row['nx']; |
|
49 | - $_Avery_Labels[$row['code']]['NY']=$row['ny']; |
|
50 | - $_Avery_Labels[$row['code']]['SpaceX']=$row['spacex']; |
|
51 | - $_Avery_Labels[$row['code']]['SpaceY']=$row['spacey']; |
|
52 | - $_Avery_Labels[$row['code']]['width']=$row['width']; |
|
53 | - $_Avery_Labels[$row['code']]['height']=$row['height']; |
|
54 | - $_Avery_Labels[$row['code']]['font-size']=$row['font_size']; |
|
55 | - $_Avery_Labels[$row['code']]['custom_x']=$row['custom_x']; |
|
56 | - $_Avery_Labels[$row['code']]['custom_y']=$row['custom_y']; |
|
41 | + $_Avery_Labels[$row['code']]['name'] = $row['name']; |
|
42 | + $_Avery_Labels[$row['code']]['paper-size'] = $row['paper_size']; |
|
43 | + $_Avery_Labels[$row['code']]['orientation'] = $row['orientation']; |
|
44 | + $_Avery_Labels[$row['code']]['metric'] = $row['metric']; |
|
45 | + $_Avery_Labels[$row['code']]['marginLeft'] = $row['leftmargin']; |
|
46 | + $_Avery_Labels[$row['code']]['marginTop'] = $row['topmargin']; |
|
47 | + $_Avery_Labels[$row['code']]['marginTop'] = $row['topmargin']; |
|
48 | + $_Avery_Labels[$row['code']]['NX'] = $row['nx']; |
|
49 | + $_Avery_Labels[$row['code']]['NY'] = $row['ny']; |
|
50 | + $_Avery_Labels[$row['code']]['SpaceX'] = $row['spacex']; |
|
51 | + $_Avery_Labels[$row['code']]['SpaceY'] = $row['spacey']; |
|
52 | + $_Avery_Labels[$row['code']]['width'] = $row['width']; |
|
53 | + $_Avery_Labels[$row['code']]['height'] = $row['height']; |
|
54 | + $_Avery_Labels[$row['code']]['font-size'] = $row['font_size']; |
|
55 | + $_Avery_Labels[$row['code']]['custom_x'] = $row['custom_x']; |
|
56 | + $_Avery_Labels[$row['code']]['custom_y'] = $row['custom_y']; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | else |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | } |
63 | 63 | |
64 | 64 | // We add characteristics to the name |
65 | -foreach($_Avery_Labels as $key => $val) |
|
65 | +foreach ($_Avery_Labels as $key => $val) |
|
66 | 66 | { |
67 | - $_Avery_Labels[$key]['name'].=' ('.$_Avery_Labels[$key]['paper-size'].' - '.$_Avery_Labels[$key]['NX'].'x'.$_Avery_Labels[$key]['NY'].')'; |
|
67 | + $_Avery_Labels[$key]['name'] .= ' ('.$_Avery_Labels[$key]['paper-size'].' - '.$_Avery_Labels[$key]['NX'].'x'.$_Avery_Labels[$key]['NY'].')'; |
|
68 | 68 | } |
69 | 69 |
@@ -50,25 +50,25 @@ discard block |
||
50 | 50 | // Entries must be declared in modules descriptor with line |
51 | 51 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
52 | 52 | // $this->tabs = array('entity:-tabname); to remove a tab |
53 | - complete_head_from_modules($conf, $langs, $object, $head, $tab,'loan'); |
|
53 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan'); |
|
54 | 54 | |
55 | 55 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
56 | 56 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
57 | - $upload_dir = $conf->loan->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
58 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
59 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
57 | + $upload_dir = $conf->loan->dir_output."/".dol_sanitizeFileName($object->ref); |
|
58 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
59 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
60 | 60 | $head[$tab][0] = DOL_URL_ROOT.'/loan/document.php?id='.$object->id; |
61 | 61 | $head[$tab][1] = $langs->trans("Documents"); |
62 | - if (($nbFiles+$nbLinks) > 0) $head[$tab][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
62 | + if (($nbFiles + $nbLinks) > 0) $head[$tab][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
63 | 63 | $head[$tab][2] = 'documents'; |
64 | 64 | $tab++; |
65 | 65 | |
66 | 66 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
67 | 67 | { |
68 | - $nbNote = (empty($object->note_private)?0:1)+(empty($object->note_public)?0:1); |
|
68 | + $nbNote = (empty($object->note_private) ? 0 : 1) + (empty($object->note_public) ? 0 : 1); |
|
69 | 69 | $head[$tab][0] = DOL_URL_ROOT."/loan/note.php?id=".$object->id; |
70 | 70 | $head[$tab][1] = $langs->trans("Notes"); |
71 | - if($nbNote > 0) $head[$tab][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
71 | + if ($nbNote > 0) $head[$tab][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
72 | 72 | $head[$tab][2] = 'note'; |
73 | 73 | $tab++; |
74 | 74 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $head[$tab][2] = 'info'; |
79 | 79 | $tab++; |
80 | 80 | |
81 | - complete_head_from_modules($conf,$langs,$object,$head,$tab,'loan','remove'); |
|
81 | + complete_head_from_modules($conf, $langs, $object, $head, $tab, 'loan', 'remove'); |
|
82 | 82 | |
83 | 83 | return $head; |
84 | 84 | } |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Define size of logo small and mini |
26 | -$maxwidthsmall=270;$maxheightsmall=150; |
|
27 | -$maxwidthmini=128;$maxheightmini=72; |
|
26 | +$maxwidthsmall = 270; $maxheightsmall = 150; |
|
27 | +$maxwidthmini = 128; $maxheightmini = 72; |
|
28 | 28 | $quality = 80; |
29 | 29 | |
30 | 30 | |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function image_format_supported($file) |
39 | 39 | { |
40 | - $regeximgext='\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php |
|
40 | + $regeximgext = '\.gif|\.jpg|\.jpeg|\.png|\.bmp|\.xpm|\.xbm|\.svg'; // See also into product.class.php |
|
41 | 41 | |
42 | 42 | // Case filename is not a format image |
43 | - if (! preg_match('/('.$regeximgext.')$/i',$file,$reg)) return -1; |
|
43 | + if (!preg_match('/('.$regeximgext.')$/i', $file, $reg)) return -1; |
|
44 | 44 | |
45 | 45 | // Case filename is a format image but not supported by this PHP |
46 | - $imgfonction=''; |
|
46 | + $imgfonction = ''; |
|
47 | 47 | if (strtolower($reg[1]) == '.gif') $imgfonction = 'imagecreatefromgif'; |
48 | 48 | if (strtolower($reg[1]) == '.png') $imgfonction = 'imagecreatefrompng'; |
49 | 49 | if (strtolower($reg[1]) == '.jpg') $imgfonction = 'imagecreatefromjpeg'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (strtolower($reg[1]) == '.xbm') $imgfonction = 'imagecreatefromxbm'; |
54 | 54 | if ($imgfonction) |
55 | 55 | { |
56 | - if (! function_exists($imgfonction)) |
|
56 | + if (!function_exists($imgfonction)) |
|
57 | 57 | { |
58 | 58 | // Fonctions de conversion non presente dans ce PHP |
59 | 59 | return 0; |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | */ |
75 | 75 | function dol_getImageSize($file, $url = false) |
76 | 76 | { |
77 | - $ret=array(); |
|
77 | + $ret = array(); |
|
78 | 78 | |
79 | 79 | if (image_format_supported($file) < 0) return $ret; |
80 | 80 | |
81 | 81 | $filetoread = $file; |
82 | 82 | if (!$url) |
83 | 83 | { |
84 | - $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
84 | + $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if ($filetoread) |
88 | 88 | { |
89 | 89 | $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image |
90 | - $ret['width']=$infoImg[0]; // Largeur de l'image |
|
91 | - $ret['height']=$infoImg[1]; // Hauteur de l'image |
|
90 | + $ret['width'] = $infoImg[0]; // Largeur de l'image |
|
91 | + $ret['height'] = $infoImg[1]; // Hauteur de l'image |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return $ret; |
@@ -106,33 +106,33 @@ discard block |
||
106 | 106 | * @param int $src_y Position of croping image in source image (not use if mode=0) |
107 | 107 | * @return int File name if OK, error message if KO |
108 | 108 | */ |
109 | -function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $src_y=0) |
|
109 | +function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0) |
|
110 | 110 | { |
111 | 111 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
112 | 112 | |
113 | - global $conf,$langs; |
|
113 | + global $conf, $langs; |
|
114 | 114 | |
115 | 115 | dol_syslog("dol_imageResizeOrCrop file=".$file." mode=".$mode." newWidth=".$newWidth." newHeight=".$newHeight." src_x=".$src_x." src_y=".$src_y); |
116 | 116 | |
117 | 117 | // Clean parameters |
118 | - $file=trim($file); |
|
118 | + $file = trim($file); |
|
119 | 119 | |
120 | 120 | // Check parameters |
121 | - if (! $file) |
|
121 | + if (!$file) |
|
122 | 122 | { |
123 | 123 | // Si le fichier n'a pas ete indique |
124 | 124 | return 'Bad parameter file'; |
125 | 125 | } |
126 | - elseif (! file_exists($file)) |
|
126 | + elseif (!file_exists($file)) |
|
127 | 127 | { |
128 | 128 | // Si le fichier passe en parametre n'existe pas |
129 | - return $langs->trans("ErrorFileNotFound",$file); |
|
129 | + return $langs->trans("ErrorFileNotFound", $file); |
|
130 | 130 | } |
131 | - elseif(image_format_supported($file) < 0) |
|
131 | + elseif (image_format_supported($file) < 0) |
|
132 | 132 | { |
133 | 133 | return 'This filename '.$file.' does not seem to be an image filename.'; |
134 | 134 | } |
135 | - elseif(!is_numeric($newWidth) && !is_numeric($newHeight)) |
|
135 | + elseif (!is_numeric($newWidth) && !is_numeric($newHeight)) |
|
136 | 136 | { |
137 | 137 | return 'Wrong value for parameter newWidth or newHeight'; |
138 | 138 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | return 'Both newHeight or newWidth must be defined for croping'; |
146 | 146 | } |
147 | 147 | |
148 | - $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
148 | + $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
149 | 149 | |
150 | 150 | $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image |
151 | 151 | $imgWidth = $infoImg[0]; // Largeur de l'image |
@@ -153,18 +153,18 @@ discard block |
||
153 | 153 | |
154 | 154 | if ($mode == 0) // If resize, we check parameters |
155 | 155 | { |
156 | - if ($newWidth <= 0) |
|
156 | + if ($newWidth <= 0) |
|
157 | 157 | { |
158 | - $newWidth=intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio |
|
158 | + $newWidth = intval(($newHeight / $imgHeight) * $imgWidth); // Keep ratio |
|
159 | 159 | } |
160 | 160 | if ($newHeight <= 0) |
161 | 161 | { |
162 | - $newHeight=intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio |
|
162 | + $newHeight = intval(($newWidth / $imgWidth) * $imgHeight); // Keep ratio |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - $imgfonction=''; |
|
167 | - switch($infoImg[2]) |
|
166 | + $imgfonction = ''; |
|
167 | + switch ($infoImg[2]) |
|
168 | 168 | { |
169 | 169 | case 1: // IMG_GIF |
170 | 170 | $imgfonction = 'imagecreatefromgif'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } |
182 | 182 | if ($imgfonction) |
183 | 183 | { |
184 | - if (! function_exists($imgfonction)) |
|
184 | + if (!function_exists($imgfonction)) |
|
185 | 185 | { |
186 | 186 | // Fonctions de conversion non presente dans ce PHP |
187 | 187 | return 'Resize not possible. This PHP does not support GD functions '.$imgfonction; |
@@ -189,27 +189,27 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | // Initialisation des variables selon l'extension de l'image |
192 | - switch($infoImg[2]) |
|
192 | + switch ($infoImg[2]) |
|
193 | 193 | { |
194 | 194 | case 1: // Gif |
195 | 195 | $img = imagecreatefromgif($filetoread); |
196 | - $extImg = '.gif'; // File name extension of image |
|
197 | - $newquality='NU'; // Quality is not used for this format |
|
196 | + $extImg = '.gif'; // File name extension of image |
|
197 | + $newquality = 'NU'; // Quality is not used for this format |
|
198 | 198 | break; |
199 | 199 | case 2: // Jpg |
200 | 200 | $img = imagecreatefromjpeg($filetoread); |
201 | 201 | $extImg = '.jpg'; |
202 | - $newquality=100; // % quality maximum |
|
202 | + $newquality = 100; // % quality maximum |
|
203 | 203 | break; |
204 | 204 | case 3: // Png |
205 | 205 | $img = imagecreatefrompng($filetoread); |
206 | 206 | $extImg = '.png'; |
207 | - $newquality=0; // No compression (0-9) |
|
207 | + $newquality = 0; // No compression (0-9) |
|
208 | 208 | break; |
209 | 209 | case 4: // Bmp |
210 | 210 | $img = imagecreatefromwbmp($filetoread); |
211 | 211 | $extImg = '.bmp'; |
212 | - $newquality='NU'; // Quality is not used for this format |
|
212 | + $newquality = 'NU'; // Quality is not used for this format |
|
213 | 213 | break; |
214 | 214 | } |
215 | 215 | |
@@ -237,18 +237,18 @@ discard block |
||
237 | 237 | } |
238 | 238 | |
239 | 239 | // Initialisation des variables selon l'extension de l'image |
240 | - switch($infoImg[2]) |
|
240 | + switch ($infoImg[2]) |
|
241 | 241 | { |
242 | 242 | case 1: // Gif |
243 | 243 | $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF |
244 | - imagecolortransparent($imgThumb,$trans_colour); |
|
244 | + imagecolortransparent($imgThumb, $trans_colour); |
|
245 | 245 | break; |
246 | 246 | case 2: // Jpg |
247 | 247 | $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); |
248 | 248 | break; |
249 | 249 | case 3: // Png |
250 | - imagealphablending($imgThumb,false); // Pour compatibilite sur certain systeme |
|
251 | - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel |
|
250 | + imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme |
|
251 | + $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel |
|
252 | 252 | break; |
253 | 253 | case 4: // Bmp |
254 | 254 | $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | dol_syslog("dol_imageResizeOrCrop: convert image from ($imgWidth x $imgHeight) at position ($src_x x $src_y) to ($newWidth x $newHeight) as $extImg, newquality=$newquality"); |
260 | 260 | //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee |
261 | - imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode==0?$imgWidth:$newWidth), ($mode==0?$imgHeight:$newHeight)); // Insere l'image de base redimensionnee |
|
261 | + imagecopyresampled($imgThumb, $img, 0, 0, $src_x, $src_y, $newWidth, $newHeight, ($mode == 0 ? $imgWidth : $newWidth), ($mode == 0 ? $imgHeight : $newHeight)); // Insere l'image de base redimensionnee |
|
262 | 262 | |
263 | 263 | $imgThumbName = $file; |
264 | 264 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | //fclose($fp); |
268 | 268 | |
269 | 269 | // Create image on disk |
270 | - switch($infoImg[2]) |
|
270 | + switch ($infoImg[2]) |
|
271 | 271 | { |
272 | 272 | case 1: // Gif |
273 | 273 | imagegif($imgThumb, $imgThumbName); |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | // Set permissions on file |
287 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); |
|
287 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); |
|
288 | 288 | |
289 | 289 | // Free memory. This does not delete image. |
290 | 290 | imagedestroy($img); |
291 | 291 | imagedestroy($imgThumb); |
292 | 292 | |
293 | - clearstatcache(); // File was replaced by a modified one, so we clear file caches. |
|
293 | + clearstatcache(); // File was replaced by a modified one, so we clear file caches. |
|
294 | 294 | |
295 | 295 | return $imgThumbName; |
296 | 296 | } |
@@ -349,64 +349,64 @@ discard block |
||
349 | 349 | * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) |
350 | 350 | * @return string Full path of thumb or '' if it fails or 'Error...' if it fails |
351 | 351 | */ |
352 | -function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0) |
|
352 | +function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $quality = 50, $outdir = 'thumbs', $targetformat = 0) |
|
353 | 353 | { |
354 | 354 | require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
355 | 355 | |
356 | - global $conf,$langs; |
|
356 | + global $conf, $langs; |
|
357 | 357 | |
358 | 358 | dol_syslog("vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality." outdir=".$outdir." targetformat=".$targetformat); |
359 | 359 | |
360 | 360 | // Clean parameters |
361 | - $file=trim($file); |
|
361 | + $file = trim($file); |
|
362 | 362 | |
363 | 363 | // Check parameters |
364 | - if (! $file) |
|
364 | + if (!$file) |
|
365 | 365 | { |
366 | 366 | // Si le fichier n'a pas ete indique |
367 | 367 | return 'ErrorBadParameters'; |
368 | 368 | } |
369 | - elseif (! file_exists($file)) |
|
369 | + elseif (!file_exists($file)) |
|
370 | 370 | { |
371 | 371 | // Si le fichier passe en parametre n'existe pas |
372 | - dol_syslog($langs->trans("ErrorFileNotFound",$file),LOG_ERR); |
|
373 | - return $langs->trans("ErrorFileNotFound",$file); |
|
372 | + dol_syslog($langs->trans("ErrorFileNotFound", $file), LOG_ERR); |
|
373 | + return $langs->trans("ErrorFileNotFound", $file); |
|
374 | 374 | } |
375 | - elseif(image_format_supported($file) < 0) |
|
375 | + elseif (image_format_supported($file) < 0) |
|
376 | 376 | { |
377 | - dol_syslog('This file '.$file.' does not seem to be an image format file name.',LOG_WARNING); |
|
377 | + dol_syslog('This file '.$file.' does not seem to be an image format file name.', LOG_WARNING); |
|
378 | 378 | return 'ErrorBadImageFormat'; |
379 | 379 | } |
380 | - elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1){ |
|
380 | + elseif (!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < -1) { |
|
381 | 381 | // Si la largeur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) |
382 | - dol_syslog('Wrong value for parameter maxWidth',LOG_ERR); |
|
382 | + dol_syslog('Wrong value for parameter maxWidth', LOG_ERR); |
|
383 | 383 | return 'Error: Wrong value for parameter maxWidth'; |
384 | 384 | } |
385 | - elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1){ |
|
385 | + elseif (!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < -1) { |
|
386 | 386 | // Si la hauteur max est incorrecte (n'est pas numerique, est vide, ou est inferieure a 0) |
387 | - dol_syslog('Wrong value for parameter maxHeight',LOG_ERR); |
|
387 | + dol_syslog('Wrong value for parameter maxHeight', LOG_ERR); |
|
388 | 388 | return 'Error: Wrong value for parameter maxHeight'; |
389 | 389 | } |
390 | 390 | |
391 | - $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
391 | + $filetoread = realpath(dol_osencode($file)); // Chemin canonique absolu de l'image |
|
392 | 392 | |
393 | 393 | $infoImg = getimagesize($filetoread); // Recuperation des infos de l'image |
394 | 394 | $imgWidth = $infoImg[0]; // Largeur de l'image |
395 | 395 | $imgHeight = $infoImg[1]; // Hauteur de l'image |
396 | 396 | |
397 | - if ($maxWidth == -1) $maxWidth=$infoImg[0]; // If size is -1, we keep unchanged |
|
398 | - if ($maxHeight == -1) $maxHeight=$infoImg[1]; // If size is -1, we keep unchanged |
|
397 | + if ($maxWidth == -1) $maxWidth = $infoImg[0]; // If size is -1, we keep unchanged |
|
398 | + if ($maxHeight == -1) $maxHeight = $infoImg[1]; // If size is -1, we keep unchanged |
|
399 | 399 | |
400 | 400 | // Si l'image est plus petite que la largeur et la hauteur max, on ne cree pas de vignette |
401 | 401 | if ($infoImg[0] < $maxWidth && $infoImg[1] < $maxHeight) |
402 | 402 | { |
403 | 403 | // On cree toujours les vignettes |
404 | - dol_syslog("File size is smaller than thumb size",LOG_DEBUG); |
|
404 | + dol_syslog("File size is smaller than thumb size", LOG_DEBUG); |
|
405 | 405 | //return 'Le fichier '.$file.' ne necessite pas de creation de vignette'; |
406 | 406 | } |
407 | 407 | |
408 | - $imgfonction=''; |
|
409 | - switch($infoImg[2]) |
|
408 | + $imgfonction = ''; |
|
409 | + switch ($infoImg[2]) |
|
410 | 410 | { |
411 | 411 | case IMAGETYPE_GIF: // 1 |
412 | 412 | $imgfonction = 'imagecreatefromgif'; |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | if ($imgfonction) |
428 | 428 | { |
429 | - if (! function_exists($imgfonction)) |
|
429 | + if (!function_exists($imgfonction)) |
|
430 | 430 | { |
431 | 431 | // Fonctions de conversion non presente dans ce PHP |
432 | 432 | return 'Error: Creation of thumbs not possible. This PHP does not support GD function '.$imgfonction; |
@@ -434,12 +434,12 @@ discard block |
||
434 | 434 | } |
435 | 435 | |
436 | 436 | // On cree le repertoire contenant les vignettes |
437 | - $dirthumb = dirname($file).($outdir?'/'.$outdir:''); // Chemin du dossier contenant les vignettes |
|
437 | + $dirthumb = dirname($file).($outdir ? '/'.$outdir : ''); // Chemin du dossier contenant les vignettes |
|
438 | 438 | dol_mkdir($dirthumb); |
439 | 439 | |
440 | 440 | // Initialisation des variables selon l'extension de l'image |
441 | - $img=null; |
|
442 | - switch($infoImg[2]) |
|
441 | + $img = null; |
|
442 | + switch ($infoImg[2]) |
|
443 | 443 | { |
444 | 444 | case IMAGETYPE_GIF: // 1 |
445 | 445 | $img = imagecreatefromgif($filetoread); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | break; |
448 | 448 | case IMAGETYPE_JPEG: // 2 |
449 | 449 | $img = imagecreatefromjpeg($filetoread); |
450 | - $extImg = (preg_match('/\.jpeg$/',$file)?'.jpeg':'.jpg'); // Extension de l'image |
|
450 | + $extImg = (preg_match('/\.jpeg$/', $file) ? '.jpeg' : '.jpg'); // Extension de l'image |
|
451 | 451 | break; |
452 | 452 | case IMAGETYPE_PNG: // 3 |
453 | 453 | $img = imagecreatefrompng($filetoread); |
@@ -462,21 +462,21 @@ discard block |
||
462 | 462 | $extImg = '.bmp'; |
463 | 463 | break; |
464 | 464 | } |
465 | - if (! is_resource($img)) |
|
465 | + if (!is_resource($img)) |
|
466 | 466 | { |
467 | 467 | dol_syslog('Failed to detect type of image. We found infoImg[2]='.$infoImg[2], LOG_WARNING); |
468 | 468 | return 0; |
469 | 469 | } |
470 | 470 | |
471 | 471 | // Initialisation des dimensions de la vignette si elles sont superieures a l'original |
472 | - if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; } |
|
473 | - if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; } |
|
472 | + if ($maxWidth > $imgWidth) { $maxWidth = $imgWidth; } |
|
473 | + if ($maxHeight > $imgHeight) { $maxHeight = $imgHeight; } |
|
474 | 474 | |
475 | - $whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette |
|
476 | - $imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original |
|
475 | + $whFact = $maxWidth / $maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette |
|
476 | + $imgWhFact = $imgWidth / $imgHeight; // Facteur largeur/hauteur de l'original |
|
477 | 477 | |
478 | 478 | // Fixe les dimensions de la vignette |
479 | - if($whFact < $imgWhFact) |
|
479 | + if ($whFact < $imgWhFact) |
|
480 | 480 | { |
481 | 481 | // Si largeur determinante |
482 | 482 | $thumbWidth = $maxWidth; |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | $thumbHeight = $maxHeight; |
489 | 489 | $thumbWidth = $thumbHeight * $imgWhFact; |
490 | 490 | } |
491 | - $thumbHeight=round($thumbHeight); |
|
492 | - $thumbWidth=round($thumbWidth); |
|
491 | + $thumbHeight = round($thumbHeight); |
|
492 | + $thumbWidth = round($thumbWidth); |
|
493 | 493 | |
494 | 494 | // Define target format |
495 | - if (empty($targetformat)) $targetformat=$infoImg[2]; |
|
495 | + if (empty($targetformat)) $targetformat = $infoImg[2]; |
|
496 | 496 | |
497 | 497 | // Create empty image |
498 | 498 | if ($targetformat == IMAGETYPE_GIF) |
@@ -519,35 +519,35 @@ discard block |
||
519 | 519 | |
520 | 520 | // Initialisation des variables selon l'extension de l'image |
521 | 521 | // $targetformat is 0 by default, in such case, we keep original extension |
522 | - switch($targetformat) |
|
522 | + switch ($targetformat) |
|
523 | 523 | { |
524 | 524 | case IMAGETYPE_GIF: // 1 |
525 | 525 | $trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procede autrement pour le format GIF |
526 | - imagecolortransparent($imgThumb,$trans_colour); |
|
526 | + imagecolortransparent($imgThumb, $trans_colour); |
|
527 | 527 | $extImgTarget = '.gif'; |
528 | - $newquality='NU'; |
|
528 | + $newquality = 'NU'; |
|
529 | 529 | break; |
530 | 530 | case IMAGETYPE_JPEG: // 2 |
531 | 531 | $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); |
532 | - $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'.jpg'); |
|
533 | - $newquality=$quality; |
|
532 | + $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '.jpg'); |
|
533 | + $newquality = $quality; |
|
534 | 534 | break; |
535 | 535 | case IMAGETYPE_PNG: // 3 |
536 | - imagealphablending($imgThumb,false); // Pour compatibilite sur certain systeme |
|
537 | - $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel |
|
536 | + imagealphablending($imgThumb, false); // Pour compatibilite sur certain systeme |
|
537 | + $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel |
|
538 | 538 | $extImgTarget = '.png'; |
539 | - $newquality=$quality-100; |
|
540 | - $newquality=round(abs($quality-100)*9/100); |
|
539 | + $newquality = $quality - 100; |
|
540 | + $newquality = round(abs($quality - 100) * 9 / 100); |
|
541 | 541 | break; |
542 | 542 | case IMAGETYPE_BMP: // 6 |
543 | 543 | // Not supported by PHP GD |
544 | 544 | $extImgTarget = '.bmp'; |
545 | - $newquality='NU'; |
|
545 | + $newquality = 'NU'; |
|
546 | 546 | break; |
547 | 547 | case IMAGETYPE_WBMP: // 15 |
548 | 548 | $trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0); |
549 | 549 | $extImgTarget = '.bmp'; |
550 | - $newquality='NU'; |
|
550 | + $newquality = 'NU'; |
|
551 | 551 | break; |
552 | 552 | } |
553 | 553 | if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour); |
@@ -556,10 +556,10 @@ discard block |
||
556 | 556 | //imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee |
557 | 557 | imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insere l'image de base redimensionnee |
558 | 558 | |
559 | - $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse |
|
559 | + $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // On enleve extension quelquesoit la casse |
|
560 | 560 | $fileName = basename($fileName); |
561 | 561 | //$imgThumbName = $dirthumb.'/'.getImageFileNameForSize(basename($file), $extName, $extImgTarget); // Full path of thumb file |
562 | - $imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file |
|
562 | + $imgThumbName = getImageFileNameForSize($file, $extName, $extImgTarget); // Full path of thumb file |
|
563 | 563 | |
564 | 564 | |
565 | 565 | // Check if permission are ok |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | //fclose($fp); |
568 | 568 | |
569 | 569 | // Create image on disk |
570 | - switch($targetformat) |
|
570 | + switch ($targetformat) |
|
571 | 571 | { |
572 | 572 | case IMAGETYPE_GIF: // 1 |
573 | 573 | imagegif($imgThumb, $imgThumbName); |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | // Set permissions on file |
590 | - if (! empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); |
|
590 | + if (!empty($conf->global->MAIN_UMASK)) @chmod($imgThumbName, octdec($conf->global->MAIN_UMASK)); |
|
591 | 591 | |
592 | 592 | // Free memory. This does not delete image. |
593 | 593 | imagedestroy($img); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | global $db, $langs, $conf, $user; |
38 | 38 | |
39 | 39 | // Load translation files required by the page |
40 | - $langs->loadLangs(array("sendings","deliveries")); |
|
40 | + $langs->loadLangs(array("sendings", "deliveries")); |
|
41 | 41 | |
42 | 42 | $h = 0; |
43 | 43 | $head = array(); |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | if ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire) |
51 | 51 | { |
52 | 52 | // delivery link |
53 | - $object->fetchObjectLinked($object->id,$object->element); |
|
54 | - if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery |
|
53 | + $object->fetchObjectLinked($object->id, $object->element); |
|
54 | + if (count($object->linkedObjectsIds['delivery']) > 0) // If there is a delivery |
|
55 | 55 | { |
56 | 56 | // Take first one element of array |
57 | 57 | $tmp = reset($object->linkedObjectsIds['delivery']); |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | $objectsrc = new Commande($db); |
72 | 72 | $objectsrc->fetch($object->origin_id); |
73 | 73 | } |
74 | - $nbContact = count($objectsrc->liste_contact(-1,'internal')) + count($objectsrc->liste_contact(-1,'external')); |
|
74 | + $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external')); |
|
75 | 75 | $head[$h][0] = DOL_URL_ROOT."/expedition/contact.php?id=".$object->id; |
76 | 76 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
77 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
77 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
78 | 78 | $head[$h][2] = 'contact'; |
79 | 79 | $h++; |
80 | 80 | } |
81 | 81 | |
82 | 82 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
83 | 83 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
84 | - $upload_dir = $conf->commande->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
85 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
86 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
84 | + $upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref); |
|
85 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
86 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
87 | 87 | $head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id; |
88 | 88 | $head[$h][1] = $langs->trans('Documents'); |
89 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
89 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
90 | 90 | $head[$h][2] = 'documents'; |
91 | 91 | $h++; |
92 | 92 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | if (!empty($object->note_public)) $nbNote++; |
96 | 96 | $head[$h][0] = DOL_URL_ROOT."/expedition/note.php?id=".$object->id; |
97 | 97 | $head[$h][1] = $langs->trans("Notes"); |
98 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
98 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
99 | 99 | $head[$h][2] = 'note'; |
100 | 100 | $h++; |
101 | 101 | |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | // Entries must be declared in modules descriptor with line |
104 | 104 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
105 | 105 | // $this->tabs = array('entity:-tabname); to remove a tab |
106 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery'); |
|
106 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery'); |
|
107 | 107 | |
108 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove'); |
|
108 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove'); |
|
109 | 109 | |
110 | 110 | return $head; |
111 | 111 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | global $langs, $conf, $user; |
123 | 123 | |
124 | 124 | // Load translation files required by the page |
125 | - $langs->loadLangs(array("sendings","deliveries")); |
|
125 | + $langs->loadLangs(array("sendings", "deliveries")); |
|
126 | 126 | |
127 | 127 | $h = 0; |
128 | 128 | $head = array(); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | $tmpObjectId = $object->id; |
159 | 159 | $object->id = $object->origin_id; |
160 | 160 | |
161 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery'); |
|
161 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery'); |
|
162 | 162 | |
163 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'delivery','remove'); |
|
163 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove'); |
|
164 | 164 | |
165 | 165 | $object->id = $tmpObjectId; |
166 | 166 | return $head; |
@@ -174,34 +174,34 @@ discard block |
||
174 | 174 | * @param string $filter Filter |
175 | 175 | * @return int <0 if KO, >0 if OK |
176 | 176 | */ |
177 | -function show_list_sending_receive($origin,$origin_id,$filter='') |
|
177 | +function show_list_sending_receive($origin, $origin_id, $filter = '') |
|
178 | 178 | { |
179 | 179 | global $db, $conf, $langs, $bc; |
180 | 180 | global $form; |
181 | 181 | |
182 | - $product_static=new Product($db); |
|
183 | - $expedition=new Expedition($db); |
|
184 | - $warehousestatic=new Entrepot($db); |
|
182 | + $product_static = new Product($db); |
|
183 | + $expedition = new Expedition($db); |
|
184 | + $warehousestatic = new Entrepot($db); |
|
185 | 185 | |
186 | 186 | $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,"; |
187 | - $sql.= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; |
|
188 | - $sql.= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; |
|
187 | + $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,"; |
|
188 | + $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,"; |
|
189 | 189 | //if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,"; |
190 | - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; |
|
191 | - $sql.= ' p.description as product_desc'; |
|
192 | - $sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; |
|
193 | - $sql.= ", ".MAIN_DB_PREFIX."expedition as e"; |
|
194 | - $sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj"; |
|
190 | + $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,'; |
|
191 | + $sql .= ' p.description as product_desc'; |
|
192 | + $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; |
|
193 | + $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; |
|
194 | + $sql .= ", ".MAIN_DB_PREFIX.$origin."det as obj"; |
|
195 | 195 | //if ($conf->livraison_bon->enabled) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."livraison as l ON l.fk_expedition = e.rowid LEFT JOIN ".MAIN_DB_PREFIX."livraisondet as ld ON ld.fk_livraison = l.rowid AND obj.rowid = ld.fk_origin_line"; |
196 | - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; |
|
196 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON obj.fk_product = p.rowid"; |
|
197 | 197 | //TODO Add link to expeditiondet_batch |
198 | - $sql.= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
199 | - $sql.= " AND obj.fk_".$origin." = ".$origin_id; |
|
200 | - $sql.= " AND obj.rowid = ed.fk_origin_line"; |
|
201 | - $sql.= " AND ed.fk_expedition = e.rowid"; |
|
202 | - if ($filter) $sql.= $filter; |
|
198 | + $sql .= " WHERE e.entity IN (".getEntity('expedition').")"; |
|
199 | + $sql .= " AND obj.fk_".$origin." = ".$origin_id; |
|
200 | + $sql .= " AND obj.rowid = ed.fk_origin_line"; |
|
201 | + $sql .= " AND ed.fk_expedition = e.rowid"; |
|
202 | + if ($filter) $sql .= $filter; |
|
203 | 203 | |
204 | - $sql.= " ORDER BY obj.fk_product"; |
|
204 | + $sql .= " ORDER BY obj.fk_product"; |
|
205 | 205 | |
206 | 206 | dol_syslog("show_list_sending_receive", LOG_DEBUG); |
207 | 207 | $resql = $db->query($sql); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | print '<td align="center">'.$langs->trans("DateCreation").'</td>'; |
224 | 224 | print '<td align="center">'.$langs->trans("DateDeliveryPlanned").'</td>'; |
225 | 225 | print '<td align="center">'.$langs->trans("QtyPreparedOrShipped").'</td>'; |
226 | - if (! empty($conf->stock->enabled)) |
|
226 | + if (!empty($conf->stock->enabled)) |
|
227 | 227 | { |
228 | 228 | print '<td>'.$langs->trans("Warehouse").'</td>'; |
229 | 229 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | print '<td>'; |
234 | 234 | print '</td>'; |
235 | 235 | }*/ |
236 | - if (! empty($conf->livraison_bon->enabled)) |
|
236 | + if (!empty($conf->livraison_bon->enabled)) |
|
237 | 237 | { |
238 | 238 | print '<td>'.$langs->trans("DeliveryOrder").'</td>'; |
239 | 239 | //print '<td align="center">'.$langs->trans("QtyReceived").'</td>'; |
@@ -249,59 +249,59 @@ discard block |
||
249 | 249 | |
250 | 250 | // Sending id |
251 | 251 | print '<td align="left" class="nowrap">'; |
252 | - print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"),'sending').' '.$objp->exp_ref.'<a>'; |
|
252 | + print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"), 'sending').' '.$objp->exp_ref.'<a>'; |
|
253 | 253 | print '</td>'; |
254 | 254 | |
255 | 255 | // Description |
256 | 256 | if ($objp->fk_product > 0) |
257 | 257 | { |
258 | 258 | // Define output language |
259 | - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
259 | + if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) |
|
260 | 260 | { |
261 | 261 | $object = new $origin($db); |
262 | 262 | $object->fetch($origin_id); |
263 | 263 | $object->fetch_thirdparty(); |
264 | 264 | |
265 | 265 | $prod = new Product($db); |
266 | - $prod->id=$objp->fk_product; |
|
266 | + $prod->id = $objp->fk_product; |
|
267 | 267 | $prod->getMultiLangs(); |
268 | 268 | |
269 | 269 | $outputlangs = $langs; |
270 | - $newlang=''; |
|
271 | - if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id']; |
|
272 | - if (empty($newlang)) $newlang=$object->thirdparty->default_lang; |
|
273 | - if (! empty($newlang)) |
|
270 | + $newlang = ''; |
|
271 | + if (empty($newlang) && !empty($_REQUEST['lang_id'])) $newlang = $_REQUEST['lang_id']; |
|
272 | + if (empty($newlang)) $newlang = $object->thirdparty->default_lang; |
|
273 | + if (!empty($newlang)) |
|
274 | 274 | { |
275 | - $outputlangs = new Translate("",$conf); |
|
275 | + $outputlangs = new Translate("", $conf); |
|
276 | 276 | $outputlangs->setDefaultLang($newlang); |
277 | 277 | } |
278 | 278 | |
279 | - $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
279 | + $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; |
|
280 | 280 | } |
281 | 281 | else |
282 | 282 | { |
283 | - $label = (! empty($objp->label)?$objp->label:$objp->product_label); |
|
283 | + $label = (!empty($objp->label) ? $objp->label : $objp->product_label); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | print '<td>'; |
287 | 287 | |
288 | 288 | // Show product and description |
289 | - $product_static->type=$objp->fk_product_type; |
|
290 | - $product_static->id=$objp->fk_product; |
|
291 | - $product_static->ref=$objp->ref; |
|
292 | - $product_static->status_batch=$objp->product_tobatch; |
|
293 | - $text=$product_static->getNomUrl(1); |
|
294 | - $text.= ' - '.$label; |
|
295 | - $description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description)); |
|
296 | - print $form->textwithtooltip($text,$description,3,'','',$i); |
|
289 | + $product_static->type = $objp->fk_product_type; |
|
290 | + $product_static->id = $objp->fk_product; |
|
291 | + $product_static->ref = $objp->ref; |
|
292 | + $product_static->status_batch = $objp->product_tobatch; |
|
293 | + $text = $product_static->getNomUrl(1); |
|
294 | + $text .= ' - '.$label; |
|
295 | + $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($objp->description)); |
|
296 | + print $form->textwithtooltip($text, $description, 3, '', '', $i); |
|
297 | 297 | |
298 | 298 | // Show range |
299 | - print_date_range($objp->date_start,$objp->date_end); |
|
299 | + print_date_range($objp->date_start, $objp->date_end); |
|
300 | 300 | |
301 | 301 | // Add description in form |
302 | - if (! empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
302 | + if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) |
|
303 | 303 | { |
304 | - print (! empty($objp->description) && $objp->description!=$objp->product)?'<br>'.dol_htmlentitiesbr($objp->description):''; |
|
304 | + print (!empty($objp->description) && $objp->description != $objp->product) ? '<br>'.dol_htmlentitiesbr($objp->description) : ''; |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | print '</td>'; |
@@ -309,34 +309,34 @@ discard block |
||
309 | 309 | else |
310 | 310 | { |
311 | 311 | print "<td>"; |
312 | - if ($objp->fk_product_type==1) $text = img_object($langs->trans('Service'),'service'); |
|
313 | - else $text = img_object($langs->trans('Product'),'product'); |
|
312 | + if ($objp->fk_product_type == 1) $text = img_object($langs->trans('Service'), 'service'); |
|
313 | + else $text = img_object($langs->trans('Product'), 'product'); |
|
314 | 314 | |
315 | - if (! empty($objp->label)) { |
|
316 | - $text.= ' <strong>'.$objp->label.'</strong>'; |
|
317 | - print $form->textwithtooltip($text,$objp->description,3,'','',$i); |
|
315 | + if (!empty($objp->label)) { |
|
316 | + $text .= ' <strong>'.$objp->label.'</strong>'; |
|
317 | + print $form->textwithtooltip($text, $objp->description, 3, '', '', $i); |
|
318 | 318 | } else { |
319 | 319 | print $text.' '.nl2br($objp->description); |
320 | 320 | } |
321 | 321 | |
322 | 322 | // Show range |
323 | - print_date_range($objp->date_start,$objp->date_end); |
|
323 | + print_date_range($objp->date_start, $objp->date_end); |
|
324 | 324 | print "</td>\n"; |
325 | 325 | } |
326 | 326 | |
327 | 327 | //print '<td align="center">'.$objp->qty_asked.'</td>'; |
328 | 328 | |
329 | 329 | // Date creation |
330 | - print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->date_creation),'day').'</td>'; |
|
330 | + print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->date_creation), 'day').'</td>'; |
|
331 | 331 | |
332 | 332 | // Date shipping creation |
333 | - print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->date_delivery),'day').'</td>'; |
|
333 | + print '<td align="center" class="nowrap">'.dol_print_date($db->jdate($objp->date_delivery), 'day').'</td>'; |
|
334 | 334 | |
335 | 335 | // Qty shipped |
336 | 336 | print '<td align="center">'.$objp->qty_shipped.'</td>'; |
337 | 337 | |
338 | 338 | // Warehouse |
339 | - if (! empty($conf->stock->enabled)) |
|
339 | + if (!empty($conf->stock->enabled)) |
|
340 | 340 | { |
341 | 341 | print '<td>'; |
342 | 342 | if ($objp->warehouse_id > 0) |
@@ -380,17 +380,17 @@ discard block |
||
380 | 380 | }*/ |
381 | 381 | |
382 | 382 | // Informations on receipt |
383 | - if (! empty($conf->livraison_bon->enabled)) |
|
383 | + if (!empty($conf->livraison_bon->enabled)) |
|
384 | 384 | { |
385 | 385 | include_once DOL_DOCUMENT_ROOT.'/livraison/class/livraison.class.php'; |
386 | - $expedition->id=$objp->sendingid; |
|
387 | - $expedition->fetchObjectLinked($expedition->id,$expedition->element); |
|
386 | + $expedition->id = $objp->sendingid; |
|
387 | + $expedition->fetchObjectLinked($expedition->id, $expedition->element); |
|
388 | 388 | //var_dump($expedition->linkedObjects); |
389 | 389 | |
390 | - $receiving=''; |
|
391 | - if (count($expedition->linkedObjects['delivery']) > 0) $receiving=reset($expedition->linkedObjects['delivery']); // Take first link |
|
390 | + $receiving = ''; |
|
391 | + if (count($expedition->linkedObjects['delivery']) > 0) $receiving = reset($expedition->linkedObjects['delivery']); // Take first link |
|
392 | 392 | |
393 | - if (! empty($receiving)) |
|
393 | + if (!empty($receiving)) |
|
394 | 394 | { |
395 | 395 | // $expedition->fk_origin_line = id of det line of order |
396 | 396 | // $receiving->fk_origin_line = id of det line of order |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | //print '</td>'; |
411 | 411 | // Date shipping real |
412 | 412 | print '<td align="right">'; |
413 | - print dol_print_date($receiving->date_delivery,'day'); |
|
413 | + print dol_print_date($receiving->date_delivery, 'day'); |
|
414 | 414 | print '</td>'; |
415 | 415 | } |
416 | 416 | else |
@@ -57,10 +57,10 @@ discard block |
||
57 | 57 | $objectsrc = new Commande($db); |
58 | 58 | $objectsrc->fetch($object->origin_id); |
59 | 59 | } |
60 | - $nbContact = count($objectsrc->liste_contact(-1,'internal')) + count($objectsrc->liste_contact(-1,'external')); |
|
60 | + $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external')); |
|
61 | 61 | $head[$h][0] = DOL_URL_ROOT."/reception/contact.php?id=".$object->id; |
62 | 62 | $head[$h][1] = $langs->trans("ContactsAddresses"); |
63 | - if ($nbContact > 0) $head[$h][1].= ' <span class="badge">'.$nbContact.'</span>'; |
|
63 | + if ($nbContact > 0) $head[$h][1] .= ' <span class="badge">'.$nbContact.'</span>'; |
|
64 | 64 | $head[$h][2] = 'contact'; |
65 | 65 | $h++; |
66 | 66 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | if (!empty($object->note_public)) $nbNote++; |
71 | 71 | $head[$h][0] = DOL_URL_ROOT."/reception/note.php?id=".$object->id; |
72 | 72 | $head[$h][1] = $langs->trans("Notes"); |
73 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
73 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
74 | 74 | $head[$h][2] = 'note'; |
75 | 75 | $h++; |
76 | 76 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | |
82 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'order','remove'); |
|
82 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'remove'); |
|
83 | 83 | |
84 | 84 | return $head; |
85 | 85 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $h++; |
104 | 104 | |
105 | 105 | |
106 | - if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) |
|
106 | + if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) |
|
107 | 107 | { |
108 | 108 | $head[$h][0] = DOL_URL_ROOT.'/admin/reception_extrafields.php'; |
109 | 109 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $h++; |
112 | 112 | } |
113 | 113 | |
114 | - if (! empty($conf->global->MAIN_SUBMODULE_RECEPTION)) |
|
114 | + if (!empty($conf->global->MAIN_SUBMODULE_RECEPTION)) |
|
115 | 115 | { |
116 | 116 | $head[$h][0] = DOL_URL_ROOT.'/admin/commande_fournisseur_dispatch_extrafields.php'; |
117 | 117 | $head[$h][1] = $langs->trans("ExtraFieldsLines"); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | - complete_head_from_modules($conf,$langs,null,$head,$h,'reception_admin','remove'); |
|
124 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'reception_admin', 'remove'); |
|
125 | 125 | |
126 | 126 | return $head; |
127 | 127 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $h = 0; |
35 | 35 | $head = array(); |
36 | 36 | |
37 | - $head[$h][0] = DOL_URL_ROOT . '/expensereport/card.php?id=' . $object->id; |
|
37 | + $head[$h][0] = DOL_URL_ROOT.'/expensereport/card.php?id='.$object->id; |
|
38 | 38 | $head[$h][1] = $langs->trans("Card"); |
39 | 39 | $head[$h][2] = 'card'; |
40 | 40 | $h++; |
@@ -43,37 +43,37 @@ discard block |
||
43 | 43 | // Entries must be declared in modules descriptor with line |
44 | 44 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
45 | 45 | // $this->tabs = array('entity:-tabname); to remove a tab |
46 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport'); |
|
46 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'expensereport'); |
|
47 | 47 | |
48 | 48 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
49 | 49 | require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; |
50 | - $upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref); |
|
51 | - $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview.*\.png)$')); |
|
52 | - $nbLinks=Link::count($db, $object->element, $object->id); |
|
50 | + $upload_dir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); |
|
51 | + $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); |
|
52 | + $nbLinks = Link::count($db, $object->element, $object->id); |
|
53 | 53 | $head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id; |
54 | 54 | $head[$h][1] = $langs->trans('Documents'); |
55 | - if (($nbFiles+$nbLinks) > 0) $head[$h][1].= ' <span class="badge">'.($nbFiles+$nbLinks).'</span>'; |
|
55 | + if (($nbFiles + $nbLinks) > 0) $head[$h][1] .= ' <span class="badge">'.($nbFiles + $nbLinks).'</span>'; |
|
56 | 56 | $head[$h][2] = 'documents'; |
57 | 57 | $h++; |
58 | 58 | |
59 | 59 | if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) |
60 | 60 | { |
61 | 61 | $nbNote = 0; |
62 | - if(!empty($object->note_private)) $nbNote++; |
|
63 | - if(!empty($object->note_public)) $nbNote++; |
|
62 | + if (!empty($object->note_private)) $nbNote++; |
|
63 | + if (!empty($object->note_public)) $nbNote++; |
|
64 | 64 | $head[$h][0] = DOL_URL_ROOT.'/expensereport/note.php?id='.$object->id; |
65 | 65 | $head[$h][1] = $langs->trans('Notes'); |
66 | - if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; |
|
66 | + if ($nbNote > 0) $head[$h][1] .= ' <span class="badge">'.$nbNote.'</span>'; |
|
67 | 67 | $head[$h][2] = 'note'; |
68 | 68 | $h++; |
69 | 69 | } |
70 | 70 | |
71 | - $head[$h][0] = DOL_URL_ROOT . '/expensereport/info.php?id=' . $object->id; |
|
71 | + $head[$h][0] = DOL_URL_ROOT.'/expensereport/info.php?id='.$object->id; |
|
72 | 72 | $head[$h][1] = $langs->trans("Info"); |
73 | 73 | $head[$h][2] = 'info'; |
74 | 74 | $h++; |
75 | 75 | |
76 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport','remove'); |
|
76 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'expensereport', 'remove'); |
|
77 | 77 | |
78 | 78 | return $head; |
79 | 79 | } |
@@ -102,14 +102,14 @@ discard block |
||
102 | 102 | // Entries must be declared in modules descriptor with line |
103 | 103 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
104 | 104 | // $this->tabs = array('entity:-tabname); to remove a tab |
105 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_expensereport'); |
|
105 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_expensereport'); |
|
106 | 106 | |
107 | 107 | $head[$h][0] = DOL_URL_ROOT.'/expensereport/payment/info.php?id='.$object->id; |
108 | 108 | $head[$h][1] = $langs->trans("Info"); |
109 | 109 | $head[$h][2] = 'info'; |
110 | 110 | $h++; |
111 | 111 | |
112 | - complete_head_from_modules($conf,$langs,$object,$head,$h,'payment_expensereport', 'remove'); |
|
112 | + complete_head_from_modules($conf, $langs, $object, $head, $h, 'payment_expensereport', 'remove'); |
|
113 | 113 | |
114 | 114 | return $head; |
115 | 115 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | // Entries must be declared in modules descriptor with line |
154 | 154 | // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab |
155 | 155 | // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab |
156 | - complete_head_from_modules($conf,$langs,null,$head,$h,'expensereport_admin'); |
|
156 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'expensereport_admin'); |
|
157 | 157 | |
158 | 158 | $head[$h][0] = DOL_URL_ROOT.'/admin/expensereport_extrafields.php'; |
159 | 159 | $head[$h][1] = $langs->trans("ExtraFields"); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $h++; |
168 | 168 | */ |
169 | 169 | |
170 | - complete_head_from_modules($conf,$langs,null,$head,$h,'expensereport_admin','remove'); |
|
170 | + complete_head_from_modules($conf, $langs, null, $head, $h, 'expensereport_admin', 'remove'); |
|
171 | 171 | |
172 | 172 | return $head; |
173 | 173 | } |