Skip to content

Commit

Permalink
Merge branch '20.0' into fix_hidden_dropdown_download_link_in_project
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Dec 19, 2024
2 parents ca51c23 + 4ef891d commit a728c2c
Show file tree
Hide file tree
Showing 60 changed files with 426 additions and 217 deletions.
3 changes: 3 additions & 0 deletions .github/changed-lines-count-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add this tag for any changes for more than 1 line
"Pending analysis of PR (maintenance team)":
min: 1
21 changes: 21 additions & 0 deletions .github/workflows/pr-18-autolabel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Set label for v18"
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- "18.0"
push:
branches:
- "18.0"

jobs:
changed-lines-count-labeler:
runs-on: ubuntu-latest
name: An action for automatically labelling pull requests based on the changed lines count
steps:
- name: Set a label
uses: vkirilichev/changed-lines-count-labeler@v0.2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/changed-lines-count-labeler.yml
continue-on-error: true
27 changes: 15 additions & 12 deletions .github/workflows/pr-18.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Set reviewer for v18
on:
pull_request:
types: [opened, synchronize, reopened]
Expand All @@ -7,15 +8,13 @@ on:
branches:
- "18.0"

permissions: write-all

jobs:
run:
pr18:
runs-on: ubuntu-latest

env:
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_TOKEN: ${{ github.token }}
#env:
# GH_TOKEN: ${{ github.token }}
# GH_TOKENS: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
Expand All @@ -26,17 +25,21 @@ jobs:
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"
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
21 changes: 20 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@
name: Test github actions
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]
branches:
- "18.0"

permissions: write-all
env:
ENVGHT: ${{ secrets.GITHUB_TOKEN }}
ENVGHU: ${{ github.token }}
VARAAA: ${{ vars.AAA }}
SECBBB: ${{ secrets.BBB }}
VARREPORGCCC: ${{ vars.CCC }}
ENVFIX: "abc"

jobs:
testjob:
runs-on: ubuntu-latest
steps:
- name: Log
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 "repo-token: ${{secrets.GITHUB_TOKEN}}"
echo "variable org: ${{vars.AAA}}"
echo "env prg: ${{env.AAA}}"
echo "env prg: ${{env.VARAAA}}"
echo "secret org: ${{secrets.BBB}}"
echo "variable repository of orga: ${{vars.CCC}}"
echo "ENVGHT: ${{env.ENVGHT}}"
echo "ENVGHU: ${{env.ENVGHU}}"
echo "VARAAA: ${{vars.AAA}}"
echo "ENVAAA: ${{env.VARAAA}}"
echo "VARREPORGCCC: ${{env.VARREPORGCCC}}"
echo "ENVFIX: ${{env.ENVFIX}}"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
# git commit -a -m "My message" --no-verify
# (Recommendation: run git commit -a .. once, then with `--no-verify`)
- id: no-commit-to-branch
args: [--branch, develop, --pattern, \d+.0]
args: [--branch, develop, --pattern, \d+.0$]
# This checks that xml files are correct
- id: check-xml
exclude: |
Expand Down
82 changes: 58 additions & 24 deletions htdocs/accountancy/class/bookkeeping.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Copyright (C) 2015-2022 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Jose MARTINEZ <jose.martinez@pichinov.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -68,7 +69,7 @@ class BookKeeping extends CommonObject
public $doc_date;

/**
* @var int Deadline for payment
* @var int|null|'' Deadline for payment
*/
public $date_lim_reglement;

Expand Down Expand Up @@ -98,12 +99,12 @@ class BookKeeping extends CommonObject
public $thirdparty_code;

/**
* @var string subledger account
* @var string|null subledger account
*/
public $subledger_account;

/**
* @var string subledger label
* @var string|null subledger label
*/
public $subledger_label;

Expand Down Expand Up @@ -329,7 +330,7 @@ public function create(User $user, $notrigger = 0)
$this->piece_num = 0;

