@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | return $this->LibStatut($this->status, $mode); |
227 | 227 | } |
228 | 228 | |
229 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
229 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
230 | 230 | /** |
231 | 231 | * Return the status |
232 | 232 | * |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public static function LibStatut($status, $mode = 0) |
238 | 238 | { |
239 | - // phpcs:enable |
|
239 | + // phpcs:enable |
|
240 | 240 | global $langs; |
241 | 241 | |
242 | 242 | $labelStatus = $langs->transnoentitiesnoconv('ToDo'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | } |
87 | 87 | |
88 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
88 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
89 | 89 | /** |
90 | 90 | * Read text file, icalender text file |
91 | 91 | * |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function read_file($file) |
96 | 96 | { |
97 | - // phpcs:enable |
|
97 | + // phpcs:enable |
|
98 | 98 | $this->file = $file; |
99 | 99 | $file_text = ''; |
100 | 100 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | return $file_text; // return all text |
112 | 112 | } |
113 | 113 | |
114 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
114 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
115 | 115 | /** |
116 | 116 | * Returns the number of calendar events |
117 | 117 | * |
@@ -119,11 +119,11 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function get_event_count() |
121 | 121 | { |
122 | - // phpcs:enable |
|
122 | + // phpcs:enable |
|
123 | 123 | return $this->event_count; |
124 | 124 | } |
125 | 125 | |
126 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
126 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
127 | 127 | /** |
128 | 128 | * Returns the number of to do |
129 | 129 | * |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function get_todo_count() |
133 | 133 | { |
134 | - // phpcs:enable |
|
134 | + // phpcs:enable |
|
135 | 135 | return $this->todo_count; |
136 | 136 | } |
137 | 137 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | return $this->cal; |
262 | 262 | } |
263 | 263 | |
264 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
264 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
265 | 265 | /** |
266 | 266 | * Add to $this->ical array one value and key. |
267 | 267 | * |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function add_to_array($type, $key, $value) |
274 | 274 | { |
275 | - // phpcs:enable |
|
275 | + // phpcs:enable |
|
276 | 276 | |
277 | 277 | //print 'type='.$type.' key='.$key.' value='.$value.'<br>'."\n"; |
278 | 278 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | $this->last_key = $key; |
325 | 325 | } |
326 | 326 | |
327 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
327 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
328 | 328 | /** |
329 | 329 | * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); |
330 | 330 | * |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function retun_key_value($text) |
335 | 335 | { |
336 | - // phpcs:enable |
|
336 | + // phpcs:enable |
|
337 | 337 | /* |
338 | 338 | preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); |
339 | 339 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | return explode(':', $text, 2); |
350 | 350 | } |
351 | 351 | |
352 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
352 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
353 | 353 | /** |
354 | 354 | * Parse RRULE return array |
355 | 355 | * |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function ical_rrule($value) |
360 | 360 | { |
361 | - // phpcs:enable |
|
361 | + // phpcs:enable |
|
362 | 362 | $result = array(); |
363 | 363 | $rrule = explode(';', $value); |
364 | 364 | foreach ($rrule as $line) { |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | return $result; |
369 | 369 | } |
370 | 370 | |
371 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
371 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
372 | 372 | /** |
373 | 373 | * Return Unix time from ical date time format (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) |
374 | 374 | * |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | */ |
378 | 378 | public function ical_date_to_unix($ical_date) |
379 | 379 | { |
380 | - // phpcs:enable |
|
380 | + // phpcs:enable |
|
381 | 381 | $ical_date = str_replace('T', '', $ical_date); |
382 | 382 | $ical_date = str_replace('Z', '', $ical_date); |
383 | 383 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | return $ntime; // ntime is a GTM time |
394 | 394 | } |
395 | 395 | |
396 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
396 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
397 | 397 | /** |
398 | 398 | * Return unix date from iCal date format |
399 | 399 | * |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function ical_dt_date($key, $value) |
405 | 405 | { |
406 | - // phpcs:enable |
|
406 | + // phpcs:enable |
|
407 | 407 | $return_value = array(); |
408 | 408 | |
409 | 409 | // Analyse TZID |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | return array($key, $return_value); |
425 | 425 | } |
426 | 426 | |
427 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
427 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
428 | 428 | /** |
429 | 429 | * Return sorted eventlist as array or false if calendar is empty |
430 | 430 | * |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function get_sort_event_list() |
434 | 434 | { |
435 | - // phpcs:enable |
|
435 | + // phpcs:enable |
|
436 | 436 | $temp = $this->get_event_list(); |
437 | 437 | if (!empty($temp)) { |
438 | 438 | usort($temp, array(&$this, "ical_dtstart_compare")); |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
445 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
446 | 446 | /** |
447 | 447 | * Compare two unix timestamp |
448 | 448 | * |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | */ |
453 | 453 | public function ical_dtstart_compare($a, $b) |
454 | 454 | { |
455 | - // phpcs:enable |
|
455 | + // phpcs:enable |
|
456 | 456 | return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); |
457 | 457 | } |
458 | 458 | |
459 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
459 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
460 | 460 | /** |
461 | 461 | * Return eventlist array (not sorted eventlist array) |
462 | 462 | * |
@@ -464,11 +464,11 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public function get_event_list() |
466 | 466 | { |
467 | - // phpcs:enable |
|
467 | + // phpcs:enable |
|
468 | 468 | return (empty($this->cal['VEVENT']) ? array() : $this->cal['VEVENT']); |
469 | 469 | } |
470 | 470 | |
471 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
471 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
472 | 472 | /** |
473 | 473 | * Return freebusy array (not sort eventlist array) |
474 | 474 | * |
@@ -476,11 +476,11 @@ discard block |
||
476 | 476 | */ |
477 | 477 | public function get_freebusy_list() |
478 | 478 | { |
479 | - // phpcs:enable |
|
479 | + // phpcs:enable |
|
480 | 480 | return (empty($this->cal['VFREEBUSY']) ? array() : $this->cal['VFREEBUSY']); |
481 | 481 | } |
482 | 482 | |
483 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
483 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
484 | 484 | /** |
485 | 485 | * Return to do array (not sorted todo array) |
486 | 486 | * |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function get_todo_list() |
490 | 490 | { |
491 | - // phpcs:enable |
|
491 | + // phpcs:enable |
|
492 | 492 | return $this->cal['VTODO']; |
493 | 493 | } |
494 | 494 | |
495 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
495 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
496 | 496 | /** |
497 | 497 | * Return base calendar data |
498 | 498 | * |
@@ -500,11 +500,11 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function get_calender_data() |
502 | 502 | { |
503 | - // phpcs:enable |
|
503 | + // phpcs:enable |
|
504 | 504 | return $this->cal['VCALENDAR']; |
505 | 505 | } |
506 | 506 | |
507 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
507 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
508 | 508 | /** |
509 | 509 | * Return array with all data |
510 | 510 | * |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function get_all_data() |
514 | 514 | { |
515 | - // phpcs:enable |
|
515 | + // phpcs:enable |
|
516 | 516 | return $this->cal; |
517 | 517 | } |
518 | 518 | } |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | public $fin_validite; // code |
195 | 195 | public $user_author_id; // label |
196 | 196 | /** |
197 | - * @deprecated |
|
198 | - * @see $total_ht |
|
199 | - */ |
|
197 | + * @deprecated |
|
198 | + * @see $total_ht |
|
199 | + */ |
|
200 | 200 | public $price; // label doc |
201 | 201 | /** |
202 | 202 | * @deprecated |
@@ -204,9 +204,9 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public $tva; // code |
206 | 206 | /** |
207 | - * @deprecated |
|
208 | - * @see $total_ttc |
|
209 | - */ |
|
207 | + * @deprecated |
|
208 | + * @see $total_ttc |
|
209 | + */ |
|
210 | 210 | public $total; // label |
211 | 211 | public $cond_reglement_code; |
212 | 212 | public $cond_reglement; |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | */ |
227 | 227 | public $availability_id; // id |
228 | 228 | /** |
229 | - * @var int availability ID |
|
230 | - * @deprecated |
|
231 | - * @see $availability_id |
|
232 | - */ |
|
229 | + * @var int availability ID |
|
230 | + * @deprecated |
|
231 | + * @see $availability_id |
|
232 | + */ |
|
233 | 233 | public $fk_availability; // code |
234 | 234 | /** |
235 | - * @var string availability code |
|
236 | - */ |
|
235 | + * @var string availability code |
|
236 | + */ |
|
237 | 237 | public $availability_code; // label |
238 | 238 | /** |
239 | 239 | * @var string availability label |
@@ -338,8 +338,8 @@ discard block |
||
338 | 338 | 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'visible' => -2, 'position' => 900), |
339 | 339 | ); |
340 | 340 | /** |
341 | - * {@inheritdoc} |
|
342 | - */ |
|
341 | + * {@inheritdoc} |
|
342 | + */ |
|
343 | 343 | protected $table_ref_field = 'ref'; // Todo rename into STATUS_CLOSE ? |
344 | 344 | |
345 | 345 | /** |
@@ -190,23 +190,23 @@ discard block |
||
190 | 190 | * @var integer|string $delivery_date ; |
191 | 191 | */ |
192 | 192 | public $delivery_date; |
193 | - public $fin_validite; // code |
|
194 | - public $user_author_id; // label |
|
193 | + public $fin_validite; // code |
|
194 | + public $user_author_id; // label |
|
195 | 195 | /** |
196 | 196 | * @deprecated |
197 | 197 | * @see $total_ht |
198 | 198 | */ |
199 | - public $price; // label doc |
|
199 | + public $price; // label doc |
|
200 | 200 | /** |
201 | 201 | * @deprecated |
202 | 202 | * @see $total_tva |
203 | 203 | */ |
204 | - public $tva; // code |
|
204 | + public $tva; // code |
|
205 | 205 | /** |
206 | 206 | * @deprecated |
207 | 207 | * @see $total_ttc |
208 | 208 | */ |
209 | - public $total; // label |
|
209 | + public $total; // label |
|
210 | 210 | public $cond_reglement_code; |
211 | 211 | public $cond_reglement; |
212 | 212 | public $cond_reglement_doc; |
@@ -223,17 +223,17 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * @var int availability ID |
225 | 225 | */ |
226 | - public $availability_id; // id |
|
226 | + public $availability_id; // id |
|
227 | 227 | /** |
228 | 228 | * @var int availability ID |
229 | 229 | * @deprecated |
230 | 230 | * @see $availability_id |
231 | 231 | */ |
232 | - public $fk_availability; // code |
|
232 | + public $fk_availability; // code |
|
233 | 233 | /** |
234 | 234 | * @var string availability code |
235 | 235 | */ |
236 | - public $availability_code; // label |
|
236 | + public $availability_code; // label |
|
237 | 237 | /** |
238 | 238 | * @var string availability label |
239 | 239 | */ |
@@ -512,14 +512,14 @@ discard block |
||
512 | 512 | |
513 | 513 | if (!empty($ref)) { |
514 | 514 | if (!empty($forceentity)) { |
515 | - $sql .= " WHERE p.entity = " . (int)$forceentity; // Check only the current entity because we may have the same reference in several entities |
|
515 | + $sql .= " WHERE p.entity = " . (int) $forceentity; // Check only the current entity because we may have the same reference in several entities |
|
516 | 516 | } else { |
517 | 517 | $sql .= " WHERE p.entity IN (" . getEntity('propal') . ")"; |
518 | 518 | } |
519 | 519 | $sql .= " AND p.ref='" . $this->db->escape($ref) . "'"; |
520 | 520 | } else { |
521 | 521 | // Don't use entity if you use rowid |
522 | - $sql .= " WHERE p.rowid = " . ((int)$rowid); |
|
522 | + $sql .= " WHERE p.rowid = " . ((int) $rowid); |
|
523 | 523 | } |
524 | 524 | |
525 | 525 | dol_syslog(get_only_class($this) . "::fetch", LOG_DEBUG); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $this->ref_customer = $obj->ref_client; |
537 | 537 | $this->ref_ext = $obj->ref_ext; |
538 | 538 | |
539 | - $this->total = $obj->total_ttc; // TODO deprecated |
|
539 | + $this->total = $obj->total_ttc; // TODO deprecated |
|
540 | 540 | $this->total_ttc = $obj->total_ttc; |
541 | 541 | $this->total_ht = $obj->total_ht; |
542 | 542 | $this->total_tva = $obj->total_tva; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $this->note_private = $obj->note_private; |
556 | 556 | $this->note_public = $obj->note_public; |
557 | 557 | |
558 | - $this->status = (int)$obj->fk_statut; |
|
558 | + $this->status = (int) $obj->fk_statut; |
|
559 | 559 | $this->statut = $this->status; // deprecated |
560 | 560 | |
561 | 561 | $this->datec = $this->db->jdate($obj->datec); // TODO deprecated |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $this->cond_reglement_doc = $obj->cond_reglement_libelle_doc; |
589 | 589 | $this->deposit_percent = $obj->deposit_percent; |
590 | 590 | |
591 | - $this->extraparams = !empty($obj->extraparams) ? (array)json_decode($obj->extraparams, true) : array(); |
|
591 | + $this->extraparams = !empty($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array(); |
|
592 | 592 | |
593 | 593 | $this->user_author_id = $obj->fk_user_author; |
594 | 594 | $this->user_validation_id = $obj->fk_user_valid; |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $sql .= ' d.fk_multicurrency, d.multicurrency_code, d.multicurrency_subprice, d.multicurrency_total_ht, d.multicurrency_total_tva, d.multicurrency_total_ttc'; |
655 | 655 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'propaldet as d'; |
656 | 656 | $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product as p ON (d.fk_product = p.rowid)'; |
657 | - $sql .= ' WHERE d.fk_propal = ' . ((int)$this->id); |
|
657 | + $sql .= ' WHERE d.fk_propal = ' . ((int) $this->id); |
|
658 | 658 | if ($only_product) { |
659 | 659 | $sql .= ' AND p.fk_product_type = 0'; |
660 | 660 | } |
@@ -873,10 +873,10 @@ discard block |
||
873 | 873 | |
874 | 874 | // Clean parameters |
875 | 875 | $remise_percent = price2num($remise_percent); |
876 | - $qty = (float)price2num($qty); |
|
876 | + $qty = (float) price2num($qty); |
|
877 | 877 | $pu = price2num($pu); |
878 | 878 | $pu_ht_devise = price2num($pu_ht_devise); |
879 | - if (!preg_match('/\((.*)\)/', (string)$txtva)) { |
|
879 | + if (!preg_match('/\((.*)\)/', (string) $txtva)) { |
|
880 | 880 | $txtva = price2num($txtva); // $txtva can have format '5.0(XXX)' or '5' |
881 | 881 | } |
882 | 882 | $txlocaltax1 = price2num($txlocaltax1); |
@@ -937,9 +937,9 @@ discard block |
||
937 | 937 | // Anciens indicateurs: $price, $remise (a ne plus utiliser) |
938 | 938 | $price = $pu; |
939 | 939 | $remise = 0; |
940 | - if ((float)$remise_percent > 0) { |
|
941 | - $remise = round(((float)$pu * (float)$remise_percent / 100), 2); |
|
942 | - $price = (float)$pu - $remise; |
|
940 | + if ((float) $remise_percent > 0) { |
|
941 | + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); |
|
942 | + $price = (float) $pu - $remise; |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | //Fetch current line from the database and then clone the object and set it in $oldline property |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | $sql .= " note_public=" . (isset($this->note_public) ? "'" . $this->db->escape($this->note_public) . "'" : "null") . ","; |
1098 | 1098 | $sql .= " model_pdf=" . (isset($this->model_pdf) ? "'" . $this->db->escape($this->model_pdf) . "'" : "null") . ","; |
1099 | 1099 | $sql .= " import_key=" . (isset($this->import_key) ? "'" . $this->db->escape($this->import_key) . "'" : "null"); |
1100 | - $sql .= " WHERE rowid=" . ((int)$this->id); |
|
1100 | + $sql .= " WHERE rowid=" . ((int) $this->id); |
|
1101 | 1101 | |
1102 | 1102 | $this->db->begin(); |
1103 | 1103 | |
@@ -1216,8 +1216,8 @@ discard block |
||
1216 | 1216 | // Delete extrafields of lines and lines |
1217 | 1217 | if (!$error && !empty($this->table_element_line)) { |
1218 | 1218 | $tabletodelete = $this->table_element_line; |
1219 | - $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id) . ")"; |
|
1220 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int)$this->id); |
|
1219 | + $sqlef = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . "_extrafields WHERE fk_object IN (SELECT rowid FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id) . ")"; |
|
1220 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . $tabletodelete . " WHERE " . $this->fk_element . " = " . ((int) $this->id); |
|
1221 | 1221 | if (!$this->db->query($sqlef) || !$this->db->query($sql)) { |
1222 | 1222 | $error++; |
1223 | 1223 | $this->error = $this->db->lasterror(); |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | |
1254 | 1254 | // Delete main record |
1255 | 1255 | if (!$error) { |
1256 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int)$this->id); |
|
1256 | + $sql = "DELETE FROM " . MAIN_DB_PREFIX . $this->table_element . " WHERE rowid = " . ((int) $this->id); |
|
1257 | 1257 | $res = $this->db->query($sql); |
1258 | 1258 | if (!$res) { |
1259 | 1259 | $error++; |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | } |
1290 | 1290 | } |
1291 | 1291 | if (file_exists($dir)) { |
1292 | - $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
1292 | + $res = @dol_delete_dir_recursive($dir); // delete files physically + into ecm tables |
|
1293 | 1293 | if (!$res) { |
1294 | 1294 | $this->error = 'ErrorFailToDeleteDir'; |
1295 | 1295 | $this->errors[] = $this->error; |
@@ -1609,15 +1609,15 @@ discard block |
||
1609 | 1609 | $sql .= ", '" . $this->db->idate($this->date) . "'"; |
1610 | 1610 | $sql .= ", '" . $this->db->idate($now) . "'"; |
1611 | 1611 | $sql .= ", '(PROV)'"; |
1612 | - $sql .= ", " . ($user->id > 0 ? ((int)$user->id) : "NULL"); |
|
1612 | + $sql .= ", " . ($user->id > 0 ? ((int) $user->id) : "NULL"); |
|
1613 | 1613 | $sql .= ", '" . $this->db->escape($this->note_private) . "'"; |
1614 | 1614 | $sql .= ", '" . $this->db->escape($this->note_public) . "'"; |
1615 | 1615 | $sql .= ", '" . $this->db->escape($this->model_pdf) . "'"; |
1616 | 1616 | $sql .= ", " . ($this->fin_validite != '' ? "'" . $this->db->idate($this->fin_validite) . "'" : "NULL"); |
1617 | - $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int)$this->cond_reglement_id) : 'NULL'); |
|
1617 | + $sql .= ", " . ($this->cond_reglement_id > 0 ? ((int) $this->cond_reglement_id) : 'NULL'); |
|
1618 | 1618 | $sql .= ", " . (!empty($this->deposit_percent) ? "'" . $this->db->escape($this->deposit_percent) . "'" : 'NULL'); |
1619 | - $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int)$this->mode_reglement_id) : 'NULL'); |
|
1620 | - $sql .= ", " . ($this->fk_account > 0 ? ((int)$this->fk_account) : 'NULL'); |
|
1619 | + $sql .= ", " . ($this->mode_reglement_id > 0 ? ((int) $this->mode_reglement_id) : 'NULL'); |
|
1620 | + $sql .= ", " . ($this->fk_account > 0 ? ((int) $this->fk_account) : 'NULL'); |
|
1621 | 1621 | $sql .= ", '" . $this->db->escape($this->ref_client) . "'"; |
1622 | 1622 | $sql .= ", '" . $this->db->escape($this->ref_ext) . "'"; |
1623 | 1623 | $sql .= ", " . (empty($delivery_date) ? "NULL" : "'" . $this->db->idate($delivery_date) . "'"); |
@@ -1626,12 +1626,12 @@ discard block |
||
1626 | 1626 | $sql .= ", " . $this->availability_id; |
1627 | 1627 | $sql .= ", " . $this->demand_reason_id; |
1628 | 1628 | $sql .= ", " . ($this->fk_project ? $this->fk_project : "null"); |
1629 | - $sql .= ", " . (int)$this->fk_incoterms; |
|
1629 | + $sql .= ", " . (int) $this->fk_incoterms; |
|
1630 | 1630 | $sql .= ", '" . $this->db->escape($this->location_incoterms) . "'"; |
1631 | 1631 | $sql .= ", " . setEntity($this); |
1632 | - $sql .= ", " . (int)$this->fk_multicurrency; |
|
1632 | + $sql .= ", " . (int) $this->fk_multicurrency; |
|
1633 | 1633 | $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
1634 | - $sql .= ", " . (float)$this->multicurrency_tx; |
|
1634 | + $sql .= ", " . (float) $this->multicurrency_tx; |
|
1635 | 1635 | $sql .= ")"; |
1636 | 1636 | |
1637 | 1637 | dol_syslog(get_only_class($this) . "::create", LOG_DEBUG); |
@@ -1641,7 +1641,7 @@ discard block |
||
1641 | 1641 | |
1642 | 1642 | if ($this->id) { |
1643 | 1643 | $this->ref = '(PROV' . $this->id . ')'; |
1644 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int)$this->id); |
|
1644 | + $sql = 'UPDATE ' . MAIN_DB_PREFIX . "propal SET ref='" . $this->db->escape($this->ref) . "' WHERE rowid=" . ((int) $this->id); |
|
1645 | 1645 | |
1646 | 1646 | dol_syslog(get_only_class($this) . "::create", LOG_DEBUG); |
1647 | 1647 | $resql = $this->db->query($sql); |
@@ -1686,7 +1686,7 @@ discard block |
||
1686 | 1686 | for ($i = 0; $i < $num; $i++) { |
1687 | 1687 | if (!is_object($this->lines[$i])) { // If this->lines is not array of objects, coming from REST API |
1688 | 1688 | // Convert into object this->lines[$i]. |
1689 | - $line = (object)$this->lines[$i]; |
|
1689 | + $line = (object) $this->lines[$i]; |
|
1690 | 1690 | } else { |
1691 | 1691 | $line = $this->lines[$i]; |
1692 | 1692 | } |
@@ -1879,11 +1879,11 @@ discard block |
||
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | $remise_percent = price2num($remise_percent); |
1882 | - $qty = (float)price2num($qty); |
|
1882 | + $qty = (float) price2num($qty); |
|
1883 | 1883 | $pu_ht = price2num($pu_ht); |
1884 | 1884 | $pu_ht_devise = price2num($pu_ht_devise); |
1885 | 1885 | $pu_ttc = price2num($pu_ttc); |
1886 | - if (!preg_match('/\((.*)\)/', (string)$txtva)) { |
|
1886 | + if (!preg_match('/\((.*)\)/', (string) $txtva)) { |
|
1887 | 1887 | $txtva = price2num($txtva); // $txtva can have format '5,1' or '5.1' or '5.1(XXX)', we must clean only if '5,1' |
1888 | 1888 | } |
1889 | 1889 | $txlocaltax1 = price2num($txlocaltax1); |
@@ -1965,9 +1965,9 @@ discard block |
||
1965 | 1965 | // Anciens indicateurs: $price, $remise (a ne plus utiliser) |
1966 | 1966 | $price = $pu; |
1967 | 1967 | $remise = 0; |
1968 | - if ((float)$remise_percent > 0) { |
|
1969 | - $remise = round(((float)$pu * (float)$remise_percent / 100), 2); |
|
1970 | - $price = (float)$pu - $remise; |
|
1968 | + if ((float) $remise_percent > 0) { |
|
1969 | + $remise = round(((float) $pu * (float) $remise_percent / 100), 2); |
|
1970 | + $price = (float) $pu - $remise; |
|
1971 | 1971 | } |
1972 | 1972 | |
1973 | 1973 | // Insert line |
@@ -2118,8 +2118,8 @@ discard block |
||
2118 | 2118 | |
2119 | 2119 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2120 | 2120 | $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
2121 | - $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int)$user->id); |
|
2122 | - $sql .= " WHERE rowid = " . ((int)$this->id) . " AND fk_statut = " . self::STATUS_DRAFT; |
|
2121 | + $sql .= " fk_statut = " . self::STATUS_VALIDATED . ", date_valid='" . $this->db->idate($now) . "', fk_user_valid=" . ((int) $user->id); |
|
2122 | + $sql .= " WHERE rowid = " . ((int) $this->id) . " AND fk_statut = " . self::STATUS_DRAFT; |
|
2123 | 2123 | |
2124 | 2124 | dol_syslog(get_only_class($this) . "::valid", LOG_DEBUG); |
2125 | 2125 | $resql = $this->db->query($sql); |
@@ -2145,7 +2145,7 @@ discard block |
||
2145 | 2145 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
2146 | 2146 | // Now we rename also files into index |
2147 | 2147 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'propale/" . $this->db->escape($this->newref) . "'"; |
2148 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int)$conf->entity); |
|
2148 | + $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'propale/" . $this->db->escape($this->ref) . "' and entity = " . ((int) $conf->entity); |
|
2149 | 2149 | $resql = $this->db->query($sql); |
2150 | 2150 | if (!$resql) { |
2151 | 2151 | $error++; |
@@ -2216,12 +2216,12 @@ discard block |
||
2216 | 2216 | $file = $classname . ".php"; |
2217 | 2217 | |
2218 | 2218 | // Include file with class |
2219 | - $dirmodels = array_merge(array('/'), (array)$conf->modules_parts['models']); |
|
2219 | + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
|
2220 | 2220 | foreach ($dirmodels as $reldir) { |
2221 | 2221 | $dir = dol_buildpath($reldir . "core/modules/propale/"); |
2222 | 2222 | |
2223 | 2223 | // Load file with numbering class (if found) |
2224 | - $mybool = ((bool)@include_once $dir . $file) || $mybool; |
|
2224 | + $mybool = ((bool) @include_once $dir . $file) || $mybool; |
|
2225 | 2225 | } |
2226 | 2226 | |
2227 | 2227 | if (!$mybool) { |
@@ -2272,7 +2272,7 @@ discard block |
||
2272 | 2272 | $this->db->begin(); |
2273 | 2273 | |
2274 | 2274 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET datep = '" . $this->db->idate($date) . "'"; |
2275 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2275 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2276 | 2276 | |
2277 | 2277 | dol_syslog(__METHOD__, LOG_DEBUG); |
2278 | 2278 | $resql = $this->db->query($sql); |
@@ -2331,7 +2331,7 @@ discard block |
||
2331 | 2331 | $this->db->begin(); |
2332 | 2332 | |
2333 | 2333 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET fin_validite = " . ($date_end_validity != '' ? "'" . $this->db->idate($date_end_validity) . "'" : 'null'); |
2334 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2334 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2335 | 2335 | |
2336 | 2336 | dol_syslog(__METHOD__, LOG_DEBUG); |
2337 | 2337 | |
@@ -2406,7 +2406,7 @@ discard block |
||
2406 | 2406 | |
2407 | 2407 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal "; |
2408 | 2408 | $sql .= " SET date_livraison = " . ($delivery_date != '' ? "'" . $this->db->idate($delivery_date) . "'" : 'null'); |
2409 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2409 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2410 | 2410 | |
2411 | 2411 | dol_syslog(__METHOD__, LOG_DEBUG); |
2412 | 2412 | $resql = $this->db->query($sql); |
@@ -2462,8 +2462,8 @@ discard block |
||
2462 | 2462 | $this->db->begin(); |
2463 | 2463 | |
2464 | 2464 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2465 | - $sql .= " SET fk_availability = " . ((int)$id); |
|
2466 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2465 | + $sql .= " SET fk_availability = " . ((int) $id); |
|
2466 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2467 | 2467 | |
2468 | 2468 | dol_syslog(__METHOD__ . ' availability(' . $id . ')', LOG_DEBUG); |
2469 | 2469 | $resql = $this->db->query($sql); |
@@ -2524,8 +2524,8 @@ discard block |
||
2524 | 2524 | $this->db->begin(); |
2525 | 2525 | |
2526 | 2526 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal "; |
2527 | - $sql .= " SET fk_input_reason = " . ((int)$id); |
|
2528 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2527 | + $sql .= " SET fk_input_reason = " . ((int) $id); |
|
2528 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2529 | 2529 | |
2530 | 2530 | dol_syslog(__METHOD__, LOG_DEBUG); |
2531 | 2531 | $resql = $this->db->query($sql); |
@@ -2588,7 +2588,7 @@ discard block |
||
2588 | 2588 | $this->db->begin(); |
2589 | 2589 | |
2590 | 2590 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal SET ref_client = " . (empty($ref_client) ? 'NULL' : "'" . $this->db->escape($ref_client) . "'"); |
2591 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2591 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2592 | 2592 | |
2593 | 2593 | dol_syslog(__METHOD__ . ' $this->id=' . $this->id . ', ref_client=' . $ref_client, LOG_DEBUG); |
2594 | 2594 | $resql = $this->db->query($sql); |
@@ -2643,12 +2643,12 @@ discard block |
||
2643 | 2643 | $error = 0; |
2644 | 2644 | |
2645 | 2645 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2646 | - $sql .= " SET fk_statut = " . ((int)$status) . ","; |
|
2646 | + $sql .= " SET fk_statut = " . ((int) $status) . ","; |
|
2647 | 2647 | if (!empty($note)) { |
2648 | 2648 | $sql .= " note_private = '" . $this->db->escape($note) . "',"; |
2649 | 2649 | } |
2650 | 2650 | $sql .= " date_cloture=NULL, fk_user_cloture=NULL"; |
2651 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2651 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2652 | 2652 | |
2653 | 2653 | $this->db->begin(); |
2654 | 2654 | |
@@ -2726,17 +2726,17 @@ discard block |
||
2726 | 2726 | } |
2727 | 2727 | |
2728 | 2728 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2729 | - $sql .= " SET fk_statut = " . ((int)$status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature; |
|
2730 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2729 | + $sql .= " SET fk_statut = " . ((int) $status) . ", note_private = '" . $this->db->escape($newprivatenote) . "', date_signature='" . $this->db->idate($date_signature) . "', fk_user_signature=" . $fk_user_signature; |
|
2730 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2731 | 2731 | |
2732 | 2732 | $resql = $this->db->query($sql); |
2733 | 2733 | if ($resql) { |
2734 | 2734 | // Status self::STATUS_REFUSED by default |
2735 | 2735 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED', $this->model_pdf); |
2736 | - $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2736 | + $trigger_name = 'PROPAL_CLOSE_REFUSED'; // used later in call_trigger() |
|
2737 | 2737 | |
2738 | 2738 | if ($status == self::STATUS_SIGNED) { // Status self::STATUS_SIGNED |
2739 | - $trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2739 | + $trigger_name = 'PROPAL_CLOSE_SIGNED'; // used later in call_trigger() |
|
2740 | 2740 | $modelpdf = getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL') ? $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL : $this->model_pdf; |
2741 | 2741 | |
2742 | 2742 | // The connected company is classified as a client |
@@ -2817,7 +2817,7 @@ discard block |
||
2817 | 2817 | $sql .= " c.datec, c.date_valid as datev, c.date_signature, c.date_cloture,"; |
2818 | 2818 | $sql .= " c.fk_user_author, c.fk_user_valid, c.fk_user_signature, c.fk_user_cloture"; |
2819 | 2819 | $sql .= " FROM " . MAIN_DB_PREFIX . "propal as c"; |
2820 | - $sql .= " WHERE c.rowid = " . ((int)$id); |
|
2820 | + $sql .= " WHERE c.rowid = " . ((int) $id); |
|
2821 | 2821 | |
2822 | 2822 | $result = $this->db->query($sql); |
2823 | 2823 | |
@@ -2908,8 +2908,8 @@ discard block |
||
2908 | 2908 | $newprivatenote = dol_concatdesc($this->note_private, $note); |
2909 | 2909 | |
2910 | 2910 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal SET fk_statut = ' . self::STATUS_BILLED . ", "; |
2911 | - $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int)$user->id); |
|
2912 | - $sql .= ' WHERE rowid = ' . ((int)$this->id) . ' AND fk_statut = ' . ((int)self::STATUS_SIGNED); |
|
2911 | + $sql .= " note_private = '" . $this->db->escape($newprivatenote) . "', date_cloture='" . $this->db->idate($now) . "', fk_user_cloture=" . ((int) $user->id); |
|
2912 | + $sql .= ' WHERE rowid = ' . ((int) $this->id) . ' AND fk_statut = ' . ((int) self::STATUS_SIGNED); |
|
2913 | 2913 | |
2914 | 2914 | dol_syslog(__METHOD__, LOG_DEBUG); |
2915 | 2915 | $resql = $this->db->query($sql); |
@@ -2983,8 +2983,8 @@ discard block |
||
2983 | 2983 | |
2984 | 2984 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
2985 | 2985 | $sql .= " SET fk_statut = " . self::STATUS_CANCELED . ","; |
2986 | - $sql .= " fk_user_modif = " . ((int)$user->id); |
|
2987 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
2986 | + $sql .= " fk_user_modif = " . ((int) $user->id); |
|
2987 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
2988 | 2988 | |
2989 | 2989 | dol_syslog(get_only_class($this) . "::cancel", LOG_DEBUG); |
2990 | 2990 | if ($this->db->query($sql)) { |
@@ -3042,7 +3042,7 @@ discard block |
||
3042 | 3042 | $sql = "UPDATE " . MAIN_DB_PREFIX . "propal"; |
3043 | 3043 | $sql .= " SET fk_statut = " . self::STATUS_DRAFT; |
3044 | 3044 | $sql .= ", online_sign_ip = NULL , online_sign_name = NULL"; |
3045 | - $sql .= " WHERE rowid = " . ((int)$this->id); |
|
3045 | + $sql .= " WHERE rowid = " . ((int) $this->id); |
|
3046 | 3046 | |
3047 | 3047 | $resql = $this->db->query($sql); |
3048 | 3048 | if (!$resql) { |
@@ -3117,18 +3117,18 @@ discard block |
||
3117 | 3117 | if ($search_sale == -2) { |
3118 | 3118 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3119 | 3119 | } elseif ($search_sale > 0) { |
3120 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3120 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3121 | 3121 | } |
3122 | 3122 | } |
3123 | 3123 | // Search on socid |
3124 | 3124 | if ($socid) { |
3125 | - $sql .= " AND p.fk_soc = " . ((int)$socid); |
|
3125 | + $sql .= " AND p.fk_soc = " . ((int) $socid); |
|
3126 | 3126 | } |
3127 | 3127 | if ($draft) { |
3128 | - $sql .= " AND p.fk_statut = " . ((int)self::STATUS_DRAFT); |
|
3128 | + $sql .= " AND p.fk_statut = " . ((int) self::STATUS_DRAFT); |
|
3129 | 3129 | } |
3130 | 3130 | if ($notcurrentuser > 0) { |
3131 | - $sql .= " AND p.fk_user_author <> " . ((int)$user->id); |
|
3131 | + $sql .= " AND p.fk_user_author <> " . ((int) $user->id); |
|
3132 | 3132 | } |
3133 | 3133 | $sql .= $this->db->order($sortfield, $sortorder); |
3134 | 3134 | $sql .= $this->db->plimit($limit, $offset); |
@@ -3266,8 +3266,8 @@ discard block |
||
3266 | 3266 | $this->db->begin(); |
3267 | 3267 | |
3268 | 3268 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal'; |
3269 | - $sql .= ' SET fk_availability = ' . ((int)$availability_id); |
|
3270 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3269 | + $sql .= ' SET fk_availability = ' . ((int) $availability_id); |
|
3270 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3271 | 3271 | |
3272 | 3272 | dol_syslog(__METHOD__ . ' availability(' . $availability_id . ')', LOG_DEBUG); |
3273 | 3273 | $resql = $this->db->query($sql); |
@@ -3329,8 +3329,8 @@ discard block |
||
3329 | 3329 | $this->db->begin(); |
3330 | 3330 | |
3331 | 3331 | $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'propal'; |
3332 | - $sql .= ' SET fk_input_reason = ' . ((int)$demand_reason_id); |
|
3333 | - $sql .= ' WHERE rowid=' . ((int)$this->id); |
|
3332 | + $sql .= ' SET fk_input_reason = ' . ((int) $demand_reason_id); |
|
3333 | + $sql .= ' WHERE rowid=' . ((int) $this->id); |
|
3334 | 3334 | |
3335 | 3335 | dol_syslog(__METHOD__ . ' demand_reason(' . $demand_reason_id . ')', LOG_DEBUG); |
3336 | 3336 | $resql = $this->db->query($sql); |
@@ -3406,7 +3406,7 @@ discard block |
||
3406 | 3406 | if ($search_sale == -2) { |
3407 | 3407 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3408 | 3408 | } elseif ($search_sale > 0) { |
3409 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3409 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3410 | 3410 | } |
3411 | 3411 | } |
3412 | 3412 | |
@@ -3582,7 +3582,7 @@ discard block |
||
3582 | 3582 | if ($search_sale == -2) { |
3583 | 3583 | $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc)"; |
3584 | 3584 | } elseif ($search_sale > 0) { |
3585 | - $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int)$search_sale) . ")"; |
|
3585 | + $sql .= " AND EXISTS (SELECT sc.fk_soc FROM " . MAIN_DB_PREFIX . "societe_commerciaux as sc WHERE sc.fk_soc = p.fk_soc AND sc.fk_user = " . ((int) $search_sale) . ")"; |
|
3586 | 3586 | } |
3587 | 3587 | } |
3588 | 3588 |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
668 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
669 | 669 | /** |
670 | 670 | * Update DB line fields total_xxx |
671 | 671 | * Used by migration |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function update_total() |
676 | 676 | { |
677 | - // phpcs:enable |
|
677 | + // phpcs:enable |
|
678 | 678 | $this->db->begin(); |
679 | 679 | |
680 | 680 | // Mise a jour ligne en base |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | |
972 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
972 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
973 | 973 | /** |
974 | 974 | * Initialize this->userassigned array with list of id of user assigned to event |
975 | 975 | * |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | */ |
979 | 979 | public function fetch_userassigned($override = true) |
980 | 980 | { |
981 | - // phpcs:enable |
|
981 | + // phpcs:enable |
|
982 | 982 | $sql = "SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; |
983 | 983 | $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm_resources"; |
984 | 984 | $sql .= " WHERE element_type = 'user' AND fk_actioncomm = " . ((int) $this->id); |
@@ -996,9 +996,9 @@ discard block |
||
996 | 996 | while ($obj = $this->db->fetch_object($resql2)) { |
997 | 997 | if ($obj->fk_element > 0) { |
998 | 998 | $this->userassigned[$obj->fk_element] = array('id' => $obj->fk_element, |
999 | - 'mandatory' => $obj->mandatory, |
|
1000 | - 'answer_status' => $obj->answer_status, |
|
1001 | - 'transparency' => $obj->transparency); |
|
999 | + 'mandatory' => $obj->mandatory, |
|
1000 | + 'answer_status' => $obj->answer_status, |
|
1001 | + 'transparency' => $obj->transparency); |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | if ($override === true) { |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | } |
1390 | 1390 | } |
1391 | 1391 | |
1392 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1392 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1393 | 1393 | /** |
1394 | 1394 | * Load indicators for dashboard (this->nbtodo and this->nbtodolate) |
1395 | 1395 | * |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | */ |
1400 | 1400 | public function load_board($user, $load_state_board = 0) |
1401 | 1401 | { |
1402 | - // phpcs:enable |
|
1402 | + // phpcs:enable |
|
1403 | 1403 | global $conf, $langs; |
1404 | 1404 | |
1405 | 1405 | if (empty($load_state_board)) { |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | return $this->LibStatut($this->percentage, $mode, $hidenastatus, $this->datep); |
1527 | 1527 | } |
1528 | 1528 | |
1529 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1529 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1530 | 1530 | /** |
1531 | 1531 | * Return label of action status |
1532 | 1532 | * |
@@ -1538,7 +1538,7 @@ discard block |
||
1538 | 1538 | */ |
1539 | 1539 | public function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '') |
1540 | 1540 | { |
1541 | - // phpcs:enable |
|
1541 | + // phpcs:enable |
|
1542 | 1542 | global $langs; |
1543 | 1543 | |
1544 | 1544 | $labelStatus = $langs->transnoentitiesnoconv('StatusNotApplicable'); |
@@ -1942,7 +1942,7 @@ discard block |
||
1942 | 1942 | return 1; |
1943 | 1943 | } |
1944 | 1944 | |
1945 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1945 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
1946 | 1946 | /** |
1947 | 1947 | * Export events from database into a cal file. |
1948 | 1948 | * |
@@ -1958,7 +1958,7 @@ discard block |
||
1958 | 1958 | { |
1959 | 1959 | global $hookmanager; |
1960 | 1960 | |
1961 | - // phpcs:enable |
|
1961 | + // phpcs:enable |
|
1962 | 1962 | global $conf, $langs, $dolibarr_main_url_root, $mysoc; |
1963 | 1963 | |
1964 | 1964 | require_once DOL_DOCUMENT_ROOT . "/core/lib/xcal.lib.php"; |
@@ -572,8 +572,8 @@ discard block |
||
572 | 572 | $sql .= "ip"; |
573 | 573 | $sql .= ") VALUES ("; |
574 | 574 | $sql .= "'(PROV)', "; |
575 | - $sql .= "'" . $this->db->idate($now) . "', "; // date creation |
|
576 | - $sql .= "'" . $this->db->idate($this->datep) . "', "; // date start event |
|
575 | + $sql .= "'" . $this->db->idate($now) . "', "; // date creation |
|
576 | + $sql .= "'" . $this->db->idate($this->datep) . "', "; // date start event |
|
577 | 577 | $sql .= (strval($this->datef) != '' ? "'" . $this->db->idate($this->datef) . "'" : "null") . ", "; |
578 | 578 | $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'" . $this->db->escape($this->durationp) . "'" : "null") . ", "; // deprecated |
579 | 579 | $sql .= (isset($this->type_id) ? $this->type_id : "null") . ","; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm as a"; |
1342 | 1342 | // Fields from hook |
1343 | 1343 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
1344 | - $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
1344 | + $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook |
|
1345 | 1345 | if (!empty($hookmanager->resPrint)) { |
1346 | 1346 | $sql .= $hookmanager->resPrint; |
1347 | 1347 | } |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | } |
1366 | 1366 | // Fields where hook |
1367 | 1367 | $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype); |
1368 | - $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
1368 | + $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook |
|
1369 | 1369 | if (!empty($hookmanager->resPrint)) { |
1370 | 1370 | $sql .= $hookmanager->resPrint; |
1371 | 1371 | } |
@@ -1442,7 +1442,7 @@ discard block |
||
1442 | 1442 | |
1443 | 1443 | $resql = $this->db->query($sql); |
1444 | 1444 | if ($resql) { |
1445 | - $response = null; // Ensure the variable is defined |
|
1445 | + $response = null; // Ensure the variable is defined |
|
1446 | 1446 | if (empty($load_state_board)) { |
1447 | 1447 | $agenda_static = new ActionComm($this->db); |
1448 | 1448 | $response = new WorkboardResponse(); |
@@ -1745,8 +1745,8 @@ discard block |
||
1745 | 1745 | } |
1746 | 1746 | if (!empty($this->note_private)) { |
1747 | 1747 | $tooltip .= '<br><br><b>' . $langs->trans('Description') . ':</b><br>'; |
1748 | - $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
1749 | - $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
1748 | + $texttoshow = dolGetFirstLineOfText($this->note_private, 8); // Try to limit length of content |
|
1749 | + $tooltip .= '<div class="tenlinesmax">'; // Restrict height of content into the tooltip |
|
1750 | 1750 | $tooltip .= (dol_textishtml($texttoshow) ? str_replace(array("\r", "\n"), "", $texttoshow) : str_replace(array("\r", "\n"), '<br>', $texttoshow)); |
1751 | 1751 | $tooltip .= '</div>'; |
1752 | 1752 | } |
@@ -2629,7 +2629,7 @@ discard block |
||
2629 | 2629 | //Select all action comm reminders |
2630 | 2630 | $sql = "SELECT rowid as id FROM " . MAIN_DB_PREFIX . "actioncomm_reminder"; |
2631 | 2631 | $sql .= " WHERE typeremind = 'email'"; |
2632 | - $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
2632 | + $sql .= " AND status = 0"; // 0=No yet sent, -1=Error. TODO Include reminder in error once we can count number of error, so we can try 5 times and not more on errors. |
|
2633 | 2633 | $sql .= " AND dateremind <= '" . $this->db->idate($now) . "'"; |
2634 | 2634 | $sql .= " AND entity IN (" . getEntity('actioncomm') . ")"; |
2635 | 2635 | $sql .= $this->db->order("dateremind", "ASC"); |
@@ -2637,7 +2637,7 @@ discard block |
||
2637 | 2637 | |
2638 | 2638 | if ($resql) { |
2639 | 2639 | $formmail = new FormMail($this->db); |
2640 | - $to = null; // Ensure 'to' is defined for static analysis |
|
2640 | + $to = null; // Ensure 'to' is defined for static analysis |
|
2641 | 2641 | |
2642 | 2642 | while ($obj = $this->db->fetch_object($resql)) { |
2643 | 2643 | $res = $actionCommReminder->fetch($obj->id); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | } |
622 | 622 | } |
623 | 623 | |
624 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
624 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
625 | 625 | /** |
626 | 626 | * Delete targets emailing |
627 | 627 | * |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | */ |
630 | 630 | public function delete_targets() |
631 | 631 | { |
632 | - // phpcs:enable |
|
632 | + // phpcs:enable |
|
633 | 633 | $sql = "DELETE FROM " . MAIN_DB_PREFIX . "mailing_cibles"; |
634 | 634 | $sql .= " WHERE fk_mailing = " . ((int) $this->id); |
635 | 635 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | } |
647 | 647 | |
648 | 648 | |
649 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
649 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
650 | 650 | /** |
651 | 651 | * Change status of each recipient |
652 | 652 | * |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | */ |
656 | 656 | public function reset_targets_status($user) |
657 | 657 | { |
658 | - // phpcs:enable |
|
658 | + // phpcs:enable |
|
659 | 659 | $sql = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles"; |
660 | 660 | $sql .= " SET statut = 0"; |
661 | 661 | $sql .= " WHERE fk_mailing = " . ((int) $this->id); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | return $this->LibStatut($this->status, $mode); |
871 | 871 | } |
872 | 872 | |
873 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
873 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps |
|
874 | 874 | /** |
875 | 875 | * Return the label of a given status |
876 | 876 | * |
@@ -880,7 +880,7 @@ discard block |
||
880 | 880 | */ |
881 | 881 | public function LibStatut($status, $mode = 0) |
882 | 882 | { |
883 | - // phpcs:enable |
|
883 | + // phpcs:enable |
|
884 | 884 | global $langs; |
885 | 885 | $langs->load("mailing"); |
886 | 886 |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->title = $obj->title; |
385 | 385 | $this->messtype = $obj->messtype; |
386 | 386 | |
387 | - $this->statut = $obj->status; // deprecated |
|
387 | + $this->statut = $obj->status; // deprecated |
|
388 | 388 | $this->status = $obj->status; |
389 | 389 | |
390 | 390 | $this->nbemail = $obj->nbemail; |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | $sql .= ' WHERE rowid = ' . ((int) $this->id); |
728 | 728 | |
729 | 729 | $resqlupdate = $this->db->query($sql); |
730 | - if (! $resqlupdate) { |
|
730 | + if (!$resqlupdate) { |
|
731 | 731 | $this->error = $this->db->lasterror(); |
732 | 732 | return -1; |
733 | 733 | } else { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | return $event; |
340 | 340 | } |
341 | 341 | |
342 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
342 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
343 | 343 | /** |
344 | 344 | * Clean sensible object datas |
345 | 345 | * |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | protected function _cleanObjectDatas($object) |
350 | 350 | { |
351 | - // phpcs:enable |
|
351 | + // phpcs:enable |
|
352 | 352 | $object = parent::_cleanObjectDatas($object); |
353 | 353 | |
354 | 354 | unset($object->note); // alreaydy into note_private |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | |
667 | - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
667 | + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore |
|
668 | 668 | /** |
669 | 669 | * Clean sensible object datas |
670 | 670 | * |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | */ |
674 | 674 | protected function _cleanObjectDatas($object) |
675 | 675 | { |
676 | - // phpcs:enable |
|
676 | + // phpcs:enable |
|
677 | 677 | $object = parent::_cleanObjectDatas($object); |
678 | 678 | |
679 | 679 | // Remove fields not relevant to categories |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $error = 0; |
88 | 88 | $this->db->begin(); |
89 | 89 | |
90 | - if (! $error) { |
|
91 | - if (! $notrigger) { |
|
90 | + if (!$error) { |
|
91 | + if (!$notrigger) { |
|
92 | 92 | // Call triggers |
93 | 93 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
94 | 94 | if ($result < 0) { |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | - if (! $error) { |
|
101 | + if (!$error) { |
|
102 | 102 | $result = $this->deleteExtraFields(); |
103 | 103 | if ($result < 0) { |
104 | 104 | $error++; |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - if (! $error) { |
|
108 | + if (!$error) { |
|
109 | 109 | $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
110 | 110 | |
111 | 111 | $res = $this->db->query($sql); |