Completed
Branch develop (d02c61)
by
unknown
18:56
created
htdocs/product/stock/stocktransfer/class/stocktransfer.class.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	/**
104 104
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
105 105
 	 */
106
-	public $fields=array(
106
+	public $fields = array(
107 107
 		'rowid'                    => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"),
108 108
 		'entity'                   => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>1, 'default'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'comment'=>"Id"),
109 109
 		'ref'                      => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	public function fetchLines()
353 353
 	{
354
-		require_once DOL_DOCUMENT_ROOT . '/product/stock/stocktransfer/class/stocktransferline.class.php';
354
+		require_once DOL_DOCUMENT_ROOT.'/product/stock/stocktransfer/class/stocktransferline.class.php';
355 355
 		$this->lines = array();
356 356
 
357 357
 		$result = $this->fetchLinesCommon();
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		if (empty($this->lines)) $this->fetchLines();
388 388
 		if (!empty($this->lines)) {
389
-			foreach ($this->lines as $l) $total_pmp+= ($l->pmp * $l->qty);
389
+			foreach ($this->lines as $l) $total_pmp += ($l->pmp * $l->qty);
390 390
 		}
391 391
 
392 392
 		return $total_pmp;
Please login to merge, or discard this patch.
Braces   +71 added lines, -25 removed lines patch added patch discarded remove patch
@@ -183,8 +183,12 @@  discard block
 block discarded – undo
183 183
 		$this->db = $db;
184 184
 		$this->origin_type = 'StockTransfer@product/stock/stocktransfer';
185 185
 
186
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
187
-		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
186
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
187
+			$this->fields['rowid']['visible'] = 0;
188
+		}
189
+		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
190
+			$this->fields['entity']['enabled'] = 0;
191
+		}
188 192
 
189 193
 		// Example to show how to set values of fields definition dynamically
