From 9fc2d9fc038c63d237ac40464fd25809df33b8b4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 6 Jul 2021 19:02:03 +0200 Subject: [PATCH] Fix phpcs --- htdocs/bom/bom_list.php | 2 +- htdocs/core/lib/functions.lib.php | 2 +- htdocs/expensereport/card.php | 18 +++++++++--------- htdocs/expensereport/index.php | 2 +- htdocs/install/upgrade2.php | 1 - htdocs/mrp/mo_list.php | 4 ++-- htdocs/takepos/invoice.php | 1 - htdocs/user/class/user.class.php | 2 +- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 6b54e8a4044..b9a279ae943 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -321,7 +321,7 @@ if ($object->ismultientitymanaged == 1) { foreach ($search as $key => $val) { if (array_key_exists($key, $object->fields)) { if ($key == 'status' && $search[$key] == -1) { - continue; + continue; } $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4a15fc26707..60ffa14b75d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -783,7 +783,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = try { $dom = new DOMDocument; $dom->loadHTML($out, LIBXML_ERR_NONE|LIBXML_HTML_NOIMPLIED|LIBXML_HTML_NODEFDTD|LIBXML_NONET|LIBXML_NOWARNING|LIBXML_NOXMLDECL); - } catch(Exception $e) { + } catch (Exception $e) { //print $e->getMessage(); return 'InvalidHTMLString'; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index d207ffd20c1..c01c720f481 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -1675,15 +1675,15 @@ if ($action == 'create') { print ''; print ''.$langs->trans("User").''; print ''; - if ($object->fk_user_author > 0) { - $userauthor = new User($db); - $result = $userauthor->fetch($object->fk_user_author); - if ($result < 0) { - dol_print_error('', $userauthor->error); - } elseif ($result > 0) { - print $userauthor->getNomUrl(-1); - } - } + if ($object->fk_user_author > 0) { + $userauthor = new User($db); + $result = $userauthor->fetch($object->fk_user_author); + if ($result < 0) { + dol_print_error('', $userauthor->error); + } elseif ($result > 0) { + print $userauthor->getNomUrl(-1); + } + } print ''; // Period diff --git a/htdocs/expensereport/index.php b/htdocs/expensereport/index.php index c350f3ae2b4..c87cc08fb40 100644 --- a/htdocs/expensereport/index.php +++ b/htdocs/expensereport/index.php @@ -139,7 +139,7 @@ $dataseries = dol_sort_array($dataseries, 1, 'desc'); $KEEPNFIRST = 7; // Keep first $KEEPNFIRST one + 1 with the remain $i = 0; if (count($dataseries) > ($KEEPNFIRST + 1)) { - foreach($dataseries as $key => $val) { + foreach ($dataseries as $key => $val) { if ($i < $KEEPNFIRST) { $i++; continue; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 5960b92f793..eb778f521ad 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4984,4 +4984,3 @@ function migrate_export_import_profiles($mode = 'export') print ''.$langs->trans("NothingToDo")."\n"; } } - diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 91821d38ee2..6b4351bed6c 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -236,8 +236,8 @@ foreach ($search as $key => $val) { $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0); if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) { if ($search[$key] == '-1' || $search[$key] === '0') { - $search[$key] = ''; - } + $search[$key] = ''; + } $mode_search = 2; } if ($search[$key] != '') { diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 3246b24cc5c..f55f84130b6 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -707,7 +707,6 @@ if ($action == "updatereduction") { // Reload data $invoice->fetch($placeid); - } elseif ($action == 'update_reduction_global') { foreach ($invoice->lines as $line) { $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $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); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ef530cbe6f5..0bde31dec50 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -3223,7 +3223,7 @@ class User extends CommonObject if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) { unset($this->users[$key]); - } + } } }