// First check if line not yet already in bookkeeping.
// Note that we must include 'doc_type - fk_doc - numero_compte - label' to be sure to have unicity of line (because we may have several lines
// Note that we must include 'doc_type - fk_doc - numero_compte - label - subledger_account (if not empty)' to be sure to have unicity of line (because we may have several lines
// with same doc_type, fk_doc, numero_compte for 1 invoice line when using localtaxes with same account)
// WARNING: This is not reliable, label may have been modified. This is just a small protection.
// The page that make transfer make the test on couple (doc_type - fk_doc) only.
Expand All @@ -343,6 +344,9 @@ public function create(User $user, $notrigger = 0)
}
$sql .= " AND numero_compte = '".$this->db->escape($this->numero_compte)."'";
$sql .= " AND label_operation = '".$this->db->escape($this->label_operation)."'";
if (!empty($this->subledger_account)) {
$sql .= " AND subledger_account = '".$this->db->escape($this->subledger_account)."'";
}
$sql .= " AND entity = ".$conf->entity; // Do not use getEntity for accounting features

$resql = $this->db->query($sql);
Expand Down Expand Up @@ -2814,10 +2818,8 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep

$sql = 'SELECT';
$sql .= " t.numero_compte,";
$sql .= " t.label_compte,";
if ($separate_auxiliary_account) {
$sql .= " t.subledger_account,";
$sql .= " t.subledger_label,";
$sql .= " NULLIF(t.subledger_account, '') as subledger_account,"; // fix db issues with Null or "" values
}
$sql .= " aa.pcg_type,";
$sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance";
Expand All @@ -2829,10 +2831,11 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep
$sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')';
$sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'";
$sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'";
$sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type';
$sql .= ' GROUP BY t.numero_compte, aa.pcg_type';
if ($separate_auxiliary_account) {
$sql .= ' ,t.subledger_account, t.subledger_label';
$sql .= " , NULLIF(t.subledger_account, '')";
}
$sql .= ' HAVING (SUM(t.credit) - SUM(t.debit)) != 0 '; // Exclude rows with opening_balance = 0
$sql .= $this->db->order("t.numero_compte", "ASC");

$resql = $this->db->query($sql);
Expand All @@ -2853,24 +2856,41 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep

$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;

$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;

$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';

if ($separate_auxiliary_account) {
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}

$bookkeeping->numero_compte = $obj->numero_compte;
$bookkeeping->label_compte = $obj->label_compte;
$accountingaccount = new AccountingAccount($this->db);
$accountingaccount->fetch('', $obj->numero_compte);
$bookkeeping->label_compte = $accountingaccount->label; // latest account label used

$bookkeeping->label_operation = $new_fiscal_period->label;
$bookkeeping->montant = $mt;
Expand Down Expand Up @@ -2900,21 +2920,35 @@ public function closeFiscalPeriod($fiscal_period_id, $new_fiscal_period_id, $sep

$bookkeeping = new BookKeeping($this->db);
$bookkeeping->doc_date = $new_fiscal_period->date_start;
$bookkeeping->date_lim_reglement = 0;
$bookkeeping->doc_ref = $new_fiscal_period->label;

$bookkeeping->date_lim_reglement = '';
$bookkeeping->doc_ref = $fiscal_period->label;

$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'closure';
$bookkeeping->fk_doc = $new_fiscal_period->id;
$bookkeeping->fk_doc = $fiscal_period->id;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = '';

if ($separate_auxiliary_account) {
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = $obj->subledger_account;
$bookkeeping->subledger_label = $obj->subledger_label;
$sql = 'SELECT';
$sql .= " subledger_label";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE subledger_account = '" . $this->db->escape($obj->subledger_account) . "'";
$sql .= " ORDER BY doc_date DESC";
$sql .= " LIMIT 1";
$result = $this->db->query($sql);
if (!$result) {
$this->errors[] = 'Error: ' . $this->db->lasterror();
dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR);
$error++;
}
$objtmp = $this->db->fetch_object($result);
$bookkeeping->subledger_label = $objtmp->subledger_label; // latest subledger label used
} else {
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->subledger_account = null;
$bookkeeping->subledger_label = null;
}

$bookkeeping->numero_compte = $accountingaccount->account_number;
Expand Down
21 changes: 20 additions & 1 deletion htdocs/admin/dict.php
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,26 @@

