Completed
Branch develop (d02c61)
by
unknown
18:56
created
htdocs/asset/tpl/depreciation_options_view.tpl.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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'))) {
Please login to merge, or discard this patch.
htdocs/accountancy/class/accountancyimport.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 "''";
Please login to merge, or discard this patch.
htdocs/fourn/class/fournisseur.facture-rec.class.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -479,7 +479,9 @@
 block discarded – undo
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') . ',';
Please login to merge, or discard this patch.
Spacing   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -334,32 +334,32 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
 		$facid = $this->id;
1080 1080
 
1081
-		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, fk_remise_except=$fk_remise_except, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1081
+		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, fk_remise_except=$fk_remise_except, 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 1082
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
1083 1083
 
1084 1084
 		// Check parameters
@@ -1149,41 +1149,41 @@  discard block
 block discarded – undo
1149 1149
 				$product_type = $product->type;
1150 1150
 			}
1151 1151
 
1152
-			$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
1153
-			$sql .= ' fk_facture_fourn = ' . ((int) $facid);
1154
-			$sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');
1155
-			$sql .= ", ref = '" . $this->db->escape($ref) . "'";
1156
-			$sql .= ", label = '" . $this->db->escape($label) . "'";
1157
-			$sql .= ", description = '" . $this->db->escape($desc) . "'";
1158
-			$sql .= ', pu_ht = ' . price2num($pu_ht);
1159
-			$sql .= ', qty = ' . price2num($qty);
1160
-			$sql .= ", remise_percent = '" . price2num($remise_percent) . "'";
1161
-			$sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";
1162
-			$sql .= ', tva_tx = ' . price2num($txtva);
1163
-			$sql .= ', localtax1_tx = ' . (float) $txlocaltax1;
1164
-			$sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";
1165
-			$sql .= ', localtax2_tx = ' . (float) $txlocaltax2;
1166
-			$sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";
1167
-			$sql .= ", total_ht = '" . price2num($total_ht) . "'";
1168
-			$sql .= ", total_tva = '" . price2num($total_tva) . "'";
1169
-			$sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";
1170
-			$sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";
1171
-			$sql .= ", total_ttc = '" . price2num($total_ttc) . "'";
1172
-			$sql .= ', product_type = ' . (int) $product_type;
1173
-			$sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);
1174
-			$sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);
1175
-			$sql .= ', info_bits = ' . (int) $info_bits;
1176
-			$sql .= ', special_code = ' . (int) $special_code;
1177
-			$sql .= ', rang = ' . (int) $rang;
1178
-			$sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
1179
-			$sql .= ', fk_user_modif = ' . (int) $user;
1152
+			$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
1153
+			$sql .= ' fk_facture_fourn = '.((int) $facid);
1154
+			$sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null');
1155
+			$sql .= ", ref = '".$this->db->escape($ref)."'";
1156
+			$sql .= ", label = '".$this->db->escape($label)."'";
1157
+			$sql .= ", description = '".$this->db->escape($desc)."'";
1158
+			$sql .= ', pu_ht = '.price2num($pu_ht);
1159
+			$sql .= ', qty = '.price2num($qty);
1160
+			$sql .= ", remise_percent = '".price2num($remise_percent)."'";
1161
+			$sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'";
1162
+			$sql .= ', tva_tx = '.price2num($txtva);
1163
+			$sql .= ', localtax1_tx = '.(float) $txlocaltax1;
1164
+			$sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'";
1165
+			$sql .= ', localtax2_tx = '.(float) $txlocaltax2;
1166
+			$sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'";
1167
+			$sql .= ", total_ht = '".price2num($total_ht)."'";
1168
+			$sql .= ", total_tva = '".price2num($total_tva)."'";
1169
+			$sql .= ", total_localtax1 = '".price2num($total_localtax1)."'";
1170
+			$sql .= ", total_localtax2 = '".price2num($total_localtax2)."'";
1171
+			$sql .= ", total_ttc = '".price2num($total_ttc)."'";
1172
+			$sql .= ', product_type = '.(int) $product_type;
1173
+			$sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start);
1174
+			$sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end);
1175
+			$sql .= ', info_bits = '.(int) $info_bits;
1176
+			$sql .= ', special_code = '.(int) $special_code;
1177
+			$sql .= ', rang = '.(int) $rang;
1178
+			$sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null');
1179
+			$sql .= ', fk_user_modif = '.(int) $user;
1180 1180
 			$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
