From c496df7dfeb084aedc27b773d954bd654225caf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 16 Nov 2024 11:39:55 +0100 Subject: [PATCH] test github token (#31931) * test github token * solving errors * test github token * test * test * fix * fix * fix * fix * fix --- .github/workflows/phpstan_baseline.yml | 21 +++++++++++--------- htdocs/comm/propal/stats/index.php | 18 ++++++----------- htdocs/commande/stats/index.php | 5 ++--- htdocs/product/stock/productlot_document.php | 2 ++ 4 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/phpstan_baseline.yml b/.github/workflows/phpstan_baseline.yml index 618a2d266900a..9503c25de7749 100644 --- a/.github/workflows/phpstan_baseline.yml +++ b/.github/workflows/phpstan_baseline.yml @@ -1,9 +1,9 @@ name: 'PHPStan baseline' on: - # Every Thursday we want to refresh the baseline + # Every day we want to refresh the baseline schedule: - - cron: '0 6 * * 4' + - cron: '0 12 * * *' # We want to be able to manually refresh the baseline too workflow_dispatch: @@ -14,18 +14,21 @@ on: required: true type: string # Run PHPStan analyse on pull requests - #pull_request: + # pull_request: + +permissions: {} # none env: PHP_VERSION: '8.2' + GH_TOKEN: ${{ github.token }} gh_event: ${{ inputs.gh_event || github.event_name }} CACHE_KEY_PART: ${{ ( inputs.gh_event == 'pull_request' || github.event_name == 'pull_request' ) && format('{0}-{1}', github.base_ref, github.head_ref) || github.ref_name }} jobs: phpstan: runs-on: ubuntu-latest - permissions: write-all - # contents: write - # pull-requests: write + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 @@ -54,7 +57,7 @@ jobs: phpstan-cache-${{ env.PHP_VERSION }}- - uses: ruudk/phpstan-baseline-refresh-create-pr-action@main with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ env.GH_TOKEN }} phpstan_path: phpstan configuration_path: phpstan.neon.dist phpstan_additional_arguments: --memory-limit 7G -a build/phpstan/bootstrap_action.php @@ -63,8 +66,8 @@ jobs: commit_email: dolibarr-bot@users.noreply.github.com commit_message: PHPStan > Update baseline target_branch: develop - pr_create: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && 1 || 0 }} - # pr_create: 1 + # pr_create: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule') && 1 || 0 }} + pr_create: 1 pr_title: PHPStan > Update baseline pr_reviewer: eldy pr_body: | diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 55c4d15f18fda..ff88cc5e51f9a 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -97,18 +97,12 @@ $langs->loadLangs(array('propal', 'other', 'companies')); -$picto = null; -$dir = null; -$cat_type = null; -$cat_label = null; - -if ($mode == 'customer') { - $picto = 'propal'; - $title = $langs->trans("ProposalsStatistics"); - $dir = $conf->propal->dir_temp; - $cat_type = Categorie::TYPE_CUSTOMER; - $cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); -} +$picto = 'propal'; +$title = $langs->trans("ProposalsStatistics"); +$dir = $conf->propal->dir_temp; +$cat_type = Categorie::TYPE_CUSTOMER; +$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Customer")); + if ($mode == 'supplier') { $picto = 'supplier_proposal'; $title = $langs->trans("ProposalsStatisticsSuppliers"); diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 555c04558e532..cc2aac53b024c 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -304,9 +304,8 @@ $head[$h][2] = 'byyear'; $h++; -if ($mode == 'customer') { - $type = 'order_stats'; -} +$type = 'order_stats'; + if ($mode == 'supplier') { $type = 'supplier_order_stats'; } diff --git a/htdocs/product/stock/productlot_document.php b/htdocs/product/stock/productlot_document.php index 54813e16de131..a53aafa557f5f 100644 --- a/htdocs/product/stock/productlot_document.php +++ b/htdocs/product/stock/productlot_document.php @@ -88,6 +88,8 @@ $modulepart = 'product_batch'; $object = new Productlot($db); if ($id || $ref) { + $productid = 0; + $batch = ''; if ($ref) { $tmp = explode('_', $ref); $productid = $tmp[0];