Completed
Branch develop (6fc0a8)
by
unknown
16:53
created
htdocs/modulebuilder/template/myobject_agenda.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -310,7 +310,7 @@
 block discarded – undo
310 310
 		//require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
311 311
 		//$cachekey = 'count_events_myobject_'.$object->id;
312 312
 		//$nbEvent = dol_getcache($cachekey);
313
-		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>': '');
313
+		$titlelist = $langs->trans("Actions").(is_numeric($nbEvent) ? '<span class="opacitymedium colorblack paddingleft">('.$nbEvent.')</span>' : '');
314 314
 
315 315
 		print_barre_liste($titlelist, 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 0);
316 316
 
Please login to merge, or discard this patch.
htdocs/modulebuilder/template/class/myobject.class.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	/**
165 165
 	 * @var int Thirdparty ID
166 166
 	 */
167
-	public $socid;		// both socid and fk_soc are used
168
-	public $fk_soc;		// both socid and fk_soc are used
167
+	public $socid; // both socid and fk_soc are used
168
+	public $fk_soc; // both socid and fk_soc are used
169 169
 
170 170
 	/**
171 171
 	 * @var int Status
@@ -473,29 +473,29 @@  discard block
 block discarded – undo
473 473
 					if (preg_match('/^integer/', $type)) {
474 474
 						if (is_int($value)) {
475 475
 							// single value
476
-							$sqlwhere[] = $key . " = " . intval($value);
476
+							$sqlwhere[] = $key." = ".intval($value);
477 477
 						} elseif (is_array($value)) {
478 478
 							if (empty($value)) continue;
479
-							$sqlwhere[] = $key . ' IN (' . $this->db->sanitize(implode(',', array_map('intval', $value))) . ')';
479
+							$sqlwhere[] = $key.' IN ('.$this->db->sanitize(implode(',', array_map('intval', $value))).')';
480 480
 						}
481 481
 						continue;
482 482
 					} elseif (in_array($type, array('date', 'datetime', 'timestamp'))) {
483
-						$sqlwhere[] = $key . " = '" . $this->db->idate($value) . "'";
483
+						$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
484 484
 						continue;
485 485
 					}
486 486
 				}
487 487
 
488 488
 				// when the $key doesn't fall into the previously handled categories, we do as if the column were a varchar/text
489 489
 				if (is_array($value) && count($value)) {
490
-					$value = implode(',', array_map(function ($v) {
491
-						return "'" . $this->db->sanitize($this->db->escape($v)) . "'";
490
+					$value = implode(',', array_map(function($v) {
491
+						return "'".$this->db->sanitize($this->db->escape($v))."'";
492 492
 					}, $value));
493
-					$sqlwhere[] = $key . ' IN (' . $this->db->sanitize($value, true) . ')';
493
+					$sqlwhere[] = $key.' IN ('.$this->db->sanitize($value, true).')';
494 494
 				} elseif (is_scalar($value)) {
495 495
 					if (strpos($value, '%') === false) {
496
-						$sqlwhere[] = $key . " = '" . $this->db->sanitize($this->db->escape($value)) . "'";
496
+						$sqlwhere[] = $key." = '".$this->db->sanitize($this->db->escape($value))."'";
497 497
 					} else {
498
-						$sqlwhere[] = $key . " LIKE '%" . $this->db->escapeforlike($this->db->escape($value)) . "%'";
498
+						$sqlwhere[] = $key." LIKE '%".$this->db->escapeforlike($this->db->escape($value))."%'";
499 499
 					}
500 500
 				}
501 501
 			}
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 				$label = $langs->trans("ShowMyObject");
867 867
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
868 868
 			}
869
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
869
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
870 870
 			$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
871 871
 		} else {
872 872
 			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 				$this->date_creation     = $this->db->jdate($obj->datec);
1080 1080
 				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
1081 1081
 				if (!empty($obj->datev)) {
1082
-					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
1082
+					$this->date_validation = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
1083 1083
 				}
1084 1084
 			}
1085 1085
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -475,7 +475,9 @@
 block discarded – undo
475 475
 							// single value
476 476
 							$sqlwhere[] = $key . " = " . intval($value);
477 477
 						} elseif (is_array($value)) {
478
-							if (empty($value)) continue;
478
+							if (empty($value)) {
479
+								continue;
480
+							}
479 481
 							$sqlwhere[] = $key . ' IN (' . $this->db->sanitize(implode(',', array_map('intval', $value))) . ')';
480 482
 						}
481 483
 						continue;
Please login to merge, or discard this patch.
htdocs/salaries/virement_request.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 	print "</td></tr>";
275 275
 } else {
276 276
 	print "<tr>";
277
-	print '<td class="titlefield">' . $langs->trans("DateStartPeriod") . '</td><td>';
277
+	print '<td class="titlefield">'.$langs->trans("DateStartPeriod").'</td><td>';
278 278
 	print dol_print_date($object->datesp, 'day');
279 279
 	print '</td></tr>';
280 280
 }
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 	print "</td></tr>";
286 286
 } else {
287 287
 	print "<tr>";
288
-	print '<td>' . $langs->trans("DateEndPeriod") . '</td><td>';
288
+	print '<td>'.$langs->trans("DateEndPeriod").'</td><td>';
289 289
 	print dol_print_date($object->dateep, 'day');
290 290
 	print '</td></tr>';
291 291
 }
292 292
 if ($action == 'edit') {
293
-	print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>';
293
+	print '<tr><td class="fieldrequired">'.$langs->trans("Amount").'</td><td><input name="amount" size="10" value="'.price($object->amount).'"></td></tr>';
294 294
 } else {
295
-	print '<tr><td>' . $langs->trans("Amount") . '</td><td><span class="amount">' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '</span></td></tr>';
295
+	print '<tr><td>'.$langs->trans("Amount").'</td><td><span class="amount">'.price($object->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span></td></tr>';
296 296
 }
297 297
 
298 298
 // Default mode of payment
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -300,8 +300,9 @@  discard block
 block discarded – undo
300 300
 print '<table class="nobordernopadding" width="100%"><tr><td>';
301 301
 print $langs->trans('DefaultPaymentMode');
302 302
 print '</td>';
303
-if ($action != 'editmode')
303
+if ($action != 'editmode') {
304 304
 	print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'), 1).'</a></td>';
305
+}
305 306
 print '</tr></table>';
306 307
 print '</td><td>';
307 308
 
@@ -406,8 +407,9 @@  discard block
 block discarded – undo
406 407
 				}
407 408
 
408 409
 				print '<td class="right">';
409
-				if ($bankaccountstatic->id)
410
-					print $bankaccountstatic->getNomUrl(1, 'transactions');
410
+				if ($bankaccountstatic->id) {
411
+									print $bankaccountstatic->getNomUrl(1, 'transactions');
412
+				}
411 413
 				print '</td>';
412 414
 			}
413 415
 			print '<td class="right nowrap amountcard">'.price($objp->amount)."</td>\n";
Please login to merge, or discard this patch.
htdocs/product/card.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 $refalreadyexists = 0;
96 96
 
97 97
 // Get parameters
98
-$id  = GETPOST('id', 'int');
98
+$id = GETPOST('id', 'int');
99 99
 if (!empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS)) {
100 100
 	$ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null);
101 101
 } else {
@@ -507,11 +507,11 @@  discard block
 block discarded – undo
507 507
 		if (!$error) {
508 508
 			$units = GETPOST('units', 'int');
509 509
 
510
-			$object->entity				= $conf->entity;
511
-			$object->ref				= $ref;
512
-			$object->label				= GETPOST('label', $label_security_check);
513
-			$object->price_base_type	= GETPOST('price_base_type', 'aZ09');
514
-			$object->mandatory_period	= !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
510
+			$object->entity = $conf->entity;
511
+			$object->ref = $ref;
512
+			$object->label = GETPOST('label', $label_security_check);
513
+			$object->price_base_type = GETPOST('price_base_type', 'aZ09');
514
+			$object->mandatory_period = !empty(GETPOST("mandatoryperiod", 'alpha')) ? 1 : 0;
515 515
 			if ($object->price_base_type == 'TTC') {
516 516
 				$object->price_ttc = GETPOST('price');
517 517
 			} else {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 			$object->duration_value     	 = $duration_value;
596 596
 			$object->duration_unit      	 = $duration_unit;
597 597
 			$object->fk_default_warehouse	 = GETPOST('fk_default_warehouse', 'int');
598
-			$object->fk_default_workstation	 = GETPOST('fk_default_workstation', 'int');
598
+			$object->fk_default_workstation = GETPOST('fk_default_workstation', 'int');
599 599
 			$object->seuil_stock_alerte 	 = GETPOST('seuil_stock_alerte') ?GETPOST('seuil_stock_alerte') : 0;
600 600
 			$object->desiredstock          = GETPOST('desiredstock') ?GETPOST('desiredstock') : 0;
601 601
 			$object->canvas             	 = GETPOST('canvas');
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 				$object->oldcopy = clone $object;
742 742
 
743 743
 				if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) {
744
-					$object->ref                = $ref;
744
+					$object->ref = $ref;
745 745
 				}
746 746
 				$object->label                  = GETPOST('label', $label_security_check);
747 747
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 				$object->status_batch = GETPOST('status_batch', 'aZ09');
764 764
 				$object->batch_mask = GETPOST('batch_mask', 'alpha');
765 765
 				$object->fk_default_warehouse   = GETPOST('fk_default_warehouse', 'int');
766
-				$object->fk_default_workstation   = GETPOST('fk_default_workstation', 'int');
766
+				$object->fk_default_workstation = GETPOST('fk_default_workstation', 'int');
767 767
 				// removed from update view so GETPOST always empty
768 768
 				/*
769 769
 				$object->seuil_stock_alerte     = GETPOST('seuil_stock_alerte');
@@ -862,7 +862,7 @@  discard block
 block discarded – undo
862 862
 					$object->accountancy_code_buy_export = $accountancy_code_buy_export;
863 863
 				}
864 864
 				if ($object->isService()) {
865
-					$object->mandatory_period =  (!empty($checkmandatory)) ? 1 : 0 ;
865
+					$object->mandatory_period = (!empty($checkmandatory)) ? 1 : 0;
866 866
 				}
867 867
 
868 868
 
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 							$action = "";
961 961
 
962 962
 							$mesg = $langs->trans("ErrorProductAlreadyExists", $clone->ref);
963
-							$mesg .= ' <a href="' . $_SERVER["PHP_SELF"] . '?ref=' . $clone->ref . '">' . $langs->trans("ShowCardHere") . '</a>.';
963
+							$mesg .= ' <a href="'.$_SERVER["PHP_SELF"].'?ref='.$clone->ref.'">'.$langs->trans("ShowCardHere").'</a>.';
964 964
 							setEventMessages($mesg, null, 'errors');
965 965
 						} else {
966 966
 							if (count($clone->errors)) {
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 					} else {
982 982
 						$db->commit();
983 983
 						$db->close();
984
-						header("Location: " . $_SERVER["PHP_SELF"] . "?id=" . $id);
984
+						header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
985 985
 						exit;
986 986
 					}
987 987
 				} else {
@@ -1459,12 +1459,12 @@  discard block
 block discarded – undo
1459 1459
 			if ($showbarcode) {
1460 1460
 				print '<tr><td>'.$langs->trans('BarcodeType').'</td><td>';
1461 1461
 				if (GETPOSTISSET('fk_barcode_type')) {
1462
-					$fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0;
1462
+					$fk_barcode_type = GETPOST('fk_barcode_type') ?GETPOST('fk_barcode_type') : 0;
1463 1463
 				} else {
1464 1464
 					if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) {
1465 1465
 						$fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE");
1466 1466
 					} else {
1467
-						$fk_barcode_type=0;
1467
+						$fk_barcode_type = 0;
1468 1468
 					}
1469 1469
 				}
1470 1470
 				require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
Please login to merge, or discard this patch.
htdocs/bookcal/calendar_card.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
 // Get parameters
86 86
 $id = GETPOST('id', 'int');
87 87
 $ref = GETPOST('ref', 'alpha');
88
-$lineid   = GETPOST('lineid', 'int');
88
+$lineid = GETPOST('lineid', 'int');
89 89
 
90 90
 $action = GETPOST('action', 'aZ09');
91 91
 $confirm = GETPOST('confirm', 'alpha');
92 92
 $cancel = GETPOST('cancel', 'aZ09');
93 93
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
94
-$backtopage = GETPOST('backtopage', 'alpha');					// if not set, a default page will be used
95
-$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');	// if not set, $backtopage will be used
94
+$backtopage = GETPOST('backtopage', 'alpha'); // if not set, a default page will be used
95
+$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // if not set, $backtopage will be used
96 96
 $backtopagejsfields = GETPOST('backtopagejsfields', 'alpha');
97 97
 $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
98 98
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
 	// Link to public page
426 426
 	print '<tr><td>Link</td>';
427
-	print '<td><a href="'. DOL_URL_ROOT.'/public/bookcal/index.php?id='.$object->id.'" target="_blank">Public page</a>';
427
+	print '<td><a href="'.DOL_URL_ROOT.'/public/bookcal/index.php?id='.$object->id.'" target="_blank">Public page</a>';
428 428
 	print '</td></tr>';
429 429
 
430 430
 	print '</table>';
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
 			// Clone
524 524
 			if ($permissiontoadd) {
525
-				print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
525
+				print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);
526 526
 			}
527 527
 
528 528
 			/*
Please login to merge, or discard this patch.
htdocs/bookcal/class/availabilities.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	/**
113 113
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
114 114
 	 */