1181 1181
 			$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
1182 1182
 			$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
1183 1183
 			$sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc);
1184
-			$sql .= ' WHERE rowid = ' . (int) $rowid;
1184
+			$sql .= ' WHERE rowid = '.(int) $rowid;
1185 1185
 
1186
-			dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
1186
+			dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
1187 1187
 			if ($this->db->query($sql)) {
1188 1188
 				$this->id = $facid;
1189 1189
 				$this->update_price();
@@ -1272,16 +1272,16 @@  discard block
 block discarded – undo
1272 1272
 		$tmparray = dol_getdate($now);
1273 1273
 		$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
1274 1274
 
1275
-		dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation);
1275
+		dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation);
1276 1276
 
1277 1277
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec';
1278 1278
 		$sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency
1279 1279
 		$sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')";
1280 1280
 		$sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
1281 1281
 		$sql .= ' AND suspended = 0';
1282
-		$sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here
1282
+		$sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here
1283 1283
 		if ($restrictioninvoiceid > 0) {
1284
-			$sql .= ' AND rowid = '. (int) $restrictioninvoiceid;
1284
+			$sql .= ' AND rowid = '.(int) $restrictioninvoiceid;
1285 1285
 		}
1286 1286
 		$sql .= $this->db->order('entity', 'ASC');
1287 1287
 		//print $sql;exit;
@@ -1319,14 +1319,14 @@  discard block
 block discarded – undo
1319 1319
 					// Set entity context
1320 1320
 					$conf->entity = $facturerec->entity;
1321 1321
 
1322
-					dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity);
1322
+					dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity);
1323 1323
 
1324 1324
 					$new_fac_fourn = new FactureFournisseur($this->db);
1325 1325
 					$new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
1326 1326
 					$new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
1327 1327
 
1328 1328
 					$new_fac_fourn->type = self::TYPE_STANDARD;
1329
-					$new_fac_fourn->statut = self::STATUS_DRAFT;	// deprecated
1329
+					$new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated
1330 1330
 					$new_fac_fourn->status = self::STATUS_DRAFT;
1331 1331
 					$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.
1332 1332
 					$new_fac_fourn->socid = $facturerec->socid;
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 					$new_fac_fourn->model_pdf = $facturerec->model_pdf;
1336 1336
 					$new_fac_fourn->fk_project = $facturerec->fk_project;
1337 1337
 					$new_fac_fourn->label = $facturerec->label;
1338
-					$new_fac_fourn->libelle = $facturerec->label;	// deprecated
1338
+					$new_fac_fourn->libelle = $facturerec->label; // deprecated
1339 1339
 
1340 1340
 					$invoiceidgenerated = $new_fac_fourn->create($user);
1341 1341
 					if ($invoiceidgenerated <= 0) {
@@ -1364,22 +1364,22 @@  discard block
 block discarded – undo
1364 1364
 					}
1365 1365
 				} else {
1366 1366
 					$error++;
1367
-					$this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n";
1368
-					$this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity;
1369
-					dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity);
1367
+					$this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n";
1368
+					$this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity;
1369
+					dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity);
1370 1370
 				}
1371 1371
 
1372 1372
 				if (!$error && $invoiceidgenerated >= 0) {
1373 1373
 					$facturerec->nb_gen_done++;
1374 1374
 					$facturerec->date_last_gen = dol_now();
1375
-					$facturerec->date_when= $facturerec->getNextDate();
1375
+					$facturerec->date_when = $facturerec->getNextDate();
1376 1376
 					$facturerec->update($user);
1377
-					$this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre);
1378
-					dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->titre. ' is finished with a success generation');
1377
+					$this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre);
1378
+					dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->titre.' is finished with a success generation');
1379 1379
 					$nb_create++;
1380 1380
 					$this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->titre)."\n";
