Completed
Branch develop (f74d65)
by
unknown
21:18
created
htdocs/contrat/card.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 $permissionnote = $user->hasRight('contrat', 'creer'); // Used by the include of actions_setnotes.inc.php
101 101
 $permissiondellink = $user->hasRight('contrat', 'creer'); // Used by the include of actions_dellink.inc.php
102 102
 $permissiontodelete = ($user->hasRight('contrat', 'creer') && $object->statut == $object::STATUS_DRAFT) || $user->hasRight('contrat', 'supprimer');
103
-$permissiontoadd   = $user->hasRight('contrat', 'creer');     //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
103
+$permissiontoadd   = $user->hasRight('contrat', 'creer'); //  Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
104 104
 $permissiontoedit = $permissiontoadd;
105 105
 $permissiontoactivate = $user->hasRight('contrat', 'activer');
106 106
 $error = 0;
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
 	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
145 145
 
146
-	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';  // Must be include, not include_once
146
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
147 147
 
148 148
 	if ($action == 'confirm_active' && $confirm == 'yes' && $permissiontoactivate) {
149 149
 		$date_start = '';
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 									$lines[$i]->pa_ht,
371 371
 									$array_options,
372 372
 									$lines[$i]->fk_unit,
373
-									$num+1
373
+									$num + 1
374 374
 								);
375 375
 
