Skip to content

Commit

Permalink
Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 8, 2024
2 parents 3505990 + 7beb874 commit 774a48f
Show file tree
Hide file tree
Showing 18 changed files with 145 additions and 59 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
20 changes: 20 additions & 0 deletions .github/workflows/pr-18-autolabel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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
26 changes: 14 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,20 @@ 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 }}"
echo Set the reviewere
gh pr edit $pr_number --add-reviewer "$REVIEWER"
continue-on-error: true
17 changes: 16 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
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 "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: ${{env.VARAAA}}"
echo "ENVAAA: ${{env.VARAAA}}"
echo "VARREPORGCCC: ${{env.VARREPORGCCC}}"
echo "ENVFIX: ${{env.abc}}"
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
20 changes: 16 additions & 4 deletions htdocs/comm/propal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,7 @@
$fk_account = GETPOSTINT('fk_account');

// Load objectsrc
$objectsrc = null;
if (!empty($origin) && !empty($originid)) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
Expand All @@ -1824,6 +1825,14 @@

if ($element == 'project') {
$projectid = $originid;

// Fetch project and thirdparty
$project = new Project($db);
$project->fetch($projectid);
if ($project->socid > 0) {
$soc = new Societe($db);
$soc->fetch($project->socid);
}
} else {
// For compatibility
if ($element == 'order' || $element == 'commande') {
Expand Down Expand Up @@ -1855,9 +1864,9 @@

$soc = $objectsrc->thirdparty;

$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0));
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0));
$warehouse_id = (!empty($objectsrc->warehouse_id) ? $objectsrc->warehouse_id : (!empty($soc->warehouse_id) ? $soc->warehouse_id : 0));

// Replicate extrafields
$objectsrc->fetch_optionals();
Expand All @@ -1872,7 +1881,10 @@
}
}
}
} else {
}

// Load default values from thirdparty
if (!empty($soc)) {
$cond_reglement_id = empty($soc->cond_reglement_id) ? $cond_reglement_id : $soc->cond_reglement_id;
$deposit_percent = empty($soc->deposit_percent) ? $deposit_percent : $soc->deposit_percent;
$mode_reglement_id = empty($soc->mode_reglement_id) ? $mode_reglement_id : $soc->mode_reglement_id;
Expand Down
16 changes: 8 additions & 8 deletions htdocs/compta/facture/card-rec.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@
$object = new FactureRec($db);
if (($id > 0 || $ref) && $action != 'create' && $action != 'add') {
$ret = $object->fetch($id, $ref);
if (!$ret) {
if ($ret < 0) {
dol_print_error($db, $object->error, $object->errors);
exit;
} elseif (! $ret) {
setEventMessages($langs->trans("ErrorRecordNotFound"), null, 'errors');
}
}
Expand Down Expand Up @@ -1372,14 +1375,10 @@
}
print '</tr></table>';
print '</td><td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE) {
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
}
if ($action == 'editconditions') {
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id');
} else {
print '&nbsp;';
$form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none');
}
print '</td></tr>';

Expand Down Expand Up @@ -1809,6 +1808,7 @@
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions = new FormActions($db);
$morehtmlcenter = '';
$somethingshown = $formactions->showactions($object, $object->element, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);

print '</div>';
Expand Down
6 changes: 3 additions & 3 deletions htdocs/compta/facture/class/api_invoices.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,11 +693,11 @@ public function put($id, $request_data = null)
}
}

if ($this->invoice->update(DolibarrApiAccess::$user)) {
if ($this->invoice->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
} else {
throw new RestException(500, $this->invoice->error);
}

return false;
}

