Passed
Branch develop (fc1365)
by Laurent
84:32
created
htdocs/takepos/invoice.php 1 patch
Braces   +29 added lines, -10 removed lines patch added patch discarded remove patch
@@ -184,7 +184,9 @@  discard block
 block discarded – undo
184 184
 
185 185
 $parameters=array();
186 186
 $reshook=$hookmanager->executeHooks('doActions', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
187
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
187
+if ($reshook < 0) {
188
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
189
+}
188 190
 
189 191
 if (empty($reshook)) {
190 192
 	// Action to record a payment on a TakePOS invoice
@@ -547,7 +549,10 @@  discard block
 block discarded – undo
547 549
 		if (!empty($conf->global->TAKEPOS_GROUP_SAME_PRODUCT)) {
548 550
 			foreach ($invoice->lines as $line) {
549 551
 				if ($line->product_ref == $prod->ref) {
550
-					if ($line->special_code==4) continue; // If this line is sended to printer create new line
552
+					if ($line->special_code==4) {
553
+						continue;
554
+					}
555
+					// If this line is sended to printer create new line
551 556
 					$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty + $qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
552 557
 					if ($result < 0) {
553 558
 						dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
@@ -579,8 +584,9 @@  discard block
 block discarded – undo
579 584
 					if ($pf->find_min_price_product_fournisseur($idproduct, $qty) > 0) {
580 585
 						$line['fk_fournprice'] = $pf->product_fourn_price_id;
581 586
 						$line['pa_ht'] = $pf->fourn_unitprice_with_discount;
582
-						if ($pf->fourn_charges > 0)
583
-							$line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
587
+						if ($pf->fourn_charges > 0) {
588
+													$line['pa_ht'] += $pf->fourn_charges / $pf->fourn_qty;
589
+						}
584 590
 					}
585 591
 				}
586 592
 			}
@@ -588,7 +594,9 @@  discard block
 block discarded – undo
588 594
 			// complete line by hook
589 595
 			$parameters = array('prod' => $prod, 'line' => $line);
590 596
 			$reshook=$hookmanager->executeHooks('completeTakePosAddLine', $parameters, $invoice, $action);    // Note that $action and $line may have been modified by some hooks
591
-			if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
597
+			if ($reshook < 0) {
598
+				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
599
+			}
592 600
 
593 601
 
594 602
 			if (empty($reshook)) {
@@ -633,9 +641,11 @@  discard block
 block discarded – undo
633 641
 		$desc = GETPOST('addnote', 'alpha');
634 642
 		if ($idline==0) {
635 643
 			$invoice->update_note($desc, '_public');
636
-		} else foreach ($invoice->lines as $line) {
644
+		} else {
645
+			foreach ($invoice->lines as $line) {
637 646
 			if ($line->id == $idline) {
638 647
 				$result = $invoice->updateline($line->id, $desc, $line->subprice, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
648
+		}
639 649
 			}
640 650
 		}
641 651
 		$invoice->fetch($placeid);
@@ -959,7 +969,10 @@  discard block
 block discarded – undo
959 969
 <script type="text/javascript">
960 970
 var selectedline=0;
961 971
 var selectedtext="";
962
-<?php if ($action=="valid") echo "var place=0;";?> // Set to default place after close sale
972
+<?php if ($action=="valid") {
973
+	echo "var place=0;";
974
+}
975
+?> // Set to default place after close sale
963 976
 var placeid=<?php echo ($placeid > 0 ? $placeid : 0); ?>;
964 977
 $(document).ready(function() {
965 978
 	var idoflineadded = <?php echo (empty($idoflineadded) ? 0 : $idoflineadded); ?>;
@@ -1336,7 +1349,9 @@  discard block
 block discarded – undo
1336 1349
 // complete header by hook
1337 1350
 $parameters=array();
1338 1351
 $reshook=$hookmanager->executeHooks('completeTakePosInvoiceHeader', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1339
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1352
+if ($reshook < 0) {
1353
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1354
+}
1340 1355
 print $hookmanager->resPrint;
1341 1356
 
1342 1357
 if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) {
@@ -1500,7 +1515,9 @@  discard block
 block discarded – undo
1500 1515
 				// complete line by hook
1501 1516
 				$parameters=array('line' => $line);
1502 1517
 				$reshook=$hookmanager->executeHooks('completeTakePosInvoiceParentLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1503
-				if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1518
+				if ($reshook < 0) {
1519
+					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1520
+				}
1504 1521
 				$htmlsupplements[$line->fk_parent_line] .= $hookmanager->resPrint;
1505 1522
 
1506 1523
 				if (empty($_SESSION["basiclayout"]) || $_SESSION["basiclayout"] != 1) {
@@ -1591,7 +1608,9 @@  discard block
 block discarded – undo
1591 1608
 				// complete line by hook
1592 1609
 				$parameters=array('line' => $line);
1593 1610
 				$reshook=$hookmanager->executeHooks('completeTakePosInvoiceLine', $parameters, $invoice, $action);    // Note that $action and $object may have been modified by some hooks
1594
-				if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1611
+				if ($reshook < 0) {
1612
+					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
1613
+				}
1595 1614
 				$htmlforlines .= $hookmanager->resPrint;
1596 1615
 
1597 1616
 				$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_note.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,9 @@
 block discarded – undo
51 51
 
52 52
 // Load object
53 53
 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
54
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
54
+if ($id > 0 || !empty($ref)) {
55
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
56
+}
55 57
 
56 58
 $permissionnote = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_setnotes.inc.php
57 59
 $permissiontoadd = $user->rights->stocktransfer->stocktransfer->write; // Used by the include of actions_addupdatedelete.inc.php
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_contact.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,7 +35,9 @@  discard block
 block discarded – undo
35 35
 $action = GETPOST('action', 'alpha');
36 36
 
37 37
 // Security check
38
-if ($user->socid) $socid = $user->socid;
38
+if ($user->socid) {
39
+	$socid = $user->socid;
40
+}
39 41
 
40 42
 $result = restrictedArea($user, 'stocktransfer', $id, '', 'stocktransfer');
41 43
 
@@ -175,7 +177,9 @@  discard block
 block discarded – undo
175 177
 	$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
176 178
 	foreach ($dirtpls as $reldir) {
177 179
 		$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
178
-		if ($res) break;
180
+		if ($res) {
181
+			break;
182
+		}
179 183
 	}
180 184
 }
181 185
 
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_list.php 1 patch
Braces   +159 added lines, -60 removed lines patch added patch discarded remove patch
@@ -68,28 +68,39 @@  discard block
 block discarded – undo
68 68
 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
69 69
 
70 70
 // Default sort order (if not yet defined by previous GETPOST)
71
-if (!$sortfield) $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
72
-if (!$sortorder) $sortorder = "ASC";
71
+if (!$sortfield) {
72
+	$sortfield = "t.".key($object->fields);
73
+}
74
+// Set here default search field. By default 1st field in definition.
75
+if (!$sortorder) {
76
+	$sortorder = "ASC";
77
+}
73 78
 
74 79
 // Initialize array of search criterias
75 80
 $search_all = GETPOST('search_all', 'alphanohtml') ? trim(GETPOST('search_all', 'alphanohtml')) : trim(GETPOST('sall', 'alphanohtml'));
76 81
 $search = array();
77 82
 foreach ($object->fields as $key => $val) {
78
-	if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha');
79
-}
83
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
84
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
85
+	}
86
+	}
80 87
 
81 88
 // List of fields to search into when doing a "search in all"
82 89
 $fieldstosearchall = array();
83 90
 foreach ($object->fields as $key => $val) {
84
-	if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
85
-}
91
+	if ($val['searchall']) {
92
+		$fieldstosearchall['t.'.$key] = $val['label'];
93
+	}
94
+	}
86 95
 
87 96
 // Definition of fields for list
88 97
 $arrayfields = array();
89 98
 foreach ($object->fields as $key => $val) {
90 99
 	// If $val['visible']==0, then we never show the field
91
-	if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
92
-}
100
+	if (!empty($val['visible'])) {
101
+		$arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>(verifCond($val['enabled']) && ($val['visible'] != 3)), 'position'=>$val['position']);
102
+	}
103
+	}
93 104
 //var_dump($object->fields);
94 105
 // Extra fields
95 106
 if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
@@ -113,14 +124,18 @@  discard block
 block discarded – undo
113 124
 $permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete;
114 125
 
115 126
 // Security check
116
-if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
127
+if (empty($conf->stocktransfer->enabled)) {
128
+	accessforbidden('Module not enabled');
129
+}
117 130
 $socid = 0;
118 131
 if ($user->socid > 0) {	// Protection if external user
119 132
 	//$socid = $user->socid;
120 133
 	accessforbidden();
121 134
 }
122 135
 //$result = restrictedArea($user, 'stocktransfer', $id, '');
123
-if (!$permissiontoread) accessforbidden();
136
+if (!$permissiontoread) {
137
+	accessforbidden();
138
+}
124 139
 
125 140
 
126 141
 
@@ -133,7 +148,9 @@  discard block
 block discarded – undo
133 148
 
134 149
 $parameters = array();
135 150
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
136
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
151
+if ($reshook < 0) {
152
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
153
+}
137 154
 
138 155
 if (empty($reshook)) {
139 156
 	// Selection of new fields
@@ -182,27 +199,42 @@  discard block
 block discarded – undo
182 199
 }
183 200
 // Add fields from extrafields
184 201
 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
185
-	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
186
-}
202
+	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
203
+		$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key." as options_".$key.', ' : '');
204
+	}
205
+	}
187 206
 // Add fields from hooks
188 207
 $parameters = array();
189 208
 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
190 209
 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
191 210
 $sql = preg_replace('/,\s*$/', '', $sql);
192 211
 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
193
-if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
194
-if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
195
-else $sql .= " WHERE 1 = 1";
212
+if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
213
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
214
+}
215
+if ($object->ismultientitymanaged == 1) {
216
+	$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
217
+} else {
218
+	$sql .= " WHERE 1 = 1";
219
+}
196 220
 foreach ($search as $key => $val) {
197
-	if ($key == 'status' && $search[$key] == -1) continue;
221
+	if ($key == 'status' && $search[$key] == -1) {
222
+		continue;
223
+	}
198 224
 	$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
199 225
 	if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
200
-		if ($search[$key] == '-1') $search[$key] = '';
226
+		if ($search[$key] == '-1') {
227
+			$search[$key] = '';
228
+		}
201 229
 		$mode_search = 2;
202 230
 	}