115
-	public $fields=array(
115
+	public $fields = array(
116 116
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
117 117
 		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>20, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax150', 'cssview'=>'wordbreak', 'help'=>"BookcalLabelAvailabilityHelp", 'showoncombobox'=>'2', 'validate'=>'1',),
118 118
 		'fk_bookcal_calendar' => array('type'=>'integer:Calendar:bookcal/class/calendar.class.php:1', 'label'=>'Calendar', 'enabled'=>'1', 'position'=>25, 'notnull'=>1, 'visible'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'csslist'=>'tdoverflowmax100'),
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 		if (!empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) {
1005 1005
 			$mybool = false;
1006 1006
 
1007
-			$file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON') . ".php";
1007
+			$file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON').".php";
1008 1008
 			$classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON;
1009 1009
 
1010 1010
 			// Include file with class
Please login to merge, or discard this patch.
htdocs/fourn/facture/list.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -582,16 +582,16 @@  discard block
 block discarded – undo
582 582
 	$sql .= " AND f.fk_cond_reglement = ".((int) $search_paymentcond);
583 583
 }
584 584
 if ($search_date_start) {
585
-	$sql .= " AND f.datef >= '" . $db->idate($search_date_start) . "'";
585
+	$sql .= " AND f.datef >= '".$db->idate($search_date_start)."'";
586 586
 }
587 587
 if ($search_date_end) {
588
-	$sql .= " AND f.datef <= '" . $db->idate($search_date_end) . "'";
588
+	$sql .= " AND f.datef <= '".$db->idate($search_date_end)."'";
589 589
 }
590 590
 if ($search_datelimit_start) {
591
-	$sql .= " AND f.date_lim_reglement >= '" . $db->idate($search_datelimit_start) . "'";
591
+	$sql .= " AND f.date_lim_reglement >= '".$db->idate($search_datelimit_start)."'";
592 592
 }
593 593
 if ($search_datelimit_end) {
594
-	$sql .= " AND f.date_lim_reglement <= '" . $db->idate($search_datelimit_end) . "'";
594
+	$sql .= " AND f.date_lim_reglement <= '".$db->idate($search_datelimit_end)."'";
595 595
 }
596 596
 if ($option == 'late') {
597 597
 	$sql .= " AND f.date_lim_reglement < '".$db->idate(dol_now() - $conf->facture->fournisseur->warning_delay)."'";
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 			if ($searchCategorySupplierOperator == 0) {
613 613
 				$searchCategorySupplierSqlList[] = " EXISTS (SELECT ck.fk_soc FROM ".MAIN_DB_PREFIX."categorie_fournisseur as ck WHERE s.rowid = ck.fk_soc AND ck.fk_categorie = ".((int) $searchCategorySupplier).")";
614 614
 			} else {
615
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategorySupplier);
615
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategorySupplier);
616 616
 			}
617 617
 		}