376 376
 								if ($result < 0) {
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 					$result = $prodcustprice->fetchAll('', '', 0, 0, $filter);
521 521
 					if ($result) {
522 522
 						if (count($prodcustprice->lines) > 0) {
523
-							$price_min =  price($prodcustprice->lines[0]->price_min);
524
-							$price_min_ttc =  price($prodcustprice->lines[0]->price_min_ttc);
523
+							$price_min = price($prodcustprice->lines[0]->price_min);
524
+							$price_min_ttc = price($prodcustprice->lines[0]->price_min_ttc);
525 525
 							/*$tva_tx = $prodcustprice->lines[0]->tva_tx;
526 526
 							if ($prodcustprice->lines[0]->default_vat_code && !preg_match('/\(.*\)/', $tva_tx)) {
527 527
 								$tva_tx .= ' ('.$prodcustprice->lines[0]->default_vat_code.')';
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			// update price_ht with discount
756 756
 			// TODO Use object->updateline instead objedtline->update
757 757
 
758
-			$price_ht =  price2num(GETPOST('elprice'), 'MU');
758
+			$price_ht = price2num(GETPOST('elprice'), 'MU');
759 759
 			$remise_percent = price2num(GETPOST('elremise_percent'), 2);
760 760
 			if ($remise_percent > 0) {
761 761
 				$remise = round(($price_ht * $remise_percent / 100), 2);
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 	} elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) {
862 862
 		$date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear'));
863 863
 		$date_end   = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear'));
864
-		$comment      = GETPOST('comment', 'alpha');
864
+		$comment = GETPOST('comment', 'alpha');
865 865
 		$result = $object->activateAll($user, $date_start, 0, $comment, $date_end);
866 866
 		if ($result < 0) {
867 867
 			setEventMessages($object->error, $object->errors, 'errors');
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
998 998
 
999 999
 	// Actions to build doc
1000
-	$upload_dir = $conf->contrat->multidir_output[!empty($object->entity)?$object->entity:$conf->entity];
1000
+	$upload_dir = $conf->contrat->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity];
1001 1001
 	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
1002 1002
 
1003 1003
 	// Actions to send emails
@@ -1395,7 +1395,7 @@  discard block
 block discarded – undo
1395 1395
 		$morehtmlref .= '<div class="refidno">';
1396 1396
 		// Ref customer
1397 1397
 		$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
1398
-		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1398
+		$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->hasRight('contrat', 'creer'), 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1, 'getFormatedCustomerRef');
1399 1399
 		// Ref supplier
1400 1400
 		$morehtmlref .= '<br>';
1401 1401
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->hasRight('contrat', 'creer'), 'string', '', 0, 1);
@@ -1489,7 +1489,7 @@  discard block
 block discarded – undo
1489 1489
 		}
1490 1490
 
1491 1491
 
1492
-		$arrayothercontracts = $object->getListOfContracts('others');	// array or -1 if technical error
1492
+		$arrayothercontracts = $object->getListOfContracts('others'); // array or -1 if technical error
1493 1493
 
1494 1494
 		/*
1495 1495
 		 * Lines of contracts
Please login to merge, or discard this patch.
htdocs/fourn/class/fournisseur.facture-rec.class.php 1 patch
Spacing   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		$now = dol_now();
266 266
 
267 267
 		// Clean parameters
268
-		$this->titre = empty($this->titre) ? '' : $this->titre;	// deprecated
268
+		$this->titre = empty($this->titre) ? '' : $this->titre; // deprecated
269 269
 		$this->title = empty($this->title) ? '' : $this->title;
270 270
 		$keyforref = $this->table_ref_field;
271 271
 		$this->ref = $this->$keyforref;
@@ -327,32 +327,32 @@  discard block
 block discarded – undo
327 327
 			$sql .= ", '".$this->db->idate($now)."'";
328 328
 			$sql .= ", ".((int) $this->suspended);
329 329
 			$sql .= ", '".$this->db->escape($this->libelle)."'";
330
-			$sql .= ", " .(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0');                              // amount
331
-			$sql .= ", " .((int) $user->id);
332
-			$sql .= ", " .(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
333
-			$sql .= ", " .(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
334
-			$sql .= ", " .($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
335
-			$sql .= ", " .($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
336
-			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL');      // date_lim_reglement
337
-			$sql .= ", " .(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
338
-			$sql .= ", " .(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
339
-			$sql .= ", " .(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
340
-			$sql .= ", " . (int) $facfourn_src->fk_multicurrency;
330
+			$sql .= ", ".(!empty($facfourn_src->total_ttc) ? (float) $facfourn_src->total_ttc : '0'); // amount
331
+			$sql .= ", ".((int) $user->id);
332
+			$sql .= ", ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL');
333
+			$sql .= ", ".(!empty($facfourn_src->fk_account) ? ((int) $facfourn_src->fk_account) : 'NULL');
334
+			$sql .= ", ".($this->cond_reglement_id > 0 ? (int) $this->cond_reglement_id : 'NULL');
335
+			$sql .= ", ".($this->mode_reglement_id > 0 ? (int) $this->mode_reglement_id : 'NULL');
336
+			$sql .= ", ".($facfourn_src->date_echeance > 0 ? "'".$this->db->idate($facfourn_src->date_echeance)."'" : 'NULL'); // date_lim_reglement
337
+			$sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'NULL');
338
+			$sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'NULL');
339
+			$sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL');
340
+			$sql .= ", ".(int) $facfourn_src->fk_multicurrency;
341 341
 			$sql .= ", '".$this->db->escape($facfourn_src->multicurrency_code)."'";
342
-			$sql .= ", " . (float) $facfourn_src->multicurrency_tx;
343
-			$sql .= ", " . (int) $this->usenewprice;
344
-			$sql .= ", " . (int) $this->frequency;
342
+			$sql .= ", ".(float) $facfourn_src->multicurrency_tx;
343
+			$sql .= ", ".(int) $this->usenewprice;
344
+			$sql .= ", ".(int) $this->frequency;
345 345
 			$sql .= ", '".$this->db->escape($this->unit_frequency)."'";
346
-			$sql .= ", " .(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
347
-			$sql .= ", " .(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
348
-			$sql .= ", " . (int) $this->nb_gen_done;
349
-			$sql .= ", " . (int) $this->nb_gen_max;
350
-			$sql .= ", " . (int) $this->auto_validate;
351
-			$sql .= ", " . (int) $this->generate_pdf;
346
+			$sql .= ", ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL');
347
+			$sql .= ", ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL');
348
+			$sql .= ", ".(int) $this->nb_gen_done;
349
+			$sql .= ", ".(int) $this->nb_gen_max;
350
+			$sql .= ", ".(int) $this->auto_validate;
351
+			$sql .= ", ".(int) $this->generate_pdf;
352 352
 			$sql .= ')';
353 353
 
354 354
 			if ($this->db->query($sql)) {
355
-				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_rec');
355
+				$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_rec');
356 356
 
357 357
 				// Fields used into addline later
358 358
 				$this->fk_multicurrency = $facfourn_src->fk_multicurrency;
@@ -489,42 +489,42 @@  discard block
 block discarded – undo
489 489
 		$error = 0;
490 490
 
491 491
 		$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_rec SET";
492
-		$sql .= " titre = '" . (!empty($this->title) ? $this->db->escape($this->title) : "")."'," ;
493
-		$sql .= " ref_supplier = '". (!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
494
-		$sql .= " entity = ". (!empty($this->entity) ? ((int) $this->entity) : 1) . ',';
495
-		if ($this->fk_soc > 0) $sql .= " fk_soc = ". (int) $this->fk_soc. ',';
496
-		$sql .= " suspended = ". (!empty($this->suspended) ? ((int) $this->suspended) : 0) . ',';
497
-		$sql .= " libelle = ". (!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL') . ",";
498
-		$sql .= " vat_src_code = ". (!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL') . ',';
499
-		$sql .= " localtax1 = ". (!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00) . ',';
500
-		$sql .= " localtax2 = ". (!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00) . ',';
501
-		$sql .= " total_ht = ". (!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00) . ',';
502
-		$sql .= " total_tva = ". (!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00) . ',';
503
-		$sql .= " total_ttc = ". (!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00) . ',';
504
-		$sql .= " fk_user_modif = ". ((int) $user->id) . ',';
505
-		$sql .= " fk_projet = ". (!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL') . ',';
506
-		$sql .= " fk_account = ". (!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL') . ',';
507
-		$sql .= " fk_mode_reglement = ". (!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL') . ',';
508
-		$sql .= " fk_cond_reglement = ". (!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL') . ',';
509
-		$sql .= " date_lim_reglement = ". (!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL') . ',';
510
-		$sql .= " note_private = '". (!empty($this->note_private) ? $this->db->escape($this->note_private) : '') . "',";
511
-		$sql .= " note_public = '". (!empty($this->note_public) ? $this->db->escape($this->note_public) : '') . "',";
512
-		$sql .= " modelpdf = ". (!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL') . ",";
513
-		$sql .= " fk_multicurrency = ". (!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL') . ',';
514
-		$sql .= " multicurrency_code = ". (!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL') . ",";
515
-		$sql .= " multicurrency_tx = ". (!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1) . ',';
516
-		$sql .= " multicurrency_total_ht = ". (!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00) . ',';
517
-		$sql .= " multicurrency_total_tva = ". (!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00) . ',';
518
-		$sql .= " multicurrency_total_ttc = ". (!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00) . ',';
519
-		$sql .= " usenewprice = ". (!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0) . ',';
520
-		$sql .= " frequency = ". (!empty($this->frequency) ? ((int) $this->frequency) : 0). ',';
521
-		$sql .= " unit_frequency = '". (!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : ''). "',";
522
-		$sql .= " date_when = ". (!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL') . ',';
523
-		$sql .= " date_last_gen = ". (!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL') . ',';
524
-		$sql .= " nb_gen_done = ". (!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0) . ',';
525
-		$sql .= " nb_gen_max = ". (!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0) . ',';
526
-		$sql .= " auto_validate = ". (!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
527
-		$sql .= " WHERE rowid = ". (int) $this->id;
492
+		$sql .= " titre = '".(!empty($this->title) ? $this->db->escape($this->title) : "")."',";
493
+		$sql .= " ref_supplier = '".(!empty($this->ref_supplier) ? $this->db->escape($this->ref_supplier) : "")."',";
494
+		$sql .= " entity = ".(!empty($this->entity) ? ((int) $this->entity) : 1).',';
495
+		if ($this->fk_soc > 0) $sql .= " fk_soc = ".(int) $this->fk_soc.',';
496
+		$sql .= " suspended = ".(!empty($this->suspended) ? ((int) $this->suspended) : 0).',';
497
+		$sql .= " libelle = ".(!empty($this->libelle) ? "'".$this->db->escape($this->libelle)."'" : 'NULL').",";
498
+		$sql .= " vat_src_code = ".(!empty($this->vat_src_code) ? "'".$this->db->escape($this->vat_src_code)."'" : 'NULL').',';
499
+		$sql .= " localtax1 = ".(!empty($this->localtax1) ? ((float) $this->localtax1) : 0.00).',';
500
+		$sql .= " localtax2 = ".(!empty($this->localtax2) ? ((float) $this->localtax2) : 0.00).',';
501
+		$sql .= " total_ht = ".(!empty($this->total_ht) ? ((float) $this->total_ht) : 0.00).',';
502
+		$sql .= " total_tva = ".(!empty($this->total_tva) ? ((float) $this->total_tva) : 0.00).',';
503
+		$sql .= " total_ttc = ".(!empty($this->total_ttc) ? ((float) $this->total_ttc) : 0.00).',';
504
+		$sql .= " fk_user_modif = ".((int) $user->id).',';
505
+		$sql .= " fk_projet = ".(!empty($this->fk_project) ? ((int) $this->fk_project) : 'NULL').',';
506
+		$sql .= " fk_account = ".(!empty($this->fk_account) ? ((int) $this->fk_account) : 'NULL').',';
507
+		$sql .= " fk_mode_reglement = ".(!empty($this->mode_reglement_id) ? ((int) $this->mode_reglement_id) : 'NULL').',';
508
+		$sql .= " fk_cond_reglement = ".(!empty($this->cond_reglement_id) ? ((int) $this->cond_reglement_id) : 'NULL').',';
509
+		$sql .= " date_lim_reglement = ".(!empty($this->date_lim_reglement) ? "'".$this->db->idate($this->date_lim_reglement)."'" : 'NULL').',';
510
+		$sql .= " note_private = '".(!empty($this->note_private) ? $this->db->escape($this->note_private) : '')."',";
511
+		$sql .= " note_public = '".(!empty($this->note_public) ? $this->db->escape($this->note_public) : '')."',";
512
+		$sql .= " modelpdf = ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : 'NULL').",";
513
+		$sql .= " fk_multicurrency = ".(!empty($this->fk_multicurrency) ? ((int) $this->fk_multicurrency) : 'NULL').',';
514
+		$sql .= " multicurrency_code = ".(!empty($this->multicurrency_code) ? "'".$this->db->escape($this->multicurrency_code)."'" : 'NULL').",";
515
+		$sql .= " multicurrency_tx = ".(!empty($this->multicurrency_tx) ? ((float) $this->multicurrency_tx) : 1).',';
516
+		$sql .= " multicurrency_total_ht = ".(!empty($this->multicurrency_total_ht) ? ((float) $this->multicurrency_total_ht) : 0.00).',';
517
+		$sql .= " multicurrency_total_tva = ".(!empty($this->multicurrency_total_tva) ? ((float) $this->multicurrency_total_tva) : 0.00).',';
518
+		$sql .= " multicurrency_total_ttc = ".(!empty($this->multicurrency_total_ttc) ? ((float) $this->multicurrency_total_ttc) : 0.00).',';
519
+		$sql .= " usenewprice = ".(!empty($this->usenewprice) ? ((int) $this->usenewprice) : 0).',';
520
+		$sql .= " frequency = ".(!empty($this->frequency) ? ((int) $this->frequency) : 0).',';
521
+		$sql .= " unit_frequency = '".(!empty($this->unit_frequency) ? $this->db->escape($this->unit_frequency) : '')."',";
522
+		$sql .= " date_when = ".(!empty($this->date_when) ? "'".$this->db->idate($this->date_when)."'" : 'NULL').',';
523
+		$sql .= " date_last_gen = ".(!empty($this->date_last_gen) ? "'".$this->db->idate($this->date_last_gen)."'" : 'NULL').',';
524
+		$sql .= " nb_gen_done = ".(!empty($this->nb_gen_done) ? ((int) $this->nb_gen_done) : 0).',';
525
+		$sql .= " nb_gen_max = ".(!empty($this->nb_gen_max) ? ((int) $this->nb_gen_max) : 0).',';
526
+		$sql .= " auto_validate = ".(!empty($this->auto_validate) ? ((int) $this->auto_validate) : 0);
527
+		$sql .= " WHERE rowid = ".(int) $this->id;
528 528
 
529 529
 		dol_syslog(get_class($this)."::update", LOG_DEBUG);
530 530
 		$resql = $this->db->query($sql);
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
584 584
 		$sql .= ' WHERE f.entity IN ('.getEntity('invoice').')';
585 585
 		if ($rowid) {
586
-			$sql .= ' AND f.rowid='. (int) $rowid;
586
+			$sql .= ' AND f.rowid='.(int) $rowid;
587 587
 		} elseif ($ref) {
588 588
 			$sql .= " AND f.titre='".$this->db->escape($ref)."'";
589 589
 		} else {
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
717 717
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
718 718
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
719
-		$sql .= ' WHERE l.fk_facture_fourn = '. (int) $this->id;
719
+		$sql .= ' WHERE l.fk_facture_fourn = '.(int) $this->id;
720 720
 		$sql .= ' ORDER BY l.rang';
721 721
 
722 722
 		dol_syslog('FactureFournisseurRec::fetch_lines', LOG_DEBUG);
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 				$line->product_type             = $objp->product_type;
757 757
 				$line->date_start               = $objp->date_start;
758 758
 				$line->date_end                 = $objp->date_end;
759
-				$line->info_bits                = $objp->info_bits	;
759
+				$line->info_bits                = $objp->info_bits;
760 760
 				$line->special_code             = $objp->special_code;
761 761
 				$line->rang                     = $objp->rang;
762 762
 				$line->fk_unit                  = $objp->fk_unit;
@@ -806,11 +806,11 @@  discard block
 block discarded – undo
806 806
 		$main = MAIN_DB_PREFIX.'facture_fourn_det_rec';
807 807
 		$ef = $main."_extrafields";
808 808
 
809
-		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ". (int) $rowid .")";
810
-		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ". (int) $rowid;
809
+		$sqlef = "DELETE FROM ".$ef." WHERE fk_object IN (SELECT rowid FROM ".$main." WHERE fk_facture_fourn = ".(int) $rowid.")";
810
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_det_rec WHERE fk_facture_fourn = ".(int) $rowid;
811 811
 
812 812
 		if ($this->db->query($sqlef) && $this->db->query($sql)) {
813
-			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ". (int) $rowid;
813
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_fourn_rec WHERE rowid = ".(int) $rowid;
814 814
 			dol_syslog($sql);
815 815
 			if ($this->db->query($sql)) {
816 816
 				// Delete linked object
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 			}
840 840
 			// End call triggers
841 841
 		}
842
-		if (! $error) {
842
+		if (!$error) {
843 843
 			$this->db->commit();
844 844
 			return 1;
845 845
 		} else {
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 				}
952 952
 			}
953 953
 
954
-			$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec (';
954
+			$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det_rec (';
955 955
 			$sql .= 'fk_facture_fourn';
956 956
 			$sql .= ', fk_product';
957 957
 			$sql .= ', ref';
@@ -983,46 +983,46 @@  discard block
 block discarded – undo
983 983
 			$sql .= ', fk_user_author';
984 984
 			$sql .= ', fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc';
985 985
 			$sql .= ') VALUES (';
986
-			$sql .= ' ' . (int) $facid;   // source supplier invoie id
987
-			$sql .= ', ' . (!empty($fk_product) ? "'" . $this->db->escape($fk_product) . "'" : 'null');
988
-			$sql .= ', ' . (!empty($ref) ? "'" . $this->db->escape($ref) . "'" : 'null');
989
-			$sql .= ', ' . (!empty($label) ? "'" . $this->db->escape($label) . "'" : 'null');
990
-			$sql .= ", '" . $this->db->escape($desc) . "'";
991
-			$sql .= ', ' . price2num($pu_ht);
992
-			$sql .= ', ' . price2num($pu_ttc);
993
-			$sql .= ', ' . price2num($qty);
994
-			$sql .= ', ' . price2num($remise_percent);
986
+			$sql .= ' '.(int) $facid; // source supplier invoie id
987
+			$sql .= ', '.(!empty($fk_product) ? "'".$this->db->escape($fk_product)."'" : 'null');
988
+			$sql .= ', '.(!empty($ref) ? "'".$this->db->escape($ref)."'" : 'null');
989
+			$sql .= ', '.(!empty($label) ? "'".$this->db->escape($label)."'" : 'null');
990
+			$sql .= ", '".$this->db->escape($desc)."'";
991
+			$sql .= ', '.price2num($pu_ht);
992
+			$sql .= ', '.price2num($pu_ttc);
993
+			$sql .= ', '.price2num($qty);
994
+			$sql .= ', '.price2num($remise_percent);
995 995
 			$sql .= ', null';
996
-			$sql .= ", '" . $this->db->escape($vat_src_code) . "'";
997
-			$sql .= ', ' . price2num($txtva);
998
-			$sql .= ', ' . price2num($txlocaltax1);
999
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '') . "'";
1000
-			$sql .= ', ' . price2num($txlocaltax2);
1001
-			$sql .= ", '" . $this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '') . "'";
1002
-			$sql .= ', ' . price2num($total_ht);
1003
-			$sql .= ', ' . price2num($total_tva);
1004
-			$sql .= ', ' . price2num($total_localtax1);
1005
-			$sql .= ', ' . price2num($total_localtax2);
1006
-			$sql .= ', ' . price2num($total_ttc);
1007
-			$sql .= ', ' . (int) $product_type;
1008
-			$sql .= ', ' . ($date_start > 0 ? (int) $date_start : 'NULL');
1009
-			$sql .= ', ' . ($date_end > 0 ? (int) $date_end : 'NULL');
1010
-			$sql .= ', ' . (int) $info_bits;
1011
-			$sql .= ', ' . (int) $special_code;
1012
-			$sql .= ', ' . (int) $rang;
1013
-			$sql .= ', ' . ($fk_unit ? (int) $fk_unit : 'NULL');
1014
-			$sql .= ', ' . (int) $user->id;
1015
-			$sql .= ', ' . (int) $this->fk_multicurrency;
1016
-			$sql .= ", '" . $this->db->escape($this->multicurrency_code) . "'";
1017
-			$sql .= ', ' . price2num($pu_ht_devise, 'CU');
1018
-			$sql .= ', ' . price2num($multicurrency_total_ht, 'CT');
1019
-			$sql .= ', ' . price2num($multicurrency_total_tva, 'CT');
1020
-			$sql .= ', ' . price2num($multicurrency_total_ttc, 'CT');
996
+			$sql .= ", '".$this->db->escape($vat_src_code)."'";
997
+			$sql .= ', '.price2num($txtva);
998
+			$sql .= ', '.price2num($txlocaltax1);
999
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[0]) ? $localtaxes_type[0] : '')."'";
1000
+			$sql .= ', '.price2num($txlocaltax2);
1001
+			$sql .= ", '".$this->db->escape(isset($localtaxes_type[2]) ? $localtaxes_type[2] : '')."'";
1002
+			$sql .= ', '.price2num($total_ht);
1003
+			$sql .= ', '.price2num($total_tva);
1004
+			$sql .= ', '.price2num($total_localtax1);
1005
+			$sql .= ', '.price2num($total_localtax2);
1006
+			$sql .= ', '.price2num($total_ttc);
1007
+			$sql .= ', '.(int) $product_type;
1008
+			$sql .= ', '.($date_start > 0 ? (int) $date_start : 'NULL');
1009
+			$sql .= ', '.($date_end > 0 ? (int) $date_end : 'NULL');
1010
+			$sql .= ', '.(int) $info_bits;
1011
+			$sql .= ', '.(int) $special_code;
1012
+			$sql .= ', '.(int) $rang;
1013
+			$sql .= ', '.($fk_unit ? (int) $fk_unit : 'NULL');
1014
+			$sql .= ', '.(int) $user->id;
1015
+			$sql .= ', '.(int) $this->fk_multicurrency;
1016
+			$sql .= ", '".$this->db->escape($this->multicurrency_code)."'";
1017
+			$sql .= ', '.price2num($pu_ht_devise, 'CU');
1018
+			$sql .= ', '.price2num($multicurrency_total_ht, 'CT');
1019
+			$sql .= ', '.price2num($multicurrency_total_tva, 'CT');
1020
+			$sql .= ', '.price2num($multicurrency_total_ttc, 'CT');
1021 1021
 			$sql .= ')';
1022 1022
 
1023
-			dol_syslog(get_class($this). '::addline', LOG_DEBUG);
1023
+			dol_syslog(get_class($this).'::addline', LOG_DEBUG);
1024 1024
 			if ($this->db->query($sql)) {
1025
-				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX. 'facture_fourn_det_rec');
1025
+				$lineId = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det_rec');
1026 1026
 				$this->update_price();
1027 1027
 				$this->id = $facid;
1028 1028
 				$this->db->commit();
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
 		$facid = $this->id;
1075 1075
 
1076
-		dol_syslog(get_class($this). '::updateline facid=' .$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1076
+		dol_syslog(get_class($this).'::updateline facid='.$facid." rowid=$rowid, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, txlocaltax1=$txlocaltax1, txlocaltax2=$txlocaltax2, fk_product=$fk_product, remise_percent=$remise_percent, info_bits=$info_bits, price_base_type=$price_base_type, pu_ttc=$pu_ttc, type=$type, fk_unit=$fk_unit, pu_ht_devise=$pu_ht_devise", LOG_DEBUG);
1077 1077
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
1078 1078
 
1079 1079
 		// Check parameters
@@ -1144,41 +1144,41 @@  discard block
 block discarded – undo
1144 1144
 				$product_type = $product->type;
1145 1145
 			}
1146 1146
 
1147
-			$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
1148
-			$sql .= ' fk_facture_fourn = ' . ((int) $facid);
1149
-			$sql .= ', fk_product = ' . ($fk_product > 0 ? ((int) $fk_product) : 'null');
1150
-			$sql .= ", ref = '" . $this->db->escape($ref) . "'";
1151
-			$sql .= ", label = '" . $this->db->escape($label) . "'";
1152
-			$sql .= ", description = '" . $this->db->escape($desc) . "'";
1153
-			$sql .= ', pu_ht = ' . price2num($pu_ht);
1154
-			$sql .= ', qty = ' . price2num($qty);
1155
-			$sql .= ", remise_percent = '" . price2num($remise_percent) . "'";
1156
-			$sql .= ", vat_src_code = '" . $this->db->escape($vat_src_code) . "'";
1157
-			$sql .= ', tva_tx = ' . price2num($txtva);
1158
-			$sql .= ', localtax1_tx = ' . (float) $txlocaltax1;
1159
-			$sql .= ", localtax1_type = '" . $this->db->escape($localtaxes_type[0]) . "'";
1160
-			$sql .= ', localtax2_tx = ' . (float) $txlocaltax2;
1161
-			$sql .= ", localtax2_type = '" . $this->db->escape($localtaxes_type[2]) . "'";
1162
-			$sql .= ", total_ht = '" . price2num($total_ht) . "'";
1163
-			$sql .= ", total_tva = '" . price2num($total_tva) . "'";
1164
-			$sql .= ", total_localtax1 = '" . price2num($total_localtax1) . "'";
1165
-			$sql .= ", total_localtax2 = '" . price2num($total_localtax2) . "'";
1166
-			$sql .= ", total_ttc = '" . price2num($total_ttc) . "'";
1167
-			$sql .= ', product_type = ' . (int) $product_type;
1168
-			$sql .= ', date_start = ' . (empty($date_start) ? 'NULL' : (int) $date_start);
1169
-			$sql .= ', date_end = ' . (empty($date_end) ? 'NULL' : (int) $date_end);
1170
-			$sql .= ', info_bits = ' . (int) $info_bits;
1171
-			$sql .= ', special_code = ' . (int) $special_code;
1172
-			$sql .= ', rang = ' . (int) $rang;
1173
-			$sql .= ', fk_unit = ' . ($fk_unit ? "'" . $this->db->escape($fk_unit) . "'" : 'null');
1174
-			$sql .= ', fk_user_modif = ' . (int) $user;
1147
+			$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
1148
+			$sql .= ' fk_facture_fourn = '.((int) $facid);
1149
+			$sql .= ', fk_product = '.($fk_product > 0 ? ((int) $fk_product) : 'null');
1150
+			$sql .= ", ref = '".$this->db->escape($ref)."'";
1151
+			$sql .= ", label = '".$this->db->escape($label)."'";
1152
+			$sql .= ", description = '".$this->db->escape($desc)."'";
1153
+			$sql .= ', pu_ht = '.price2num($pu_ht);
1154
+			$sql .= ', qty = '.price2num($qty);
1155
+			$sql .= ", remise_percent = '".price2num($remise_percent)."'";
1156
+			$sql .= ", vat_src_code = '".$this->db->escape($vat_src_code)."'";
1157
+			$sql .= ', tva_tx = '.price2num($txtva);
1158
+			$sql .= ', localtax1_tx = '.(float) $txlocaltax1;
1159
+			$sql .= ", localtax1_type = '".$this->db->escape($localtaxes_type[0])."'";
1160
+			$sql .= ', localtax2_tx = '.(float) $txlocaltax2;
1161
+			$sql .= ", localtax2_type = '".$this->db->escape($localtaxes_type[2])."'";
1162
+			$sql .= ", total_ht = '".price2num($total_ht)."'";
1163
+			$sql .= ", total_tva = '".price2num($total_tva)."'";
1164
+			$sql .= ", total_localtax1 = '".price2num($total_localtax1)."'";
1165
+			$sql .= ", total_localtax2 = '".price2num($total_localtax2)."'";
1166
+			$sql .= ", total_ttc = '".price2num($total_ttc)."'";
1167
+			$sql .= ', product_type = '.(int) $product_type;
1168
+			$sql .= ', date_start = '.(empty($date_start) ? 'NULL' : (int) $date_start);
1169
+			$sql .= ', date_end = '.(empty($date_end) ? 'NULL' : (int) $date_end);
1170
+			$sql .= ', info_bits = '.(int) $info_bits;
1171
+			$sql .= ', special_code = '.(int) $special_code;
1172
+			$sql .= ', rang = '.(int) $rang;
1173
+			$sql .= ', fk_unit = '.($fk_unit ? "'".$this->db->escape($fk_unit)."'" : 'null');
1174
+			$sql .= ', fk_user_modif = '.(int) $user;
1175 1175
 			$sql .= ', multicurrency_subprice = '.price2num($pu_ht_devise);
1176 1176
 			$sql .= ', multicurrency_total_ht = '.price2num($multicurrency_total_ht);
1177 1177
 			$sql .= ', multicurrency_total_tva = '.price2num($multicurrency_total_tva);
1178 1178
 			$sql .= ', multicurrency_total_ttc = '.price2num($multicurrency_total_ttc);
1179
-			$sql .= ' WHERE rowid = ' . (int) $rowid;
1179
+			$sql .= ' WHERE rowid = '.(int) $rowid;
1180 1180
 
1181
-			dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
1181
+			dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
1182 1182
 			if ($this->db->query($sql)) {
1183 1183
 				$this->id = $facid;
1184 1184
 				$this->update_price();
@@ -1267,16 +1267,16 @@  discard block
 block discarded – undo
1267 1267
 		$tmparray = dol_getdate($now);
1268 1268
 		$today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day
1269 1269
 
1270
-		dol_syslog('createRecurringInvoices restrictioninvoiceid=' .$restrictioninvoiceid. ' forcevalidation=' .$forcevalidation);
1270
+		dol_syslog('createRecurringInvoices restrictioninvoiceid='.$restrictioninvoiceid.' forcevalidation='.$forcevalidation);
1271 1271
 
1272 1272
 		$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'facture_fourn_rec';
1273 1273
 		$sql .= ' WHERE frequency > 0'; // A recurring supplier invoice is an invoice with a frequency
1274 1274
 		$sql .= " AND (date_when IS NULL OR date_when <= '".$this->db->idate($today)."')";
1275 1275
 		$sql .= ' AND (nb_gen_done < nb_gen_max OR nb_gen_max = 0)';
1276 1276
 		$sql .= ' AND suspended = 0';
1277
-		$sql .= ' AND entity = '. (int) $conf->entity; // MUST STAY = $conf->entity here
1277
+		$sql .= ' AND entity = '.(int) $conf->entity; // MUST STAY = $conf->entity here
1278 1278
 		if ($restrictioninvoiceid > 0) {
1279
-			$sql .= ' AND rowid = '. (int) $restrictioninvoiceid;
1279
+			$sql .= ' AND rowid = '.(int) $restrictioninvoiceid;
1280 1280
 		}
1281 1281
 		$sql .= $this->db->order('entity', 'ASC');
1282 1282
 		//print $sql;exit;
@@ -1298,7 +1298,7 @@  discard block
 block discarded – undo
1298 1298
 			}
1299 1299
 
1300 1300
 			$saventity = $conf->entity;
1301
-			$laststep="None";
1301
+			$laststep = "None";
1302 1302
 
1303 1303
 			while ($i < $num) {     // Loop on each template invoice. If $num = 0, test is false at first pass.
1304 1304
 				$line = $this->db->fetch_object($resql);
@@ -1309,21 +1309,21 @@  discard block
 block discarded – undo
1309 1309
 
1310 1310
 				$new_fac_fourn = null;
1311 1311
 				$facturerec = new FactureFournisseurRec($this->db);
1312
-				$laststep="Fetch {$line->rowid}";
1312
+				$laststep = "Fetch {$line->rowid}";
1313 1313
 				$facturerec->fetch($line->rowid);
1314 1314
 
1315 1315
 				if ($facturerec->id > 0) {
1316 1316
 					// Set entity context
1317 1317
 					$conf->entity = $facturerec->entity;
1318 1318
 
1319
-					dol_syslog('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', ref=' .$facturerec->ref. ', entity=' .$facturerec->entity);
1319
+					dol_syslog('createRecurringInvoices Process invoice template id='.$facturerec->id.', ref='.$facturerec->ref.', entity='.$facturerec->entity);
1320 1320
 
1321 1321
 					$new_fac_fourn = new FactureFournisseur($this->db);
1322 1322
 					$new_fac_fourn->fac_rec = $facturerec->id; // We will create $facture from this recurring invoice
1323 1323
 					$new_fac_fourn->fk_fac_rec_source = $facturerec->id; // We will create $facture from this recurring invoice
1324 1324
 
1325 1325
 					$new_fac_fourn->type = self::TYPE_STANDARD;
1326
-					$new_fac_fourn->statut = self::STATUS_DRAFT;	// deprecated
1326
+					$new_fac_fourn->statut = self::STATUS_DRAFT; // deprecated
1327 1327
 					$new_fac_fourn->status = self::STATUS_DRAFT;
1328 1328
 					$new_fac_fourn->date = empty($facturerec->date_when) ? $now : $facturerec->date_when; // We could also use dol_now here but we prefer date_when so invoice has real date when we would like even if we generate later.
1329 1329
 					$new_fac_fourn->socid = $facturerec->socid;
@@ -1332,10 +1332,10 @@  discard block
 block discarded – undo
1332 1332
 					$new_fac_fourn->model_pdf = $facturerec->model_pdf;
1333 1333
 					$new_fac_fourn->fk_project = $facturerec->fk_project;
1334 1334
 					$new_fac_fourn->label = $facturerec->label;
1335
-					$new_fac_fourn->libelle = $facturerec->label;	// deprecated
1335
+					$new_fac_fourn->libelle = $facturerec->label; // deprecated
1336 1336
 
1337 1337
 					$invoiceidgenerated = $new_fac_fourn->create($user);
1338
-					$laststep="Create invoiceidgenerated $invoiceidgenerated";
1338
+					$laststep = "Create invoiceidgenerated $invoiceidgenerated";
1339 1339
 					if ($invoiceidgenerated <= 0) {
1340 1340
 						$this->errors = $new_fac_fourn->errors;
1341 1341
 						$this->error = $new_fac_fourn->error;
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
 					}
1344 1344
 					if (!$error && ($facturerec->auto_validate || $forcevalidation)) {
1345 1345
 						$result = $new_fac_fourn->validate($user);
1346
-						$laststep="Validate by user $user";
1346
+						$laststep = "Validate by user $user";
1347 1347
 						if ($result <= 0) {
1348 1348
 							$this->errors = $new_fac_fourn->errors;
1349 1349
 							$this->error = $new_fac_fourn->error;
@@ -1353,9 +1353,9 @@  discard block
 block discarded – undo
1353 1353
 
1354 1354
 					if (!$error && $facturerec->generate_pdf) {
1355 1355
 						// We refresh the object in order to have all necessary data (like date_lim_reglement)
1356
-						$laststep="Refresh {$new_fac_fourn->id}";
1356
+						$laststep = "Refresh {$new_fac_fourn->id}";
1357 1357
 						$new_fac_fourn->fetch($new_fac_fourn->id);
1358
-						$laststep="GenerateDocument {$new_fac_fourn->id}";
1358
+						$laststep = "GenerateDocument {$new_fac_fourn->id}";
1359 1359
 						$result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs);
1360 1360
 						if ($result < 0) {
1361 1361
 							$this->errors = $new_fac_fourn->errors;
@@ -1365,22 +1365,22 @@  discard block
 block discarded – undo
1365 1365
 					}
1366 1366
 				} else {
1367 1367
 					$error++;
1368
-					$this->error = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity."\n";
1369
-					$this->errors[] = 'Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity;
1370
-					dol_syslog('createRecurringInvoices Failed to load invoice template with id=' .$line->rowid. ', entity=' .$conf->entity);
1368
+					$this->error = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity."\n";
1369
+					$this->errors[] = 'Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity;
1370
+					dol_syslog('createRecurringInvoices Failed to load invoice template with id='.$line->rowid.', entity='.$conf->entity);
1371 1371
 				}
1372 1372
 
1373 1373
 				if (!$error && $invoiceidgenerated >= 0) {
1374 1374
 					$facturerec->nb_gen_done++;
1375 1375
 					$facturerec->date_last_gen = dol_now();
1376
-					$facturerec->date_when= $facturerec->getNextDate();
1376
+					$facturerec->date_when = $facturerec->getNextDate();
1377 1377
 					$facturerec->update($user);
1378
-					$this->db->commit('createRecurringInvoices Process invoice template id=' .$facturerec->id. ', title=' .$facturerec->title);
1379
-					dol_syslog('createRecurringInvoices Process invoice template ' .$facturerec->title. ' is finished with a success generation');
1378
+					$this->db->commit('createRecurringInvoices Process invoice template id='.$facturerec->id.', title='.$facturerec->title);
1379
+					dol_syslog('createRecurringInvoices Process invoice template '.$facturerec->title.' is finished with a success generation');
1380 1380
 					$nb_create++;
1381 1381
 					$this->output .= $langs->trans('InvoiceGeneratedFromTemplate', $new_fac_fourn->ref, $facturerec->title)."\n";
1382 1382
 				} else {
1383
-					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id=' .$facturerec->id. ', title=' .$facturerec->title);
1383
+					$this->db->rollback('createRecurringInvoices Process invoice template error='.$error.' invoiceidgenerated='.$invoiceidgenerated.' LastStep='.$laststep.' id='.$facturerec->id.', title='.$facturerec->title);
1384 1384
 				}
1385 1385
 
1386 1386
 				$parameters = array(
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 		}
1474 1474
 		$result .= $linkend;
1475 1475
 		global $action;
1476
-		$hookmanager->initHooks(array($this->element . 'dao'));
1476
+		$hookmanager->initHooks(array($this->element.'dao'));
1477 1477
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
1478 1478
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1479 1479
 		if ($reshook > 0) {
@@ -1652,8 +1652,8 @@  discard block
 block discarded – undo
1652 1652
 		$prodids = array();
1653 1653
 
1654 1654
 		$sql = 'SELECT rowid';
1655
-		$sql .= ' FROM ' .MAIN_DB_PREFIX. 'product';
1656
-		$sql .= ' WHERE entity IN (' .getEntity('product'). ')';
1655
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'product';
1656
+		$sql .= ' WHERE entity IN ('.getEntity('product').')';
1657 1657
 		$sql .= $this->db->plimit(100);
1658 1658
 
1659 1659
 		$resql = $this->db->query($sql);
@@ -1692,7 +1692,7 @@  discard block
 block discarded – undo
1692 1692
 			$xnbp = 0;
1693 1693
 			while ($xnbp < $nbp) {
1694 1694
 				$line = new FactureLigne($this->db);
1695
-				$line->desc = $langs->trans('Description'). ' ' .$xnbp;
1695
+				$line->desc = $langs->trans('Description').' '.$xnbp;
1696 1696
 				$line->qty = 1;
1697 1697
 				$line->subprice = 100;
1698 1698
 				$line->tva_tx = 19.6;
@@ -1740,7 +1740,7 @@  discard block
 block discarded – undo
1740 1740
 
1741 1741
 			// Add a line "offered"
1742 1742
 			$line = new FactureLigne($this->db);
1743
-			$line->desc = $langs->trans('Description'). ' (offered line)';
1743
+			$line->desc = $langs->trans('Description').' (offered line)';
1744 1744
 			$line->qty = 1;
1745 1745
 			$line->subprice = 100;
1746 1746
 			$line->tva_tx = 19.6;
@@ -1787,12 +1787,12 @@  discard block
 block discarded – undo
1787 1787
 	public function setFrequencyAndUnit($frequency, $unit)
1788 1788
 	{
1789 1789
 		if (!$this->table_element) {
1790
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1790
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with property table_element not defined', LOG_ERR);
1791 1791
 			return -1;
1792 1792
 		}
1793 1793
 
1794 1794
 		if (!empty($frequency) && empty($unit)) {
1795
-			dol_syslog(get_class($this). '::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1795
+			dol_syslog(get_class($this).'::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined', LOG_ERR);
1796 1796
 			return -2;
1797 1797
 		}
1798 1798
 
@@ -1831,11 +1831,11 @@  discard block
 block discarded – undo
1831 1831
 			return -1;
1832 1832
 		}
1833 1833
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1834
-		$sql .= " SET date_when = " .($date ? "'".$this->db->idate($date)."'" : "NULL");
1834
+		$sql .= " SET date_when = ".($date ? "'".$this->db->idate($date)."'" : "NULL");
1835 1835
 		if ($increment_nb_gen_done > 0) {
1836 1836
 			$sql .= ", nb_gen_done = nb_gen_done + 1";
1837 1837
 		}
1838
-		$sql .= " WHERE rowid = " . (int) $this->id;
1838
+		$sql .= " WHERE rowid = ".(int) $this->id;
1839 1839
 
1840 1840
 		dol_syslog(get_class($this).'::setNextDate', LOG_DEBUG);
1841 1841
 
@@ -1869,8 +1869,8 @@  discard block
 block discarded – undo
1869 1869
 		}
1870 1870
 
1871 1871
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1872
-		$sql .= " SET nb_gen_max = ". (int) $nb;
1873
-		$sql .= " WHERE rowid = " . (int) $this->id;
1872
+		$sql .= " SET nb_gen_max = ".(int) $nb;
1873
+		$sql .= " WHERE rowid = ".(int) $this->id;
1874 1874
 
1875 1875
 		dol_syslog(get_class($this).'::setMaxPeriod', LOG_DEBUG);
1876 1876
 
@@ -1898,7 +1898,7 @@  discard block
 block discarded – undo
1898 1898
 
1899 1899
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1900 1900
 		$sql .= " SET auto_validate = ".((int) $validate);
1901
-		$sql .= " WHERE rowid = " . (int) $this->id;
1901
+		$sql .= " WHERE rowid = ".(int) $this->id;
1902 1902
 
1903 1903
 		dol_syslog(get_class($this).'::setAutoValidate', LOG_DEBUG);
1904 1904
 
@@ -1925,8 +1925,8 @@  discard block
 block discarded – undo
1925 1925
 		}
1926 1926
 
1927 1927
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1928
-		$sql .= " SET generate_pdf = ". (int) $validate;
1929
-		$sql .= " WHERE rowid = " . (int) $this->id;
1928
+		$sql .= " SET generate_pdf = ".(int) $validate;
1929
+		$sql .= " WHERE rowid = ".(int) $this->id;
1930 1930
 
1931 1931
 		dol_syslog(get_class($this).'::setGeneratePdf', LOG_DEBUG);
1932 1932
 
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
 
1955 1955
 		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
1956 1956
 		$sql .= " SET modelpdf = '".$this->db->escape($model)."'";
1957
-		$sql .= " WHERE rowid = " . (int) $this->id;
1957
+		$sql .= " WHERE rowid = ".(int) $this->id;
1958 1958
 
1959 1959
 		dol_syslog(get_class($this).'::setModelPdf', LOG_DEBUG);
1960 1960
 
@@ -2027,8 +2027,8 @@  discard block
 block discarded – undo
2027 2027
 		$error = 0;
2028 2028
 		$this->db->begin();
2029 2029
 
2030
-		if (! $error) {
2031
-			if (! $notrigger) {
2030
+		if (!$error) {
2031
+			if (!$notrigger) {
2032 2032
 				// Call triggers
2033 2033
 				$result = $this->call_trigger('LINESUPPLIERBILLREC_DELETE', $user);
2034 2034
 				if ($result < 0) {
@@ -2038,15 +2038,15 @@  discard block
 block discarded – undo
2038 2038
 			}
2039 2039
 		}
2040 2040
 
2041
-		if (! $error) {
2041
+		if (!$error) {
2042 2042
 			$result = $this->deleteExtraFields();
2043 2043
 			if ($result < 0) {
2044 2044
 				$error++;
2045 2045
 			}
2046 2046
 		}
2047 2047
 
2048
-		if (! $error) {
2049
-			$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . ' WHERE rowid=' . (int) $this->id;
2048
+		if (!$error) {
2049
+			$sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.(int) $this->id;
2050 2050
 
2051 2051
 			$res = $this->db->query($sql);
2052 2052
 			if ($res === false) {
@@ -2086,7 +2086,7 @@  discard block
 block discarded – undo
2086 2086
 		$sql .= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
2087 2087
 		$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det_rec as l';
2088 2088
 		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
2089
-		$sql .= ' WHERE l.rowid = '. (int) $rowid;
2089
+		$sql .= ' WHERE l.rowid = '.(int) $rowid;
2090 2090
 		$sql .= ' ORDER BY l.rang';
2091 2091
 
2092 2092
 		dol_syslog('FactureRec::fetch', LOG_DEBUG);
@@ -2158,44 +2158,44 @@  discard block
 block discarded – undo
2158 2158
 
2159 2159
 		include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
2160 2160
 
2161
-		$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'facture_fourn_det_rec SET';
2162
-		$sql .= ' fk_facture_fourn = ' . (int) $this->fk_facture_fourn;
2163
-		$sql .= ', fk_parent_line = ' . (int) $this->fk_parent;
2164
-		$sql .= ', fk_product = ' . (int) $this->fk_product;
2165
-		$sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL');
2166
-		$sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL');
2167
-		$sql .= ", description = '" . $this->db->escape($this->description) . "'";
2168
-		$sql .= ', pu_ht = ' . price2num($this->pu_ht);
2169
-		$sql .= ', pu_ttc = ' . price2num($this->pu_ttc);
2170
-		$sql .= ', qty = ' . price2num($this->qty);
2171
-		$sql .= ", remise_percent = '" . price2num($this->remise_percent) . "'";
2172
-		$sql .= ', fk_remise_except = ' . (int) $this->fk_remise_except;
2173
-		$sql .= ", vat_src_code = '" . $this->db->escape($this->vat_src_code) . "'";
2174
-		$sql .= ', tva_tx = ' . price2num($this->tva_tx);
2175
-		$sql .= ', localtax1_tx = ' . price2num($this->localtax1_tx);
2176
-		$sql .= ", localtax1_type = '" . $this->db->escape($this->localtax1_type) . "'";
2177
-		$sql .= ', localtax2_tx = ' . price2num($this->localtax2_tx);
2178
-		$sql .= ", localtax2_type = '" . $this->db->escape($this->localtax2_type) . "'";
2161
+		$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn_det_rec SET';
2162
+		$sql .= ' fk_facture_fourn = '.(int) $this->fk_facture_fourn;
2163
+		$sql .= ', fk_parent_line = '.(int) $this->fk_parent;
2164
+		$sql .= ', fk_product = '.(int) $this->fk_product;
2165
+		$sql .= ', ref = '.(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'NULL');
2166
+		$sql .= ", label = ".(!empty($this->label) ? "'".$this->db->escape($this->label)."'" : 'NULL');
2167
+		$sql .= ", description = '".$this->db->escape($this->description)."'";
2168
+		$sql .= ', pu_ht = '.price2num($this->pu_ht);
2169
+		$sql .= ', pu_ttc = '.price2num($this->pu_ttc);
2170
+		$sql .= ', qty = '.price2num($this->qty);
2171
+		$sql .= ", remise_percent = '".price2num($this->remise_percent)."'";
2172
+		$sql .= ', fk_remise_except = '.(int) $this->fk_remise_except;
2173
+		$sql .= ", vat_src_code = '".$this->db->escape($this->vat_src_code)."'";
2174
+		$sql .= ', tva_tx = '.price2num($this->tva_tx);
2175
+		$sql .= ', localtax1_tx = '.price2num($this->localtax1_tx);
2176
+		$sql .= ", localtax1_type = '".$this->db->escape($this->localtax1_type)."'";
2177
+		$sql .= ', localtax2_tx = '.price2num($this->localtax2_tx);
2178
+		$sql .= ", localtax2_type = '".$this->db->escape($this->localtax2_type)."'";
2179 2179
 		if (empty($this->skip_update_total)) {
2180
-			$sql .= ', total_ht = ' . price2num($this->total_ht);
2181
-			$sql .= ', total_tva = ' . price2num($this->total_tva);
2182
-			$sql .= ', total_localtax1 = ' . price2num($this->total_localtax1);
2183
-			$sql .= ', total_localtax2 = ' . price2num($this->total_localtax2);
2184
-			$sql .= ', total_ttc = ' . price2num($this->total_ttc);
2180
+			$sql .= ', total_ht = '.price2num($this->total_ht);
2181
+			$sql .= ', total_tva = '.price2num($this->total_tva);
2182
+			$sql .= ', total_localtax1 = '.price2num($this->total_localtax1);
2183
+			$sql .= ', total_localtax2 = '.price2num($this->total_localtax2);
2184
+			$sql .= ', total_ttc = '.price2num($this->total_ttc);
2185 2185
 		}
2186
-		$sql .= ', product_type = ' . (int) $this->product_type;
2187
-		$sql .= ', date_start = ' . (int) $this->date_start;
2188
-		$sql .= ', date_end = ' . (int) $this->date_end;
2189
-		$sql .= ", info_bits = " . ((int) $this->info_bits);
2190
-		$sql .= ', special_code =' . (int) $this->special_code;
2191
-		$sql .= ', rang = ' . (int) $this->rang;
2192
-		$sql .= ', fk_unit = ' .($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2193
-		$sql .= ', fk_user_modif = ' . (int) $user;
2194
-		$sql .= ' WHERE rowid = ' . (int) $this->id;
2186
+		$sql .= ', product_type = '.(int) $this->product_type;
2187
+		$sql .= ', date_start = '.(int) $this->date_start;
2188
+		$sql .= ', date_end = '.(int) $this->date_end;
2189
+		$sql .= ", info_bits = ".((int) $this->info_bits);
2190
+		$sql .= ', special_code ='.(int) $this->special_code;
2191
+		$sql .= ', rang = '.(int) $this->rang;
2192
+		$sql .= ', fk_unit = '.($this->fk_unit ? "'".$this->db->escape($this->fk_unit)."'" : 'null');
2193
+		$sql .= ', fk_user_modif = '.(int) $user;
2194
+		$sql .= ' WHERE rowid = '.(int) $this->id;
2195 2195
 
2196 2196
 		$this->db->begin();
2197 2197
 
2198
-		dol_syslog(get_class($this). '::updateline', LOG_DEBUG);
2198
+		dol_syslog(get_class($this).'::updateline', LOG_DEBUG);
2199 2199
 		$resql = $this->db->query($sql);
2200 2200
 		if ($resql) {
2201 2201
 			if (!$error) {
Please login to merge, or discard this patch.
htdocs/fourn/facture/card-rec.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
 // Load Dolibarr environment
34 34
 require '../../main.inc.php';
35
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture-rec.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.product.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture-rec.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39 39
 if (isModEnabled('project')) {
40
-	include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
40
+	include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
41 41
 }
42
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
43
-require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
44
-require_once DOL_DOCUMENT_ROOT . '/core/lib/invoice.lib.php';
45
-require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
42
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
43
+require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
44
+require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
45
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
46 46
 
47 47
 // Load translation files required by the page
48 48
 $langs->loadLangs(array('bills', 'companies', 'compta', 'admin', 'other', 'products', 'banks', 'suppliers'));
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 	$page = 0;
84 84
 }     // If $page is not defined, or '' or -1
85 85
 $offset = $limit * $page;
86
-if (! $sortorder) {
86
+if (!$sortorder) {
87 87
 	$sortorder = 'DESC';
88 88
 }
89
-if (! $sortfield) {
89
+if (!$sortfield) {
90 90
 	$sortfield = 'f.titre';
91 91
 }
92 92
 $pageprev = $page - 1;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 $object = new FactureFournisseurRec($db);
96 96
 if (($id > 0 || $title) && $action != 'create' && $action != 'add') {
97 97
 	$ret = $object->fetch($id, $title);
98
-	if (! $ret) {
98
+	if (!$ret) {
99 99
 		setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
100 100
 	}
101 101
 }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	$action = 'list';
140 140
 	$massaction = '';
141 141
 }
142
-if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
142
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
143 143
 	$massaction = '';
144 144
 }
145 145
 
@@ -155,18 +155,18 @@  discard block
 block discarded – undo
155 155
 	}
156 156
 
157 157
 	// Selection of new fields
158
-	include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php';
158
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
159 159
 
160 160
 	// Set note
161
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once
161
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
162 162
 
163
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; // Must be include, not include_once
163
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
164 164
 
165
-	include DOL_DOCUMENT_ROOT . '/core/actions_lineupdown.inc.php'; // Must be include, not include_once
165
+	include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
166 166
 
167 167
 	// Create predefined invoice
168 168
 	if ($action == 'add') {
169
-		if (! GETPOST('title', 'alphanohtml')) {
169
+		if (!GETPOST('title', 'alphanohtml')) {
170 170
 			setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
171 171
 			$action = "create";
172 172
 			$error++;
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 			}
190 190
 		}
191 191
 
192
-		if (! $error) {
192
+		if (!$error) {
193 193
 			$object->titre = GETPOST('title', 'alphanohtml'); // deprecated
194 194
 			$object->title = GETPOST('title', 'alphanohtml');
195
-			$object->libelle = GETPOST('libelle', 'alpha');	// deprecated
195
+			$object->libelle = GETPOST('libelle', 'alpha'); // deprecated
196 196
 			$object->label = GETPOST('libelle', 'alpha');
197 197
 			$object->fk_project = GETPOST('projectid', 'int');
198 198
 			$object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml');
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
 				$action = "create";
239 239
 			}
240 240
 
241
-			if (! $error) {
241
+			if (!$error) {
242 242
 				$db->commit();
243 243
 
244
-				header("Location: " . $_SERVER['PHP_SELF'] . '?facid=' . $object->id);
244
+				header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id);
245 245
 				exit;
246 246
 			} else {
247 247
 				$db->rollback();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && ($user->hasRight("fournisseur", "facture", "supprimer") || $user->hasRight("supplier_invoice", "supprimer"))) {
259 259
 		$object->delete($user);
260 260
 
261
-		header('Location: ' . DOL_URL_ROOT . '/fourn/facture/list-rec.php');
261
+		header('Location: '.DOL_URL_ROOT.'/fourn/facture/list-rec.php');
262 262
 		exit;
263 263
 	}
264 264
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		$result = $object->setValueFrom('titre', $title, '', null, 'text', '', $user);
289 289
 
290 290
 		if ($result > 0) {
291
-			$object->titre = $title;	// deprecated
291
+			$object->titre = $title; // deprecated
292 292
 			$object->title = $title;
293 293
 			$object->ref = $object->title;
294 294
 		} else {
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			$error++;
336 336
 		}
337 337
 
338
-		if (! $error) {
338
+		if (!$error) {
339 339
 			$db->commit();
340 340
 		} else {
341 341
 			$db->rollback();
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 			$error++;
353 353
 		}
354 354
 
355
-		if (! $error) {
355
+		if (!$error) {
356 356
 			$db->commit();
357 357
 		} else {
358 358
 			$db->rollback();
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 			$error++;
412 412
 		}
413 413
 
414
-		if (! $error) {
414
+		if (!$error) {
415 415
 			$result = $object->insertExtraFields('BILLREC_MODIFY');
416 416
 			if ($result < 0) {
417 417
 				setEventMessages($object->error, $object->errors, 'errors');
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
 			$tva_tx = '';
441 441
 		}
442 442
 
443
-		$qty = price2num(GETPOST('qty' . $predef, 'alpha'), 'MS', 2);
444
-		$remise_percent = price2num(GETPOST('remise_percent' . $predef), '', 2);
443
+		$qty = price2num(GETPOST('qty'.$predef, 'alpha'), 'MS', 2);
444
+		$remise_percent = price2num(GETPOST('remise_percent'.$predef), '', 2);
445 445
 
446 446
 		// Extrafields
447 447
 		$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 		if (is_array($extralabelsline)) {
451 451
 			// Get extra fields
452 452
 			foreach ($extralabelsline as $key => $value) {
453
-				unset($_POST["options_" . $key . $predef]);
453
+				unset($_POST["options_".$key.$predef]);
454 454
 			}
455 455
 		}
456 456
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
463 463
 			$error++;
464 464
 		}
465
-		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (! ($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
465
+		if ($prod_entry_mode == 'free' && (empty($idprod) || $idprod < 0) && (!($price_ht >= 0) || $price_ht == '')) {    // Unit price can be 0 but not ''
466 466
 			setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
467 467
 			$error++;
468 468
 		}
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 			}
512 512
 		}
513 513
 
514
-		if (! $error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
514
+		if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) {
515 515
 			$ret = $object->fetch($id);
516 516
 			if ($ret < 0) {
517 517
 				dol_print_error($db, $object->error);
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
 			$ret = $object->fetch_thirdparty();
521 521
 
522 522
 			// Clean parameters
523
-			$date_start = dol_mktime(GETPOST('date_start' . $predef . 'hour'), GETPOST('date_start' . $predef . 'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start' . $predef . 'month'), GETPOST('date_start' . $predef . 'day'), GETPOST('date_start' . $predef . 'year'));
524
-			$date_end = dol_mktime(GETPOST('date_end' . $predef . 'hour'), GETPOST('date_end' . $predef . 'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end' . $predef . 'month'), GETPOST('date_end' . $predef . 'day'), GETPOST('date_end' . $predef . 'year'));
523
+			$date_start = dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
524
+			$date_end = dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end'.$predef.'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
525 525
 			$price_base_type = (GETPOST('price_base_type', 'alpha') ? GETPOST('price_base_type', 'alpha') : 'HT');
526 526
 
527 527
 			// Define special_code for special lines
@@ -618,23 +618,23 @@  discard block
 block discarded – undo
618 618
 							$outputlangs->load('products');
619 619
 						}
620 620
 						if (!empty($prod->customcode)) {
621
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
621
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
622 622
 						}
623 623
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
624 624
 							$tmptxt .= ' - ';
625 625
 						}
626 626
 						if (!empty($prod->country_code)) {
627
-							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $outputlangs, 0);
627
+							$tmptxt .= $outputlangs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $outputlangs, 0);
628 628
 						}
629 629
 					} else {
630 630
 						if (!empty($prod->customcode)) {
631
-							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
631
+							$tmptxt .= $langs->transnoentitiesnoconv("CustomCode").': '.$prod->customcode;
632 632
 						}
633 633
 						if (!empty($prod->customcode) && !empty($prod->country_code)) {
634 634
 							$tmptxt .= ' - ';
635 635
 						}
636 636
 						if (!empty($prod->country_code)) {
637
-							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
637
+							$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin").': '.getCountry($prod->country_code, 0, $db, $langs, 0);
638 638
 						}
639 639
 					}
640 640
 					$tmptxt .= ')';
@@ -660,8 +660,8 @@  discard block
 block discarded – undo
660 660
 			$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : null;
661 661
 
662 662
 			// Margin
663
-			$fournprice = price2num(GETPOST('fournprice' . $predef) ? GETPOST('fournprice' . $predef) : '');
664
-			$buyingprice = price2num(GETPOST('buying_price' . $predef) != '' ? GETPOST('buying_price' . $predef) : ''); // If buying_price is '0', we must keep this value
663
+			$fournprice = price2num(GETPOST('fournprice'.$predef) ? GETPOST('fournprice'.$predef) : '');
664
+			$buyingprice = price2num(GETPOST('buying_price'.$predef) != '' ? GETPOST('buying_price'.$predef) : ''); // If buying_price is '0', we must keep this value
665 665
 
666 666
 			// Local Taxes
667 667
 			$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty, $mysoc, $tva_npr);
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
 				$action = '';
728 728
 			}
729 729
 		}
730
-	} elseif ($action == 'updateline' && $usercancreate && ! GETPOST('cancel', 'alpha')) {
731
-		if (! $object->fetch($id) > 0) {
730
+	} elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) {
731
+		if (!$object->fetch($id) > 0) {
732 732
 			dol_print_error($db);
733 733
 		}
734 734
 		$object->fetch_thirdparty();
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 			$objectline->array_options = $array_options;
764 764
 			$result = $objectline->insertExtraFields();
765 765
 			if ($result < 0) {
766
-				setEventMessages($langs->trans('Error') . $result, null, 'errors');
766
+				setEventMessages($langs->trans('Error').$result, null, 'errors');
767 767
 			}
768 768
 		}
769 769
 
@@ -773,13 +773,13 @@  discard block
 block discarded – undo
773 773
 		if (is_array($extralabelsline)) {
774 774
 			// Get extra fields
775 775
 			foreach ($extralabelsline as $key => $value) {
776
-				unset($_POST["options_" . $key]);
776
+				unset($_POST["options_".$key]);
777 777
 			}
778 778
 		}
779 779
 
780 780
 		// Define special_code for special lines
781 781
 		$special_code = GETPOST('special_code', 'int');
782
-		if (! GETPOST('qty', 'alpha')) {
782
+		if (!GETPOST('qty', 'alpha')) {
783 783
 			$special_code = 3;
784 784
 		}
785 785
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
 		$date_end_fill = !empty(GETPOST('date_end_fill', 'int')) ? GETPOST('date_end_fill', 'int') : 'NULL';
826 826
 
827 827
 		// Update line
828
-		if (! $error) {
828
+		if (!$error) {
829 829
 			$result = $object->updateline(GETPOST('lineid', 'int'), GETPOST('productid', 'int'), $ref_fourn, $label, $description, $pu_ht, $qty, $remise_percent, $vat_rate, $localtax1_rate, $localtax1_rate, 'HT', $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1);
830 830
 			if ($result >= 0) {
831 831
 				$object->fetch($object->id); // Reload lines
@@ -899,10 +899,10 @@  discard block
 block discarded – undo
899 899
 	if ($object->fetch($id) > 0) {
900 900
 		$result = $object->fetch_lines();
901 901
 
902
-		print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
903
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
902
+		print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
903
+		print '<input type="hidden" name="token" value="'.newToken().'">';
904 904
 		print '<input type="hidden" name="action" value="add">';
905
-		print '<input type="hidden" name="facid" value="' . $object->id . '">';
905
+		print '<input type="hidden" name="facid" value="'.$object->id.'">';
906 906
 
907 907
 		print dol_get_fiche_head(null, '', '', 0);
908 908
 
@@ -915,17 +915,17 @@  discard block
 block discarded – undo
915 915
 		$object->fetch_thirdparty();
916 916
 
917 917
 		// Title
918
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("Title") . '</td><td>';
919
-		print '<input class="flat quatrevingtpercent" type="text" name="title" value="' . dol_escape_htmltag(GETPOST("title", 'alphanohtml')) . '" autofocus>';
918
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Title").'</td><td>';
919
+		print '<input class="flat quatrevingtpercent" type="text" name="title" value="'.dol_escape_htmltag(GETPOST("title", 'alphanohtml')).'" autofocus>';
920 920
 		print '</td></tr>';
921 921
 
922 922
 		// Ref supplier
923
-		print '<tr><td class="titlefieldcreate fieldrequired">' . $langs->trans("RefSupplier") . '</td><td>';
924
-		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="' . $object->ref_supplier . '">';
923
+		print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("RefSupplier").'</td><td>';
924
+		print '<input class="flat maxwidth500" type="text" name="ref_supplier" value="'.$object->ref_supplier.'">';
925 925
 		print '</td></tr>';
926 926
 
927 927
 		// Third party
928
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Customer") . '</td><td>' . $object->thirdparty->getNomUrl(1, 'customer') . '</td>';
928
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Customer").'</td><td>'.$object->thirdparty->getNomUrl(1, 'customer').'</td>';
929 929
 		print '</tr>';
930 930
 
931 931
 		$note_public = GETPOSTISSET('note_public') ? GETPOST('note_public', 'restricthtml') : $object->note_public;
@@ -934,30 +934,30 @@  discard block
 block discarded – undo
934 934
 		// Help of substitution key
935 935
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
936 936
 
937
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m') . ')';
938
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%m') . ')';
939
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m') . ')';
940
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B') . ')';
941
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%B') . ')';
942
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B') . ')';
943
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y') . ')';
944
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($object->date, '%Y') . ')';
945
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y') . ')';
937
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%m').')';
938
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%m').')';
939
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%m').')';
940
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'm'), '%B').')';
941
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%B').')';
942
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'm'), '%B').')';
943
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, -1, 'y'), '%Y').')';
944
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($object->date, '%Y').')';
945
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date, 1, 'y'), '%Y').')';
946 946
 		// Only on template invoices
947
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . (isset($object->date_when)?' (' . $langs->trans("Example") . ': ' .dol_print_date($object->date_when, 'dayhour') . ')':'');
948
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . (isset($object->date_when)?' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour') . ')':'');
947
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date($object->date_when, 'dayhour').')' : '');
948
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").(isset($object->date_when) ? ' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($object->date_when, $object->frequency, $object->unit_frequency), 'dayhour').')' : '');
949 949
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $langs->trans("Count");
950 950
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $langs->trans("MaxPeriodNumber");
951 951
 
952
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
952
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
953 953
 		foreach ($substitutionarray as $key => $val) {
954
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
954
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
955 955
 		}
956 956
 		$htmltext .= '</i>';
957 957
 
958 958
 		// Label
959
-		print '<tr><td class="titlefieldcreate">' . $langs->trans("Label") . '</td><td>';
960
-		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="' . $object->label . '">';
959
+		print '<tr><td class="titlefieldcreate">'.$langs->trans("Label").'</td><td>';
960
+		print '<input class="flat quatrevingtpercent" type="text" name="libelle" value="'.$object->label.'">';
961 961
 		print '</td></tr>';
962 962
 
963 963
 		// Public note
@@ -982,38 +982,38 @@  discard block
 block discarded – undo
982 982
 		}
983 983
 
984 984
 		// Author
985
-		print "<tr><td>" . $langs->trans("Author") . "</td><td>" . $user->getFullName($langs) . "</td></tr>";
985
+		print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
986 986
 
987 987
 		// Payment term
988
-		print "<tr><td>" . $langs->trans("PaymentConditions") . "</td><td>";
989
-		$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none');
988
+		print "<tr><td>".$langs->trans("PaymentConditions")."</td><td>";
989
+		$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none');
990 990
 		print "</td></tr>";
991 991
 
992 992
 		// Payment mode
993
-		print "<tr><td>" . $langs->trans("PaymentMode") . "</td><td>";
994
-		$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none', '', 1);
993
+		print "<tr><td>".$langs->trans("PaymentMode")."</td><td>";
994
+		$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none', '', 1);
995 995
 		print "</td></tr>";
996 996
 
997 997
 		// Project
998 998
 		if (isModEnabled('project') && is_object($object->thirdparty) && $object->thirdparty->id > 0) {
999 999
 			$projectid = GETPOST('projectid') ? GETPOST('projectid') : $object->fk_project;
1000 1000
 			$langs->load('projects');
1001
-			print '<tr><td>' . $langs->trans('Project') . '</td><td>';
1001
+			print '<tr><td>'.$langs->trans('Project').'</td><td>';
1002 1002
 			$numprojet = $formproject->select_projects($object->thirdparty->id, $projectid, 'projectid', 0, 0, 1, 0, 0, 0, 0, '', 0, 0, '');
1003
-			print ' &nbsp; <a href="' . DOL_URL_ROOT . '/projet/card.php?socid=' . $object->thirdparty->id . '&action=create&status=1&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create&socid=' . $object->thirdparty->id . (!empty($id) ? '&id=' . $id : '')) . '">' . $langs->trans("AddProject") . '</a>';
1003
+			print ' &nbsp; <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id.'&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create&socid='.$object->thirdparty->id.(!empty($id) ? '&id='.$id : '')).'">'.$langs->trans("AddProject").'</a>';
1004 1004
 			print '</td></tr>';
1005 1005
 		}
1006 1006
 
1007 1007
 		// Bank account
1008 1008
 		if ($object->fk_account > 0) {
1009
-			print "<tr><td>" . $langs->trans('BankAccount') . "</td><td>";
1010
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1009
+			print "<tr><td>".$langs->trans('BankAccount')."</td><td>";
1010
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1011 1011
 			print "</td></tr>";
1012 1012
 		}
1013 1013
 
1014 1014
 		// Model pdf
1015
-		print "<tr><td>" . $langs->trans('Model') . "</td><td>";
1016
-		include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1015
+		print "<tr><td>".$langs->trans('Model')."</td><td>";
1016
+		include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1017 1017
 		$list = ModelePDFSuppliersInvoices::liste_modeles($db);
1018 1018
 		print $form->selectarray('modelpdf', $list, $conf->global->INVOICE_SUPPLIER_ADDON_PDF);
1019 1019
 		print "</td></tr>";
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 
1025 1025
 		// Autogeneration
1026 1026
 		$title = $langs->trans("Recurrence");
1027
-		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', '');
1027
+		print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
1028 1028
 
1029 1029
 		print '<span class="opacitymedium">'.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).'</span><br><br>';
1030 1030
 
@@ -1033,30 +1033,30 @@  discard block
 block discarded – undo
1033 1033
 		print '<table class="border centpercent">';
1034 1034
 
1035 1035
 		// Frequency + unit
1036
-		print '<tr><td class="titlefieldcreate">' . $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency')) . "</td><td>";
1037
-		print "<input type='text' name='frequency' value='" . GETPOST('frequency', 'int') . "' size='4' />&nbsp;" . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm'));
1036
+		print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'))."</td><td>";
1037
+		print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' />&nbsp;".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), (GETPOST('unit_frequency') ? GETPOST('unit_frequency') : 'm'));
1038 1038
 		print "</td></tr>";
1039 1039
 
1040 1040
 		// Date next run
1041
-		print "<tr><td>" . $langs->trans('NextDateToExecution') . "</td><td>";
1041
+		print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
1042 1042
 		$date_next_execution = isset($date_next_execution) ? $date_next_execution : (GETPOST('remonth') ? dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')) : -1);
1043 1043
 		print $form->selectDate($date_next_execution, '', 1, 1, '', "add", 1, 1);
1044 1044
 		print "</td></tr>";
1045 1045
 
1046 1046
 		// Number max of generation
1047
-		print "<tr><td>" . $langs->trans("MaxPeriodNumber") . "</td><td>";
1048
-		print '<input type="text" name="nb_gen_max" value="' . GETPOST('nb_gen_max') . '" size="5" />';
1047
+		print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
1048
+		print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
1049 1049
 		print "</td></tr>";
1050 1050
 
1051 1051
 		// Auto validate the invoice
1052
-		print "<tr><td>" . $langs->trans("StatusOfGeneratedInvoices") . "</td><td>";
1052
+		print "<tr><td>".$langs->trans("StatusOfGeneratedInvoices")."</td><td>";
1053 1053
 		$select = array('0' => $langs->trans('BillStatusDraft'), '1' => $langs->trans('BillStatusValidated'));
1054 1054
 		print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
1055 1055
 		print "</td></tr>";
1056 1056
 
1057 1057
 		// Auto generate document
1058 1058
 		if (getDolGlobalString('INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION')) {
1059
-			print "<tr><td>" . $langs->trans("StatusOfAutoGeneratedDocuments") . "</td><td>";
1059
+			print "<tr><td>".$langs->trans("StatusOfAutoGeneratedDocuments")."</td><td>";
1060 1060
 			$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
1061 1061
 			print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
1062 1062
 			print "</td></tr>";
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 
1100 1100
 		print "</form>\n";
1101 1101
 	} else {
1102
-		dol_print_error('', "Error, no invoice " . $object->id);
1102
+		dol_print_error('', "Error, no invoice ".$object->id);
1103 1103
 	}
1104 1104
 } else {
1105 1105
 	/*
@@ -1113,12 +1113,12 @@  discard block
 block discarded – undo
1113 1113
 
1114 1114
 		// Confirmation de la suppression d'une ligne produit
1115 1115
 		if ($action == 'ask_deleteline') {
1116
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1116
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
1117 1117
 		}
1118 1118
 
1119 1119
 		// Confirm delete of repeatable invoice
1120 1120
 		if ($action == 'ask_deleteinvoice') {
1121
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1121
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
1122 1122
 		}
1123 1123
 
1124 1124
 		print $formconfirm;
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
 
1133 1133
 		// Recurring invoice content
1134 1134
 
1135
-		$linkback = '<a href="' . DOL_URL_ROOT . '/fourn/facture/list-rec.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans('BackToList') . '</a>';
1135
+		$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/list-rec.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans('BackToList').'</a>';
1136 1136
 
1137 1137
 		$morehtmlref = '';
1138 1138
 		if ($action != 'edittitle') {
@@ -1145,33 +1145,33 @@  discard block
 block discarded – undo
1145 1145
 		$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
1146 1146
 		$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
1147 1147
 		// Thirdparty
1148
-		$morehtmlref .= '<br>' . $langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
1148
+		$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1);
1149 1149
 
1150 1150
 		// Project
1151 1151
 		if (isModEnabled('project')) {
1152 1152
 			$langs->load('projects');
1153
-			$morehtmlref .= '<br>' . $langs->trans('Project') . ' ';
1153
+			$morehtmlref .= '<br>'.$langs->trans('Project').' ';
1154 1154
 			if ($usercancreate) {
1155 1155
 				if ($action != 'classify') {
1156
-					$morehtmlref .= '<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
1156
+					$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
1157 1157
 				}
1158 1158
 				if ($action == 'classify') {
1159
-					$morehtmlref .= '<form method="post" action="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '">';
1159
+					$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
1160 1160
 					$morehtmlref .= '<input type="hidden" name="action" value="classin">';
1161
-					$morehtmlref .= '<input type="hidden" name="token" value="' . newToken() . '">';
1161
+					$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
1162 1162
 					$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
1163
-					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
1163
+					$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
1164 1164
 					$morehtmlref .= '</form>';
1165 1165
 				} else {
1166
-					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1166
+					$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300');
1167 1167
 				}
1168 1168
 			} else {
1169 1169
 				if (!empty($object->fk_project)) {
1170 1170
 					$project = new Project($db);
1171 1171
 					$project->fetch($object->fk_project);
1172
-					$morehtmlref .= ' : ' . $project->getNomUrl(1);
1172
+					$morehtmlref .= ' : '.$project->getNomUrl(1);
1173 1173
 					if ($project->title) {
1174
-						$morehtmlref .= ' - ' . $project->title;
1174
+						$morehtmlref .= ' - '.$project->title;
1175 1175
 					}
1176 1176
 				} else {
1177 1177
 					$morehtmlref .= '';
@@ -1190,34 +1190,34 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
 		print '<table class="border centpercent tableforfield">';
1192 1192
 
1193
-		print '<tr><td class="titlefield">' . $langs->trans('Author') . '</td><td>';
1193
+		print '<tr><td class="titlefield">'.$langs->trans('Author').'</td><td>';
1194 1194
 		print $author->getNomUrl(-1);
1195 1195
 		print "</td></tr>";
1196 1196
 
1197 1197
 		// Label
1198 1198
 		print '<tr>';
1199
-		print '<td>' . $form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1200
-		print '<td>' . $form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate) . '</td>';
1199
+		print '<td>'.$form->editfieldkey("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1200
+		print '<td>'.$form->editfieldval("Label", 'libelle', $object->libelle, $object, $usercancreate).'</td>';
1201 1201
 		print '</tr>';
1202 1202
 
1203
-		print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
1204
-		print '<td>' . price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1203
+		print '<tr><td>'.$langs->trans('AmountHT').'</td>';
1204
+		print '<td>'.price($object->total_ht, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1205 1205
 		print '</tr>';
1206 1206
 
1207
-		print '<tr><td>' . $langs->trans("AmountVAT") . '</td><td>' . price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1207
+		print '<tr><td>'.$langs->trans("AmountVAT").'</td><td>'.price($object->total_tva, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1208 1208
 		print '</tr>';
1209 1209
 
1210 1210
 		// Amount Local Taxes
1211 1211
 		if (($mysoc->localtax1_assuj == "1" && $mysoc->useLocalTax(1)) || $object->total_localtax1 != 0) {    // Localtax1
1212
-			print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td>';
1213
-			print '<td class="nowrap">' . price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1212
+			print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
1213
+			print '<td class="nowrap">'.price($object->total_localtax1, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1214 1214
 		}
1215 1215
 		if (($mysoc->localtax2_assuj == "1" && $mysoc->useLocalTax(2)) || $object->total_localtax2 != 0) {    // Localtax2
1216
-			print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td>';
1217
-			print '<td class=nowrap">' . price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency) . '</td></tr>';
1216
+			print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
1217
+			print '<td class=nowrap">'.price($object->total_localtax2, 1, '', 1, -1, -1, $conf->currency).'</td></tr>';
1218 1218
 		}
1219 1219
 
1220
-		print '<tr><td>' . $langs->trans("AmountTTC") . '</td><td colspan="3">' . price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency) . '</td>';
1220
+		print '<tr><td>'.$langs->trans("AmountTTC").'</td><td colspan="3">'.price($object->total_ttc, '', $langs, 1, -1, -1, $conf->currency).'</td>';
1221 1221
 		print '</tr>';
1222 1222
 
1223 1223
 		// Payment term
@@ -1226,14 +1226,14 @@  discard block
 block discarded – undo
1226 1226
 		print $langs->trans('PaymentConditionsShort');
1227 1227
 		print '</td>';
1228 1228
 		if ($action != 'editconditions' && $usercancreate) {
1229
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
1229
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetConditions'), 1).'</a></td>';
1230 1230
 		}
1231 1231
 		print '</tr></table>';
1232 1232
 		print '</td><td>';
1233 1233
 		if ($action == 'editconditions') {
1234
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
1234
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
1235 1235
 		} else {
1236
-			$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
1236
+			$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
1237 1237
 		}
1238 1238
 
1239 1239
 		print '</td></tr>';
@@ -1244,14 +1244,14 @@  discard block
 block discarded – undo
1244 1244
 		print $langs->trans('PaymentMode');
1245 1245
 		print '</td>';
1246 1246
 		if ($action != 'editmode' && $usercancreate) {
1247
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmode&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('SetMode'), 1) . '</a></td>';
1247
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
1248 1248
 		}
1249 1249
 		print '</tr></table>';
1250 1250
 		print '</td><td>';
1251 1251
 		if ($action == 'editmode') {
1252
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1252
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1);
1253 1253
 		} else {
1254
-			$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->mode_reglement_id, 'none');
1254
+			$form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none');
1255 1255
 		}
1256 1256
 		print '</td></tr>';
1257 1257
 
@@ -1264,12 +1264,12 @@  discard block
 block discarded – undo
1264 1264
 			print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
1265 1265
 			print '</td>';
1266 1266
 			if ($usercancreate && $action != 'editmulticurrencycode' && $object->suspended == $object::STATUS_SUSPENDED) {
1267
-				print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
1267
+				print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencycode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
1268 1268
 			}
1269 1269
 			print '</tr></table>';
1270 1270
 			print '</td><td>';
1271 1271
 			$htmlname = (($usercancreate && $action == 'editmulticurrencycode') ? 'multicurrency_code' : 'none');
1272
-			$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, $htmlname);
1272
+			$form->form_multicurrency_code($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_code, $htmlname);
1273 1273
 			print '</td></tr>';
1274 1274
 
1275 1275
 			// Multicurrency rate
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 				print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0);
1281 1281
 				print '</td>';
1282 1282
 				if ($usercancreate && $action != 'editmulticurrencyrate' && $object->suspended == $object::STATUS_SUSPENDED && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1283
-					print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
1283
+					print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmulticurrencyrate&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1).'</a></td>';
1284 1284
 				}
1285 1285
 				print '</tr></table>';
1286 1286
 				print '</td><td>';
@@ -1288,12 +1288,12 @@  discard block
 block discarded – undo
1288 1288
 					if ($action == 'actualizemulticurrencyrate') {
1289 1289
 						list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
1290 1290
 					}
1291
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1291
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, ($usercancreate ? 'multicurrency_tx' : 'none'), $object->multicurrency_code);
1292 1292
 				} else {
1293
-					$form->form_multicurrency_rate($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1293
+					$form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$object->id, $object->multicurrency_tx, 'none', $object->multicurrency_code);
1294 1294
 					if ($object->statut == $object::STATUS_DRAFT && $object->multicurrency_code && $object->multicurrency_code != $conf->currency) {
1295 1295
 						print '<div class="inline-block"> &nbsp; &nbsp; &nbsp; &nbsp; ';
1296
-						print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=actualizemulticurrencyrate">' . $langs->trans("ActualizeCurrency") . '</a>';
1296
+						print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=actualizemulticurrencyrate">'.$langs->trans("ActualizeCurrency").'</a>';
1297 1297
 						print '</div>';
1298 1298
 					}
1299 1299
 				}
@@ -1309,24 +1309,24 @@  discard block
 block discarded – undo
1309 1309
 
1310 1310
 		$substitutionarray = getCommonSubstitutionArray($langs, 2, null, $object);
1311 1311
 
1312
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m') . ')';
1313
-		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%m') . ')';
1314
-		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m') . ')';
1315
-		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B') . ')';
1316
-		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%B') . ')';
1317
-		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B') . ')';
1318
-		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y') . ')';
1319
-		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date($dateexample, '%Y') . ')';
1320
-		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y') . ')';
1312
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH__'] = $langs->trans("PreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%m').')';
1313
+		$substitutionarray['__INVOICE_MONTH__'] = $langs->trans("MonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%m').')';
1314
+		$substitutionarray['__INVOICE_NEXT_MONTH__'] = $langs->trans("NextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%m').')';
1315
+		$substitutionarray['__INVOICE_PREVIOUS_MONTH_TEXT__'] = $langs->trans("TextPreviousMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'm'), '%B').')';
1316
+		$substitutionarray['__INVOICE_MONTH_TEXT__'] = $langs->trans("TextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%B').')';
1317
+		$substitutionarray['__INVOICE_NEXT_MONTH_TEXT__'] = $langs->trans("TextNextMonthOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'm'), '%B').')';
1318
+		$substitutionarray['__INVOICE_PREVIOUS_YEAR__'] = $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, -1, 'y'), '%Y').')';
1319
+		$substitutionarray['__INVOICE_YEAR__'] = $langs->trans("YearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample, '%Y').')';
1320
+		$substitutionarray['__INVOICE_NEXT_YEAR__'] = $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'), '%Y').')';
1321 1321
 		// Only on template invoices
1322
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour') . ')';
1323
-		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen") . ' (' . $langs->trans("Example") . ': ' . dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour') . ')';
1322
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__'] = $langs->trans("DateNextInvoiceBeforeGen").' ('.$langs->trans("Example").': '.dol_print_date(($object->date_when ? $object->date_when : dol_now()), 'dayhour').')';
1323
+		$substitutionarray['__INVOICE_DATE_NEXT_INVOICE_AFTER_GEN__'] = $langs->trans("DateNextInvoiceAfterGen").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree(($object->date_when ? $object->date_when : dol_now()), $object->frequency, $object->unit_frequency), 'dayhour').')';
1324 1324
 		$substitutionarray['__INVOICE_COUNTER_CURRENT__'] = $object->nb_gen_done;
1325 1325
 		$substitutionarray['__INVOICE_COUNTER_MAX__'] = $object->nb_gen_max;
1326 1326
 
1327
-		$htmltext = '<i>' . $langs->trans("FollowingConstantsWillBeSubstituted") . ':<br>';
1327
+		$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
1328 1328
 		foreach ($substitutionarray as $key => $val) {
1329
-			$htmltext .= $key . ' = ' . $langs->trans($val) . '<br>';
1329
+			$htmltext .= $key.' = '.$langs->trans($val).'<br>';
1330 1330
 		}
1331 1331
 		$htmltext .= '</i>';
1332 1332
 
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		print '<tr><td>';
1335 1335
 		print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $usercancreate);
1336 1336
 		print '</td><td class="wordbreak">';
1337
-		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1337
+		print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1338 1338
 		print '</td>';
1339 1339
 		print '</tr>';
1340 1340
 
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
 		print '<tr><td>';
1343 1343
 		print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $usercancreate);
1344 1344
 		print '</td><td class="wordbreak">';
1345
-		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:' . ROWS_4 . ':90%', '', null, null, '', 1);
1345
+		print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $usercancreate, 'textarea:'.ROWS_4.':90%', '', null, null, '', 1);
1346 1346
 		print '</td>';
1347 1347
 		print '</tr>';
1348 1348
 
@@ -1352,14 +1352,14 @@  discard block
 block discarded – undo
1352 1352
 		print $langs->trans('BankAccount');
1353 1353
 		print '<td>';
1354 1354
 		if ($action != 'editbankaccount' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1355
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editbankaccount&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetBankAccount'), 1) . '</a></td>';
1355
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
1356 1356
 		}
1357 1357
 		print '</tr></table>';
1358 1358
 		print '</td><td>';
1359 1359
 		if ($action == 'editbankaccount') {
1360
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'fk_account', 1);
1360
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
1361 1361
 		} else {
1362
-			$form->formSelectAccount($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_account, 'none');
1362
+			$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
1363 1363
 		}
1364 1364
 		print "</td>";
1365 1365
 		print '</tr>';
@@ -1370,18 +1370,18 @@  discard block
 block discarded – undo
1370 1370
 		print $langs->trans('Model');
1371 1371
 		print '<td>';
1372 1372
 		if ($action != 'editmodelpdf' && $usercancreate && $object->statut == FactureFournisseurRec::STATUS_NOTSUSPENDED) {
1373
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=editmodelpdf&token=' . newToken() . '&id=' . $object->id . '">' . img_edit($langs->trans('SetModel'), 1) . '</a></td>';
1373
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=editmodelpdf&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetModel'), 1).'</a></td>';
1374 1374
 		}
1375 1375
 		print '</tr></table>';
1376 1376
 		print '</td><td>';
1377 1377
 		if ($action == 'editmodelpdf') {
1378
-			include_once DOL_DOCUMENT_ROOT . '/core/modules/supplier_invoice/modules_facturefournisseur.php';
1378
+			include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';
1379 1379
 			$list = array();
1380 1380
 			$models = ModelePDFSuppliersInvoices::liste_modeles($db);
1381 1381
 			foreach ($models as $k => $model) {
1382
-				$list[] = str_replace(':', '|', $k) . ':' . $model;
1382
+				$list[] = str_replace(':', '|', $k).':'.$model;
1383 1383
 			}
1384
-			$select = 'select;' . implode(',', $list);
1384
+			$select = 'select;'.implode(',', $list);
1385 1385
 			//TODO : Droits
1386 1386
 			print $form->editfieldval($langs->trans('Model'), 'modelpdf', $object->model_pdf, $object, $usercancreate, $select);
1387 1387
 		} else {
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 
1393 1393
 		// Other attributes
1394 1394
 		$cols = 2;
1395
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
1395
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
1396 1396
 
1397 1397
 		print '</table>';
1398 1398
 
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 		print '<table class="border centpercent tableforfield">';
1410 1410
 
1411
-		print '<tr><td colspan="2">' . img_picto('', 'recurring', 'class="pictofixedwidth"') . $title . '</td></tr>';
1411
+		print '<tr><td colspan="2">'.img_picto('', 'recurring', 'class="pictofixedwidth"').$title.'</td></tr>';
1412 1412
 
1413 1413
 		// if "frequency" is empty or = 0, the reccurence is disabled
1414 1414
 		print '<tr><td style="width: 50%">';
@@ -1416,23 +1416,23 @@  discard block
 block discarded – undo
1416 1416
 		print $langs->trans('Frequency');
1417 1417
 		print '</td>';
1418 1418
 		if ($action != 'editfrequency' && $usercancreate) {
1419
-			print '<td class="right"><a class="editfielda" href="' . $_SERVER["PHP_SELF"] . '?action=editfrequency&token=' . newToken() . '&facid=' . $object->id . '">' . img_edit($langs->trans('Edit'), 1) . '</a></td>';
1419
+			print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('Edit'), 1).'</a></td>';
1420 1420
 		}
1421 1421
 		print '</tr></table>';
1422 1422
 		print '</td><td>';
1423 1423
 		if ($action == 'editfrequency') {
1424
-			print '<form method="post" action="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '">';
1424
+			print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'">';
1425 1425
 			print '<input type="hidden" name="action" value="setfrequency">';
1426
-			print '<input type="hidden" name="token" value="' . newToken() . '">';
1426
+			print '<input type="hidden" name="token" value="'.newToken().'">';
1427 1427
 			print '<table class="nobordernopadding">';
1428 1428
 			print '<tr><td>';
1429
-			print "<input type='text' name='frequency' value='" . $object->frequency . "' size='5' />&nbsp;" . $form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
1429
+			print "<input type='text' name='frequency' value='".$object->frequency."' size='5' />&nbsp;".$form->selectarray('unit_frequency', array('d' => $langs->trans('Day'), 'm' => $langs->trans('Month'), 'y' => $langs->trans('Year')), ($object->unit_frequency ? $object->unit_frequency : 'm'));
1430 1430
 			print '</td>';
1431
-			print '<td class="left"><input type="submit" class="button button-edit" value="' . $langs->trans("Modify") . '"></td>';
1431
+			print '<td class="left"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></td>';
1432 1432
 			print '</tr></table></form>';
1433 1433
 		} else {
1434 1434
 			if ($object->frequency > 0) {
1435
-				print $langs->trans('FrequencyPer_' . $object->unit_frequency, $object->frequency);
1435
+				print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
1436 1436
 			} else {
1437 1437
 				print $langs->trans("NotARecurringInvoiceTemplate");
1438 1438
 			}
@@ -1451,8 +1451,8 @@  discard block
 block discarded – undo
1451 1451
 			print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $usercancreate, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
1452 1452
 		}
1453 1453
 		//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
1454
-		if (! $object->isMaxNbGenReached()) {
1455
-			if (! $object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1454
+		if (!$object->isMaxNbGenReached()) {
1455
+			if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) {
1456 1456
 				print img_warning($langs->trans("Late"));
1457 1457
 			}
1458 1458
 		} else {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 			print $langs->trans("StatusOfGeneratedInvoices");
1486 1486
 		}
1487 1487
 		print '</td><td>';
1488
-		$select = 'select;0:' . $langs->trans('BillStatusDraft') . ',1:' . $langs->trans('BillStatusValidated');
1488
+		$select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated');
1489 1489
 		if ($action == 'auto_validate' || $object->frequency > 0) {
1490 1490
 			print $form->editfieldval($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $usercancreate, $select);
1491 1491
 		}
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 			}
1502 1502
 			print '</td>';
1503 1503
 			print '<td>';
1504
-			$select = 'select;0:' . $langs->trans('DoNotGenerateDoc') . ',1:' . $langs->trans('AutogenerateDoc');
1504
+			$select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc');
1505 1505
 			if ($action == 'generate_pdf' || $object->frequency > 0) {
1506 1506
 				print $form->editfieldval($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $usercancreate, $select);
1507 1507
 			}
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
 			print '<table class="border centpercent tableforfield">';
1526 1526
 
1527 1527
 			// Nb of generation already done
1528
-			print '<tr><td style="width: 50%">' . $langs->trans("NbOfGenerationDone") . '</td>';
1528
+			print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
1529 1529
 			print '<td>';
1530 1530
 			print $object->nb_gen_done ? $object->nb_gen_done : '0';
1531 1531
 			print '</td>';
@@ -1550,15 +1550,15 @@  discard block
 block discarded – undo
1550 1550
 		print '<div class="clearboth"></div><br>';
1551 1551
 
1552 1552
 		// Lines
1553
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '#add' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
1554
-        	<input type="hidden" name="token" value="' . newToken() . '">
1555
-        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
1553
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '#add' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
1554
+        	<input type="hidden" name="token" value="' . newToken().'">
1555
+        	<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
1556 1556
         	<input type="hidden" name="mode" value="">
1557
-        	<input type="hidden" name="id" value="' . $object->id . '">
1557
+        	<input type="hidden" name="id" value="' . $object->id.'">
1558 1558
         	';
1559 1559
 
1560 1560
 		if (!empty($conf->use_javascript_ajax) && $object->statut == 0) {
1561
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
1561
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
1562 1562
 		}
1563 1563
 
1564 1564
 		print '<div class="div-table-responsive-no-min">';
@@ -1612,24 +1612,24 @@  discard block
 block discarded – undo
1612 1612
 		if (empty($object->suspended)) {
1613 1613
 			if ($usercancreate) {
1614 1614
 				if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) {
1615
-					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("MaxGenerationReached")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1615
+					print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
1616 1616
 				} else {
1617 1617
 					if (empty($object->frequency) || $object->date_when <= $nowlasthour) {
1618
-						print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fourn/facture/card.php?action=create&socid=' . $object->thirdparty->id . '&fac_rec=' . $object->id . '">' . $langs->trans("CreateBill") . '</a></div>';
1618
+						print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->thirdparty->id.'&fac_rec='.$object->id.'">'.$langs->trans("CreateBill").'</a></div>';
1619 1619
 					} else {
1620
-						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="' . dol_escape_htmltag($langs->trans("DateIsNotEnough")) . '">' . $langs->trans("CreateBill") . '</a></div>';
1620
+						print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
1621 1621
 					}
1622 1622
 				}
1623 1623
 			} else {
1624
-				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">' . $langs->trans("CreateBill") . '</a></div>';
1624
+				print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateBill").'</a></div>';
1625 1625
 			}
1626 1626
 		}
1627 1627
 
1628 1628
 		if ($usercancreate) {
1629 1629
 			if (empty($object->suspended)) {
1630
-				print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=disable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Disable") . '</a></div>';
1630
+				print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=disable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Disable").'</a></div>';
1631 1631
 			} else {
1632
-				print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=enable&id=' . $object->id . '&token=' . newToken() . '">' . $langs->trans("Enable") . '</a></div>';
1632
+				print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=enable&id='.$object->id.'&token='.newToken().'">'.$langs->trans("Enable").'</a></div>';
1633 1633
 			}
1634 1634
 		}
1635 1635
 
Please login to merge, or discard this patch.
htdocs/compta/facture/list.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 			if ($searchCategoryProductOperator == 0) {
849 849
 				$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facturedet as fd WHERE fd.fk_facture = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
850 850
 			} else {
851
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
851
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct);
852 852
 			}
853 853
 		}
854 854
 	}
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 			if ($searchCategoryCustomerOperator == 0) {
879 879
 				$searchCategoryCustomerSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategoryCustomer).")";
880 880
 			} else {
881
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
881
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer);
882 882
 			}
883 883
 		}
884 884
 	}
@@ -1898,8 +1898,8 @@  discard block
 block discarded – undo
1898 1898
 	$totalarray['val'] = array();
1899 1899
 	$totalarray['val']['f.total_ht'] = 0;
1900 1900
 	$totalarray['val']['f.total_tva'] = 0;
1901
-	$totalarray['val']['f.total_localtax1']=0;
1902
-	$totalarray['val']['f.total_localtax1']=0;
1901
+	$totalarray['val']['f.total_localtax1'] = 0;
1902
+	$totalarray['val']['f.total_localtax1'] = 0;
1903 1903
 	$totalarray['val']['f.total_ttc'] = 0;
1904 1904
 	$totalarray['val']['totalam'] = 0;
1905 1905
 	$totalarray['val']['rtp'] = 0;
@@ -1938,7 +1938,7 @@  discard block
 block discarded – undo
1938 1938
 		$facturestatic->multicurrency_total_ht = $obj->multicurrency_total_ht;
1939 1939
 		$facturestatic->multicurrency_total_tva = $obj->multicurrency_total_vat;
1940 1940
 		$facturestatic->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
1941
-		$facturestatic->statut = $obj->fk_statut;	// deprecated
1941
+		$facturestatic->statut = $obj->fk_statut; // deprecated
1942 1942
 		$facturestatic->status = $obj->fk_statut;
1943 1943
 		$facturestatic->close_code = $obj->close_code;
1944 1944
 		$facturestatic->total_ttc = $obj->total_ttc;
@@ -2414,7 +2414,7 @@  discard block
 block discarded – undo
2414 2414
 			$userstatic->lastname = $obj->lastname;
2415 2415
 			$userstatic->firstname = $obj->firstname;
2416 2416
 			$userstatic->email = $obj->user_email;
2417
-			$userstatic->statut = $obj->user_statut;	// deprecated
2417
+			$userstatic->statut = $obj->user_statut; // deprecated
2418 2418
 			$userstatic->status = $obj->user_statut;
2419 2419
 			$userstatic->entity = $obj->entity;
2420 2420
 			$userstatic->photo = $obj->photo;
@@ -2457,7 +2457,7 @@  discard block
 block discarded – undo
2457 2457
 							$userstatic->lastname = $val['lastname'];
2458 2458
 							$userstatic->firstname = $val['firstname'];
2459 2459
 							$userstatic->email = $val['email'];
2460
-							$userstatic->statut = $val['statut'];	// deprecated
2460
+							$userstatic->statut = $val['statut']; // deprecated
2461 2461
 							$userstatic->status = $val['statut'];
2462 2462
 							$userstatic->entity = $val['entity'];
2463 2463
 							$userstatic->photo = $val['photo'];
Please login to merge, or discard this patch.
htdocs/accountancy/bookkeeping/listbyaccount.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -52,29 +52,29 @@  discard block
 block discarded – undo
52 52
 	$context_default = 'bookkeepingbyaccountlist';
53 53
 }
54 54
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
55
-$search_date_startyear =  GETPOST('search_date_startyear', 'int');
56
-$search_date_startmonth =  GETPOST('search_date_startmonth', 'int');
57
-$search_date_startday =  GETPOST('search_date_startday', 'int');
58
-$search_date_endyear =  GETPOST('search_date_endyear', 'int');
59
-$search_date_endmonth =  GETPOST('search_date_endmonth', 'int');
60
-$search_date_endday =  GETPOST('search_date_endday', 'int');
55
+$search_date_startyear = GETPOST('search_date_startyear', 'int');
56
+$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
57
+$search_date_startday = GETPOST('search_date_startday', 'int');
58
+$search_date_endyear = GETPOST('search_date_endyear', 'int');
59
+$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
60
+$search_date_endday = GETPOST('search_date_endday', 'int');
61 61
 $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
62 62
 $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
63 63
 $search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
64
-$search_date_export_startyear =  GETPOST('search_date_export_startyear', 'int');
65
-$search_date_export_startmonth =  GETPOST('search_date_export_startmonth', 'int');
66
-$search_date_export_startday =  GETPOST('search_date_export_startday', 'int');
67
-$search_date_export_endyear =  GETPOST('search_date_export_endyear', 'int');
68
-$search_date_export_endmonth =  GETPOST('search_date_export_endmonth', 'int');
69
-$search_date_export_endday =  GETPOST('search_date_export_endday', 'int');
64
+$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
65
+$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
66
+$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
67
+$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
68
+$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
69
+$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
70 70
 $search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
71 71
 $search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
72
-$search_date_validation_startyear =  GETPOST('search_date_validation_startyear', 'int');
73
-$search_date_validation_startmonth =  GETPOST('search_date_validation_startmonth', 'int');
74
-$search_date_validation_startday =  GETPOST('search_date_validation_startday', 'int');
75
-$search_date_validation_endyear =  GETPOST('search_date_validation_endyear', 'int');
76
-$search_date_validation_endmonth =  GETPOST('search_date_validation_endmonth', 'int');
77
-$search_date_validation_endday =  GETPOST('search_date_validation_endday', 'int');
72
+$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
73
+$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
74
+$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
75
+$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
76
+$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
77
+$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
78 78
 $search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
79 79
 $search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
80 80
 $search_import_key = GETPOST("search_import_key", 'alpha');
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		} else {
305 305
 			$filter['t.numero_compte>='] = $search_accountancy_code_start;
306 306
 		}
307
-		$param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
307
+		$param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
308 308
 	}
309 309
 	if (!empty($search_accountancy_code_end)) {
310 310
 		if ($type == 'sub') {
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		} else {
313 313
 			$filter['t.numero_compte<='] = $search_accountancy_code_end;
314 314
 		}
315
-		$param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
315
+		$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
316 316
 	}
317 317
 	if (!empty($search_label_account)) {
318 318
 		$filter['t.label_compte'] = $search_label_account;
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 			}
495 495
 
496 496
 			if (!$error) {
497
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
497
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
498 498
 				exit();
499 499
 			}
500 500
 		} elseif ($massaction == 'letteringmanual') {
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 				setEventMessages('', $lettering->errors, 'errors');
505 505
 			} else {
506 506
 				setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
507
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
507
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
508 508
 				exit();
509 509
 			}
510 510
 		} elseif ($action == 'unletteringauto' && $confirm == "yes") {
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 			}
526 526
 
527 527
 			if (!$error) {
528
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
528
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
529 529
 				exit();
530 530
 			}
531 531
 		} elseif ($action == 'unletteringmanual' && $confirm == "yes") {
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 				setEventMessages('', $lettering->errors, 'errors');
536 536
 			} else {
537 537
 				setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
538
-				header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
538
+				header('Location: '.$_SERVER['PHP_SELF'].'?noreset=1'.$param);
539 539
 				exit();
540 540
 			}
541 541
 		}
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 // List of mass actions available
643 643
 $arrayofmassactions = array();
644 644
 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
645
-	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
646
-	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
647
-	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
648
-	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
645
+	$arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringAuto');
646
+	$arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringAuto');
647
+	$arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans('LetteringManual');
648
+	$arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"').$langs->trans('UnletteringManual');
649 649
 }
650 650
 if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
651 651
 	$arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
@@ -678,11 +678,11 @@  discard block
 block discarded – undo
678 678
 if (empty($reshook)) {
679 679
 	$newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
680 680
 	if ($type == 'sub') {
681
-		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
682
-		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
681
+		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly'));
682
+		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
683 683
 	} else {
684
-		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
685
-		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
684
+		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
685
+		$newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly'));
686 686
 	}
687 687
 	$newcardbutton .= dolGetButtonTitleSeparator();
688 688
 	$newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
@@ -760,8 +760,8 @@  discard block
 block discarded – undo
760 760
 } else {
761 761
 	$stringforfirstkey .= ' CTL +';
762 762
 }
763
-$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
764
-$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
763
+$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="'.$stringforfirstkey.' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
764
+$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="'.$stringforfirstkey.' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
765 765
 $moreforfilter .= <<<SCRIPT
766 766
 <script type="text/javascript">
767 767
 	jQuery(document).ready(function() {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 $i = 0;
967 967
 
968 968
 $totalarray = array();
969
-$totalarray['val'] = array ();
969
+$totalarray['val'] = array();
970 970
 $totalarray['nbfield'] = 0;
971 971
 $total_debit = 0;
972 972
 $total_credit = 0;
@@ -988,8 +988,8 @@  discard block
 block discarded – undo
988 988
 	}
989 989
 	//if (empty($accountg)) $accountg = '-';
990 990
 
991
-	$colspan = 0;			// colspan before field 'label of operation'
992
-	$colspanend = 0;		// colspan after debit/credit
991
+	$colspan = 0; // colspan before field 'label of operation'
992
+	$colspanend = 0; // colspan after debit/credit
993 993
 	if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
994 994
 		$colspan++;
995 995
 	}
@@ -1014,9 +1014,9 @@  discard block
 block discarded – undo
1014 1014
 		if (isset($displayed_account_number)) {
1015 1015
 			print '<tr class="liste_total">';
1016 1016
 			if ($type == 'sub') {
1017
-				print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accounta($displayed_account_number) . ':</td>';
1017
+				print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accounta($displayed_account_number).':</td>';
1018 1018
 			} else {
1019
-				print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
1019
+				print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.length_accountg($displayed_account_number).':</td>';
1020 1020
 			}
1021 1021
 			print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1022 1022
 			print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 
1044 1044
 		// Show the break account
1045 1045
 		print '<tr class="trforbreak">';
1046
-		print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields)+1).'" class="tdforbreak">';
1046
+		print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields) + 1).'" class="tdforbreak">';
1047 1047
 		if ($type == 'sub') {
1048 1048
 			if ($line->subledger_account != "" && $line->subledger_account != '-1') {
1049 1049
 				print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
@@ -1051,9 +1051,9 @@  discard block
 block discarded – undo
1051 1051
 				print length_accounta($line->subledger_account);
1052 1052
 			} else {
1053 1053
 				// Should not happen: subledger account must be null or a non empty value
1054
-				print '<span class="error">' . $langs->trans("Unknown");
1054
+				print '<span class="error">'.$langs->trans("Unknown");
1055 1055
 				if ($line->subledger_label) {
1056
-					print ' (' . $line->subledger_label . ')';
1056
+					print ' ('.$line->subledger_label.')';
1057 1057
 					$htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1058 1058
 				} else {
1059 1059
 					$htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
@@ -1063,9 +1063,9 @@  discard block
 block discarded – undo
1063 1063
 			}
1064 1064
 		} else {
1065 1065
 			if ($line->numero_compte != "" && $line->numero_compte != '-1') {
1066
-				print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
1066
+				print length_accountg($line->numero_compte).' : '.$object->get_compte_desc($line->numero_compte);
1067 1067
 			} else {
1068
-				print '<span class="error">' . $langs->trans("Unknown") . '</span>';
1068
+				print '<span class="error">'.$langs->trans("Unknown").'</span>';
1069 1069
 			}
1070 1070
 		}
1071 1071
 		print '</td>';
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 			if (in_array($line->id, $arrayofselected)) {
1089 1089
 				$selected = 1;
1090 1090
 			}
1091
-			print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1091
+			print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1092 1092
 		}
1093 1093
 		print '</td>';
1094 1094
 		if (!$i) {
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 		} elseif ($line->doc_type == 'bank') {
1185 1185
 			print $objectstatic->getNomUrl(1);
1186 1186
 			$bank_ref = strstr($line->doc_ref, '-');
1187
-			print " " . $bank_ref;
1187
+			print " ".$bank_ref;
1188 1188
 		} else {
1189 1189
 			print $line->doc_ref;
1190 1190
 		}
@@ -1286,7 +1286,7 @@  discard block
 block discarded – undo
1286 1286
 			if (in_array($line->id, $arrayofselected)) {
1287 1287
 				$selected = 1;
1288 1288
 			}
1289
-			print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1289
+			print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1290 1290
 		}
1291 1291
 		print '</td>';
1292 1292
 		if (!$i) {
Please login to merge, or discard this patch.
htdocs/admin/mails_ticket.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 		}
316 316
 		$htmltext = $langs->trans("ContactSuperAdminForChange");
317 317
 		print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
318
-		print '<input type="hidden" name="MAIN_MAIL_SENDMODE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET').'">';
318
+		print '<input type="hidden" name="MAIN_MAIL_SENDMODE_TICKET" value="'.getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET').'">';
319 319
 	}
320 320
 	print '</td></tr>';
321 321
 
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
344 344
 			print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
345 345
 			print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
346
-			print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
346
+			print ' <span class="opacitymedium smtp_method">'.$langs->trans("SeeLinkToOnlineDocumentation").'</span>';
347 347
 		} else {
348 348
 			$text = !empty($mainserver) ? $mainserver : $smtpserver;
349 349
 			$htmltext = $langs->trans("ContactSuperAdminForChange");
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
438 438
 		print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
439 439
 		// SuperAdministrator access only
440
-		if (!isModEnabled('multicompany')  || ($user->admin && !$user->entity)) {
440
+		if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
441 441
 			print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET);
442 442
 		} else {
443 443
 			$text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 			}
447 447
 			$htmltext = $langs->trans("ContactSuperAdminForChange");
448 448
 			print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
449
-			print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET').'">';
449
+			print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET').'">';
450 450
 		}
451 451
 		print '</td></tr>';
452 452
 	}
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 		// AUTH method
528 528
 		if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
529 529
 			$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
530
-			$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ?  $langs->trans("UseOauth") : '') ;
530
+			$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '');
531 531
 			print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
532 532
 		}
533 533
 
534 534
 		// SMTPS ID
535 535
 		if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
536
-			print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'</td></tr>';
536
+			print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'</td></tr>';
537 537
 		}
538 538
 
539 539
 		// SMTPS PW
Please login to merge, or discard this patch.
htdocs/admin/mails.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
384 384
 
385 385
 	// SuperAdministrator access only
386
-	if (!isModEnabled('multicompany')  || ($user->admin && !$user->entity)) {
386
+	if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
387 387
 		print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'));
388 388
 	} else {
389 389
 		$text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE')];
@@ -502,11 +502,11 @@  discard block
 block discarded – undo
502 502
 		print '</td><td>';
503 503
 		// SuperAdministrator access only
504 504
 		if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
505
-			print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="' . htmlspecialchars($mainsmtppw, ENT_COMPAT, 'UTF-8') . '" autocomplete="off">';
505
+			print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW" size="32" value="'.htmlspecialchars($mainsmtppw, ENT_COMPAT, 'UTF-8').'" autocomplete="off">';
506 506
 		} else {
507 507
 			$htmltext = $langs->trans("ContactSuperAdminForChange");
508 508
 			print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW, $htmltext, 1, 'superadmin');
509
-			print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="' . htmlspecialchars($mainsmtppw, ENT_COMPAT, 'UTF-8') . '">';
509
+			print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW" value="'.htmlspecialchars($mainsmtppw, ENT_COMPAT, 'UTF-8').'">';
510 510
 		}
511 511
 		print '</td></tr>';
512 512
 	}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		print '<tr class="oddeven smtp_oauth_service"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
517 517
 
518 518
 		// SuperAdministrator access only
519
-		if (!isModEnabled('multicompany')  || ($user->admin && !$user->entity)) {
519
+		if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
520 520
 			print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE);
521 521
 		} else {
522 522
 			$text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE')];
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
 			}
526 526
 			$htmltext = $langs->trans("ContactSuperAdminForChange");
527 527
 			print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
528
-			print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE" value="' . getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'">';
528
+			print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE" value="'.getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE').'">';
529 529
 		}
530 530
 		print '</td></tr>';
531 531
 	}
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 		// AUTH method
722 722
 		if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
723 723
 			$authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE', 'LOGIN');
724
-			$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ?  $langs->trans("UseOauth") : '') ;
724
+			$text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '');
725 725
 			print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
726 726
 		}
727 727
 
728 728
 		// SMTPS ID
729 729
 		if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) {
730
-			print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>' . getDolGlobalString('MAIN_MAIL_SMTPS_ID').'</td></tr>';
730
+			print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID').'</td></tr>';
731 731
 		}
732 732
 
733 733
 		// SMTPS PW
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
 		print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined"));
851 851
 		print ' '.$help;
852 852
 		print '</td>';
853
-		print '<td>' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
853
+		print '<td>'.getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
854 854
 		if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) {
855 855
 			print img_warning($langs->trans("Mandatory"));
856 856
 		} elseif (!isValidEmail($conf->global->MAIN_MAIL_EMAIL_FROM)) {
Please login to merge, or discard this patch.
htdocs/emailcollector/class/emailcollector.class.php 1 patch
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 // Put here all includes required by your class file
25
-include_once DOL_DOCUMENT_ROOT .'/emailcollector/lib/emailcollector.lib.php';
26
-
27
-require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
28
-require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
29
-
30
-require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php';                   // Customer Proposal
31
-require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php';                    // Sale Order
32
-require_once DOL_DOCUMENT_ROOT .'/compta/facture/class/facture.class.php';               // Customer Invoice
33
-require_once DOL_DOCUMENT_ROOT .'/contact/class/contact.class.php';                      // Contact / Address
34
-require_once DOL_DOCUMENT_ROOT .'/expedition/class/expedition.class.php';                // Shipping / Delivery
35
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.commande.class.php';           // Purchase Order
36
-require_once DOL_DOCUMENT_ROOT .'/fourn/class/fournisseur.facture.class.php';            // Purchase Invoice
37
-require_once DOL_DOCUMENT_ROOT .'/projet/class/project.class.php';                       // Project
38
-require_once DOL_DOCUMENT_ROOT .'/reception/class/reception.class.php';                  // Reception
39
-require_once DOL_DOCUMENT_ROOT .'/recruitment/class/recruitmentcandidature.class.php';   // Recruiting
40
-require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php';                      // Third-Party
41
-require_once DOL_DOCUMENT_ROOT .'/supplier_proposal/class/supplier_proposal.class.php';  // Supplier Proposal
42
-require_once DOL_DOCUMENT_ROOT .'/ticket/class/ticket.class.php';                        // Ticket
25
+include_once DOL_DOCUMENT_ROOT.'/emailcollector/lib/emailcollector.lib.php';
26
+
27
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
28
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
29
+
30
+require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; // Customer Proposal
31
+require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; // Sale Order
32
+require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Customer Invoice
33
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; // Contact / Address
34
+require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; // Shipping / Delivery
35
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; // Purchase Order
36
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; // Purchase Invoice
37
+require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Project
38
+require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php'; // Reception
39
+require_once DOL_DOCUMENT_ROOT.'/recruitment/class/recruitmentcandidature.class.php'; // Recruiting
40
+require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; // Third-Party
41
+require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; // Supplier Proposal
42
+require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php'; // Ticket
43 43
 //require_once DOL_DOCUMENT_ROOT .'/expensereport/class/expensereport.class.php';        // Expense Report
44 44
 //require_once DOL_DOCUMENT_ROOT .'/holiday/class/holiday.class.php';                    // Holidays (leave request)
45 45
 
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 		} elseif (empty($this->imap_encryption) || ($this->imap_encryption == 'ssl' && getDolGlobalString('IMAP_FORCE_NOSSL'))) {
799 799
 			$flags .= '';
800 800
 		} else {
801
-			$flags .= '/' . $this->imap_encryption;
801
+			$flags .= '/'.$this->imap_encryption;
802 802
 		}
803 803
 
804 804
 		$flags .= '/novalidate-cert';
@@ -828,8 +828,8 @@  discard block
 block discarded – undo
828 828
 	{
829 829
 		if (function_exists('mb_convert_encoding')) {
830 830
 			// change spaces by entropy because mb_convert fail with spaces
831
-			$str = preg_replace("/ /", "xxxSPACExxx", $str);		// the replacement string must be valid in utf7 so _ can't be used
832
-			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str);	// the replacement string must be valid in utf7 so _ can't be used
831
+			$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
832
+			$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
833 833
 			// if mb_convert work
834 834
 			if ($str = mb_convert_encoding($str, "UTF-7")) {
835 835
 				// change characters
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 				$keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
1159 1159
 
1160 1160
 				$OAUTH_SERVICENAME = 'Unknown';
1161
-				if ( array_key_exists($keyforsupportedoauth2array, $supportedoauth2array)
1161
+				if (array_key_exists($keyforsupportedoauth2array, $supportedoauth2array)
1162 1162
 					&& array_key_exists('name', $supportedoauth2array[$keyforsupportedoauth2array])
1163 1163
 					&& !empty($supportedoauth2array[$keyforsupportedoauth2array]['name'])) {
1164 1164
 					$OAUTH_SERVICENAME = $supportedoauth2array[$keyforsupportedoauth2array]['name'].(!empty($keyforprovider) ? '-'.$keyforprovider : '');
@@ -1426,7 +1426,7 @@  discard block
 block discarded – undo
1426 1426
 				}
1427 1427
 
1428 1428
 				if ($rule['type'] == 'from') {
1429
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1429
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1430 1430
 					if (count($tmprulevaluearray) >= 2) {
1431 1431
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1432 1432
 							$search .= ($search ? ' ' : '').$not.'FROM "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
 					}
1437 1437
 				}
1438 1438
 				if ($rule['type'] == 'to') {
1439
-					$tmprulevaluearray = explode('*', $rule['rulevalue']);	// Search on abc*def means searching on 'abc' and on 'def'
1439
+					$tmprulevaluearray = explode('*', $rule['rulevalue']); // Search on abc*def means searching on 'abc' and on 'def'
1440 1440
 					if (count($tmprulevaluearray) >= 2) {
1441 1441
 						foreach ($tmprulevaluearray as $tmprulevalue) {
1442 1442
 							$search .= ($search ? ' ' : '').$not.'TO "'.str_replace('"', '', $tmprulevalue).'"';
@@ -1592,7 +1592,7 @@  discard block
 block discarded – undo
1592 1592
 			}
1593 1593
 		}
1594 1594
 
1595
-		$arrayofemailtodelete = array();	// Track email to delete to make the deletion at end.
1595
+		$arrayofemailtodelete = array(); // Track email to delete to make the deletion at end.
1596 1596
 
1597 1597
 		// Loop on each email found
1598 1598
 		if (!$error && !empty($arrayofemail) && count($arrayofemail) > 0) {
@@ -1662,8 +1662,8 @@  discard block
 block discarded – undo
1662 1662
 				} else {
1663 1663
 					$operationslog .= " - ".dol_escape_htmltag((string) $imapemail);
1664 1664
 				}
1665
-				$operationslog .= " - References: ".dol_escape_htmltag($headers['References']??'')." - Subject: ".dol_escape_htmltag($headers['Subject']);
1666
-				dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References']??'')." Subject: ".$headers['Subject']);
1665
+				$operationslog .= " - References: ".dol_escape_htmltag($headers['References'] ?? '')." - Subject: ".dol_escape_htmltag($headers['Subject']);
1666
+				dol_syslog("** Process email ".$iforemailloop." References: ".($headers['References'] ?? '')." Subject: ".$headers['Subject']);
1667 1667
 
1668 1668
 
1669 1669
 				$trackidfoundintorecipienttype = '';
@@ -1783,7 +1783,7 @@  discard block
 block discarded – undo
1783 1783
 						$attachments = [];
1784 1784
 					}
1785 1785
 				} else {
1786
-					$this->getmsg($connection, $imapemail);	// This set global var $charset, $htmlmsg, $plainmsg, $attachments
1786
+					$this->getmsg($connection, $imapemail); // This set global var $charset, $htmlmsg, $plainmsg, $attachments
1787 1787
 				}
1788 1788
 				//print $plainmsg;
1789 1789
 				//var_dump($plainmsg); exit;
@@ -2220,7 +2220,7 @@  discard block
 block discarded – undo
2220 2220
 
2221 2221
 						// Make Operation
2222 2222
 						dol_syslog("Execute action ".$operation['type']." actionparam=".$operation['actionparam'].' thirdpartystatic->id='.$thirdpartystatic->id.' contactstatic->id='.$contactstatic->id.' projectstatic->id='.$projectstatic->id);
2223
-						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type);	// If a Dolibarr tracker id is found, we should now the id of object
2223
+						dol_syslog("Execute action fk_element_id=".$fk_element_id." fk_element_type=".$fk_element_type); // If a Dolibarr tracker id is found, we should now the id of object
2224 2224
 
2225 2225
 						$actioncode = 'EMAIL_IN';
2226 2226
 						// If we scan the Sent box, we use the code for out email
@@ -2400,7 +2400,7 @@  discard block
 block discarded – undo
2400 2400
 													$thirdpartystatic->name_alias = $namealiastouseforthirdparty;
2401 2401
 												}
2402 2402
 											} else {
2403
-												$thirdpartystatic->name_alias = (empty($replytostring) ? (empty($fromtext) ? '': $fromtext) : $replytostring);
2403
+												$thirdpartystatic->name_alias = (empty($replytostring) ? (empty($fromtext) ? '' : $fromtext) : $replytostring);
2404 2404
 											}
2405 2405
 											$thirdpartystatic->email = (empty($emailtouseforthirdparty) ? (empty($replyto) ? (empty($from) ? '' : $from) : $replyto) : $emailtouseforthirdparty);
2406 2406
 
@@ -2451,11 +2451,11 @@  discard block
 block discarded – undo
2451 2451
 									$result = $contactstatic->fetch(0, null, '', $from);
2452 2452
 									if ($result < 0) {
2453 2453
 										$errorforactions++;
2454
-										$this->error = 'Error when getting contact with email ' . $from;
2454
+										$this->error = 'Error when getting contact with email '.$from;
2455 2455
 										$this->errors[] = $this->error;
2456 2456
 										break;
2457 2457
 									} elseif ($result == 0) {
2458
-										dol_syslog("Contact with email " . $from . " was not found. We try to create it.");
2458
+										dol_syslog("Contact with email ".$from." was not found. We try to create it.");
2459 2459
 										$contactstatic = new Contact($this->db);
2460 2460
 
2461 2461
 										// Create contact
@@ -2470,28 +2470,28 @@  discard block
 block discarded – undo
2470 2470
 										} else {
2471 2471
 											// Search country by name or code
2472 2472
 											if (!empty($contactstatic->country)) {
2473
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2473
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2474 2474
 												$result = getCountry('', 3, $this->db, '', 1, $contactstatic->country);
2475 2475
 												if ($result == 'NotDefined') {
2476 2476
 													$errorforactions++;
2477
-													$this->error = "Error country not found by this name '" . $contactstatic->country . "'";
2477
+													$this->error = "Error country not found by this name '".$contactstatic->country."'";
2478 2478
 												} elseif (!($result > 0)) {
2479 2479
 													$errorforactions++;
2480
-													$this->error = "Error when search country by this name '" . $contactstatic->country . "'";
2480
+													$this->error = "Error when search country by this name '".$contactstatic->country."'";
2481 2481
 													$this->errors[] = $this->db->lasterror();
2482 2482
 												} else {
2483 2483
 													$contactstatic->country_id = $result;
2484 2484
 													$operationslog .= '<br>We set property country_id='.dol_escape_htmltag($result);
2485 2485
 												}
2486 2486
 											} elseif (!empty($contactstatic->country_code)) {
2487
-												require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2487
+												require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2488 2488
 												$result = getCountry($contactstatic->country_code, 3, $this->db);
2489 2489
 												if ($result == 'NotDefined') {
2490 2490
 													$errorforactions++;
2491
-													$this->error = "Error country not found by this code '" . $contactstatic->country_code . "'";
2491
+													$this->error = "Error country not found by this code '".$contactstatic->country_code."'";
2492 2492
 												} elseif (!($result > 0)) {
2493 2493
 													$errorforactions++;
2494
-													$this->error = "Error when search country by this code '" . $contactstatic->country_code . "'";
2494
+													$this->error = "Error when search country by this code '".$contactstatic->country_code."'";
2495 2495
 													$this->errors[] = $this->db->lasterror();
2496 2496
 												} else {
2497 2497
 													$contactstatic->country_id = $result;
@@ -2502,28 +2502,28 @@  discard block
 block discarded – undo
2502 2502
 											if (!$errorforactions) {
2503 2503
 												// Search state by name or code (for country if defined)
2504 2504
 												if (!empty($contactstatic->state)) {
2505
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2505
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2506 2506
 													$result = dol_getIdFromCode($this->db, $contactstatic->state, 'c_departements', 'nom', 'rowid');
2507 2507
 													if (empty($result)) {
2508 2508
 														$errorforactions++;
2509
-														$this->error = "Error state not found by this name '" . $contactstatic->state . "'";
2509
+														$this->error = "Error state not found by this name '".$contactstatic->state."'";
2510 2510
 													} elseif (!($result > 0)) {
2511 2511
 														$errorforactions++;
2512
-														$this->error = "Error when search state by this name '" . $contactstatic->state . "'";
2512
+														$this->error = "Error when search state by this name '".$contactstatic->state."'";
2513 2513
 														$this->errors[] = $this->db->lasterror();
2514 2514
 													} else {
2515 2515
 														$contactstatic->state_id = $result;
2516 2516
 														$operationslog .= '<br>We set property state_id='.dol_escape_htmltag($result);
2517 2517
 													}
2518 2518
 												} elseif (!empty($contactstatic->state_code)) {
2519
-													require_once DOL_DOCUMENT_ROOT . '/core/lib/functions.lib.php';
2519
+													require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
2520 2520
 													$result = dol_getIdFromCode($this->db, $contactstatic->state_code, 'c_departements', 'code_departement', 'rowid');
2521 2521
 													if (empty($result)) {
2522 2522
 														$errorforactions++;
2523
-														$this->error = "Error state not found by this code '" . $contactstatic->state_code . "'";
2523
+														$this->error = "Error state not found by this code '".$contactstatic->state_code."'";
2524 2524
 													} elseif (!($result > 0)) {
2525 2525
 														$errorforactions++;
2526
-														$this->error = "Error when search state by this code '" . $contactstatic->state_code . "'";
2526
+														$this->error = "Error when search state by this code '".$contactstatic->state_code."'";
2527 2527
 														$this->errors[] = $this->db->lasterror();
2528 2528
 													} else {
2529 2529
 														$contactstatic->state_id = $result;
@@ -2586,8 +2586,8 @@  discard block
 block discarded – undo
2586 2586
 								$actioncomm->label       = $langs->trans("ActionAC_".$actioncode).' - '.$langs->trans("MailFrom").' '.$from;
2587 2587
 								$actioncomm->note_private = $descriptionfull;
2588 2588
 								$actioncomm->fk_project  = $projectstatic->id;
2589
-								$actioncomm->datep       = $date;	// date of email
2590
-								$actioncomm->datef       = $date;	// date of email
2589
+								$actioncomm->datep       = $date; // date of email
2590
+								$actioncomm->datef       = $date; // date of email
2591 2591
 								$actioncomm->percentage  = -1; // Not applicable
2592 2592
 								$actioncomm->socid       = $thirdpartystatic->id;
2593 2593
 								$actioncomm->contact_id = $contactstatic->id;
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
 								}
2760 2760
 								$hookmanager->initHooks(array('emailcolector'));
2761 2761
 								$parameters = array('arrayobject' => $arrayobject);
2762
-								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters);    // Note that $action and $object may have been modified by some hooks
2762
+								$reshook = $hookmanager->executeHooks('addmoduletoeamailcollectorjoinpiece', $parameters); // Note that $action and $object may have been modified by some hooks
2763 2763
 								if ($reshook > 0) {
2764 2764
 									$arrayobject = $hookmanager->resArray;
2765 2765
 								}
@@ -2768,10 +2768,10 @@  discard block
 block discarded – undo
2768 2768
 
2769 2769
 								foreach ($arrayobject as $key => $objectdesc) {
2770 2770
 									$sql = 'SELECT DISTINCT t.rowid ';
2771
-									$sql .= ' FROM ' . MAIN_DB_PREFIX . $objectdesc['table'] . ' AS t';
2771
+									$sql .= ' FROM '.MAIN_DB_PREFIX.$objectdesc['table'].' AS t';
2772 2772
 									$sql .= ' WHERE ';
2773 2773
 									foreach ($objectdesc['fields'] as $field) {
2774
-										$sql .= "'" .$this->db->escape($subject) . "'  LIKE CONCAT('%',  t." . $field . ", '%') OR ";
2774
+										$sql .= "'".$this->db->escape($subject)."'  LIKE CONCAT('%',  t.".$field.", '%') OR ";
2775 2775
 									}
2776 2776
 									$sql = substr($sql, 0, -4);
2777 2777
 
@@ -2791,8 +2791,8 @@  discard block
 block discarded – undo
2791 2791
 									foreach ($ids as $val) {
2792 2792
 										$res = $objectmanaged->fetch($val);
2793 2793
 										if ($res) {
2794
-											$path = ($objectmanaged->entity > 1 ? "/" . $objectmanaged->entity : '');
2795
-											$dirs[] = DOL_DATA_ROOT . $path . "/" . $elementpath . '/' . dol_sanitizeFileName($objectmanaged->ref) . '/';
2794
+											$path = ($objectmanaged->entity > 1 ? "/".$objectmanaged->entity : '');
2795
+											$dirs[] = DOL_DATA_ROOT.$path."/".$elementpath.'/'.dol_sanitizeFileName($objectmanaged->ref).'/';
2796 2796
 										} else {
2797 2797
 											$this->errors[] = 'object not found';
2798 2798
 										}
@@ -2801,7 +2801,7 @@  discard block
 block discarded – undo
2801 2801
 								foreach ($dirs as $target) {
2802 2802
 									$prefix = $this->actions[$this->id]['actionparam'];
2803 2803
 									foreach ($data as $filename => $content) {
2804
-										$resr = saveAttachment($target, $prefix . '_' . $filename, $content);
2804
+										$resr = saveAttachment($target, $prefix.'_'.$filename, $content);
2805 2805
 										if ($resr == -1) {
2806 2806
 											$this->errors[] = 'Doc not saved';
2807 2807
 										}
@@ -2848,7 +2848,7 @@  discard block
 block discarded – undo
2848 2848
 								$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
2849 2849
 
2850 2850
 								$projecttocreate->title = $subject;
2851
-								$projecttocreate->date_start = $date;	// date of email
2851
+								$projecttocreate->date_start = $date; // date of email
2852 2852
 								$projecttocreate->date_end = '';
2853 2853
 								$projecttocreate->opp_status = $id_opp_status;
2854 2854
 								$projecttocreate->opp_percent = $percent_opp_status;
@@ -3108,7 +3108,7 @@  discard block
 block discarded – undo
3108 3108
 								$candidaturetocreate->note_private = $descriptionfull;
3109 3109
 								$candidaturetocreate->entity = $conf->entity;
3110 3110
 								$candidaturetocreate->email_msgid = $msgid;
3111
-								$candidaturetocreate->email_date = $date;		// date of email
3111
+								$candidaturetocreate->email_date = $date; // date of email
3112 3112
 								$candidaturetocreate->status = $candidaturetocreate::STATUS_DRAFT;
3113 3113
 								//$candidaturetocreate->fk_contact = $contactstatic->id;
3114 3114
 
@@ -3472,8 +3472,8 @@  discard block
 block discarded – undo
3472 3472
 				 * append increment number to the original filename
3473 3473
 				 */
3474 3474
 				while (file_exists($destdir.$file_name.".".$extension)) {
3475
-					$file_name = $file_name_original . ' (' . $num . ')';
3476
-					$file_name_complete = $file_name . "." . $extension;
3475
+					$file_name = $file_name_original.' ('.$num.')';
3476
+					$file_name_complete = $file_name.".".$extension;
3477 3477
 					$destination = $destdir.$file_name_complete;
3478 3478
 					$num++;
3479 3479
 				}
@@ -3607,7 +3607,7 @@  discard block
 block discarded – undo
3607 3607
 	 */
3608 3608
 	private function saveAttachment($destdir, $filename, $content)
3609 3609
 	{
3610
-		require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
3610
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
3611 3611
 
3612 3612
 		$tmparraysize = getDefaultImageSizes();
3613 3613
 		$maxwidthsmall = $tmparraysize['maxwidthsmall'];
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -887,16 +887,16 @@  discard block
 block discarded – undo
887 887
 				}
888 888
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
889 889
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
890
-					$datas[$key]= '<br><b><u>'. $labelextra . '</u></b>';
890
+					$datas[$key] = '<br><b><u>'.$labelextra.'</u></b>';
891 891
 				} else {
892
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
893
-					$datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
892
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
893
+					$datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
894 894
 					$count++;
895 895
 				}
896 896
 			}
897 897
 		}