203
-	if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
231
+	if ($search[$key] != '') {
232
+		$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
233
+	}
234
+	}
235
+if ($search_all) {
236
+	$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
204 237
 }
205
-if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
206 238
 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
207 239
 // Add where from extra fields
208 240
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
@@ -244,7 +276,9 @@  discard block
 block discarded – undo
244 276
 if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
245 277
 	$num = $nbtotalofrecords;
246 278
 } else {
247
-	if ($limit) $sql .= $db->plimit($limit + 1, $offset);
279
+	if ($limit) {
280
+		$sql .= $db->plimit($limit + 1, $offset);
281
+	}
248 282
 
249 283
 	$resql = $db->query($sql);
250 284
 	if (!$resql) {
@@ -287,13 +321,22 @@  discard block
 block discarded – undo
287 321
 $arrayofselected = is_array($toselect) ? $toselect : array();
288 322
 
289 323
 $param = '';
290
-if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
291
-if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
324
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
325
+	$param .= '&contextpage='.urlencode($contextpage);
326
+}
327
+if ($limit > 0 && $limit != $conf->liste_limit) {
328
+	$param .= '&limit='.urlencode($limit);
329
+}
292 330
 foreach ($search as $key => $val) {
293
-	if (is_array($search[$key]) && count($search[$key])) foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
294
-	else $param .= '&search_'.$key.'='.urlencode($search[$key]);
331
+	if (is_array($search[$key]) && count($search[$key])) {
332
+		foreach ($search[$key] as $skey) $param .= '&search_'.$key.'[]='.urlencode($skey);
333
+	} else {
334
+		$param .= '&search_'.$key.'='.urlencode($search[$key]);
335
+	}
336
+	}
337
+if ($optioncss != '') {
338
+	$param .= '&optioncss='.urlencode($optioncss);
295 339
 }
296
-if ($optioncss != '')     $param .= '&optioncss='.urlencode($optioncss);
297 340
 // Add $param from extra fields
298 341
 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
299 342
 
@@ -304,12 +347,18 @@  discard block
 block discarded – undo
304 347
 	//'builddoc'=>$langs->trans("PDFMerge"),
305 348
 	//'presend'=>$langs->trans("SendByMail"),
306 349
 );