1381 1381
 				} else {
1382
-					$this->db->rollback('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->titre);
1382
+					$this->db->rollback('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->titre);
1383 1383
 				}
1384 1384
 
1385 1385
 				$parameters = array(
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 		}
1473 1473
 		$result .= $linkend;
1474 1474
 		global $action;
1475
-		$hookmanager->initHooks(array($this->element . 'dao'));
1475
+		$hookmanager->initHooks(array($this->element.'dao'));
1476 1476
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
1477 1477
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1478 1478
 		if ($reshook > 0) {
@@ -1651,8 +1651,8 @@  discard block
 block discarded – undo
1651 1651
 		$prodids = array();
1652 1652
 
1653 1653
 		$sql = 'SELECT rowid';
1654
-		$sql .= ' FROM ' .MAIN_DB_PREFIX. 'product';
1655
-		$sql .= ' WHERE entity IN (' .getEntity('product'). ')';
1654
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'product';
1655
+		$sql .= ' WHERE entity IN ('.getEntity('product').')';
1656 1656
 		$sql .= $this->db->plimit(100);
1657 1657
 
1658 1658
 		$resql = $this->db->query($sql);
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
 			$xnbp = 0;
1692 1692
 			while ($xnbp < $nbp) {
1693 1693
 				$line = new FactureLigne($this->db);
1694
-				$line->desc = $langs->trans('Description'). ' ' .$xnbp;
1694
+				$line->desc = $langs->trans('Description').' '.$xnbp;
1695 1695
 				$line->qty = 1;
1696 1696
 				$line->subprice = 100;
1697 1697
 				$line->tva_tx = 19.6;
@@ -1739,7 +1739,7 @@  discard block
 block discarded – undo
1739 1739
 
1740 1740
 			// Add a line "offered"
1741 1741
 			$line = new FactureLigne($this->db);
1742
-			$line->desc = $langs->trans('Description'). ' (offered line)';
1742
+			$line->desc = $langs->trans('Description').' (offered line)';
1743 1743
 			$line->qty = 1;
1744 1744
 			$line->subprice = 100;
1745 1745
 			$line->tva_tx = 19.6;
@@ -1786,12 +1786,12 @@  discard block
 block discarded – undo
1786 1786
 	public function setFrequencyAndUnit($frequency, $unit)
1787 1787
 	{
1788 1788
 		if (!$this->table_element) {
1789
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1789
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1790 1790
 			return -1;
1791 1791
 		}
1792 1792
 
1793 1793
 		if (!empty($frequency) && empty($unit)) {
1794
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1794
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1795 1795
 			return -2;
1796 1796
 		}
1797 1797
 
@@ -1830,11 +1830,11 @@  discard block
 block discarded – undo
1830 1830
 			return -1;
1831 1831
 		}
1832 1832
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1833
-		$sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");
1833
+		$sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL");
1834 1834
 		if ($increment_nb_gen_done > 0) {
1835 1835
 			$sql .= ", nb_gen_done = nb_gen_done + 1";
1836 1836
 		}
1837
-		$sql .= " WHERE rowid = " . (int) $this->id;
1837
+		$sql .= " WHERE rowid = ".(int) $this->id;
1838 1838
 
1839 1839
 		dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);
1840 1840
 
@@ -1868,8 +1868,8 @@  discard block
 block discarded – undo
1868 1868
 		}
1869 1869
 
1870 1870
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1871
-		$sql .= " SET nb_gen_max = ". (int) $nb;
1872
-		$sql .= " WHERE rowid = " . (int) $this->id;
1871
+		$sql .= " SET nb_gen_max = ".(int) $nb;
1872
+		$sql .= " WHERE rowid = ".(int) $this->id;
1873 1873
 
1874 1874
 		dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);
1875 1875
 
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
 
1898 1898
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1899 1899
 		$sql .= " SET auto_validate = ".((int) $validate);
1900
-		$sql .= " WHERE rowid = " . (int) $this->id;
1900
+		$sql .= " WHERE rowid = ".(int) $this->id;
1901 1901
 
1902 1902
 		dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);
1903 1903
 
@@ -1924,8 +1924,8 @@  discard block
 block discarded – undo
1924 1924
 		}
1925 1925
 
1926 1926
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1927
-		$sql .= " SET generate_pdf = ". (int) $validate;
1928
-		$sql .= " WHERE rowid = " . (int) $this->id;
1927
+		$sql .= " SET generate_pdf = ".(int) $validate;
1928
+		$sql .= " WHERE rowid = ".(int) $this->id;
1929 1929
 
1930 1930
 		dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);
1931 1931
 
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 
1954 1954
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1955 1955
 		$sql .= " SET modelpdf = '".$this->db->escape($model)."'";
1956
-		$sql .= " WHERE rowid = " . (int) $this->id;
1956
+		$sql .= " WHERE rowid = ".(int) $this->id;
1957 1957
 
1958 1958
 		dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);