898 898
 
899
-		$hookmanager->initHooks(array($this->element . 'dao'));
899
+		$hookmanager->initHooks(array($this->element.'dao'));
900 900
 		$parameters = array(
901 901
 			'tooltipcontentarray' => &$datas,
902 902
 			'params' => $params,
@@ -1387,7 +1387,7 @@  discard block
 block discarded – undo
1387 1387
 		if ($source == 'external' || $source == 'thirdparty') {
1388 1388
 			$sql .= " AND tc.source = 'external'";
1389 1389
 			if ($status >= 0) {
1390
-				$sql .= " AND t.statut = ".((int) $status);	// t is llx_socpeople
1390
+				$sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople
1391 1391
 			}
1392 1392
 		}
1393 1393
 		$sql .= " AND tc.active = 1";
@@ -1746,8 +1746,8 @@  discard block
 block discarded – undo
1746 1746
 		if ($idtofetch) {
1747 1747
 			$thirdparty = new Societe($this->db);
1748 1748
 			$result = $thirdparty->fetch($idtofetch);
1749
-			if ($result<0) {
1750
-				$this->errors=array_merge($this->errors, $thirdparty->errors);
1749
+			if ($result < 0) {
1750
+				$this->errors = array_merge($this->errors, $thirdparty->errors);
1751 1751
 			}
1752 1752
 			$this->thirdparty = $thirdparty;
1753 1753
 
@@ -1777,7 +1777,7 @@  discard block
 block discarded – undo
1777 1777
 		}
1778 1778
 
1779 1779
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element;
1780
-		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'";	// no escapeforlike here
1780
+		$sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here
1781 1781
 		$sql .= " LIMIT 1";
1782 1782
 
1783 1783
 		$query = $this->db->query($sql);
@@ -2070,9 +2070,9 @@  discard block
 block discarded – undo
2070 2070
 		if ($trigkey) {
2071 2071
 			$oldvalue = null;
2072 2072
 
2073
-			$sql = "SELECT " . $field;
2074
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2075
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
2073
+			$sql = "SELECT ".$field;
2074
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2075
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2076 2076
 
2077 2077
 			$resql = $this->db->query($sql);
2078 2078
 			if ($resql) {
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
 		}
2203 2203
 		$restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc;
2204 2204
 		$sql = "SELECT MAX(te.".$fieldid.")";
2205
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2205
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2206 2206
 		if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
2207 2207
 			$tmparray = explode('@', $this->ismultientitymanaged);
2208 2208
 			$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 		$this->ref_previous = $row[0];
2273 2273
 
2274 2274
 		$sql = "SELECT MIN(te.".$fieldid.")";
2275
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2275
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2276 2276
 		if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
2277 2277
 			$tmparray = explode('@', $this->ismultientitymanaged);
2278 2278
 			$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 		// Triggers
2427 2427
 		if (!$error && !$notrigger) {
2428 2428
 			// Call triggers
2429
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2429
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2430 2430
 			if ($result < 0) {
2431 2431
 				$error++;
2432 2432
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2791,7 +2791,7 @@  discard block
 block discarded – undo
2791 2791
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
2792 2792
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
2793 2793
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
2794
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2794
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2795 2795
 			}
2796 2796
 			$sql .= ' WHERE rowid='.((int) $this->id);
2797 2797
 
@@ -3140,10 +3140,10 @@  discard block
 block discarded – undo
3140 3140
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3141 3141
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3142 3142
 		if (!$renum) {
3143
-			$sql .= " AND " . $fieldposition . " = 0";
3143
+			$sql .= " AND ".$fieldposition." = 0";
3144 3144
 		}
3145 3145
 		if ($renum) {
3146
-			$sql .= " AND " . $fieldposition . " <> 0";
3146
+			$sql .= " AND ".$fieldposition." <> 0";
3147 3147
 		}
3148 3148
 
3149 3149
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3164,7 +3164,7 @@  discard block
 block discarded – undo
3164 3164
 			if ($fk_parent_line) {
3165 3165
 				$sql .= ' AND fk_parent_line IS NULL';
3166 3166
 			}
3167
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3167
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3168 3168
 
3169 3169
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3170 3170
 			$resql = $this->db->query($sql);
@@ -3215,7 +3215,7 @@  discard block
 block discarded – undo
3215 3215
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3216 3216
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3217 3217
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3218
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3218
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3219 3219
 
3220 3220
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3221 3221
 		$resql = $this->db->query($sql);
@@ -3298,8 +3298,8 @@  discard block
 block discarded – undo
3298 3298
 			dol_print_error($this->db);
3299 3299
 			return -1;
3300 3300
 		} else {
3301
-			$parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3302
-			$action='';
3301
+			$parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3302
+			$action = '';
3303 3303
 			$reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action);
3304 3304
 			return 1;
3305 3305
 		}
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
 
3339 3339
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3340 3340
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3341
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3341
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3342 3342
 			if ($this->db->query($sql)) {
3343 3343
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
3344 3344
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3369,7 +3369,7 @@  discard block
 block discarded – undo
3369 3369
 
3370 3370
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3371 3371
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3372
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3372
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3373 3373
 			if ($this->db->query($sql)) {
3374 3374
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
3375 3375
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 			$fieldposition = 'position';
3396 3396
 		}
3397 3397
 
3398
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3398
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3399 3399
 		$sql .= " WHERE rowid = ".((int) $rowid);
3400 3400
 
3401 3401
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3423,7 +3423,7 @@  discard block
 block discarded – undo
3423 3423
 
3424 3424
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3425 3425
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3426
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3426
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3427 3427
 		$resql = $this->db->query($sql);
3428 3428
 		if ($resql) {
3429 3429
 			$row = $this->db->fetch_row($resql);
@@ -3541,7 +3541,7 @@  discard block
 block discarded – undo
3541 3541
 			$newsuffix = '';
3542 3542
 		}
3543 3543
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3544
-			$fieldusermod =  "fk_user_mod";
3544
+			$fieldusermod = "fk_user_mod";
3545 3545
 		} elseif ($this->table_element == 'ecm_files') {
3546 3546
 			$fieldusermod = "fk_user_m";
3547 3547
 		} else {
@@ -3583,7 +3583,7 @@  discard block
 block discarded – undo
3583 3583
 						$trigger_name = 'EXPENSE_REPORT_MODIFY';
3584 3584
 						break;
3585 3585
 					default:
3586
-						$trigger_name = strtoupper($this->element) . '_MODIFY';
3586
+						$trigger_name = strtoupper($this->element).'_MODIFY';
3587 3587
 				}
3588 3588
 				$ret = $this->call_trigger($trigger_name, $user);
3589 3589
 				if ($ret < 0) {
@@ -3941,7 +3941,7 @@  discard block
 block discarded – undo
3941 3941
 		// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
3942 3942
 		$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
3943 3943
 		// Add module part to target type if object has $module property and isn't in core modules.
3944
-		$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3944
+		$targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3945 3945
 
3946 3946
 		$parameters = array('targettype'=>$targettype);
3947 3947
 		// Hook for explicitly set the targettype if it must be differtent than $this->element
@@ -3953,19 +3953,19 @@  discard block
 block discarded – undo
3953 3953
 		$this->db->begin();
3954 3954
 		$error = 0;
3955 3955
 
3956
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
3956
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
3957 3957
 		$sql .= "fk_source";
3958 3958
 		$sql .= ", sourcetype";
3959 3959
 		$sql .= ", fk_target";
3960 3960
 		$sql .= ", targettype";
3961 3961
 		$sql .= ") VALUES (";
3962 3962
 		$sql .= ((int) $origin_id);
3963
-		$sql .= ", '" . $this->db->escape($origin) . "'";
3964
-		$sql .= ", " . ((int) $this->id);
3965
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
3963
+		$sql .= ", '".$this->db->escape($origin)."'";
3964
+		$sql .= ", ".((int) $this->id);
3965
+		$sql .= ", '".$this->db->escape($targettype)."'";
3966 3966
 		$sql .= ")";
3967 3967
 
3968
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
3968
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
3969 3969
 		if ($this->db->query($sql)) {
3970 3970
 			if (!$notrigger) {
3971 3971
 				// Call trigger
@@ -4272,20 +4272,20 @@  discard block
 block discarded – undo
4272 4272
 		$this->db->begin();
4273 4273
 		$error = 0;
4274 4274
 
4275
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4275
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4276 4276
 		if ($updatesource) {
4277
-			$sql .= "fk_source = " . ((int) $sourceid);
4278
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4279
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4280
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4277
+			$sql .= "fk_source = ".((int) $sourceid);
4278
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4279
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4280
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4281 4281
 		} elseif ($updatetarget) {
4282
-			$sql .= "fk_target = " . ((int) $targetid);
4283
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4284
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4285
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4282
+			$sql .= "fk_target = ".((int) $targetid);
4283
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4284
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4285
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4286 4286
 		}
4287 4287
 
4288
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4288
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4289 4289
 		if ($this->db->query($sql)) {
4290 4290
 			if (!$notrigger) {
4291 4291
 				// Call trigger
@@ -4361,25 +4361,25 @@  discard block
 block discarded – undo
4361 4361
 		}
4362 4362
 
4363 4363
 		if (!$error) {
4364
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4364
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4365 4365
 			$sql .= " WHERE";
4366 4366
 			if ($rowid > 0) {
4367
-				$sql .= " rowid = " . ((int) $rowid);
4367
+				$sql .= " rowid = ".((int) $rowid);
4368 4368
 			} else {
4369 4369
 				if ($deletesource) {
4370
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4371
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'";
4370
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4371
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'";
4372 4372
 				} elseif ($deletetarget) {
4373
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4374
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4373
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4374
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'";
4375 4375
 				} else {
4376
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')";
4376
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')";
4377 4377
 					$sql .= " OR";
4378
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')";
4378
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')";
4379 4379
 				}
4380 4380
 			}
4381 4381
 
4382
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4382
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4383 4383
 			if (!$this->db->query($sql)) {
4384 4384
 				$this->error = $this->db->lasterror();
4385 4385
 				$this->errors[] = $this->error;
@@ -4541,14 +4541,14 @@  discard block
 block discarded – undo
4541 4541
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4542 4542
 		}
4543 4543
 		$sql .= " WHERE rowid = ".((int) $elementId);
4544
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4544
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4545 4545
 
4546 4546
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4547 4547
 		$resql = $this->db->query($sql);
4548 4548
 		if ($resql) {
4549 4549
 			$error = 0;
4550 4550
 
4551
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4551
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4552 4552
 
4553 4553
 			if ($nb_rows_affected > 0) {
4554 4554
 				if (empty($trigkey)) {
@@ -4593,7 +4593,7 @@  discard block
 block discarded – undo
4593 4593
 					if ($fieldstatus == 'tosell') {
4594 4594
 						$this->status = $status;
4595 4595
 					} elseif ($fieldstatus == 'tobuy') {
4596
-						$this->status_buy = $status;	// @phpstan-ignore-line
4596
+						$this->status_buy = $status; // @phpstan-ignore-line
4597 4597
 					} else {
4598 4598
 						$this->statut = $status;
4599 4599
 						$this->status = $status;
@@ -4702,7 +4702,7 @@  discard block
 block discarded – undo
4702 4702
 			return -1;
4703 4703
 		}
4704 4704
 
4705
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4705
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4706 4706
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
4707 4707
 		$tmparray = array_keys($this->childtables);
4708 4708
 		if (is_numeric($tmparray[0])) {
@@ -4715,26 +4715,26 @@  discard block
 block discarded – undo
4715 4715
 			//print $id.'-'.$table.'-'.$elementname.'<br>';
4716 4716
 			// Check if element can be deleted
4717 4717
 			$sql = "SELECT COUNT(*) as nb";
4718
-			$sql.= " FROM ".$this->db->prefix().$table." as c";
4718
+			$sql .= " FROM ".$this->db->prefix().$table." as c";
4719 4719
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4720
-				$sql.= ", ".$this->db->prefix().$element['parent']." as p";
4720
+				$sql .= ", ".$this->db->prefix().$element['parent']." as p";
4721 4721
 			}
4722 4722
 			if (!empty($element['fk_element'])) {
4723
-				$sql.= " WHERE c.".$element['fk_element']." = ".((int) $id);
4723
+				$sql .= " WHERE c.".$element['fk_element']." = ".((int) $id);
4724 4724
 			} else {
4725
-				$sql.= " WHERE c.".$this->fk_element." = ".((int) $id);
4725
+				$sql .= " WHERE c.".$this->fk_element." = ".((int) $id);
4726 4726
 			}
4727 4727
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4728
-				$sql.= " AND c.".$element['parentkey']." = p.rowid";
4728
+				$sql .= " AND c.".$element['parentkey']." = p.rowid";
4729 4729
 			}
4730 4730
 			if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) {
4731
-				$sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4731
+				$sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4732 4732
 			}
4733 4733
 			if (!empty($entity)) {
4734 4734
 				if (!empty($element['parent']) && !empty($element['parentkey'])) {
4735
-					$sql.= " AND p.entity = ".((int) $entity);
4735
+					$sql .= " AND p.entity = ".((int) $entity);
4736 4736
 				} else {
4737
-					$sql.= " AND c.entity = ".((int) $entity);
4737
+					$sql .= " AND c.entity = ".((int) $entity);
4738 4738
 				}
4739 4739
 			}
4740 4740
 
@@ -4748,9 +4748,9 @@  discard block
 block discarded – undo
4748 4748
 					if (is_numeric($element)) {	// very old usage array('table1', 'table2', ...)
4749 4749
 						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table);
4750 4750
 					} elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...)
4751
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4751
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4752 4752
 					} else { // new usage: $element['name']=Translation key
4753
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4753
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4754 4754
 					}
4755 4755
 					break; // We found at least one, we stop here
4756 4756
 				}
@@ -4809,7 +4809,7 @@  discard block
 block discarded – undo
4809 4809
 	 */
4810 4810
 	public function getTotalDiscount()
4811 4811
 	{
4812
-		if (!empty($this->table_element_line) ) {
4812
+		if (!empty($this->table_element_line)) {
4813 4813
 			$total_discount = 0.00;
4814 4814
 
4815 4815
 			$sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht";
@@ -5762,7 +5762,7 @@  discard block
 block discarded – undo
5762 5762
 			$setsharekey = false;
5763 5763
 			if ($this->element == 'propal' || $this->element == 'proposal') {
5764 5764
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
5765
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
5765
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
5766 5766
 				}
5767 5767
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
5768 5768
 					$setsharekey = true;
@@ -5820,7 +5820,7 @@  discard block
 block discarded – undo
5820 5820
 				$ecmfile->gen_or_uploaded = 'generated';
5821 5821
 				$ecmfile->description = ''; // indexed content
5822 5822
 				$ecmfile->keywords = ''; // keyword content
5823
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
5823
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
5824 5824
 				$ecmfile->src_object_id   = $this->id;
5825 5825
 
5826 5826
 				$result = $ecmfile->create($user);
@@ -5872,7 +5872,7 @@  discard block
 block discarded – undo
5872 5872
 			$maxwidthmini = $tmparraysize['maxwidthmini'];
5873 5873
 			$maxheightmini = $tmparraysize['maxheightmini'];
5874 5874
 			//$quality = $tmparraysize['quality'];
5875
-			$quality = 50;	// For thumbs, we force quality to 50
5875
+			$quality = 50; // For thumbs, we force quality to 50
5876 5876
 
5877 5877
 			// Create small thumbs for company (Ratio is near 16/9)
5878 5878
 			// Used on logon for example
@@ -5974,8 +5974,8 @@  discard block
 block discarded – undo
5974 5974
 		// phpcs:enable
5975 5975
 		global $langs, $conf;
5976 5976
 
5977
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
5978
-			dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
5977
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
5978
+			dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
5979 5979
 			exit;
5980 5980
 		}
5981 5981
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6169,7 +6169,7 @@  discard block
 block discarded – undo
6169 6169
 		$savDisableCompute = $conf->disable_compute;
6170 6170
 		$conf->disable_compute = 1;
6171 6171
 
6172
-		$ret = $this->fetch($id);	/* @phpstan-ignore-line */
6172
+		$ret = $this->fetch($id); /* @phpstan-ignore-line */
6173 6173
 
6174 6174
 		$conf->disable_compute = $savDisableCompute;
6175 6175
 
@@ -6273,9 +6273,9 @@  discard block
 block discarded – undo
6273 6273
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6274 6274
 							//var_dump($conf->disable_compute);
6275 6275
 							if (empty($conf->disable_compute)) {
6276
-								global $objectoffield;        // We set a global variable to $objectoffield so
6277
-								$objectoffield = $this;        // we can use it inside computed formula
6278
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6276
+								global $objectoffield; // We set a global variable to $objectoffield so
6277
+								$objectoffield = $this; // we can use it inside computed formula
6278
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6279 6279
 							}
6280 6280
 						}
6281 6281
 					}
@@ -6289,7 +6289,7 @@  discard block
 block discarded – undo
6289 6289
 					return 0;
6290 6290
 				}
6291 6291
 			} else {
6292
-				$this->errors[]=$this->db->lasterror;
6292
+				$this->errors[] = $this->db->lasterror;
6293 6293
 				return -1;
6294 6294
 			}
6295 6295
 		}
@@ -6456,7 +6456,7 @@  discard block
 block discarded – undo
6456 6456
 										// If old value crypted in database is same than submited new value, it means we don't change it, so we don't update.
6457 6457
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6458 6458
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6459
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6459
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6460 6460
 											} else {
6461 6461
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6462 6462
 											}
