Completed
Branch develop (a878e9)
by
unknown
17:43
created
htdocs/product/reassort.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 $sql .= $hookmanager->resPrint;
158 158
 $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
159 159
 if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) {
160
-	$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'product_stock as s ON p.rowid = s.fk_product';
160
+	$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
161 161
 }
162 162
 if (getDolGlobalString('PRODUCT_USE_UNITS')) {
163 163
 	$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
@@ -176,48 +176,48 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 	$sql .= "(";
178 178
 	$sql .= " SELECT cp.fk_categorie, cp.fk_product";
179
-	$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp";
179
+	$sql .= " FROM ".MAIN_DB_PREFIX."categorie_product as cp";
180 180
 	$sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ
181 181
 	if ($search_categ > 0) {
182
-		$sql .= " AND cp.fk_categorie = " . ((int) $search_categ);
182
+		$sql .= " AND cp.fk_categorie = ".((int) $search_categ);
183 183
 	}
184 184
 	$sql .= ")";
185 185
 }
186 186
 if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) {
187 187
 	if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_VIRTUAL_WITH_NO_PHYSICAL')) {
188
-		$sql .= " AND EXISTS (SELECT e.rowid FROM " . MAIN_DB_PREFIX . "entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock') . "))";
188
+		$sql .= " AND EXISTS (SELECT e.rowid FROM ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = s.fk_entrepot AND e.entity IN (".getEntity('stock')."))";
189 189
 	} else {
190 190
 		$sql .= " AND
191 191
 		(
192 192
 			EXISTS
193 193
 				(SELECT e.rowid
194
-				 FROM " . MAIN_DB_PREFIX . "entrepot as e
195
-				 WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock') . "))
194
+				 FROM " . MAIN_DB_PREFIX."entrepot as e
195
+				 WHERE e.rowid = s.fk_entrepot AND e.entity IN (" . getEntity('stock')."))
196 196
 			OR (
197 197
 				SELECT SUM(cd1.qty) as qty
198
-				FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as cd1
199
-				LEFT JOIN " . MAIN_DB_PREFIX . "commande_fournisseur as c1
198
+				FROM " . MAIN_DB_PREFIX."commande_fournisseurdet as cd1
199
+				LEFT JOIN " . MAIN_DB_PREFIX."commande_fournisseur as c1
200 200
 					ON c1.rowid = cd1.fk_commande
201 201
 				WHERE c1.entity IN (1) AND cd1.fk_product = p.rowid AND c1.fk_statut in (3,4) AND cd1.qty <> 0
202 202
 			) IS NOT NULL
203 203
 			OR (
204 204
 				SELECT SUM(cd2.qty) as qty
205
-				FROM " . MAIN_DB_PREFIX . "commandedet as cd2
206
-				LEFT JOIN " . MAIN_DB_PREFIX . "commande as c2 ON c2.rowid = cd2.fk_commande
205
+				FROM " . MAIN_DB_PREFIX."commandedet as cd2
206
+				LEFT JOIN " . MAIN_DB_PREFIX."commande as c2 ON c2.rowid = cd2.fk_commande
207 207
 				WHERE c2.entity IN (1) AND cd2.fk_product = p.rowid AND c2.fk_statut in (1,2) AND cd2.qty <> 0
208 208
 			) IS NOT NULL
209 209
 			OR (
210 210
 				SELECT SUM(ed3.qty) as qty
211
-				FROM " . MAIN_DB_PREFIX . "expeditiondet as ed3
212
-				LEFT JOIN " . MAIN_DB_PREFIX . "expedition as e3 ON e3.rowid = ed3.fk_expedition
213
-				LEFT JOIN " . MAIN_DB_PREFIX . "commandedet as cd3 ON ed3.fk_elementdet = cd3.rowid
214
-				LEFT JOIN " . MAIN_DB_PREFIX . "commande as c3 ON c3.rowid = cd3.fk_commande
211
+				FROM " . MAIN_DB_PREFIX."expeditiondet as ed3
212
+				LEFT JOIN " . MAIN_DB_PREFIX."expedition as e3 ON e3.rowid = ed3.fk_expedition
213
+				LEFT JOIN " . MAIN_DB_PREFIX."commandedet as cd3 ON ed3.fk_elementdet = cd3.rowid
214
+				LEFT JOIN " . MAIN_DB_PREFIX."commande as c3 ON c3.rowid = cd3.fk_commande
215 215
 				WHERE e3.entity IN (1) AND cd3.fk_product = p.rowid AND c3.fk_statut IN (1,2) AND e3.fk_statut IN (1,2) AND ed3.qty <> 0
216 216
 			) IS NOT NULL
217 217
 			OR (
218 218
 				SELECT SUM(mp4.qty) as qty
219
-				FROM " . MAIN_DB_PREFIX . "mrp_production as mp4
220
-				LEFT JOIN " . MAIN_DB_PREFIX . "mrp_mo as m4 ON m4.rowid = mp4.fk_mo AND m4.entity IN (1) AND m4.status IN (1,2)
219
+				FROM " . MAIN_DB_PREFIX."mrp_production as mp4
220
+				LEFT JOIN " . MAIN_DB_PREFIX."mrp_mo as m4 ON m4.rowid = mp4.fk_mo AND m4.entity IN (1) AND m4.status IN (1,2)
221 221
 				WHERE mp4.fk_product = p.rowid AND mp4.qty <> 0
222 222
 			) IS NOT NULL
223 223
 			) ";
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 $sql_having = '';
281 281
 if (!getDolGlobalString('PRODUCT_STOCK_LIST_SHOW_WITH_PRECALCULATED_DENORMALIZED_PHYSICAL_STOCK')) {
282 282
 	if ($search_toolowstock) {
283
-		$sql_having .= " HAVING SUM(" . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ") < p.seuil_stock_alerte";
283
+		$sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
284 284
 	}
285 285
 	if ($search_stock_physique != '') {
286 286
 		//$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
287
-		$natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
288
-		$natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
287
+		$natural_search_physique = natural_search('SUM('.$db->ifsql('s.reel IS NULL', '0', 's.reel').')', $search_stock_physique, 1, 1);
288
+		$natural_search_physique = " ".substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
289 289
 		if (!empty($sql_having)) {
290 290
 			$sql_having .= " AND";
291 291
 		} else {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		$param .= "&sbarcode=".urlencode((string) ($sbarcode));
387 387
 	}
388 388
 	if ($search_stock_physique) {
389
-		$param .= '&search_stock_physique=' . urlencode($search_stock_physique);
389
+		$param .= '&search_stock_physique='.urlencode($search_stock_physique);
390 390
 	}
391 391
 
392 392
 	llxHeader("", $texte, $helpurl, '', 0, 0, '', '', '', 'mod-product page-reassort');
Please login to merge, or discard this patch.
htdocs/core/class/html.formsetup.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -164,12 +164,12 @@  discard block
 block discarded – undo
164 164
 			$out .= $this->htmlBeforeOutputForm;
165 165
 
166 166
 			if ($editMode) {
167
-				$out .= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';
167
+				$out .= '<form '.self::generateAttributesStringFromArray($this->formAttributes).' >';
168 168
 
169 169
 				// generate hidden values from $this->formHiddenInputs
170 170
 				if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) {
171 171
 					foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) {
172
-						$out .= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';
172
+						$out .= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="'.dol_escape_htmltag($hiddenValue).'">';
173 173
 					}
174 174
 				}
175 175
 			}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 			} elseif ($editMode) {
189 189
 				$out .= '<div class="form-setup-button-container center">'; // Todo : remove .center by adding style to form-setup-button-container css class in all themes
190 190
 				$out .= $this->htmlOutputMoreButton;
191
-				$out .= '<input class="button button-save" type="submit" value="' . $this->langs->trans("Save") . '">'; // Todo fix dolibarr style for <button and use <button instead of input
191
+				$out .= '<input class="button button-save" type="submit" value="'.$this->langs->trans("Save").'">'; // Todo fix dolibarr style for <button and use <button instead of input
192 192
 				/*$out .= ' &nbsp;&nbsp; ';
193 193
 				$out .= '<a class="button button-cancel" type="submit" href="' . $this->formAttributes['action'] . '">'.$this->langs->trans('Cancel').'</a>';
194 194
 				*/
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
 			if (empty($hideTitle)) {
233 233
 				$out .= '<thead>';
234 234
 				$out .= '<tr class="liste_titre">';
235
-				$out .= '	<td>' . $this->langs->trans("Parameter") . '</td>';
236
-				$out .= '	<td>' . $this->langs->trans("Value") . '</td>';
235
+				$out .= '	<td>'.$this->langs->trans("Parameter").'</td>';
236
+				$out .= '	<td>'.$this->langs->trans("Value").'</td>';
237 237
 				$out .= '</tr>';
238 238
 				$out .= '</thead>';
239 239
 			}
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 		if (!empty($this->helpText)) {
833 833
 			return $this->helpText;
834 834
 		}
835
-		return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');
835
+		return (($this->langs->trans($this->confKey.'Tooltip') != $this->confKey.'Tooltip') ? $this->langs->trans($this->confKey.'Tooltip') : '');
836 836
 	}
837 837
 
838 838
 	/**
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 
850 850
 		// if conf defined on entity 0, prepend a picto to indicate it will apply across all entities
851 851
 		if (isModEnabled('multicompany') && $this->entity == 0) {
852
-			$out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh') . '&nbsp;' . $out;
852
+			$out = img_picto($this->langs->trans('AllEntities'), 'fa-globe-americas em088 opacityhigh').'&nbsp;'.$out;
853 853
 		}
854 854
 
855 855
 		return $out;
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		} elseif ($this->type == 'html') {
898 898
 			$out .= $this->generateInputFieldHtml();
899 899
 		} elseif ($this->type == 'color') {
900
-			$out .=  $this->generateInputFieldColor();
900
+			$out .= $this->generateInputFieldColor();
901 901
 		} elseif ($this->type == 'yesno') {
902 902
 			if (!empty($conf->use_javascript_ajax)) {
903 903
 				$out .= ajax_constantonoff($this->confKey);
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 	 */
956 956
 	public function generateInputFieldTextarea()
957 957
 	{
958
-		$out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">' . "\n";
958
+		$out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">'."\n";
959 959
 		$out .= dol_htmlentities($this->fieldValue);
960 960
 		$out .= "</textarea>\n";
961 961
 		return $out;
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 	public function generateInputFieldHtml()
970 970
 	{
971 971
 		global $conf;
972
-		require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
972
+		require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
973 973
 		$doleditor = new DolEditor($this->confKey, $this->fieldValue, '', 160, 'dolibarr_notes', '', false, false, isModEnabled('fckeditor'), ROWS_5, '90%');
974 974
 		return $doleditor->Create(1);
975 975
 	}
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 		$out = '';
1009 1009
 		if (preg_match('/emailtemplate:/', $this->type)) {
1010
-			include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
1010
+			include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
1011 1011
 			$formmail = new FormMail($this->db);
1012 1012
 
1013 1013
 			$tmp = explode(':', $this->type);
@@ -1017,10 +1017,10 @@  discard block
 block discarded – undo
1017 1017
 				foreach ($formmail->lines_model as $modelMail) {
1018 1018
 					$moreonlabel = '';
1019 1019
 					if (!empty($arrayOfMessageName[$modelMail->label])) {
1020
-						$moreonlabel = ' <span class="opacitymedium">(' . $this->langs->trans("SeveralLangugeVariatFound") . ')</span>';
1020
+						$moreonlabel = ' <span class="opacitymedium">('.$this->langs->trans("SeveralLangugeVariatFound").')</span>';
1021 1021
 					}
1022 1022
 					// The 'label' is the key that is unique if we exclude the language
1023
-					$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)) . $moreonlabel;
1023
+					$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)).$moreonlabel;
1024 1024
 				}
1025 1025
 			}
1026 1026
 			$out .= $this->form->selectarray($this->confKey, $arrayOfMessageName, $this->fieldValue, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
@@ -1079,10 +1079,10 @@  discard block
 block discarded – undo
1079 1079
 		}
1080 1080
 		$out = '<input required="required" type="password" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ? GETPOST($this->confKey, 'alpha') : $this->fieldValue).'"';
1081 1081
 		if ($min) {
1082
-			$out .= ' minlength="' . $min . '"';
1082
+			$out .= ' minlength="'.$min.'"';
1083 1083
 		}
1084 1084
 		if ($max) {
1085
-			$out .= ' maxlength="' . $max . '"';
1085
+			$out .= ' maxlength="'.$max.'"';
1086 1086
 		}
1087 1087
 		$out .= '>';
1088 1088
 		return $out;
@@ -1208,9 +1208,9 @@  discard block
 block discarded – undo