618 618
 	}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 			if ($searchCategoryProductOperator == 0) {
643 643
 				$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
644 644
 			} else {
645
-				$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
645
+				$listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct);
646 646
 			}
647 647
 		}
648 648
 	}
@@ -1457,11 +1457,11 @@  discard block
 block discarded – undo
1457 1457
 $totalarray = array();
1458 1458
 $totalarray['nbfield'] = 0;
1459 1459
 $totalarray['val'] = array();
1460
-$totalarray['val']['f.total_ht']=0;
1461
-$totalarray['val']['f.total_vat']=0;
1462
-$totalarray['val']['f.total_localtax1']=0;
1463
-$totalarray['val']['f.total_localtax1']=0;
1464
-$totalarray['val']['f.total_ttc']=0;
1460
+$totalarray['val']['f.total_ht'] = 0;
1461
+$totalarray['val']['f.total_vat'] = 0;
1462
+$totalarray['val']['f.total_localtax1'] = 0;
1463
+$totalarray['val']['f.total_localtax1'] = 0;
1464
+$totalarray['val']['f.total_ttc'] = 0;
1465 1465
 $imaxinloop = ($limit ? min($num, $limit) : $num);
1466 1466
 while ($i < $imaxinloop) {
1467 1467
 	$obj = $db->fetch_object($resql);
@@ -1839,7 +1839,7 @@  discard block
 block discarded – undo
1839 1839
 			$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
1840 1840
 			$nbLinks = Link::count($db, $facturestatic->element, $facturestatic->id);
1841 1841
 			$nbTotal = $nbFiles + $nbLinks;
1842
-			echo '<td class="center">'.(empty($nbTotal)? '':$nbTotal).'</td>';
1842
+			echo '<td class="center">'.(empty($nbTotal) ? '' : $nbTotal).'</td>';
1843 1843
 			if (!$i) {
1844 1844
 				$totalarray['nbfield']++;
1845 1845
 			}
Please login to merge, or discard this patch.
htdocs/fourn/facture/card.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 			$error++;
758 758
 		}
759 759
 