@@ -6467,7 +6467,7 @@  discard block
 block discarded – undo
6467 6467
 										// If value has changed
6468 6468
 										if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6469 6469
 											if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) {
6470
-												$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6470
+												$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6471 6471
 											} else {
6472 6472
 												$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6473 6473
 											}
@@ -6479,7 +6479,7 @@  discard block
 block discarded – undo
6479 6479
 									//var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]);
6480 6480
 									// If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value
6481 6481
 									if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) {	// dolibarr reversible encryption
6482
-										$new_array_options[$key] = dolEncrypt($this->array_options[$key]);	// warning, must be called when on the master
6482
+										$new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master
6483 6483
 									} else {
6484 6484
 										$new_array_options[$key] = $this->array_options[$key]; // Value is kept
6485 6485
 									}
@@ -6865,7 +6865,7 @@  discard block
 block discarded – undo
6865 6865
 								if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) {	// If old value crypted in database is same than submited new value, it means we don't change it, so we don't update.
6866 6866
 									if ($algo == 'dolcrypt') {	// dolibarr reversible encryption
6867 6867
 										if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {
6868
-											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
6868
+											$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
6869 6869
 										} else {
6870 6870
 											$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
6871 6871
 										}
@@ -6885,7 +6885,7 @@  discard block
 block discarded – undo
6885 6885
 								}
6886 6886
 							} else {
6887 6887
 								if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) {	// dolibarr reversible encryption
6888
-									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]);	// warning, must be called when on the master
6888
+									$new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master
6889 6889
 								} else {
6890 6890
 									$new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept
6891 6891
 								}
