diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 376bf29454f..2682e99df38 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,20 +1,42 @@ on: pull_request: - types: - - opened + types: [opened, synchronize, reopened] + branches: + - "18.0" + push: branches: - "18.0" +permissions: write-all + jobs: run: - runs-on: ubuntu-22.04 - permissions: - pull-requests: write + runs-on: ubuntu-latest + + env: + # GH_TOKEN: ${{ secrets.GH_TOKEN }} + GH_TOKEN: ${{ github.token }} + 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 + # run: | + # echo "GH_TOKEN=$GH_TOKEN" + # 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 + 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" + continue-on-error: true diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000000..cf263dd0b57 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,19 @@ +on: + workflow_dispatch: + pull_request: + types: [opened, reopened, synchronize] + branches: + - "18.0" + +permissions: write-all + +jobs: + testjob: + runs-on: ubuntu-latest + steps: + - name: Log + run: | + echo "variable org: ${{vars.AAA}}" + echo "env prg: ${{env.AAA}}" + echo "secret org: ${{secrets.BBB}}" + echo "variable repository of orga: ${{vars.CCC}}" diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index e81f647f763..2eac807cb71 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -43,7 +43,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); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index b163216fb64..3ce0b5fa0ea 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1507,9 +1507,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 '
'; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index fb5621901a9..489c4c267c5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8601,6 +8601,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; diff --git a/htdocs/core/js/lib_foot.js.php b/htdocs/core/js/lib_foot.js.php index c497362e04b..cf99f087c20 100644 --- a/htdocs/core/js/lib_foot.js.php +++ b/htdocs/core/js/lib_foot.js.php @@ -112,8 +112,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)); diff --git a/htdocs/core/tpl/extrafields_list_search_param.tpl.php b/htdocs/core/tpl/extrafields_list_search_param.tpl.php index 2ab5749b4e0..da123939c68 100644 --- a/htdocs/core/tpl/extrafields_list_search_param.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_param.tpl.php @@ -37,6 +37,16 @@ if (!empty($search_array_options) && is_array($search_array_options)) { // $extr $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); } } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 0a777b7b5a7..08179914124 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -399,6 +399,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; @@ -504,10 +505,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 88916572746..4270d723959 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1324,6 +1324,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; @@ -1340,7 +1345,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, @@ -3171,14 +3176,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 diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index f462d08372a..e02c7227557 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -917,7 +917,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; @@ -925,6 +925,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; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 73905831ee5..440315732de 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -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 6be3424be3d..13f6f56190d 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -772,7 +772,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']); }