Completed
Branch develop (b5f2d2)
by
unknown
20:52
created
htdocs/product/stock/stocktransfer/stocktransfer_agenda.php 1 patch
Braces   +28 added lines, -10 removed lines patch added patch discarded remove patch
@@ -43,8 +43,10 @@  discard block
 block discarded – undo
43 43
 
44 44
 if (GETPOST('actioncode', 'array')) {
45 45
 	$actioncode = GETPOST('actioncode', 'array', 3);
46
-	if (!count($actioncode)) $actioncode = '0';
47
-} else {
46
+	if (!count($actioncode)) {
47
+		$actioncode = '0';
48
+	}
49
+	} else {
48 50
 	$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT'));
49 51
 }
50 52
 $search_rowid = GETPOST('search_rowid');
@@ -58,8 +60,12 @@  discard block
 block discarded – undo
58 60
 $offset = $limit * $page;
59 61
 $pageprev = $page - 1;
60 62
 $pagenext = $page + 1;
61
-if (!$sortfield) $sortfield = 'a.datep,a.id';
62
-if (!$sortorder) $sortorder = 'DESC,DESC';
63
+if (!$sortfield) {
64
+	$sortfield = 'a.datep,a.id';
65
+}
66
+if (!$sortorder) {
67
+	$sortorder = 'DESC,DESC';
68
+}
63 69
 
64 70
 // Initialize technical objects
65 71
 $object = new StockTransfer($db);
@@ -71,7 +77,9 @@  discard block
 block discarded – undo
71 77
 
72 78
 // Load object
73 79
 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
74
-if ($id > 0 || !empty($ref)) $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
80
+if ($id > 0 || !empty($ref)) {
81
+	$upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id;
82
+}
75 83
 
76 84
 // Security check - Protection if external user
77 85
 //if ($user->socid > 0) accessforbidden();
@@ -87,7 +95,9 @@  discard block
 block discarded – undo
87 95
 
88 96
 $parameters = array('id'=>$id);
89 97
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
90
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
98
+if ($reshook < 0) {
99
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
100
+}
91 101
 
92 102
 if (empty($reshook)) {
93 103
 	// Cancel
@@ -117,7 +127,9 @@  discard block
 block discarded – undo
117 127
 	$help_url = '';
118 128
 	llxHeader('', $title, $help_url);
119 129
 
120
-	if (isModEnabled('notification')) $langs->load("mails");
130
+	if (isModEnabled('notification')) {
131
+		$langs->load("mails");
132
+	}
121 133
 	$head = stocktransferPrepareHead($object);
122 134
 
123 135
 
@@ -191,7 +203,9 @@  discard block
 block discarded – undo
191 203
 	$permok = $user->hasRight('agenda', 'myactions', 'create');
192 204
 	if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
193 205
 		//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
194
-		if (get_class($objthirdparty) == 'Societe') $out .= '&amp;socid='.$objthirdparty->id;
206
+		if (get_class($objthirdparty) == 'Societe') {
207
+			$out .= '&amp;socid='.$objthirdparty->id;
208
+		}
195 209
 		$out .= (!empty($objcon->id) ? '&amp;contactid='.$objcon->id : '').'&amp;backtopage=1';
196 210
 		//$out.=$langs->trans("AddAnAction").' ';
197 211
 		//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
@@ -213,8 +227,12 @@  discard block
 block discarded – undo
213 227
 
214 228
 	if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
215 229
 		$param = '&id='.$object->id.'&socid='.$socid;
216
-		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
217
-		if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.((int) $limit);
230
+		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
231
+			$param .= '&contextpage='.urlencode($contextpage);
232
+		}
233
+		if ($limit > 0 && $limit != $conf->liste_limit) {
234
+			$param .= '&limit='.((int) $limit);
235
+		}
218 236
 
219 237
 
220 238
 		//print load_fiche_titre($langs->trans("ActionsOnStockTransfer"), '', '');
Please login to merge, or discard this patch.
htdocs/product/stock/stocktransfer/stocktransfer_card.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 		if (empty($error)) {
185 185
 			$line = new StockTransferLine($db);
186
-			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
186
+			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'").')'));
187 187
 			if (!empty($records[key($records)])) $line = $records[key($records)];
188 188
 			$line->fk_stocktransfer = $id;
189 189
 			$line->qty += $qty;
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 // Affichage alerte date prévue de départ si transfert concerné
369 369
 $date_prevue_depart = $object->date_prevue_depart;
370 370
 $date_prevue_depart_plus_delai = $date_prevue_depart;
371
-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');
371
+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');
372 372
 if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
373 373
 	print "$('.valuefield.fieldname_date_prevue_depart').append('";
374 374
 	print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@@ -437,31 +437,31 @@  discard block
 block discarded – undo
437 437
 // Part to edit record