190 194
 		/*if ($user->rights->stocktransfer->stocktransfer->read) {
@@ -221,10 +225,16 @@  discard block
 block discarded – undo
221 225
 	public function create(User $user, $notrigger = false)
222 226
 	{
223 227
 		$model_pdf = GETPOST('model');
224
-		if (!empty($model_pdf)) $this->model_pdf = $model_pdf;
228
+		if (!empty($model_pdf)) {
229
+			$this->model_pdf = $model_pdf;
230
+		}
225 231
 		$this->status = (int) $this->status;
226
-		if ($this->fk_warehouse_source <= 0) $this->fk_warehouse_source = 0;
227
-		if ($this->fk_warehouse_destination <= 0) $this->fk_warehouse_destination = 0;
232
+		if ($this->fk_warehouse_source <= 0) {
233
+			$this->fk_warehouse_source = 0;
234
+		}
235
+		if ($this->fk_warehouse_destination <= 0) {
236
+			$this->fk_warehouse_destination = 0;
237
+		}
228 238
 		return $this->createCommon($user, $notrigger);
229 239
 	}
230 240
 
@@ -248,7 +258,9 @@  discard block
 block discarded – undo
248 258
 
249 259
 		// Load source object
250 260
 		$result = $object->fetchCommon($fromid);
251
-		if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
261
+		if ($result > 0 && !empty($object->table_element_line)) {
262
+			$object->fetchLines();
263
+		}
252 264
 
253 265
 		// get lines so they will be clone
254 266
 		//foreach($this->lines as $line)
@@ -300,8 +312,9 @@  discard block
 block discarded – undo
300 312
 		if (!$error) {
301 313
 			// copy external contacts if same company
302 314
 			if (property_exists($this, 'socid') && $this->socid == $object->socid) {
303
-				if ($this->copy_linked_contact($object, 'external') < 0)
304
-					$error++;
315
+				if ($this->copy_linked_contact($object, 'external') < 0) {
316
+									$error++;
317
+				}
305 318
 			}
306 319
 		}
307 320
 
@@ -327,7 +340,9 @@  discard block
 block discarded – undo
327 340
 	public function fetch($id, $ref = null)
328 341
 	{
329 342
 		$result = $this->fetchCommon($id, $ref);
330
-		if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
343
+		if ($result > 0 && !empty($this->table_element_line)) {
344
+			$this->fetchLines();
345
+		}
331 346
 		return $result;
332 347
 	}
333 348
 
@@ -371,9 +386,13 @@  discard block
 block discarded – undo
371 386
 
372 387
 		$total_pmp = 0;
373 388
 
374
-		if (empty($this->lines)) $this->fetchLines();
389
+		if (empty($this->lines)) {
390
+			$this->fetchLines();
391
+		}
375 392
 		if (!empty($this->lines)) {
376
-			foreach ($this->lines as $l) $total_pmp+= ($l->pmp * $l->qty);
393
+			foreach ($this->lines as $l) {
394
+				$total_pmp+= ($l->pmp * $l->qty);
395
+			}
377 396
 		}
378 397
 
379 398
 		return $total_pmp;
@@ -401,8 +420,11 @@  discard block
 block discarded – undo
401 420
 		$sql = 'SELECT ';
402 421
 		$sql .= $this->getFieldList();
403 422
 		$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
404
-		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
405
-		else $sql .= ' WHERE 1 = 1';
423
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
424
+			$sql .= ' WHERE t.entity IN ('.getEntity($this->element).')';
425
+		} else {
426
+			$sql .= ' WHERE 1 = 1';
427
+		}
406 428
 		// Manage filter
407 429
 		$sqlwhere = array();
408 430
 		if (count($filter) > 0) {
@@ -465,8 +487,12 @@  discard block
 block discarded – undo
465 487
 	{
466 488
 		$this->tms = ''; // Will be done automatically because tms field is on update cascade
467 489
 		$res = $this->updateCommon($user, $notrigger);
468
-		if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) $this->fetch_thirdparty();
469
-		if (empty($this->socid) && empty($this->fk_soc)) unset($this->thirdparty);
490
+		if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) {
491
+			$this->fetch_thirdparty();
492
+		}
493
+		if (empty($this->socid) && empty($this->fk_soc)) {
494
+			unset($this->thirdparty);
495
+		}
470 496
 		return $res;
471 497
 	}
472 498
 
@@ -553,8 +579,12 @@  discard block
 block discarded – undo
553 579
 			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
554 580
 			$sql .= " SET ref = '".$this->db->escape($num)."',";
555 581
 			$sql .= " status = ".self::STATUS_VALIDATED;
556
-			if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',";
557
-			if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id);
582
+			if (!empty($this->fields['date_validation'])) {
583
+				$sql .= ", date_validation = '".$this->db->idate($now)."',";
584
+			}
585
+			if (!empty($this->fields['fk_user_valid'])) {
586
+				$sql .= ", fk_user_valid = ".((int) $user->id);
587
+			}
558 588
 			$sql .= " WHERE rowid = ".((int) $this->id);
559 589
 
560 590
 			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@@ -568,7 +598,9 @@  discard block
 block discarded – undo
568 598
 			if (!$error && !$notrigger) {
569 599
 				// Call trigger
570 600
 				$result = $this->call_trigger('STOCKTRANSFER_VALIDATE', $user);
571
-				if ($result < 0) $error++;
601
+				if ($result < 0) {
602
+					$error++;
603
+				}
572 604
 				// End call triggers
573 605
 			}
574 606
 		}
@@ -710,7 +742,10 @@  discard block
 block discarded – undo
710 742
 	{
711 743
 		global $conf, $langs, $hookmanager;
712 744
 
713
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
745
+		if (!empty($conf->dol_no_mouse_hover)) {
746
+			$notooltip = 1;
747
+		}
748
+		// Force disable tooltips
714 749
 
715 750
 		$result = '';
716 751
 
@@ -742,7 +777,9 @@  discard block
 block discarded – undo
742 777
 			}
743 778
 			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
744 779
 			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
745
-		} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
780
+		} else {
781
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
782
+		}
746 783
 
747 784
 		$linkstart = '<a href="'.$url.'"';
748 785
 		$linkstart .= $linkclose.'>';
@@ -751,7 +788,9 @@  discard block
 block discarded – undo
751 788
 		$result .= $linkstart;
752 789
 
753 790
 		if (empty($this->showphoto_on_popup)) {
754
-			if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
791
+			if ($withpicto) {
792
+				$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
793
+			}
755 794
 		} else {
756 795
 			if ($withpicto) {
757 796
 				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -777,7 +816,9 @@  discard block
 block discarded – undo
777 816
 			}
778 817
 		}
779 818
 
780
-		if ($withpicto != 2) $result .= $this->ref;
819
+		if ($withpicto != 2) {
820
+			$result .= $this->ref;
821
+		}
781 822
 
782 823
 		$result .= $linkend;
783 824
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@@ -786,8 +827,11 @@  discard block
 block discarded – undo
786 827
 		$hookmanager->initHooks(array('stocktransferdao'));
787 828
 		$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
788 829
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
789
-		if ($reshook > 0) $result = $hookmanager->resPrint;
790
-		else $result .= $hookmanager->resPrint;
830
+		if ($reshook > 0) {
831
+			$result = $hookmanager->resPrint;
832
+		} else {
833
+			$result .= $hookmanager->resPrint;
834
+		}
791 835
 
792 836
 		return $result;
793 837
 	}
@@ -829,7 +873,9 @@  discard block
 block discarded – undo
829 873
 
830 874
 		$statusType = 'status'.$status;
831 875
 		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
832
-		if ($status == self::STATUS_CLOSED) $statusType = 'status6';
876
+		if ($status == self::STATUS_CLOSED) {
877
+			$statusType = 'status6';
878
+		}
833 879
 
834 880
 		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
835 881
 	}
Please login to merge, or discard this patch.
htdocs/asset/depreciation.php 2 patches
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,11 +53,17 @@
 block discarded – undo
53 53
 }
54 54
 
55 55
 // Security check (enable the most restrictive one)
56
-if ($user->socid > 0) accessforbidden();
56
+if ($user->socid > 0) {
57
+	accessforbidden();
58
+}
57 59
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
58 60
 restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
59
-if (!isModEnabled('asset')) accessforbidden();
60
-if (!empty($object->not_depreciated)) accessforbidden();
61
+if (!isModEnabled('asset')) {
62
+	accessforbidden();
63
+}
64
+if (!empty($object->not_depreciated)) {
65
+	accessforbidden();
66
+}
61 67
 
62 68
 $object->asset_depreciation_options = &$assetdepreciationoptions;
63 69
 $result = $assetdepreciationoptions->fetchDeprecationOptions($object->id);
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
30 30
 
31 31
 // Load translation files required by the page
32 32
 $langs->loadLangs(array("assets", "companies"));
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 $extrafields->fetch_name_optionals_label($object->table_element);
49 49
 
50 50
 // Load object
51
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
51
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
52 52
 if ($id > 0 || !empty($ref)) {
53
-	$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
53
+	$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
54 54
 }
55 55
 
56 56
 // Security check (enable the most restrictive one)
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 	// Object card
100 100
 	// ------------------------------------------------------------
101
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
101
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
102 102
 
103 103
 	$morehtmlref = '<div class="refidno">';
104 104
 	$morehtmlref .= '</div>';
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 				print '<div class="fichecenter">';
135 135
 				print '<div class="fichehalfleft">';
136 136
 				print '<div class="underbanner clearboth"></div>';
137
-				print '<table class="border centpercent tableforfield">' . "\n";
138
-				print '<tr><td class="titlefield">' . $langs->trans('AssetBaseDepreciationHT') . '</td><td>' . price($depreciation_info['base_depreciation_ht']) . '</td></tr>';
139
-				print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationBeginDate') . '</td><td>' . dol_print_date($object->date_start > $object->date_acquisition ? $object->date_start : $object->date_acquisition, 'day') . '</td></tr>';
137
+				print '<table class="border centpercent tableforfield">'."\n";
138
+				print '<tr><td class="titlefield">'.$langs->trans('AssetBaseDepreciationHT').'</td><td>'.price($depreciation_info['base_depreciation_ht']).'</td></tr>';
139
+				print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationBeginDate').'</td><td>'.dol_print_date($object->date_start > $object->date_acquisition ? $object->date_start : $object->date_acquisition, 'day').'</td></tr>';
140 140
 				print '</table>';
141 141
 
142 142
 				// We close div and reopen for second column
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
 				print '<div class="underbanner clearboth"></div>';
147 147
 				print '<table class="border centpercent tableforfield">';
148
-				print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationDuration') . '</td><td>' . $depreciation_info['duration'] . ' ( ' . $depreciation_info['duration_type'] . ' )</td></tr>';
149
-				print '<tr><td class="titlefield">' . $langs->trans('AssetDepreciationRate') . '</td><td>' . $depreciation_info['rate'] . '</td></tr>';
148
+				print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationDuration').'</td><td>'.$depreciation_info['duration'].' ( '.$depreciation_info['duration_type'].' )</td></tr>';
149
+				print '<tr><td class="titlefield">'.$langs->trans('AssetDepreciationRate').'</td><td>'.$depreciation_info['rate'].'</td></tr>';
150 150
 				print '</table>';
151 151
 				print '</div>';
152 152
 				print '</div>';
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
 
161 161
 				print '<tr class="liste_titre">';
162 162
 				print '<td class="width20"></td>';
163
-				print '<td>' . $langs->trans("Ref") . '</td>';
164
-				print '<td class="center">' . $langs->trans("AssetDepreciationDate") . '</td>';
165
-				print '<td class="right">' . $langs->trans("AssetDepreciationHT") . '</td>';
166
-				print '<td class="right">' . $langs->trans("AssetCumulativeDepreciationHT") . '</td>';
167
-				print '<td class="right">' . $langs->trans("AssetResidualHT") . '</td>';
163
+				print '<td>'.$langs->trans("Ref").'</td>';
164
+				print '<td class="center">'.$langs->trans("AssetDepreciationDate").'</td>';
165
+				print '<td class="right">'.$langs->trans("AssetDepreciationHT").'</td>';
166
+				print '<td class="right">'.$langs->trans("AssetCumulativeDepreciationHT").'</td>';
167
+				print '<td class="right">'.$langs->trans("AssetResidualHT").'</td>';
168 168
 				print '</tr>';
169 169
 
170 170
 				if (empty($lines)) {
171
-					print '<tr><td class="impair center" colspan="6"><span class="opacitymedium">' . $langs->trans("None") . '</span></td></tr>';
171
+					print '<tr><td class="impair center" colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
172 172
 				} else {
173 173
 					foreach ($lines as $line) {
174 174
 						print '<tr class="oddeven">';
175
-						print '<td>' . ($line['bookkeeping'] ? $bookkeeping_icon : ($line['depreciation_date'] > $now ? $future_icon : '')) . '</td>';
176
-						print '<td >' . (empty($line['ref']) ? $langs->trans('AssetDepreciationReversal') : $line['ref']) . '</td>';
177
-						print '<td class="center">' . dol_print_date($line['depreciation_date'], 'day') . '</td>';
175
+						print '<td>'.($line['bookkeeping'] ? $bookkeeping_icon : ($line['depreciation_date'] > $now ? $future_icon : '')).'</td>';
176
+						print '<td >'.(empty($line['ref']) ? $langs->trans('AssetDepreciationReversal') : $line['ref']).'</td>';
177
+						print '<td class="center">'.dol_print_date($line['depreciation_date'], 'day').'</td>';
178 178
 						print '<td class="right">';
179 179
 						print price($line['depreciation_ht']);
180 180
 						print '</td>';
Please login to merge, or discard this patch.
htdocs/asset/card.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,12 +76,20 @@
 block discarded – undo
76 76
 $upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
77 77
 
78 78
 // Security check (enable the most restrictive one)
79
-if ($user->socid > 0) accessforbidden();
80
-if ($user->socid > 0) $socid = $user->socid;
79
+if ($user->socid > 0) {
80
+	accessforbidden();
81
+}
82
+if ($user->socid > 0) {
83
+	$socid = $user->socid;
84
+}
81 85
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
82 86
 restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
83
-if (!isModEnabled('asset')) accessforbidden();
84
-if (!$permissiontoread) accessforbidden();
87
+if (!isModEnabled('asset')) {
88
+	accessforbidden();
89
+}
90
+if (!$permissiontoread) {
91
+	accessforbidden();
92
+}
85 93
 
86 94
 
87 95
 /*
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	}
182 182
 	if (GETPOSTISSET('supplier_invoice_id')) {
183 183
 		$object->fields['supplier_invoice_id'] = array('type' => 'integer:FactureFournisseur:fourn/class/fournisseur.facture.class.php:1:entity IN (__SHARED_ENTITIES__)', 'label' => 'SupplierInvoice', 'enabled' => '1', 'noteditable' => '1', 'position' => 280, 'notnull' => 0, 'visible' => 1, 'index' => 1, 'validate' => '1',);
184
-		print '<input type="hidden" name="supplier_invoice_id" value="' . GETPOST('supplier_invoice_id', 'int') . '">';
184
+		print '<input type="hidden" name="supplier_invoice_id" value="'.GETPOST('supplier_invoice_id', 'int').'">';
185 185
 	}
186 186
 
187 187
 	print dol_get_fiche_head(array(), '');
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 			array('type' => 'checkbox', 'name' => 'disposal_depreciated', 'label' => $langs->trans("AssetDisposalDepreciated"), 'value' => $disposal_depreciated),
285 285
 			array('type' => 'checkbox', 'name' => 'disposal_subject_to_vat', 'label' => $langs->trans("AssetDisposalSubjectToVat"), 'value' => $disposal_subject_to_vat),
286 286
 		);
287
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref . ' - ' . $object->label), 'confirm_disposal', $formquestion, 'yes', 1);
287
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AssetDisposal'), $langs->trans('AssetConfirmDisposalAsk', $object->ref.' - '.$object->label), 'confirm_disposal', $formquestion, 'yes', 1);
288 288
 	} elseif ($action == 'reopen') {
289 289
 		// Re-open
290 290
 		// Create an array for form
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	print '<table class="border centpercent tableforfield">'."\n";
329 329
 
330 330
 	// Common attributes
331
-	$keyforbreak='date_acquisition';	// We change column just before this field
331
+	$keyforbreak = 'date_acquisition'; // We change column just before this field
332 332
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
333 333
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
334 334
 	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 	// Buttons for actions
348 348
 	if ($action != 'presend' && $action != 'editline') {
349
-		print '<div class="tabsAction">' . "\n";
349
+		print '<div class="tabsAction">'."\n";
350 350
 		$parameters = array();
351 351
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
352 352
 		if ($reshook < 0) {
@@ -356,26 +356,26 @@  discard block
 block discarded – undo
356 356
 		if (empty($reshook)) {
357 357
 			// Send
358 358
 			if (empty($user->socid)) {
359
-				print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
359
+				print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
360 360
 			}
361 361
 
362 362
 			if ($object->status == $object::STATUS_DRAFT) {
363
-				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
363
+				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
364 364
 			}
365 365
 
366 366
 			// Clone
367 367
 			//print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', false && $permissiontoadd);
368 368
 
369 369
 			if ($object->status == $object::STATUS_DRAFT) {
370
-				print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=disposal&token=' . newToken(), '', $permissiontoadd);
370
+				print dolGetButtonAction($langs->trans('AssetDisposal'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disposal&token='.newToken(), '', $permissiontoadd);
371 371
 			} else {
372
-				print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen&token=' . newToken(), '', $permissiontoadd);
372
+				print dolGetButtonAction($langs->trans('ReOpen'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd);
373 373
 			}
374 374
 
375 375
 			// Delete (need delete permission, or if draft, just need create/modify permission)
376
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
376
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
377 377
 		}
378
-		print '</div>' . "\n";
378
+		print '</div>'."\n";
379 379
 	}
380 380
 
381 381
 	// Select mail models is same action as presend
Please login to merge, or discard this patch.
htdocs/asset/model/card.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,12 +76,20 @@
 block discarded – undo
76 76
 $upload_dir = $conf->asset->multidir_output[isset($object->entity) ? $object->entity : 1];
77 77
 
78 78
 // Security check (enable the most restrictive one)
79
-if ($user->socid > 0) accessforbidden();
80
-if ($user->socid > 0) $socid = $user->socid;
79
+if ($user->socid > 0) {
80
+	accessforbidden();
81
+}
82
+if ($user->socid > 0) {
83
+	$socid = $user->socid;
84
+}
81 85
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
82 86
 restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
83
-if (!isModEnabled('asset')) accessforbidden();
84
-if (!$permissiontoread) accessforbidden();
87
+if (!isModEnabled('asset')) {
88
+	accessforbidden();
89
+}
90
+if (!$permissiontoread) {
91
+	accessforbidden();
92
+}
85 93
 
86 94
 
87 95
 /*
Please login to merge, or discard this patch.
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
30
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31 31
 
32 32
 // Load translation files required by the page
33 33
 $langs->loadLangs(array("assets", "other"));
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 // Initialize technical objects
46 46
 $object = new AssetModel($db);
47 47
 $extrafields = new ExtraFields($db);
48
-$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id;
48
+$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
49 49
 $hookmanager->initHooks(array('assetmodelcard', 'globalcard')); // Note that conf->hooks_modules contains array
50 50
 
51 51
 // Fetch optionals attributes and labels
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 $search_all = GETPOST("search_all", 'alpha');
58 58
 $search = array();
59 59
 foreach ($object->fields as $key => $val) {
60
-	if (GETPOST('search_' . $key, 'alpha')) {
61
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
60
+	if (GETPOST('search_'.$key, 'alpha')) {
61
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
62 62
 	}
63 63
 }
64 64
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 }
68 68
 
69 69
 // Load object
70
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
70
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
71 71
 
72 72
 $permissiontoread = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'read')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'read')));
73 73
 $permissiontoadd = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'write')) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 if (empty($reshook)) {
99 99
 	$error = 0;
100 100
 
101
-	$backurlforlist = DOL_URL_ROOT . '/asset/model/list.php';
101
+	$backurlforlist = DOL_URL_ROOT.'/asset/model/list.php';
102 102
 
103 103
 	if (empty($backtopage) || ($cancel && empty($id))) {
104 104
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
105 105
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
106 106
 				$backtopage = $backurlforlist;
107 107
 			} else {
108
-				$backtopage = DOL_URL_ROOT . '/asset/model/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
108
+				$backtopage = DOL_URL_ROOT.'/asset/model/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
109 109
 			}
110 110
 		}
111 111
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
124
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
124
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
125 125
 }
126 126
 
127 127
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 $form = new Form($db);
135 135
 $formfile = new FormFile($db);
136 136
 
137
-$title = $langs->trans("AssetModel") . ' - ' . $langs->trans("Card");
137
+$title = $langs->trans("AssetModel").' - '.$langs->trans("Card");
138 138
 $help_url = '';
139 139
 llxHeader('', $title, $help_url);
140 140
 
141 141
 // Part to create
142 142
 if ($action == 'create') {
143
-	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_' . $object->picto);
143
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_'.$object->picto);
144 144
 
145
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
146
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
145
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
146
+	print '<input type="hidden" name="token" value="'.newToken().'">';
147 147
 	print '<input type="hidden" name="action" value="add">';
148 148
 	if ($backtopage) {
149
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
149
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
150 150
 	}
151 151
 	if ($backtopageforcancel) {
152
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
152
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
153 153
 	}
154 154
 
155 155
 	print dol_get_fiche_head(array(), '');
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 	// Set some default values
158 158
 	//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
159 159
 
160
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
160
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
161 161
 
162 162
 	// Common attributes
163
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
163
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
164 164
 
165 165
 	// Other attributes
166
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
166
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
167 167
 
168
-	print '</table>' . "\n";
168
+	print '</table>'."\n";
169 169
 
170 170
 	print dol_get_fiche_end();
171 171
 
@@ -178,28 +178,28 @@  discard block
 block discarded – undo
178 178
 
179 179
 // Part to edit record
180 180
 if (($id || $ref) && $action == 'edit') {
181
-	print load_fiche_titre($langs->trans("AssetModel"), '', 'object_' . $object->picto);
181
+	print load_fiche_titre($langs->trans("AssetModel"), '', 'object_'.$object->picto);
182 182
 
183
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
184
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
183
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
184
+	print '<input type="hidden" name="token" value="'.newToken().'">';
185 185
 	print '<input type="hidden" name="action" value="update">';
186
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
186
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
187 187
 	if ($backtopage) {
188
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
188
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
189 189
 	}
190 190
 	if ($backtopageforcancel) {
191
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
191
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
192 192
 	}
193 193
 
194 194
 	print dol_get_fiche_head();
195 195
 
196
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
196
+	print '<table class="border centpercent tableforfieldedit">'."\n";
197 197
 
198 198
 	// Common attributes
199
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
199
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
200 200
 
201 201
 	// Other attributes
202
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
202
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
203 203
 
204 204
 	print '</table>';
205 205
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 
222 222
 	// Confirmation to delete
223 223
 	if ($action == 'delete') {
224
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
224
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
225 225
 	} elseif ($action == 'clone') {
226 226
 		// Clone confirmation
227 227
 		// Create an array for form
228 228
 		$formquestion = array();
229
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
229
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
230 230
 	}
231 231
 
232 232
 	// Call Hook formConfirm
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 	// Object card
246 246
 	// ------------------------------------------------------------
247
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
247
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
248 248
 
249 249
 	$morehtmlref = '<div class="refidno">';
250 250
 	$morehtmlref .= '</div>';
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 	print '<div class="fichecenter">';
257 257
 	print '<div class="fichehalfleft">';
258 258
 	print '<div class="underbanner clearboth"></div>';
259
-	print '<table class="border centpercent tableforfield">' . "\n";
259
+	print '<table class="border centpercent tableforfield">'."\n";
260 260
 
261 261
 	// Common attributes
262
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
262
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
263 263
 
264 264
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
265
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
265
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
266 266
 
267 267
 	print '</table>';
268 268
 	print '</div>';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 	// Buttons for actions
277 277
 	if ($action != 'editline') {
278
-		print '<div class="tabsAction">' . "\n";
278
+		print '<div class="tabsAction">'."\n";
279 279
 		$parameters = array();
280 280
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
281 281
 		if ($reshook < 0) {
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 
285 285
 		if (empty($reshook)) {
286 286
 			if ($object->status == $object::STATUS_DRAFT) {
287
-				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
287
+				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
288 288
 			}
289 289
 
290 290
 			// Back to draft
291 291
 			if ($object->status != $object::STATUS_DRAFT) {
292
-				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd);
292
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
293 293
 			}
294 294
 
295 295
 			if ($object->status != $object::STATUS_VALIDATED) {
296
-				print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=confirm_validate&confirm=yes&token=' . newToken(), '', $permissiontoadd);
296
+				print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
297 297
 			}
298 298
 
299 299
 			if ($object->status != $object::STATUS_CANCELED) {
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 
303 303
 			// Clone
304
-			print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($socid) ? '&socid=' . $socid : '') . '&action=clone&token=' . newToken(), '', $permissiontoadd);
304
+			print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($socid) ? '&socid='.$socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);
305 305
 
306 306
 			// Delete (need delete permission, or if draft, just need create/modify permission)
307
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
307
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
308 308
 		}
309
-		print '</div>' . "\n";
309
+		print '</div>'."\n";
310 310
 	}
311 311
 
312 312
 	print '<div class="fichecenter"><div class="fichehalfleft">';
Please login to merge, or discard this patch.
htdocs/asset/list.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -130,12 +130,20 @@
 block discarded – undo
130 130
 }
131 131
 
132 132
 // Security check (enable the most restrictive one)
133
-if ($user->socid > 0) accessforbidden();
134
-$socid = 0; if ($user->socid > 0) $socid = $user->socid;
133
+if ($user->socid > 0) {
134
+	accessforbidden();
135
+}
136
+$socid = 0; if ($user->socid > 0) {
137
+	$socid = $user->socid;
138
+}
135 139
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
136 140
 restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
137
-if (!isModEnabled('asset')) accessforbidden();
138
-if (!$permissiontoread) accessforbidden();
141
+if (!isModEnabled('asset')) {
142
+	accessforbidden();
143
+}
144
+if (!$permissiontoread) {
145
+	accessforbidden();
146
+}
139 147
 
140 148
 
141 149
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 $show_files		= GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
40 40
 $confirm		= GETPOST('confirm', 'alpha'); // Result of a confirmation
41 41
 $cancel			= GETPOST('cancel', 'alpha'); // We click on a Cancel button
42
-$toselect		= GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
42
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
43 43
 $contextpage	= GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search
44 44
 $backtopage		= GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
45
-$optioncss		= GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
46
-$mode			= GETPOST('mode', 'alpha');  // mode view (kanban or common)
45
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
46
+$mode = GETPOST('mode', 'alpha'); // mode view (kanban or common)
47 47
 $id				= GETPOST('id', 'int');
48 48
 
49 49
 // Load variable for pagination
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 // Default sort order (if not yet defined by previous GETPOST)
74 74
 if (!$sortfield) {
75
-	reset($object->fields);					// Reset is required to avoid key() to return null.
75
+	reset($object->fields); // Reset is required to avoid key() to return null.
76 76
 	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
77 77
 }
78 78
 if (!$sortorder) {
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 					$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
257 257
 				}
258 258
 				if (preg_match('/_dtend$/', $key)) {
259
-					$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
259
+					$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
260 260
 				}
261 261
 			}
262 262
 		}
Please login to merge, or discard this patch.
htdocs/asset/document.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -75,10 +75,14 @@
 block discarded – undo
75 75
 $permissiontoadd = $user->rights->asset->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
76 76
 
77 77
 // Security check (enable the most restrictive one)
78
-if ($user->socid > 0) accessforbidden();
78
+if ($user->socid > 0) {
79
+	accessforbidden();
80
+}
79 81
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
80 82
 restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
81
-if (!isModEnabled('asset')) accessforbidden();
83
+if (!isModEnabled('asset')) {
84
+	accessforbidden();
85
+}
82 86
 
83 87
 
84 88
 /*
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	// Object card
119 119
 	// ------------------------------------------------------------
120
-	$linkback = '<a href="' . dol_buildpath('/asset/asset_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
120
+	$linkback = '<a href="'.dol_buildpath('/asset/asset_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
121 121
 
122 122
 	$morehtmlref = '<div class="refidno">';
123 123
 	$morehtmlref .= '</div>';
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	print '<table class="border centpercent tableforfield">';
131 131
 
132 132
 	// Number of files
133
-	print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
133
+	print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
134 134
 
135 135
 	// Total size
136
-	print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
136
+	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
137 137
 
138 138
 	print '</table>';
139 139
 
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 	//  $permissiontoadd = 1;
147 147
 	$permtoedit = $user->hasRight('asset', 'write');
148 148
 	//  $permtoedit = 1;
149
-	$param = '&id=' . $object->id;
149
+	$param = '&id='.$object->id;
150 150
 
151 151
 	//$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
152
-	$relativepathwithnofile = dol_sanitizeFileName($object->ref) . '/';
152
+	$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
153 153
 
154
-	include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
154
+	include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
155 155
 } else {
156 156
 	accessforbidden('', 0, 1);
157 157
 }
Please login to merge, or discard this patch.
htdocs/salaries/info.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,9 @@
 block discarded – undo
100 100
  * View
101 101
  */
