diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5853729bdd0..e37cecf0a43 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -65,7 +65,17 @@ jobs: - name: Setup PHPCS uses: shivammathur/setup-php@v2 - if: steps.changed-php.outputs.any_changed == 'true' + # Install when we're going to run phpcs + if: | + steps.changed-php.outputs.any_changed == 'true' + || + ( + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) + ) with: php-version: 8.1 coverage: none # disable xdebug, pcov @@ -79,6 +89,17 @@ jobs: set -o pipefail pre-commit run php-cs --files ${ALL_CHANGED_FILES} | tee -a ${RAW_LOG} + - name: Run some pre-commit hooks on all files on push to "main" branches + if: | + github.event_name == 'push' + && ( + github.event.ref == 'refs/heads/develop' + || endsWith(github.event.ref, '.0') + ) + run: | + set -o pipefail + pre-commit run -a php-cs | tee -a ${RAW_LOG} + # If error, we convert log in the checkstyle format - name: Convert Raw Log to CheckStyle format if: ${{ failure() }} diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 8aa8ac23537..5df4e184b93 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -915,6 +915,12 @@ while ($currentdaytoshow < $lastdaytoshow) { } } $sql .= " AND u.statut = 1"; + if ($filtert > 0) { + $sql .= " AND u.rowid = ".((int) $filtert); + } + if ($usergroup > 0) { + $sql .= " AND ug.fk_usergroup = ".((int) $usergroup); + } if ($user->socid > 0) { // External users should see only contacts of their company $sql .= " AND u.fk_soc = ".((int) $user->socid); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 82a713b8f3c..8c425f3f9db 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9514,7 +9514,7 @@ abstract class CommonObject $this->$field = (float) $obj->$field; } } else { - if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (isset($obj->$field) && (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1))) { $this->$field = (int) $obj->$field; } else { $this->$field = null; @@ -9529,7 +9529,7 @@ abstract class CommonObject $this->$field = (float) $obj->$field; } } else { - if (isset($obj->$field) && !is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1)) { + if (isset($obj->$field) && (!is_null($obj->$field) || (isset($info['notnull']) && $info['notnull'] == 1))) { $this->$field = (float) $obj->$field; } else { $this->$field = null; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index fa4fcbe9ebd..1cd3886e63e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2044,7 +2044,7 @@ class CommandeFournisseur extends CommonOrder $this->line->total_localtax2 = $total_localtax2; $this->line->total_ttc = $total_ttc; $this->line->product_type = $type; - $this->line->special_code = (!empty($this->special_code) ? $this->special_code : 0); + $this->line->special_code = (!empty($special_code) ? $special_code : 0); $this->line->origin = $origin; $this->line->origin_id = $origin_id; $this->line->fk_unit = $fk_unit; diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 2531a2d25cc..0e5305640bc 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -294,7 +294,7 @@ if (empty($reshook)) { if ($pay != "delayed") { $payment->create($user); - $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); if ($res < 0) { $error++; dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1);