307
-if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
308
-if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
350
+if ($permissiontodelete) {
351
+	$arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
352
+}
353
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
354
+	$arrayofmassactions = array();
355
+}
309 356
 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
310 357
 
311 358
 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
312
-if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
359
+if ($optioncss != '') {
360
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
361
+}
313 362
 print '<input type="hidden" name="token" value="'.newToken().'">';
314 363
 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
315 364
 print '<input type="hidden" name="action" value="list">';
@@ -330,7 +379,9 @@  discard block
 block discarded – undo
330 379
 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
331 380
 
332 381
 if ($search_all) {
333
-	foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
382
+	foreach ($fieldstosearchall as $key => $val) {
383
+		$fieldstosearchall[$key] = $langs->trans($val);
384
+	}
334 385
 	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
335 386
 }
336 387
 
@@ -341,8 +392,11 @@  discard block
 block discarded – undo
341 392
 
342 393
 $parameters = array();
343 394
 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
344
-if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
345
-else $moreforfilter = $hookmanager->resPrint;
395
+if (empty($reshook)) {
396
+	$moreforfilter .= $hookmanager->resPrint;
397
+} else {
398
+	$moreforfilter = $hookmanager->resPrint;
399
+}
346 400
 
347 401
 if (!empty($moreforfilter)) {
348 402
 	print '<div class="liste_titre liste_titre_bydiv centpercent">';
@@ -363,16 +417,24 @@  discard block
 block discarded – undo
363 417
 print '<tr class="liste_titre">';
364 418
 foreach ($object->fields as $key => $val) {
365 419
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
366
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
367
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
368
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
369
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
420
+	if ($key == 'status') {
421
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
422
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
423
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
424
+	} elseif (in_array($val['type'], array('timestamp'))) {
425
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
426
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
427
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
428
+	}
370 429
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
371 430
 		print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
372
-		if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
373
-		elseif (strpos($val['type'], 'integer:') === 0) {
431
+		if (is_array($val['arrayofkeyval'])) {
432
+			print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
433
+		} elseif (strpos($val['type'], 'integer:') === 0) {
374 434
 			print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
375
-		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
435
+		} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
436
+			print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
437
+		}
376 438
 		print '</td>';
377 439
 	}
378 440
 }
@@ -396,10 +458,15 @@  discard block
 block discarded – undo
396 458
 print '<tr class="liste_titre">';
397 459
 foreach ($object->fields as $key => $val) {
398 460
 	$cssforfield = (empty($val['css']) ? '' : $val['css']);
399
-	if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
400
-	elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
401
-	elseif (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
402
-	elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
461
+	if ($key == 'status') {
462
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
463
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
464
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
465
+	} elseif (in_array($val['type'], array('timestamp'))) {
466
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
467
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
468
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
469
+	}
403 470
 	if (!empty($arrayfields['t.'.$key]['checked'])) {
404 471
 		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
405 472
 	}
@@ -419,7 +486,10 @@  discard block
 block discarded – undo
419 486
 $needToFetchEachLine = 0;
420 487
 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
421 488
 	foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
422
-		if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
489
+		if (preg_match('/\$object/', $val)) {
490
+			$needToFetchEachLine++;
491
+		}
492
+		// There is at least one compute field that use $object
423 493
 	}
424 494
 }
425 495
 
@@ -430,7 +500,10 @@  discard block
 block discarded – undo
430 500
 $totalarray = array();