@@ -7135,7 +7135,7 @@  discard block
 block discarded – undo
7135 7135
 		// Special case that force options and type ($type can be integer, varchar, ...)
7136 7136
 		if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) {
7137 7137
 			$param['options'] = $this->fields[$key]['arrayofkeyval'];
7138
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
7138
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
7139 7139
 		}
7140 7140
 
7141 7141
 		$label = $this->fields[$key]['label'];
@@ -7187,7 +7187,7 @@  discard block
 block discarded – undo
7187 7187
 
7188 7188
 		// Add validation state class
7189 7189
 		if (!empty($validationClass)) {
7190
-			$morecss.= $validationClass;
7190
+			$morecss .= $validationClass;
7191 7191
 		}
7192 7192
 
7193 7193
 		if (in_array($type, array('date'))) {
@@ -7293,7 +7293,7 @@  discard block
 block discarded – undo
7293 7293
 			if (is_array($param['options'])) {
7294 7294
 				$param_list = array_keys($param['options']);
7295 7295
 				$InfoFieldList = explode(":", $param_list[0], 5);
7296
-				if (! empty($InfoFieldList[4])) {
7296
+				if (!empty($InfoFieldList[4])) {
7297 7297
 					$pos = 0; $parenthesisopen = 0;
7298 7298
 					while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) {
7299 7299
 						if (substr($InfoFieldList[4], $pos, 1) == '(') {
@@ -7305,7 +7305,7 @@  discard block
 block discarded – undo
7305 7305
 						$pos++;
7306 7306
 					}
7307 7307
 					$tmpbefore = substr($InfoFieldList[4], 0, $pos);
7308
-					$tmpafter = substr($InfoFieldList[4], $pos+1);
7308
+					$tmpafter = substr($InfoFieldList[4], $pos + 1);
7309 7309
 					//var_dump($InfoFieldList[4].' -> '.$pos); var_dump($tmpafter);
7310 7310
 					$InfoFieldList[4] = $tmpbefore;
7311 7311
 					if ($tmpafter !== '') {
@@ -7353,8 +7353,8 @@  discard block
 block discarded – undo
7353 7353
 					}
7354 7354
 
7355 7355
 					$sqlwhere = '';
7356
-					$sql = "SELECT " . $keyList;
7357
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7356
+					$sql = "SELECT ".$keyList;
7357
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7358 7358
 					if (!empty($InfoFieldList[4])) {
7359 7359
 						// can use SELECT request
7360 7360
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7371,18 +7371,18 @@  discard block
 block discarded – undo
7371 7371
 						// We have to join on extrafield table
7372 7372
 						$errstr = '';
7373 7373
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7374
-							$sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra";
7375
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2];
7376
-							$sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7374
+							$sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra";
7375
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2];
7376
+							$sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7377 7377
 						} else {
7378
-							$sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7378
+							$sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1);
7379 7379
 						}
7380 7380
 					} else {
7381 7381
 						$sqlwhere .= ' WHERE 1=1';
7382 7382
 					}
