diff --git a/.github/workflows/pr-18.yaml b/.github/workflows/pr-18.yaml index 04b4b0ff35e..4f274e28c8f 100644 --- a/.github/workflows/pr-18.yaml +++ b/.github/workflows/pr-18.yaml @@ -1,3 +1,11 @@ +# Action to prepare the github action +# Go on Dolibarr - Settings - Developer settings - Enter a name + webhook to disable + Permissions (see app test) + Can install by any account +# Click on generate the private keys +# Click on Install application - choose user of the Organization +# Go on Organisation - Secret and variables and create a secret PR18_SECRET_KEY and copy the content of received private key. Choose the repository access to "Repository Dolibarr". +# Go on Organisation - Secret and variables and create a variable PR18_APP_ID and copy the ID of the previously create ID. Choose the repository access to "Repository Dolibarr". +# + name: Set reviewer for v18 on: pull_request: @@ -17,38 +25,21 @@ jobs: # GH_TOKENS: ${{ secrets.GITHUB_TOKEN }} steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.PR18_APP_ID }} + private-key: ${{ secrets.PR18_SECRET_KEY }} + - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - #- name: Install GitHub CLI - # run: | - # sudo apt update - # sudo apt install gh -y - - - name: Assign reviewer method 1 + - name: Assign reviewer env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} url: ${{ github.event.pull_request.html_url }} run: | - gh pr edit "$url" --add-assignee rycks --add-reviewer rycks - gh pr merge "$url" --merge --auto - continue-on-error: true + gh pr edit "$url" --add-reviewer rycks + gh pr edit "$url" --add-reviewer lvessiller-opendsi - - name: Assign reviewer method 2 - 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 "Run action by ${{ github.actor }}" - echo "github.token=${{ github.token }}" - echo "secrets.GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" - echo "GITHUB_EVENT_PATH=$GITHUB_EVENT_PATH" - echo Get the pr_number - pr_number=$(jq --raw-output .number < $GITHUB_EVENT_PATH) - echo "pr_number=$pr_number" - echo Authenticate login gh - gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}" - gh auth setup-git - echo Set the reviewer - gh pr edit $pr_number --add-reviewer "$REVIEWER" - continue-on-error: true diff --git a/.travis.yml b/.travis.yml index 6fe86320aa2..fa0fadfa608 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ # from Dolibarr GitHub repository. # For syntax, see https://docs.travis-ci.com/user/languages/php/ -# We use dist: bionic = 18.04, focal = 20.04 +# We use dist: focal = 20.04, jammy = 22.04 os: linux dist: jammy diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 1a8cc0a8be4..e4a7f3215ff 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -21,6 +21,9 @@ $PROJECT="dolibarr"; $PUBLISHBETARC="$ENV{'DESTIASSOLOGIN'}\@vmprod1.dolibarr.org:/home/dolibarr/asso.dolibarr.org/dolibarr_documents/website/www.dolibarr.org/files"; $PUBLISHSTABLE="$ENV{'DESTISFLOGIN'}\@frs.sourceforge.net:/home/frs/project/dolibarr"; +# due to implicit origin on git commands, example +# implicit origin, lionel upstream, eric dolibarr +$GITREMOTENAME="$ENV{'GITREMOTENAME'}"; #@LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages @LISTETARGET=("TGZ","ZIP","RPM_GENERIC","RPM_FEDORA","RPM_MANDRIVA","RPM_OPENSUSE","DEB","EXEDOLIWAMP","SNAPSHOT"); # Possible packages %REQUIREMENTPUBLISH=( @@ -97,6 +100,13 @@ if (! -d $ENV{"DESTIBETARC"} || ! -d $ENV{"DESTISTABLE"}) exit 1; } +if (! $ENV{"GITREMOTENAME"}) +{ + print "Error: environment variable GITREMOTENAME does not exist. You can set it to 'origin' or any other git remote name.\n"; + print "$PROG.$Extension aborted.\n"; + sleep 2; + exit 1; +} # Detect OS type # -------------- if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; } @@ -442,15 +452,15 @@ if ($nboftargetok) { { print 'Run git tag -a -f -m "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'" "'.$MAJOR.'.'.$MINOR.'.'.$BUILD.'"'."\n"; $ret=`git tag -a -f -m "$MAJOR.$MINOR.$BUILD" "$MAJOR.$MINOR.$BUILD"`; - print 'Run git push -f --tags'."\n"; - $ret=`git push -f --tags`; + print 'Run git push $GITREMOTENAME -f --tags'."\n"; + $ret=`git push $GITREMOTENAME -f --tags`; #$ret=`git push -f origin "$MAJOR.$MINOR.$BUILD"`; } } else { - print 'Run git push --tags'."\n"; - $ret=`git push --tags`; + print 'Run git push $GITREMOTENAME --tags'."\n"; + $ret=`git push $GITREMOTENAME --tags`; #$ret=`git push origin "$MAJOR.$MINOR.$BUILD"`; } chdir("$olddir"); diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index cbfca62885e..f8dd235b6c6 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -586,7 +586,7 @@ class Lettering extends BookKeeping $grouped_lines = array(); foreach (self::$doc_type_infos as $doc_type => $doc_type_info) { - if (!is_array($bookkeeping_lines_by_type[$doc_type])) { + if (empty($bookkeeping_lines_by_type[$doc_type]) || !is_array($bookkeeping_lines_by_type[$doc_type])) { continue; } diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 7b39a4556c9..228887305f9 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -53,6 +53,9 @@ if ($user->socid && $socid) { $result = restrictedArea($user, 'societe', $socid); } +$object = new ActionComm($db); +$object->fetch($id); + $usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->hasRight('agenda', 'myactions', 'create')); @@ -65,8 +68,6 @@ $form = new Form($db); $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda|DE:Modul_Terminplanung'; llxHeader('', $langs->trans("Agenda"), $help_url); -$object = new ActionComm($db); -$object->fetch($id); $object->info($object->id); $head = actions_prepare_head($object); diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index d92cbc2035a..c49c98d360b 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -51,7 +51,7 @@ $charge = new ChargeSociales($db); * Actions */ -if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'yes')) { +if ($action == 'add_payment') { $error = 0; if ($cancel) { @@ -89,7 +89,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y } } - if (count($amounts) <= 0) { + if (empty($amounts)) { $error++; setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors'); $action = 'create'; @@ -119,9 +119,9 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y if (!$error) { $result = $paiement->addPaymentToBank($user, 'payment_sc', '(SocialContributionPayment)', GETPOST('accountid', 'int'), '', ''); - if (!($result > 0)) { + if ($result <= 0) { $error++; - setEventMessages($paiement->error, null, 'errors'); + setEventMessages($paiement->error, $paiement->errors, 'errors'); $action = 'create'; } } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 6eb53cfdf5d..63e237171af 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -472,7 +472,7 @@ while ($i < $imaxinloop) { print ''; print $line->LibStatut($obj->statut_ligne, 2); print " "; - print ''; + print ''; print substr('000000'.$obj->rowid_ligne, -6); print ''; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 645f1d0c25f..7fd62282b16 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -598,7 +598,6 @@ class PaymentSocialContribution extends CommonObject $result = $this->update_fk_bank($bank_line_id); if ($result <= 0) { $error++; - dol_print_error($this->db); } // Add link 'payment', 'payment_supplier', 'payment_sc' in bank_url between payment and bank transaction @@ -610,7 +609,7 @@ class PaymentSocialContribution extends CommonObject $result = $acc->add_url_line($bank_line_id, $this->id, $url, '(paiement)', $mode); if ($result <= 0) { $error++; - dol_print_error($this->db); + $this->setErrorsFromObject($acc); } } @@ -622,7 +621,8 @@ class PaymentSocialContribution extends CommonObject $socialcontrib->fetch($key); $result = $acc->add_url_line($bank_line_id, $socialcontrib->id, DOL_URL_ROOT.'/compta/charges.php?id=', $socialcontrib->type_label.(($socialcontrib->lib && $socialcontrib->lib != $socialcontrib->type_label) ? ' ('.$socialcontrib->lib.')' : ''), 'sc'); if ($result <= 0) { - dol_print_error($this->db); + $this->setErrorsFromObject($acc); + $error++; } if ($socialcontrib->fk_user) { @@ -639,14 +639,14 @@ class PaymentSocialContribution extends CommonObject ); if ($result <= 0) { - $this->error = $acc->error; + $this->setErrorsFromObject($acc); $error++; } } } } } else { - $this->error = $acc->error; + $this->setErrorsFromObject($acc); $error++; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ac97e6cfed2..91969f39dc9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7337,7 +7337,7 @@ abstract class CommonObject } $out .= '