431 501
 while ($i < ($limit ? min($num, $limit) : $num)) {
432 502
 	$obj = $db->fetch_object($resql);
433
-	if (empty($obj)) break; // Should not happen
503
+	if (empty($obj)) {
504
+		break;
505
+	}
506
+	// Should not happen
434 507
 
435 508
 	// Store properties in $object
436 509
 	$object->setVarsFromFetchObj($obj);
@@ -439,31 +512,48 @@  discard block
 block discarded – undo
439 512
 	print '<tr class="oddeven">';
440 513
 	foreach ($object->fields as $key => $val) {
441 514
 		$cssforfield = (empty($val['css']) ? '' : $val['css']);
442
-		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center';
443
-		elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center';
515
+		if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
516
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
517
+		} elseif ($key == 'status') {
518
+			$cssforfield .= ($cssforfield ? ' ' : '').'center';
519
+		}
444 520
 
445
-		if (in_array($val['type'], array('timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
446
-		elseif ($key == 'ref') $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
521
+		if (in_array($val['type'], array('timestamp'))) {
522
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
523
+		} elseif ($key == 'ref') {
524
+			$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
525
+		}
447 526
 
448
-		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield .= ($cssforfield ? ' ' : '').'right';
527
+		if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
528
+			$cssforfield .= ($cssforfield ? ' ' : '').'right';
529
+		}
449 530
 		//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
450 531
 
451 532
 		if (!empty($arrayfields['t.'.$key]['checked'])) {
452 533
 			print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
453
-			if ($key == 'status') print $object->getLibStatut(5);
454
-			else {
534
+			if ($key == 'status') {
535
+				print $object->getLibStatut(5);
536
+			} else {
455 537
 				print $object->showOutputField($val, $key, $object->$key, '');
456 538
 				if ($key === 'date_prevue_depart' && $object->lead_time_for_warning > 0 && $object->$key > 0) {
457 539
 					$date_prevue_depart = $object->$key;
458 540
 					$date_prevue_depart_plus_delai = $date_prevue_depart;
459
-					if ($object->lead_time_for_warning > 0) $date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
460
-					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
541
+					if ($object->lead_time_for_warning > 0) {
542
+						$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
543
+					}
544
+					if ($date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
545
+						print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
546
+					}
461 547
 				}
462 548
 			}
463 549
 			print '</td>';
464
-			if (!$i) $totalarray['nbfield']++;
550
+			if (!$i) {
551
+				$totalarray['nbfield']++;
552
+			}
465 553
 			if (!empty($val['isameasure'])) {
466
-				if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
554
+				if (!$i) {
555
+					$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
556
+				}
467 557
 				$totalarray['val']['t.'.$key] += $object->$key;
468 558
 			}
469 559
 		}
@@ -478,11 +568,15 @@  discard block
 block discarded – undo
478 568
 	print '<td class="nowrap center">';
479 569
 	if ($massactionbutton || $massaction) {   // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
480 570
 		$selected = 0;
481
-		if (in_array($object->id, $arrayofselected)) $selected = 1;
571
+		if (in_array($object->id, $arrayofselected)) {
572
+			$selected = 1;
573
+		}
482 574
 		print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
483 575
 	}
484 576
 	print '</td>';
485
-	if (!$i) $totalarray['nbfield']++;
577
+	if (!$i) {
578
+		$totalarray['nbfield']++;
579
+	}
486 580
 
487 581
 	print '</tr>'."\n";
488 582
 
@@ -495,7 +589,10 @@  discard block
 block discarded – undo
495 589
 // If no record found
496 590
 if ($num == 0) {
497 591
 	$colspan = 1;
498
-	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
592
+	foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) {
593
+		$colspan++;
594
+	}
595
+	}
499 596
 	print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
500 597
 }
501 598
 
@@ -513,7 +610,9 @@  discard block
 block discarded – undo
513 610
 
514 611
 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
515 612
 	$hidegeneratedfilelistifempty = 1;
516
-	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
613
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
614
+		$hidegeneratedfilelistifempty = 0;
615
+	}
517 616
 
518 617
 	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
519 618
 	$formfile = new FormFile($db);
Please login to merge, or discard this patch.
htdocs/contrat/class/contrat.class.php 1 patch
Braces   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2637,7 +2637,9 @@  discard block
 block discarded – undo
2637 2637
 		$sql.= ' WHERE cd.fk_contrat = c.rowid';
2638 2638
 		$sql.= " AND date_format(cd.date_fin_validite, '%Y-%m-%d') <= date_format('".$this->db->idate($enddatetoscan)."', '%Y-%m-%d')";
2639 2639
 		$sql.= " AND cd.statut = 4";
2640
-		if ($thirdparty_id > 0) $sql.=" AND c.fk_soc = ".((int) $thirdparty_id);
2640
+		if ($thirdparty_id > 0) {
2641
+			$sql.=" AND c.fk_soc = ".((int) $thirdparty_id);
2642
+		}
2641 2643
 		//print $sql;
2642 2644
 
2643 2645
 		$resql = $this->db->query($sql);
@@ -2682,7 +2684,10 @@  discard block
 block discarded – undo
2682 2684
 						//dol_sort_array($contract->linkedObjects['facture'], 'date');
2683 2685
 						$someinvoicenotpaid=0;
2684 2686
 						foreach ($object->linkedObjects['facture'] as $idinvoice => $invoice) {
2685
-							if ($invoice->statut == Facture::STATUS_DRAFT) continue;	// Draft invoice are not invoice not paid
2687
+							if ($invoice->statut == Facture::STATUS_DRAFT) {
2688
+								continue;
2689
+							}
2690
+							// Draft invoice are not invoice not paid
2686 2691
 
2687 2692
 							if (empty($invoice->paye)) {
2688 2693
 								$someinvoicenotpaid++;
Please login to merge, or discard this patch.
htdocs/public/payment/paymentok.php 1 patch
Braces   +14 added lines, -5 removed lines patch added patch discarded remove patch
@@ -971,13 +971,20 @@  discard block
 block discarded – undo
971 971
 
972 972
 						if (!$error && isModEnabled("banque")) {
973 973
 							$bankaccountid = 0;
974
-							if ($paymentmethod == 'paybox') $bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
975
-							elseif ($paymentmethod == 'paypal') $bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
976
-							elseif ($paymentmethod == 'stripe') $bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
974
+							if ($paymentmethod == 'paybox') {
975
+								$bankaccountid = $conf->global->PAYBOX_BANK_ACCOUNT_FOR_PAYMENTS;
976
+							} elseif ($paymentmethod == 'paypal') {
977
+								$bankaccountid = $conf->global->PAYPAL_BANK_ACCOUNT_FOR_PAYMENTS;
978
+							} elseif ($paymentmethod == 'stripe') {
979
+								$bankaccountid = $conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS;
980
+							}
977 981
 
978 982
 							if ($bankaccountid > 0) {
979 983
 								$label = '(CustomerInvoicePayment)';
980
-								if ($object->type == Facture::TYPE_CREDIT_NOTE) $label = '(CustomerInvoicePaymentBack)'; // Refund of a credit note
984
+								if ($object->type == Facture::TYPE_CREDIT_NOTE) {
985
+									$label = '(CustomerInvoicePaymentBack)';
986
+								}
987
+								// Refund of a credit note
981 988
 								$result = $paiement->addPaymentToBank($user, 'payment', $label, $bankaccountid, '', '');
982 989
 								if ($result < 0) {
983 990
 									$postactionmessages[] = $paiement->error . ' ' . join("<br>\n", $paiement->errors);
@@ -1562,7 +1569,9 @@  discard block
 block discarded – undo
1562 1569
 		include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
1563 1570
 		$paiement = new Paiement($db);
1564 1571
 		$result = $paiement->call_trigger('PAYMENTONLINE_PAYMENT_OK', $user);
1565
-		if ($result < 0) $error++;
1572
+		if ($result < 0) {
1573
+			$error++;
1574
+		}
1566 1575
 	}
1567 1576
 
1568 1577
 	print $langs->trans("YourPaymentHasBeenRecorded")."<br>\n";
Please login to merge, or discard this patch.
htdocs/product/class/productfournisseurprice.class.php 1 patch
Braces   +59 added lines, -21 removed lines patch added patch discarded remove patch
@@ -177,8 +177,12 @@  discard block
 block discarded – undo
177 177
 
178 178
 		$this->db = $db;
179 179
 
180
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
181
-		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
180
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
181
+			$this->fields['rowid']['visible'] = 0;
182
+		}
183
+		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
184
+			$this->fields['entity']['enabled'] = 0;
185
+		}
182 186
 
183 187
 		// Unset fields that are disabled
184 188
 		foreach ($this->fields as $key => $val) {
@@ -220,7 +224,9 @@  discard block
 block discarded – undo
220 224
 
221 225
 		// Load source object
222 226
 		$result = $object->fetchCommon($fromid);
223
-		if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
227
+		if ($result > 0 && !empty($object->table_element_line)) {
228
+			$object->fetchLines();
229
+		}
224 230
 
225 231
 		// get lines so they will be clone
226 232
 		//foreach($this->lines as $line)
@@ -232,8 +238,12 @@  discard block
 block discarded – undo
232 238
 		unset($object->import_key);
233 239
 
234 240
 		// Clear fields
235
-		if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
236
-		if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
241
+		if (property_exists($object, 'ref')) {
242
+			$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
243
+		}
244
+		if (property_exists($object, 'label')) {
245
+			$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
246
+		}
237 247
 		if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; }
238 248
 		if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); }
239 249
 		if (property_exists($object, 'date_modification')) { $object->date_modification = null; }
@@ -270,8 +280,9 @@  discard block
 block discarded – undo
270 280
 		if (!$error) {
271 281
 			// copy external contacts if same company
272 282
 			if (property_exists($this, 'socid') && $this->socid == $object->socid) {
273
-				if ($this->copy_linked_contact($object, 'external') < 0)
274
-					$error++;
283
+				if ($this->copy_linked_contact($object, 'external') < 0) {
284
+									$error++;
285
+				}
275 286
 			}
276 287
 		}
277 288
 
@@ -320,8 +331,11 @@  discard block
 block discarded – undo
320 331
 		$sql = "SELECT ";
321 332
 		$sql .= $this->getFieldList();
322 333
 		$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
323
-		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($this->element).")";
324
-		else $sql .= " WHERE 1 = 1";
334
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
335
+			$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
336
+		} else {
337
+			$sql .= " WHERE 1 = 1";
338
+		}
325 339
 		// Manage filter
