From d420d035defaf98cf2e5b549e9aa14f08e2ec5ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Nov 2024 13:02:14 +0100 Subject: [PATCH 01/17] Update pr-18.yaml (#32024) * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml --------- Co-authored-by: Laurent Destailleur --- .github/workflows/pr-18.yaml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 376bf29454f..3464d60fd03 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -4,17 +4,32 @@ on: - opened branches: - "18.0" + push: + branches: + - "18.0" jobs: run: runs-on: ubuntu-22.04 permissions: - pull-requests: write + pull-requests: write steps: - name: Create PR review request + continue-on-error: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} + # GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} url: ${{ github.event.pull_request.html_url }} run: | - gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - gh pr merge "$url" --merge --auto + # https://cli.github.com/manual/gh_api + gh api \ + --method POST \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ + -f "reviewers[]=eldy" + #gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks + #gh pr merge "$url" --merge --auto From 877fd003533d144cbeacdbc5af81b1592ad0efdf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Nov 2024 13:21:58 +0100 Subject: [PATCH 02/17] Update pr-18.yaml --- .github/workflows/pr-18.yaml | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 3464d60fd03..e78a72217b6 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -11,25 +11,25 @@ on: jobs: run: runs-on: ubuntu-22.04 - permissions: - pull-requests: write steps: - - name: Create PR review request - continue-on-error: true - env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ github.token }} - # GH_TOKEN: ${{ github.token }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # GH_TOKEN: ${{ secrets.AUTOMATION_TOKEN }} - url: ${{ github.event.pull_request.html_url }} - run: | - # https://cli.github.com/manual/gh_api - gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers \ - -f "reviewers[]=eldy" - #gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - #gh pr merge "$url" --merge --auto + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install GitHub CLI + run: sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 && \ + sudo apt-add-repository https://cli.github.com/packages && \ + sudo apt update && \ + sudo apt install gh -y + + - name: Authenticate GitHub CLI + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: gh auth login --with-token <<< "$GH_TOKEN" + + - name: Assign reviewer + env: + REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer + run: | + pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + gh pr edit $pr_number --add-reviewer "$REVIEWER" From 991f53db9ebfb7cb3a98d34fa9c407c8df94835d Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 17:46:54 +0100 Subject: [PATCH 03/17] FIX: use tax with code on supplier order line give tax code missing in supplier invoice (#32018) * FIX: use vat with code on supplier order result code missing in supplier invoice * FIX: use vat with code on supplier order result code missing in supplier invoice --- htdocs/fourn/commande/list.php | 8 +++++++- htdocs/fourn/facture/card.php | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 454af465920..60518e789fb 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -496,10 +496,16 @@ if (empty($reshook)) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { $fk_parent_line = 0; } + + $tva_tx = $lines[$i]->tva_tx; + if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + } + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, - $lines[$i]->tva_tx, + $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 23b9be4300c..6f90af4ba22 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1255,6 +1255,11 @@ if (empty($reshook)) { $date_end = $lines[$i]->date_end; } + $tva_tx = $lines[$i]->tva_tx; + if (!empty($lines[$i]->vat_src_code) && !preg_match('/\(/', $tva_tx)) { + $tva_tx .= ' ('.$lines[$i]->vat_src_code.')'; + } + // FIXME Missing special_code into addline and updateline methods $object->special_code = $lines[$i]->special_code; @@ -1271,7 +1276,7 @@ if (empty($reshook)) { $result = $object->addline( $desc, $pu, - $lines[$i]->tva_tx, + $tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->qty, From c12a7e144a5babe9feebc003d05682c2e92f16e5 Mon Sep 17 00:00:00 2001 From: lvessiller-opendsi Date: Thu, 21 Nov 2024 19:07:58 +0100 Subject: [PATCH 04/17] FIX TakePos barcode rule (#31857) * FIX TakePos barcode rule * Keep last test confition on barcode rule --- htdocs/takepos/ajax/ajax.php | 4 ++-- htdocs/takepos/index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 249cdc04ed9..b196ed4a9f3 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -212,7 +212,7 @@ if ($action == 'getProducts') { if (isset($barcode_value_list['qd'])) { $qty_str .= '.' . $barcode_value_list['qd']; } - $qty = floatval($qty_str); + $qty = (float) $qty_str; } $objProd = new Product($db); @@ -241,7 +241,7 @@ if ($action == 'getProducts') { 'label' => $obj->label, 'tosell' => $obj->tosell, 'tobuy' => $obj->tobuy, - 'barcode' => $obj->barcode, + 'barcode' => $term, // there is only one product matches the barcode rule and so the term is considered as the barcode of this product, 'price' => empty($objProd->multiprices[$pricelevel]) ? $obj->price : $objProd->multiprices[$pricelevel], 'price_ttc' => empty($objProd->multiprices_ttc[$pricelevel]) ? $obj->price_ttc : $objProd->multiprices_ttc[$pricelevel], 'object' => 'product', diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 5ddd0e59b94..c18da67daca 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -731,7 +731,7 @@ function Search2(keyCodeForEnter, moreorless) { console.log("There is only 1 answer with barcode matching the search, so we change the thirdparty "+data[0]['rowid']); ChangeThirdparty(data[0]['rowid']); } - else if ($('#search').val() == data[0]['barcode'] && 'product' == data[0]['object']) { + else if ('product' == data[0]['object'] && $('#search').val() == data[0]['barcode']) { console.log("There is only 1 answer and we found search on a barcode, so we add the product in basket, qty="+data[0]['qty']); ClickProduct(0, data[0]['qty']); } From 240c5bb3115e7428ec1a1fd7e92c41f4234b5c08 Mon Sep 17 00:00:00 2001 From: HENRY Florian Date: Thu, 21 Nov 2024 23:00:41 +0100 Subject: [PATCH 05/17] fix: buyer and sellers in supplier invoice and supplier order list are not corectly defined (#32028) * fix: buyer and sellers in supplier invoice and supplier order list are not corectly defined * chore: revert bad changes --- htdocs/fourn/commande/list.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 60518e789fb..33c59ea0330 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -391,6 +391,7 @@ if (empty($reshook)) { $societe = new Societe($db); $societe->fetch($cmd->socid); $objecttmp->vat_reverse_charge = $societe->vat_reverse_charge; + $objecttmp->thirdparty = $societe; } $objecttmp->socid = $cmd->socid; $objecttmp->type = $objecttmp::TYPE_STANDARD; From ec93f508631ab4c2a0d21df645af1c97f679aae3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:15:14 +0100 Subject: [PATCH 06/17] Test --- .github/workflows/pr-18.yaml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 376bf29454f..11188dc974d 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,20 +1,29 @@ on: pull_request: - types: - - opened + types: [opened, reopened] branches: - "18.0" jobs: run: - runs-on: ubuntu-22.04 - permissions: - pull-requests: write + runs-on: ubuntu-latest steps: - - name: Create PR review request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - url: ${{ github.event.pull_request.html_url }} - run: | - gh pr edit "$url" --add-assignee lvessiller-opendsi,rycks --add-reviewer lvessiller-opendsi,rycks - gh pr merge "$url" --merge --auto + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install GitHub CLI + run: | + sudo apt update + sudo apt install gh -y + + - name: Authenticate GitHub CLI + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: gh auth login --with-token <<< "$GH_TOKEN" + + - name: Assign reviewer + env: + REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer + run: | + pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) + gh pr edit $pr_number --add-reviewer "$REVIEWER" From c2a037842d502b79ebada741434b284a1b3b859b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:22:26 +0100 Subject: [PATCH 07/17] Add test --- .github/workflows/test.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000000..f49494c5522 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,18 @@ +on: + workflow_dispatch: +jobs: + demo_app_authentication: + runs-on: ubuntu-latest + steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.CIAPPID }} + private-key: ${{ secrets.CIAPPPRIKEY }} + + - name: Use the token + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + run: | + gh api dolibarr From 53ffe42f9235cce3d3287b87fbbd911a82adcd61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 00:27:58 +0100 Subject: [PATCH 08/17] Test CI --- .github/workflows/test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f49494c5522..1fb89b8cb96 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,6 +4,9 @@ jobs: demo_app_authentication: runs-on: ubuntu-latest steps: + - name: Log + run: echo "CIAPPID ${{ vars.CIAPPID }}" + - name: Generate a token id: generate-token uses: actions/create-github-app-token@v1 From 682544ad45506539fe702e10e85e7bd96d49152c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 13:08:56 +0100 Subject: [PATCH 09/17] Update test.yaml (#32054) * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update pr-18.yaml * Update pr-18.yaml * Update pr-18.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update test.yaml * Update pr-18.yaml * Update test.yaml --- .github/workflows/pr-18.yaml | 18 ++++++++++++------ .github/workflows/test.yaml | 26 ++++++++++++-------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index a0c2579dc0d..d60a225a455 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,15 +1,18 @@ on: pull_request: - types: [opened, reopened] + types: [opened, synchronize, reopened] branches: - "18.0" push: branches: - "18.0" +permissions: write-all + jobs: run: runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -19,15 +22,18 @@ jobs: sudo apt update sudo apt install gh -y - - name: Authenticate GitHub CLI - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} - run: gh auth login --with-token <<< "$GH_TOKEN" + #- name: Authenticate GitHub CLI + # env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + # run: gh auth login --with-token <<< "$GH_TOKEN" - name: Assign reviewer env: + GH_TOKEN: ${{ github.token }} + #GH_TOKEN: ${{ secrets.GH_TOKEN }} #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | + echo "GH_TOKEN=$GH_TOKEN" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - gh pr edit $pr_number --add-reviewer "$REVIEWER" + #gh pr edit $pr_number --add-reviewer "$REVIEWER" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1fb89b8cb96..cf263dd0b57 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,21 +1,19 @@ on: workflow_dispatch: + pull_request: + types: [opened, reopened, synchronize] + branches: + - "18.0" + +permissions: write-all + jobs: - demo_app_authentication: + testjob: runs-on: ubuntu-latest steps: - name: Log - run: echo "CIAPPID ${{ vars.CIAPPID }}" - - - name: Generate a token - id: generate-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ vars.CIAPPID }} - private-key: ${{ secrets.CIAPPPRIKEY }} - - - name: Use the token - env: - GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: | - gh api dolibarr + echo "variable org: ${{vars.AAA}}" + echo "env prg: ${{env.AAA}}" + echo "secret org: ${{secrets.BBB}}" + echo "variable repository of orga: ${{vars.CCC}}" From e35b534ee282bfa0657557d9b5ba146e3ae5bca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Nov 2024 13:22:05 +0100 Subject: [PATCH 10/17] fix ajax tooltip lib_foot.js.php (#32044) Co-authored-by: Laurent Destailleur --- htdocs/core/js/lib_foot.js.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index 5ed7dfb2eb1..4f2ca935115 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -110,8 +110,10 @@ if (empty($conf->dol_no_mouse_hover)) { success: function(response){ // Setting content option console.log("ajax success"); - elemfortooltip.tooltip("option","content",response); - elemfortooltip.tooltip("open"); + if (elemfortooltip.is(":hover")) { + elemfortooltip.tooltip("option","content",response); + elemfortooltip.tooltip("open"); + } } }); }, opendelay)); From 9cd7d381a64968126581e298e4f757235ed474e5 Mon Sep 17 00:00:00 2001 From: Jon Bendtsen Date: Fri, 22 Nov 2024 13:25:25 +0100 Subject: [PATCH 11/17] flip supplier proposal and orders to show up as negative in the project Profit overview (#32048) Co-authored-by: Jon Bendtsen --- htdocs/projet/element.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 614d9d3c39f..ed14a6791bf 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -909,7 +909,7 @@ foreach ($listofreferent as $key => $value) { $total_ttc_by_line = $element->total_ttc; } - // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases + // Change sign of $total_ht_by_line and $total_ttc_by_line for various payments if ($tablename == 'payment_various') { if ($element->sens == 1) { $total_ht_by_line = -$total_ht_by_line; @@ -917,6 +917,12 @@ foreach ($listofreferent as $key => $value) { } } + // Change sign of $total_ht_by_line and $total_ttc_by_line for supplier proposal and supplier order + if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_proposal') { + $total_ht_by_line = -$total_ht_by_line; + $total_ttc_by_line = -$total_ttc_by_line; + } + // Add total if we have to if ($qualifiedfortotal) { $total_ht = $total_ht + $total_ht_by_line; From 32b18d6bfd497d54a8c89108deb1033660019d10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Nov 2024 15:22:22 +0100 Subject: [PATCH 12/17] Execute --- .github/workflows/pr-18.yaml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index d60a225a455..2682e99df38 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -13,6 +13,10 @@ jobs: run: runs-on: ubuntu-latest + env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ github.token }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -23,17 +27,16 @@ jobs: sudo apt install gh -y #- name: Authenticate GitHub CLI - # env: - # GH_TOKEN: ${{ secrets.GH_TOKEN }} - # run: gh auth login --with-token <<< "$GH_TOKEN" + # run: | + # echo "GH_TOKEN=$GH_TOKEN" + # gh auth login --with-token <<< "$GH_TOKEN" - name: Assign reviewer env: - GH_TOKEN: ${{ github.token }} - #GH_TOKEN: ${{ secrets.GH_TOKEN }} #REVIEWER: "eldy,lvessiller-opendsi,rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer REVIEWER: "rycks" # Remplacez par le nom d'utilisateur GitHub du reviewer run: | echo "GH_TOKEN=$GH_TOKEN" pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - #gh pr edit $pr_number --add-reviewer "$REVIEWER" + gh pr edit $pr_number --add-reviewer "$REVIEWER" + continue-on-error: true From acdab170a7b0445102ceefab05e95e44fc5ae48a Mon Sep 17 00:00:00 2001 From: "Thomas C." <56068416+Thomas905@users.noreply.github.com> Date: Fri, 22 Nov 2024 17:58:21 +0100 Subject: [PATCH 13/17] fix (#32012) --- htdocs/fourn/facture/card.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 6f90af4ba22..d2699019a63 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -3030,14 +3030,12 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } - if (!$formconfirm) { - $parameters = array('formConfirm' => $formconfirm, 'lineid'=>$lineid); - $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $formconfirm .= $hookmanager->resPrint; - } elseif ($reshook > 0) { - $formconfirm = $hookmanager->resPrint; - } + $parameters = array('formConfirm' => $formconfirm, 'lineid'=>$lineid); + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; } // Print form confirm From 7b160390840001c1cad74e8c916ef13eb00686fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 27 Nov 2024 18:02:59 +0100 Subject: [PATCH 14/17] fix test (#32110) --- htdocs/admin/mails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 73096056f98..cf0a1451c42 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -42,7 +42,7 @@ if (!$user->admin) { $usersignature = $user->signature; // For action = test or send, we ensure that content is not html, even for signature, because for this we want a test with NO html. -if ($action == 'test' || ($action == 'send' && $trackid = 'test')) { +if ($action == 'test' || ($action == 'send' && $trackid == 'test')) { $usersignature = dol_string_nohtmltag($usersignature, 2); } From e9009ede870c1a1a329f3c22f8ddc5a6120f618d Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Wed, 27 Nov 2024 22:02:29 +0100 Subject: [PATCH 15/17] Fix double hook printFieldPreListTitle in command list (#32108) * Fix command list : remove double hook printFieldPreListTitle * Remove files --- htdocs/commande/list.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ab99e305871..f82da9ce6f4 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1492,9 +1492,6 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; print '
'; } From 6337a987d88b64013eab90dc6183c4af3ed7415e Mon Sep 17 00:00:00 2001 From: Mathieu Moulin Date: Sun, 1 Dec 2024 23:28:49 +0100 Subject: [PATCH 16/17] Fix handling of boolean extrafields in list filters (#32109) * Fix show payment URL in massaction context when not one email per recipient * Debug v20 - fix param for filter on boolean * FIX : Fix case when the value of a extrafields of the type 'boolean', 'select' or other have an option with a value equal to '0'. It's not reselected when the filter is set. * Revert "Fix show payment URL in massaction context when not one email per recipient" This reverts commit 0986d487f1946dd90686dc9c38f89a5f04a37162. --------- Co-authored-by: Laurent Destailleur Co-authored-by: kkhelifa --- .../tpl/extrafields_list_search_input.tpl.php | 2 +- .../tpl/extrafields_list_search_param.tpl.php | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index f57101b81e6..3f90715cbea 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -47,7 +47,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) { $morecss = 'maxwidth200'; } - echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + echo $extrafields->showInputField($key, (!isset($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } print ''; } diff --git a/htdocs/core/tpl/extrafields_list_search_param.tpl.php b/htdocs/core/tpl/extrafields_list_search_param.tpl.php index 7e58e106882..da123939c68 100644 --- a/htdocs/core/tpl/extrafields_list_search_param.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_param.tpl.php @@ -31,8 +31,24 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr $param .= '&'.$search_options_pattern.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M'); $val = ''; } - if ($val != '') { - $param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val); + if ($val !== '') { + if (is_array($val)) { + foreach ($val as $val2) { + $param .= '&'.$search_options_pattern.$tmpkey.'[]='.urlencode($val2); + } + } else { + // test if we have checkbox type, we add the _multiselect needed into param + $tmpkey = preg_replace('/'.$search_options_pattern.'/', '', $key); + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('checkbox', 'chkbxlst'))) { + $param .= '&'.$search_options_pattern.$tmpkey.'_multiselect='.urlencode($val); + } + // test if we have boolean type, we add the _booleand needed into param + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$tmpkey], array('boolean'))) { + $param .= '&'.$search_options_pattern.$tmpkey.'_boolean='.urlencode($val); + } + + $param .= '&'.$search_options_pattern.$tmpkey.'='.urlencode($val); + } } } } From 4962dd1a8147c2d7e2b4d9c8362ff811b5c44a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Lukas?= Date: Mon, 2 Dec 2024 00:48:13 +0100 Subject: [PATCH 17/17] Fix #29353 (#32151) Hidden extrafields are NULL on update. Can only happen with extrafields in positions of commercial elements (facture, propal, commande, etc) --- htdocs/core/class/commonobject.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 355a6dc7684..055a24ac5fd 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8210,6 +8210,10 @@ abstract class CommonObject if (($mode == 'create') && abs($visibility) != 1 && abs($visibility) != 3) { continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list } elseif (($mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3 && abs($visibility) != 4) { + // We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost + $ef_name = 'options_' . $key; + $ef_value = $this->array_options[$ef_name]; + $out .= '' . "\n"; continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation } elseif ($mode == 'view' && empty($visibility)) { continue;