7383 7383
 					// Some tables may have field, some other not. For the moment we disable it.
7384 7384
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7385
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7385
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7386 7386
 					}
7387 7387
 					$sql .= $sqlwhere;
7388 7388
 					//print $sql;
@@ -7394,7 +7394,7 @@  discard block
 block discarded – undo
7394 7394
 						$sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label));
7395 7395
 					}
7396 7396
 
7397
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
7397
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
7398 7398
 					$resql = $this->db->query($sql);
7399 7399
 					if ($resql) {
7400 7400
 						$out .= '<option value="0">&nbsp;</option>';
@@ -7410,7 +7410,7 @@  discard block
 block discarded – undo
7410 7410
 							if (count($fields_label) > 1) {
7411 7411
 								$notrans = true;
7412 7412
 								foreach ($fields_label as $field_toshow) {
7413
-									$labeltoshow .= $obj->$field_toshow . ' ';
7413
+									$labeltoshow .= $obj->$field_toshow.' ';
7414 7414
 								}
7415 7415
 							} else {
7416 7416
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7421,12 +7421,12 @@  discard block
 block discarded – undo
7421 7421
 								foreach ($fields_label as $field_toshow) {
7422 7422
 									$translabel = $langs->trans($obj->$field_toshow);
7423 7423
 									if ($translabel != $obj->$field_toshow) {
7424
-										$labeltoshow = dol_trunc($translabel) . ' ';
7424
+										$labeltoshow = dol_trunc($translabel).' ';
7425 7425
 									} else {
7426
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
7426
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
7427 7427
 									}
7428 7428
 								}
7429
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7429
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7430 7430
 							} else {
7431 7431
 								if (!$notrans) {
7432 7432
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -7440,34 +7440,34 @@  discard block
 block discarded – undo
7440 7440
 									$labeltoshow = '(not defined)';
7441 7441
 								}
7442 7442
 								if ($value == $obj->rowid) {
7443
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7443
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7444 7444
 								}
7445 7445
 
7446 7446
 								if (!empty($InfoFieldList[3]) && $parentField) {
7447
-									$parent = $parentName . ':' . $obj->{$parentField};
7447
+									$parent = $parentName.':'.$obj->{$parentField};
7448 7448
 									$isDependList = 1;
7449 7449
 								}
7450 7450
 
7451
-								$out .= '<option value="' . $obj->rowid . '"';
7451
+								$out .= '<option value="'.$obj->rowid.'"';
7452 7452
 								$out .= ($value == $obj->rowid ? ' selected' : '');
7453
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
7454
-								$out .= '>' . $labeltoshow . '</option>';
7453
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
7454
+								$out .= '>'.$labeltoshow.'</option>';
7455 7455
 							}
7456 7456
 
7457 7457
 							$i++;
7458 7458
 						}