760
-		$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver');	// If we enter the 02 january, we need to save the 02 january for server
760
+		$dateinvoice = dol_mktime(0, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'), 'tzserver'); // If we enter the 02 january, we need to save the 02 january for server
761 761
 		$datedue = dol_mktime(0, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'), 'tzserver');
762 762
 		//var_dump($dateinvoice.' '.dol_print_date($dateinvoice, 'dayhour'));
763 763
 		//var_dump(dol_now('tzuserrel').' '.dol_get_last_hour(dol_now('tzuserrel')).' '.dol_print_date(dol_now('tzuserrel'),'dayhour').' '.dol_print_date(dol_get_last_hour(dol_now('tzuserrel')), 'dayhour'));
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 				$object->ref = GETPOST('ref', 'alphanohtml');
796 796
 				$object->ref_supplier = GETPOST('ref_supplier', 'alpha');
797 797
 				$object->socid = GETPOST('socid', 'int');
798
-				$object->libelle = GETPOST('label', 'alphanohtml');	// deprecated
798
+				$object->libelle = GETPOST('label', 'alphanohtml'); // deprecated
799 799
 				$object->label = GETPOST('label', 'alphanohtml');
800 800
 				$object->date = $dateinvoice;
801 801
 				$object->date_echeance = $datedue;
@@ -1033,28 +1033,28 @@  discard block
 block discarded – undo
1033 1033
 				$tmpproject = GETPOST('projectid', 'int');
1034 1034
 
1035 1035
 				// Creation invoice
1036
+				$object->socid = GETPOST('socid', 'int');
1037
+				$object->type = GETPOST('type', 'alphanohtml');
1038
+				$object->subtype = GETPOST('subtype', 'alphanohtml');
1039
+				$object->ref = GETPOST('ref', 'alphanohtml');
1040
+				$object->ref_supplier = GETPOST('ref_supplier', 'alphanohtml');
1036 1041
 				$object->socid				= GETPOST('socid', 'int');
1037
-				$object->type				= GETPOST('type', 'alphanohtml');
1038
-				$object->subtype            = GETPOST('subtype', 'alphanohtml');
1039
-				$object->ref				= GETPOST('ref', 'alphanohtml');
1040
-				$object->ref_supplier		= GETPOST('ref_supplier', 'alphanohtml');
1041
-				$object->socid				= GETPOST('socid', 'int');
1042
-				$object->libelle			= GETPOST('label', 'alphanohtml');	// deprecated
1042
+				$object->libelle = GETPOST('label', 'alphanohtml'); // deprecated
1043 1043
 				$object->label				= GETPOST('label', 'alphanohtml');
1044
-				$object->date				= $dateinvoice;
1045
-				$object->date_echeance		= $datedue;
1046
-				$object->note_public		= GETPOST('note_public', 'restricthtml');
1047
-				$object->note_private		= GETPOST('note_private', 'restricthtml');
1044
+				$object->date = $dateinvoice;
1045
+				$object->date_echeance = $datedue;
1046
+				$object->note_public = GETPOST('note_public', 'restricthtml');
1047
+				$object->note_private = GETPOST('note_private', 'restricthtml');
1048 1048
 				$object->cond_reglement_id	= GETPOST('cond_reglement_id');
1049 1049
 				$object->mode_reglement_id	= GETPOST('mode_reglement_id');
1050 1050
 				$object->fk_account			= GETPOST('fk_account', 'int');
1051 1051
 				$object->vat_reverse_charge	= GETPOST('vat_reverse_charge') == 'on' ? 1 : 0;
1052 1052
 				$object->fk_project			= ($tmpproject > 0) ? $tmpproject : null;
1053
-				$object->fk_incoterms		= GETPOST('incoterm_id', 'int');
1053
+				$object->fk_incoterms = GETPOST('incoterm_id', 'int');
1054 1054
 				$object->location_incoterms	= GETPOST('location_incoterms', 'alpha');
1055 1055
 				$object->multicurrency_code	= GETPOST('multicurrency_code', 'alpha');
1056
-				$object->multicurrency_tx	= GETPOST('originmulticurrency_tx', 'int');
1057
-				$object->transport_mode_id	= GETPOST('transport_mode_id');
1056
+				$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
1057
+				$object->transport_mode_id = GETPOST('transport_mode_id');
1058 1058
 
1059 1059
 				// Auto calculation of date due if not filled by user
1060 1060
 				if (empty($object->date_echeance)) {
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 		// Edit line
1394 1394
 		$db->begin();
1395 1395
 
1396
-		if (! $object->fetch($id) > 0) {
1396
+		if (!$object->fetch($id) > 0) {
1397 1397
 			dol_print_error($db);
1398 1398
 		}
1399 1399
 		$object->fetch_thirdparty();
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
 			$idprod = GETPOST('idprod', 'int');
1538 1538
 		}
1539 1539
 
1540
-		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);		// Can be '1.2' or '1.2 (CODE)'
1540
+		$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); // Can be '1.2' or '1.2 (CODE)'
1541 1541
 
1542 1542
 		$price_ht = price2num(GETPOST('price_ht'), 'MU', 2);
1543 1543
 		$price_ht_devise = price2num(GETPOST('multicurrency_price_ht'), 'CU', 2);
@@ -2221,7 +2221,7 @@  discard block
 block discarded – undo
2221 2221
 	print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
2222 2222
 	print '<input type="hidden" name="token" value="'.newToken().'">';
2223 2223
 	print '<input type="hidden" name="action" value="add">';
2224
-	print '<input type="hidden" name="changecompany" value="0">';	// will be set to 1 by javascript so we know post is done after a company change
2224
+	print '<input type="hidden" name="changecompany" value="0">'; // will be set to 1 by javascript so we know post is done after a company change
2225 2225
 
2226 2226
 	if (!empty($societe->id) && $societe->id > 0) {
2227 2227
 		print '<input type="hidden" name="socid" value="'.$societe->id.'">'."\n";
@@ -2305,7 +2305,7 @@  discard block
 block discarded – undo
2305 2305
 
2306 2306
 			$sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
2307 2307
 			$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_rec as r';
2308
-			$sql .= ' WHERE r.fk_soc = '. (int) $invoice_predefined->socid;
2308
+			$sql .= ' WHERE r.fk_soc = '.(int) $invoice_predefined->socid;
2309 2309
 
2310 2310
 			$resql = $db->query($sql);
2311 2311
 			if ($resql) {
@@ -2363,7 +2363,7 @@  discard block
 block discarded – undo
2363 2363
 
2364 2364
 		// Standard invoice
2365 2365
 		print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
2366
-		$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int')? '' : 'checked').'> ';
2366
+		$tmp = '<input type="radio" id="radio_standard" name="type" value="0"'.(GETPOST('type', 'int') ? '' : 'checked').'> ';
2367 2367
 		$desc = $form->textwithpicto($tmp.'<label for="radio_standard">'.$langs->trans("InvoiceStandardAsk").'</label>', $langs->transnoentities("InvoiceStandardDesc"), 1, 'help', '', 0, 3);
2368 2368
 		print $desc;
2369 2369
 		print '</div></div>';
@@ -2372,7 +2372,7 @@  discard block
 block discarded – undo
2372 2372
 			// Deposit - Down payment
2373 2373
 			if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
2374 2374
 				print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
2375
-				$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> ';
2375
+				$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> ';
2376 2376
 				print '<script type="text/javascript">
2377 2377
 				jQuery(document).ready(function() {
2378 2378
 					jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() {
@@ -2418,7 +2418,7 @@  discard block
 block discarded – undo
2418 2418
 					print $form->selectarray('typedeposit', $arraylist, GETPOST('typedeposit', 'aZ09'), 0, 0, 0, '', 1);
2419 2419
 					print '</td>';
2420 2420
 					print '<td class="nowrap" style="padding-left: 5px">';
2421
-					print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="' . GETPOST('valuedeposit', 'int') . '"/>';
2421
+					print '<span class="opacitymedium paddingleft">'.$langs->trans("AmountOrPercent").'</span><input type="text" id="valuedeposit" name="valuedeposit" class="width75 right" value="'.GETPOST('valuedeposit', 'int').'"/>';
2422 2422
 					print '</td>';
2423 2423
 				}
2424 2424
 				print '</tr></table>';
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 				if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) {
2574 2574
 					$tmp = '<input type="radio" name="type" id="radio_creditnote" value="0" disabled> ';
2575 2575
 				} else {
2576
-					$tmp='<input type="radio" name="type" id="radio_creditnote" value="2"> ';
2576
+					$tmp = '<input type="radio" name="type" id="radio_creditnote" value="2"> ';
2577 2577
 				}
2578 2578
 				$text = $tmp.$langs->trans("InvoiceAvoir").' ';
2579 2579
 				$text .= '<span class="opacitymedium">('.$langs->trans("YouMustCreateInvoiceFromSupplierThird").')</span> ';
@@ -2666,8 +2666,8 @@  discard block
 block discarded – undo
2666 2666
 
2667 2667
 		// Vat reverse-charge by default
2668 2668
 		if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
2669
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
2670
-			print '<tr><td>' . $langs->trans('VATReverseCharge') . '</td><td>';
2669
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
2670
+			print '<tr><td>'.$langs->trans('VATReverseCharge').'</td><td>';
2671 2671
 			// Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed
2672 2672
 			if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) {
2673 2673
 				$vat_reverse_charge = 1;
@@ -2675,7 +2675,7 @@  discard block
 block discarded – undo
2675 2675
 				$vat_reverse_charge = 0;
2676 2676
 			}
2677 2677
 
2678
-			print '<input type="checkbox" name="vat_reverse_charge"'. (!empty($vat_reverse_charge) ? ' checked ' : '') . '>';
2678
+			print '<input type="checkbox" name="vat_reverse_charge"'.(!empty($vat_reverse_charge) ? ' checked ' : '').'>';
2679 2679
 			print '</td></tr>';
2680 2680
 		}
2681 2681
 
@@ -3236,7 +3236,7 @@  discard block
 block discarded – undo
3236 3236
 					$facavoir->fetch($id);
3237 3237
 					$invoicecredits[] = $facavoir->getNomUrl(1);
3238 3238
 				}
3239
-				print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir") . (count($invoicecredits) ? ' ' : '') . implode(',', $invoicecredits);
3239
+				print ' <span class="opacitymediumbycolor paddingleft">'.$langs->transnoentities("InvoiceHasAvoir").(count($invoicecredits) ? ' ' : '').implode(',', $invoicecredits);
3240 3240
 				print '</span>';
3241 3241
 			}