326 340
 		$sqlwhere = array();
327 341
 		if (count($filter) > 0) {
@@ -437,8 +451,12 @@  discard block
 block discarded – undo
437 451
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element;
438 452
 			$sql .= " SET ref = '".$this->db->escape($num)."',";
439 453
 			$sql .= " status = ".self::STATUS_VALIDATED;
440
-			if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'";
441
-			if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id;
454
+			if (!empty($this->fields['date_validation'])) {
455
+				$sql .= ", date_validation = '".$this->db->idate($now)."'";
456
+			}
457
+			if (!empty($this->fields['fk_user_valid'])) {
458
+				$sql .= ", fk_user_valid = ".$user->id;
459
+			}
442 460
 			$sql .= " WHERE rowid = ".((int) $this->id);
443 461
 
444 462
 			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@@ -452,7 +470,9 @@  discard block
 block discarded – undo
452 470
 			if (!$error && !$notrigger) {
453 471
 				// Call trigger
454 472
 				$result = $this->call_trigger('PRODUCTFOURNISSEURPRICE_VALIDATE', $user);
455
-				if ($result < 0) $error++;
473
+				if ($result < 0) {
474
+					$error++;
475
+				}
456 476
 				// End call triggers
457 477
 			}
458 478
 		}
@@ -573,7 +593,10 @@  discard block
 block discarded – undo
573 593
 	{
574 594
 		global $conf, $langs, $hookmanager;
575 595
 
576
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
596
+		if (!empty($conf->dol_no_mouse_hover)) {
597
+			$notooltip = 1;
598
+		}
599
+		// Force disable tooltips
577 600
 
578 601
 		$result = '';
579 602
 
@@ -589,8 +612,12 @@  discard block
 block discarded – undo
589 612
 		if ($option != 'nolink') {
590 613
 			// Add param to save lastsearch_values or not
591 614
 			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
592
-			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
593
-			if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
615
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
616
+				$add_save_lastsearch_values = 1;
617
+			}
618
+			if ($add_save_lastsearch_values) {
619
+				$url .= '&save_lastsearch_values=1';
620
+			}
594 621
 		}
595 622
 
596 623
 		$linkclose = '';
@@ -601,7 +628,9 @@  discard block
 block discarded – undo
601 628
 			}
602 629
 			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
603 630
 			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
604
-		} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
631
+		} else {
632
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
633
+		}
605 634
 
606 635
 		$linkstart = '<a href="'.$url.'"';