$tablecode = 't.code';
$tableprefix = '';
$tableprefixarray = array(DICT_FORME_JURIDIQUE => 'f.code', DICT_DEPARTEMENTS => 'd.code_departement', DICT_REGIONS => 'r.code_region', DICT_COUNTRY => 'c.code', DICT_CIVILITY => 'c.code', DICT_ACTIONCOMM => 'a.code', DICT_CURRENCIES => 'code_iso', DICT_ECOTAXE => 'e.code', DICT_HOLIDAY_TYPES => 'h.code', DICT_CHARGESOCIALES => 'a.code', DICT_HRM_PUBLIC_HOLIDAY => 'a.code', DICT_UNITS => 'r.code', DICT_SOCIALNETWORKS => 's.code', 45 => 'f.code', 46 => 'f.code', 47 => 'f.code', 48 => 'f.code');
$tableprefixarray = array(
DICT_FORME_JURIDIQUE => 'f.code',
DICT_DEPARTEMENTS => 'd.code_departement',
DICT_REGIONS => 'r.code_region',
DICT_COUNTRY => 'c.code',
DICT_CIVILITY => 'c.code',
DICT_ACTIONCOMM => 'a.code',
DICT_CHARGESOCIALES => 'a.code',
DICT_TYPENT => 't.code',
DICT_CURRENCIES => 'c.code_iso',
DICT_ECOTAXE => 'e.code',
DICT_HOLIDAY_TYPES => 'h.code',
DICT_HRM_PUBLIC_HOLIDAY => 'a.code',
DICT_UNITS => 'r.code',
DICT_SOCIALNETWORKS => 's.code',
45 => 'f.code',
46 => 'f.code',
47 => 'f.code',
48 => 'f.code',
);
if (!empty($tableprefixarray[$id])) {
$tablecode = $tableprefixarray[$id];
$tableprefix = preg_replace('/\..*$/', '.', $tablecode);
Expand Down
6 changes: 5 additions & 1 deletion htdocs/admin/security_other.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
$res3 = 1;
$res4 = 1;
$res5 = 1;
$res6 = 1;
if (GETPOSTISSET('MAIN_APPLICATION_TITLE')) {
$res1 = dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", GETPOST("MAIN_APPLICATION_TITLE", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
}
Expand All @@ -82,7 +83,10 @@
if (GETPOSTISSET('MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS')) {
$res5 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", GETPOST("MAIN_SECURITY_MAX_ATTACHMENT_ON_FORMS", 'alphanohtml'), 'int', 0, '', $conf->entity);
}
if ($res1 && $res2 && $res3 && $res4 && $res5) {
if (GETPOSTISSET('MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH')) {
$res6 = dolibarr_set_const($db, "MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", GETPOST("MAIN_SECURITY_MAX_NUMBER_FAILED_AUTH", 'alphanohtml'), 'int', 0, '', $conf->entity);
}
if ($res1 && $res2 && $res3 && $res4 && $res5 && $res6) {
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
}
}
Expand Down
18 changes: 17 additions & 1 deletion htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(),
}
}
if (!empty($InfoFieldList[1])) {
$sql .= " ORDER BY nom";
$sql .= $this->db->order($InfoFieldList[1]);
}
// $sql.= ' WHERE entity = '.$conf->entity;

Expand All @@ -334,8 +334,10 @@ public function advMultiselectarraySelllist($htmlname, $sqlqueryparam = array(),
if ($num) {
while ($i < $num) {
$obj = $this->db->fetch_object($resql);

$fieldtoread = $InfoFieldList[1];
$labeltoshow = dol_trunc($obj->$fieldtoread, 90);

$options_array[$obj->rowid] = $labeltoshow;
$i++;
}
Expand Down Expand Up @@ -401,6 +403,20 @@ public function advMultiselectarray($htmlname, $options_array = array(), $select
global $conf, $langs;

$form = new Form($this->db);
foreach ($options_array as $okey => $val) {
if ((string) $okey == '') {
continue;
}

$valarray = explode('|', $val);
$val = $valarray[0];

if ($val) {
$options_array[$okey] = $langs->trans($val);
} else {
$options_array[$okey] = $val;
}
}
$return = $form->multiselectarray($htmlname, $options_array, $selected_array, 0, 0, '', 0, 295);
return $return;
}
Expand Down
Loading

0 comments on commit a728c2c

Please sign in to comment.