3242 3242
 			if (isset($objectidnext) && $objectidnext > 0) {
@@ -3432,12 +3432,12 @@  discard block
 block discarded – undo
3432 3432
 					print '<input type="hidden" name="action" value="setvatreversecharge">';
3433 3433
 					print '<input type="hidden" name="token" value="'.newToken().'">';
3434 3434
 
3435
-					print '<input type="checkbox" name="vat_reverse_charge"' . ($object->vat_reverse_charge == '1' ? ' checked ' : '') . '>';
3435
+					print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').'>';
3436 3436
 
3437 3437
 					print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
3438 3438
 					print '</form>';
3439 3439
 				} else {
3440
-					print '<input type="checkbox" name="vat_reverse_charge"'. ($object->vat_reverse_charge == '1' ? ' checked ' : '') . ' disabled>';
3440
+					print '<input type="checkbox" name="vat_reverse_charge"'.($object->vat_reverse_charge == '1' ? ' checked ' : '').' disabled>';
3441 3441
 				}
3442 3442
 				print '</td></tr>';
3443 3443
 			}
@@ -3498,15 +3498,15 @@  discard block
 block discarded – undo
3498 3498
 			print '<table class="border tableforfield centpercent">';
3499 3499
 
3500 3500
 			print '<tr>';
3501
-			print '<td class="titlefieldmiddle">' . $langs->trans('AmountHT') . '</td>';
3502
-			print '<td class="nowrap amountcard right">' . price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
3501
+			print '<td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
3502
+			print '<td class="nowrap amountcard right">'.price($object->total_ht, '', $langs, 0, -1, -1, $conf->currency).'</td>';
3503 3503
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3504
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3504
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ht, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3505 3505
 			}
3506 3506
 			print '</tr>';
3507 3507
 
3508 3508
 			print '<tr>';
3509
-			print '<td>' . $langs->trans('AmountVAT') . '</td>';
3509
+			print '<td>'.$langs->trans('AmountVAT').'</td>';
3510 3510
 			print '<td class="nowrap amountcard right">';
3511 3511
 			if (GETPOST('calculationrule')) {
3512 3512
 				$calculationrule = GETPOST('calculationrule', 'alpha');
@@ -3520,40 +3520,40 @@  discard block
 block discarded – undo
3520 3520
 			}
3521 3521
 			// Show link for "recalculate"
3522 3522
 			if ($object->getVentilExportCompta() == 0) {
3523
-				$s = '<span class="hideonsmartphone opacitymedium">' . $langs->trans("ReCalculate") . ' </span>';
3524
-				$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=totalofround">' . $langs->trans("Mode1") . '</a>';
3523
+				$s = '<span class="hideonsmartphone opacitymedium">'.$langs->trans("ReCalculate").' </span>';
3524
+				$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=totalofround">'.$langs->trans("Mode1").'</a>';
3525 3525
 				$s .= ' / ';
3526
-				$s .= '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=calculate&calculationrule=roundoftotal">' . $langs->trans("Mode2") . '</a>';
3526
+				$s .= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=calculate&calculationrule=roundoftotal">'.$langs->trans("Mode2").'</a>';
3527 3527
 				print '<div class="inline-block">';
3528
-				print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum) . '<br>' . $langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
3528
+				print $form->textwithtooltip($s, $langs->trans("CalculationRuleDesc", $calculationrulenum).'<br>'.$langs->trans("CalculationRuleDescSupplier"), 2, 1, img_picto('', 'help'), '', 3, '', 0, 'recalculate');
3529 3529
 				print '&nbsp; &nbsp; &nbsp; &nbsp;';