7459 7459
 						$this->db->free($resql);
7460 7460
 					} else {
7461
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7461
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7462 7462
 					}
7463 7463
 				} else {
7464 7464
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7465 7465
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7466 7466
 					$out .= '<option value="0">&nbsp;</option>';
7467 7467
 					foreach ($data as $data_key => $data_value) {
7468
-						$out .= '<option value="' . $data_key . '"';
7468
+						$out .= '<option value="'.$data_key.'"';
7469 7469
 						$out .= ($value == $data_key ? ' selected' : '');
7470
-						$out .= '>' . $data_value . '</option>';
7470
+						$out .= '>'.$data_value.'</option>';
7471 7471
 					}
7472 7472
 				}
7473 7473
 			}
@@ -7532,8 +7532,8 @@  discard block
 block discarded – undo
7532 7532
 					}
7533 7533
 
7534 7534
 					$sqlwhere = '';
7535
-					$sql = "SELECT " . $keyList;
7536
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
7535
+					$sql = "SELECT ".$keyList;
7536
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
7537 7537
 					if (!empty($InfoFieldList[4])) {
7538 7538
 						// can use SELECT request
7539 7539
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7549,23 +7549,23 @@  discard block
 block discarded – undo
7549 7549
 
7550 7550
 						// We have to join on extrafield table
7551 7551
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7552
-							$sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra';
7553
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7552
+							$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
7553
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7554 7554
 						} else {
7555
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7555
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7556 7556
 						}