/**
Expand Down
1 change: 1 addition & 0 deletions htdocs/compta/facture/class/facture-rec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidat
$nb_create++;
$this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n";
} else {
$this->output .= $langs->trans("InvoiceGeneratedFromTemplateError", $facture->ref, $facturerec->ref, $this->error)."\n";
$this->db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref);
}

Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/dolgraph.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1115,8 +1115,8 @@ private function draw_chart($file, $fileurl) // @phpstan-ignore-line
$values[$x] = (is_numeric($tmpvalue) ? $tmpvalue : null);
$arrayofgroupslegend[$i] = array(
'stacknum' => $tmpykey[1],
'legend' => $this->Legend[$tmpykey[1]],
'legendwithgroup' => $this->Legend[$tmpykey[1]] . ' - ' . $tmpykey[2]
'legend' => $this->Legend[$tmpykey[1]] ?? '',
'legendwithgroup' => ($this->Legend[$tmpykey[1]] ?? '') . ' - ' . $tmpykey[2]
);
} else {
$tmpvalue = (array_key_exists('y_' . $i, $valarray) ? $valarray['y_' . $i] : $valarray[$i + 1]);
Expand Down
4 changes: 2 additions & 2 deletions htdocs/core/class/html.formticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi
$ticketstat->loadCacheTypesTickets();

print '<select id="select'.$htmlname.'" class="flat minwidth100'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.($multiselect ? '[]' : '').'"'.($multiselect ? ' multiple' : '').'>';
if ($empty) {
if ($empty && !$multiselect) {
print '<option value="">&nbsp;</option>';
}

Expand Down Expand Up @@ -821,7 +821,7 @@ public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $fi
print ' selected="selected"';
} elseif (in_array($id, $selected)) {
print ' selected="selected"';
} elseif ($arraytypes['use_default'] == "1" && empty($selected)) {
} elseif ($arraytypes['use_default'] == "1" && empty($selected) && !$multiselect) {
print ' selected="selected"';
}

Expand Down
37 changes: 20 additions & 17 deletions htdocs/core/tpl/advtarget.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,10 @@
$extrafields->fetch_name_optionals_label($elementtype);
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
if ($key != 'ts_nameextra' && $key != 'ts_payeur') {
print '<tr><td>'.$extrafields->attributes[$elementtype]['label'][$key];
if (isset($extrafields->attributes[$elementtype]['langfile'][$key])) {
$langs->load($extrafields->attributes[$elementtype]['langfile'][$key]);
}
print '<tr><td>'.$langs->trans($extrafields->attributes[$elementtype]['label'][$key]);
if (!empty($array_query['options_'.$key]) || (is_array($array_query['options_'.$key]) && count($array_query['options_'.$key]) > 0)) {
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
}
Expand All @@ -309,9 +312,9 @@
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
print '<table class="nobordernopadding"><tr>';
print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
print $form->selectDate('', 'options_'.$key.'_st_dt');
print $form->selectDate('', 'options_'.$key.'_st_dt', 0, 0, 1);
print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
print $form->selectDate('', 'options_'.$key.'_end_dt');
print $form->selectDate('', 'options_'.$key.'_end_dt', 0, 0, 1);
print '</td></tr></table>';

print '</td><td>'."\n";
Expand All @@ -327,19 +330,19 @@
$array_query['options_'.$key]
);
print '</td><td>'."\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
print $formadvtargetemaling->advMultiselectarray('options_'.$key, $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key]);
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'select') {
print $formadvtargetemaling->advMultiselectarray('options_'.$key, $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key]);
print '</td><td>'."\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key, $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key]);
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'sellist') {
print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key, $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key]);
print '</td><td>'."\n";
} else {
print '<table class="nobordernopadding"><tr>';
print '<td></td><td>';
if (is_array($array_query['options_'.$key])) {
print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key]));
print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key]), '', '', '', '', 0, 'societe', 1);
} else {
print $extrafields->showInputField($key, $array_query['options_'.$key]);
print $extrafields->showInputField($key, $array_query['options_'.$key], '', '', '', '', 0, 'societe', 1);
}
print '</td></tr></table>';

Expand Down Expand Up @@ -508,9 +511,9 @@
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) {
print '<table class="nobordernopadding"><tr>';
print '<td>'.$langs->trans("AdvTgtStartDt").'</td><td>';
print $form->selectDate('', 'options_'.$key.'_st_dt_cnct');
print $form->selectDate('', 'options_'.$key.'_st_dt_cnct', 0, 0, 1);
print '</td><td>'.$langs->trans("AdvTgtEndDt").'</td><td>';
print $form->selectDate('', 'options_'.$key.'_end_dt_cnct');
print $form->selectDate('', 'options_'.$key.'_end_dt_cnct', 0, 0, 1);
print '</td></tr></table>';
print '</td><td>'."\n";
print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help');
Expand All @@ -525,17 +528,17 @@
$array_query['options_'.$key.'_cnct']
);
print '</td><td>'."\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'select')) {
print $formadvtargetemaling->advMultiselectarray('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']);
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'select') {
print $formadvtargetemaling->advMultiselectarray('options_'.$key.'_cnct', $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key.'_cnct']);
print '</td><td>'."\n";
} elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'sellist')) {
print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$key]['param']['options'], $array_query['options_'.$key.'_cnct']);
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'sellist') {
print $formadvtargetemaling->advMultiselectarraySelllist('options_'.$key.'_cnct', $extrafields->attributes[$elementtype]['param'][$key]['options'], $array_query['options_'.$key.'_cnct']);
print '</td><td>'."\n";
} else {
if (is_array($array_query['options_'.$key.'_cnct'])) {
print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct');
print $extrafields->showInputField($key, implode(',', $array_query['options_'.$key.'_cnct']), '', '_cnct', '', '', 0, 'socpeople', 1);
} else {
print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct');
print $extrafields->showInputField($key, $array_query['options_'.$key.'_cnct'], '', '_cnct', '', '', 0, 'socpeople', 1);
}
print '</td><td>'."\n";
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/tpl/passwordreset.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
}

// DDOS protection
$size = (int) $_SERVER['CONTENT_LENGTH'];
$size = (int) ($_SERVER['CONTENT_LENGTH'] ?? 0);
if ($size > 10000) {
$langs->loadLangs(array("errors", "install"));
httponly_accessforbidden('<center>'.$langs->trans("ErrorRequestTooLarge").'<br><a href="'.DOL_URL_ROOT.'">'.$langs->trans("ClickHereToGoToApp").'</a></center>', 413, 1);
Expand Down
Loading

0 comments on commit 774a48f

Please sign in to comment.