3530 3530
 				print '</div>';
3531 3531
 			}
3532 3532
 			print price($object->total_tva, 1, $langs, 0, -1, -1, $conf->currency);
3533 3533
 			print '</td>';
3534 3534
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3535
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3535
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_tva, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3536 3536
 			}
3537 3537
 			print '</tr>';
3538 3538
 
3539 3539
 			if ($societe->localtax1_assuj == "1") { //Localtax1
3540 3540
 				print '<tr>';
3541
-				print '<td>' . $langs->transcountry("AmountLT1", $societe->country_code) . '</td>';
3542
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';
3541
+				print '<td>'.$langs->transcountry("AmountLT1", $societe->country_code).'</td>';
3542
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax1, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
3543 3543
 				print '</tr>';
3544 3544
 			}
3545 3545
 			if ($societe->localtax2_assuj == "1") { //Localtax2
3546 3546
 				print '<tr>';
3547
-				print '<td>' . $langs->transcountry("AmountLT2", $societe->country_code) . '</td>';
3548
-				print '<td class="nowrap amountcard right">' . price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency) . '</td>';
3547
+				print '<td>'.$langs->transcountry("AmountLT2", $societe->country_code).'</td>';
3548
+				print '<td class="nowrap amountcard right">'.price($object->total_localtax2, 1, $langs, 0, -1, -1, $conf->currency).'</td>';
3549 3549
 				print '</tr>';
3550 3550
 			}
3551 3551
 
3552 3552
 			print '<tr>';
3553
-			print '<td>' . $langs->trans('AmountTTC') . '</td>';
3554
-			print '<td class="nowrap amountcard right">' . price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency) . '</td>';
3553
+			print '<td>'.$langs->trans('AmountTTC').'</td>';
3554
+			print '<td class="nowrap amountcard right">'.price($object->total_ttc, '', $langs, 0, -1, -1, $conf->currency).'</td>';
3555 3555
 			if (isModEnabled("multicurrency") && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) {
3556
-				print '<td class="nowrap amountcard right">' . price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code) . '</td>';
3556
+				print '<td class="nowrap amountcard right">'.price($object->multicurrency_total_ttc, '', $langs, 0, -1, -1, $object->multicurrency_code).'</td>';
3557 3557
 			}
3558 3558
 			print '</tr>';
3559 3559
 
@@ -3859,7 +3859,7 @@  discard block
 block discarded – undo
3859 3859
 					print '<tr><td colspan="'.$nbcols.'" class="right">';
3860 3860
 					print '<span class="opacitymedium">';
3861 3861
 					print $langs->trans('RemainderToPayBackMulticurrency');
3862
-					if ($resteapayeraffiche> 0) {
3862
+					if ($resteapayeraffiche > 0) {
3863 3863
 						print ' ('.$langs->trans('NegativeIfExcessRefunded').')';
3864 3864
 					}
3865 3865
 					print '</span>';
@@ -4089,7 +4089,7 @@  discard block
 block discarded – undo
4089 4089
 				}
4090 4090
 
4091 4091
 				// Clone as predefined / Create template