7557 7557
 					} else {
7558 7558
 						$sqlwhere .= ' WHERE 1=1';
7559 7559
 					}
7560 7560
 					// Some tables may have field, some other not. For the moment we disable it.
7561 7561
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7562
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7562
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7563 7563
 					}
7564 7564
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
7565 7565
 					// print $sql;
7566 7566
 
7567 7567
 					$sql .= $sqlwhere;
7568
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
7568
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
7569 7569
 					$resql = $this->db->query($sql);
7570 7570
 					if ($resql) {
7571 7571
 						$num = $this->db->num_rows($resql);
@@ -7583,7 +7583,7 @@  discard block
 block discarded – undo
7583 7583
 							if (count($fields_label) > 1) {
7584 7584
 								$notrans = true;
7585 7585
 								foreach ($fields_label as $field_toshow) {
7586
-									$labeltoshow .= $obj->$field_toshow . ' ';
7586
+									$labeltoshow .= $obj->$field_toshow.' ';
7587 7587
 								}
7588 7588
 							} else {
7589 7589
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7594,9 +7594,9 @@  discard block
 block discarded – undo
7594 7594
 								foreach ($fields_label as $field_toshow) {
7595 7595
 									$translabel = $langs->trans($obj->$field_toshow);
7596 7596
 									if ($translabel != $obj->$field_toshow) {
7597
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
7597
+										$labeltoshow = dol_trunc($translabel, 18).' ';
7598 7598
 									} else {
7599
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
7599
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
7600 7600
 									}
7601 7601
 								}
7602 7602
 
@@ -7619,7 +7619,7 @@  discard block
 block discarded – undo
7619 7619
 								}
7620 7620
 
7621 7621
 								if (!empty($InfoFieldList[3]) && $parentField) {
7622
-									$parent = $parentName . ':' . $obj->{$parentField};
7622
+									$parent = $parentName.':'.$obj->{$parentField};
7623 7623
 									$isDependList = 1;
7624 7624
 								}
7625 7625
 
@@ -7630,14 +7630,14 @@  discard block
 block discarded – undo
7630 7630
 						}
7631 7631
 						$this->db->free($resql);
7632 7632
 
7633
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7633
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7634 7634
 					} else {
7635
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7635
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7636 7636
 					}
7637 7637
 				} else {
7638 7638
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7639 7639
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7640
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7640
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7641 7641
 				}
7642 7642
 			}
7643 7643
 		} elseif ($type == 'link') {
@@ -7723,7 +7723,7 @@  discard block
 block discarded – undo
7723 7723
 			$out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
7724 7724
 		}
7725 7725
 
7726
-		if ($isDependList==1) {
7726
+		if ($isDependList == 1) {
7727 7727
 			$out .= $this->getJSListDependancies('_common');
7728 7728
 		}
7729 7729
 		/* Add comments
@@ -7774,7 +7774,7 @@  discard block
 block discarded – undo
7774 7774
 			$type = 'varchar'; // convert varchar(xx) int varchar
7775 7775
 		}
7776 7776
 		if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
7777
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
7777
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
7778 7778
 		}
7779 7779
 		if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
7780 7780
 			$type = 'link';
@@ -7859,7 +7859,7 @@  discard block
 block discarded – undo
7859 7859
 			$value = $this->getLibStatut(3);
7860 7860
 		} elseif ($type == 'date') {
7861 7861
 			if (!empty($value)) {
7862
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
7862
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
7863 7863
 			} else {
7864 7864
 				$value = '';
7865 7865
 			}
@@ -7897,7 +7897,7 @@  discard block
 block discarded – undo
7897 7897
 				$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
7898 7898
 			}
7899 7899
 		} elseif ($type == 'select') {
7900
-			$value = isset($param['options'][$value])?$param['options'][$value]:'';
7900
+			$value = isset($param['options'][$value]) ? $param['options'][$value] : '';
7901 7901
 		} elseif ($type == 'sellist') {
7902 7902
 			$param_list = array_keys($param['options']);
7903 7903
 			$InfoFieldList = explode(":", $param_list[0]);
@@ -7957,9 +7957,9 @@  discard block
 block discarded – undo
7957 7957
 									$translabel = $langs->trans($obj->$field_toshow);
7958 7958
 								}
7959 7959
 								if ($translabel != $field_toshow) {
7960
-									$value .= dol_trunc($translabel, 18) . ' ';
7960
+									$value .= dol_trunc($translabel, 18).' ';
7961 7961
 								} else {
7962
-									$value .= $obj->$field_toshow . ' ';
7962
+									$value .= $obj->$field_toshow.' ';
7963 7963
 								}
7964 7964
 							}
7965 7965
 						} else {
@@ -7975,7 +7975,7 @@  discard block
 block discarded – undo
7975 7975
 						}
7976 7976
 					}
7977 7977
 				} else {
7978
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
7978
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7979 7979
 
7980 7980
 					$toprint = array();
7981 7981
 					$obj = $this->db->fetch_object($resql);
@@ -7983,7 +7983,7 @@  discard block
 block discarded – undo
7983 7983
 					$c->fetch($obj->rowid);
7984 7984
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
7985 7985
 					foreach ($ways as $way) {
7986
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
7986
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
7987 7987
 					}
7988 7988
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
7989 7989
 				}
@@ -7999,11 +7999,11 @@  discard block
 block discarded – undo
7999 7999
 				$toprint = array();
8000 8000
 				foreach ($value_arr as $keyval => $valueval) {
8001 8001
 					if (!empty($valueval)) {
8002
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
8002
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
8003 8003
 					}
8004 8004
 				}
8005 8005
 				if (!empty($toprint)) {
8006
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
8006
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
8007 8007
 				}
8008 8008
 			}
8009 8009
 		} elseif ($type == 'chkbxlst') {
@@ -8058,9 +8058,9 @@  discard block
 block discarded – undo
8058 8058
 										$translabel = $langs->trans($obj->$field_toshow);
8059 8059
 									}
8060 8060
 									if ($translabel != $field_toshow) {
8061
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8061
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8062 8062
 									} else {
8063
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
8063
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
8064 8064
 									}
8065 8065
 								}
8066 8066
 							} else {
@@ -8069,15 +8069,15 @@  discard block
 block discarded – undo
8069 8069
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
8070 8070
 								}
8071 8071
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
8072
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
8072
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
8073 8073
 								} else {
8074
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
8074
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
8075 8075
 								}
8076 8076
 							}
8077 8077
 						}
8078 8078
 					}
8079 8079
 				} else {
8080
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
8080
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
8081 8081
 
8082 8082
 					$toprint = array();
8083 8083
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -8086,7 +8086,7 @@  discard block
 block discarded – undo
8086 8086
 							$c->fetch($obj->rowid);
8087 8087
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
8088 8088
 							foreach ($ways as $way) {
8089
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
8089
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
8090 8090
 							}
8091 8091
 						}
8092 8092
 					}
@@ -8233,7 +8233,7 @@  discard block
 block discarded – undo
8233 8233
 		global $langs;
8234 8234
 
8235 8235
 		if (!class_exists('Validate')) {
8236
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
8236
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
8237 8237
 		}
8238 8238
 
8239 8239
 		$this->clearFieldError($fieldKey);
@@ -8447,7 +8447,7 @@  discard block
 block discarded – undo
8447 8447
 				$out .= "\n";
8448 8448
 
8449 8449
 				$nbofextrafieldsshown = 0;
8450
-				$e = 0;	// var to manage the modulo (odd/even)
8450
+				$e = 0; // var to manage the modulo (odd/even)
8451 8451
 
8452 8452
 				$lastseparatorkeyfound = '';
8453 8453
 				$extrafields_collapse_num = '';
@@ -8498,7 +8498,7 @@  discard block
 block discarded – undo
8498 8498
 					}
8499 8499
 
8500 8500
 					$colspan = 0;
8501
-					if (is_array($params) && count($params) > 0 && $display_type=='card') {
8501
+					if (is_array($params) && count($params) > 0 && $display_type == 'card') {
8502 8502
 						if (array_key_exists('cols', $params)) {
8503 8503
 							$colspan = $params['cols'];
8504 8504
 						} elseif (array_key_exists('colspan', $params)) {	// For backward compatibility. Use cols instead now.
@@ -8585,7 +8585,7 @@  discard block
 block discarded – undo
8585 8585
 						$domData .= ' data-targetid="'.$this->id.'"';
8586 8586
 
8587 8587
 						$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
8588
-						if ($display_type=='card') {
8588
+						if ($display_type == 'card') {
8589 8589
 							if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) {
8590 8590
 								$colspan = 0;
8591 8591
 							}
@@ -8696,12 +8696,12 @@  discard block
 block discarded – undo
8696 8696
 								break;
8697 8697
 						}
8698 8698
 
8699
-						$out .= ($display_type=='card' ? '</td>' : '</div>');
8699
+						$out .= ($display_type == 'card' ? '</td>' : '</div>');
8700 8700
 
8701 8701
 						if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) {
8702
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8702
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8703 8703
 						} else {
8704
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8704
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8705 8705
 						}
8706 8706
 
8707 8707
 						$e++;
@@ -9084,7 +9084,7 @@  discard block
 block discarded – undo
9084 9084
 							if ($val['share']) {
9085 9085
 								if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
9086 9086
 									$return .= '<!-- Show original file (thumb not yet available with shared links) -->';
9087
-									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
9087
+									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
9088 9088
 								} else {
9089 9089
 									$return .= '<!-- Show original file -->';
9090 9090
 									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
@@ -9096,7 +9096,7 @@  discard block
 block discarded – undo
9096 9096
 						} else {
9097 9097
 							if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
9098 9098
 								$return .= '<!-- Show thumb -->';
9099
-								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
9099
+								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
9100 9100
 							} else {
9101 9101
 								$return .= '<!-- Show original file -->';
9102 9102
 								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
@@ -9505,7 +9505,7 @@  discard block
 block discarded – undo
9505 9505
 						continue;
9506 9506
 					}
9507 9507
 				}
9508
-				$keys_with_alias[] = $alias . '.' . $fieldname;
9508
+				$keys_with_alias[] = $alias.'.'.$fieldname;
9509 9509
 			}
9510 9510
 			return implode(',', $keys_with_alias);
9511 9511
 		} else {
@@ -9625,7 +9625,7 @@  discard block
 block discarded – undo
9625 9625
 		if (!$error) {
9626 9626
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
9627 9627
 			$sql .= " (".implode(", ", $keys).')';
9628
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
9628
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
9629 9629
 
9630 9630
 			$res = $this->db->query($sql);
9631 9631
 			if (!$res) {
@@ -9910,7 +9910,7 @@  discard block
 block discarded – undo
9910 9910
 
9911 9911
 		// Update extrafield
9912 9912
 		if (!$error) {
9913
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
9913
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
9914 9914
 			if ($result < 0) {
9915 9915
 				$error++;
9916 9916
 			}
@@ -10118,12 +10118,12 @@  discard block
 block discarded – undo
10118 10118
 				$error++;
10119 10119
 			} else {
10120 10120
 				while ($obj = $this->db->fetch_object($resql)) {
10121
-					$result = $this->fetch($obj->rowid);	// @phpstan-ignore-line
10121
+					$result = $this->fetch($obj->rowid); // @phpstan-ignore-line
10122 10122
 					if ($result < 0) {
10123 10123
 						$error++;
10124 10124
 						$this->errors[] = $this->error;
10125 10125
 					} else {
10126
-						$result = $this->delete($user);	// @phpstan-ignore-line
10126
+						$result = $this->delete($user); // @phpstan-ignore-line
10127 10127
 						if ($result < 0) {
10128 10128
 							$error++;
10129 10129
 							$this->errors[] = $this->error;
@@ -10288,7 +10288,7 @@  discard block
 block discarded – undo
10288 10288
 		);
10289 10289
 		foreach ($fields as $key => $value) {
10290 10290
 			if (array_key_exists($key, $this->fields)) {
10291
-				$this->{$key} = $value;		// @phpstan-ignore-line
10291
+				$this->{$key} = $value; // @phpstan-ignore-line
10292 10292
 			}
10293 10293
 		}
10294 10294
 
@@ -10433,7 +10433,7 @@  discard block
 block discarded – undo
10433 10433
 		// Process
10434 10434
 		foreach ($to_del as $del) {
10435 10435
 			if ($c->fetch($del) > 0) {
10436
-				$result=$c->del_type($this, $type_categ);
10436
+				$result = $c->del_type($this, $type_categ);
10437 10437
 				if ($result < 0) {
10438 10438
 					$error++;
10439 10439
 					$this->error = $c->error;
Please login to merge, or discard this patch.