diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 414ec11fb5a..339c1cef9c9 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -128,7 +128,8 @@ if ($action == 'initbarcodethirdparties') { if ($resql) { $num = $db->num_rows($resql); - $i = 0; $nbok = $nbtry = 0; + $i = 0; + $nbok = $nbtry = 0; while ($i < min($num, $maxperinit)) { $obj = $db->fetch_object($resql); if ($obj) { @@ -230,7 +231,8 @@ if ($action == 'initbarcodeproducts') { if ($resql) { $num = $db->num_rows($resql); - $i = 0; $nbok = $nbtry = 0; + $i = 0; + $nbok = $nbtry = 0; while ($i < min($num, $maxperinit)) { $obj = $db->fetch_object($resql); if ($obj) { diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index ca8be4d2ed5..9c25611a822 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -110,7 +110,8 @@ if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) { } if ($action == 'builddoc') { - $result = 0; $error = 0; + $result = 0; + $error = 0; if (empty($forbarcode)) { // barcode value setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors'); @@ -313,7 +314,7 @@ foreach (array_keys($_Avery_Labels) as $codecards) { $arrayoflabels[$codecards] = $labeltoshow; } asort($arrayoflabels); -print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ?GETPOST('modellabel') : $conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); +print $form->selectarray('modellabel', $arrayoflabels, (GETPOST('modellabel') ? GETPOST('modellabel') : $conf->global->ADHERENT_ETIQUETTE_TYPE), 1, 0, 0, '', 0, 0, 0, '', '', 1); print ''; // Number of stickers to print @@ -321,7 +322,7 @@ print '
'; print '
'; print $langs->trans("NumberOfStickers").'   '; print '
'; -print ''; +print ''; print '
'; print ''; diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 4976d63ff01..e73f4cb1196 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -151,7 +151,7 @@ $countryArray = array(); $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { - $countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); + $countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); } } diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index cc13b072507..70611f174e9 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -42,7 +42,7 @@ if ((!$user->admin && !$user->hasRight('blockedlog', 'read')) || empty($conf->bl // Get Parameters $action = GETPOST('action', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'blockedloglist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') @@ -80,7 +80,7 @@ if (($search_start == -1 || empty($search_start)) && !GETPOSTISSET('search_start } // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -160,8 +160,8 @@ if ($action === 'downloadblockchain') { $sql .= " FROM ".MAIN_DB_PREFIX."blockedlog"; $sql .= " WHERE entity = ".$conf->entity; if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) { - $dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1); - $datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12); + $dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ? GETPOST('monthtoexport', 'int') : 1); + $datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ? GETPOST('monthtoexport', 'int') : 12); $sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; } $sql .= " ORDER BY rowid ASC"; // Required so we get the first one @@ -190,8 +190,8 @@ if ($action === 'downloadblockchain') { $sql .= " FROM ".MAIN_DB_PREFIX."blockedlog"; $sql .= " WHERE entity = ".((int) $conf->entity); if (GETPOST('monthtoexport', 'int') > 0 || GETPOST('yeartoexport', 'int') > 0) { - $dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 1); - $datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ?GETPOST('monthtoexport', 'int') : 12); + $dates = dol_get_first_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ? GETPOST('monthtoexport', 'int') : 1); + $datee = dol_get_last_day(GETPOST('yeartoexport', 'int'), GETPOST('monthtoexport', 'int') ? GETPOST('monthtoexport', 'int') : 12); $sql .= " AND date_creation BETWEEN '".$db->idate($dates)."' AND '".$db->idate($datee)."'"; } $sql .= " ORDER BY rowid ASC"; // Required so later we can use the parameter $previoushash of checkSignature() @@ -200,7 +200,7 @@ if ($action === 'downloadblockchain') { if ($res) { header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); - header("Content-disposition: attachment; filename=\"unalterable-log-archive-".$dolibarr_main_db_name."-".(GETPOST('yeartoexport', 'int') > 0 ? GETPOST('yeartoexport', 'int').(GETPOST('monthtoexport', 'int') > 0 ?sprintf("%02d", GETPOST('monthtoexport', 'int')) : '').'-' : '').$previoushash.".csv\""); + header("Content-disposition: attachment; filename=\"unalterable-log-archive-".$dolibarr_main_db_name."-".(GETPOST('yeartoexport', 'int') > 0 ? GETPOST('yeartoexport', 'int').(GETPOST('monthtoexport', 'int') > 0 ? sprintf("%02d", GETPOST('monthtoexport', 'int')) : '').'-' : '').$previoushash.".csv\""); print $langs->transnoentities('Id') .';'.$langs->transnoentities('Date') @@ -230,7 +230,7 @@ if ($action === 'downloadblockchain') { $block_static->action = $obj->action; $block_static->fk_object = $obj->fk_object; $block_static->element = $obj->element; - $block_static->amounts = (double) $obj->amounts; + $block_static->amounts = (float) $obj->amounts; $block_static->ref_object = $obj->ref_object; $block_static->date_object = $db->jdate($obj->date_object); $block_static->user_fullname = $obj->user_fullname; diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index d95a7499fee..683276a82fb 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -78,7 +78,6 @@ class BlockedLogAuthority */ public function getLocalBlockChain() { - $block_static = new BlockedLog($this->db); $this->signature = $block_static->getSignature(); @@ -103,7 +102,6 @@ class BlockedLogAuthority */ public function getBlockchainHash() { - return md5($this->signature.$this->blockchain); } @@ -115,7 +113,6 @@ class BlockedLogAuthority */ public function checkBlockchain($hash) { - return ($hash === $this->getBlockchainHash()); } @@ -127,7 +124,6 @@ class BlockedLogAuthority */ public function addBlock($block) { - $this->blockchain .= $block; } @@ -139,7 +135,6 @@ class BlockedLogAuthority */ public function checkBlock($block) { - if (strlen($block) != 64) { return false; } @@ -215,7 +210,6 @@ class BlockedLogAuthority */ public function create($user) { - global $conf, $langs, $hookmanager; $langs->load('blockedlog'); @@ -263,7 +257,6 @@ class BlockedLogAuthority */ public function update($user) { - global $conf, $langs, $hookmanager; $langs->load('blockedlog'); diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 08265f8c472..27a05d81e0e 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -762,7 +762,7 @@ class BlockedLog $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->tms); - $this->amounts = (double) $obj->amounts; + $this->amounts = (float) $obj->amounts; $this->action = $obj->action; $this->element = $obj->element; @@ -840,7 +840,6 @@ class BlockedLog */ public function setCertified() { - $res = $this->db->query("UPDATE ".MAIN_DB_PREFIX."blockedlog SET certified=1 WHERE rowid=".((int) $this->id)); if (!$res) { return false; @@ -865,7 +864,7 @@ class BlockedLog $error = 0; // Clean data - $this->amounts = (double) $this->amounts; + $this->amounts = (float) $this->amounts; dol_syslog(get_class($this).'::create action='.$this->action.' fk_user='.$this->fk_user.' user_fullname='.$this->user_fullname, LOG_DEBUG); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index b84b3df5173..88f2a4c8504 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -49,14 +49,14 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); // Load variables for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 15ccc6e7bf3..816ad0190a8 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -42,7 +42,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -176,8 +176,12 @@ if (empty($reshook)) { if (!empty($idprod) && isModEnabled('workstation')) { $product = new Product($db); $res = $product->fetch($idprod); - if ($res > 0 && $product->type == Product::TYPE_SERVICE) $fk_default_workstation = $product->fk_default_workstation; - if (empty($fk_unit)) $fk_unit = $product->fk_unit; + if ($res > 0 && $product->type == Product::TYPE_SERVICE) { + $fk_default_workstation = $product->fk_default_workstation; + } + if (empty($fk_unit)) { + $fk_unit = $product->fk_unit; + } } if ($qty == '') { @@ -544,40 +548,40 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } */ - $morehtmlref .= ''; + $morehtmlref .= ''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; - print ''."\n"; + print '
'; + print '
'; + print '
'; + print '
'."\n"; - // Common attributes - $keyforbreak = 'duration'; - include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - $object->calculateCosts(); - print ''; - print ''; + // Common attributes + $keyforbreak = 'duration'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + $object->calculateCosts(); + print ''; + print ''; - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print '
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'.$form->textwithpicto($langs->trans("TotalCost"), $langs->trans("BOMTotalCost")).''.price($object->total_cost).'
'.$langs->trans("UnitCost").''.price($object->unit_cost).'
'; - print '
'; - print '
'; + print ''; + print ''; + print ''; - print '
'; + print '
'; - print dol_get_fiche_end(); + print dol_get_fiche_end(); - /* - * Lines - */ + /* + * Lines + */ if (!empty($object->table_element_line)) { // Products @@ -615,9 +619,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if (empty($reshook)) { $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); + } } } @@ -662,9 +669,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add services form $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectServiceLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if (empty($reshook)) { $object->formAddObjectLine(1, $mysoc, null, '/bom/tpl'); + } } } } @@ -672,17 +682,17 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } - print ''; + print ''; - print "\n"; + print "\n"; - mrpCollapseBomManagement(); + mrpCollapseBomManagement(); - $res = $object->fetchLines(); + $res = $object->fetchLines(); - // Buttons for actions + // Buttons for actions if ($action != 'presend' && $action != 'editline') { print '
'."\n"; @@ -696,16 +706,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Send //if (empty($user->socid)) { // print '' . $langs->trans('SendMail') . ''."\n"; - //} + //} - // Back to draft + // Back to draft if ($object->status == $object::STATUS_VALIDATED) { if ($permissiontoadd) { print ''.$langs->trans("SetToDraft").''."\n"; } } - // Modify + // Modify if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; @@ -714,7 +724,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - // Validate + // Validate if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { if (is_array($object->lines) && count($object->lines) > 0) { @@ -726,50 +736,50 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - // Re-open + // Re-open if ($permissiontoadd && $object->status == $object::STATUS_CANCELED) { print ''.$langs->trans("ReOpen").''."\n"; } - // Create MO + // Create MO if (isModEnabled('mrp')) { if ($object->status == $object::STATUS_VALIDATED && $user->hasRight('mrp', 'write')) { print ''.$langs->trans("CreateMO").''."\n"; } } - // Clone + // Clone if ($permissiontoadd) { print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : "").'&action=clone&object=bom', 'clone', $permissiontoadd); } - // Close / Cancel + // Close / Cancel if ($permissiontoadd && $object->status == $object::STATUS_VALIDATED) { print ''.$langs->trans("Disable").''."\n"; } - /* - if ($user->rights->bom->write) - { - if ($object->status == 1) - { - print ''.$langs->trans("Disable").''."\n"; - } - else - { - print ''.$langs->trans("Enable").''."\n"; - } - } - */ + /* + if ($user->rights->bom->write) + { + if ($object->status == 1) + { + print ''.$langs->trans("Disable").''."\n"; + } + else + { + print ''.$langs->trans("Enable").''."\n"; + } + } + */ - // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + // Delete + print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); } print '
'."\n"; } - // Select mail models is same action as presend + // Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } @@ -806,18 +816,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } - //Select mail models is same action as presend + //Select mail models is same action as presend if (GETPOST('modelselected')) { $action = 'presend'; } - // Presend form - $modelmail = 'bom'; - $defaulttopic = 'InformationMessage'; - $diroutput = $conf->bom->dir_output; - $trackid = 'bom'.$object->id; + // Presend form + $modelmail = 'bom'; + $defaulttopic = 'InformationMessage'; + $diroutput = $conf->bom->dir_output; + $trackid = 'bom'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; } diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 88fbdde11c7..df5a9044bf5 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -118,7 +118,7 @@ if ($object->id) { // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 79e5a81ff28..9d4ee2b757c 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -34,20 +34,20 @@ $langs->loadLangs(array('mrp', 'other')); // Get Parameters $id = GETPOST('id', 'int'); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomlist'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'alpha'); // mode view (kanban or common) // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST('page', 'int'); diff --git a/htdocs/bom/bom_net_needs.php b/htdocs/bom/bom_net_needs.php index a76198e021d..14821d68a42 100644 --- a/htdocs/bom/bom_net_needs.php +++ b/htdocs/bom/bom_net_needs.php @@ -39,7 +39,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bomnet_needs'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); @@ -115,8 +115,11 @@ if (empty($reshook)) { } } } - if ($action == 'treeview') $object->getNetNeedsTree($TChildBom, 1); - else $object->getNetNeeds($TChildBom, 1); + if ($action == 'treeview') { + $object->getNetNeedsTree($TChildBom, 1); + } else { + $object->getNetNeeds($TChildBom, 1); + } } @@ -187,8 +190,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print dol_get_fiche_end(); - $viewlink = dolGetButtonTitle($langs->trans('GroupByX', $langs->transnoentitiesnoconv("Products")), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected':''))); - $viewlink .= dolGetButtonTitle($langs->trans('TreeView'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected':''))); + $viewlink = dolGetButtonTitle($langs->trans('GroupByX', $langs->transnoentitiesnoconv("Products")), '', 'fa fa-bars imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&token='.newToken(), '', 1, array('morecss' => 'reposition '.($action !== 'treeview' ? 'btnTitleSelected' : ''))); + $viewlink .= dolGetButtonTitle($langs->trans('TreeView'), '', 'fa fa-stream imgforviewmode', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=treeview&token='.newToken(), '', 1, array('morecss' => 'reposition marginleftonly '.($action == 'treeview' ? 'btnTitleSelected' : ''))); print load_fiche_titre($langs->trans("BOMNetNeeds"), $viewlink, 'product'); @@ -214,7 +217,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.img_picto('', 'folder', 'class="paddingright"').$langs->trans("UndoExpandAll").' '; } print ''; - if ($action == 'treeview') print ''.$langs->trans('ProducedBy').''; + if ($action == 'treeview') { + print ''.$langs->trans('ProducedBy').''; + } print ''.$langs->trans('Quantity').''; print ''.$form->textwithpicto($langs->trans("PhysicalStock"), $text_stock_options, 1).''; print ''.$form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")).''; @@ -229,15 +234,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (!empty($TProduct['bom'])) { $prod = new Product($db); $prod->fetch($TProduct['bom']->fk_product); - if ($TProduct['parentid'] != $object->id) print ''; - else print ''; - if ($action == 'treeview') print ''.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1); - else print ''.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); + if ($TProduct['parentid'] != $object->id) { + print ''; + } else { + print ''; + } + if ($action == 'treeview') { + print ''.str_repeat($repeatChar, $TProduct['level']).$prod->getNomUrl(1); + } else { + print ''.str_repeat($repeatChar, $TProduct['level']).$TProduct['bom']->getNomUrl(1); + } print ' '; print img_picto('', 'folder-open'); print ''; print ''; - if ($action == 'treeview') print ''.$TProduct['bom']->getNomUrl(1).''; + if ($action == 'treeview') { + print ''.$TProduct['bom']->getNomUrl(1).''; + } print ''.$TProduct['qty'].''; print ''; print ''; @@ -248,11 +261,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if (empty($prod->stock_reel)) $prod->stock_reel = 0; - if ($fk_bom != $object->id) print ''; - else print ''; + if (empty($prod->stock_reel)) { + $prod->stock_reel = 0; + } + if ($fk_bom != $object->id) { + print ''; + } else { + print ''; + } print ''.str_repeat($repeatChar, $TInfos['level']).$prod->getNomUrl(1).''; - if ($action == 'treeview') print ''; + if ($action == 'treeview') { + print ''; + } print ''.$TInfos['qty'].''; print ''.price2num($prod->stock_reel, 'MS').''; print ''.$prod->stock_theorique.''; @@ -265,7 +285,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $prod = new Product($db); $prod->fetch($fk_product); $prod->load_virtual_stock(); - if (empty($prod->stock_reel)) $prod->stock_reel = 0; + if (empty($prod->stock_reel)) { + $prod->stock_reel = 0; + } print ''; print ''.$prod->getNomUrl(1).''; print ''.$qty.''; @@ -289,10 +311,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } - print ''; - - - ?> + print ''; ?>