4092
-				if (($object->type ==  FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) {
4092
+				if (($object->type == FactureFournisseur::TYPE_STANDARD || $object->type == FactureFournisseur::TYPE_DEPOSIT) && $object->statut == 0 && $usercancreate) {
4093 4093
 					if (!$objectidnext && count($object->lines) > 0) {
4094 4094
 						print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card-rec.php?facid='.$object->id.'&amp;action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
4095 4095
 					}
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3936,9 +3936,12 @@
 block discarded – undo
3936 3936
 
3937 3937
 					$parameters = array();
3938 3938
 					$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
3939
-					if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
3940
-					if (empty($reshook))
3941
-						$object->formAddObjectLine(1, $societe, $mysoc);
3939
+					if ($reshook < 0) {
3940
+						setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
3941
+					}
3942
+					if (empty($reshook)) {
3943
+											$object->formAddObjectLine(1, $societe, $mysoc);
3944
+					}
3942 3945
 				}
3943 3946
 			}
3944 3947
 
Please login to merge, or discard this patch.
htdocs/contrat/class/contrat.class.php 2 patches
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 		if (!empty($conf->global->CONTRACT_ADDON)) {
296 296
 			$mybool = false;
297 297
 
298
-			$file = getDolGlobalString('CONTRACT_ADDON') . ".php";
298
+			$file = getDolGlobalString('CONTRACT_ADDON').".php";
299 299
 			$classname = $conf->global->CONTRACT_ADDON;
300 300
 
301 301
 			// Include file with class
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 			if ($contratline->statut != ContratLigne::STATUS_OPEN) {
405 405
 				$contratline->context = $this->context;
406 406
 
407
-				$result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment);	// This call trigger LINECONTRACT_ACTIVATE
407
+				$result = $contratline->active_line($user, $date_start, !empty($date_end) ? $date_end : -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
408 408
 				if ($result < 0) {
409 409
 					$error++;
410 410
 					$this->error = $contratline->error;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			// Close lines not already closed
455 455
 			if ($contratline->statut != ContratLigne::STATUS_CLOSED) {
456 456
 				$contratline->date_end_real = $now;
457
-				$contratline->date_cloture = $now;	// For backward compatibility
457
+				$contratline->date_cloture = $now; // For backward compatibility
458 458
 				$contratline->user_closing_id = $user->id;
459 459
 				$contratline->statut = ContratLigne::STATUS_CLOSED;
460 460
 				$result = $contratline->close_line($user, $now, $comment, $notrigger);
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 			if (!$error) {
592 592
 				$this->ref = $num;
593 593
 				$this->status = self::STATUS_VALIDATED;
594
-				$this->statut = self::STATUS_VALIDATED;	// deprecated
594
+				$this->statut = self::STATUS_VALIDATED; // deprecated
595 595
 				$this->date_validation = $now;
596 596
 			}
597 597
 		} else {
@@ -861,10 +861,10 @@  discard block
 block discarded – undo
861 861
 				$line->localtax2_tx		= $objp->localtax2_tx;
862 862
 				$line->localtax1_type	= $objp->localtax1_type;
863 863
 				$line->localtax2_type	= $objp->localtax2_type;
864
-				$line->subprice			= $objp->subprice;
864
+				$line->subprice = $objp->subprice;
865 865
 				$line->statut = $objp->status;
866 866
 				$line->status = $objp->status;
867
-				$line->remise_percent	= $objp->remise_percent;
867
+				$line->remise_percent = $objp->remise_percent;
868 868
 				$line->price_ht			= $objp->price_ht;
869 869
 				$line->price = $objp->price_ht; // For backward compatibility
870 870
 				$line->total_ht			= $objp->total_ht;
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 				//$line->date_fin_prevue   = $this->db->jdate($objp->date_fin_validite);
908 908
 				//$line->date_fin_reel     = $this->db->jdate($objp->date_cloture);
909 909
 
910
-				$line->rang     = $objp->rang;
910
+				$line->rang = $objp->rang;
911 911
 
912 912
 				// Retrieve all extrafields for contract line
913 913
 				// fetch optionals attributes and labels
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 		}
1419 1419
 
1420 1420
 		if (!$error) {
1421
-			$result = $this->insertExtraFields();	// This delete and reinsert extrafields
1421
+			$result = $this->insertExtraFields(); // This delete and reinsert extrafields
1422 1422
 			if ($result < 0) {
1423 1423
 				$error++;
1424 1424
 			}
@@ -2054,7 +2054,7 @@  discard block
 block discarded – undo
2054 2054
 				}
2055 2055
 				$datas['customer'] = '<br><b>'.$langs->trans('Customer').':</b> '.$this->thirdparty->getNomUrl(1, '', 0, 1);
2056 2056
 			}
2057
-			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '. $this->ref_customer;
2057
+			$datas['refcustomer'] = '<br><b>'.$langs->trans('RefCustomer').':</b> '.$this->ref_customer;
2058 2058
 			if (!$nofetch) {
2059 2059
 				$langs->load('project');
2060 2060
 				if (empty($this->project)) {
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 				$label = $langs->trans("ShowContract");
2128 2128
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
2129 2129
 			}
2130
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
2130
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
2131 2131
 			$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
2132 2132
 		}
2133 2133
 		$linkstart = '<a href="'.$url.'"';
@@ -2523,7 +2523,7 @@  discard block
 block discarded – undo
2523 2523
 		global $user;
2524 2524
 
2525 2525
 		$ticket = new Ticket($this->db);
2526
-		$nbTicket =  $ticket->fetchAll($user,  'ASC', 't.datec',  '', 0, '', array('t.fk_contract' => $this->id));
2526
+		$nbTicket = $ticket->fetchAll($user, 'ASC', 't.datec', '', 0, '', array('t.fk_contract' => $this->id));
2527 2527
 
2528 2528
 		return ($nbTicket < 0 ? $nbTicket : $ticket->lines);
2529 2529
 	}
@@ -2545,7 +2545,7 @@  discard block
 block discarded – undo
2545 2545
 		global $conf, $langs;
2546 2546
 
2547 2547
 		if (!dol_strlen($modele)) {
2548
-			$modele = '';	// No doc template/generation by default
2548
+			$modele = ''; // No doc template/generation by default
2549 2549
 
2550 2550
 			if (!empty($this->model_pdf)) {
2551 2551
 				$modele = $this->model_pdf;
@@ -2642,14 +2642,14 @@  discard block
 block discarded – undo
2642 2642
 			}
2643 2643
 		}
2644 2644
 
2645
-		if (empty($conf->global->CONTRACT_ADDON) || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').".php")) {
2645
+		if (empty($conf->global->CONTRACT_ADDON) || !is_readable(DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').".php")) {
2646 2646
 			$this->error = 'ErrorSetupNotComplete';
2647 2647
 			dol_syslog($this->error);
2648 2648
 			return -1;
2649 2649
 		}
2650 2650
 
2651 2651
 		// Set ref
2652
-		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/" . getDolGlobalString('CONTRACT_ADDON').'.php';
2652
+		require_once DOL_DOCUMENT_ROOT."/core/modules/contract/".getDolGlobalString('CONTRACT_ADDON').'.php';
2653 2653
 		$obj = $conf->global->CONTRACT_ADDON;
2654 2654
 		$modContract = new $obj();
2655 2655
 		$clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj);
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
 
2737 2737
 		$error = 0;
2738 2738
 		$this->output = '';
2739
-		$this->error='';
2739
+		$this->error = '';
2740 2740
 
2741 2741
 		$contractlineprocessed = array();
2742 2742
 		$contractignored = array();
@@ -2745,12 +2745,12 @@  discard block
 block discarded – undo
2745 2745
 		dol_syslog(__METHOD__, LOG_DEBUG);
2746 2746
 
2747 2747
 		$sql = 'SELECT c.rowid, c.ref_customer, cd.rowid as lid, cd.date_fin_validite, p.duration';
2748
-		$sql.= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd';
2749
-		$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product';
2750
-		$sql.= ' WHERE cd.fk_contrat = c.rowid';
2751
-		$sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')";
2752
-		$sql.= " AND cd.statut = 4";
2753
-		if ($thirdparty_id > 0) $sql.=" AND c.fk_soc = ".((int) $thirdparty_id);
2748
+		$sql .= ' FROM '.MAIN_DB_PREFIX.'contrat as c, '.MAIN_DB_PREFIX.'contratdet as cd';
2749
+		$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON p.rowid = cd.fk_product';
2750
+		$sql .= ' WHERE cd.fk_contrat = c.rowid';
2751
+		$sql .= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')";
2752
+		$sql .= " AND cd.statut = 4";
2753
+		if ($thirdparty_id > 0) $sql .= " AND c.fk_soc = ".((int) $thirdparty_id);
2754 2754
 		//print $sql;
2755 2755
 
2756 2756
 		$resql = $this->db->query($sql);
@@ -2759,7 +2759,7 @@  discard block
 block discarded – undo
2759 2759
 
2760 2760
 			include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
2761 2761
 
2762
-			$i=0;
2762
+			$i = 0;
2763 2763
 			while ($i < $num) {
2764 2764
 				$obj = $this->db->fetch_object($resql);
2765 2765
 				if ($obj) {
@@ -2769,7 +2769,7 @@  discard block
 block discarded – undo
2769 2769
 
2770 2770
 					// Load contract
2771 2771
 					$object = new Contrat($this->db);
2772
-					$object->fetch($obj->rowid);		// fetch also lines
2772
+					$object->fetch($obj->rowid); // fetch also lines
2773 2773
 					//$object->fetch_thirdparty();
2774 2774
 
2775 2775
 					if ($object->id <= 0) {
@@ -2796,9 +2796,9 @@  discard block
 block discarded – undo
2796 2796
 						usort($object->linkedObjects['facture'], array('Contrat', 'contractCmpDate'));
2797 2797
 						//dol_sort_array($object->linkedObjects['facture'], 'date');
2798 2798
 
2799
-						$someinvoicenotpaid=0;
2799
+						$someinvoicenotpaid = 0;
2800 2800
 						foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) {
2801
-							if ($invoice->statut == Facture::STATUS_DRAFT) continue;	// Draft invoice are not invoice not paid
2801
+							if ($invoice->statut == Facture::STATUS_DRAFT) continue; // Draft invoice are not invoice not paid
2802 2802
 
2803 2803
 							if (empty($invoice->paye)) {
2804 2804
 								$someinvoicenotpaid++;
@@ -2814,7 +2814,7 @@  discard block
 block discarded – undo
2814 2814
 					if ($expirationdate && $expirationdate < $enddatetoscan) {
2815 2815
 						dol_syslog("Define the newdate of end of services from expirationdate=".$expirationdate);
2816 2816
 						$newdate = $expirationdate;
2817
-						$protecti=0;	//$protecti is to avoid infinite loop
2817
+						$protecti = 0; //$protecti is to avoid infinite loop
2818 2818
 						while ($newdate < $enddatetoscan && $protecti < 1000) {
2819 2819
 							$newdate = dol_time_plus_duree($newdate, $duration_value, $duration_unit);
2820 2820
 							$protecti++;
@@ -2832,39 +2832,39 @@  discard block
 block discarded – undo
2832 2832
 							$comment = 'Renew date of contract '.$object->ref.' line '.$obj->lid.' by doAutoRenewContracts';
2833 2833
 
2834 2834
 							$sqlupdate = 'UPDATE '.MAIN_DB_PREFIX."contratdet SET date_fin_validite = '".$this->db->idate($newdate)."'";
2835
-							$sqlupdate.= ' WHERE rowid = '.((int) $obj->lid);
2835
+							$sqlupdate .= ' WHERE rowid = '.((int) $obj->lid);
2836 2836
 							$resqlupdate = $this->db->query($sqlupdate);
2837 2837
 							if ($resqlupdate) {
2838
-								$contractlineprocessed[$obj->lid]=$object->ref;
2838
+								$contractlineprocessed[$obj->lid] = $object->ref;
2839 2839
 
2840 2840
 								$actioncode = 'RENEW_CONTRACT';
2841 2841
 								$now = dol_now();
2842 2842
 
2843 2843
 								// Create an event
2844 2844
 								$actioncomm = new ActionComm($this->db);
2845
-								$actioncomm->type_code    = 'AC_OTH_AUTO';		// Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
2845
+								$actioncomm->type_code    = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
2846 2846
 								$actioncomm->code         = 'AC_'.$actioncode;
2847 2847
 								$actioncomm->label        = $label;
2848 2848
 								$actioncomm->datep        = $now;
2849 2849
 								$actioncomm->datef        = $now;
2850
-								$actioncomm->percentage   = -1;   // Not applicable
2850
+								$actioncomm->percentage   = -1; // Not applicable
2851 2851
 								$actioncomm->socid        = $object->socid;
2852
-								$actioncomm->authorid     = $user->id;   // User saving action
2853
-								$actioncomm->userownerid  = $user->id;	// Owner of action
2852
+								$actioncomm->authorid     = $user->id; // User saving action
2853
+								$actioncomm->userownerid  = $user->id; // Owner of action
2854 2854
 								$actioncomm->fk_element   = $object->id;
2855 2855
 								$actioncomm->elementtype  = 'contract';
2856 2856
 								$actioncomm->note_private = $comment;
2857 2857
 
2858
-								$ret = $actioncomm->create($user);       // User creating action
2858
+								$ret = $actioncomm->create($user); // User creating action
2859 2859
 							} else {
2860
-								$contracterror[$object->id]=$object->ref;
2860
+								$contracterror[$object->id] = $object->ref;
2861 2861
 
2862 2862
 								$error++;
2863 2863
 								$errorforlocaltransaction++;
2864 2864
 								$this->error = $this->db->lasterror();
2865 2865
 							}
2866 2866
 
2867
-							if (! $errorforlocaltransaction) {
2867
+							if (!$errorforlocaltransaction) {
2868 2868
 								$this->db->commit();
2869 2869
 							} else {
2870 2870
 								$this->db->rollback();
@@ -2883,9 +2883,9 @@  discard block
 block discarded – undo
2883 2883
 			$this->error = $this->db->lasterror();
2884 2884
 		}
2885 2885
 
2886
-		$this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed)>0 ? ' : '.join(',', $contractlineprocessed) : '');
2886
+		$this->output .= count($contractlineprocessed).' contract line(s) with end date before '.dol_print_date($enddatetoscan, 'day').' were renewed'.(count($contractlineprocessed) > 0 ? ' : '.join(',', $contractlineprocessed) : '');
2887 2887
 
2888
-		return ($error ? 1: 0);
2888
+		return ($error ? 1 : 0);
2889 2889
 	}
2890 2890
 
2891 2891
 	/**
@@ -3236,7 +3236,7 @@  discard block
 block discarded – undo
3236 3236
 		}
3237 3237
 
3238 3238
 		$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat.'"';
3239
-		$link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
3239
+		$link .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
3240 3240
 		$link .= $dataparams.' class="'.$classfortooltip.'">';
3241 3241
 		$linkend = '</a>';
3242 3242
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2750,7 +2750,9 @@  discard block
 block discarded – undo
2750 2750
 		$sql.= ' WHERE cd.fk_contrat = c.rowid';
2751 2751
 		$sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')";
2752 2752
 		$sql.= " AND cd.statut = 4";
2753
-		if ($thirdparty_id > 0) $sql.=" AND c.fk_soc = ".((int) $thirdparty_id);
2753
+		if ($thirdparty_id > 0) {
2754
+			$sql.=" AND c.fk_soc = ".((int) $thirdparty_id);
2755
+		}
2754 2756
 		//print $sql;
2755 2757
 
2756 2758
 		$resql = $this->db->query($sql);
@@ -2798,7 +2800,10 @@  discard block
 block discarded – undo
2798 2800
 
2799 2801
 						$someinvoicenotpaid=0;
2800 2802
 						foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) {
2801
-							if ($invoice->statut == Facture::STATUS_DRAFT) continue;	// Draft invoice are not invoice not paid
2803
+							if ($invoice->statut == Facture::STATUS_DRAFT) {
2804
+								continue;
2805
+							}
2806
+							// Draft invoice are not invoice not paid
2802 2807
 
2803 2808
 							if (empty($invoice->paye)) {
2804 2809
 								$someinvoicenotpaid++;
Please login to merge, or discard this patch.