@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
80 | 80 | */ |
81 | - public $fields=array( |
|
81 | + public $fields = array( |
|
82 | 82 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
83 | 83 | 'fk_product_attribute' => array('type'=>'integer:ProductAttribute:variants/class/ProductAttribute.class.php', 'label'=>'ProductAttribute', 'enabled'=>1, 'visible'=>0, 'position'=>10, 'notnull'=>1, 'index'=>1,), |
84 | 84 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), |
@@ -160,32 +160,32 @@ discard block |
||
160 | 160 | $error++; |
161 | 161 | } |
162 | 162 | if ($error) { |
163 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
163 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
164 | 164 | return -1; |
165 | 165 | } |
166 | 166 | |
167 | 167 | $this->db->begin(); |
168 | 168 | |
169 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
169 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
170 | 170 | $sql .= " fk_product_attribute, ref, value, entity, position"; |
171 | 171 | $sql .= ")"; |
172 | 172 | $sql .= " VALUES ("; |
173 | - $sql .= " " . ((int) $this->fk_product_attribute); |
|
174 | - $sql .= ", '" . $this->db->escape($this->ref) . "'"; |
|
175 | - $sql .= ", '" . $this->db->escape($this->value) . "'"; |
|
176 | - $sql .= ", " . ((int) $this->entity); |
|
177 | - $sql .= ", " . ((int) $this->position); |
|
173 | + $sql .= " ".((int) $this->fk_product_attribute); |
|
174 | + $sql .= ", '".$this->db->escape($this->ref)."'"; |
|
175 | + $sql .= ", '".$this->db->escape($this->value)."'"; |
|
176 | + $sql .= ", ".((int) $this->entity); |
|
177 | + $sql .= ", ".((int) $this->position); |
|
178 | 178 | $sql .= ")"; |
179 | 179 | |
180 | 180 | dol_syslog(__METHOD__, LOG_DEBUG); |
181 | 181 | $resql = $this->db->query($sql); |
182 | 182 | if (!$resql) { |
183 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
183 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
184 | 184 | $error++; |
185 | 185 | } |
186 | 186 | |
187 | 187 | if (!$error) { |
188 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
188 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if (!$error && !$notrigger) { |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | $error++; |
227 | 227 | } |
228 | 228 | if ($error) { |
229 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
229 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
230 | 230 | return -1; |
231 | 231 | } |
232 | 232 | |
233 | 233 | $sql = "SELECT rowid, fk_product_attribute, ref, value"; |
234 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
235 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
236 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
234 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
235 | + $sql .= " WHERE rowid = ".((int) $id); |
|
236 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
237 | 237 | |
238 | 238 | dol_syslog(__METHOD__, LOG_DEBUG); |
239 | 239 | $resql = $this->db->query($sql); |
240 | 240 | if (!$resql) { |
241 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
242 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
241 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
242 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
243 | 243 | return -1; |
244 | 244 | } |
245 | 245 | |
@@ -274,15 +274,15 @@ discard block |
||
274 | 274 | $sql .= "DISTINCT "; |
275 | 275 | } |
276 | 276 | |
277 | - $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v "; |
|
277 | + $sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM ".MAIN_DB_PREFIX."product_attribute_value v "; |
|
278 | 278 | |
279 | 279 | if ($only_used) { |
280 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | - $sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child "; |
|
280 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid "; |
|
281 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination c ON c.rowid = c2v.fk_prod_combination "; |
|
282 | + $sql .= "LEFT JOIN ".MAIN_DB_PREFIX."product p ON p.rowid = c.fk_product_child "; |
|
283 | 283 | } |
284 | 284 | |
285 | - $sql .= "WHERE v.fk_product_attribute = " . ((int) $prodattr_id); |
|
285 | + $sql .= "WHERE v.fk_product_attribute = ".((int) $prodattr_id); |
|
286 | 286 | |
287 | 287 | if ($only_used) { |
288 | 288 | $sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1"; |
@@ -334,25 +334,25 @@ discard block |
||
334 | 334 | $error++; |
335 | 335 | } |
336 | 336 | if ($error) { |
337 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
337 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
338 | 338 | return -1; |
339 | 339 | } |
340 | 340 | |
341 | 341 | $this->db->begin(); |
342 | 342 | |
343 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
343 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
344 | 344 | |
345 | - $sql .= " fk_product_attribute = " . ((int) $this->fk_product_attribute); |
|
346 | - $sql .= ", ref = '" . $this->db->escape($this->ref) . "'"; |
|
347 | - $sql .= ", value = '" . $this->db->escape($this->value) . "'"; |
|
348 | - $sql .= ", position = " . ((int) $this->position); |
|
345 | + $sql .= " fk_product_attribute = ".((int) $this->fk_product_attribute); |
|
346 | + $sql .= ", ref = '".$this->db->escape($this->ref)."'"; |
|
347 | + $sql .= ", value = '".$this->db->escape($this->value)."'"; |
|
348 | + $sql .= ", position = ".((int) $this->position); |
|
349 | 349 | |
350 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
350 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
351 | 351 | |
352 | 352 | dol_syslog(__METHOD__, LOG_DEBUG); |
353 | 353 | $resql = $this->db->query($sql); |
354 | 354 | if (!$resql) { |
355 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
355 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
356 | 356 | $error++; |
357 | 357 | } |
358 | 358 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | $error++; |
396 | 396 | } |
397 | 397 | if ($error) { |
398 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
398 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
399 | 399 | return -1; |
400 | 400 | } |
401 | 401 | |
@@ -419,12 +419,12 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | if (!$error) { |
422 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
422 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element." WHERE rowid = ".((int) $this->id); |
|
423 | 423 | |
424 | 424 | dol_syslog(__METHOD__, LOG_DEBUG); |
425 | 425 | $resql = $this->db->query($sql); |
426 | 426 | if (!$resql) { |
427 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
427 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
428 | 428 | $error++; |
429 | 429 | } |
430 | 430 | } |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | $error++; |
458 | 458 | } |
459 | 459 | if ($error) { |
460 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
460 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
461 | 461 | return -1; |
462 | 462 | } |
463 | 463 | |
464 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr_val = " . ((int) $this->id); |
|
464 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr_val = ".((int) $this->id); |
|
465 | 465 | |
466 | 466 | dol_syslog(__METHOD__, LOG_DEBUG); |
467 | 467 | $resql = $this->db->query($sql); |
468 | 468 | if (!$resql) { |
469 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
469 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
470 | 470 | return -1; |
471 | 471 | } |
472 | 472 |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | /** |
99 | 99 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
100 | 100 | */ |
101 | - public $fields=array( |
|
101 | + public $fields = array( |
|
102 | 102 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
103 | 103 | 'ref' => array('type'=>'varchar(255)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), |
104 | 104 | 'ref_ext' => array('type' => 'varchar(255)', 'label' => 'ExternalRef', 'enabled' => 1, 'visible' => 0, 'position' => 20, 'searchall'=>1), |
@@ -192,32 +192,32 @@ discard block |
||
192 | 192 | $error++; |
193 | 193 | } |
194 | 194 | if ($error) { |
195 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
195 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
196 | 196 | return -1; |
197 | 197 | } |
198 | 198 | |
199 | 199 | $this->db->begin(); |
200 | 200 | |
201 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . $this->table_element . " ("; |
|
201 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element." ("; |
|
202 | 202 | $sql .= " ref, ref_ext, label, entity, position"; |
203 | 203 | $sql .= ")"; |
204 | 204 | $sql .= " VALUES ("; |
205 | - $sql .= " '" . $this->db->escape($this->ref) . "'"; |
|
206 | - $sql .= ", '" . $this->db->escape($this->ref_ext) . "'"; |
|
207 | - $sql .= ", '" . $this->db->escape($this->label) . "'"; |
|
208 | - $sql .= ", " . ((int) $this->entity); |
|
209 | - $sql .= ", " . ((int) $this->position); |
|
205 | + $sql .= " '".$this->db->escape($this->ref)."'"; |
|
206 | + $sql .= ", '".$this->db->escape($this->ref_ext)."'"; |
|
207 | + $sql .= ", '".$this->db->escape($this->label)."'"; |
|
208 | + $sql .= ", ".((int) $this->entity); |
|
209 | + $sql .= ", ".((int) $this->position); |
|
210 | 210 | $sql .= ")"; |
211 | 211 | |
212 | 212 | dol_syslog(__METHOD__, LOG_DEBUG); |
213 | 213 | $resql = $this->db->query($sql); |
214 | 214 | if (!$resql) { |
215 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
215 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
216 | 216 | $error++; |
217 | 217 | } |
218 | 218 | |
219 | 219 | if (!$error) { |
220 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); |
|
220 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | if (!$error && !$notrigger) { |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | $error++; |
259 | 259 | } |
260 | 260 | if ($error) { |
261 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
261 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
262 | 262 | return -1; |
263 | 263 | } |
264 | 264 | |
265 | 265 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
266 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
267 | - $sql .= " WHERE rowid = " . ((int) $id); |
|
268 | - $sql .= " AND entity IN (" . getEntity('product') . ")"; |
|
266 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
267 | + $sql .= " WHERE rowid = ".((int) $id); |
|
268 | + $sql .= " AND entity IN (".getEntity('product').")"; |
|
269 | 269 | |
270 | 270 | dol_syslog(__METHOD__, LOG_DEBUG); |
271 | 271 | $resql = $this->db->query($sql); |
272 | 272 | if (!$resql) { |
273 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
274 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
273 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
274 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
275 | 275 | return -1; |
276 | 276 | } |
277 | 277 | |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | $return = array(); |
302 | 302 | |
303 | 303 | $sql = "SELECT rowid, ref, ref_ext, label, position"; |
304 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
305 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
304 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
305 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
306 | 306 | $sql .= $this->db->order("position", "asc"); |
307 | 307 | |
308 | 308 | dol_syslog(__METHOD__, LOG_DEBUG); |
309 | 309 | $resql = $this->db->query($sql); |
310 | 310 | if (!$resql) { |
311 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
311 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
312 | 312 | dol_print_error($this->db); |
313 | 313 | return $return; |
314 | 314 | } |
@@ -360,25 +360,25 @@ discard block |
||
360 | 360 | $error++; |
361 | 361 | } |
362 | 362 | if ($error) { |
363 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
363 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
364 | 364 | return -1; |
365 | 365 | } |
366 | 366 | |
367 | 367 | $this->db->begin(); |
368 | 368 | |
369 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET"; |
|
369 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET"; |
|
370 | 370 | |
371 | - $sql .= " ref = '" . $this->db->escape($this->ref) . "'"; |
|
372 | - $sql .= ", ref_ext = '" . $this->db->escape($this->ref_ext) . "'"; |
|
373 | - $sql .= ", label = '" . $this->db->escape($this->label) . "'"; |
|
374 | - $sql .= ", position = " . ((int) $this->position); |
|
371 | + $sql .= " ref = '".$this->db->escape($this->ref)."'"; |
|
372 | + $sql .= ", ref_ext = '".$this->db->escape($this->ref_ext)."'"; |
|
373 | + $sql .= ", label = '".$this->db->escape($this->label)."'"; |
|
374 | + $sql .= ", position = ".((int) $this->position); |
|
375 | 375 | |
376 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
376 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
377 | 377 | |
378 | 378 | dol_syslog(__METHOD__, LOG_DEBUG); |
379 | 379 | $resql = $this->db->query($sql); |
380 | 380 | if (!$resql) { |
381 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
381 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
382 | 382 | $error++; |
383 | 383 | } |
384 | 384 | |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $error++; |
422 | 422 | } |
423 | 423 | if ($error) { |
424 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
424 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
425 | 425 | return -1; |
426 | 426 | } |
427 | 427 | |
@@ -446,25 +446,25 @@ discard block |
||
446 | 446 | |
447 | 447 | if (!$error) { |
448 | 448 | // Delete values |
449 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
450 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
449 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
450 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
451 | 451 | |
452 | - dol_syslog(__METHOD__ . ' - Delete values', LOG_DEBUG); |
|
452 | + dol_syslog(__METHOD__.' - Delete values', LOG_DEBUG); |
|
453 | 453 | $resql = $this->db->query($sql); |
454 | 454 | if (!$resql) { |
455 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
455 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
456 | 456 | $error++; |
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
460 | 460 | if (!$error) { |
461 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
462 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
461 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
462 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
463 | 463 | |
464 | - dol_syslog(__METHOD__ . ' - Delete attribute', LOG_DEBUG); |
|
464 | + dol_syslog(__METHOD__.' - Delete attribute', LOG_DEBUG); |
|
465 | 465 | $resql = $this->db->query($sql); |
466 | 466 | if (!$resql) { |
467 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
467 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
468 | 468 | $error++; |
469 | 469 | } |
470 | 470 | } |
@@ -503,15 +503,15 @@ discard block |
||
503 | 503 | $error++; |
504 | 504 | } |
505 | 505 | if ($error) { |
506 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
506 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
507 | 507 | return -1; |
508 | 508 | } |
509 | 509 | |
510 | 510 | $sql = "SELECT td.rowid, td.fk_product_attribute, td.ref, td.value, td.position"; |
511 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line . " AS td"; |
|
512 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $this->table_element . " AS t ON t.rowid = td." . $this->fk_element; |
|
513 | - $sql .= " WHERE t.rowid = " . ((int) $this->id); |
|
514 | - $sql .= " AND t.entity IN (" . getEntity('product') . ")"; |
|
511 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS td"; |
|
512 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$this->table_element." AS t ON t.rowid = td.".$this->fk_element; |
|
513 | + $sql .= " WHERE t.rowid = ".((int) $this->id); |
|
514 | + $sql .= " AND t.entity IN (".getEntity('product').")"; |
|
515 | 515 | if ($filters) { |
516 | 516 | $sql .= $filters; |
517 | 517 | } |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | dol_syslog(__METHOD__, LOG_DEBUG); |
521 | 521 | $resql = $this->db->query($sql); |
522 | 522 | if (!$resql) { |
523 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
524 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
523 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
524 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
525 | 525 | return -3; |
526 | 526 | } |
527 | 527 | |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | public function addLine($ref, $value, $position = -1, $notrigger = 0) |
576 | 576 | { |
577 | 577 | global $langs, $user; |
578 | - dol_syslog(__METHOD__ . " id={$this->id}, ref=$ref, value=$value, notrigger=$notrigger"); |
|
578 | + dol_syslog(__METHOD__." id={$this->id}, ref=$ref, value=$value, notrigger=$notrigger"); |
|
579 | 579 | $error = 0; |
580 | 580 | |
581 | 581 | // Clean parameters |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | $error++; |
588 | 588 | } |
589 | 589 | if ($error) { |
590 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
590 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
591 | 591 | return -1; |
592 | 592 | } |
593 | 593 | |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | { |
637 | 637 | global $user; |
638 | 638 | |
639 | - dol_syslog(__METHOD__ . " lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
639 | + dol_syslog(__METHOD__." lineid=$lineid, ref=$ref, value=$value, notrigger=$notrigger"); |
|
640 | 640 | |
641 | 641 | // Clean parameters |
642 | 642 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | */ |
678 | 678 | public function deleteLine(User $user, $lineid, $notrigger = 0) |
679 | 679 | { |
680 | - dol_syslog(__METHOD__ . " lineid=$lineid, notrigger=$notrigger"); |
|
680 | + dol_syslog(__METHOD__." lineid=$lineid, notrigger=$notrigger"); |
|
681 | 681 | |
682 | 682 | // Clean parameters |
683 | 683 | $lineid = $lineid > 0 ? $lineid : 0; |
@@ -724,19 +724,19 @@ discard block |
||
724 | 724 | $error++; |
725 | 725 | } |
726 | 726 | if ($error) { |
727 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
727 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
728 | 728 | return -1; |
729 | 729 | } |
730 | 730 | |
731 | 731 | $sql = "SELECT COUNT(*) AS count"; |
732 | - $sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element_line; |
|
733 | - $sql .= " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
732 | + $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line; |
|
733 | + $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
|
734 | 734 | |
735 | 735 | dol_syslog(__METHOD__, LOG_DEBUG); |
736 | 736 | $resql = $this->db->query($sql); |
737 | 737 | if (!$resql) { |
738 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
739 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
738 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
739 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
740 | 740 | return -1; |
741 | 741 | } |
742 | 742 | |
@@ -767,21 +767,21 @@ discard block |
||
767 | 767 | $error++; |
768 | 768 | } |
769 | 769 | if ($error) { |
770 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
770 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
771 | 771 | return -1; |
772 | 772 | } |
773 | 773 | |
774 | 774 | $sql = "SELECT COUNT(*) AS count"; |
775 | - $sql .= " FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val AS pac2v"; |
|
776 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
777 | - $sql .= " WHERE pac2v.fk_prod_attr = " . ((int) $this->id); |
|
778 | - $sql .= " AND pac.entity IN (" . getEntity('product') . ")"; |
|
775 | + $sql .= " FROM ".MAIN_DB_PREFIX."product_attribute_combination2val AS pac2v"; |
|
776 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination AS pac ON pac2v.fk_prod_combination = pac.rowid"; |
|
777 | + $sql .= " WHERE pac2v.fk_prod_attr = ".((int) $this->id); |
|
778 | + $sql .= " AND pac.entity IN (".getEntity('product').")"; |
|
779 | 779 | |
780 | 780 | dol_syslog(__METHOD__, LOG_DEBUG); |
781 | 781 | $resql = $this->db->query($sql); |
782 | 782 | if (!$resql) { |
783 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
784 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
783 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
784 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
785 | 785 | return -1; |
786 | 786 | } |
787 | 787 | |
@@ -811,16 +811,16 @@ discard block |
||
811 | 811 | $error++; |
812 | 812 | } |
813 | 813 | if ($error) { |
814 | - dol_syslog(__METHOD__ . ' ' . $this->errorsToString(), LOG_ERR); |
|
814 | + dol_syslog(__METHOD__.' '.$this->errorsToString(), LOG_ERR); |
|
815 | 815 | return -1; |
816 | 816 | } |
817 | 817 | |
818 | - $sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val WHERE fk_prod_attr = " . ((int) $this->id); |
|
818 | + $sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."product_attribute_combination2val WHERE fk_prod_attr = ".((int) $this->id); |
|
819 | 819 | |
820 | 820 | dol_syslog(__METHOD__, LOG_DEBUG); |
821 | 821 | $resql = $this->db->query($sql); |
822 | 822 | if (!$resql) { |
823 | - $this->errors[] = "Error " . $this->db->lasterror(); |
|
823 | + $this->errors[] = "Error ".$this->db->lasterror(); |
|
824 | 824 | return -1; |
825 | 825 | } |
826 | 826 | |
@@ -844,8 +844,8 @@ discard block |
||
844 | 844 | { |
845 | 845 | // Count number of attributes to reorder (according to choice $renum) |
846 | 846 | $nl = 0; |
847 | - $sql = "SELECT count(rowid) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
848 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
847 | + $sql = "SELECT count(rowid) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
848 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
849 | 849 | if (!$renum) { |
850 | 850 | $sql .= " AND position = 0"; |
851 | 851 | } else { |
@@ -865,11 +865,11 @@ discard block |
||
865 | 865 | $rows = array(); |
866 | 866 | |
867 | 867 | // We first search all attributes |
868 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
869 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
870 | - $sql .= " ORDER BY position ASC, rowid " . $rowidorder; |
|
868 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
869 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
870 | + $sql .= " ORDER BY position ASC, rowid ".$rowidorder; |
|
871 | 871 | |
872 | - dol_syslog(__METHOD__ . " search all attributes", LOG_DEBUG); |
|
872 | + dol_syslog(__METHOD__." search all attributes", LOG_DEBUG); |
|
873 | 873 | $resql = $this->db->query($sql); |
874 | 874 | if ($resql) { |
875 | 875 | $i = 0; |
@@ -904,8 +904,8 @@ discard block |
||
904 | 904 | { |
905 | 905 | global $hookmanager; |
906 | 906 | |
907 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
908 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
907 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
908 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
909 | 909 | |
910 | 910 | dol_syslog(__METHOD__, LOG_DEBUG); |
911 | 911 | if (!$this->db->query($sql)) { |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | */ |
928 | 928 | public function getPositionOfAttribute($rowid) |
929 | 929 | { |
930 | - $sql = "SELECT position FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
931 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
930 | + $sql = "SELECT position FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
931 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
932 | 932 | |
933 | 933 | dol_syslog(__METHOD__, LOG_DEBUG); |
934 | 934 | $resql = $this->db->query($sql); |
@@ -987,12 +987,12 @@ discard block |
||
987 | 987 | public function updateAttributePositionUp($rowid, $position) |
988 | 988 | { |
989 | 989 | if ($position > 1) { |
990 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
991 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
992 | - $sql .= " AND position = " . ((int) ($position - 1)); |
|
990 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
991 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
992 | + $sql .= " AND position = ".((int) ($position - 1)); |
|
993 | 993 | if ($this->db->query($sql)) { |
994 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position - 1)); |
|
995 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
994 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position - 1)); |
|
995 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
996 | 996 | if (!$this->db->query($sql)) { |
997 | 997 | dol_print_error($this->db); |
998 | 998 | } |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | public function updateAttributePositionDown($rowid, $position, $max) |
1014 | 1014 | { |
1015 | 1015 | if ($position < $max) { |
1016 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) $position); |
|
1017 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
1018 | - $sql .= " AND position = " . ((int) ($position + 1)); |
|
1016 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) $position); |
|
1017 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
1018 | + $sql .= " AND position = ".((int) ($position + 1)); |
|
1019 | 1019 | if ($this->db->query($sql)) { |
1020 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element . " SET position = " . ((int) ($position + 1)); |
|
1021 | - $sql .= " WHERE rowid = " . ((int) $rowid); |
|
1020 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET position = ".((int) ($position + 1)); |
|
1021 | + $sql .= " WHERE rowid = ".((int) $rowid); |
|
1022 | 1022 | if (!$this->db->query($sql)) { |
1023 | 1023 | dol_print_error($this->db); |
1024 | 1024 | } |
@@ -1036,8 +1036,8 @@ discard block |
||
1036 | 1036 | public function getMaxAttributesPosition() |
1037 | 1037 | { |
1038 | 1038 | // Search the last position of attributes |
1039 | - $sql = "SELECT max(position) FROM " . MAIN_DB_PREFIX . $this->table_element; |
|
1040 | - $sql .= " WHERE entity IN (" . getEntity('product') . ")"; |
|
1039 | + $sql = "SELECT max(position) FROM ".MAIN_DB_PREFIX.$this->table_element; |
|
1040 | + $sql .= " WHERE entity IN (".getEntity('product').")"; |
|
1041 | 1041 | |
1042 | 1042 | dol_syslog(__METHOD__, LOG_DEBUG); |
1043 | 1043 | $resql = $this->db->query($sql); |
@@ -1083,17 +1083,17 @@ discard block |
||
1083 | 1083 | |
1084 | 1084 | $result = ''; |
1085 | 1085 | |
1086 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("ProductAttribute") . '</u>'; |
|
1086 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("ProductAttribute").'</u>'; |
|
1087 | 1087 | if (isset($this->status)) { |
1088 | - $label .= ' ' . $this->getLibStatut(5); |
|
1088 | + $label .= ' '.$this->getLibStatut(5); |
|
1089 | 1089 | } |
1090 | 1090 | $label .= '<br>'; |
1091 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
1091 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
1092 | 1092 | if (!empty($this->label)) { |
1093 | - $label .= '<br><b>' . $langs->trans('Label') . ':</b> ' . $this->label; |
|
1093 | + $label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label; |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | - $url = dol_buildpath('/variants/card.php', 1) . '?id=' . $this->id; |
|
1096 | + $url = dol_buildpath('/variants/card.php', 1).'?id='.$this->id; |
|
1097 | 1097 | |
1098 | 1098 | if ($option != 'nolink') { |
1099 | 1099 | // Add param to save lastsearch_values or not |
@@ -1110,20 +1110,20 @@ discard block |
||
1110 | 1110 | if (empty($notooltip)) { |
1111 | 1111 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
1112 | 1112 | $label = $langs->trans("ShowProductAttribute"); |
1113 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
1113 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
1114 | 1114 | } |
1115 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
1116 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
1115 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
1116 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
1117 | 1117 | } else { |
1118 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
1118 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | if ($option == 'nolink' || empty($url)) { |
1122 | 1122 | $linkstart = '<span'; |
1123 | 1123 | } else { |
1124 | - $linkstart = '<a href="' . $url . '"'; |
|
1124 | + $linkstart = '<a href="'.$url.'"'; |
|
1125 | 1125 | } |
1126 | - $linkstart .= $linkclose . '>'; |
|
1126 | + $linkstart .= $linkclose.'>'; |
|
1127 | 1127 | if ($option == 'nolink' || empty($url)) { |
1128 | 1128 | $linkend = '</span>'; |
1129 | 1129 | } else { |
@@ -1134,29 +1134,29 @@ discard block |
||
1134 | 1134 | |
1135 | 1135 | if (empty($this->showphoto_on_popup)) { |
1136 | 1136 | if ($withpicto) { |
1137 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1137 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1138 | 1138 | } |
1139 | 1139 | } else { |
1140 | 1140 | if ($withpicto) { |
1141 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
1141 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
1142 | 1142 | |
1143 | 1143 | list($class, $module) = explode('@', $this->picto); |
1144 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
1144 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
1145 | 1145 | $filearray = dol_dir_list($upload_dir, "files"); |
1146 | 1146 | $filename = $filearray[0]['name']; |
1147 | 1147 | if (!empty($filename)) { |
1148 | 1148 | $pospoint = strpos($filearray[0]['name'], '.'); |
1149 | 1149 | |
1150 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
1151 | - if (empty($conf->global->{strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS'})) { |
|
1152 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
1150 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
1151 | + if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) { |
|
1152 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
1153 | 1153 | } else { |
1154 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
1154 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | $result .= '</div>'; |
1158 | 1158 | } else { |
1159 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1159 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
1160 | 1160 | } |
1161 | 1161 | } |
1162 | 1162 | } |
@@ -1243,9 +1243,9 @@ discard block |
||
1243 | 1243 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1244 | 1244 | foreach ($dirtpls as $module => $reldir) { |
1245 | 1245 | if (!empty($module)) { |
1246 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_create.tpl.php'); |
|
1246 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_create.tpl.php'); |
|
1247 | 1247 | } else { |
1248 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_create.tpl.php'; |
|
1248 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_create.tpl.php'; |
|
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | if (empty($conf->file->strict_mode)) { |
@@ -1292,9 +1292,9 @@ discard block |
||
1292 | 1292 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1293 | 1293 | foreach ($dirtpls as $module => $reldir) { |
1294 | 1294 | if (!empty($module)) { |
1295 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_title.tpl.php'); |
|
1295 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_title.tpl.php'); |
|
1296 | 1296 | } else { |
1297 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_title.tpl.php'; |
|
1297 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_title.tpl.php'; |
|
1298 | 1298 | } |
1299 | 1299 | if (empty($conf->file->strict_mode)) { |
1300 | 1300 | $res = @include $tpl; |
@@ -1357,9 +1357,9 @@ discard block |
||
1357 | 1357 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1358 | 1358 | foreach ($dirtpls as $module => $reldir) { |
1359 | 1359 | if (!empty($module)) { |
1360 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_view.tpl.php'); |
|
1360 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_view.tpl.php'); |
|
1361 | 1361 | } else { |
1362 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_view.tpl.php'; |
|
1362 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_view.tpl.php'; |
|
1363 | 1363 | } |
1364 | 1364 | |
1365 | 1365 | if (empty($conf->file->strict_mode)) { |
@@ -1381,9 +1381,9 @@ discard block |
||
1381 | 1381 | $dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir)); |
1382 | 1382 | foreach ($dirtpls as $module => $reldir) { |
1383 | 1383 | if (!empty($module)) { |
1384 | - $tpl = dol_buildpath($reldir . '/productattributevalueline_edit.tpl.php'); |
|
1384 | + $tpl = dol_buildpath($reldir.'/productattributevalueline_edit.tpl.php'); |
|
1385 | 1385 | } else { |
1386 | - $tpl = DOL_DOCUMENT_ROOT . $reldir . '/productattributevalueline_edit.tpl.php'; |
|
1386 | + $tpl = DOL_DOCUMENT_ROOT.$reldir.'/productattributevalueline_edit.tpl.php'; |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | if (empty($conf->file->strict_mode)) { |
@@ -15,9 +15,9 @@ |
||
15 | 15 | if (!empty($totalarray['pos'][$i])) { |
16 | 16 | print '<td class="right">'; |
17 | 17 | if (isset($totalarray['type']) && $totalarray['type'][$i] == 'duration') { |
18 | - print (!empty($totalarray['val'][$totalarray['pos'][$i]])?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin'):0); |
|
18 | + print (!empty($totalarray['val'][$totalarray['pos'][$i]]) ?convertSecondToTime($totalarray['val'][$totalarray['pos'][$i]], 'allhourmin') : 0); |
|
19 | 19 | } else { |
20 | - print price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0); |
|
20 | + print price(!empty($totalarray['val'][$totalarray['pos'][$i]]) ? $totalarray['val'][$totalarray['pos'][$i]] : 0); |
|
21 | 21 | } |
22 | 22 | print '</td>'; |
23 | 23 | } else { |
@@ -289,7 +289,7 @@ |
||
289 | 289 | // phpcs:enable |
290 | 290 | $this->_Metric = $format['metric']; |
291 | 291 | $this->_Avery_Name = $format['name']; |
292 | - $this->_Avery_Code = empty($format['code'])?'':$format['code']; |
|
292 | + $this->_Avery_Code = empty($format['code']) ? '' : $format['code']; |
|
293 | 293 | $this->_Margin_Left = $this->convertMetric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); |
294 | 294 | $this->_Margin_Top = $this->convertMetric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); |
295 | 295 | $this->_X_Space = $this->convertMetric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; |
427 | 427 | $sql .= "fk_bank"; |
428 | 428 | $sql .= ", url_id"; |
429 | - $sql .= ", url"; // deprecated |
|
429 | + $sql .= ", url"; // deprecated |
|
430 | 430 | $sql .= ", label"; |
431 | 431 | $sql .= ", type"; |
432 | 432 | $sql .= ") VALUES ("; |
433 | 433 | $sql .= " ".((int) $line_id); |
434 | 434 | $sql .= ", ".((int) $url_id); |
435 | - $sql .= ", '".$this->db->escape($url)."'"; // dperecated |
|
435 | + $sql .= ", '".$this->db->escape($url)."'"; // dperecated |
|
436 | 436 | $sql .= ", '".$this->db->escape($label)."'"; |
437 | 437 | $sql .= ", '".$this->db->escape($type)."'"; |
438 | 438 | $sql .= ")"; |
@@ -1803,8 +1803,8 @@ discard block |
||
1803 | 1803 | */ |
1804 | 1804 | public $datev; |
1805 | 1805 | |
1806 | - public $amount; /* Amount of payment in the bank account currency */ |
|
1807 | - public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */ |
|
1806 | + public $amount; /* Amount of payment in the bank account currency */ |
|
1807 | + public $amount_main_currency; /* Amount in the currency of company if bank account use another currency */ |
|
1808 | 1808 | |
1809 | 1809 | /** |
1810 | 1810 | * @var int ID |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | } else { |
200 | 200 | $sql = ''; |
201 | 201 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
202 | - $sql_exists = "SELECT rowid FROM " . MAIN_DB_PREFIX . "product_perentity"; |
|
203 | - $sql_exists .= " WHERE fk_product = " . ((int) $productid) . " AND entity = " . ((int) $conf->entity); |
|
202 | + $sql_exists = "SELECT rowid FROM ".MAIN_DB_PREFIX."product_perentity"; |
|
203 | + $sql_exists .= " WHERE fk_product = ".((int) $productid)." AND entity = ".((int) $conf->entity); |
|
204 | 204 | $resql_exists = $db->query($sql_exists); |
205 | 205 | if (!$resql_exists) { |
206 | 206 | $msg .= '<div><span style="color:red">'.$langs->trans("ErrorDB").' : '.$langs->trans("Product").' '.$productid.' '.$langs->trans("NotVentilatedinAccount").' : id='.$accounting_account_id.'<br> <pre>'.$resql_exists.'</pre></span></div>'; |
@@ -209,14 +209,14 @@ discard block |
||
209 | 209 | $nb_exists = $db->num_rows($resql_exists); |
210 | 210 | if ($nb_exists <= 0) { |
211 | 211 | // insert |
212 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "product_perentity (fk_product, entity, " . $db->escape($accountancy_field_name) . ")"; |
|
213 | - $sql .= " VALUES (" . ((int) $productid) . ", " . ((int) $conf->entity) . ", '" . $db->escape($accounting->account_number) . "')"; |
|
212 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_perentity (fk_product, entity, ".$db->escape($accountancy_field_name).")"; |
|
213 | + $sql .= " VALUES (".((int) $productid).", ".((int) $conf->entity).", '".$db->escape($accounting->account_number)."')"; |
|
214 | 214 | } else { |
215 | 215 | $obj_exists = $db->fetch_object($resql_exists); |
216 | 216 | // update |
217 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "product_perentity"; |
|
218 | - $sql .= " SET " . $accountancy_field_name . " = '" . $db->escape($accounting->account_number) . "'"; |
|
219 | - $sql .= " WHERE rowid = " . ((int) $obj_exists->rowid); |
|
217 | + $sql = "UPDATE ".MAIN_DB_PREFIX."product_perentity"; |
|
218 | + $sql .= " SET ".$accountancy_field_name." = '".$db->escape($accounting->account_number)."'"; |
|
219 | + $sql .= " WHERE rowid = ".((int) $obj_exists->rowid); |
|
220 | 220 | } |
221 | 221 | } |
222 | 222 | } else { |
@@ -319,17 +319,17 @@ discard block |
||
319 | 319 | $sql .= " aa.rowid as aaid"; |
320 | 320 | $sql .= " FROM ".MAIN_DB_PREFIX."product as p"; |
321 | 321 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
322 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
323 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = ppe." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; |
|
322 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
323 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.account_number = ppe.".$accountancy_field_name." AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; |
|
324 | 324 | } else { |
325 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_account as aa ON aa.account_number = p." . $accountancy_field_name . " AND aa.fk_pcg_version = '" . $db->escape($pcgvercode) . "'"; |
|
325 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.account_number = p.".$accountancy_field_name." AND aa.fk_pcg_version = '".$db->escape($pcgvercode)."'"; |
|
326 | 326 | } |
327 | 327 | if (!empty($searchCategoryProductList)) { |
328 | 328 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; // We'll need this table joined to the select in order to filter by categ |
329 | 329 | } |
330 | 330 | $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; |
331 | 331 | if (strlen(trim($search_current_account))) { |
332 | - $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, $search_current_account); |
|
332 | + $sql .= natural_search((empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.").$accountancy_field_name, $search_current_account); |
|
333 | 333 | } |
334 | 334 | if ($search_current_account_valid == 'withoutvalidaccount') { |
335 | 335 | $sql .= " AND aa.account_number IS NULL"; |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); |
513 | 513 | |
514 | 514 | if ($massaction == 'set_default_account') { |
515 | - $formquestion[]=array('type' => 'other', |
|
515 | + $formquestion[] = array('type' => 'other', |
|
516 | 516 | 'name' => 'set_default_account', |
517 | 517 | 'label' => $langs->trans("AccountancyCode"), |
518 | 518 | 'value' => $form->select_account('', 'default_account', 1, array(), 0, 0, 'maxwidth200 maxwidthonsmartphone', 'cachewithshowemptyone')); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } else { |
598 | 598 | print_liste_field_titre("OnBuy", $_SERVER["PHP_SELF"], "p.tobuy", "", $param, '', $sortfield, $sortorder, 'center '); |
599 | 599 | } |
600 | - print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.") . $accountancy_field_name, "", $param, '', $sortfield, $sortorder); |
|
600 | + print_liste_field_titre("CurrentDedicatedAccountingAccount", $_SERVER["PHP_SELF"], (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? "p." : "ppe.").$accountancy_field_name, "", $param, '', $sortfield, $sortorder); |
|
601 | 601 | print_liste_field_titre("AssignDedicatedAccountingAccount"); |
602 | 602 | $clickpitco = $form->showCheckAddButtons('checkforselect', 1); |
603 | 603 | print_liste_field_titre($clickpitco, '', '', '', '', '', '', '', 'center '); |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | if (!empty($chk_prod)) { |
833 | 833 | $ischecked = 0; |
834 | 834 | if (in_array($product_static->id, $chk_prod)) { |
835 | - $ischecked=true; |
|
835 | + $ischecked = true; |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 |
@@ -950,63 +950,63 @@ discard block |
||
950 | 950 | } |
951 | 951 | |
952 | 952 | // FEC:JournalCode |
953 | - print $line->code_journal . $separator; |
|
953 | + print $line->code_journal.$separator; |
|
954 | 954 | |
955 | 955 | // FEC:JournalLib |
956 | - print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; |
|
956 | + print dol_string_unaccent($langs->transnoentities($line->journal_label)).$separator; |
|
957 | 957 | |
958 | 958 | // FEC:EcritureNum |
959 | - print $line->piece_num . $separator; |
|
959 | + print $line->piece_num.$separator; |
|
960 | 960 | |
961 | 961 | // FEC:EcritureDate |
962 | - print $date_document . $separator; |
|
962 | + print $date_document.$separator; |
|
963 | 963 | |
964 | 964 | // FEC:CompteNum |
965 | - print $line->numero_compte . $separator; |
|
965 | + print $line->numero_compte.$separator; |
|
966 | 966 | |
967 | 967 | // FEC:CompteLib |
968 | - print dol_string_unaccent($line->label_compte) . $separator; |
|
968 | + print dol_string_unaccent($line->label_compte).$separator; |
|
969 | 969 | |
970 | 970 | // FEC:CompAuxNum |
971 | - print $line->subledger_account . $separator; |
|
971 | + print $line->subledger_account.$separator; |
|
972 | 972 | |
973 | 973 | // FEC:CompAuxLib |
974 | - print dol_string_unaccent($line->subledger_label) . $separator; |
|
974 | + print dol_string_unaccent($line->subledger_label).$separator; |
|
975 | 975 | |
976 | 976 | // FEC:PieceRef |
977 | - print $line->doc_ref . $separator; |
|
977 | + print $line->doc_ref.$separator; |
|
978 | 978 | |
979 | 979 | // FEC:PieceDate |
980 | - print dol_string_unaccent($date_creation) . $separator; |
|
980 | + print dol_string_unaccent($date_creation).$separator; |
|
981 | 981 | |
982 | 982 | // FEC:EcritureLib |
983 | 983 | // Clean label operation to prevent problem on export with tab separator & other character |
984 | 984 | $line->label_operation = str_replace(array("\t", "\n", "\r"), " ", $line->label_operation); |
985 | - print dol_string_unaccent($line->label_operation) . $separator; |
|
985 | + print dol_string_unaccent($line->label_operation).$separator; |
|
986 | 986 | |
987 | 987 | // FEC:Debit |
988 | - print price2fec($line->debit) . $separator; |
|
988 | + print price2fec($line->debit).$separator; |
|
989 | 989 | |
990 | 990 | // FEC:Credit |
991 | - print price2fec($line->credit) . $separator; |
|
991 | + print price2fec($line->credit).$separator; |
|
992 | 992 | |
993 | 993 | // FEC:EcritureLet |
994 | - print $line->lettering_code . $separator; |
|
994 | + print $line->lettering_code.$separator; |
|
995 | 995 | |
996 | 996 | // FEC:DateLet |
997 | - print $date_lettering . $separator; |
|
997 | + print $date_lettering.$separator; |
|
998 | 998 | |
999 | 999 | // FEC:ValidDate |
1000 | - print $date_validation . $separator; |
|
1000 | + print $date_validation.$separator; |
|
1001 | 1001 | |
1002 | 1002 | // FEC:Montantdevise |
1003 | - print $line->multicurrency_amount . $separator; |
|
1003 | + print $line->multicurrency_amount.$separator; |
|
1004 | 1004 | |
1005 | 1005 | // FEC:Idevise |
1006 | - print $line->multicurrency_code . $separator; |
|
1006 | + print $line->multicurrency_code.$separator; |
|
1007 | 1007 | |
1008 | 1008 | // FEC_suppl:DateLimitReglmt |
1009 | - print $date_limit_payment . $separator; |
|
1009 | + print $date_limit_payment.$separator; |
|
1010 | 1010 | |
1011 | 1011 | // FEC_suppl:NumFacture |
1012 | 1012 | // Clean ref invoice to prevent problem on export with tab separator & other character |
@@ -1081,63 +1081,63 @@ discard block |
||
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | // FEC:JournalCode |
1084 | - print $line->code_journal . $separator; |
|
1084 | + print $line->code_journal.$separator; |
|
1085 | 1085 | |
1086 | 1086 | // FEC:JournalLib |
1087 | - print dol_string_unaccent($langs->transnoentities($line->journal_label)) . $separator; |
|
1087 | + print dol_string_unaccent($langs->transnoentities($line->journal_label)).$separator; |
|
1088 | 1088 | |
1089 | 1089 | // FEC:EcritureNum |
1090 | - print $line->piece_num . $separator; |
|
1090 | + print $line->piece_num.$separator; |
|
1091 | 1091 | |
1092 | 1092 | // FEC:EcritureDate |
1093 | - print $date_creation . $separator; |
|
1093 | + print $date_creation.$separator; |
|
1094 | 1094 | |
1095 | 1095 | // FEC:CompteNum |
1096 | - print length_accountg($line->numero_compte) . $separator; |
|
1096 | + print length_accountg($line->numero_compte).$separator; |
|
1097 | 1097 | |
1098 | 1098 | // FEC:CompteLib |
1099 | - print dol_string_unaccent($line->label_compte) . $separator; |
|
1099 | + print dol_string_unaccent($line->label_compte).$separator; |
|
1100 | 1100 | |
1101 | 1101 | // FEC:CompAuxNum |
1102 | - print length_accounta($line->subledger_account) . $separator; |
|
1102 | + print length_accounta($line->subledger_account).$separator; |
|
1103 | 1103 | |
1104 | 1104 | // FEC:CompAuxLib |
1105 | - print dol_string_unaccent($line->subledger_label) . $separator; |
|
1105 | + print dol_string_unaccent($line->subledger_label).$separator; |
|
1106 | 1106 | |
1107 | 1107 | // FEC:PieceRef |
1108 | - print $line->doc_ref . $separator; |
|
1108 | + print $line->doc_ref.$separator; |
|
1109 | 1109 | |
1110 | 1110 | // FEC:PieceDate |
1111 | - print $date_document . $separator; |
|
1111 | + print $date_document.$separator; |
|
1112 | 1112 | |
1113 | 1113 | // FEC:EcritureLib |
1114 | 1114 | // Clean label operation to prevent problem on export with tab separator & other character |
1115 | 1115 | $line->label_operation = str_replace(array("\t", "\n", "\r"), " ", $line->label_operation); |
1116 | - print dol_string_unaccent($line->label_operation) . $separator; |
|
1116 | + print dol_string_unaccent($line->label_operation).$separator; |
|
1117 | 1117 | |
1118 | 1118 | // FEC:Debit |
1119 | - print price2fec($line->debit) . $separator; |
|
1119 | + print price2fec($line->debit).$separator; |
|
1120 | 1120 | |
1121 | 1121 | // FEC:Credit |
1122 | - print price2fec($line->credit) . $separator; |
|
1122 | + print price2fec($line->credit).$separator; |
|
1123 | 1123 | |
1124 | 1124 | // FEC:EcritureLet |
1125 | - print $line->lettering_code . $separator; |
|
1125 | + print $line->lettering_code.$separator; |
|
1126 | 1126 | |
1127 | 1127 | // FEC:DateLet |
1128 | - print $date_lettering . $separator; |
|
1128 | + print $date_lettering.$separator; |
|
1129 | 1129 | |
1130 | 1130 | // FEC:ValidDate |
1131 | - print $date_validation . $separator; |
|
1131 | + print $date_validation.$separator; |
|
1132 | 1132 | |
1133 | 1133 | // FEC:Montantdevise |
1134 | - print $line->multicurrency_amount . $separator; |
|
1134 | + print $line->multicurrency_amount.$separator; |
|
1135 | 1135 | |
1136 | 1136 | // FEC:Idevise |
1137 | - print $line->multicurrency_code . $separator; |
|
1137 | + print $line->multicurrency_code.$separator; |
|
1138 | 1138 | |
1139 | 1139 | // FEC_suppl:DateLimitReglmt |
1140 | - print $date_limit_payment . $separator; |
|
1140 | + print $date_limit_payment.$separator; |
|
1141 | 1141 | |
1142 | 1142 | // FEC_suppl:NumFacture |
1143 | 1143 | // Clean ref invoice to prevent problem on export with tab separator & other character |
@@ -1577,7 +1577,7 @@ discard block |
||
1577 | 1577 | } |
1578 | 1578 | } elseif ($line->doc_type == 'customer_invoice') { |
1579 | 1579 | if (($line->amount) < 0) { |
1580 | - $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
1580 | + $nature_piece = 'AC'; // Currently, only the sign of amount allows to know the type of invoice (standard or credit note). Other solution is to analyse debit/credit/role of account. TODO Add column doc_type_long or make amount mandatory with rule on sign. |
|
1581 | 1581 | } else { |
1582 | 1582 | $nature_piece = 'FC'; |
1583 | 1583 | } |
@@ -1764,8 +1764,8 @@ discard block |
||
1764 | 1764 | ($line->doc_type == 'supplier_invoice' && !isset($supplier_invoices_infos[$line->fk_doc]))) { |
1765 | 1765 | if ($line->doc_type == 'customer_invoice') { |
1766 | 1766 | // Get new customer invoice ref and company name |
1767 | - $sql = 'SELECT f.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture as f'; |
|
1768 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON f.fk_soc = s.rowid'; |
|
1767 | + $sql = 'SELECT f.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture as f'; |
|
1768 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON f.fk_soc = s.rowid'; |
|
1769 | 1769 | $sql .= ' WHERE f.rowid = '.((int) $line->fk_doc); |
1770 | 1770 | $resql = $this->db->query($sql); |
1771 | 1771 | if ($resql) { |
@@ -1778,8 +1778,8 @@ discard block |
||
1778 | 1778 | } |
1779 | 1779 | } else { |
1780 | 1780 | // Get new supplier invoice ref and company name |
1781 | - $sql = 'SELECT ff.ref, s.nom FROM ' . MAIN_DB_PREFIX . 'facture_fourn as ff'; |
|
1782 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe AS s ON ff.fk_soc = s.rowid'; |
|
1781 | + $sql = 'SELECT ff.ref, s.nom FROM '.MAIN_DB_PREFIX.'facture_fourn as ff'; |
|
1782 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON ff.fk_soc = s.rowid'; |
|
1783 | 1783 | $sql .= ' WHERE ff.rowid = '.((int) $line->fk_doc); |
1784 | 1784 | $resql = $this->db->query($sql); |
1785 | 1785 | if ($resql) { |
@@ -1802,28 +1802,28 @@ discard block |
||
1802 | 1802 | } |
1803 | 1803 | } |
1804 | 1804 | |
1805 | - print $line->id . $this->separator; |
|
1806 | - print $date . $this->separator; |
|
1807 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
1805 | + print $line->id.$this->separator; |
|
1806 | + print $date.$this->separator; |
|
1807 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
1808 | 1808 | |
1809 | 1809 | if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { |
1810 | - print length_accountg($line->subledger_account) . $this->separator; |
|
1810 | + print length_accountg($line->subledger_account).$this->separator; |
|
1811 | 1811 | } else { |
1812 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
1812 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
1813 | 1813 | } |
1814 | 1814 | //Libellé Auto |
1815 | 1815 | print $this->separator; |
1816 | 1816 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
1817 | 1817 | //Libellé manuel |
1818 | - print dol_trunc(str_replace('"', '', $invoice_ref . (!empty($company_name) ? ' - ' : '') . $company_name), 40, 'right', 'UTF-8', 1) . $this->separator; |
|
1818 | + print dol_trunc(str_replace('"', '', $invoice_ref.(!empty($company_name) ? ' - ' : '').$company_name), 40, 'right', 'UTF-8', 1).$this->separator; |
|
1819 | 1819 | //Numéro de pièce |
1820 | - print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . $this->separator; |
|
1820 | + print dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).$this->separator; |
|
1821 | 1821 | //Devise |
1822 | - print 'EUR' . $this->separator; |
|
1822 | + print 'EUR'.$this->separator; |
|
1823 | 1823 | //Amount |
1824 | - print price2num(abs($line->debit - $line->credit)) . $this->separator; |
|
1824 | + print price2num(abs($line->debit - $line->credit)).$this->separator; |
|
1825 | 1825 | //Sens |
1826 | - print $line->sens . $this->separator; |
|
1826 | + print $line->sens.$this->separator; |
|
1827 | 1827 | //Code lettrage |
1828 | 1828 | print $this->separator; |
1829 | 1829 | //Date Echéance |
@@ -1851,21 +1851,21 @@ discard block |
||
1851 | 1851 | } else { |
1852 | 1852 | $date = dol_print_date($line->doc_date, '%d%m%Y'); |
1853 | 1853 | |
1854 | - print $line->id . $this->separator; |
|
1855 | - print $date . $this->separator; |
|
1856 | - print substr($line->code_journal, 0, 4) . $this->separator; |
|
1854 | + print $line->id.$this->separator; |
|
1855 | + print $date.$this->separator; |
|
1856 | + print substr($line->code_journal, 0, 4).$this->separator; |
|
1857 | 1857 | if ((substr($line->numero_compte, 0, 3) == '411') || (substr($line->numero_compte, 0, 3) == '401')) { // TODO No hard code value |
1858 | - print length_accountg($line->subledger_account) . $this->separator; |
|
1858 | + print length_accountg($line->subledger_account).$this->separator; |
|
1859 | 1859 | } else { |
1860 | - print substr(length_accountg($line->numero_compte), 0, 15) . $this->separator; |
|
1860 | + print substr(length_accountg($line->numero_compte), 0, 15).$this->separator; |
|
1861 | 1861 | } |
1862 | 1862 | print $this->separator; |
1863 | 1863 | //print '"'.dol_trunc(str_replace('"', '', $line->label_operation),40,'right','UTF-8',1).'"' . $this->separator; |
1864 | - print '"' . dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1) . '"' . $this->separator; |
|
1865 | - print '"' . dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1) . '"' . $this->separator; |
|
1866 | - print price2num(abs($line->debit - $line->credit)) . $this->separator; |
|
1867 | - print $line->sens . $this->separator; |
|
1868 | - print $date . $this->separator; |
|
1864 | + print '"'.dol_trunc(str_replace('"', '', $line->doc_ref), 40, 'right', 'UTF-8', 1).'"'.$this->separator; |
|
1865 | + print '"'.dol_trunc(str_replace('"', '', $line->piece_num), 10, 'right', 'UTF-8', 1).'"'.$this->separator; |
|
1866 | + print price2num(abs($line->debit - $line->credit)).$this->separator; |
|
1867 | + print $line->sens.$this->separator; |
|
1868 | + print $date.$this->separator; |
|
1869 | 1869 | print $this->separator; |
1870 | 1870 | print $this->separator; |
1871 | 1871 | print 'EUR'; |
@@ -1926,7 +1926,7 @@ discard block |
||
1926 | 1926 | $tab[] = $line->code_journal; |
1927 | 1927 | |
1928 | 1928 | $separator = $this->separator; |
1929 | - print implode($separator, $tab) . $this->end_line; |
|
1929 | + print implode($separator, $tab).$this->end_line; |
|
1930 | 1930 | } |
1931 | 1931 | } |
1932 | 1932 |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | |
84 | 84 | const STATUS_DRAFT = 0; |
85 | 85 | const STATUS_TRANSFERED = 1; |
86 | - const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
87 | - const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
86 | + const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
87 | + const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type |
|
88 | 88 | |
89 | 89 | |
90 | 90 | /** |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | if (!$error) { |
921 | 921 | $ref = substr($year, -2).$month; |
922 | 922 | |
923 | - $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
923 | + $sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX" |
|
924 | 924 | $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons"; |
925 | 925 | $sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'"; |
926 | 926 | $sql .= " AND entity = ".((int) $conf->entity); |
@@ -1891,7 +1891,7 @@ discard block |
||
1891 | 1891 | $XML_CREDITOR .= ' <EndToEndId>'.(($conf->global->PRELEVEMENT_END_TO_END != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters |
1892 | 1892 | $XML_CREDITOR .= ' </PmtId>'.$CrLf; |
1893 | 1893 | if (!empty($this->sepa_xml_pti_in_ctti)) { |
1894 | - $XML_CREDITOR .= ' <PmtTpInf>' . $CrLf; |
|
1894 | + $XML_CREDITOR .= ' <PmtTpInf>'.$CrLf; |
|
1895 | 1895 | |
1896 | 1896 | // Can be 'NORM' for normal or 'HIGH' for high priority level |
1897 | 1897 | if (!empty($conf->global->PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY)) { |
@@ -1899,14 +1899,14 @@ discard block |
||
1899 | 1899 | } else { |
1900 | 1900 | $instrprty = 'NORM'; |
1901 | 1901 | } |
1902 | - $XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>' . $CrLf; |
|
1903 | - $XML_CREDITOR .= ' <SvcLvl>' . $CrLf; |
|
1904 | - $XML_CREDITOR .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
1905 | - $XML_CREDITOR .= ' </SvcLvl>' . $CrLf; |
|
1906 | - $XML_CREDITOR .= ' <CtgyPurp>' . $CrLf; |
|
1907 | - $XML_CREDITOR .= ' <Cd>CORE</Cd>' . $CrLf; |
|
1908 | - $XML_CREDITOR .= ' </CtgyPurp>' . $CrLf; |
|
1909 | - $XML_CREDITOR .= ' </PmtTpInf>' . $CrLf; |
|
1902 | + $XML_CREDITOR .= ' <InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf; |
|
1903 | + $XML_CREDITOR .= ' <SvcLvl>'.$CrLf; |
|
1904 | + $XML_CREDITOR .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
1905 | + $XML_CREDITOR .= ' </SvcLvl>'.$CrLf; |
|
1906 | + $XML_CREDITOR .= ' <CtgyPurp>'.$CrLf; |
|
1907 | + $XML_CREDITOR .= ' <Cd>CORE</Cd>'.$CrLf; |
|
1908 | + $XML_CREDITOR .= ' </CtgyPurp>'.$CrLf; |
|
1909 | + $XML_CREDITOR .= ' </PmtTpInf>'.$CrLf; |
|
1910 | 1910 | } |
1911 | 1911 | $XML_CREDITOR .= ' <Amt>'.$CrLf; |
1912 | 1912 | $XML_CREDITOR .= ' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf; |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | $this->emetteur_iban = $account->iban; |
2063 | 2063 | $this->emetteur_bic = $account->bic; |
2064 | 2064 | |
2065 | - $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
2065 | + $this->emetteur_ics = ($type == 'bank-transfer' ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456"; |
|
2066 | 2066 | |
2067 | 2067 | $this->raison_sociale = $account->proprio; |
2068 | 2068 | } |
@@ -2154,15 +2154,15 @@ discard block |
||
2154 | 2154 | $XML_SEPA_INFO .= ' <NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf; |
2155 | 2155 | $XML_SEPA_INFO .= ' <CtrlSum>'.$total.'</CtrlSum>'.$CrLf; |
2156 | 2156 | if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) { // @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange. |
2157 | - $XML_SEPA_INFO .= ' <PmtTpInf>' . $CrLf; |
|
2158 | - $XML_SEPA_INFO .= ' <SvcLvl>' . $CrLf; |
|
2159 | - $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>' . $CrLf; |
|
2160 | - $XML_SEPA_INFO .= ' </SvcLvl>' . $CrLf; |
|
2161 | - $XML_SEPA_INFO .= ' <LclInstrm>' . $CrLf; |
|
2162 | - $XML_SEPA_INFO .= ' <Cd>CORE</Cd>' . $CrLf; |
|
2163 | - $XML_SEPA_INFO .= ' </LclInstrm>' . $CrLf; |
|
2164 | - $XML_SEPA_INFO .= ' <SeqTp>' . $format . '</SeqTp>' . $CrLf; |
|
2165 | - $XML_SEPA_INFO .= ' </PmtTpInf>' . $CrLf; |
|
2157 | + $XML_SEPA_INFO .= ' <PmtTpInf>'.$CrLf; |
|
2158 | + $XML_SEPA_INFO .= ' <SvcLvl>'.$CrLf; |
|
2159 | + $XML_SEPA_INFO .= ' <Cd>SEPA</Cd>'.$CrLf; |
|
2160 | + $XML_SEPA_INFO .= ' </SvcLvl>'.$CrLf; |
|
2161 | + $XML_SEPA_INFO .= ' <LclInstrm>'.$CrLf; |
|
2162 | + $XML_SEPA_INFO .= ' <Cd>CORE</Cd>'.$CrLf; |
|
2163 | + $XML_SEPA_INFO .= ' </LclInstrm>'.$CrLf; |
|
2164 | + $XML_SEPA_INFO .= ' <SeqTp>'.$format.'</SeqTp>'.$CrLf; |
|
2165 | + $XML_SEPA_INFO .= ' </PmtTpInf>'.$CrLf; |
|
2166 | 2166 | } |
2167 | 2167 | $XML_SEPA_INFO .= ' <ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf; |
2168 | 2168 | $XML_SEPA_INFO .= ' <Dbtr>'.$CrLf; |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | // Security check |
54 | 54 | if ($user->socid) $socid = $user->socid; |
55 | 55 | |
56 | -$search_ref = GETPOST('search_ref', 'alpha'); |
|
57 | -$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
58 | -$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
59 | -$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
56 | +$search_ref = GETPOST('search_ref', 'alpha'); |
|
57 | +$search_date_startday = GETPOST('search_date_startday', 'int'); |
|
58 | +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); |
|
59 | +$search_date_startyear = GETPOST('search_date_startyear', 'int'); |
|
60 | 60 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
61 | -$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
61 | +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
|
62 | 62 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
63 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
64 | -$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
|
65 | -$search_user = GETPOST('search_user', 'alpha'); |
|
63 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
64 | +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
|
65 | +$search_user = GETPOST('search_user', 'alpha'); |
|
66 | 66 | $search_payment_type = GETPOST('search_payment_type'); |
67 | -$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); |
|
67 | +$search_cheque_num = GETPOST('search_cheque_num', 'alpha'); |
|
68 | 68 | $search_bank_account = GETPOST('search_bank_account', 'int'); |
69 | -$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' |
|
69 | +$search_amount = GETPOST('search_amount', 'alpha'); // alpha because we must be able to search on '< x' |
|
70 | 70 | |
71 | 71 | $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; |
72 | 72 | $sortfield = GETPOST('sortfield', 'aZ09comma'); |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | $sql .= natural_search('pndf.rowid', $search_ref); |
199 | 199 | } |
200 | 200 | if ($search_date_start) { |
201 | - $sql .= " AND pndf.datep >= '" . $db->idate($search_date_start) . "'"; |
|
201 | + $sql .= " AND pndf.datep >= '".$db->idate($search_date_start)."'"; |
|
202 | 202 | } |
203 | 203 | if ($search_date_end) { |
204 | - $sql .=" AND pndf.datep <= '" . $db->idate($search_date_end) . "'"; |
|
204 | + $sql .= " AND pndf.datep <= '".$db->idate($search_date_end)."'"; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | if ($search_user) { |