102 102
 
103
-if (isModEnabled('project')) $formproject = new FormProjets($db);
103
+if (isModEnabled('project')) {
104
+	$formproject = new FormProjets($db);
105
+}
104 106
 
105 107
 $title = $langs->trans('Salary')." - ".$langs->trans('Info');
106 108
 $help_url = "";
Please login to merge, or discard this patch.
htdocs/delivery/card.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,10 +89,10 @@
 block discarded – undo
89 89
  */
90 90
 
91 91
 $parameters = array();
92
-$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);       // Note that $action and $object may have been modified by some hooks
92
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
93 93
 // Delete Link
94 94
 $permissiondellink = $user->rights->expedition->delivery->supprimer; // Used by the include of actions_dellink.inc.php
95
-include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';     // Must be include, not include_once
95
+include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once
96 96
 
97 97
 if ($action == 'add') {
98 98
 	$db->begin();
Please login to merge, or discard this patch.
htdocs/core/modules/mailings/partnership.modules.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -222,7 +222,7 @@
 block discarded – undo
222 222
 			$num = $this->db->num_rows($resql);
223 223
 
224 224
 			if (empty($conf->partnership->enabled)) {
225
-				$num = 0;   // Force empty list if category module is not enabled
225
+				$num = 0; // Force empty list if category module is not enabled
226 226
 			}
227 227
 
228 228
 			if ($num) {
Please login to merge, or discard this patch.