@@ -349,8 +349,9 @@ discard block |
||
349 | 349 | |
350 | 350 | $rang = $i; |
351 | 351 | //there may already be rows from previous receptions |
352 | - if (!empty($createbills_onebythird)) |
|
353 | - $rang = $TFactThirdNbLines[$rcp->socid]; |
|
352 | + if (!empty($createbills_onebythird)) { |
|
353 | + $rang = $TFactThirdNbLines[$rcp->socid]; |
|
354 | + } |
|
354 | 355 | |
355 | 356 | $result = $objecttmp->addline( |
356 | 357 | $desc, |
@@ -380,8 +381,10 @@ discard block |
||
380 | 381 | |
381 | 382 | if ($result > 0) { |
382 | 383 | $lineid = $result; |
383 | - if (!empty($createbills_onebythird)) //increment rang to keep order |
|
384 | + if (!empty($createbills_onebythird)) { |
|
385 | + //increment rang to keep order |
|
384 | 386 | $TFactThirdNbLines[$rcp->socid]++; |
387 | + } |
|
385 | 388 | } else { |
386 | 389 | $lineid = 0; |
387 | 390 | $error++; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int'); |
60 | 60 | $search_date_delivery_endmonth = GETPOST('search_date_delivery_endmonth', 'int'); |
61 | 61 | $search_date_delivery_endyear = GETPOST('search_date_delivery_endyear', 'int'); |
62 | -$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver |
|
62 | +$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver |
|
63 | 63 | $search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear); |
64 | 64 | $search_date_create_startday = GETPOST('search_date_create_startday', 'int'); |
65 | 65 | $search_date_create_startmonth = GETPOST('search_date_create_startmonth', 'int'); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $search_date_create_endday = GETPOST('search_date_create_endday', 'int'); |
68 | 68 | $search_date_create_endmonth = GETPOST('search_date_create_endmonth', 'int'); |
69 | 69 | $search_date_create_endyear = GETPOST('search_date_create_endyear', 'int'); |
70 | -$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver |
|
70 | +$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver |
|
71 | 71 | $search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear); |
72 | 72 | $search_billed = GETPOST("search_billed", 'int'); |
73 | 73 | $sall = GETPOST('sall', 'alphanohtml'); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $TFactThirdNbLines = array(); |
222 | 222 | |
223 | 223 | $nb_bills_created = 0; |
224 | - $lastid= 0; |
|
224 | + $lastid = 0; |
|
225 | 225 | $lastref = ''; |
226 | 226 | |
227 | 227 | $db->begin(); |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | // if the VAT reverse-charge is activated by default in supplier card to resume the information |
350 | 350 | $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge; |
351 | 351 | |
352 | - $objecttmp->fk_project = $rcp->fk_project; |
|
352 | + $objecttmp->fk_project = $rcp->fk_project; |
|
353 | 353 | //$objecttmp->multicurrency_code = $rcp->multicurrency_code; |
354 | 354 | if (empty($createbills_onebythird)) { |
355 | 355 | $objecttmp->ref_supplier = $rcp->ref; |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | } |
383 | 383 | } |
384 | 384 | |
385 | - $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id |
|
385 | + $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id |
|
386 | 386 | |
387 | 387 | //var_dump($objecttmp->error);exit; |
388 | 388 | if ($res > 0) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | $id = $objecttmp->id; // For builddoc action |
557 | 557 | $lastref = $objecttmp->ref; // generated ref |
558 | - $object =$objecttmp; |
|
558 | + $object = $objecttmp; |
|
559 | 559 | |
560 | 560 | // Fac builddoc |
561 | 561 | $donotredirect = 1; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '<div class="fichecenter">'; |
68 | 68 | print '<div class="fichehalfleft">'; |
69 | 69 | print '<div class="underbanner clearboth"></div>'; |
70 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
70 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
71 | 71 | $mode_info['fields'] = dol_sort_array($mode_info['fields'], 'position'); |
72 | 72 | foreach ($mode_info['fields'] as $field_key => $field_info) { |
73 | 73 | if (!empty($field_info['enabled_field'])) { |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | print '<table class="border centpercent tableforfield">'; |
95 | 95 | } |
96 | 96 | |
97 | - $key = $mode_key . '_' . $field_key; |
|
97 | + $key = $mode_key.'_'.$field_key; |
|
98 | 98 | $value = $assetdepreciationoptions->deprecation_options[$mode_key][$field_key]; |
99 | 99 | |
100 | - print '<tr class="field_' . $key . '"><td'; |
|
101 | - print ' class="' . (empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']) . ' fieldname_' . $key; |
|
100 | + print '<tr class="field_'.$key.'"><td'; |
|
101 | + print ' class="'.(empty($field_info['tdcss']) ? 'titlefield' : $field_info['tdcss']).' fieldname_'.$key; |
|
102 | 102 | if ($field_info['type'] == 'text' || $field_info['type'] == 'html') { |
103 | 103 | print ' tdtop'; |
104 | 104 | } |
@@ -113,12 +113,12 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | print '</td>'; |
116 | - print '<td class="valuefield fieldname_' . $key; |
|
116 | + print '<td class="valuefield fieldname_'.$key; |
|
117 | 117 | if ($field_info['type'] == 'text') { |
118 | 118 | print ' wordbreak'; |
119 | 119 | } |
120 | 120 | if (!empty($field_info['cssview'])) { |
121 | - print ' ' . $field_info['cssview']; |
|
121 | + print ' '.$field_info['cssview']; |
|
122 | 122 | } |
123 | 123 | print '">'; |
124 | 124 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | } |
127 | 127 | if ($field_key == 'lang') { |
128 | 128 | $langs->load("languages"); |
129 | - $labellang = ($value ? $langs->trans('Language_' . $value) : ''); |
|
129 | + $labellang = ($value ? $langs->trans('Language_'.$value) : ''); |
|
130 | 130 | print picto_from_langcode($value, 'class="paddingrightonly saturatemedium opacitylow"'); |
131 | 131 | print $labellang; |
132 | 132 | } else { |
133 | 133 | if (isset($field_info['copytoclipboard']) && $field_info['copytoclipboard'] == 2) { |
134 | - $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
134 | + $out = $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
135 | 135 | print showValueWithClipboardCPButton($out, 0, $out); |
136 | 136 | } else { |
137 | - print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key . '_', 0); |
|
137 | + print $assetdepreciationoptions->showOutputField($field_info, $field_key, $value, '', '', $mode_key.'_', 0); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | if (in_array($field_info['type'], array('text', 'html'))) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $amount = $credit; |
107 | 107 | } |
108 | 108 | |
109 | - return "'" . $this->db->escape(abs($amount)) . "'"; |
|
109 | + return "'".$this->db->escape(abs($amount))."'"; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return "''"; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $sens = 'C'; |
135 | 135 | } |
136 | 136 | |
137 | - return "'" . $this->db->escape($sens) . "'"; |
|
137 | + return "'".$this->db->escape($sens)."'"; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | return "''"; |
@@ -479,7 +479,9 @@ |
||
479 | 479 | $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; |
480 | 480 | $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
481 | 481 | $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
482 | - if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
482 | + if ($this->fk_soc > 0) { |
|
483 | + $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
484 | + } |
|
483 | 485 | $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
484 | 486 | $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
485 | 487 | $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
@@ -334,32 +334,32 @@ discard block |
||
334 | 334 | $sql .= ", '".$this->db->idate($now)."'"; |
335 | 335 | $sql .= ", ".((int) $this->suspended); |
336 | 336 | $sql .= ", '".$this->db->escape($this->libelle)."'"; |
337 | - $sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
338 | - $sql .= ", " .((int) $user->id); |
|
339 | - $sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
340 | - $sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
341 | - $sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
342 | - $sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
343 | - $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
344 | - $sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
345 | - $sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
346 | - $sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
347 | - $sql .= ", " . (int) $facfourn_src->fk_multicurrency; |
|
337 | + $sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount |
|
338 | + $sql .= ", ".((int) $user->id); |
|
339 | + $sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL'); |
|
340 | + $sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL'); |
|
341 | + $sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL'); |
|
342 | + $sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL'); |
|
343 | + $sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement |
|
344 | + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL'); |
|
345 | + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL'); |
|
346 | + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL'); |
|
347 | + $sql .= ", ".(int) $facfourn_src->fk_multicurrency; |
|
348 | 348 | $sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'"; |
349 | - $sql .= ", " . (float) $facfourn_src->multicurrency_tx; |
|
350 | - $sql .= ", " . (int) $this->usenewprice; |
|
351 | - $sql .= ", " . (int) $this->frequency; |
|
349 | + $sql .= ", ".(float) $facfourn_src->multicurrency_tx; |
|
350 | + $sql .= ", ".(int) $this->usenewprice; |
|
351 | + $sql .= ", ".(int) $this->frequency; |
|
352 | 352 | $sql .= ", '".$this->db->escape($this->unit_frequency)."'"; |
353 | - $sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
354 | - $sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
355 | - $sql .= ", " . (int) $this->nb_gen_done; |
|
356 | - $sql .= ", " . (int) $this->nb_gen_max; |
|
357 | - $sql .= ", " . (int) $this->auto_validate; |
|
358 | - $sql .= ", " . (int) $this->generate_pdf; |
|
353 | + $sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL'); |
|
354 | + $sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL'); |
|
355 | + $sql .= ", ".(int) $this->nb_gen_done; |
|
356 | + $sql .= ", ".(int) $this->nb_gen_max; |
|
357 | + $sql .= ", ".(int) $this->auto_validate; |
|
358 | + $sql .= ", ".(int) $this->generate_pdf; |
|
359 | 359 | $sql .= ')'; |
360 | 360 | |
361 | 361 | if ($this->db->query($sql)) { |
362 | - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec'); |
|
362 | + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec'); |
|
363 | 363 | |
364 | 364 | // Fields used into addline later |
365 | 365 | $this->fk_multicurrency = $facfourn_src->fk_multicurrency; |
@@ -496,42 +496,42 @@ discard block |
||
496 | 496 | $error = 0; |
497 | 497 | |
498 | 498 | $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET"; |
499 | - $sql .= " titre = '" . (!empty($this->titre) ? $this->db->escape($this->titre) : "")."'," ; |
|
500 | - $sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
501 | - $sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ','; |
|
502 | - if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ','; |
|
503 | - $sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ','; |
|
504 | - $sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ","; |
|
505 | - $sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ','; |
|
506 | - $sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ','; |
|
507 | - $sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ','; |
|
508 | - $sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ','; |
|
509 | - $sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ','; |
|
510 | - $sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ','; |
|
511 | - $sql .= " fk_user_modif = ". ((int) $user->id) . ','; |
|
512 | - $sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ','; |
|
513 | - $sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ','; |
|
514 | - $sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ','; |
|
515 | - $sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ','; |
|
516 | - $sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ','; |
|
517 | - $sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',"; |
|
518 | - $sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',"; |
|
519 | - $sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ","; |
|
520 | - $sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ','; |
|
521 | - $sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ","; |
|
522 | - $sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ','; |
|
523 | - $sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ','; |
|
524 | - $sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ','; |
|
525 | - $sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ','; |
|
526 | - $sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ','; |
|
527 | - $sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ','; |
|
528 | - $sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',"; |
|
529 | - $sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ','; |
|
530 | - $sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ','; |
|
531 | - $sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ','; |
|
532 | - $sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ','; |
|
533 | - $sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
534 | - $sql .= " WHERE rowid = ". (int) $this->id; |
|
499 | + $sql .= " titre = '".(!empty($this->titre) ? $this->db->escape($this->titre) : "")."',"; |
|
500 | + $sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',"; |
|
501 | + $sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).','; |
|
502 | + if ($this->fk_soc > 0) $sql .= " fk_soc = ".(int) $this->fk_soc.','; |
|
503 | + $sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).','; |
|
504 | + $sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').","; |
|
505 | + $sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').','; |
|
506 | + $sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).','; |
|
507 | + $sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).','; |
|
508 | + $sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).','; |
|
509 | + $sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).','; |
|
510 | + $sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).','; |
|
511 | + $sql .= " fk_user_modif = ".((int) $user->id).','; |
|
512 | + $sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').','; |
|
513 | + $sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').','; |
|
514 | + $sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').','; |
|
515 | + $sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').','; |
|
516 | + $sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').','; |
|
517 | + $sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',"; |
|
518 | + $sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',"; |
|
519 | + $sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').","; |
|
520 | + $sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').','; |
|
521 | + $sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').","; |
|
522 | + $sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).','; |
|
523 | + $sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).','; |
|
524 | + $sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).','; |
|
525 | + $sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).','; |
|
526 | + $sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).','; |
|
527 | + $sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).','; |
|
528 | + $sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',"; |
|
529 | + $sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').','; |
|
530 | + $sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').','; |
|
531 | + $sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).','; |
|
532 | + $sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).','; |
|
533 | + $sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0); |
|
534 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
535 | 535 | |
536 | 536 | dol_syslog(get_class($this)."::update", LOG_DEBUG); |
537 | 537 | $resql = $this->db->query($sql); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; |
591 | 591 | $sql .= ' WHERE f.entity IN ('.getEntity('invoice').')'; |
592 | 592 | if ($rowid) { |
593 | - $sql .= ' AND f.rowid='. (int) $rowid; |
|
593 | + $sql .= ' AND f.rowid='.(int) $rowid; |
|
594 | 594 | } elseif ($ref) { |
595 | 595 | $sql .= " AND f.titre='".$this->db->escape($ref)."'"; |
596 | 596 | } else { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
723 | 723 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
724 | 724 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
725 | - $sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id; |
|
725 | + $sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id; |
|
726 | 726 | $sql .= ' ORDER BY l.rang'; |
727 | 727 | |
728 | 728 | dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $line->product_type = $objp->product_type; |
763 | 763 | $line->date_start = $objp->date_start; |
764 | 764 | $line->date_end = $objp->date_end; |
765 | - $line->info_bits = $objp->info_bits ; |
|
765 | + $line->info_bits = $objp->info_bits; |
|
766 | 766 | $line->special_code = $objp->special_code; |
767 | 767 | $line->rang = $objp->rang; |
768 | 768 | $line->fk_unit = $objp->fk_unit; |
@@ -812,11 +812,11 @@ discard block |
||
812 | 812 | $main = MAIN_DB_PREFIX.'facture_fourn_det_rec'; |
813 | 813 | $ef = $main."_extrafields"; |
814 | 814 | |
815 | - $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")"; |
|
816 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid; |
|
815 | + $sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")"; |
|
816 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid; |
|
817 | 817 | |
818 | 818 | if ($this->db->query($sqlef) && $this->db->query($sql)) { |
819 | - $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid; |
|
819 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid; |
|
820 | 820 | dol_syslog($sql); |
821 | 821 | if ($this->db->query($sql)) { |
822 | 822 | // Delete linked object |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | } |
846 | 846 | // End call triggers |
847 | 847 | } |
848 | - if (! $error) { |
|
848 | + if (!$error) { |
|
849 | 849 | $this->db->commit(); |
850 | 850 | return 1; |
851 | 851 | } else { |
@@ -957,7 +957,7 @@ discard block |
||
957 | 957 | } |
958 | 958 | } |
959 | 959 | |
960 | - $sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec ('; |
|
960 | + $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec ('; |
|
961 | 961 | $sql .= 'fk_facture_fourn'; |
962 | 962 | $sql .= ', fk_product'; |
963 | 963 | $sql .= ', ref'; |
@@ -989,46 +989,46 @@ discard block |
||
989 | 989 | $sql .= ', fk_user_author'; |
990 | 990 | $sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; |
991 | 991 | $sql .= ') VALUES ('; |
992 | - $sql .= ' ' . (int) $facid; // source supplier invoie id |
|
993 | - $sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null'); |
|
994 | - $sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null'); |
|
995 | - $sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null'); |
|
996 | - $sql .= ", '" . $this->db->escape($desc) . "'"; |
|
997 | - $sql .= ', ' . price2num($pu_ht); |
|
998 | - $sql .= ', ' . price2num($pu_ttc); |
|
999 | - $sql .= ', ' . price2num($qty); |
|
1000 | - $sql .= ', ' . price2num($remise_percent); |
|
992 | + $sql .= ' '.(int) $facid; // source supplier invoie id |
|
993 | + $sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null'); |
|
994 | + $sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null'); |
|
995 | + $sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null'); |
|
996 | + $sql .= ", '".$this->db->escape($desc)."'"; |
|
997 | + $sql .= ', '.price2num($pu_ht); |
|
998 | + $sql .= ', '.price2num($pu_ttc); |
|
999 | + $sql .= ', '.price2num($qty); |
|
1000 | + $sql .= ', '.price2num($remise_percent); |
|
1001 | 1001 | $sql .= ', null'; |
1002 | - $sql .= ", '" . $this->db->escape($vat_src_code) . "'"; |
|
1003 | - $sql .= ', ' . price2num($txtva); |
|
1004 | - $sql .= ', ' . price2num($txlocaltax1); |
|
1005 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'"; |
|
1006 | - $sql .= ', ' . price2num($txlocaltax2); |
|
1007 | - $sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'"; |
|
1008 | - $sql .= ', ' . price2num($total_ht); |
|
1009 | - $sql .= ', ' . price2num($total_tva); |
|
1010 | - $sql .= ', ' . price2num($total_localtax1); |
|
1011 | - $sql .= ', ' . price2num($total_localtax2); |
|
1012 | - $sql .= ', ' . price2num($total_ttc); |
|
1013 | - $sql .= ', ' . (int) $product_type; |
|
1014 | - $sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1015 | - $sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1016 | - $sql .= ', ' . (int) $info_bits; |
|
1017 | - $sql .= ', ' . (int) $special_code; |
|
1018 | - $sql .= ', ' . (int) $rang; |
|
1019 | - $sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1020 | - $sql .= ', ' . (int) $user; |
|
1021 | - $sql .= ', ' . (int) $this->fk_multicurrency; |
|
1022 | - $sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'"; |
|
1023 | - $sql .= ', ' . price2num($pu_ht_devise, 'CU'); |
|
1024 | - $sql .= ', ' . price2num($multicurrency_total_ht, 'CT'); |
|
1025 | - $sql .= ', ' . price2num($multicurrency_total_tva, 'CT'); |
|
1026 | - $sql .= ', ' . price2num($multicurrency_total_ttc, 'CT'); |
|
1002 | + $sql .= ", '".$this->db->escape($vat_src_code)."'"; |
|
1003 | + $sql .= ', '.price2num($txtva); |
|
1004 | + $sql .= ', '.price2num($txlocaltax1); |
|
1005 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'"; |
|
1006 | + $sql .= ', '.price2num($txlocaltax2); |
|
1007 | + $sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'"; |
|
1008 | + $sql .= ', '.price2num($total_ht); |
|
1009 | + $sql .= ', '.price2num($total_tva); |
|
1010 | + $sql .= ', '.price2num($total_localtax1); |
|
1011 | + $sql .= ', '.price2num($total_localtax2); |
|
1012 | + $sql .= ', '.price2num($total_ttc); |
|
1013 | + $sql .= ', '.(int) $product_type; |
|
1014 | + $sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL'); |
|
1015 | + $sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL'); |
|
1016 | + $sql .= ', '.(int) $info_bits; |
|
1017 | + $sql .= ', '.(int) $special_code; |
|
1018 | + $sql .= ', '.(int) $rang; |
|
1019 | + $sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL'); |
|
1020 | + $sql .= ', '.(int) $user; |
|
1021 | + $sql .= ', '.(int) $this->fk_multicurrency; |
|
1022 | + $sql .= ", '".$this->db->escape($this->multicurrency_code)."'"; |
|
1023 | + $sql .= ', '.price2num($pu_ht_devise, 'CU'); |
|
1024 | + $sql .= ', '.price2num($multicurrency_total_ht, 'CT'); |
|
1025 | + $sql .= ', '.price2num($multicurrency_total_tva, 'CT'); |
|
1026 | + $sql .= ', '.price2num($multicurrency_total_ttc, 'CT'); |
|
1027 | 1027 | $sql .= ')'; |
1028 | 1028 | |
1029 | - dol_syslog(get_class($this). '::addline', LOG_DEBUG); |
|
1029 | + dol_syslog(get_class($this).'::addline', LOG_DEBUG); |
|
1030 | 1030 | if ($this->db->query($sql)) { |
1031 | - $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec'); |
|
1031 | + $lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec'); |
|
1032 | 1032 | $this->update_price(); |
1033 | 1033 | $this->id = $facid; |
1034 | 1034 | $this->db->commit(); |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | |
1080 | 1080 | $facid = $this->id; |
1081 | 1081 | |
1082 | - dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
1082 | + dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG); |
|
1083 | 1083 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
1084 | 1084 | |
1085 | 1085 | // Check parameters |
@@ -1150,41 +1150,41 @@ discard block |
||
1150 | 1150 | $product_type = $product->type; |
1151 | 1151 | } |
1152 | 1152 | |
1153 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
1154 | - $sql .= ' fk_facture_fourn = ' . ((int) $facid); |
|
1155 | - $sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1156 | - $sql .= ", ref = '" . $this->db->escape($ref) . "'"; |
|
1157 | - $sql .= ", label = '" . $this->db->escape($label) . "'"; |
|
1158 | - $sql .= ", description = '" . $this->db->escape($desc) . "'"; |
|
1159 | - $sql .= ', pu_ht = ' . price2num($pu_ht); |
|
1160 | - $sql .= ', qty = ' . price2num($qty); |
|
1161 | - $sql .= ", remise_percent = '" . price2num($remise_percent) . "'"; |
|
1162 | - $sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'"; |
|
1163 | - $sql .= ', tva_tx = ' . price2num($txtva); |
|
1164 | - $sql .= ', localtax1_tx = ' . (float) $txlocaltax1; |
|
1165 | - $sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'"; |
|
1166 | - $sql .= ', localtax2_tx = ' . (float) $txlocaltax2; |
|
1167 | - $sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'"; |
|
1168 | - $sql .= ", total_ht = '" . price2num($total_ht) . "'"; |
|
1169 | - $sql .= ", total_tva = '" . price2num($total_tva) . "'"; |
|
1170 | - $sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'"; |
|
1171 | - $sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'"; |
|
1172 | - $sql .= ", total_ttc = '" . price2num($total_ttc) . "'"; |
|
1173 | - $sql .= ', product_type = ' . (int) $product_type; |
|
1174 | - $sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start); |
|
1175 | - $sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end); |
|
1176 | - $sql .= ', info_bits = ' . (int) $info_bits; |
|
1177 | - $sql .= ', special_code = ' . (int) $special_code; |
|
1178 | - $sql .= ', rang = ' . (int) $rang; |
|
1179 | - $sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null'); |
|
1180 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
1153 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
1154 | + $sql .= ' fk_facture_fourn = '.((int) $facid); |
|
1155 | + $sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null'); |
|
1156 | + $sql .= ", ref = '".$this->db->escape($ref)."'"; |
|
1157 | + $sql .= ", label = '".$this->db->escape($label)."'"; |
|
1158 | + $sql .= ", description = '".$this->db->escape($desc)."'"; |
|
1159 | + $sql .= ', pu_ht = '.price2num($pu_ht); |
|
1160 | + $sql .= ', qty = '.price2num($qty); |
|
1161 | + $sql .= ", remise_percent = '".price2num($remise_percent)."'"; |
|
1162 | + $sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'"; |
|
1163 | + $sql .= ', tva_tx = '.price2num($txtva); |
|
1164 | + $sql .= ', localtax1_tx = '.(float) $txlocaltax1; |
|
1165 | + $sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'"; |
|
1166 | + $sql .= ', localtax2_tx = '.(float) $txlocaltax2; |
|
1167 | + $sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'"; |
|
1168 | + $sql .= ", total_ht = '".price2num($total_ht)."'"; |
|
1169 | + $sql .= ", total_tva = '".price2num($total_tva)."'"; |
|
1170 | + $sql .= ", total_localtax1 = '".price2num($total_localtax1)."'"; |
|
1171 | + $sql .= ", total_localtax2 = '".price2num($total_localtax2)."'"; |
|
1172 | + $sql .= ", total_ttc = '".price2num($total_ttc)."'"; |
|
1173 | + $sql .= ', product_type = '.(int) $product_type; |
|
1174 | + $sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start); |
|
1175 | + $sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end); |
|
1176 | + $sql .= ', info_bits = '.(int) $info_bits; |
|
1177 | + $sql .= ', special_code = '.(int) $special_code; |
|
1178 | + $sql .= ', rang = '.(int) $rang; |
|
1179 | + $sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null'); |
|
1180 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
1181 | 1181 | $sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise); |
1182 | 1182 | $sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht); |
1183 | 1183 | $sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva); |
1184 | 1184 | $sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc); |
1185 | - $sql .= ' WHERE rowid = ' . (int) $rowid; |
|
1185 | + $sql .= ' WHERE rowid = '.(int) $rowid; |
|
1186 | 1186 | |
1187 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
1187 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
1188 | 1188 | if ($this->db->query($sql)) { |
1189 | 1189 | $this->id = $facid; |
1190 | 1190 | $this->update_price(); |
@@ -1273,16 +1273,16 @@ discard block |
||
1273 | 1273 | $tmparray = dol_getdate($now); |
1274 | 1274 | $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day |
1275 | 1275 | |
1276 | - dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation); |
|
1276 | + dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation); |
|
1277 | 1277 | |
1278 | 1278 | $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec'; |
1279 | 1279 | $sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency |
1280 | 1280 | $sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')"; |
1281 | 1281 | $sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)'; |
1282 | 1282 | $sql .= ' AND suspended = 0'; |
1283 | - $sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here |
|
1283 | + $sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here |
|
1284 | 1284 | if ($restrictioninvoiceid > 0) { |
1285 | - $sql .= ' AND rowid = '. (int) $restrictioninvoiceid; |
|
1285 | + $sql .= ' AND rowid = '.(int) $restrictioninvoiceid; |
|
1286 | 1286 | } |
1287 | 1287 | $sql .= $this->db->order('entity', 'ASC'); |
1288 | 1288 | //print $sql;exit; |
@@ -1320,14 +1320,14 @@ discard block |
||
1320 | 1320 | // Set entity context |
1321 | 1321 | $conf->entity = $facturerec->entity; |
1322 | 1322 | |
1323 | - dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity); |
|
1323 | + dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity); |
|
1324 | 1324 | |
1325 | 1325 | $new_fac_fourn = new FactureFournisseur($this->db); |
1326 | 1326 | $new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice |
1327 | 1327 | $new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice |
1328 | 1328 | |
1329 | 1329 | $new_fac_fourn->type = self::TYPE_STANDARD; |
1330 | - $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1330 | + $new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated |
|
1331 | 1331 | $new_fac_fourn->status = self::STATUS_DRAFT; |
1332 | 1332 | $new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later. |
1333 | 1333 | $new_fac_fourn->socid = $facturerec->socid; |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | $new_fac_fourn->model_pdf = $facturerec->model_pdf; |
1337 | 1337 | $new_fac_fourn->fk_project = $facturerec->fk_project; |
1338 | 1338 | $new_fac_fourn->label = $facturerec->label; |
1339 | - $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1339 | + $new_fac_fourn->libelle = $facturerec->label; // deprecated |
|
1340 | 1340 | |
1341 | 1341 | $invoiceidgenerated = $new_fac_fourn->create($user); |
1342 | 1342 | if ($invoiceidgenerated <= 0) { |
@@ -1365,22 +1365,22 @@ discard block |
||
1365 | 1365 | } |
1366 | 1366 | } else { |
1367 | 1367 | $error++; |
1368 | - $this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n"; |
|
1369 | - $this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity; |
|
1370 | - dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity); |
|
1368 | + $this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n"; |
|
1369 | + $this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity; |
|
1370 | + dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity); |
|
1371 | 1371 | } |
1372 | 1372 | |
1373 | 1373 | if (!$error && $invoiceidgenerated >= 0) { |
1374 | 1374 | $facturerec->nb_gen_done++; |
1375 | 1375 | $facturerec->date_last_gen = dol_now(); |
1376 | - $facturerec->date_when= $facturerec->getNextDate(); |
|
1376 | + $facturerec->date_when = $facturerec->getNextDate(); |
|
1377 | 1377 | $facturerec->update($user); |
1378 | - $this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1379 | - dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->titre. ' is finished with a success generation'); |
|
1378 | + $this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1379 | + dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->titre.' is finished with a success generation'); |
|
1380 | 1380 | $nb_create++; |
1381 | 1381 | $this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->titre)."\n"; |
1382 | 1382 | } else { |
1383 | - $this->db->rollback('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre); |
|
1383 | + $this->db->rollback('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre); |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | $parameters = array( |
@@ -1473,7 +1473,7 @@ discard block |
||
1473 | 1473 | } |
1474 | 1474 | $result .= $linkend; |
1475 | 1475 | global $action; |
1476 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
1476 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
1477 | 1477 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
1478 | 1478 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
1479 | 1479 | if ($reshook > 0) { |
@@ -1652,8 +1652,8 @@ discard block |
||
1652 | 1652 | $prodids = array(); |
1653 | 1653 | |
1654 | 1654 | $sql = 'SELECT rowid'; |
1655 | - $sql .= ' FROM ' .MAIN_DB_PREFIX. 'product'; |
|
1656 | - $sql .= ' WHERE entity IN (' .getEntity('product'). ')'; |
|
1655 | + $sql .= ' FROM '.MAIN_DB_PREFIX.'product'; |
|
1656 | + $sql .= ' WHERE entity IN ('.getEntity('product').')'; |
|
1657 | 1657 | $sql .= $this->db->plimit(100); |
1658 | 1658 | |
1659 | 1659 | $resql = $this->db->query($sql); |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | $xnbp = 0; |
1693 | 1693 | while ($xnbp < $nbp) { |
1694 | 1694 | $line = new FactureLigne($this->db); |
1695 | - $line->desc = $langs->trans('Description'). ' ' .$xnbp; |
|
1695 | + $line->desc = $langs->trans('Description').' '.$xnbp; |
|
1696 | 1696 | $line->qty = 1; |
1697 | 1697 | $line->subprice = 100; |
1698 | 1698 | $line->tva_tx = 19.6; |
@@ -1740,7 +1740,7 @@ discard block |
||
1740 | 1740 | |
1741 | 1741 | // Add a line "offered" |
1742 | 1742 | $line = new FactureLigne($this->db); |
1743 | - $line->desc = $langs->trans('Description'). ' (offered line)'; |
|
1743 | + $line->desc = $langs->trans('Description').' (offered line)'; |
|
1744 | 1744 | $line->qty = 1; |
1745 | 1745 | $line->subprice = 100; |
1746 | 1746 | $line->tva_tx = 19.6; |
@@ -1787,12 +1787,12 @@ discard block |
||
1787 | 1787 | public function setFrequencyAndUnit($frequency, $unit) |
1788 | 1788 | { |
1789 | 1789 | if (!$this->table_element) { |
1790 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1790 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR); |
|
1791 | 1791 | return -1; |
1792 | 1792 | } |
1793 | 1793 | |
1794 | 1794 | if (!empty($frequency) && empty($unit)) { |
1795 | - dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1795 | + dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR); |
|
1796 | 1796 | return -2; |
1797 | 1797 | } |
1798 | 1798 | |
@@ -1831,11 +1831,11 @@ discard block |
||
1831 | 1831 | return -1; |
1832 | 1832 | } |
1833 | 1833 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1834 | - $sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1834 | + $sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL"); |
|
1835 | 1835 | if ($increment_nb_gen_done > 0) { |
1836 | 1836 | $sql .= ", nb_gen_done = nb_gen_done + 1"; |
1837 | 1837 | } |
1838 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1838 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1839 | 1839 | |
1840 | 1840 | dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG); |
1841 | 1841 | |
@@ -1869,8 +1869,8 @@ discard block |
||
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1872 | - $sql .= " SET nb_gen_max = ". (int) $nb; |
|
1873 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1872 | + $sql .= " SET nb_gen_max = ".(int) $nb; |
|
1873 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1874 | 1874 | |
1875 | 1875 | dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG); |
1876 | 1876 | |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | |
1899 | 1899 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1900 | 1900 | $sql .= " SET auto_validate = ".((int) $validate); |
1901 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1901 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1902 | 1902 | |
1903 | 1903 | dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG); |
1904 | 1904 | |
@@ -1925,8 +1925,8 @@ discard block |
||
1925 | 1925 | } |
1926 | 1926 | |
1927 | 1927 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1928 | - $sql .= " SET generate_pdf = ". (int) $validate; |
|
1929 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1928 | + $sql .= " SET generate_pdf = ".(int) $validate; |
|
1929 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1930 | 1930 | |
1931 | 1931 | dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG); |
1932 | 1932 | |
@@ -1954,7 +1954,7 @@ discard block |
||
1954 | 1954 | |
1955 | 1955 | $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
1956 | 1956 | $sql .= " SET modelpdf = '".$this->db->escape($model)."'"; |
1957 | - $sql .= " WHERE rowid = " . (int) $this->id; |
|
1957 | + $sql .= " WHERE rowid = ".(int) $this->id; |
|
1958 | 1958 | |
1959 | 1959 | dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG); |
1960 | 1960 | |
@@ -2028,8 +2028,8 @@ discard block |
||
2028 | 2028 | $error = 0; |
2029 | 2029 | $this->db->begin(); |
2030 | 2030 | |
2031 | - if (! $error) { |
|
2032 | - if (! $notrigger) { |
|
2031 | + if (!$error) { |
|
2032 | + if (!$notrigger) { |
|
2033 | 2033 | // Call triggers |
2034 | 2034 | $result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user); |
2035 | 2035 | if ($result < 0) { |
@@ -2039,15 +2039,15 @@ discard block |
||
2039 | 2039 | } |
2040 | 2040 | } |
2041 | 2041 | |
2042 | - if (! $error) { |
|
2042 | + if (!$error) { |
|
2043 | 2043 | $result = $this->deleteExtraFields(); |
2044 | 2044 | if ($result < 0) { |
2045 | 2045 | $error++; |
2046 | 2046 | } |
2047 | 2047 | } |
2048 | 2048 | |
2049 | - if (! $error) { |
|
2050 | - $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id; |
|
2049 | + if (!$error) { |
|
2050 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id; |
|
2051 | 2051 | |
2052 | 2052 | $res = $this->db->query($sql); |
2053 | 2053 | if ($res === false) { |
@@ -2087,7 +2087,7 @@ discard block |
||
2087 | 2087 | $sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc'; |
2088 | 2088 | $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l'; |
2089 | 2089 | $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; |
2090 | - $sql .= ' WHERE l.rowid = '. (int) $rowid; |
|
2090 | + $sql .= ' WHERE l.rowid = '.(int) $rowid; |
|
2091 | 2091 | $sql .= ' ORDER BY l.rang'; |
2092 | 2092 | |
2093 | 2093 | dol_syslog('FactureRec::fetch', LOG_DEBUG); |
@@ -2159,44 +2159,44 @@ discard block |
||
2159 | 2159 | |
2160 | 2160 | include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; |
2161 | 2161 | |
2162 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET'; |
|
2163 | - $sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn; |
|
2164 | - $sql .= ', fk_parent_line = ' . (int) $this->fk_parent; |
|
2165 | - $sql .= ', fk_product = ' . (int) $this->fk_product; |
|
2166 | - $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); |
|
2167 | - $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); |
|
2168 | - $sql .= ", description = '" . $this->db->escape($this->description) . "'"; |
|
2169 | - $sql .= ', pu_ht = ' . price2num($this->pu_ht); |
|
2170 | - $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); |
|
2171 | - $sql .= ', qty = ' . price2num($this->qty); |
|
2172 | - $sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'"; |
|
2173 | - $sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except; |
|
2174 | - $sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'"; |
|
2175 | - $sql .= ', tva_tx = ' . price2num($this->tva_tx); |
|
2176 | - $sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx); |
|
2177 | - $sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'"; |
|
2178 | - $sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx); |
|
2179 | - $sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'"; |
|
2162 | + $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET'; |
|
2163 | + $sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn; |
|
2164 | + $sql .= ', fk_parent_line = '.(int) $this->fk_parent; |
|
2165 | + $sql .= ', fk_product = '.(int) $this->fk_product; |
|
2166 | + $sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL'); |
|
2167 | + $sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL'); |
|
2168 | + $sql .= ", description = '".$this->db->escape($this->description)."'"; |
|
2169 | + $sql .= ', pu_ht = '.price2num($this->pu_ht); |
|
2170 | + $sql .= ', pu_ttc = '.price2num($this->pu_ttc); |
|
2171 | + $sql .= ', qty = '.price2num($this->qty); |
|
2172 | + $sql .= ", remise_percent = '".price2num($this->remise_percent)."'"; |
|
2173 | + $sql .= ', fk_remise_except = '.(int) $this->fk_remise_except; |
|
2174 | + $sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'"; |
|
2175 | + $sql .= ', tva_tx = '.price2num($this->tva_tx); |
|
2176 | + $sql .= ', localtax1_tx = '.price2num($this->localtax1_tx); |
|
2177 | + $sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'"; |
|
2178 | + $sql .= ', localtax2_tx = '.price2num($this->localtax2_tx); |
|
2179 | + $sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'"; |
|
2180 | 2180 | if (empty($this->skip_update_total)) { |
2181 | - $sql .= ', total_ht = ' . price2num($this->total_ht); |
|
2182 | - $sql .= ', total_tva = ' . price2num($this->total_tva); |
|
2183 | - $sql .= ', total_localtax1 = ' . price2num($this->total_localtax1); |
|
2184 | - $sql .= ', total_localtax2 = ' . price2num($this->total_localtax2); |
|
2185 | - $sql .= ', total_ttc = ' . price2num($this->total_ttc); |
|
2181 | + $sql .= ', total_ht = '.price2num($this->total_ht); |
|
2182 | + $sql .= ', total_tva = '.price2num($this->total_tva); |
|
2183 | + $sql .= ', total_localtax1 = '.price2num($this->total_localtax1); |
|
2184 | + $sql .= ', total_localtax2 = '.price2num($this->total_localtax2); |
|
2185 | + $sql .= ', total_ttc = '.price2num($this->total_ttc); |
|
2186 | 2186 | } |
2187 | - $sql .= ', product_type = ' . (int) $this->product_type; |
|
2188 | - $sql .= ', date_start = ' . (int) $this->date_start; |
|
2189 | - $sql .= ', date_end = ' . (int) $this->date_end; |
|
2190 | - $sql .= ", info_bits = " . ((int) $this->info_bits); |
|
2191 | - $sql .= ', special_code =' . (int) $this->special_code; |
|
2192 | - $sql .= ', rang = ' . (int) $this->rang; |
|
2193 | - $sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2194 | - $sql .= ', fk_user_modif = ' . (int) $user; |
|
2195 | - $sql .= ' WHERE rowid = ' . (int) $this->id; |
|
2187 | + $sql .= ', product_type = '.(int) $this->product_type; |
|
2188 | + $sql .= ', date_start = '.(int) $this->date_start; |
|
2189 | + $sql .= ', date_end = '.(int) $this->date_end; |
|
2190 | + $sql .= ", info_bits = ".((int) $this->info_bits); |
|
2191 | + $sql .= ', special_code ='.(int) $this->special_code; |
|
2192 | + $sql .= ', rang = '.(int) $this->rang; |
|
2193 | + $sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null'); |
|
2194 | + $sql .= ', fk_user_modif = '.(int) $user; |
|
2195 | + $sql .= ' WHERE rowid = '.(int) $this->id; |
|
2196 | 2196 | |
2197 | 2197 | $this->db->begin(); |
2198 | 2198 | |
2199 | - dol_syslog(get_class($this). '::updateline', LOG_DEBUG); |
|
2199 | + dol_syslog(get_class($this).'::updateline', LOG_DEBUG); |
|
2200 | 2200 | $resql = $this->db->query($sql); |
2201 | 2201 | if ($resql) { |
2202 | 2202 | if (!$error) { |
@@ -447,13 +447,17 @@ |
||
447 | 447 | $object->setContract($linked_contract->id); |
448 | 448 | // don't set '$contractid' so it is not used when creating an intervention. |
449 | 449 | } |
450 | - if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); |
|
450 | + if (empty(NOLOGIN)) { |
|
451 | + setEventMessage($langs->trans('TicketManyContractsLinked'), 'warnings'); |
|
452 | + } |
|
451 | 453 | break; |
452 | 454 | } |
453 | 455 | } |
454 | 456 | } |
455 | 457 | if ($number_contracts_found == 0) { |
456 | - if (empty(NOLOGIN)) setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); |
|
458 | + if (empty(NOLOGIN)) { |
|
459 | + setEventMessage($langs->trans('TicketNoContractFoundToLink'), 'mesgs'); |
|
460 | + } |
|
457 | 461 | } |
458 | 462 | } |
459 | 463 | // Automatically create intervention |
@@ -48,7 +48,7 @@ |
||
48 | 48 | case 'sellist': |
49 | 49 | $tmp = ''; |
50 | 50 | $tmpparam = jsonOrUnserialize($obj->param); // $tmp may be array 'options' => array 'c_currencies:code_iso:code_iso' => null |
51 | - if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
51 | + if (is_array($tmpparam) && array_key_exists('options', $tmpparam) && $tmpparam['options'] && is_array($tmpparam['options'])) { |
|
52 | 52 | $tmpkeys = array_keys($tmpparam['options']); |
53 | 53 | $tmp = array_shift($tmpkeys); |
54 | 54 | } |
@@ -353,7 +353,7 @@ |
||
353 | 353 | 'b.montant'=>'rule-computeAmount', |
354 | 354 | 'b.sens'=>'rule-computeDirection' |
355 | 355 | ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) |
356 | - $this->import_convertvalue_array[$r]=array( |
|
356 | + $this->import_convertvalue_array[$r] = array( |
|
357 | 357 | 'b.piece_num' => array('rule' => 'compute', 'classfile' => '/accountancy/class/accountancyimport.class.php', 'class' => 'AccountancyImport', 'method' => 'cleanValue', 'element' => 'Accountancy'), |
358 | 358 | 'b.numero_compte'=>array('rule'=>'accountingaccount'), |
359 | 359 | 'b.subledger_account'=>array('rule'=>'accountingaccount'), |
@@ -101,27 +101,27 @@ |
||
101 | 101 | { |
102 | 102 | global $langs; |
103 | 103 | $legendSkills = '<div style="font-style:italic;"> |
104 | - ' . $langs->trans('legend') . ' |
|
104 | + ' . $langs->trans('legend').' |
|
105 | 105 | <table class="border" width="100%"> |
106 | 106 | <tr> |
107 | 107 | <td><span style="vertical-align:middle" class="toohappy diffnote little"></span> |
108 | - ' . $langs->trans('CompetenceAcquiredByOneOrMore') . '</td> |
|
108 | + ' . $langs->trans('CompetenceAcquiredByOneOrMore').'</td> |
|
109 | 109 | </tr> |
110 | 110 | <tr> |
111 | 111 | <td><span style="vertical-align:middle" class="veryhappy diffnote little"></span> |
112 | - ' . $langs->trans('MaxlevelGreaterThan') . '</td> |
|
112 | + ' . $langs->trans('MaxlevelGreaterThan').'</td> |
|
113 | 113 | </tr> |
114 | 114 | <tr> |
115 | 115 | <td><span style="vertical-align:middle" class="happy diffnote little"></span> |
116 | - ' . $langs->trans('MaxLevelEqualTo') . '</td> |
|
116 | + ' . $langs->trans('MaxLevelEqualTo').'</td> |
|
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | 119 | <td><span style="vertical-align:middle" class="sad diffnote little"></span> |
120 | - ' . $langs->trans('MaxLevelLowerThan') . '</td> |
|
120 | + ' . $langs->trans('MaxLevelLowerThan').'</td> |
|
121 | 121 | </tr> |
122 | 122 | <tr> |
123 | 123 | <td><span style="vertical-align:middle" class="toosad diffnote little"></span> |
124 | - ' . $langs->trans('SkillNotAcquired') . '</td> |
|
124 | + ' . $langs->trans('SkillNotAcquired').'</td> |
|
125 | 125 | </tr> |
126 | 126 | </table> |
127 | 127 | </div>'; |
@@ -144,7 +144,9 @@ |
||
144 | 144 | //$socid = $user->socid; |
145 | 145 | accessforbidden(); |
146 | 146 | } |
147 | -if (!$permissiontoread) accessforbidden(); |
|
147 | +if (!$permissiontoread) { |
|
148 | + accessforbidden(); |
|
149 | +} |
|
148 | 150 | |
149 | 151 | |
150 | 152 | /* |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | $hasgroupby = true; |
306 | 306 | $sql .= " GROUP BY "; |
307 | 307 | foreach ($object->fields as $key => $val) { |
308 | - $sql .= "t." . $key . ", "; |
|
308 | + $sql .= "t.".$key.", "; |
|
309 | 309 | } |
310 | 310 | // Add fields from extrafields |
311 | 311 | //if (!empty($extrafields->attributes[$object->table_element]['label'])) { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | //} |
316 | 316 | // Add where from hooks |
317 | 317 | $parameters = array(); |
318 | -$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
318 | +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook |
|
319 | 319 | $sql .= $hookmanager->resPrint; |
320 | 320 | $sql = preg_replace("/,\s*$/", "", $sql); |
321 | 321 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { |
381 | 381 | $obj = $db->fetch_object($resql); |
382 | 382 | $id = $obj->rowid; |
383 | - header("Location: " . dol_buildpath('/variants/card.php', 2) . '?id=' . $id); |
|
383 | + header("Location: ".dol_buildpath('/variants/card.php', 2).'?id='.$id); |
|
384 | 384 | exit; |
385 | 385 | } |
386 | 386 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
608 | 608 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
609 | 609 | } |
610 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
610 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
611 | 611 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
612 | 612 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
613 | 613 | $totalarray['nbfield']++; |
@@ -704,23 +704,23 @@ discard block |
||
704 | 704 | foreach ($object->fields as $key => $val) { |
705 | 705 | $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); |
706 | 706 | if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { |
707 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
707 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
708 | 708 | } elseif ($key == 'status') { |
709 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'center'; |
|
709 | + $cssforfield .= ($cssforfield ? ' ' : '').'center'; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | if (in_array($val['type'], array('timestamp'))) { |
713 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
713 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
714 | 714 | } elseif ($key == 'ref') { |
715 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'nowrap'; |
|
715 | + $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { |
719 | - $cssforfield .= ($cssforfield ? ' ' : '') . 'right'; |
|
719 | + $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
|
720 | 720 | } |
721 | 721 | //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; |
722 | 722 | |
723 | - if (!empty($arrayfields['t.' . $key]['checked'])) { |
|
723 | + if (!empty($arrayfields['t.'.$key]['checked'])) { |
|
724 | 724 | print '<td'.($cssforfield ? ' class="'.$cssforfield.(preg_match('/tdoverflow/', $cssforfield) ? ' classfortooltip' : '').'"' : ''); |
725 | 725 | if (preg_match('/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) { |
726 | 726 | print ' title="'.dol_escape_htmltag($object->$key).'"'; |
@@ -739,15 +739,15 @@ discard block |
||
739 | 739 | } |
740 | 740 | if (!empty($val['isameasure']) && $val['isameasure'] == 1) { |
741 | 741 | if (!$i) { |
742 | - $totalarray['pos'][$totalarray['nbfield']] = 't.' . $key; |
|
742 | + $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key; |
|
743 | 743 | } |
744 | 744 | if (!isset($totalarray['val'])) { |
745 | 745 | $totalarray['val'] = array(); |
746 | 746 | } |
747 | - if (!isset($totalarray['val']['t.' . $key])) { |
|
748 | - $totalarray['val']['t.' . $key] = 0; |
|
747 | + if (!isset($totalarray['val']['t.'.$key])) { |
|
748 | + $totalarray['val']['t.'.$key] = 0; |
|
749 | 749 | } |
750 | - $totalarray['val']['t.' . $key] += $object->$key; |
|
750 | + $totalarray['val']['t.'.$key] += $object->$key; |
|
751 | 751 | } |
752 | 752 | } |
753 | 753 | } |
@@ -794,14 +794,14 @@ discard block |
||
794 | 794 | // Move |
795 | 795 | print '<td class="center linecolmove tdlineupdown">'; |
796 | 796 | if ($i > 0) { |
797 | - print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=up&rowid=' . $obj->rowid . '">' . img_up('default', 0, 'imgupforline') . '</a>'; |
|
797 | + print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=up&rowid='.$obj->rowid.'">'.img_up('default', 0, 'imgupforline').'</a>'; |
|
798 | 798 | } |
799 | 799 | if ($i < $num - 1) { |
800 | - print '<a class="lineupdown" href="' . $_SERVER['PHP_SELF'] . '?action=down&rowid=' . $obj->rowid . '">' . img_down('default', 0, 'imgdownforline') . '</a>'; |
|
800 | + print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&rowid='.$obj->rowid.'">'.img_down('default', 0, 'imgdownforline').'</a>'; |
|
801 | 801 | } |
802 | 802 | print '</td>'; |
803 | 803 | |
804 | - print '</tr>' . "\n"; |
|
804 | + print '</tr>'."\n"; |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | $i++; |