438 438
 if (($id || $ref) && $action == 'edit') {
439 439
 	//if($object->status < 3) {
440
-	print load_fiche_titre($langs->trans("StockTransfer"), '', 'object_' . $object->picto);
440
+	print load_fiche_titre($langs->trans("StockTransfer"), '', 'object_'.$object->picto);
441 441
 
442
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
443
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
442
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
443
+	print '<input type="hidden" name="token" value="'.newToken().'">';
444 444
 	print '<input type="hidden" name="action" value="update">';
445
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
446
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
447
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
445
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
446
+	if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
447
+	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
448 448
 
449 449
 	print dol_get_fiche_head();
450 450
 
451
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
451
+	print '<table class="border centpercent tableforfieldedit">'."\n";
452 452
 
453 453
 	// Common attributes
454
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
454
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
455 455
 
456 456
 	// Other attributes
457
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
457
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
458 458
 
459 459
 	print '</table>';
460 460
 
461 461
 	print dol_get_fiche_end();
462 462
 
463
-	print '<div class="center"><input type="submit" class="button" name="save" value="' . $langs->trans("Save") . '">';
464
-	print ' &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
463
+	print '<div class="center"><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
464
+	print ' &nbsp; <input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
465 465
 	print '</div>';
466 466
 
467 467
 	print '</form>';
@@ -492,28 +492,28 @@  discard block
 block discarded – undo
492 492
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
493 493
 	} elseif ($action == 'destock') { // Destock confirmation
494 494
 		// Create an array for form
495
-		$formquestion = array(	'text' => '',
495
+		$formquestion = array('text' => '',
496 496
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestock', $object->ref), 'size'=>40),
497 497
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
498 498
 		);
499 499
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProduct'), '', 'confirm_destock', $formquestion, 'yes', 1);
500 500
 	} elseif ($action == 'destockcancel') { // Destock confirmation cancel
501 501
 		// Create an array for form
502
-		$formquestion = array(	'text' => '',
502
+		$formquestion = array('text' => '',
503 503
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label"), 'value' => $langs->trans('ConfirmDestockCancel', $object->ref), 'size'=>40),
504 504
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
505 505
 		);
506 506
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DestockAllProductCancel'), '', 'confirm_destockcancel', $formquestion, 'yes', 1);
507 507
 	} elseif ($action == 'addstock') { // Addstock confirmation
508 508
 		// Create an array for form
509
-		$formquestion = array(	'text' => '',
509
+		$formquestion = array('text' => '',
510 510
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStock', $object->ref), 'size'=>40),
511 511
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
512 512
 		);
513 513
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('AddStockAllProduct'), '', 'confirm_addstock', $formquestion, 'yes', 1);
514 514
 	} elseif ($action == 'addstockcancel') { // Addstock confirmation cancel
515 515
 		// Create an array for form
516
-		$formquestion = array(	'text' => '',
516
+		$formquestion = array('text' => '',
517 517
 			array('type' => 'text', 'name' => 'label', 'label' => $langs->trans("Label").'&nbsp;:', 'value' => $langs->trans('ConfirmAddStockCancel', $object->ref), 'size'=>40),
518 518
 			array('type' => 'text', 'name' => 'inventorycode', 'label' => $langs->trans("InventoryCode"), 'value' => dol_print_date(dol_now(), '%y%m%d%H%M%S'), 'size'=>25)
519 519
 		);
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 
539 539
 
540 540
 	if ($action == 'valid' && $permissiontoadd) {
541
-		$nextref=$object->getNextNumRef();
541
+		$nextref = $object->getNextNumRef();
542 542
 		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $langs->transnoentities('ConfirmValidateStockTransfer', $nextref), 'confirm_validate', $formquestion, 0, 2);
543 543
 	}
544 544
 
@@ -560,25 +560,25 @@  discard block
 block discarded – undo
560 560
 
561 561
 	// Thirdparty
562 562
 	if (isModEnabled('societe')) {
563
-		$morehtmlref .= $langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '').'<br>';
563
+		$morehtmlref .= $langs->trans('ThirdParty').' : '.(is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '').'<br>';
564 564
 	}
565 565
 	// Project
566 566
 	if (isModEnabled('project')) {
567 567
 		$langs->load("projects");
568
-		$morehtmlref.=$langs->trans('Project') . ' ';
568
+		$morehtmlref .= $langs->trans('Project').' ';
569 569
 		if ($permissiontoadd) {
570 570
 			//if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&amp;id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
571
-			$morehtmlref.=' : ';
571
+			$morehtmlref .= ' : ';
572 572
 			if ($action == 'classify') {
573 573
 				//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
574
-				$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
575
-				$morehtmlref.='<input type="hidden" name="action" value="classin">';
576
-				$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
577
-				$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
578
-				$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
579
-				$morehtmlref.='</form>';
574
+				$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
575
+				$morehtmlref .= '<input type="hidden" name="action" value="classin">';
576
+				$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
577
+				$morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
578
+				$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
579
+				$morehtmlref .= '</form>';
580 580
 			} else {
581
-				$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
581
+				$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
582 582
 			}
583 583
 		} else {
584 584
 			if (!empty($object->fk_project)) {
@@ -606,8 +606,8 @@  discard block
 block discarded – undo
606 606
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
607 607
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
608 608
 
609
-	$object->fields['fk_soc']['visible']=0; // Already available in banner
610
-	$object->fields['fk_project']['visible']=0; // Already available in banner
609
+	$object->fields['fk_soc']['visible'] = 0; // Already available in banner
610
+	$object->fields['fk_project']['visible'] = 0; // Already available in banner
611 611
 	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
612 612
 
613 613
 	// Incoterms
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 
713 713
 	$param = '';
714 714
 
715
-	$conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE=true; // Full display needed to see all column title details
715
+	$conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE = true; // Full display needed to see all column title details
716 716
 
717 717
 	print '<tr class="liste_titre">';
718 718
 	print getTitleFieldOfList($langs->trans('ProductRef'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone ');
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 				print '<input type="submit" class="button buttongen marginbottomonly" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"></td>';
803 803
 			} else {
804 804
 				print '<td class="right">';
805
-				print '<a class="editfielda reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=editline&amp;lineid=' . $line->id . '#line_' . $line->id . '">';
806
-				print img_edit() . '</a>';
805
+				print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">';
806
+				print img_edit().'</a>';
807 807
 				print '</td>';
808 808
 				print '<td class="right">';
809
-				print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '&action=deleteline&lineid=' . $line->id . '">' . img_delete($langs->trans("Remove")) . '</a>';
809
+				print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$id.'&action=deleteline&lineid='.$line->id.'">'.img_delete($langs->trans("Remove")).'</a>';
810 810
 				print '</td>';
811 811
 			}
812 812
 
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 		$formproduct->loadWarehouses(); // Pour charger la totalité des entrepôts
860 860
 
861 861
 		// On stock ceux qui ne doivent pas être proposés dans la liste
862
-		$TExcludedWarehouseSource=array();
862
+		$TExcludedWarehouseSource = array();
863 863
 		if (!empty($object->fk_warehouse_source)) {
864 864
 			$source_ent = new Entrepot($db);
865 865
 			$source_ent->fetch($object->fk_warehouse_source);
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 		}
870 870
 
871 871
 		// On stock ceux qui ne doivent pas être proposés dans la liste
872
-		$TExcludedWarehouseDestination=array();
872
+		$TExcludedWarehouseDestination = array();
873 873
 		if (!empty($object->fk_warehouse_destination)) {
874 874
 			$dest_ent = new Entrepot($db);
875 875
 			$dest_ent->fetch($object->fk_warehouse_destination);
@@ -879,14 +879,14 @@  discard block
 block discarded – undo
879 879
 		}
880 880
 
881 881
 		// On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
882
-		$formproduct->cache_warehouses=array();
882
+		$formproduct->cache_warehouses = array();
883 883
 		// In warehouse
884 884
 		print '<td>';
885 885
 		print $formproduct->selectWarehouses(empty($fk_warehouse_source) ? $object->fk_warehouse_source : $fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
886 886
 		print '</td>';
887 887
 
888 888
 		// On vide le tableau pour qu'il se charge tout seul lors de l'appel à la fonction select_warehouses
889
-		$formproduct->cache_warehouses=array();
889
+		$formproduct->cache_warehouses = array();
890 890
 		// Out warehouse
891 891
 		print '<td>';
892 892
 		print $formproduct->selectWarehouses(empty($fk_warehouse_destination) ? $object->fk_warehouse_destination : $fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 		// PMP * Qty
904 904
 		print '<td></td>';
905 905
 		// Button to add line
906
-		print '<td class="right" colspan="2"><input type="submit" class="button" name="addline" value="' . dol_escape_htmltag($langs->trans('Add')) . '"></td>';
906
+		print '<td class="right" colspan="2"><input type="submit" class="button" name="addline" value="'.dol_escape_htmltag($langs->trans('Add')).'"></td>';
907 907
 		// Grad and drop lines
908 908
 		print '<td></td>';
909 909
 		print '</tr>';
@@ -1013,11 +1013,11 @@  discard block
 block discarded – undo
1013 1013
 		// Documents
1014 1014
 		if ($includedocgeneration) {
1015 1015
 			$objref = dol_sanitizeFileName($object->ref);
1016
-			$relativepath = $objref . '/' . $objref . '.pdf';
1016
+			$relativepath = $objref.'/'.$objref.'.pdf';
1017 1017
 			$filedir = $conf->stocktransfer->dir_output.'/'.$object->element.'/'.$objref;
1018
-			$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
1019
-			$genallowed = $user->rights->stocktransfer->stocktransfer->read;	// If you can read, you can build the PDF to read content
1020
-			$delallowed = $user->rights->stocktransfer->stocktransfer->write;	// If you can create/edit, you can remove a file on card
1018
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
1019
+			$genallowed = $user->rights->stocktransfer->stocktransfer->read; // If you can read, you can build the PDF to read content
1020
+			$delallowed = $user->rights->stocktransfer->stocktransfer->write; // If you can create/edit, you can remove a file on card
1021 1021
 			print $formfile->showdocuments('stocktransfer:StockTransfer', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
1022 1022
 		}
1023 1023
 
Please login to merge, or discard this patch.
Braces   +128 added lines, -49 removed lines patch added patch discarded remove patch
@@ -37,7 +37,9 @@  discard block
 block discarded – undo
37 37
 
38 38
 // Load translation files required by the page
39 39
 $langs->loadLangs(array("stocks", "other", "productbatch", "companies"));
40
- if (isModEnabled('incoterm')) $langs->load('incoterm');
40
+ if (isModEnabled('incoterm')) {
41
+ 	$langs->load('incoterm');
42
+ }
41 43
 
42 44
 // Get parameters
43 45
 $id = GETPOST('id', 'int');
@@ -72,10 +74,14 @@  discard block
 block discarded – undo
72 74
 $search_all = trim(GETPOST("search_all", 'alpha'));
73 75
 $search = array();
74 76
 foreach ($object->fields as $key => $val) {
75
-	if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
76
-}
77
+	if (GETPOST('search_'.$key, 'alpha')) {
78
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
79
+	}
80
+	}
77 81
 
78
-if (empty($action) && empty($id) && empty($ref)) $action = 'view';
82
+if (empty($action) && empty($id) && empty($ref)) {
83
+	$action = 'view';
84
+}
79 85
 
80 86
 // Load object
81 87
 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
@@ -94,7 +100,9 @@  discard block
 block discarded – undo
94 100
 //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
95 101
 //$result = restrictedArea($user, 'stocktransfer', $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
96 102
 
97
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
103
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
104
+	accessforbidden();
105
+}
98 106
 
99 107
 
100 108
 /*
@@ -107,7 +115,9 @@  discard block
 block discarded – undo
107 115
 
108 116
 $parameters = array();
109 117
 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
110
-if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
118
+if ($reshook < 0) {
119
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
120
+}
111 121
 
112 122
 if (empty($reshook)) {
113 123
 	$error = 0;
@@ -116,8 +126,11 @@  discard block
 block discarded – undo
116 126
 
117 127
 	if (empty($backtopage) || ($cancel && empty($id))) {
118 128
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
119
-			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist;
120
-			else $backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
129
+			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
130
+				$backtopage = $backurlforlist;
131
+			} else {
132
+				$backtopage = dol_buildpath('/product/stock/stocktransfer/stocktransfer_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
133
+			}
121 134
 		}
122 135
 	}
123 136
 	$triggermodname = 'STOCKTRANSFER_STOCKTRANSFER_MODIFY'; // Name of trigger action code to execute when we modify record
@@ -184,7 +197,9 @@  discard block
 block discarded – undo
184 197
 		if (empty($error)) {
185 198
 			$line = new StockTransferLine($db);
186 199
 			$records = $line->fetchAll('', '', 0, 0, array('customsql'=>' fk_stocktransfer = '.((int) $id).' AND fk_product = '.((int) $fk_product).' AND fk_warehouse_source = '.((int) $fk_warehouse_source).' AND fk_warehouse_destination = '.((int) $fk_warehouse_destination).' AND ('.(empty($batch) ? 'batch = "" or batch IS NULL' : "batch = '".$db->escape($batch)."'" ).')'));
187
-			if (!empty($records[key($records)])) $line = $records[key($records)];
200
+			if (!empty($records[key($records)])) {
201
+				$line = $records[key($records)];
202
+			}
188 203
 			$line->fk_stocktransfer = $id;
189 204
 			$line->qty += $qty;
190 205
 			$line->fk_warehouse_source = $fk_warehouse_source;
@@ -193,8 +208,9 @@  discard block
 block discarded – undo
193 208
 			$line->batch = $batch;
194 209
 
195 210
 			$line->pmp = $prod->pmp;
196
-			if ($line->id > 0) $line->update($user);
197
-			else {
211
+			if ($line->id > 0) {
212
+				$line->update($user);
213
+			} else {
198 214
 				$line->rang = (is_array($object->lines) || $object->lines instanceof Countable) ? count($object->lines) + 1 : 1;
199 215
 				$line->create($user);
200 216
 			}
@@ -257,10 +273,15 @@  discard block
 block discarded – undo
257 273
 				$db->begin();
258 274
 				foreach ($lines as $line) {
259 275
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source);
260
-					if ($res <= 0) $error++;
276
+					if ($res <= 0) {
277
+						$error++;
278
+					}
279
+				}
280
+				if (empty($error)) {
281
+					$db->commit();
282
+				} else {
283
+					$db->rollback();
261 284
 				}
262
-				if (empty($error)) $db->commit();
263
-				else $db->rollback();
264 285
 			}
265 286
 			if (empty($error)) {
266 287
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -278,10 +299,15 @@  discard block
 block discarded – undo
278 299
 				$db->begin();
279 300
 				foreach ($lines as $line) {
280 301
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_source, 0);
281
-					if ($res <= 0) $error++;
302
+					if ($res <= 0) {
303
+						$error++;
304
+					}
305
+				}
306
+				if (empty($error)) {
307
+					$db->commit();
308
+				} else {
309
+					$db->rollback();
282 310
 				}
283
-				if (empty($error)) $db->commit();
284
-				else $db->rollback();
285 311
 			}
286 312
 			if (empty($error)) {
287 313
 				$object->setStatut($object::STATUS_VALIDATED, $id);
@@ -299,10 +325,15 @@  discard block
 block discarded – undo
299 325
 				$db->begin();
300 326
 				foreach ($lines as $line) {
301 327
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination, 0);
302
-					if ($res <= 0) $error++;
328
+					if ($res <= 0) {
329
+						$error++;
330
+					}
331
+				}
332
+				if (empty($error)) {
333
+					$db->commit();
334
+				} else {
335
+					$db->rollback();
303 336
 				}
304
-				if (empty($error)) $db->commit();
305
-				else $db->rollback();
306 337
 			}
307 338
 			if (empty($error)) {
308 339
 				$object->setStatut($object::STATUS_CLOSED, $id);
@@ -320,10 +351,15 @@  discard block
 block discarded – undo
320 351
 				$db->begin();
321 352
 				foreach ($lines as $line) {
322 353
 					$res = $line->doStockMovement($label, $code_inv, $line->fk_warehouse_destination);
323
-					if ($res <= 0) $error++;
354
+					if ($res <= 0) {
355
+						$error++;
356
+					}
357
+				}
358
+				if (empty($error)) {
359
+					$db->commit();
360
+				} else {
361
+					$db->rollback();
324 362
 				}
325
-				if (empty($error)) $db->commit();
326
-				else $db->rollback();
327 363
 			}
328 364
 			if (empty($error)) {
329 365
 				$object->setStatut($object::STATUS_TRANSFERED, $id);
@@ -368,7 +404,9 @@  discard block
 block discarded – undo
368 404
 // Affichage alerte date prévue de départ si transfert concerné
369 405
 $date_prevue_depart = $object->date_prevue_depart;
370 406
 $date_prevue_depart_plus_delai = $date_prevue_depart;
371
-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');
407
+if ($object->lead_time_for_warning > 0) {
408
+	$date_prevue_depart_plus_delai = strtotime(date('Y-m-d', $date_prevue_depart) . ' + '.$object->lead_time_for_warning.' day');
409
+}
372 410
 if (!empty($date_prevue_depart) && $date_prevue_depart_plus_delai < strtotime(date('Y-m-d'))) {
373 411
 	print "$('.valuefield.fieldname_date_prevue_depart').append('";
374 412
 	print img_warning($langs->trans('Alert').' - '.$langs->trans('Late'));
@@ -386,8 +424,12 @@  discard block
 block discarded – undo
386 424
 	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
387 425
 	print '<input type="hidden" name="token" value="'.newToken().'">';
388 426
 	print '<input type="hidden" name="action" value="add">';
389
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
390
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
427
+	if ($backtopage) {
428
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
429
+	}
430
+	if ($backtopageforcancel) {
431
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
432
+	}
391 433
 
392 434
 	print dol_get_fiche_head(array(), '');
393 435
 
@@ -443,8 +485,12 @@  discard block
 block discarded – undo
443 485
 	print '<input type="hidden" name="token" value="' . newToken() . '">';
444 486
 	print '<input type="hidden" name="action" value="update">';
445 487
 	print '<input type="hidden" name="id" value="' . $object->id . '">';
446
-	if ($backtopage) print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
447
-	if ($backtopageforcancel) print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
488
+	if ($backtopage) {
489
+		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
490
+	}
491
+	if ($backtopageforcancel) {
492
+		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
493
+	}
448 494
 
449 495
 	print dol_get_fiche_head();
450 496
 
@@ -545,8 +591,11 @@  discard block
 block discarded – undo
545 591
 	// Call Hook formConfirm
546 592
 	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
547 593
 	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
548
-	if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
549
-	elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
594
+	if (empty($reshook)) {
595
+		$formconfirm .= $hookmanager->resPrint;
596
+	} elseif ($reshook > 0) {
597
+		$formconfirm = $hookmanager->resPrint;
598
+	}
550 599
 
551 600
 	// Print form confirm
552 601
 	print $formconfirm;
@@ -616,8 +665,11 @@  discard block
 block discarded – undo
616 665
 		print '<table width="100%" class="nobordernopadding"><tr><td>';
617 666
 		print $langs->trans('IncotermLabel');
618 667
 		print '<td><td class="right">';
619
-		if ($permissiontoadd && $action != 'editincoterm') print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
620
-		else print '&nbsp;';
668
+		if ($permissiontoadd && $action != 'editincoterm') {
669
+			print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
670
+		} else {
671
+			print '&nbsp;';
672
+		}
621 673
 		print '</td></tr></table>';
622 674
 		print '</td>';
623 675
 		print '<td>';
@@ -706,7 +758,9 @@  discard block
 block discarded – undo
706 758
 		<input type="hidden" name="mode" value="">
707 759
 		<input type="hidden" name="id" value="' . $object->id.'">
708 760
 		';
709
-	if ($lineid > 0) print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
761
+	if ($lineid > 0) {
762
+		print '<input type="hidden" name="lineid" value="'.$lineid.'" />';
763
+	}
710 764
 	print '<table id="tablelines" class="liste centpercent">';
711 765
 	//print '<div class="tagtable centpercent">';
712 766
 
@@ -753,32 +807,47 @@  discard block
 block discarded – undo
753 807
 
754 808
 		print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.'>';
755 809
 		print '<td class="titlefield">';
756
-		if ($action === 'editline' && $line->id == $lineid) $form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
757
-		else print $productstatic->getNomUrl(1).' - '.$productstatic->label;
810
+		if ($action === 'editline' && $line->id == $lineid) {
811
+			$form->select_produits($line->fk_product, 'fk_product', $filtertype, $limit, 0, -1, 2, '', 0, array(), 0, 0, 0, 'minwidth200imp maxwidth300', 1);
812
+		} else {
813
+			print $productstatic->getNomUrl(1).' - '.$productstatic->label;
814
+		}
758 815
 		print '</td>';
759 816
 		if (isModEnabled('productbatch')) {
760 817
 			print '<td>';
761
-			if ($action === 'editline' && $line->id == $lineid) print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
762
-			else {
818
+			if ($action === 'editline' && $line->id == $lineid) {
819
+				print '<input type="text" value="'.$line->batch.'" name="batch" class="flat maxwidth50"/>';
820
+			} else {
763 821
 				$productlot = new Productlot($db);
764 822
 				if ($productlot->fetch(0, $line->fk_product, $line->batch) > 0) {
765 823
 					print $productlot->getNomUrl(1);
766
-				} elseif (!empty($line->batch)) print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
824
+				} elseif (!empty($line->batch)) {
825
+					print $line->batch.'&nbsp;'.img_warning($langs->trans('BatchNotFound'));
826
+				}
767 827
 			}
768 828
 			print '</td>';
769 829
 		}
770 830
 
771 831
 		print '<td>';
772 832
 
773
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
774
-		else print $warehousestatics->getNomUrl(1);
833
+		if ($action === 'editline' && $line->id == $lineid) {
834
+			print $formproduct->selectWarehouses($line->fk_warehouse_source, 'fk_warehouse_source', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseSource);
835
+		} else {
836
+			print $warehousestatics->getNomUrl(1);
837
+		}
775 838
 		print '</td>';
776 839
 		print '<td>';
777
-		if ($action === 'editline' && $line->id == $lineid) print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
778
-		else print $warehousestatict->getNomUrl(1);
840
+		if ($action === 'editline' && $line->id == $lineid) {
841
+			print $formproduct->selectWarehouses($line->fk_warehouse_destination, 'fk_warehouse_destination', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, array(), 'minwidth200imp maxwidth200', $TExcludedWarehouseDestination);
842
+		} else {
843
+			print $warehousestatict->getNomUrl(1);
844
+		}
779 845
 		print '</td>';
780
-		if ($action === 'editline' && $line->id == $lineid) print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
781
-		else print '<td class="center">'.$line->qty.'</td>';
846
+		if ($action === 'editline' && $line->id == $lineid) {
847
+			print '<td class="center"><input type="text" class="flat maxwidth50" name="qty" value="'.$line->qty.'"></td>';
848
+		} else {
849
+			print '<td class="center">'.$line->qty.'</td>';
850
+		}
782 851
 
783 852
 		if ($conf->global->PRODUCT_USE_UNITS) {
784 853
 			print '<td class="linecoluseunit nowrap left">';
@@ -840,7 +909,9 @@  discard block
 block discarded – undo
840 909
 		// Product
841 910
 		print '<td class="titlefield">';
842 911
 		$filtertype = 0;
843
-		if (getDolGlobalString('STOCK_SUPPORTS_SERVICES')) $filtertype = '';
912
+		if (getDolGlobalString('STOCK_SUPPORTS_SERVICES')) {
913
+			$filtertype = '';
914
+		}
844 915
 		if (getDolGlobalInt('PRODUIT_LIMIT_SIZE') <= 0) {
845 916
 			$limit = '';
846 917
 		} else {
@@ -864,7 +935,9 @@  discard block
 block discarded – undo
864 935
 			$source_ent = new Entrepot($db);
865 936
 			$source_ent->fetch($object->fk_warehouse_source);
866 937
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
867
-				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) $TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
938
+				if (strpos($TDataCacheWarehouse['full_label'], $source_ent->label) === false) {
939
+					$TExcludedWarehouseSource[] = $TDataCacheWarehouse['id'];
940
+				}
868 941
 			}
869 942
 		}
870 943
 
@@ -874,7 +947,9 @@  discard block
 block discarded – undo
874 947
 			$dest_ent = new Entrepot($db);
875 948
 			$dest_ent->fetch($object->fk_warehouse_destination);
876 949
 			foreach ($formproduct->cache_warehouses as $TDataCacheWarehouse) {
877
-				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) $TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
950
+				if (strpos($TDataCacheWarehouse['full_label'], $dest_ent->label) === false) {
951
+					$TExcludedWarehouseDestination[] = $TDataCacheWarehouse['id'];
952
+				}
878 953
 			}
879 954
 		}
880 955
 
@@ -919,7 +994,9 @@  discard block
 block discarded – undo
919 994
 		print '<div class="tabsAction">'."\n";
920 995
 		$parameters = array();
921 996
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
922
-		if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
997
+		if ($reshook < 0) {
998
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
999
+		}
923 1000
 
924 1001
 		if (empty($reshook)) {
925 1002
 			// Send
@@ -1043,7 +1120,9 @@  discard block
 block discarded – undo
1043 1120
 	}
1044 1121
 
1045 1122
 	//Select mail models is same action as presend
1046
-	if (GETPOST('modelselected')) $action = 'presend';
1123
+	if (GETPOST('modelselected')) {
1124
+		$action = 'presend';
1125
+	}
1047 1126
 
1048 1127
 	// Presend form
1049 1128
 	$modelmail = 'stocktransfer';
Please login to merge, or discard this patch.
htdocs/product/stock/stockatdate.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	if ($productid > 0) {
155 155
 		$sql .= " AND ps.fk_product = ".((int) $productid);
156 156
 	}
157
-	if (! empty($search_fk_warehouse)) {
157
+	if (!empty($search_fk_warehouse)) {
158 158
 		$sql .= " AND ps.fk_entrepot IN (".$db->sanitize(join(",", $search_fk_warehouse)).")";
159 159
 	}
160 160
 	if ($search_ref) {
@@ -562,9 +562,9 @@  discard block
 block discarded – undo
562 562
 
563 563
 		if ($mode == 'future') {
564 564
 			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0, $dateendofday);
565
-			$stock = $prod->stock_theorique;		// virtual stock at a date
565
+			$stock = $prod->stock_theorique; // virtual stock at a date
566 566
 			$prod->load_stock('warehouseopen,warehouseinternal,nobatch', 0);
567
-			$virtualstock = $prod->stock_theorique;	// virtual stock in infinite future
567
+			$virtualstock = $prod->stock_theorique; // virtual stock in infinite future
568 568
 		} else {
569 569
 			$stock = $currentstock;
570 570
 			$nbofmovement = 0;
Please login to merge, or discard this patch.
htdocs/product/stock/class/entrepot.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * Warehouse open and any operations are allowed, but warehouse is not included into calculation of stock.
164 164
 	 */
165
-	const STATUS_OPENEXT_ALL = 3;	// TODO Implement this
165
+	const STATUS_OPENEXT_ALL = 3; // TODO Implement this
166 166
 
167 167
 
168 168
 
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 		}
653 653
 		$sql .= " WHERE ps.fk_entrepot = ".((int) $this->id);
654 654
 		if ($separatedPMP) {
655
-			$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ". (int) $conf->entity;
655
+			$sql .= " AND pa.fk_product = p.rowid AND pa.entity = ".(int) $conf->entity;
656 656
 		}
657 657
 		$sql .= " AND ps.fk_product = p.rowid";
658 658
 		//print $sql;
@@ -737,9 +737,9 @@  discard block
 block discarded – undo
737 737
 		}
738 738
 		// show categories for this record only in ajax to not overload lists
739 739
 		if (!$nofetch && isModEnabled('categorie')) {
740
-			require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
740
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
741 741
 			$form = new Form($this->db);
742
-			$datas['categories_warehouse'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_WAREHOUSE, 1, 1);
742
+			$datas['categories_warehouse'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_WAREHOUSE, 1, 1);
743 743
 		}
744 744
 
745 745
 		return $datas;
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 				$label = $langs->trans("Warehouse");
806 806
 				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
807 807
 			}
808
-			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' :  ' title="tocomplete"');
808
+			$linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
809 809
 			$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
810 810
 		}
811 811
 
Please login to merge, or discard this patch.
htdocs/product/stock/stats/reception.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 
40 40
 $id = GETPOST('id', 'int');
41 41
 $ref = GETPOST('ref', 'alpha');
42
-$batch  	= GETPOST('batch', 'alpha');
43
-$objectid  = GETPOST('productid', 'int');
42
+$batch = GETPOST('batch', 'alpha');
43
+$objectid = GETPOST('productid', 'int');
44 44
 
45 45
 // Security check
46 46
 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@
 block discarded – undo
81 81
 	$search_year = '';
82 82
 }
83 83
 
84
-if (!$user->hasRight('produit', 'lire')) accessforbidden();
84
+if (!$user->hasRight('produit', 'lire')) {
85
+	accessforbidden();
86
+}
85 87
 
86 88
 
87 89
 /*
Please login to merge, or discard this patch.
htdocs/product/stock/stats/expedition.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@
 block discarded – undo
39 39
 
40 40
 $id = GETPOST('id', 'int');
41 41
 $ref = GETPOST('ref', 'alpha');
42
-$batch  	= GETPOST('batch', 'alpha');
43
-$objectid  = GETPOST('productid', 'int');
42
+$batch = GETPOST('batch', 'alpha');
43
+$objectid = GETPOST('productid', 'int');
44 44
 
45 45
 // Security check
46 46
 $fieldvalue = (!empty($id) ? $id : (!empty($ref) ? $ref : ''));
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,9 @@
 block discarded – undo
81 81
 	$search_year = '';
82 82
 }
83 83
 
84
-if (!$user->hasRight('produit', 'lire')) accessforbidden();
84
+if (!$user->hasRight('produit', 'lire')) {
85
+	accessforbidden();
86
+}
85 87
 
86 88
 
87 89
 /*
Please login to merge, or discard this patch.
htdocs/product/stock/card.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -601,9 +601,9 @@
 block discarded – undo
601 601
 
602 602
 
603 603
 			$totalarray = array();
604
-			$totalarray['val'] = array ();
605
-			$totalarray['pos'] = array ();
606
-			$totalarray['type'] = array ();
604
+			$totalarray['val'] = array();
605
+			$totalarray['pos'] = array();
606
+			$totalarray['type'] = array();
607 607
 			$totalarray['nbfield'] = 0;
608 608
 
609 609
 			// TODO Create $arrayfields with all fields to show
Please login to merge, or discard this patch.
htdocs/product/stock/replenish.php 2 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -672,8 +672,12 @@  discard block
 block discarded – undo
672 672
 if ($limit > 0 && $limit != $conf->liste_limit) {
673 673
 	$filters .= '&limit='.((int) $limit);
674 674
 }
675
-if (!empty($includeproductswithoutdesiredqty)) $filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
676
-if (!empty($salert)) $filters .= '&salert='.urlencode($salert);
675
+if (!empty($includeproductswithoutdesiredqty)) {
676
+	$filters .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
677
+}
678
+if (!empty($salert)) {
679
+	$filters .= '&salert='.urlencode($salert);
680
+}
677 681
 
678 682
 $param = (isset($type) ? '&type='.urlencode($type) : '');
679 683
 $param .= '&fourn_id='.urlencode($fourn_id).'&search_label='.urlencode($search_label).'&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty).'&salert='.urlencode($salert).'&draftorder='.urlencode($draftorder);
@@ -681,8 +685,12 @@  discard block
 block discarded – undo
681 685
 $param .= '&mode='.urlencode($mode);
682 686
 $param .= '&fk_supplier='.urlencode($fk_supplier);
683 687
 $param .= '&fk_entrepot='.urlencode($fk_entrepot);
684
-if (!empty($includeproductswithoutdesiredqty)) $param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
685
-if (!empty($salert)) $param .= '&salert='.urlencode($salert);
688
+if (!empty($includeproductswithoutdesiredqty)) {
689
+	$param .= '&includeproductswithoutdesiredqty='.urlencode($includeproductswithoutdesiredqty);
690
+}
691
+if (!empty($salert)) {
692
+	$param .= '&salert='.urlencode($salert);
693
+}
686 694
 
687 695
 $stocklabel = $langs->trans('Stock');
688 696
 $stocklabelbis = $langs->trans('Stock');
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 $fk_entrepot = GETPOST('fk_entrepot', 'int');
69 69
 
70 70
 // List all visible warehouses
71
-$resWar = $db->query("SELECT rowid FROM " . MAIN_DB_PREFIX . "entrepot WHERE entity IN (" . $db->sanitize(getEntity('stock')) .")");
71
+$resWar = $db->query("SELECT rowid FROM ".MAIN_DB_PREFIX."entrepot WHERE entity IN (".$db->sanitize(getEntity('stock')).")");
72 72
 $listofqualifiedwarehousesid = "";
73 73
 $count = 0;
74 74
 while ($tmpobj = $db->fetch_object($resWar)) {
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 $sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
363 363
 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
364 364
 $list_warehouse = (empty($listofqualifiedwarehousesid) ? '0' : $listofqualifiedwarehousesid);
365
-$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse) .')';
365
+$sql .= ' AND s.fk_entrepot  IN ('.$db->sanitize($list_warehouse).')';
366 366
 
367 367
 //$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot AS ent ON s.fk_entrepot = ent.rowid AND ent.entity IN('.getEntity('stock').')';
368 368
 if (getDolGlobalString('STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE') && $fk_entrepot > 0) {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 			exit;
806 806
 		}
807 807
 
808
-		$prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock?', novirtual':''), $draftchecked);
808
+		$prod->load_stock('warehouseopen, warehouseinternal'.(!$usevirtualstock ? ', novirtual' : ''), $draftchecked);
809 809
 
810 810
 		// Multilangs
811 811
 		if (getDolGlobalInt('MAIN_MULTILANGS')) {
Please login to merge, or discard this patch.
htdocs/product/stock/tpl/extrafields_add.tpl.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@
 block discarded – undo
36 36
 <?php
37 37
 
38 38
 // Other attributes
39
-if (!isset($parameters)) $parameters = array();
39
+if (!isset($parameters)) {
40
+	$parameters = array();
41
+}
40 42
 
41 43
 $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
42 44
 print $hookmanager->resPrint;
Please login to merge, or discard this patch.