1208 1208
 		} elseif ($this->type == 'selectUser') {
1209 1209
 			$out .= $this->generateOutputFieldSelectUser();
1210 1210
 		} elseif ($this->type == 'html') {
1211
-			$out .=  $this->fieldValue;
1211
+			$out .= $this->fieldValue;
1212 1212
 		} elseif ($this->type == 'color') {
1213
-			$out .=  $this->generateOutputFieldColor();
1213
+			$out .= $this->generateOutputFieldColor();
1214 1214
 		} elseif ($this->type == 'yesno') {
1215 1215
 			if (!empty($conf->use_javascript_ajax)) {
1216 1216
 				$out .= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter
@@ -1223,7 +1223,7 @@  discard block
 block discarded – undo
1223 1223
 			}
1224 1224
 		} elseif (preg_match('/emailtemplate:/', $this->type)) {
1225 1225
 			if ($this->fieldValue > 0) {
1226
-				include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
1226
+				include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
1227 1227
 				$formmail = new FormMail($this->db);
1228 1228
 
1229 1229
 				$tmp = explode(':', $this->type);
@@ -1244,9 +1244,9 @@  discard block
 block discarded – undo
1244 1244
 			$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
1245 1245
 			$toprint = array();
1246 1246
 			foreach ($ways as $way) {
1247
-				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
1247
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #bbb"').'>'.$way.'</li>';
1248 1248
 			}
1249
-			$out .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
1249
+			$out .= '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
1250 1250
 		} elseif (preg_match('/thirdparty_type/', $this->type)) {
1251 1251
 			if ($this->fieldValue == 2) {
1252 1252
 				$out .= $this->langs->trans("Prospect");
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		$outPut = '';
1365 1365
 		$user = new User($this->db);
1366 1366
 		$user->fetch($this->fieldValue);
1367
-		$outPut = $user->firstname . " "  . $user->lastname;
1367
+		$outPut = $user->firstname." ".$user->lastname;
1368 1368
 		return $outPut;
1369 1369
 	}
1370 1370
 
Please login to merge, or discard this patch.
htdocs/compta/prelevement/class/bonprelevement.class.php 1 patch
Spacing   +453 added lines, -453 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * \brief      File of withdrawal receipts class
30 30
  */
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
34
-require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/compta/paiement/class/paiement.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/paiementfourn.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/salary.class.php';
40
-require_once DOL_DOCUMENT_ROOT . '/salaries/class/paymentsalary.class.php';
41
-require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
42
-require_once DOL_DOCUMENT_ROOT . '/user/class/userbankaccount.class.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
34
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
40
+require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php';
41
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/user/class/userbankaccount.class.php';
43 43
 
44 44
 
45 45
 /**
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 	const STATUS_DRAFT = 0;
106 106
 	const STATUS_TRANSFERED = 1;
107
-	const STATUS_CREDITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
-	const STATUS_DEBITED = 2;		// STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
107
+	const STATUS_CREDITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
108
+	const STATUS_DEBITED = 2; // STATUS_CREDITED and STATUS_DEBITED is same. Difference is in ->type
109 109
 
110 110
 
111 111
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 
259 259
 		if ($result == 0) {
260 260
 			if ($line_id > 0) {
261
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement (";
261
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement (";
262 262
 				if ($type != 'bank-transfer') {
263 263
 					$sql .= "fk_facture";
264 264
 				} else {
@@ -271,24 +271,24 @@  discard block
 block discarded – undo
271 271
 				$sql .= ",fk_prelevement_lignes";
272 272
 				$sql .= ") VALUES (";
273 273
 				$sql .= ((int) $invoice_id);
274
-				$sql .= ", " . ((int) $line_id);
274
+				$sql .= ", ".((int) $line_id);
275 275
 				$sql .= ")";
276 276
 
277 277
 				if ($this->db->query($sql)) {
278 278
 					$result = 0;
279 279
 				} else {
280 280
 					$result = -1;
281
-					$this->errors[] = get_class($this) . "::AddFacture " . $this->db->lasterror;
282
-					dol_syslog(get_class($this) . "::AddFacture Error $result");
281
+					$this->errors[] = get_class($this)."::AddFacture ".$this->db->lasterror;
282
+					dol_syslog(get_class($this)."::AddFacture Error $result");
283 283
 				}
284 284
 			} else {
285 285
 				$result = -2;
286
-				$this->errors[] = get_class($this) . "::AddFacture linedid Empty";
287
-				dol_syslog(get_class($this) . "::AddFacture Error $result");
286
+				$this->errors[] = get_class($this)."::AddFacture linedid Empty";
287
+				dol_syslog(get_class($this)."::AddFacture Error $result");
288 288
 			}
289 289
 		} else {
290 290
 			$result = -3;
291
-			dol_syslog(get_class($this) . "::AddFacture Error $result");
291
+			dol_syslog(get_class($this)."::AddFacture Error $result");
292 292
 		}
293 293
 
294 294
 		return $result;
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
 	public function addline(&$line_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key, $sourcetype = '')
312 312
 	{
313 313
 		$result = -1;
314
-		$concat = 0;	// ??? what is this for. Seems not used.
314
+		$concat = 0; // ??? what is this for. Seems not used.
315 315
 
316 316
 		if ($concat == 1) {
317 317
 			/*
318 318
 			 * We aggregate the lines
319 319
 			 */
320 320
 			$sql = "SELECT rowid";
321
-			$sql .= " FROM  " . MAIN_DB_PREFIX . "prelevement_lignes";
322
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
321
+			$sql .= " FROM  ".MAIN_DB_PREFIX."prelevement_lignes";
322
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
323 323
 			if ($sourcetype == 'salary') {
324
-				$sql .= " AND fk_soc = " . ((int) $client_id);
324
+				$sql .= " AND fk_soc = ".((int) $client_id);
325 325
 			} else {
326
-				$sql .= " AND fk_user = " . ((int) $client_id);
326
+				$sql .= " AND fk_user = ".((int) $client_id);
327 327
 			}
328
-			$sql .= " AND code_banque = '" . $this->db->escape($code_banque) . "'";
329
-			$sql .= " AND code_guichet = '" . $this->db->escape($code_guichet) . "'";
330
-			$sql .= " AND number = '" . $this->db->escape($number) . "'";
328
+			$sql .= " AND code_banque = '".$this->db->escape($code_banque)."'";
329
+			$sql .= " AND code_guichet = '".$this->db->escape($code_guichet)."'";
330
+			$sql .= " AND number = '".$this->db->escape($number)."'";
331 331
 
332 332
 			$resql = $this->db->query($sql);
333 333
 			if ($resql) {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 			/*
340 340
 			 * No aggregate
341 341
 			 */
342
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_lignes (";
342
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_lignes (";
343 343
 			$sql .= "fk_prelevement_bons";
344 344
 			$sql .= ", fk_soc";
345 345
 			$sql .= ", client_nom";
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
 			$sql .= ($sourcetype == 'salary' ? ", fk_user" : "");
352 352
 			$sql .= ") VALUES (";
353 353
 			$sql .= $this->id;
354
-			$sql .= ", " . (($sourcetype != 'salary') ? ((int) $client_id) : "0");	// fk_soc can't be null
355
-			$sql .= ", '" . $this->db->escape($client_nom) . "'";
356
-			$sql .= ", " . ((float) price2num($amount));
357
-			$sql .= ", '" . $this->db->escape($code_banque) . "'";
358
-			$sql .= ", '" . $this->db->escape($code_guichet) . "'";
359
-			$sql .= ", '" . $this->db->escape($number) . "'";
360
-			$sql .= ", '" . $this->db->escape($number_key) . "'";
361
-			$sql .= (($sourcetype == 'salary') ? ", " . ((int) $client_id) : '');
354
+			$sql .= ", ".(($sourcetype != 'salary') ? ((int) $client_id) : "0"); // fk_soc can't be null
355
+			$sql .= ", '".$this->db->escape($client_nom)."'";
356
+			$sql .= ", ".((float) price2num($amount));
357
+			$sql .= ", '".$this->db->escape($code_banque)."'";
358
+			$sql .= ", '".$this->db->escape($code_guichet)."'";
359
+			$sql .= ", '".$this->db->escape($number)."'";
360
+			$sql .= ", '".$this->db->escape($number_key)."'";
361
+			$sql .= (($sourcetype == 'salary') ? ", ".((int) $client_id) : '');
362 362
 			$sql .= ")";
363 363
 			if ($this->db->query($sql)) {
364
-				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_lignes");
364
+				$line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes");
365 365
 				$result = 0;
366 366
 			} else {
367
-				$this->errors[] = get_class($this) . "::addline Error -2 " . $this->db->lasterror;
368
-				dol_syslog(get_class($this) . "::addline Error -2");
367
+				$this->errors[] = get_class($this)."::addline Error -2 ".$this->db->lasterror;
368
+				dol_syslog(get_class($this)."::addline Error -2");
369 369
 				$result = -2;
370 370
 			}
371 371
 		}
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		$sql .= ", p.type";
409 409
 		$sql .= ", p.fk_bank_account";
410 410
 		$sql .= ", p.statut as status";
411
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as p";
412
-		$sql .= " WHERE p.entity IN (" . getEntity('invoice') . ")";
411
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
412
+		$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
413 413
 		if ($rowid > 0) {
414
-			$sql .= " AND p.rowid = " . ((int) $rowid);
414
+			$sql .= " AND p.rowid = ".((int) $rowid);
415 415
 		} else {
416
-			$sql .= " AND p.ref = '" . $this->db->escape($ref) . "'";
416
+			$sql .= " AND p.ref = '".$this->db->escape($ref)."'";
417 417
 		}
418 418
 
419
-		dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
419
+		dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
420 420
 		$result = $this->db->query($sql);
421 421
 		if ($result) {
422 422
 			if ($this->db->num_rows($result)) {
@@ -442,13 +442,13 @@  discard block
 block discarded – undo
442 442
 				if (empty($this->status)) {		// Value is sometimes null in database
443 443
 					$this->status = 0;
444 444
 				}
445
-				$this->statut         = $this->status; // For backward compatibility
445
+				$this->statut = $this->status; // For backward compatibility
446 446
 
447 447
 				$this->fetched = 1;
448 448
 
449 449
 				return 1;
450 450
 			} else {
451
-				dol_syslog(get_class($this) . "::Fetch Erreur aucune ligne retournee");
451
+				dol_syslog(get_class($this)."::Fetch Erreur aucune ligne retournee");
452 452
 				return -1;
453 453
 			}
454 454
 		} else {
@@ -489,19 +489,19 @@  discard block
 block discarded – undo
489 489
 			if ($date < $this->date_trans) {
490 490
 				$langs->load("errors");
491 491
 				$this->error = $langs->trans('ErrorDateOfMovementLowerThanDateOfFileTransmission');
492
-				dol_syslog("bon-prelevment::set_infocredit 1027 " . $this->error);
492
+				dol_syslog("bon-prelevment::set_infocredit 1027 ".$this->error);
493 493
 				return -1027;
494 494
 			}
495 495
 
496 496
 			$this->db->begin();
497 497
 
498
-			$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
499
-			$sql .= " SET fk_user_credit = " . ((int) $user->id);
500
-			$sql .= ", statut = " . self::STATUS_CREDITED;
501
-			$sql .= ", date_credit = '" . $this->db->idate($date) . "'";
502
-			$sql .= " WHERE rowid = " . ((int) $this->id);
503
-			$sql .= " AND entity = " . ((int) $conf->entity);
504
-			$sql .= " AND statut = " . self::STATUS_TRANSFERED;
498
+			$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
499
+			$sql .= " SET fk_user_credit = ".((int) $user->id);
500
+			$sql .= ", statut = ".self::STATUS_CREDITED;
501
+			$sql .= ", date_credit = '".$this->db->idate($date)."'";
502
+			$sql .= " WHERE rowid = ".((int) $this->id);
503
+			$sql .= " AND entity = ".((int) $conf->entity);
504
+			$sql .= " AND statut = ".self::STATUS_TRANSFERED;
505 505
 
506 506
 			$resql = $this->db->query($sql);
507 507
 			if ($resql) {
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 						$error++;
617 617
 						$this->error = $paiement->error;
618 618
 						$this->errors = $paiement->errors;
619
-						dol_syslog(get_class($this) . "::set_infocredit AddPayment Error " . $this->error);
619
+						dol_syslog(get_class($this)."::set_infocredit AddPayment Error ".$this->error);
620 620
 					} else {
621 621
 						if ($this->type == 'bank-transfer') {
622 622
 							if ($type == 'salary') {
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 						} else {
632 632
 							$modeforaddpayment = 'payment';
633 633
 							$labelforaddpayment = '(CustomerInvoicePayment)';
634
-							$addbankurl = 'direct-debit';	// = 'directdebit'
634
+							$addbankurl = 'direct-debit'; // = 'directdebit'
635 635
 						}
636 636
 
637 637
 						$result = $paiement->addPaymentToBank($user, $modeforaddpayment, $labelforaddpayment, $fk_bank_account, '', '', 0, '', $addbankurl);
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 							$error++;
641 641
 							$this->error = $paiement->error;
642 642
 							$this->errors = $paiement->errors;
643
-							dol_syslog(get_class($this) . "::set_infocredit AddPaymentToBank Error " . $this->error);
643
+							dol_syslog(get_class($this)."::set_infocredit AddPaymentToBank Error ".$this->error);
644 644
 						}
645 645
 					}
646 646
 				}
@@ -648,24 +648,24 @@  discard block
 block discarded – undo
648 648
 				// Update withdrawal line
649 649
 				// TODO: Translate to ligneprelevement.class.php
650 650
 				if (!$error) {
651
-					$sql = " UPDATE " . MAIN_DB_PREFIX . "prelevement_lignes";
651
+					$sql = " UPDATE ".MAIN_DB_PREFIX."prelevement_lignes";
652 652
 					$sql .= " SET statut = 2";
653
-					$sql .= " WHERE fk_prelevement_bons = " . ((int) $this->id);
653
+					$sql .= " WHERE fk_prelevement_bons = ".((int) $this->id);
654 654
 
655 655
 					if (!$this->db->query($sql)) {
656
-						dol_syslog(get_class($this) . "::set_infocredit Update lines Error");
656
+						dol_syslog(get_class($this)."::set_infocredit Update lines Error");
657 657
 						$error++;
658 658
 					}
659 659
 				}
660 660
 			} else {
661 661
 				$this->error = $this->db->lasterror();
662
-				dol_syslog(get_class($this) . "::set_infocredit Update Bons Error");
662
+				dol_syslog(get_class($this)."::set_infocredit Update Bons Error");
663 663
 				$error++;
664 664
 			}
665 665
 
666 666
 			// End of procedure
667 667
 			if ($error == 0) {
668
-				$this->date_credit = $date;		// date credit or debit
668
+				$this->date_credit = $date; // date credit or debit
669 669
 				$this->statut = self::STATUS_CREDITED;
670 670
 				$this->status = self::STATUS_CREDITED;
671 671
 
@@ -696,17 +696,17 @@  discard block
 block discarded – undo
696 696
 
697 697
 		$error = 0;
698 698
 
699
-		dol_syslog(get_class($this) . "::set_infotrans Start", LOG_INFO);
699
+		dol_syslog(get_class($this)."::set_infotrans Start", LOG_INFO);
700 700
 
701 701
 		if ($this->db->begin()) {
702
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons ";
703
-			$sql .= " SET fk_user_trans = " . $user->id;
704
-			$sql .= " , date_trans = '" . $this->db->idate($date) . "'";
705
-			$sql .= " , method_trans = " . ((int) $method);
706
-			$sql .= " , statut = " . self::STATUS_TRANSFERED;
707
-			$sql .= " WHERE rowid = " . ((int) $this->id);
708
-			$sql .= " AND entity = " . ((int) $conf->entity);
709
-			$sql .= " AND statut = " . self::STATUS_DRAFT;
702
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons ";
703
+			$sql .= " SET fk_user_trans = ".$user->id;
704
+			$sql .= " , date_trans = '".$this->db->idate($date)."'";
705
+			$sql .= " , method_trans = ".((int) $method);
706
+			$sql .= " , statut = ".self::STATUS_TRANSFERED;
707
+			$sql .= " WHERE rowid = ".((int) $this->id);
708
+			$sql .= " AND entity = ".((int) $conf->entity);
709
+			$sql .= " AND statut = ".self::STATUS_DRAFT;
710 710
 
711 711
 			if ($this->db->query($sql)) {
712 712
 				$this->method_trans = $method;
@@ -731,12 +731,12 @@  discard block
 block discarded – undo
731 731
 				return 0;
732 732
 			} else {
733 733
 				$this->db->rollback();
734
-				dol_syslog(get_class($this) . "::set_infotrans ROLLBACK", LOG_ERR);
734
+				dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR);
735 735
 
736 736
 				return -1;
737 737
 			}
738 738
 		} else {
739
-			dol_syslog(get_class($this) . "::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
739
+			dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT);
740 740
 			return -2;
741 741
 		}
742 742
 	}
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
 
755 755
 		$arr = array();
756 756
 
757
-		dol_syslog(get_class($this) . "::getListInvoices");
757
+		dol_syslog(get_class($this)."::getListInvoices");
758 758
 
759 759
 		// Returns all invoices presented within same order
760 760
 		$sql = "SELECT ";
@@ -770,13 +770,13 @@  discard block
 block discarded – undo
770 770
 		if ($amounts) {
771 771
 			$sql .= ", SUM(pl.amount)";
772 772
 		}
773
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb,";
774
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
775
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
773
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb,";
774
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
775
+		$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
776 776
 		$sql .= " WHERE p.fk_prelevement_lignes = pl.rowid";
777 777
 		$sql .= " AND pl.fk_prelevement_bons = pb.rowid";
778
-		$sql .= " AND pb.rowid = " . ((int) $this->id);
779
-		$sql .= " AND pb.entity = " . ((int) $conf->entity);
778
+		$sql .= " AND pb.rowid = ".((int) $this->id);
779
+		$sql .= " AND pb.entity = ".((int) $conf->entity);
780 780
 		if ($amounts) {
781 781
 			if ($this->type == 'bank-transfer') {
782 782
 				if ($type == 'salary') {
@@ -830,17 +830,17 @@  discard block
 block discarded – undo
830 830
 		$sql = "SELECT sum(pd.amount) as nb";
831 831
 		if ($type !== 'salary') {
832 832
 			if ($mode != 'bank-transfer') {
833
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f,";
833
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
834 834
 			} else {
835
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f,";
835
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
836 836
 			}
837 837
 		} else {
838
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s,";
838
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s,";
839 839
 		}
840
-		$sql .= " " . MAIN_DB_PREFIX . "prelevement_demande as pd";
841
-		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (" . getEntity('invoice') . ")" : " WHERE s.entity IN (" . getEntity('salary') . ")");
840
+		$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pd";
841
+		$sql .= ($type !== 'salary' ? " WHERE f.entity IN (".getEntity('invoice').")" : " WHERE s.entity IN (".getEntity('salary').")");
842 842
 		if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
843
-			$sql .= ($type !== 'salary' ? " AND f.fk_statut = " . Facture::STATUS_VALIDATED : " AND s.paye = " . Salary::STATUS_UNPAID);
843
+			$sql .= ($type !== 'salary' ? " AND f.fk_statut = ".Facture::STATUS_VALIDATED : " AND s.paye = ".Salary::STATUS_UNPAID);
844 844
 		}
845 845
 		if ($type !== 'salary') {
846 846
 			if ($mode != 'bank-transfer') {
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
 			return $obj->nb;
866 866
 		} else {
867 867
 			$error = 1;
868
-			dol_syslog(get_class($this) . "::SommeAPrelever Erreur -1");
868
+			dol_syslog(get_class($this)."::SommeAPrelever Erreur -1");
869 869
 			dol_syslog($this->db->error());
870 870
 
871 871
 			return -1;
@@ -901,26 +901,26 @@  discard block
 block discarded – undo
901 901
 		// phpcs:enable
902 902
 		if ($forsalary == 1) {
903 903
 			$sql = "SELECT count(s.rowid) as nb";
904
-			$sql .= " FROM " . MAIN_DB_PREFIX . "salary as s";
904
+			$sql .= " FROM ".MAIN_DB_PREFIX."salary as s";
905 905
 		} else {
906 906
 			$sql = "SELECT count(f.rowid) as nb";
907 907
 
908 908
 			if ($type == 'bank-transfer') {
909
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
909
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
910 910
 			} else {
911
-				$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
911
+				$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
912 912
 			}
913 913
 		}
914
-		$sql .= ", " . MAIN_DB_PREFIX . "prelevement_demande as pd";
914
+		$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pd";
915 915
 		if ($forsalary == 1) {
916
-			$sql .= " WHERE s.entity IN (" . getEntity('invoice') . ")";
916
+			$sql .= " WHERE s.entity IN (".getEntity('invoice').")";
917 917
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
918 918
 				$sql .= " AND s.paye = 0";
919 919
 			}
920 920
 		} else {
921
-			$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ")";
921
+			$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
922 922
 			if (!getDolGlobalString('WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS')) {
923
-				$sql .= " AND f.fk_statut = " . Facture::STATUS_VALIDATED;
923
+				$sql .= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
924 924
 			}
925 925
 		}
926 926
 		if ($forsalary == 1) {
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 			$sql .= " AND s.paye = 0";
941 941
 		}
942 942
 
943
-		dol_syslog(get_class($this) . "::NbFactureAPrelever");
943
+		dol_syslog(get_class($this)."::NbFactureAPrelever");
944 944
 		$resql = $this->db->query($sql);
945 945
 
946 946
 		if ($resql) {
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 
950 950
 			return $obj->nb;
951 951
 		} else {
952
-			$this->error = get_class($this) . "::NbFactureAPrelever Erreur -1 sql=" . $this->db->error();
952
+			$this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error();
953 953
 			return -1;
954 954
 		}
955 955
 	}
@@ -981,10 +981,10 @@  discard block
 block discarded – undo
981 981
 		// phpcs:enable
982 982
 		global $conf, $langs, $user;
983 983
 
984
-		dol_syslog(__METHOD__ . " Bank=" . $banque . " Office=" . $agence . " mode=" . $mode . " format=" . $format, LOG_DEBUG);
984
+		dol_syslog(__METHOD__." Bank=".$banque." Office=".$agence." mode=".$mode." format=".$format, LOG_DEBUG);
985 985
 
986
-		require_once DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php";
987
-		require_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
986
+		require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php";
987
+		require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
988 988
 
989 989
 		// Check params
990 990
 		if ($type != 'bank-transfer') {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 		$factures_prev_id = array();
1021 1021
 		$factures_errors = array();
1022 1022
 		if (!$error) {
1023
-			dol_syslog(__METHOD__ . " Read invoices for did=" . ((int) $did), LOG_DEBUG);
1023
+			dol_syslog(__METHOD__." Read invoices for did=".((int) $did), LOG_DEBUG);
1024 1024
 
1025 1025
 			$sql = "SELECT f.rowid, pd.rowid as pfdrowid";
1026 1026
 			if ($sourcetype != 'salary') {
@@ -1039,28 +1039,28 @@  discard block
 block discarded – undo
1039 1039
 			}
1040 1040
 			if ($sourcetype != 'salary') {
1041 1041
 				if ($type != 'bank-transfer') {
1042
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f";
1043
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture";
1042
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
1043
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture";
1044 1044
 				} else {
1045
-					$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn as f";
1046
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1045
+					$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
1046
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_facture_fourn";
1047 1047
 				}
1048
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON s.rowid = f.fk_soc";
1049
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1048
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc";
1049
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_rib as sr ON s.rowid = sr.fk_soc AND sr.default_rib = 1";
1050 1050
 			} else {
1051
-				$sql .= " FROM " . MAIN_DB_PREFIX . "salary as f";
1052
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "prelevement_demande as pd ON f.rowid = pd.fk_salary";
1053
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user as s ON s.rowid = f.fk_user";
1054
-				$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "user_rib as sr ON s.rowid = sr.fk_user";	// TODO Add AND sr.default_rib = 1 here
1051
+				$sql .= " FROM ".MAIN_DB_PREFIX."salary as f";
1052
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."prelevement_demande as pd ON f.rowid = pd.fk_salary";
1053
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as s ON s.rowid = f.fk_user";
1054
+				$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user_rib as sr ON s.rowid = sr.fk_user"; // TODO Add AND sr.default_rib = 1 here
1055 1055
 			}
1056 1056
 			if ($sourcetype != 'salary') {
1057 1057
 				if ($type != 'bank-transfer') {
1058
-					$sql .= " WHERE f.entity IN (" . getEntity('invoice') . ')';
1058
+					$sql .= " WHERE f.entity IN (".getEntity('invoice').')';
1059 1059
 				} else {
1060
-					$sql .= " WHERE f.entity IN (" . getEntity('supplier_invoice') . ')';
1060
+					$sql .= " WHERE f.entity IN (".getEntity('supplier_invoice').')';
1061 1061
 				}
1062 1062
 			} else {
1063
-				$sql .= " WHERE f.entity IN (" . getEntity('salary') . ')';
1063
+				$sql .= " WHERE f.entity IN (".getEntity('salary').')';
1064 1064
 			}
1065 1065
 			if ($sourcetype != 'salary') {
1066 1066
 				$sql .= " AND f.fk_statut = 1"; // Invoice validated
@@ -1074,10 +1074,10 @@  discard block
 block discarded – undo
1074 1074
 			$sql .= " AND pd.traite = 0";
1075 1075
 			$sql .= " AND pd.ext_payment_id IS NULL";
1076 1076
 			if ($sourcetype != 'salary') {
1077
-				$sql .= " AND sr.type = 'ban'";		// TODO Add AND sr.type = 'ban' for users too
1077
+				$sql .= " AND sr.type = 'ban'"; // TODO Add AND sr.type = 'ban' for users too
1078 1078
 			}
1079 1079
 			if ($did > 0) {
1080
-				$sql .= " AND pd.rowid = " . ((int) $did);
1080
+				$sql .= " AND pd.rowid = ".((int) $did);
1081 1081
 			}
1082 1082
 
1083 1083
 			$resql = $this->db->query($sql);
@@ -1086,41 +1086,41 @@  discard block
 block discarded – undo
1086 1086
 				$i = 0;
1087 1087
 
1088 1088
 				while ($i < $num) {
1089
-					$row = $this->db->fetch_row($resql);	// TODO Replace with fetch_object()
1089
+					$row = $this->db->fetch_row($resql); // TODO Replace with fetch_object()
1090 1090
 					$factures[$i] = $row; // All fields
1091 1091
 
1092 1092
 					if ($row[7] == 0) {
1093 1093
 						$error++;
1094
-						dol_syslog(__METHOD__ . " Read invoices/salary error Found a null amount", LOG_ERR);
1095
-						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id " . $row[0] . ", found a null amount";
1094
+						dol_syslog(__METHOD__." Read invoices/salary error Found a null amount", LOG_ERR);
1095
+						$this->invoice_in_error[$row[0]] = "Error for invoice or salary id ".$row[0].", found a null amount";
1096 1096
 						break;
1097 1097
 					}
1098 1098
 					$i++;
1099 1099
 				}
1100 1100
 
1101 1101
 				$this->db->free($resql);
1102
-				dol_syslog(__METHOD__ . " Read invoices/salary, " . $i . " invoices/salary to withdraw", LOG_DEBUG);
1102
+				dol_syslog(__METHOD__." Read invoices/salary, ".$i." invoices/salary to withdraw", LOG_DEBUG);
1103 1103
 			} else {
1104 1104
 				$error++;
1105 1105
 				$this->error = $this->db->lasterror();
1106
-				dol_syslog(__METHOD__ . " Read invoices/salary error " . $this->db->lasterror(), LOG_ERR);
1106
+				dol_syslog(__METHOD__." Read invoices/salary error ".$this->db->lasterror(), LOG_ERR);
1107 1107
 				return -1;
1108 1108
 			}
1109 1109
 		}
1110 1110
 
1111 1111
 		if (!$error) {
1112 1112
 			// Make some checks
1113
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
1114
-			require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1115
-			require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php';
1116
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
1113
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
1114
+			require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1115
+			require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
1116
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
1117 1117
 
1118 1118
 			$tmpsoc = new Societe($this->db);
1119 1119
 			$tmpuser = new User($this->db);
1120 1120
 
1121 1121
 			// Check BAN
1122 1122
 			$i = 0;
1123
-			dol_syslog(__METHOD__ . " Check BAN", LOG_DEBUG);
1123
+			dol_syslog(__METHOD__." Check BAN", LOG_DEBUG);
1124 1124
 
1125 1125
 			if (count($factures) > 0) {
1126 1126
 				foreach ($factures as $key => $fac) {
@@ -1160,31 +1160,31 @@  discard block
 block discarded – undo
1160 1160
 							if ($type != 'bank-transfer') {
1161 1161
 								$tmpsoc->id = $fac[2];
1162 1162
 								$tmpsoc->name = $fac[8];
1163
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/compta/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1164
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1165
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1163
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/compta/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1164
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1165
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1166 1166
 								$error++;
1167 1167
 							}
1168 1168
 							if ($type == 'bank-transfer' && $sourcetype != 'salary') {
1169 1169
 								$tmpsoc->id = $fac[2];
1170 1170
 								$tmpsoc->name = $fac[8];
1171
-								$invoice_url = "<a href='" . DOL_URL_ROOT . '/fourn/facture/card.php?facid=' . $fac[0] . "'>" . $fac[9] . "</a>";
1172
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1173
-								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice " . $invoice_url . " for thirdparty " . $tmpsoc->getNomUrl(0);
1171
+								$invoice_url = "<a href='".DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$fac[0]."'>".$fac[9]."</a>";
1172
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1173
+								$this->thirdparty_in_error[$tmpsoc->id] = "Error on default bank number IBAN/BIC for invoice ".$invoice_url." for thirdparty ".$tmpsoc->getNomUrl(0);
1174 1174
 								$error++;
1175 1175
 							}
1176 1176
 							if ($type == 'bank-transfer' && $sourcetype == 'salary') {
1177 1177
 								$tmpuser->id = $fac[2];
1178 1178
 								$tmpuser->firstname = $fac[8];
1179
-								$salary_url = "<a href='" . DOL_URL_ROOT . '/salaries/card.php?id=' . $fac[0] . "'>" . $fac[0] . "</a>";
1180
-								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1181
-								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary " . $salary_url . " for employee " . $tmpuser->getNomUrl(0);
1179
+								$salary_url = "<a href='".DOL_URL_ROOT.'/salaries/card.php?id='.$fac[0]."'>".$fac[0]."</a>";
1180
+								$this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1181
+								$this->thirdparty_in_error[$tmpuser->id] = "Error on default bank number IBAN/BIC for salary ".$salary_url." for employee ".$tmpuser->getNomUrl(0);
1182 1182
 								$error++;
1183 1183
 							}
1184
-							dol_syslog(__METHOD__ . " Check BAN Error on default bank number IBAN/BIC reported by verif(): " . implode(', ', $fac), LOG_WARNING);
1184
+							dol_syslog(__METHOD__." Check BAN Error on default bank number IBAN/BIC reported by verif(): ".implode(', ', $fac), LOG_WARNING);
1185 1185
 						}
1186 1186
 					} else {
1187
-						dol_syslog(__METHOD__ . " Check BAN Failed to read company", LOG_WARNING);
1187
+						dol_syslog(__METHOD__." Check BAN Failed to read company", LOG_WARNING);
1188 1188
 					}
1189 1189
 					/*
1190 1190
 					} else {
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 					*/
1194 1194
 				}
1195 1195
 			} else {
1196
-				dol_syslog(__METHOD__ . " Check BAN No invoice to process", LOG_WARNING);
1196
+				dol_syslog(__METHOD__." Check BAN No invoice to process", LOG_WARNING);
1197 1197
 			}
1198 1198
 		}
1199 1199
 
1200 1200
 		$ok = 0;
1201 1201
 
1202 1202
 		// Withdraw invoices in factures_prev array
1203
-		$out = count($factures_prev) . " invoices will be included.";
1203
+		$out = count($factures_prev)." invoices will be included.";
1204 1204
 		//print $out."\n";
1205 1205
 		dol_syslog($out);
1206 1206
 
@@ -1234,32 +1234,32 @@  discard block
 block discarded – undo
1234 1234
 			 * Process order generation
1235 1235
 			 */
1236 1236
 			if (!$error) {
1237
-				$ref = substr($year, -2) . $month;
1237
+				$ref = substr($year, -2).$month;
1238 1238
 
1239 1239
 				// Get next free number for the ref of bon prelevement
1240
-				$sql = "SELECT substring(ref from char_length(ref) - 1)";	// To extract "YYMMXX" from "TYYMMXX"
1241
-				$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons";
1242
-				$sql .= " WHERE ref LIKE '_" . $this->db->escape($ref) . "%'";
1243
-				$sql .= " AND entity = " . ((int) $conf->entity);
1240
+				$sql = "SELECT substring(ref from char_length(ref) - 1)"; // To extract "YYMMXX" from "TYYMMXX"
1241
+				$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons";
1242
+				$sql .= " WHERE ref LIKE '_".$this->db->escape($ref)."%'";
1243
+				$sql .= " AND entity = ".((int) $conf->entity);
1244 1244
 				$sql .= " ORDER BY ref DESC LIMIT 1";
1245 1245
 
1246
-				dol_syslog(get_class($this) . " get next free number", LOG_DEBUG);
1246
+				dol_syslog(get_class($this)." get next free number", LOG_DEBUG);
1247 1247
 				$resql = $this->db->query($sql);
1248 1248
 
1249 1249
 				if ($resql) {
1250 1250
 					$row = $this->db->fetch_row($resql);
1251 1251
 
1252 1252
 					// Build the new ref
1253
-					$ref = "T" . $ref . sprintf("%02d", (intval($row[0]) + 1));
1253
+					$ref = "T".$ref.sprintf("%02d", (intval($row[0]) + 1));
1254 1254
 
1255 1255
 					// $conf->abc->dir_output may be:
1256 1256
 					// /home/ldestailleur/git/dolibarr_15.0/documents/abc/
1257 1257
 					// or
1258 1258
 					// /home/ldestailleur/git/dolibarr_15.0/documents/X/abc with X >= 2 with multicompany.
1259 1259
 					if ($type != 'bank-transfer') {
1260
-						$dir = $conf->prelevement->dir_output . '/receipts';
1260
+						$dir = $conf->prelevement->dir_output.'/receipts';
1261 1261
 					} else {
1262
-						$dir = $conf->paymentbybanktransfer->dir_output . '/receipts';
1262
+						$dir = $conf->paymentbybanktransfer->dir_output.'/receipts';
1263 1263
 					}
1264 1264
 					if (!is_dir($dir)) {
1265 1265
 						dol_mkdir($dir);
@@ -1267,41 +1267,41 @@  discard block
 block discarded – undo
1267 1267
 
1268 1268
 					if (isModEnabled('multicompany')) {
1269 1269
 						$labelentity = $conf->entity;
1270
-						$this->filename = $dir . '/' . $ref . '-' . $labelentity . '.xml';
1270
+						$this->filename = $dir.'/'.$ref.'-'.$labelentity.'.xml';
1271 1271
 					} else {
1272
-						$this->filename = $dir . '/' . $ref . '.xml';
1272
+						$this->filename = $dir.'/'.$ref.'.xml';
1273 1273
 					}
1274 1274
 
1275 1275
 					// Create withdraw order in database
1276
-					$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_bons (";
1276
+					$sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_bons (";
1277 1277
 					$sql .= "ref, entity, datec, type, fk_bank_account";
1278 1278
 					$sql .= ") VALUES (";
1279
-					$sql .= "'" . $this->db->escape($ref) . "'";
1280
-					$sql .= ", " . ((int) $conf->entity);
1281
-					$sql .= ", '" . $this->db->idate($now) . "'";
1282
-					$sql .= ", '" . ($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order') . "'";
1283
-					$sql .= ", " . ((int) $fk_bank_account);
1279
+					$sql .= "'".$this->db->escape($ref)."'";
1280
+					$sql .= ", ".((int) $conf->entity);
1281
+					$sql .= ", '".$this->db->idate($now)."'";
1282
+					$sql .= ", '".($type == 'bank-transfer' ? 'bank-transfer' : 'debit-order')."'";
1283
+					$sql .= ", ".((int) $fk_bank_account);
1284 1284
 					$sql .= ")";
1285 1285
 
1286 1286
 					$resql = $this->db->query($sql);
1287 1287
 
1288 1288
 
1289 1289
 					if ($resql) {
1290
-						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "prelevement_bons");
1290
+						$prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons");
1291 1291
 						$this->id = $prev_id;
1292 1292
 						$this->ref = $ref;
1293 1293
 					} else {
1294 1294
 						$error++;
1295
-						dol_syslog(__METHOD__ . " Create withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1295
+						dol_syslog(__METHOD__." Create withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1296 1296
 					}
1297 1297
 				} else {
1298 1298
 					$error++;
1299
-					dol_syslog(__METHOD__ . " Get last withdraw receipt " . $this->db->lasterror(), LOG_ERR);
1299
+					dol_syslog(__METHOD__." Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR);
1300 1300
 				}
1301 1301
 			}
1302 1302
 
1303 1303
 			if (!$error) {
1304
-				dol_syslog(__METHOD__ . " Now loop on each document to insert them in llx_prelevement_demande");
1304
+				dol_syslog(__METHOD__." Now loop on each document to insert them in llx_prelevement_demande");
1305 1305
 
1306 1306
 				// Add lines for the bon
1307 1307
 				if (count($factures_prev) > 0) {
@@ -1330,17 +1330,17 @@  discard block
 block discarded – undo
1330 1330
 						}
1331 1331
 
1332 1332
 						// Update invoice requests as done
1333
-						$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande";
1333
+						$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande";
1334 1334
 						$sql .= " SET traite = 1";
1335
-						$sql .= ", date_traite = '" . $this->db->idate($now) . "'";
1336
-						$sql .= ", fk_prelevement_bons = " . ((int) $this->id);
1337
-						$sql .= " WHERE rowid = " . ((int) $fac[1]);
1335
+						$sql .= ", date_traite = '".$this->db->idate($now)."'";
1336
+						$sql .= ", fk_prelevement_bons = ".((int) $this->id);
1337
+						$sql .= " WHERE rowid = ".((int) $fac[1]);
1338 1338
 
1339 1339
 						$resql = $this->db->query($sql);
1340 1340
 						if (!$resql) {
1341 1341
 							$error++;
1342 1342
 							$this->errors[] = $this->db->lasterror();
1343
-							dol_syslog(__METHOD__ . " Update Error=" . $this->db->lasterror(), LOG_ERR);
1343
+							dol_syslog(__METHOD__." Update Error=".$this->db->lasterror(), LOG_ERR);
1344 1344
 						}
1345 1345
 					}
1346 1346
 				}
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
 				 * Create file of type='direct-debit' for direct debit order or type='bank-transfer' for credit transfer into a XML file
1352 1352
 				 */
1353 1353
 
1354
-				dol_syslog(__METHOD__ . " Init direct debit or credit transfer file for " . count($factures_prev) . " invoices", LOG_DEBUG);
1354
+				dol_syslog(__METHOD__." Init direct debit or credit transfer file for ".count($factures_prev)." invoices", LOG_DEBUG);
1355 1355
 
1356 1356
 				if (count($factures_prev) > 0) {
1357 1357
 					$this->date_echeance = $datetimeprev;
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 						$this->emetteur_iban               = $account->iban;
1368 1368
 						$this->emetteur_bic                = $account->bic;
1369 1369
 
1370
-						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);	// Example "FR78ZZZ123456"
1370
+						$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Example "FR78ZZZ123456"
1371 1371
 
1372 1372
 						$this->raison_sociale = $account->proprio;
1373 1373
 					}
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 						$error++;
1387 1387
 					}
1388 1388
 				}
1389
-				dol_syslog(__METHOD__ . " Bank order file has been generated under filename " . $this->filename, LOG_DEBUG);
1389
+				dol_syslog(__METHOD__." Bank order file has been generated under filename ".$this->filename, LOG_DEBUG);
1390 1390
 			}
1391 1391
 
1392 1392
 
@@ -1394,15 +1394,15 @@  discard block
 block discarded – undo
1394 1394
 			 * Update total defined after generation of file
1395 1395
 			 */
1396 1396
 			if (!$error) {
1397
-				$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_bons";
1398
-				$sql .= " SET amount = " . price2num($this->total);
1399
-				$sql .= " WHERE rowid = " . ((int) $this->id);
1400
-				$sql .= " AND entity = " . ((int) $conf->entity);
1397
+				$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_bons";
1398
+				$sql .= " SET amount = ".price2num($this->total);
1399
+				$sql .= " WHERE rowid = ".((int) $this->id);
1400
+				$sql .= " AND entity = ".((int) $conf->entity);
1401 1401
 				$resql = $this->db->query($sql);
1402 1402
 
1403 1403
 				if (!$resql) {
1404 1404
 					$error++;
1405
-					dol_syslog(__METHOD__ . " Error update total: " . $this->db->error(), LOG_ERR);
1405
+					dol_syslog(__METHOD__." Error update total: ".$this->db->error(), LOG_ERR);
1406 1406
 				}
1407 1407
 			}
1408 1408
 
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 
1423 1423
 			if (!$error) {
1424 1424
 				$this->db->commit();
1425
-				return count($factures_prev);	// The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1425
+				return count($factures_prev); // The error of failed lines are into $this->invoice_in_error and $this->thirdparty_in_error
1426 1426
 			} else {
1427 1427
 				$this->db->rollback();
1428 1428
 				return -1;
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 		}
1462 1462
 
1463 1463
 		if (!$error) {
1464
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id) . ")";
1464
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id).")";
1465 1465
 			$resql1 = $this->db->query($sql);
1466 1466
 			if (!$resql1) {
1467 1467
 				dol_print_error($this->db);
@@ -1469,7 +1469,7 @@  discard block
 block discarded – undo
1469 1469
 		}
1470 1470
 
1471 1471
 		if (!$error) {
1472
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_lignes WHERE fk_prelevement_bons = " . ((int) $this->id);
1472
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".((int) $this->id);
1473 1473
 			$resql2 = $this->db->query($sql);
1474 1474
 			if (!$resql2) {
1475 1475
 				dol_print_error($this->db);
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 		}
1478 1478
 
1479 1479
 		if (!$error) {
1480
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . "prelevement_bons WHERE rowid = " . ((int) $this->id);
1480
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".((int) $this->id);
1481 1481
 			$resql3 = $this->db->query($sql);
1482 1482
 			if (!$resql3) {
1483 1483
 				dol_print_error($this->db);
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		}
1486 1486
 
1487 1487
 		if (!$error) {
1488
-			$sql = "UPDATE " . MAIN_DB_PREFIX . "prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = " . ((int) $this->id);
1488
+			$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".((int) $this->id);
1489 1489
 			$resql4 = $this->db->query($sql);
1490 1490
 			if (!$resql4) {
1491 1491
 				dol_print_error($this->db);
@@ -1527,22 +1527,22 @@  discard block
 block discarded – undo
1527 1527
 			$labeltoshow = 'PaymentByBankTransfer';
1528 1528
 		}
1529 1529
 
1530
-		$label = img_picto('', $this->picto) . ' <u>' . $langs->trans($labeltoshow) . '</u> ' . $this->getLibStatut(5);
1530
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans($labeltoshow).'</u> '.$this->getLibStatut(5);
1531 1531
 		$label .= '<br>';
1532
-		$label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref;
1532
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
1533 1533
 		if (isset($this->amount)) {
1534
-			$label .= '<br><b>' . $langs->trans("Amount") . ":</b> " . price($this->amount);
1534
+			$label .= '<br><b>'.$langs->trans("Amount").":</b> ".price($this->amount);
1535 1535
 		}
1536 1536
 		if (isset($this->date_trans)) {
1537
-			$label .= '<br><b>' . $langs->trans("TransData") . ":</b> " . dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1537
+			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_trans, 'dayhour', 'tzuserrel');
1538 1538
 		}
1539 1539
 		/*if (isset($this->date_credit)) {
1540 1540
 			$label .= '<br><b>'.$langs->trans("TransData").":</b> ".dol_print_date($this->date_credit, 'dayhour', 'tzuserrel');
1541 1541
 		}*/
1542 1542
 
1543
-		$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1543
+		$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1544 1544
 		if (!empty($this->type) && $this->type == 'bank-transfer') {
1545
-			$url = DOL_URL_ROOT . '/compta/prelevement/card.php?id=' . $this->id;
1545
+			$url = DOL_URL_ROOT.'/compta/prelevement/card.php?id='.$this->id;
1546 1546
 		}
1547 1547
 
1548 1548
 		if ($option != 'nolink') {
@@ -1560,21 +1560,21 @@  discard block
 block discarded – undo
1560 1560
 		if (empty($notooltip)) {
1561 1561
 			if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
1562 1562
 				$label = $langs->trans("ShowMyObject");
1563
-				$linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"';
1563
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
1564 1564
 			}
1565
-			$linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"';
1566
-			$linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"';
1565
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
1566
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
1567 1567
 		} else {
1568
-			$linkclose = ($morecss ? ' class="' . $morecss . '"' : '');
1568
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
1569 1569
 		}
1570 1570
 
1571
-		$linkstart = '<a href="' . $url . '"';
1572
-		$linkstart .= $linkclose . '>';
1571
+		$linkstart = '<a href="'.$url.'"';
1572
+		$linkstart .= $linkclose.'>';
1573 1573
 		$linkend = '</a>';
1574 1574
 
1575 1575
 		$result .= $linkstart;
1576 1576
 		if ($withpicto) {
1577
-			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1577
+			$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
1578 1578
 		}
1579 1579
 		if ($withpicto != 2) {
1580 1580
 			$result .= $this->ref;
@@ -1603,8 +1603,8 @@  discard block
 block discarded – undo
1603 1603
 	 */
1604 1604
 	public function deleteNotificationById($rowid)
1605 1605
 	{
1606
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1607
-		$sql .= " WHERE rowid = " . ((int) $rowid);
1606
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1607
+		$sql .= " WHERE rowid = ".((int) $rowid);
1608 1608
 
1609 1609
 		if ($this->db->query($sql)) {
1610 1610
 			return 0;
@@ -1628,8 +1628,8 @@  discard block
 block discarded – undo
1628 1628
 			$userid = $user;
1629 1629
 		}
1630 1630
 
1631
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "notify_def";
1632
-		$sql .= " WHERE fk_user=" . ((int) $userid) . " AND fk_action='" . $this->db->escape($action) . "'";
1631
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def";
1632
+		$sql .= " WHERE fk_user=".((int) $userid)." AND fk_action='".$this->db->escape($action)."'";
1633 1633
 
1634 1634
 		if ($this->db->query($sql)) {
1635 1635
 			return 0;
@@ -1661,15 +1661,15 @@  discard block
 block discarded – undo
1661 1661
 		if ($this->deleteNotification($user, $action) == 0) {
1662 1662
 			$now = dol_now();
1663 1663
 
1664
-			$sql = "INSERT INTO " . MAIN_DB_PREFIX . "notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1665
-			$sql .= " VALUES ('" . $this->db->idate($now) . "', " . ((int) $userid) . ", 'NULL', 'NULL', '" . $this->db->escape($action) . "')";
1664
+			$sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_user, fk_soc, fk_contact, fk_action)";
1665
+			$sql .= " VALUES ('".$this->db->idate($now)."', ".((int) $userid).", 'NULL', 'NULL', '".$this->db->escape($action)."')";
1666 1666
 
1667
-			dol_syslog("adnotiff: " . $sql);
1667
+			dol_syslog("adnotiff: ".$sql);
1668 1668
 			if ($this->db->query($sql)) {
1669 1669
 				$result = 0;
1670 1670
 			} else {
1671 1671
 				$result = -1;
1672
-				dol_syslog(get_class($this) . "::addNotification Error $result");
1672
+				dol_syslog(get_class($this)."::addNotification Error $result");
1673 1673
 			}
1674 1674
 		}
1675 1675
 
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 
1705 1705
 		$result = 0;
1706 1706
 
1707
-		dol_syslog(get_class($this) . "::generate build file=" . $this->filename . " type=" . $type);
1707
+		dol_syslog(get_class($this)."::generate build file=".$this->filename." type=".$type);
1708 1708
 
1709 1709
 		$this->file = fopen($this->filename, "w");
1710 1710
 		if ($this->file == false) {
@@ -1750,13 +1750,13 @@  discard block
 block discarded – undo
1750 1750
 				$sql .= " f.ref as reffac, p.fk_facture as idfac,";
1751 1751
 				$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1752 1752
 				$sql .= " FROM";
1753
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1754
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1755
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1756
-				$sql .= " " . MAIN_DB_PREFIX . "societe as soc,";
1757
-				$sql .= " " . MAIN_DB_PREFIX . "c_country as c,";
1758
-				$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1759
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1753
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1754
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1755
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1756
+				$sql .= " ".MAIN_DB_PREFIX."societe as soc,";
1757
+				$sql .= " ".MAIN_DB_PREFIX."c_country as c,";
1758
+				$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1759
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1760 1760
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1761 1761
 				$sql .= " AND p.fk_facture = f.rowid";
1762 1762
 				$sql .= " AND f.fk_soc = soc.rowid";
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
 					$nbtotalDrctDbtTxInf = $i;
1793 1793
 				} else {
1794 1794
 					$this->error = $this->db->lasterror();
1795
-					fwrite($this->file, 'ERROR DEBITOR ' . $sql . $CrLf); // DEBITOR = Customers
1795
+					fwrite($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers
1796 1796
 					$result = -2;
1797 1797
 				}
1798 1798
 
@@ -1809,26 +1809,26 @@  discard block
 block discarded – undo
1809 1809
 				 * SECTION CREATION SEPA FILE - ISO200022
1810 1810
 				 */
1811 1811
 				// SEPA File Header
1812
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1813
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1814
-				fwrite($this->file, '	<CstmrDrctDbtInitn>' . $CrLf);
1812
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1813
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.008.001.02" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1814
+				fwrite($this->file, '	<CstmrDrctDbtInitn>'.$CrLf);
1815 1815
 				// SEPA Group header
1816
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1817
-				fwrite($this->file, '			<MsgId>' . ('DD/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1818
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1819
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1820
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1821
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1822
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1823
-				fwrite($this->file, '				<Id>' . $CrLf);
1824
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1825
-				fwrite($this->file, '					<Othr>' . $CrLf);
1826
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1827
-				fwrite($this->file, '					</Othr>' . $CrLf);
1828
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1829
-				fwrite($this->file, '				</Id>' . $CrLf);
1830
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1831
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1816
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1817
+				fwrite($this->file, '			<MsgId>'.('DD/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1818
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1819
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1820
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1821
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1822
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1823
+				fwrite($this->file, '				<Id>'.$CrLf);
1824
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1825
+				fwrite($this->file, '					<Othr>'.$CrLf);
1826
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1827
+				fwrite($this->file, '					</Othr>'.$CrLf);
1828
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1829
+				fwrite($this->file, '				</Id>'.$CrLf);
1830
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1831
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1832 1832
 				// SEPA File Emetteur
1833 1833
 				if ($result != -2) {
1834 1834
 					fwrite($this->file, $fileEmetteurSection);
@@ -1838,9 +1838,9 @@  discard block
 block discarded – undo
1838 1838
 					fwrite($this->file, $fileDebiteurSection);
1839 1839
 				}
1840 1840
 				// SEPA FILE FOOTER
1841
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1842
-				fwrite($this->file, '	</CstmrDrctDbtInitn>' . $CrLf);
1843
-				fwrite($this->file, '</Document>' . $CrLf);
1841
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1842
+				fwrite($this->file, '	</CstmrDrctDbtInitn>'.$CrLf);
1843
+				fwrite($this->file, '</Document>'.$CrLf);
1844 1844
 			} else {
1845 1845
 				/**
1846 1846
 				 * SECTION CREATION FICHIER SEPA - CREDIT TRANSFER
@@ -1872,13 +1872,13 @@  discard block
 block discarded – undo
1872 1872
 					$sql .= " s.ref as reffac, p.fk_salary as idfac,";
1873 1873
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, '' as rum, '' as date_rum";
1874 1874
 					$sql .= " FROM";
1875
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1876
-					$sql .= " " . MAIN_DB_PREFIX . "salary as s,";
1877
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1878
-					$sql .= " " . MAIN_DB_PREFIX . "user as u";
1879
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid,";
1880
-					$sql .= " " . MAIN_DB_PREFIX . "user_rib as rib";
1881
-					$sql .= " WHERE pl.fk_prelevement_bons=" . ((int) $this->id);
1875
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1876
+					$sql .= " ".MAIN_DB_PREFIX."salary as s,";
1877
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1878
+					$sql .= " ".MAIN_DB_PREFIX."user as u";
1879
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid,";
1880
+					$sql .= " ".MAIN_DB_PREFIX."user_rib as rib";
1881
+					$sql .= " WHERE pl.fk_prelevement_bons=".((int) $this->id);
1882 1882
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1883 1883
 					$sql .= " AND p.fk_salary = s.rowid";
1884 1884
 					$sql .= " AND s.fk_user = u.rowid";
@@ -1889,13 +1889,13 @@  discard block
 block discarded – undo
1889 1889
 					$sql .= " f.ref as reffac, f.ref_supplier as fac_ref_supplier, p.fk_facture_fourn as idfac,";
1890 1890
 					$sql .= " rib.rowid, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum, rib.rum, rib.date_rum";
1891 1891
 					$sql .= " FROM";
1892
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1893
-					$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
1894
-					$sql .= " " . MAIN_DB_PREFIX . "prelevement as p,";
1895
-					$sql .= " " . MAIN_DB_PREFIX . "societe as soc";
1896
-					$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON soc.fk_pays = c.rowid,";
1897
-					$sql .= " " . MAIN_DB_PREFIX . "societe_rib as rib";
1898
-					$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1892
+					$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1893
+					$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
1894
+					$sql .= " ".MAIN_DB_PREFIX."prelevement as p,";
1895
+					$sql .= " ".MAIN_DB_PREFIX."societe as soc";
1896
+					$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON soc.fk_pays = c.rowid,";
1897
+					$sql .= " ".MAIN_DB_PREFIX."societe_rib as rib";
1898
+					$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1899 1899
 					$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1900 1900
 					$sql .= " AND p.fk_facture_fourn = f.rowid";
1901 1901
 					$sql .= " AND f.fk_soc = soc.rowid";
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
 						$daterum = (!empty($obj->date_rum)) ? $this->db->jdate($obj->date_rum) : $this->db->jdate($obj->datec);
1923 1923
 						$refobj = $obj->reffac;
1924 1924
 						if (empty($refobj) && !empty($forsalary)) {	// If ref of salary not defined, we force a value
1925
-							$refobj = "SAL" . $obj->idfac;
1925
+							$refobj = "SAL".$obj->idfac;
1926 1926
 						}
1927 1927
 
1928 1928
 						$fileCrediteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $refobj, $obj->idfac, $obj->iban, $obj->bic, $daterum, $obj->drum, $obj->rum, $type, $obj->fac_ref_supplier);
@@ -1933,7 +1933,7 @@  discard block
 block discarded – undo
1933 1933
 					$nbtotalDrctDbtTxInf = $i;
1934 1934
 				} else {
1935 1935
 					$this->error = $this->db->lasterror();
1936
-					fwrite($this->file, 'ERROR CREDITOR ' . $sql . $CrLf); // CREDITORS = Suppliers
1936
+					fwrite($this->file, 'ERROR CREDITOR '.$sql.$CrLf); // CREDITORS = Suppliers
1937 1937
 					$result = -2;
1938 1938
 				}
1939 1939
 				// Define $fileEmetteurSection. Start of block PmtInf. Will contains all $nbtotalDrctDbtTxInf
@@ -1949,26 +1949,26 @@  discard block
 block discarded – undo
1949 1949
 				 * SECTION CREATION SEPA FILE - CREDIT TRANSFER - ISO200022
1950 1950
 				 */
1951 1951
 				// SEPA File Header
1952
-				fwrite($this->file, '<' . '?xml version="1.0" encoding="UTF-8" standalone="yes"?' . '>' . $CrLf);
1953
-				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' . $CrLf);
1954
-				fwrite($this->file, '	<CstmrCdtTrfInitn>' . $CrLf);
1952
+				fwrite($this->file, '<'.'?xml version="1.0" encoding="UTF-8" standalone="yes"?'.'>'.$CrLf);
1953
+				fwrite($this->file, '<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.$CrLf);
1954
+				fwrite($this->file, '	<CstmrCdtTrfInitn>'.$CrLf);
1955 1955
 				// SEPA Group header
1956
-				fwrite($this->file, '		<GrpHdr>' . $CrLf);
1957
-				fwrite($this->file, '			<MsgId>' . ('TRF/' . $dateTime_YMD . '/REF' . $this->id) . '</MsgId>' . $CrLf);
1958
-				fwrite($this->file, '			<CreDtTm>' . $dateTime_ECMA . '</CreDtTm>' . $CrLf);
1959
-				fwrite($this->file, '			<NbOfTxs>' . $i . '</NbOfTxs>' . $CrLf);
1960
-				fwrite($this->file, '			<CtrlSum>' . $this->total . '</CtrlSum>' . $CrLf);
1961
-				fwrite($this->file, '			<InitgPty>' . $CrLf);
1962
-				fwrite($this->file, '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf);
1963
-				fwrite($this->file, '				<Id>' . $CrLf);
1964
-				fwrite($this->file, '				    <PrvtId>' . $CrLf);
1965
-				fwrite($this->file, '					<Othr>' . $CrLf);
1966
-				fwrite($this->file, '						<Id>' . $this->emetteur_ics . '</Id>' . $CrLf);
1967
-				fwrite($this->file, '					</Othr>' . $CrLf);
1968
-				fwrite($this->file, '				    </PrvtId>' . $CrLf);
1969
-				fwrite($this->file, '				</Id>' . $CrLf);
1970
-				fwrite($this->file, '			</InitgPty>' . $CrLf);
1971
-				fwrite($this->file, '		</GrpHdr>' . $CrLf);
1956
+				fwrite($this->file, '		<GrpHdr>'.$CrLf);
1957
+				fwrite($this->file, '			<MsgId>'.('TRF/'.$dateTime_YMD.'/REF'.$this->id).'</MsgId>'.$CrLf);
1958
+				fwrite($this->file, '			<CreDtTm>'.$dateTime_ECMA.'</CreDtTm>'.$CrLf);
1959
+				fwrite($this->file, '			<NbOfTxs>'.$i.'</NbOfTxs>'.$CrLf);
1960
+				fwrite($this->file, '			<CtrlSum>'.$this->total.'</CtrlSum>'.$CrLf);
1961
+				fwrite($this->file, '			<InitgPty>'.$CrLf);
1962
+				fwrite($this->file, '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf);
1963
+				fwrite($this->file, '				<Id>'.$CrLf);
1964
+				fwrite($this->file, '				    <PrvtId>'.$CrLf);
1965
+				fwrite($this->file, '					<Othr>'.$CrLf);
1966
+				fwrite($this->file, '						<Id>'.$this->emetteur_ics.'</Id>'.$CrLf);
1967
+				fwrite($this->file, '					</Othr>'.$CrLf);
1968
+				fwrite($this->file, '				    </PrvtId>'.$CrLf);
1969
+				fwrite($this->file, '				</Id>'.$CrLf);
1970
+				fwrite($this->file, '			</InitgPty>'.$CrLf);
1971
+				fwrite($this->file, '		</GrpHdr>'.$CrLf);
1972 1972
 				// SEPA File Emetteur (mycompany)
1973 1973
 				if ($result != -2) {
1974 1974
 					fwrite($this->file, $fileEmetteurSection);
@@ -1978,9 +1978,9 @@  discard block
 block discarded – undo
1978 1978
 					fwrite($this->file, $fileCrediteurSection);
1979 1979
 				}
1980 1980
 				// SEPA FILE FOOTER
1981
-				fwrite($this->file, '		</PmtInf>' . $CrLf);
1982
-				fwrite($this->file, '	</CstmrCdtTrfInitn>' . $CrLf);
1983
-				fwrite($this->file, '</Document>' . $CrLf);
1981
+				fwrite($this->file, '		</PmtInf>'.$CrLf);
1982
+				fwrite($this->file, '	</CstmrCdtTrfInitn>'.$CrLf);
1983
+				fwrite($this->file, '</Document>'.$CrLf);
1984 1984
 			}
1985 1985
 		}
1986 1986
 
@@ -1989,10 +1989,10 @@  discard block
 block discarded – undo
1989 1989
 			if ($type != 'bank-transfer') {
1990 1990
 				$sql = "SELECT pl.amount";
1991 1991
 				$sql .= " FROM";
1992
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
1993
-				$sql .= " " . MAIN_DB_PREFIX . "facture as f,";
1994
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
1995
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
1992
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
1993
+				$sql .= " ".MAIN_DB_PREFIX."facture as f,";
1994
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
1995
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
1996 1996
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
1997 1997
 				$sql .= " AND p.fk_facture = f.rowid";
1998 1998
 
@@ -2015,10 +2015,10 @@  discard block
 block discarded – undo
2015 2015
 			} else {
2016 2016
 				$sql = "SELECT pl.amount";
2017 2017
 				$sql .= " FROM";
2018
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement_lignes as pl,";
2019
-				$sql .= " " . MAIN_DB_PREFIX . "facture_fourn as f,";
2020
-				$sql .= " " . MAIN_DB_PREFIX . "prelevement as p";
2021
-				$sql .= " WHERE pl.fk_prelevement_bons = " . ((int) $this->id);
2018
+				$sql .= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
2019
+				$sql .= " ".MAIN_DB_PREFIX."facture_fourn as f,";
2020
+				$sql .= " ".MAIN_DB_PREFIX."prelevement as p";
2021
+				$sql .= " WHERE pl.fk_prelevement_bons = ".((int) $this->id);
2022 2022
 				$sql .= " AND pl.rowid = p.fk_prelevement_lignes";
2023 2023
 				$sql .= " AND p.fk_facture_fourn = f.rowid";
2024 2024
 				// Lines
@@ -2067,7 +2067,7 @@  discard block
 block discarded – undo
2067 2067
 		$pre = substr(dol_string_nospecial(dol_string_unaccent($langs->transnoentitiesnoconv('RUM'))), 0, 3); // Must always be on 3 char ('RUM' or 'UMR'. This is a protection against bad translation)
2068 2068
 
2069 2069
 		// 3 char + '-' + 12 + '-' + id + '-' + code 		Must be lower than 32.
2070
-		return $pre . '-' . dol_print_date($row_datec, 'dayhourlogsmall') . '-' . dol_trunc($row_drum . ($row_code_client ? '-' . $row_code_client : ''), 13, 'right', 'UTF-8', 1);
2070
+		return $pre.'-'.dol_print_date($row_datec, 'dayhourlogsmall').'-'.dol_trunc($row_drum.($row_code_client ? '-'.$row_code_client : ''), 13, 'right', 'UTF-8', 1);
2071 2071
 	}
2072 2072
 
2073 2073
 
@@ -2106,11 +2106,11 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
 		// Raison Sociale Destinataire C2
2108 2108
 
2109
-		fwrite($this->file, substr(strtoupper($client_nom) . "                         ", 0, 24));
2109
+		fwrite($this->file, substr(strtoupper($client_nom)."                         ", 0, 24));
2110 2110
 
2111 2111
 		// Address optional D1
2112 2112
 		$address = strtr($rib_dom, array(" " => "-", chr(13) => " ", chr(10) => ""));
2113
-		fwrite($this->file, substr($address . "                         ", 0, 24));
2113
+		fwrite($this->file, substr($address."                         ", 0, 24));
2114 2114
 
2115 2115
 		// Zone Reservee D2
2116 2116
 
@@ -2122,17 +2122,17 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
 		// Numero de compte D4
2124 2124
 
2125
-		fwrite($this->file, substr("000000000000000" . $rib_number, -11));
2125
+		fwrite($this->file, substr("000000000000000".$rib_number, -11));
2126 2126
 
2127 2127
 		// Zone E Montant
2128 2128
 
2129 2129
 		$montant = (round($amount, 2) * 100);
2130 2130
 
2131
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2131
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2132 2132
 
2133 2133
 		// Label F
2134 2134
 
2135
-		fwrite($this->file, substr("*_" . $ref . "_RDVnet" . $rowid . "                               ", 0, 31));
2135
+		fwrite($this->file, substr("*_".$ref."_RDVnet".$rowid."                               ", 0, 31));
2136 2136
 
2137 2137
 		// Code etablissement G1
2138 2138
 
@@ -2183,7 +2183,7 @@  discard block
 block discarded – undo
2183 2183
 			$row_somme = round((float) $row_somme, 2);
2184 2184
 		}
2185 2185
 
2186
-		include_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
2186
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
2187 2187
 
2188 2188
 		$CrLf = "\n";
2189 2189
 		$Rowing = sprintf("%010d", $row_idfac);
@@ -2198,59 +2198,59 @@  discard block
 block discarded – undo
2198 2198
 		if ($type != 'bank-transfer') {
2199 2199
 			// SEPA Paiement Information of buyer for Direct Debit
2200 2200
 			$XML_DEBITOR = '';
2201
-			$XML_DEBITOR .= '			<DrctDbtTxInf>' . $CrLf;
2202
-			$XML_DEBITOR .= '				<PmtId>' . $CrLf;
2201
+			$XML_DEBITOR .= '			<DrctDbtTxInf>'.$CrLf;
2202
+			$XML_DEBITOR .= '				<PmtId>'.$CrLf;
2203 2203
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2204
-			$XML_DEBITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2205
-			$XML_DEBITOR .= '				</PmtId>' . $CrLf;
2206
-			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">' . $row_somme . '</InstdAmt>' . $CrLf;
2207
-			$XML_DEBITOR .= '				<DrctDbtTx>' . $CrLf;
2208
-			$XML_DEBITOR .= '					<MndtRltdInf>' . $CrLf;
2209
-			$XML_DEBITOR .= '						<MndtId>' . $Rum . '</MndtId>' . $CrLf;
2210
-			$XML_DEBITOR .= '						<DtOfSgntr>' . $DtOfSgntr . '</DtOfSgntr>' . $CrLf;
2211
-			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>' . $CrLf;
2212
-			$XML_DEBITOR .= '					</MndtRltdInf>' . $CrLf;
2213
-			$XML_DEBITOR .= '				</DrctDbtTx>' . $CrLf;
2214
-			$XML_DEBITOR .= '				<DbtrAgt>' . $CrLf;
2215
-			$XML_DEBITOR .= '					<FinInstnId>' . $CrLf;
2216
-			$XML_DEBITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2217
-			$XML_DEBITOR .= '					</FinInstnId>' . $CrLf;
2218
-			$XML_DEBITOR .= '				</DbtrAgt>' . $CrLf;
2219
-			$XML_DEBITOR .= '				<Dbtr>' . $CrLf;
2220
-			$XML_DEBITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2221
-			$XML_DEBITOR .= '					<PstlAdr>' . $CrLf;
2222
-			$XML_DEBITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2204
+			$XML_DEBITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('DD-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2205
+			$XML_DEBITOR .= '				</PmtId>'.$CrLf;
2206
+			$XML_DEBITOR .= '				<InstdAmt Ccy="EUR">'.$row_somme.'</InstdAmt>'.$CrLf;
2207
+			$XML_DEBITOR .= '				<DrctDbtTx>'.$CrLf;
2208
+			$XML_DEBITOR .= '					<MndtRltdInf>'.$CrLf;
2209
+			$XML_DEBITOR .= '						<MndtId>'.$Rum.'</MndtId>'.$CrLf;
2210
+			$XML_DEBITOR .= '						<DtOfSgntr>'.$DtOfSgntr.'</DtOfSgntr>'.$CrLf;
2211
+			$XML_DEBITOR .= '						<AmdmntInd>false</AmdmntInd>'.$CrLf;
2212
+			$XML_DEBITOR .= '					</MndtRltdInf>'.$CrLf;
2213
+			$XML_DEBITOR .= '				</DrctDbtTx>'.$CrLf;
2214
+			$XML_DEBITOR .= '				<DbtrAgt>'.$CrLf;
2215
+			$XML_DEBITOR .= '					<FinInstnId>'.$CrLf;
2216
+			$XML_DEBITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2217
+			$XML_DEBITOR .= '					</FinInstnId>'.$CrLf;
2218
+			$XML_DEBITOR .= '				</DbtrAgt>'.$CrLf;
2219
+			$XML_DEBITOR .= '				<Dbtr>'.$CrLf;
2220
+			$XML_DEBITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2221
+			$XML_DEBITOR .= '					<PstlAdr>'.$CrLf;
2222
+			$XML_DEBITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2223 2223
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2224
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2224
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2225 2225
 			if (trim($addressline1)) {
2226
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2226
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2227 2227
 			}
2228 2228
 			if (trim($addressline2)) {
2229
-				$XML_DEBITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2229
+				$XML_DEBITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2230 2230
 			}
2231
-			$XML_DEBITOR .= '					</PstlAdr>' . $CrLf;
2232
-			$XML_DEBITOR .= '				</Dbtr>' . $CrLf;
2233
-			$XML_DEBITOR .= '				<DbtrAcct>' . $CrLf;
2234
-			$XML_DEBITOR .= '					<Id>' . $CrLf;
2235
-			$XML_DEBITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2236
-			$XML_DEBITOR .= '					</Id>' . $CrLf;
2237
-			$XML_DEBITOR .= '				</DbtrAcct>' . $CrLf;
2238
-			$XML_DEBITOR .= '				<RmtInf>' . $CrLf;
2231
+			$XML_DEBITOR .= '					</PstlAdr>'.$CrLf;
2232
+			$XML_DEBITOR .= '				</Dbtr>'.$CrLf;
2233
+			$XML_DEBITOR .= '				<DbtrAcct>'.$CrLf;
2234
+			$XML_DEBITOR .= '					<Id>'.$CrLf;
2235
+			$XML_DEBITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2236
+			$XML_DEBITOR .= '					</Id>'.$CrLf;
2237
+			$XML_DEBITOR .= '				</DbtrAcct>'.$CrLf;
2238
+			$XML_DEBITOR .= '				<RmtInf>'.$CrLf;
2239 2239
 			// A string with some information on payment - 140 max
2240
-			$XML_DEBITOR .= '					<Ustrd>' . getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstuctured data - 140 max
2241
-			$XML_DEBITOR .= '				</RmtInf>' . $CrLf;
2242
-			$XML_DEBITOR .= '			</DrctDbtTxInf>' . $CrLf;
2240
+			$XML_DEBITOR .= '					<Ustrd>'.getDolGlobalString('PRELEVEMENT_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstuctured data - 140 max
2241
+			$XML_DEBITOR .= '				</RmtInf>'.$CrLf;
2242
+			$XML_DEBITOR .= '			</DrctDbtTxInf>'.$CrLf;
2243 2243
 			return $XML_DEBITOR;
2244 2244
 		} else {
2245 2245
 			// SEPA Payment Information of seller for Credit Transfer
2246 2246
 			$XML_CREDITOR = '';
2247
-			$XML_CREDITOR .= '			<CdtTrfTxInf>' . $CrLf;
2248
-			$XML_CREDITOR .= '				<PmtId>' . $CrLf;
2247
+			$XML_CREDITOR .= '			<CdtTrfTxInf>'.$CrLf;
2248
+			$XML_CREDITOR .= '				<PmtId>'.$CrLf;
2249 2249
 			// Add EndToEndId. Must be a unique ID for each payment (for example by including bank, buyer or seller, date, checksum)
2250
-			$XML_CREDITOR .= '					<EndToEndId>' . ((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-' . dol_trunc($row_idfac . '-' . $row_ref, 20, 'right', 'UTF-8', 1)) . '-' . $Rowing) . '</EndToEndId>' . $CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2251
-			$XML_CREDITOR .= '				</PmtId>' . $CrLf;
2250
+			$XML_CREDITOR .= '					<EndToEndId>'.((getDolGlobalString('PRELEVEMENT_END_TO_END') != "") ? $conf->global->PRELEVEMENT_END_TO_END : ('CT-'.dol_trunc($row_idfac.'-'.$row_ref, 20, 'right', 'UTF-8', 1)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
2251
+			$XML_CREDITOR .= '				</PmtId>'.$CrLf;
2252 2252
 			if (!empty($this->sepa_xml_pti_in_ctti)) {
2253
-				$XML_CREDITOR .= '				<PmtTpInf>' . $CrLf;
2253
+				$XML_CREDITOR .= '				<PmtTpInf>'.$CrLf;
2254 2254
 
2255 2255
 				// Can be 'NORM' for normal or 'HIGH' for high priority level
2256 2256
 				if (getDolGlobalString('PAYMENTBYBANKTRANSFER_FORCE_HIGH_PRIORITY')) {
@@ -2258,18 +2258,18 @@  discard block
 block discarded – undo
2258 2258
 				} else {
2259 2259
 					$instrprty = 'NORM';
2260 2260
 				}
2261
-				$XML_CREDITOR .= '					<InstrPrty>' . $instrprty . '</InstrPrty>' . $CrLf;
2262
-				$XML_CREDITOR .= '					<SvcLvl>' . $CrLf;
2263
-				$XML_CREDITOR .= '						<Cd>SEPA</Cd>' . $CrLf;
2264
-				$XML_CREDITOR .= '					</SvcLvl>' . $CrLf;
2265
-				$XML_CREDITOR .= '					<CtgyPurp>' . $CrLf;
2266
-				$XML_CREDITOR .= '						<Cd>CORE</Cd>' . $CrLf;
2267
-				$XML_CREDITOR .= '					</CtgyPurp>' . $CrLf;
2268
-				$XML_CREDITOR .= '				</PmtTpInf>' . $CrLf;
2261
+				$XML_CREDITOR .= '					<InstrPrty>'.$instrprty.'</InstrPrty>'.$CrLf;
2262
+				$XML_CREDITOR .= '					<SvcLvl>'.$CrLf;
2263
+				$XML_CREDITOR .= '						<Cd>SEPA</Cd>'.$CrLf;
2264
+				$XML_CREDITOR .= '					</SvcLvl>'.$CrLf;
2265
+				$XML_CREDITOR .= '					<CtgyPurp>'.$CrLf;
2266
+				$XML_CREDITOR .= '						<Cd>CORE</Cd>'.$CrLf;
2267
+				$XML_CREDITOR .= '					</CtgyPurp>'.$CrLf;
2268
+				$XML_CREDITOR .= '				</PmtTpInf>'.$CrLf;
2269 2269
 			}
2270
-			$XML_CREDITOR .= '				<Amt>' . $CrLf;
2270
+			$XML_CREDITOR .= '				<Amt>'.$CrLf;
2271 2271
 			$XML_CREDITOR .= '				<InstdAmt Ccy="EUR">'.round((float) $row_somme, 2).'</InstdAmt>'.$CrLf;
2272
-			$XML_CREDITOR .= '				</Amt>' . $CrLf;
2272
+			$XML_CREDITOR .= '				</Amt>'.$CrLf;
2273 2273
 			/*
2274 2274
 			 $XML_CREDITOR .= '				<DrctDbtTx>'.$CrLf;
2275 2275
 			 $XML_CREDITOR .= '					<MndtRltdInf>'.$CrLf;
@@ -2280,35 +2280,35 @@  discard block
 block discarded – undo
2280 2280
 			 $XML_CREDITOR .= '				</DrctDbtTx>'.$CrLf;
2281 2281
 			 */
2282 2282
 			//$XML_CREDITOR .= '				<ChrgBr>SLEV</ChrgBr>'.$CrLf;
2283
-			$XML_CREDITOR .= '				<CdtrAgt>' . $CrLf;
2284
-			$XML_CREDITOR .= '					<FinInstnId>' . $CrLf;
2285
-			$XML_CREDITOR .= '						<BIC>' . $row_bic . '</BIC>' . $CrLf;
2286
-			$XML_CREDITOR .= '					</FinInstnId>' . $CrLf;
2287
-			$XML_CREDITOR .= '				</CdtrAgt>' . $CrLf;
2288
-			$XML_CREDITOR .= '				<Cdtr>' . $CrLf;
2289
-			$XML_CREDITOR .= '					<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))) . '</Nm>' . $CrLf;
2290
-			$XML_CREDITOR .= '					<PstlAdr>' . $CrLf;
2291
-			$XML_CREDITOR .= '						<Ctry>' . $row_country_code . '</Ctry>' . $CrLf;
2283
+			$XML_CREDITOR .= '				<CdtrAgt>'.$CrLf;
2284
+			$XML_CREDITOR .= '					<FinInstnId>'.$CrLf;
2285
+			$XML_CREDITOR .= '						<BIC>'.$row_bic.'</BIC>'.$CrLf;
2286
+			$XML_CREDITOR .= '					</FinInstnId>'.$CrLf;
2287
+			$XML_CREDITOR .= '				</CdtrAgt>'.$CrLf;
2288
+			$XML_CREDITOR .= '				<Cdtr>'.$CrLf;
2289
+			$XML_CREDITOR .= '					<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($row_nom), ' '))).'</Nm>'.$CrLf;
2290
+			$XML_CREDITOR .= '					<PstlAdr>'.$CrLf;
2291
+			$XML_CREDITOR .= '						<Ctry>'.$row_country_code.'</Ctry>'.$CrLf;
2292 2292
 			$addressline1 = strtr($row_address, array(chr(13) => ", ", chr(10) => ""));
2293
-			$addressline2 = strtr($row_zip . (($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2293
+			$addressline2 = strtr($row_zip.(($row_zip && $row_town) ? ' ' : (string) $row_town), array(chr(13) => ", ", chr(10) => ""));
2294 2294
 			if (trim($addressline1)) {
2295
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2295
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2296 2296
 			}
2297 2297
 			if (trim($addressline2)) {
2298
-				$XML_CREDITOR .= '						<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2298
+				$XML_CREDITOR .= '						<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2299 2299
 			}
2300
-			$XML_CREDITOR .= '					</PstlAdr>' . $CrLf;
2301
-			$XML_CREDITOR .= '				</Cdtr>' . $CrLf;
2302
-			$XML_CREDITOR .= '				<CdtrAcct>' . $CrLf;
2303
-			$XML_CREDITOR .= '					<Id>' . $CrLf;
2304
-			$XML_CREDITOR .= '						<IBAN>' . preg_replace('/\s/', '', $row_iban) . '</IBAN>' . $CrLf;
2305
-			$XML_CREDITOR .= '					</Id>' . $CrLf;
2306
-			$XML_CREDITOR .= '				</CdtrAcct>' . $CrLf;
2307
-			$XML_CREDITOR .= '				<RmtInf>' . $CrLf;
2300
+			$XML_CREDITOR .= '					</PstlAdr>'.$CrLf;
2301
+			$XML_CREDITOR .= '				</Cdtr>'.$CrLf;
2302
+			$XML_CREDITOR .= '				<CdtrAcct>'.$CrLf;
2303
+			$XML_CREDITOR .= '					<Id>'.$CrLf;
2304
+			$XML_CREDITOR .= '						<IBAN>'.preg_replace('/\s/', '', $row_iban).'</IBAN>'.$CrLf;
2305
+			$XML_CREDITOR .= '					</Id>'.$CrLf;
2306
+			$XML_CREDITOR .= '				</CdtrAcct>'.$CrLf;
2307
+			$XML_CREDITOR .= '				<RmtInf>'.$CrLf;
2308 2308
 			// A string with some information on payment - 140 max
2309
-			$XML_CREDITOR .= '					<Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
2310
-			$XML_CREDITOR .= '				</RmtInf>' . $CrLf;
2311
-			$XML_CREDITOR .= '			</CdtTrfTxInf>' . $CrLf;
2309
+			$XML_CREDITOR .= '					<Ustrd>'.getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref.($row_comment ? ' - '.$row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))).'</Ustrd>'.$CrLf; // Free unstructured data - 140 max
2310
+			$XML_CREDITOR .= '				</RmtInf>'.$CrLf;
2311
+			$XML_CREDITOR .= '			</CdtTrfTxInf>'.$CrLf;
2312 2312
 			return $XML_CREDITOR;
2313 2313
 		}
2314 2314
 	}
@@ -2340,11 +2340,11 @@  discard block
 block discarded – undo
2340 2340
 
2341 2341
 		// Raison Sociale C2
2342 2342
 
2343
-		fwrite($this->file, substr($this->raison_sociale . "                           ", 0, 24));
2343
+		fwrite($this->file, substr($this->raison_sociale."                           ", 0, 24));
2344 2344
 
2345 2345
 		// Reference de la remise creancier D1 sur 7 caracteres
2346 2346
 
2347
-		fwrite($this->file, substr($this->reference_remise . "                           ", 0, 7));
2347
+		fwrite($this->file, substr($this->reference_remise."                           ", 0, 7));
2348 2348
 
2349 2349
 		// Zone Reservee D1-2
2350 2350
 
@@ -2362,7 +2362,7 @@  discard block
 block discarded – undo
2362 2362
 
2363 2363
 		// Numero de compte D4
2364 2364
 
2365
-		fwrite($this->file, substr("000000000000000" . $this->emetteur_numero_compte, -11));
2365
+		fwrite($this->file, substr("000000000000000".$this->emetteur_numero_compte, -11));
2366 2366
 
2367 2367
 		// Zone Reservee E
2368 2368
 
@@ -2425,15 +2425,15 @@  discard block
 block discarded – undo
2425 2425
 			$this->emetteur_iban = $account->iban;
2426 2426
 			$this->emetteur_bic = $account->bic;
2427 2427
 
2428
-			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics);  // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2428
+			$this->emetteur_ics = (($type == 'bank-transfer' && getDolGlobalString("SEPA_USE_IDS")) ? $account->ics_transfer : $account->ics); // Ex: PRELEVEMENT_ICS = "FR78ZZZ123456";
2429 2429
 
2430 2430
 			$this->raison_sociale = $account->proprio;
2431 2431
 		}
2432 2432
 
2433 2433
 		// Get pending payments
2434 2434
 		$sql = "SELECT rowid, ref";
2435
-		$sql .= " FROM " . MAIN_DB_PREFIX . "prelevement_bons as pb";
2436
-		$sql .= " WHERE pb.rowid = " . ((int) $this->id);
2435
+		$sql .= " FROM ".MAIN_DB_PREFIX."prelevement_bons as pb";
2436
+		$sql .= " WHERE pb.rowid = ".((int) $this->id);
2437 2437
 
2438 2438
 		$resql = $this->db->query($sql);
2439 2439
 		if ($resql) {
@@ -2450,45 +2450,45 @@  discard block
 block discarded – undo
2450 2450
 			if ($type != 'bank-transfer') {
2451 2451
 				// SEPA Paiement Information of my company for Direct Debit
2452 2452
 				$XML_SEPA_INFO = '';
2453
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2454
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('DD/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2455
-				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>' . $CrLf;
2456
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2457
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2458
-				$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2459
-				$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2460
-				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2461
-				$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2462
-				$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2463
-				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2464
-				$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2465
-				$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2466
-				$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2467
-				$XML_SEPA_INFO .= '			<ReqdColltnDt>' . $dateTime_ETAD . '</ReqdColltnDt>' . $CrLf;
2468
-				$XML_SEPA_INFO .= '			<Cdtr>' . $CrLf;
2469
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2470
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2471
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2453
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2454
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('DD/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2455
+				$XML_SEPA_INFO .= '			<PmtMtd>DD</PmtMtd>'.$CrLf;
2456
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2457
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2458
+				$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2459
+				$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2460
+				$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2461
+				$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2462
+				$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2463
+				$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2464
+				$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2465
+				$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2466
+				$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2467
+				$XML_SEPA_INFO .= '			<ReqdColltnDt>'.$dateTime_ETAD.'</ReqdColltnDt>'.$CrLf;
2468
+				$XML_SEPA_INFO .= '			<Cdtr>'.$CrLf;
2469
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2470
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2471
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2472 2472
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2473
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2473
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2474 2474
 				if ($addressline1) {
2475
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2475
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2476 2476
 				}
2477 2477
 				if ($addressline2) {
2478
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2478
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2479 2479
 				}
2480
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2481
-				$XML_SEPA_INFO .= '			</Cdtr>' . $CrLf;
2482
-				$XML_SEPA_INFO .= '			<CdtrAcct>' . $CrLf;
2483
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2484
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2485
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2486
-				$XML_SEPA_INFO .= '			</CdtrAcct>' . $CrLf;
2487
-				$XML_SEPA_INFO .= '			<CdtrAgt>' . $CrLf;
2488
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2489
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2490
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2491
-				$XML_SEPA_INFO .= '			</CdtrAgt>' . $CrLf;
2480
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2481
+				$XML_SEPA_INFO .= '			</Cdtr>'.$CrLf;
2482
+				$XML_SEPA_INFO .= '			<CdtrAcct>'.$CrLf;
2483
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2484
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2485
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2486
+				$XML_SEPA_INFO .= '			</CdtrAcct>'.$CrLf;
2487
+				$XML_SEPA_INFO .= '			<CdtrAgt>'.$CrLf;
2488
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2489
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2490
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2491
+				$XML_SEPA_INFO .= '			</CdtrAgt>'.$CrLf;
2492 2492
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2493 2493
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2494 2494
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2497,64 +2497,64 @@  discard block
 block discarded – undo
2497 2497
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2498 2498
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2499 2499
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2500
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2501
-				$XML_SEPA_INFO .= '			<CdtrSchmeId>' . $CrLf;
2502
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2503
-				$XML_SEPA_INFO .= '					<PrvtId>' . $CrLf;
2504
-				$XML_SEPA_INFO .= '						<Othr>' . $CrLf;
2505
-				$XML_SEPA_INFO .= '							<Id>' . $this->emetteur_ics . '</Id>' . $CrLf;
2506
-				$XML_SEPA_INFO .= '							<SchmeNm>' . $CrLf;
2507
-				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>' . $CrLf;
2508
-				$XML_SEPA_INFO .= '							</SchmeNm>' . $CrLf;
2509
-				$XML_SEPA_INFO .= '						</Othr>' . $CrLf;
2510
-				$XML_SEPA_INFO .= '					</PrvtId>' . $CrLf;
2511
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2512
-				$XML_SEPA_INFO .= '			</CdtrSchmeId>' . $CrLf;
2500
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2501
+				$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2502
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2503
+				$XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
2504
+				$XML_SEPA_INFO .= '						<Othr>'.$CrLf;
2505
+				$XML_SEPA_INFO .= '							<Id>'.$this->emetteur_ics.'</Id>'.$CrLf;
2506
+				$XML_SEPA_INFO .= '							<SchmeNm>'.$CrLf;
2507
+				$XML_SEPA_INFO .= '								<Prtry>SEPA</Prtry>'.$CrLf;
2508
+				$XML_SEPA_INFO .= '							</SchmeNm>'.$CrLf;
2509
+				$XML_SEPA_INFO .= '						</Othr>'.$CrLf;
2510
+				$XML_SEPA_INFO .= '					</PrvtId>'.$CrLf;
2511
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2512
+				$XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;
2513 2513
 			} else {
2514 2514
 				// SEPA Paiement Information of my company for Credit Transfer
2515 2515
 				$XML_SEPA_INFO = '';
2516
-				$XML_SEPA_INFO .= '		<PmtInf>' . $CrLf;
2517
-				$XML_SEPA_INFO .= '			<PmtInfId>' . ('TRF/' . $dateTime_YMD . '/ID' . $IdBon . '-' . $RefBon) . '</PmtInfId>' . $CrLf;
2518
-				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>' . $CrLf;
2516
+				$XML_SEPA_INFO .= '		<PmtInf>'.$CrLf;
2517
+				$XML_SEPA_INFO .= '			<PmtInfId>'.('TRF/'.$dateTime_YMD.'/ID'.$IdBon.'-'.$RefBon).'</PmtInfId>'.$CrLf;
2518
+				$XML_SEPA_INFO .= '			<PmtMtd>TRF</PmtMtd>'.$CrLf;
2519 2519
 				//$XML_SEPA_INFO .= '			<BtchBookg>False</BtchBookg>'.$CrLf;
2520
-				$XML_SEPA_INFO .= '			<NbOfTxs>' . $nombre . '</NbOfTxs>' . $CrLf;
2521
-				$XML_SEPA_INFO .= '			<CtrlSum>' . $total . '</CtrlSum>' . $CrLf;
2520
+				$XML_SEPA_INFO .= '			<NbOfTxs>'.$nombre.'</NbOfTxs>'.$CrLf;
2521
+				$XML_SEPA_INFO .= '			<CtrlSum>'.$total.'</CtrlSum>'.$CrLf;
2522 2522
 				if (!empty($this->sepa_xml_pti_in_ctti) && !empty($format)) {	// @TODO Using $format (FRST ou RCUR) in a section for a Credit Transfer looks strange.
2523
-					$XML_SEPA_INFO .= '			<PmtTpInf>' . $CrLf;
2524
-					$XML_SEPA_INFO .= '				<SvcLvl>' . $CrLf;
2525
-					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>' . $CrLf;
2526
-					$XML_SEPA_INFO .= '				</SvcLvl>' . $CrLf;
2527
-					$XML_SEPA_INFO .= '				<LclInstrm>' . $CrLf;
2528
-					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>' . $CrLf;
2529
-					$XML_SEPA_INFO .= '				</LclInstrm>' . $CrLf;
2530
-					$XML_SEPA_INFO .= '				<SeqTp>' . $format . '</SeqTp>' . $CrLf;
2531
-					$XML_SEPA_INFO .= '			</PmtTpInf>' . $CrLf;
2523
+					$XML_SEPA_INFO .= '			<PmtTpInf>'.$CrLf;
2524
+					$XML_SEPA_INFO .= '				<SvcLvl>'.$CrLf;
2525
+					$XML_SEPA_INFO .= '					<Cd>SEPA</Cd>'.$CrLf;
2526
+					$XML_SEPA_INFO .= '				</SvcLvl>'.$CrLf;
2527
+					$XML_SEPA_INFO .= '				<LclInstrm>'.$CrLf;
2528
+					$XML_SEPA_INFO .= '					<Cd>CORE</Cd>'.$CrLf;
2529
+					$XML_SEPA_INFO .= '				</LclInstrm>'.$CrLf;
2530
+					$XML_SEPA_INFO .= '				<SeqTp>'.$format.'</SeqTp>'.$CrLf;
2531
+					$XML_SEPA_INFO .= '			</PmtTpInf>'.$CrLf;
2532 2532
 				}
2533
-				$XML_SEPA_INFO .= '			<ReqdExctnDt>' . dol_print_date($dateTime_ETAD, 'dayrfc') . '</ReqdExctnDt>' . $CrLf;
2534
-				$XML_SEPA_INFO .= '			<Dbtr>' . $CrLf;
2535
-				$XML_SEPA_INFO .= '				<Nm>' . dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))) . '</Nm>' . $CrLf;
2536
-				$XML_SEPA_INFO .= '				<PstlAdr>' . $CrLf;
2537
-				$XML_SEPA_INFO .= '					<Ctry>' . $country[1] . '</Ctry>' . $CrLf;
2533
+				$XML_SEPA_INFO .= '			<ReqdExctnDt>'.dol_print_date($dateTime_ETAD, 'dayrfc').'</ReqdExctnDt>'.$CrLf;
2534
+				$XML_SEPA_INFO .= '			<Dbtr>'.$CrLf;
2535
+				$XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2536
+				$XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
2537
+				$XML_SEPA_INFO .= '					<Ctry>'.$country[1].'</Ctry>'.$CrLf;
2538 2538
 				$addressline1 = strtr($configuration->global->MAIN_INFO_SOCIETE_ADDRESS, array(chr(13) => ", ", chr(10) => ""));
2539
-				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP . (($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' ' . $configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '') . $configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2539
+				$addressline2 = strtr($configuration->global->MAIN_INFO_SOCIETE_ZIP.(($configuration->global->MAIN_INFO_SOCIETE_ZIP || ' '.$configuration->global->MAIN_INFO_SOCIETE_TOWN) ? ' ' : '').$configuration->global->MAIN_INFO_SOCIETE_TOWN, array(chr(13) => ", ", chr(10) => ""));
2540 2540
 				if ($addressline1) {
2541
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2541
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline1), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2542 2542
 				}
2543 2543
 				if ($addressline2) {
2544
-					$XML_SEPA_INFO .= '					<AdrLine>' . dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)) . '</AdrLine>' . $CrLf;
2544
+					$XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($addressline2), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2545 2545
 				}
2546
-				$XML_SEPA_INFO .= '				</PstlAdr>' . $CrLf;
2547
-				$XML_SEPA_INFO .= '			</Dbtr>' . $CrLf;
2548
-				$XML_SEPA_INFO .= '			<DbtrAcct>' . $CrLf;
2549
-				$XML_SEPA_INFO .= '				<Id>' . $CrLf;
2550
-				$XML_SEPA_INFO .= '					<IBAN>' . preg_replace('/\s/', '', $this->emetteur_iban) . '</IBAN>' . $CrLf;
2551
-				$XML_SEPA_INFO .= '				</Id>' . $CrLf;
2552
-				$XML_SEPA_INFO .= '			</DbtrAcct>' . $CrLf;
2553
-				$XML_SEPA_INFO .= '			<DbtrAgt>' . $CrLf;
2554
-				$XML_SEPA_INFO .= '				<FinInstnId>' . $CrLf;
2555
-				$XML_SEPA_INFO .= '					<BIC>' . $this->emetteur_bic . '</BIC>' . $CrLf;
2556
-				$XML_SEPA_INFO .= '				</FinInstnId>' . $CrLf;
2557
-				$XML_SEPA_INFO .= '			</DbtrAgt>' . $CrLf;
2546
+				$XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2547
+				$XML_SEPA_INFO .= '			</Dbtr>'.$CrLf;
2548
+				$XML_SEPA_INFO .= '			<DbtrAcct>'.$CrLf;
2549
+				$XML_SEPA_INFO .= '				<Id>'.$CrLf;
2550
+				$XML_SEPA_INFO .= '					<IBAN>'.preg_replace('/\s/', '', $this->emetteur_iban).'</IBAN>'.$CrLf;
2551
+				$XML_SEPA_INFO .= '				</Id>'.$CrLf;
2552
+				$XML_SEPA_INFO .= '			</DbtrAcct>'.$CrLf;
2553
+				$XML_SEPA_INFO .= '			<DbtrAgt>'.$CrLf;
2554
+				$XML_SEPA_INFO .= '				<FinInstnId>'.$CrLf;
2555
+				$XML_SEPA_INFO .= '					<BIC>'.$this->emetteur_bic.'</BIC>'.$CrLf;
2556
+				$XML_SEPA_INFO .= '				</FinInstnId>'.$CrLf;
2557
+				$XML_SEPA_INFO .= '			</DbtrAgt>'.$CrLf;
2558 2558
 				/* $XML_SEPA_INFO .= '			<UltmtCdtr>'.$CrLf;
2559 2559
 				 $XML_SEPA_INFO .= '				<Nm>'.dolEscapeXML(strtoupper(dol_string_nospecial(dol_string_unaccent($this->raison_sociale), ' '))).'</Nm>'.$CrLf;
2560 2560
 				 $XML_SEPA_INFO .= '				<PstlAdr>'.$CrLf;
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 				 $XML_SEPA_INFO .= '					<AdrLine>'.dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN), ' '), 70, 'right', 'UTF-8', 1)).'</AdrLine>'.$CrLf;
2564 2564
 				 $XML_SEPA_INFO .= '				</PstlAdr>'.$CrLf;
2565 2565
 				 $XML_SEPA_INFO .= '			</UltmtCdtr>'.$CrLf;*/
2566
-				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>' . $CrLf; // Field "Responsible of fees". Must be SLEV
2566
+				$XML_SEPA_INFO .= '			<ChrgBr>SLEV</ChrgBr>'.$CrLf; // Field "Responsible of fees". Must be SLEV
2567 2567
 				/*$XML_SEPA_INFO .= '			<CdtrSchmeId>'.$CrLf;
2568 2568
 				 $XML_SEPA_INFO .= '				<Id>'.$CrLf;
2569 2569
 				 $XML_SEPA_INFO .= '					<PrvtId>'.$CrLf;
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 				 $XML_SEPA_INFO .= '			</CdtrSchmeId>'.$CrLf;*/
2579 2579
 			}
2580 2580
 		} else {
2581
-			fwrite($this->file, 'INCORRECT EMETTEUR ' . $this->raison_sociale . $CrLf);
2581
+			fwrite($this->file, 'INCORRECT EMETTEUR '.$this->raison_sociale.$CrLf);
2582 2582
 			$XML_SEPA_INFO = '';
2583 2583
 		}
2584 2584
 		return $XML_SEPA_INFO;
@@ -2630,7 +2630,7 @@  discard block
 block discarded – undo
2630 2630
 
2631 2631
 		$montant = ($total * 100);
2632 2632
 
2633
-		fwrite($this->file, substr("000000000000000" . $montant, -16));
2633
+		fwrite($this->file, substr("000000000000000".$montant, -16));
2634 2634
 
2635 2635
 		// Zone Reservee F
2636 2636
 
@@ -2787,18 +2787,18 @@  discard block
 block discarded – undo
2787 2787
 		$return .= img_picto('', $this->picto);
2788 2788
 		$return .= '</span>';
2789 2789
 		$return .= '<div class="info-box-content">';
2790
-		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">' . (method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref) . '</span>';
2790
+		$return .= '<span class="info-box-ref inline-block tdoverflowmax150 valignmiddle">'.(method_exists($this, 'getNomUrl') ? $this->getNomUrl(1) : $this->ref).'</span>';
2791 2791
 		if ($selected >= 0) {
2792
-			$return .= '<input id="cb' . $this->id . '" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="' . $this->id . '"' . ($selected ? ' checked="checked"' : '') . '>';
2792
+			$return .= '<input id="cb'.$this->id.'" class="flat checkforselect fright" type="checkbox" name="toselect[]" value="'.$this->id.'"'.($selected ? ' checked="checked"' : '').'>';
2793 2793
 		}
2794 2794
 		if (property_exists($this, 'date_echeance')) {
2795
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Date") . '</span> : <span class="info-box-label">' . dol_print_date($this->db->jdate($this->date_echeance), 'day') . '</span>';
2795
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Date").'</span> : <span class="info-box-label">'.dol_print_date($this->db->jdate($this->date_echeance), 'day').'</span>';
2796 2796
 		}
2797 2797
 		if (property_exists($this, 'total')) {
2798
-			$return .= '<br><span class="opacitymedium">' . $langs->trans("Amount") . '</span> : <span class="amount">' . price($this->total) . '</span>';
2798
+			$return .= '<br><span class="opacitymedium">'.$langs->trans("Amount").'</span> : <span class="amount">'.price($this->total).'</span>';
2799 2799
 		}
2800 2800
 		if (method_exists($this, 'LibStatut')) {
2801
-			$return .= '<br><div class="info-box-status">' . $this->getLibStatut(3) . '</div>';
2801
+			$return .= '<br><div class="info-box-status">'.$this->getLibStatut(3).'</div>';
2802 2802
 		}
2803 2803
 		$return .= '</div>';
2804 2804
 		$return .= '</div>';
@@ -2819,9 +2819,9 @@  discard block
 block discarded – undo
2819 2819
 			return 0;
2820 2820
 		}
2821 2821
 		if ($id) {
2822
-			$sql = "SELECT COUNT(*) AS nb FROM " . MAIN_DB_PREFIX . "prelevement_lignes";
2823
-			$sql .= " WHERE fk_prelevement_bons = " . ((int) $id);
2824
-			$sql .= " AND fk_soc = 0";	// fk_soc can't be NULL
2822
+			$sql = "SELECT COUNT(*) AS nb FROM ".MAIN_DB_PREFIX."prelevement_lignes";
2823
+			$sql .= " WHERE fk_prelevement_bons = ".((int) $id);
2824
+			$sql .= " AND fk_soc = 0"; // fk_soc can't be NULL
2825 2825
 			$sql .= " AND fk_user IS NOT NULL";
2826 2826
 
2827 2827
 			$num = 0;
Please login to merge, or discard this patch.
htdocs/bom/bom_net_needs.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 $formfile = new FormFile($db);
132 132
 
133 133
 $title = $langs->trans('BOM');
134
-$help_url ='EN:Module_BOM';
134
+$help_url = 'EN:Module_BOM';
135 135
 llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-bom page-net_needs');
136 136
 
137 137
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	print "<thead>\n";
213 213
 	print '<tr class="liste_titre nodrag nodrop">';
214 214
 	print '<td class="linecoldescription">'.$langs->trans('Product');
215
-	if (getDolGlobalString('BOM_SUB_BOM')  && $action == 'treeview') {
215
+	if (getDolGlobalString('BOM_SUB_BOM') && $action == 'treeview') {
216 216
 		print ' &nbsp; <a id="show_all" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').$langs->trans("ExpandAll").'</a>&nbsp;&nbsp;';
217 217
 		print '<a id="hide_all" href="#">'.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").'</a>&nbsp;';
218 218
 	}
Please login to merge, or discard this patch.