607 636
 		$linkstart .= $linkclose.'>';
@@ -610,7 +639,9 @@  discard block
 block discarded – undo
610 639
 		$result .= $linkstart;
611 640
 
612 641
 		if (empty($this->showphoto_on_popup)) {
613
-			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);
642
+			if ($withpicto) {
643
+				$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);
644
+			}
614 645
 		} else {
615 646
 			if ($withpicto) {
616 647
 				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -636,7 +667,9 @@  discard block
 block discarded – undo
636 667
 			}
637 668
 		}
638 669
 
639
-		if ($withpicto != 2) $result .= $this->ref;
670
+		if ($withpicto != 2) {
671
+			$result .= $this->ref;
672
+		}
640 673
 
641 674
 		$result .= $linkend;
642 675
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@@ -645,8 +678,11 @@  discard block
 block discarded – undo
645 678
 		$hookmanager->initHooks(array('productfournisseurpricedao'));
646 679
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
647 680
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
648
-		if ($reshook > 0) $result = $hookmanager->resPrint;
649
-		else $result .= $hookmanager->resPrint;
681
+		if ($reshook > 0) {
682
+			$result = $hookmanager->resPrint;
683
+		} else {
684
+			$result .= $hookmanager->resPrint;
685
+		}
650 686
 
651 687
 		return $result;
652 688
 	}
@@ -686,7 +722,9 @@  discard block
 block discarded – undo
686 722
 
687 723
 		$statusType = 'status'.$status;
688 724
 		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
689
-		if ($status == self::STATUS_CANCELED) $statusType = 'status6';
725
+		if ($status == self::STATUS_CANCELED) {
726
+			$statusType = 'status6';
727
+		}
690 728
 
691 729
 		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
692 730
 	}
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/class/stocktransfer.class.php 1 patch
Braces   +77 added lines, -27 removed lines patch added patch discarded remove patch
@@ -196,8 +196,12 @@  discard block
 block discarded – undo
196 196
 		$this->db = $db;
197 197
 		$this->origin_type = 'StockTransfer@product/stock/stocktransfer';
198 198
 
199
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
200
-		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
199
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
200
+			$this->fields['rowid']['visible'] = 0;
201
+		}
202
+		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
203
+			$this->fields['entity']['enabled'] = 0;
204
+		}
201 205
 
202 206
 		// Example to show how to set values of fields definition dynamically
