Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 21.0

This commit is contained in:
Laurent Destailleur
2025-06-13 16:25:06 +02:00
16 changed files with 105 additions and 32 deletions

View File

@@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2016-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@@ -378,13 +378,21 @@ if ($action != 'export_csv') {
// Accountancy account
$moreforfilter .= $langs->trans('AccountAccounting').': ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
} else {
$moreforfilter .= '<input type="text" class="maxwidth150" name="search_accountancy_code_start" value="'.dol_escape_htmltag($search_accountancy_code_start).'" placeholder="'.$langs->trans('From').'">';
}
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200', 'accounts');
}
$moreforfilter .= ' ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
} else {
$moreforfilter .= '<input type="text" class="maxwidth150" name="search_accountancy_code_end" value="'.dol_escape_htmltag($search_accountancy_code_end).'" placeholder="'.$langs->trans('to').'">';
}
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200', 'accounts');
}

View File

@@ -2,7 +2,7 @@
/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2013-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
* Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
*
@@ -801,13 +801,21 @@ $moreforfilter .= '<div class="divsearchfield">';
$moreforfilter .= $langs->trans('AccountAccounting').': ';
$moreforfilter .= '<div class="nowrap inline-block">';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
} else {
$moreforfilter .= '<input type="text" class="maxwidth150" name="search_accountancy_code_start" value="'.dol_escape_htmltag($search_accountancy_code_start).'" placeholder="'.$langs->trans('From').'">';
}
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200');
}
$moreforfilter .= ' ';
if ($type == 'sub') {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
$moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
} else {
$moreforfilter .= '<input type="text" class="maxwidth150" name="search_accountancy_code_end" value="'.dol_escape_htmltag($search_accountancy_code_end).'" placeholder="'.$langs->trans('to').'">';
}
} else {
$moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200');
}

View File

@@ -2916,7 +2916,7 @@ function dictFieldList($fieldlist, $obj = null, $tabname = '', $context = '')
} elseif ($value == 'type_vat') {
// VAT type 0: all, 1: sell, 2: purchase
print '<td class="center">';
print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ? '' : $obj->{$value}), 1);
print $form->selectarray($value, $type_vatList, (empty($obj->{$value}) ? '0' : $obj->{$value}));
print '</td>';
} elseif ($value == 'localtax1_type' || $value == 'localtax2_type') {
// Le type de taxe locale

View File

@@ -625,7 +625,7 @@ if ($type == Categorie::TYPE_CUSTOMER) {
$param = '&limit='.$limit.'&id='.$id.'&type='.$type;
$num = count($socs);
$nbtotalofrecords = '';
$newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&client=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('societe', 'creer'));
$newcardbutton = dolGetButtonTitle($langs->trans("AddThirdParty"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&custcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('societe', 'creer'));
// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
print_barre_liste($langs->trans("Customers"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'companies', 0, $newcardbutton, '', $limit);

View File

@@ -2061,7 +2061,7 @@ if ($action == 'create') {
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&prospect=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";

View File

@@ -1986,7 +1986,7 @@ if ($action == 'create' && $usercancreate) {
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";

View File

@@ -352,9 +352,9 @@ if (empty($numref)) {
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
$morehtml = '';
if ($action != 'addline' && $action != 'reconcile') {
$morehtml .= $buttonreconcile;
}
// if ($action != 'addline' && $action != 'reconcile') {
// $morehtml .= $buttonreconcile;
// }
print '<form name="aaa" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@@ -3520,7 +3520,7 @@ if ($action == 'create') {
</script>';
}
if (!GETPOSTINT('fac_rec')) {
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
}
print '</td>';
print '</tr>'."\n";

View File

@@ -1256,7 +1256,7 @@ if ($action == 'create') {
print '<td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";

View File

@@ -435,7 +435,7 @@ if ($action == 'create') {
});
</script>';
}
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td>';
}
print '</tr>'."\n";

View File

@@ -868,11 +868,13 @@ class EmailCollector extends CommonObject
if (function_exists('mb_convert_encoding')) {
// change spaces by entropy because mb_convert fail with spaces
$str = preg_replace("/ /", "xxxSPACExxx", $str); // the replacement string must be valid in utf7 so _ can't be used
$str = preg_replace("/_/", "xxxUNDERSCORExxx", $str); // encode underscore to avoid encoding issues with mb_convert
$str = preg_replace("/\[Gmail\]/", "xxxGMAILxxx", $str); // the replacement string must be valid in utf7 so _ can't be used
// if mb_convert work
if ($str = mb_convert_encoding($str, "UTF-7")) {
// change characters
$str = preg_replace("/\+A/", "&A", $str);
$str = preg_replace("/xxxUNDERSCORExxx/", "_", $str);
// change to spaces again
$str = preg_replace("/xxxSPACExxx/", " ", $str);
// change to [Gmail] again

View File

@@ -403,7 +403,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -520,7 +525,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -632,7 +642,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -748,7 +763,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -864,7 +884,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -978,7 +1003,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -1017,7 +1047,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -1046,7 +1081,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -1226,6 +1266,9 @@ if (empty($reshook)) {
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
@@ -1277,7 +1320,15 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
@@ -1374,7 +1425,12 @@ if (empty($reshook)) {
$newlang = GETPOST('lang_id', 'aZ09');
}
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang)) {
$newlang = $object->thirdparty->default_lang;
$user = new User($db);
$user->fetch($object->fk_user_author);
$newlang = $user->lang;
}
if (empty($newlang)) {
$newlang = $langs;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);

View File

@@ -1151,7 +1151,7 @@ if ($action == 'create') {
print '<table class="border centpercent">';
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300');
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print ' <a href="'.DOL_URL_ROOT.'/societe/card.php?action=create&customer=3&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create').'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span></a>';
print '</td></tr>';
print '</table>';

View File

@@ -2064,4 +2064,3 @@ class FactureFournisseurRec extends CommonInvoice
}
}
}

View File

@@ -813,7 +813,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
print $text;
}
if (!GETPOSTISSET('backtopage')) {
$url = '/societe/card.php?action=create&client=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create');
$url = '/societe/card.php?action=create&customer=3&fournisseur=0&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=create');
$newbutton = '<span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans("AddThirdParty").'"></span>';
// TODO @LDR Implement this
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {

View File

@@ -1484,9 +1484,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
break;
}
$selectedprospect = ((GETPOSTISSET('prospect') || $action == 'create') ? GETPOSTINT('prospect') : $selectedprospect);
$selectedcustomer = ((GETPOSTISSET('customer') || $action == 'create') ? GETPOSTINT('customer') : $selectedcustomer);
$selectedsupplier = ((GETPOSTISSET('supplier') || $action == 'create') ? GETPOSTINT('supplier') : $object->fournisseur);
$selectedprospect = ((GETPOSTISSET('prospect') && $action == 'create') ? GETPOSTINT('prospect') : $selectedprospect);
$selectedcustomer = ((GETPOSTISSET('customer') && $action == 'create') ? GETPOSTINT('customer') : $selectedcustomer);
$selectedsupplier = ((GETPOSTISSET('supplier') && $action == 'create') ? GETPOSTINT('supplier') : $object->fournisseur);
print '<tr class="marginbottomlarge height50">';
if ($conf->browser->layout != 'phone') {