Merge v22

This commit is contained in:
Laurent Destailleur
2025-12-06 05:06:24 +01:00
5 changed files with 16 additions and 50 deletions

View File

@@ -658,9 +658,9 @@ class FormMail extends Form
continue;
}
if (is_array($val)) $val = implode(', ', $val); // key __MULTICURRENCY_CODE__ is an array and crashes dolGetFirstLineOfText function which accept only text
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>';
$helpforsubstitution .= '</span>';
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText((string) $val))).'<br>';
}
$helpforsubstitution .= '</span>';
}
/*

View File

@@ -3485,6 +3485,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
if ($fuser->hasRight('fournisseur', 'facture', $lire) || preg_match('/^specimen/i', $original_file)) {
$accessallowed = 1;
}
$original_file = preg_replace("/payment\//", "", $original_file); // Because the $conf->fournisseur->payment->dir_output already contains the "payment/"
$original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file;
$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity;
} elseif ($modulepart == 'payment') {

View File

@@ -294,7 +294,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
}
//dol_syslog("price.lib::calcul_price_total $qty, $pu, $remise_percent_ligne, $txtva, $price_base_type $info_bits");
if ($price_base_type == 'HT') {
if ($price_base_type != 'TTC') {
// We work to define prices using the price without tax
$result[6] = price2num($tot_sans_remise, 'MT');
$result[8] = price2num($tot_sans_remise * (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)) + $localtaxes[0], 'MT'); // Selon TVA NPR ou non
@@ -386,7 +386,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt
// If rounding is not using base 10 (rare)
if (getDolGlobalString('MAIN_ROUNDING_RULE_TOT')) {
if ($price_base_type == 'HT') {
if ($price_base_type != 'TTC') {
$result[0] = price2num(round((float) $result[0] / getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 0) * getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 'MT');
$result[1] = price2num(round((float) $result[1] / getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 0) * getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 'MT');
$result[9] = price2num(round((float) $result[9] / getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 0) * getDolGlobalFloat('MAIN_ROUNDING_RULE_TOT'), 'MT');

View File

@@ -31,13 +31,6 @@
// Load Dolibarr environment
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
/**
* @var Conf $conf
* @var DoliDB $db
@@ -45,6 +38,11 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
* @var Translate $langs
* @var User $user
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
// Load translation files required by the page
$langs->loadLangs(array('banks', 'bills', 'companies', 'suppliers'));
@@ -195,8 +193,9 @@ if ($result > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
@@ -279,7 +278,9 @@ if ($result > 0) {
print '</div>';
print '<br>';
print '<br><br>';
/**
* List of seller's invoices

View File

@@ -121,43 +121,7 @@ if ($object->id > 0 && $upload_dir !== null) {
// Supplier order card
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Date of payment
$morehtmlref .= $form->editfieldkey("Date", 'datep', $object->date, $object, (int) ($object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))), 'datehourpicker', '', 0, 3).': ';
$morehtmlref .= $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer")), 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
// Payment mode
$morehtmlref .= '<br>'.$langs->trans('PaymentMode').' : ';
$morehtmlref .= $langs->trans("PaymentType".$object->type_code) != "PaymentType".$object->type_code ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
$morehtmlref .= $object->num_payment ? ' - '.$object->num_payment : '';
// Thirdparty
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1);
// Amount
$morehtmlref .= '<br>'.$langs->trans('Amount').' : '. price($object->amount, 0, $langs, 0, 0, -1, $conf->currency);
$allow_delete = 1;
// Bank account
if (isModEnabled("bank")) {
if ($object->fk_account) {
$bankline = new AccountLine($db);
$bankline->fetch($object->bank_line);
if ($bankline->rappro) {
$allow_delete = 0;
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemoveConciliatedPayment"));
}
$morehtmlref .= '<br>'.$langs->trans('BankAccount').' : ';
$accountstatic = new Account($db);
$accountstatic->fetch($bankline->fk_account);
$morehtmlref .= $accountstatic->getNomUrl(1);
$morehtmlref .= '<br>'.$langs->trans('BankTransactionLine').' : ';
$morehtmlref .= $bankline->getNomUrl(1, 0, 'showconciliated');
}
}
$morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);