1959 1959
 
@@ -2027,8 +2027,8 @@  discard block
 block discarded – undo
2027 2027
 		$error = 0;
2028 2028
 		$this->db->begin();
2029 2029
 
2030
-		if (! $error) {
2031
-			if (! $notrigger) {
2030
+		if (!$error) {
2031
+			if (!$notrigger) {
2032 2032
 				// Call triggers
2033 2033
 				$result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user);
2034 2034
 				if ($result < 0) {
@@ -2038,15 +2038,15 @@  discard block
 block discarded – undo
2038 2038
 			}
2039 2039
 		}
2040 2040
 
2041
-		if (! $error) {
2041
+		if (!$error) {
2042 2042
 			$result = $this->deleteExtraFields();
2043 2043
 			if ($result < 0) {
2044 2044
 				$error++;
2045 2045
 			}
2046 2046
 		}
2047 2047
 
2048
-		if (! $error) {
2049
-			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id;
2048
+		if (!$error) {
2049
+			$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id;
2050 2050
 
2051 2051
 			$res = $this->db->query($sql);
2052 2052
 			if ($res === false) {
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
2087 2087
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
2088 2088
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
2089
-		$sql .= ' WHERE l.rowid = '. (int) $rowid;
2089
+		$sql .= ' WHERE l.rowid = '.(int) $rowid;
2090 2090
 		$sql .= ' ORDER BY l.rang';
2091 2091
 
2092 2092
 		dol_syslog('FactureRec::fetch', LOG_DEBUG);
@@ -2158,44 +2158,44 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
2160 2160
 
2161
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
2162
-		$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
2163
-		$sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
2164
-		$sql .= ', fk_product = ' . (int) $this->fk_product;
2165
-		$sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');
2166
-		$sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');
2167
-		$sql .= ", description = '" . $this->db->escape($this->description) . "'";
2168
-		$sql .= ', pu_ht = ' . price2num($this->pu_ht);
2169
-		$sql .= ', pu_ttc = ' . price2num($this->pu_ttc);
2170
-		$sql .= ', qty = ' . price2num($this->qty);
2171
-		$sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";
2172
-		$sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;
2173
-		$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
2174
-		$sql .= ', tva_tx = ' . price2num($this->tva_tx);
2175
-		$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
2176
-		$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
2177
-		$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
2178
-		$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
2161
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
2162
+		$sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn;
2163
+		$sql .= ', fk_parent_line = '.(int) $this->fk_parent;
2164
+		$sql .= ', fk_product = '.(int) $this->fk_product;
2165
+		$sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL');
2166
+		$sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL');
2167
+		$sql .= ", description = '".$this->db->escape($this->description)."'";
2168
+		$sql .= ', pu_ht = '.price2num($this->pu_ht);
2169
+		$sql .= ', pu_ttc = '.price2num($this->pu_ttc);
2170
+		$sql .= ', qty = '.price2num($this->qty);
2171
+		$sql .= ", remise_percent = '".price2num($this->remise_percent)."'";
2172
+		$sql .= ', fk_remise_except = '.(int) $this->fk_remise_except;
2173
+		$sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'";
2174
+		$sql .= ', tva_tx = '.price2num($this->tva_tx);
2175
+		$sql .= ', localtax1_tx = '.price2num($this->localtax1_tx);
2176
+		$sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";
2177
+		$sql .= ', localtax2_tx = '.price2num($this->localtax2_tx);
2178
+		$sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";
2179 2179
 		if (empty($this->skip_update_total)) {
2180
-			$sql .= ', total_ht = ' . price2num($this->total_ht);
2181
-			$sql .= ', total_tva = ' . price2num($this->total_tva);
2182
-			$sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);
2183
-			$sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);
2184
-			$sql .= ', total_ttc = ' . price2num($this->total_ttc);
2180
+			$sql .= ', total_ht = '.price2num($this->total_ht);
2181
+			$sql .= ', total_tva = '.price2num($this->total_tva);
2182
+			$sql .= ', total_localtax1 = '.price2num($this->total_localtax1);
2183
+			$sql .= ', total_localtax2 = '.price2num($this->total_localtax2);
2184
+			$sql .= ', total_ttc = '.price2num($this->total_ttc);
2185 2185
 		}
2186
-		$sql .= ', product_type = ' . (int) $this->product_type;
2187
-		$sql .= ', date_start = ' . (int) $this->date_start;
2188
-		$sql .= ', date_end = ' . (int) $this->date_end;
2189
-		$sql .= ", info_bits = " . ((int) $this->info_bits);
2190
-		$sql .= ', special_code =' . (int) $this->special_code;
2191
-		$sql .= ', rang = ' . (int) $this->rang;
2192
-		$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2193
-		$sql .= ', fk_user_modif = ' . (int) $user;
2194
-		$sql .= ' WHERE rowid = ' . (int) $this->id;
2186
+		$sql .= ', product_type = '.(int) $this->product_type;
2187
+		$sql .= ', date_start = '.(int) $this->date_start;
2188
+		$sql .= ', date_end = '.(int) $this->date_end;
2189
+		$sql .= ", info_bits = ".((int) $this->info_bits);
2190
+		$sql .= ', special_code ='.(int) $this->special_code;
2191
+		$sql .= ', rang = '.(int) $this->rang;
2192
+		$sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2193
+		$sql .= ', fk_user_modif = '.(int) $user;
2194
+		$sql .= ' WHERE rowid = '.(int) $this->id;
2195 2195
 
2196 2196
 		$this->db->begin();
2197 2197
 
2198
-		dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
2198
+		dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
2199 2199
 		$resql = $this->db->query($sql);
2200 2200
 		if ($resql) {
2201 2201
 			if (!$error) {
Please login to merge, or discard this patch.
htdocs/admin/propal.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 $action = GETPOST('action', 'aZ09');
45 45
 $value = GETPOST('value', 'alpha');
46
-$modulepart = GETPOST('modulepart', 'aZ09');	// Used by actions_setmoduleoptions.inc.php
46
+$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
47 47
 
48 48
 $label = GETPOST('label', 'alpha');
49 49
 $scandir = GETPOST('scan_dir', 'alpha');
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		setEventMessages($langs->trans('Error'), null, 'errors');
212 212
 	} else {
213 213
 		setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
214
-		header("Location: " . $_SERVER["PHP_SELF"]);
214
+		header("Location: ".$_SERVER["PHP_SELF"]);
215 215
 		exit();
216 216
 	}
217 217
 } elseif (preg_match('/del_(.*)/', $action, $reg)) {
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 		setEventMessages($langs->trans('Error'), null, 'errors');
227 227
 	} else {
228 228
 		setEventMessages($langs->trans('SetupSaved'), null, 'mesgs');
229
-		header("Location: " . $_SERVER["PHP_SELF"]);
229
+		header("Location: ".$_SERVER["PHP_SELF"]);
230 230
 		exit();
231 231
 	}
232 232
 }
Please login to merge, or discard this patch.
htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -447,13 +447,17 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
htdocs/core/extrafieldsinimport.inc.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
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
 				}
Please login to merge, or discard this patch.
htdocs/core/modules/contract/doc/pdf_strato.modules.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -356,10 +356,10 @@
 block discarded – undo
356 356
 						$desc = dol_htmlentitiesbr($objectligne->desc, 1); // Desc (not empty for free lines)
357 357
 						$txt = '';
358 358
 						if (empty($conf->global->CONTRACT_HIDE_QTY_ON_PDF)) {
359
-							$txt .= $outputlangs->transnoentities("Quantity") . ' : <strong>' . $objectligne->qty . '</strong>';
359
+							$txt .= $outputlangs->transnoentities("Quantity").' : <strong>'.$objectligne->qty.'</strong>';
360 360
 						}
361 361
 						if (empty($conf->global->CONTRACT_HIDE_PRICE_ON_PDF)) {
362
-							$txt .= ' - ' . $outputlangs->transnoentities("UnitPrice") . ' : <strong>' . price($objectligne->subprice) . '</strong>';
362
+							$txt .= ' - '.$outputlangs->transnoentities("UnitPrice").' : <strong>'.price($objectligne->subprice).'</strong>';
363 363
 						}
364 364
 						if (empty($conf->global->CONTRACT_HIDE_PLANNED_DATE_ON_PDF)) {
365 365
 							$txt .= '<br>';
Please login to merge, or discard this patch.
htdocs/core/modules/modAccounting.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@
 block discarded – undo
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'),
Please login to merge, or discard this patch.
htdocs/hrm/lib/hrm_evaluation.lib.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -101,27 +101,27 @@
 block discarded – undo
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>';
Please login to merge, or discard this patch.