203 207
 		/*if ($user->rights->stocktransfer->stocktransfer->read) {
@@ -234,10 +238,16 @@  discard block
 block discarded – undo
234 238
 	public function create(User $user, $notrigger = false)
235 239
 	{
236 240
 		$model_pdf = GETPOST('model');
237
-		if (!empty($model_pdf)) $this->model_pdf = $model_pdf;
241
+		if (!empty($model_pdf)) {
242
+			$this->model_pdf = $model_pdf;
243
+		}
238 244
 		$this->status = (int) $this->status;
239
-		if ($this->fk_warehouse_source <= 0) $this->fk_warehouse_source = 0;
240
-		if ($this->fk_warehouse_destination <= 0) $this->fk_warehouse_destination = 0;
245
+		if ($this->fk_warehouse_source <= 0) {
246
+			$this->fk_warehouse_source = 0;
247
+		}
248
+		if ($this->fk_warehouse_destination <= 0) {
249
+			$this->fk_warehouse_destination = 0;
250
+		}
241 251
 		return $this->createCommon($user, $notrigger);
242 252
 	}
243 253
 
@@ -261,7 +271,9 @@  discard block
 block discarded – undo
261 271
 
262 272
 		// Load source object
263 273
 		$result = $object->fetchCommon($fromid);
264
-		if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
274
+		if ($result > 0 && !empty($object->table_element_line)) {
275
+			$object->fetchLines();
276
+		}
265 277
 
266 278
 		// get lines so they will be clone
267 279
 		//foreach($this->lines as $line)
@@ -313,8 +325,9 @@  discard block
 block discarded – undo
313 325
 		if (!$error) {
314 326
 			// copy external contacts if same company
315 327
 			if (property_exists($this, 'socid') && $this->socid == $object->socid) {
316
-				if ($this->copy_linked_contact($object, 'external') < 0)
317
-					$error++;
328
+				if ($this->copy_linked_contact($object, 'external') < 0) {
329
+									$error++;
330
+				}
318 331
 			}
319 332
 		}
320 333
 
@@ -340,7 +353,9 @@  discard block
 block discarded – undo
340 353
 	public function fetch($id, $ref = null)
341 354
 	{
342 355
 		$result = $this->fetchCommon($id, $ref);
343
-		if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
356
+		if ($result > 0 && !empty($this->table_element_line)) {
357
+			$this->fetchLines();
358
+		}
344 359
 		return $result;
345 360
 	}
346 361
 
@@ -384,9 +399,13 @@  discard block
 block discarded – undo
384 399
 
385 400
 		$total_pmp = 0;
386 401
 
387
-		if (empty($this->lines)) $this->fetchLines();
402
+		if (empty($this->lines)) {
403
+			$this->fetchLines();
404
+		}
388 405
 		if (!empty($this->lines)) {
389
-			foreach ($this->lines as $l) $total_pmp+= ($l->pmp * $l->qty);
406
+			foreach ($this->lines as $l) {
407
+				$total_pmp+= ($l->pmp * $l->qty);
408
+			}
390 409
 		}
391 410
 
392 411
 		return $total_pmp;
@@ -414,8 +433,11 @@  discard block
 block discarded – undo
414 433
 		$sql = 'SELECT ';
415 434
 		$sql .= $this->getFieldList();
416 435
 		$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
417
-		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
418
-		else $sql .= ' WHERE 1 = 1';
436
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
437
+			$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
438
+		} else {
439
+			$sql .= ' WHERE 1 = 1';
440
+		}
419 441
 		// Manage filter
420 442
 		$sqlwhere = array();
421 443
 		if (count($filter) > 0) {
@@ -478,8 +500,12 @@  discard block
 block discarded – undo
478 500
 	{
479 501
 		$this->tms = ''; // Will be done automatically because tms field is on update cascade
480 502
 		$res = $this->updateCommon($user, $notrigger);
481
-		if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) $this->fetch_thirdparty();
482
-		if (empty($this->socid) && empty($this->fk_soc)) unset($this->thirdparty);
503
+		if ($this->socid > 0 || $this->fk_soc > 0 && empty($this->thirdparty)) {
504
+			$this->fetch_thirdparty();
505
+		}
506
+		if (empty($this->socid) && empty($this->fk_soc)) {
507
+			unset($this->thirdparty);
508
+		}
483 509
 		return $res;
484 510
 	}
485 511
 
@@ -566,8 +592,12 @@  discard block
 block discarded – undo
566 592
 			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
567 593
 			$sql .= " SET ref = '".$this->db->escape($num)."',";
568 594
 			$sql .= " status = ".self::STATUS_VALIDATED;
569
-			if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',";
570
-			if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id);
595
+			if (!empty($this->fields['date_validation'])) {
596
+				$sql .= ", date_validation = '".$this->db->idate($now)."',";
597
+			}
598
+			if (!empty($this->fields['fk_user_valid'])) {
599
+				$sql .= ", fk_user_valid = ".((int) $user->id);
600
+			}
571 601
 			$sql .= " WHERE rowid = ".((int) $this->id);
572 602
 
573 603
 			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@@ -581,7 +611,9 @@  discard block
 block discarded – undo
581 611
 			if (!$error && !$notrigger) {
582 612
 				// Call trigger
583 613
 				$result = $this->call_trigger('STOCKTRANSFER_VALIDATE', $user);
584
-				if ($result < 0) $error++;
614
+				if ($result < 0) {
615
+					$error++;
616
+				}
585 617
 				// End call triggers
586 618
 			}
587 619
 		}
@@ -723,7 +755,10 @@  discard block
 block discarded – undo
723 755
 	{
724 756
 		global $conf, $langs, $hookmanager;
725 757
 
726
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
758
+		if (!empty($conf->dol_no_mouse_hover)) {
759
+			$notooltip = 1;
760
+		}
761
+		// Force disable tooltips
727 762
 
728 763
 		$result = '';
729 764
 
@@ -739,8 +774,12 @@  discard block
 block discarded – undo
739 774
 		if ($option != 'nolink') {
740 775
 			// Add param to save lastsearch_values or not
741 776
 			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
742
-			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
743
-			if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
777
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
778
+				$add_save_lastsearch_values = 1;
779
+			}
780
+			if ($add_save_lastsearch_values) {
781
+				$url .= '&save_lastsearch_values=1';
782
+			}
744 783
 		}
745 784
 
746 785
 		$linkclose = '';
@@ -751,7 +790,9 @@  discard block
 block discarded – undo
751 790
 			}
752 791
 			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
753 792
 			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
754
-		} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
793
+		} else {
794
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
795
+		}
755 796
 
756 797
 		$linkstart = '<a href="'.$url.'"';
757 798
 		$linkstart .= $linkclose.'>';
@@ -760,7 +801,9 @@  discard block
 block discarded – undo
760 801
 		$result .= $linkstart;
761 802
 
762 803
 		if (empty($this->showphoto_on_popup)) {
763
-			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);
804
+			if ($withpicto) {
805
+				$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);
806
+			}
764 807
 		} else {
765 808
 			if ($withpicto) {
766 809
 				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -786,7 +829,9 @@  discard block
 block discarded – undo
786 829
 			}
787 830
 		}
788 831
 
789
-		if ($withpicto != 2) $result .= $this->ref;
832
+		if ($withpicto != 2) {
833
+			$result .= $this->ref;
834
+		}
790 835
 
791 836
 		$result .= $linkend;
792 837
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@@ -795,8 +840,11 @@  discard block
 block discarded – undo
795 840
 		$hookmanager->initHooks(array('stocktransferdao'));
796 841
 		$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
797 842
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
798
-		if ($reshook > 0) $result = $hookmanager->resPrint;
799
-		else $result .= $hookmanager->resPrint;
843
+		if ($reshook > 0) {
844
+			$result = $hookmanager->resPrint;
845
+		} else {
846
+			$result .= $hookmanager->resPrint;
847
+		}
800 848
 
801 849
 		return $result;
802 850
 	}
@@ -838,7 +886,9 @@  discard block
 block discarded – undo
838 886
 
839 887
 		$statusType = 'status'.$status;
840 888
 		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
841
-		if ($status == self::STATUS_CLOSED) $statusType = 'status6';
889
+		if ($status == self::STATUS_CLOSED) {
890
+			$statusType = 'status6';
891
+		}
842 892
 
843 893
 		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
844 894
 	}
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/class/stocktransferline.class.php 1 patch
Braces   +56 added lines, -20 removed lines patch added patch discarded remove patch
@@ -164,8 +164,12 @@  discard block
 block discarded – undo
164 164
 
165 165
 		$this->db = $db;
166 166
 
167
-		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0;
168
-		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0;
167
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) {
168
+			$this->fields['rowid']['visible'] = 0;
169
+		}
170
+		if (!isModEnabled('multicompany') && isset($this->fields['entity'])) {
171
+			$this->fields['entity']['enabled'] = 0;
172
+		}
169 173
 
170 174
 		// Example to show how to set values of fields definition dynamically
171 175
 		/*if ($user->rights->stocktransfer->stocktransferline->read) {
@@ -224,7 +228,9 @@  discard block
 block discarded – undo
224 228
 
225 229
 		// Load source object
226 230
 		$result = $object->fetchCommon($fromid);
227
-		if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines();
231
+		if ($result > 0 && !empty($object->table_element_line)) {
232
+			$object->fetchLines();
233
+		}
228 234
 
229 235
 		// get lines so they will be clone
230 236
 		//foreach($this->lines as $line)
@@ -272,8 +278,9 @@  discard block
 block discarded – undo
272 278
 		if (!$error) {
273 279
 			// copy external contacts if same company
274 280
 			if (property_exists($this, 'socid') && $this->socid == $object->socid) {
275
-				if ($this->copy_linked_contact($object, 'external') < 0)
276
-					$error++;
281
+				if ($this->copy_linked_contact($object, 'external') < 0) {
282
+									$error++;
283
+				}
277 284
 			}
278 285
 		}
279 286
 
@@ -299,7 +306,9 @@  discard block
 block discarded – undo
299 306
 	public function fetch($id, $ref = null)
300 307
 	{
301 308
 		$result = $this->fetchCommon($id, $ref);
302
-		if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines();
309
+		if ($result > 0 && !empty($this->table_element_line)) {
310
+			$this->fetchLines();
311
+		}
303 312
 		return $result;
304 313
 	}
305 314
 
@@ -339,8 +348,11 @@  discard block
 block discarded – undo
339 348
 		$sql = 'SELECT ';
340 349
 		$sql .= $this->getFieldList();
341 350
 		$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t';
342
-		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
343
-		else $sql .= ' WHERE 1 = 1';
351
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
352
+			$sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')';
353
+		} else {
354
+			$sql .= ' WHERE 1 = 1';
355
+		}
344 356
 		// Manage filter
345 357
 		$sqlwhere = array();
346 358
 		if (count($filter) > 0) {
@@ -587,8 +599,12 @@  discard block
 block discarded – undo
587 599
 			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
588 600
 			$sql .= " SET ref = '".$this->db->escape($num)."',";
589 601
 			$sql .= " status = ".self::STATUS_VALIDATED;
590
-			if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."',";
591
-			if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".((int) $user->id);
602
+			if (!empty($this->fields['date_validation'])) {
603
+				$sql .= ", date_validation = '".$this->db->idate($now)."',";
604
+			}
605
+			if (!empty($this->fields['fk_user_valid'])) {
606
+				$sql .= ", fk_user_valid = ".((int) $user->id);
607
+			}
592 608
 			$sql .= " WHERE rowid = ".((int) $this->id);
593 609
 
594 610
 			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
@@ -602,7 +618,9 @@  discard block
 block discarded – undo
602 618
 			if (!$error && !$notrigger) {
603 619
 				// Call trigger
604 620
 				$result = $this->call_trigger('STOCKTRANSFERLINE_VALIDATE', $user);
605
-				if ($result < 0) $error++;
621
+				if ($result < 0) {
622
+					$error++;
623
+				}
606 624
 				// End call triggers
607 625
 			}
608 626
 		}
@@ -744,7 +762,10 @@  discard block
 block discarded – undo
744 762
 	{
745 763
 		global $conf, $langs, $hookmanager;
746 764
 
747
-		if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips
765
+		if (!empty($conf->dol_no_mouse_hover)) {
766
+			$notooltip = 1;
767
+		}
768
+		// Force disable tooltips
748 769
 
749 770
 		$result = '';
750 771
 
@@ -760,8 +781,12 @@  discard block
 block discarded – undo
760 781
 		if ($option != 'nolink') {
761 782
 			// Add param to save lastsearch_values or not
762 783
 			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
763
-			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1;
764
-			if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1';
784
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
785
+				$add_save_lastsearch_values = 1;
786
+			}
787
+			if ($add_save_lastsearch_values) {
788
+				$url .= '&save_lastsearch_values=1';
789
+			}
765 790
 		}
766 791
 
767 792
 		$linkclose = '';
@@ -772,7 +797,9 @@  discard block
 block discarded – undo
772 797
 			}
773 798
 			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
774 799
 			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
775
-		} else $linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
800
+		} else {
801
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
802
+		}
776 803
 
777 804
 		$linkstart = '<a href="'.$url.'"';
778 805
 		$linkstart .= $linkclose.'>';
@@ -781,7 +808,9 @@  discard block
 block discarded – undo
781 808
 		$result .= $linkstart;
782 809
 
783 810
 		if (empty($this->showphoto_on_popup)) {
784
-			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);
811
+			if ($withpicto) {
812
+				$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);
813
+			}
785 814
 		} else {
786 815
 			if ($withpicto) {
787 816
 				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@@ -807,7 +836,9 @@  discard block
 block discarded – undo
807 836
 			}
808 837
 		}
809 838
 
810
-		if ($withpicto != 2) $result .= $this->ref;
839
+		if ($withpicto != 2) {
840
+			$result .= $this->ref;
841
+		}
811 842
 
812 843
 		$result .= $linkend;
813 844
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
@@ -816,8 +847,11 @@  discard block
 block discarded – undo
816 847
 		$hookmanager->initHooks(array('stocktransferlinedao'));
817 848
 		$parameters = array('id'=>$this->id, 'getnomurl'=>$result);
818 849
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
819
-		if ($reshook > 0) $result = $hookmanager->resPrint;
820
-		else $result .= $hookmanager->resPrint;
850
+		if ($reshook > 0) {
851
+			$result = $hookmanager->resPrint;
852
+		} else {
853
+			$result .= $hookmanager->resPrint;
854
+		}
821 855
 
822 856
 		return $result;
823 857
 	}
@@ -857,7 +891,9 @@  discard block
 block discarded – undo
857 891
 
858 892
 		$statusType = 'status'.$status;
859 893
 		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
860
-		if ($status == self::STATUS_CANCELED) $statusType = 'status6';
894
+		if ($status == self::STATUS_CANCELED) {
895
+			$statusType = 'status6';
896
+		}
861 897
 
862 898
 		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
863 899
 	}
Please login to merge, or discard this patch.