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

This commit is contained in:
Laurent Destailleur 2023-01-30 02:29:43 +01:00
commit 1bbcd3c403
3 changed files with 38 additions and 9 deletions

View File

@ -5,7 +5,7 @@
* Copyright (C) 2015 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2016-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2013-2017 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2017 Elarifr. Ari Elbaz <github@accedinfo.com>
* Copyright (C) 2017-2019 Frédéric France <frederic.france@netlogic.fr>
@ -579,7 +579,7 @@ class AccountancyExport
/**
* Export format : Quadratus (Format ASCII)
* Format since 2015 compatible QuadraCOMPTA
* Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr)
* Last review for this format : 2023/01/28 Alexandre Spangaro (aspangaro@open-dsi.fr)
*
* Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html
* In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)"
@ -597,6 +597,14 @@ class AccountancyExport
// $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
// $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ($TData as $data) {
// Clean some data
$data->doc_ref = dol_string_unaccent($data->doc_ref);
$data->label_operation = dol_string_unaccent($data->label_operation);
$data->numero_compte = dol_string_unaccent($data->numero_compte);
$data->label_compte = dol_string_unaccent($data->label_compte);
$data->subledger_account = dol_string_unaccent($data->subledger_account);
$data->subledger_label = dol_string_unaccent($data->subledger_label);
$code_compta = $data->numero_compte;
if (!empty($data->subledger_account)) {
$code_compta = $data->subledger_account;
@ -628,9 +636,9 @@ class AccountancyExport
if ($data->doc_type == 'customer_invoice') {
$Tab['type_compte'] = 'C';
} elseif ($data->doc_type == 'supplier_invoice') {
$Tab['coll_compte'] = 'F';
$Tab['type_compte'] = 'F';
} else {
$Tab['coll_compte'] = 'G';
$Tab['type_compte'] = 'G';
}
$Tab['filler3'] = str_repeat(' ', 235);
@ -651,7 +659,7 @@ class AccountancyExport
//$Tab['date_ecriture'] = $date_ecriture;
$Tab['date_ecriture'] = dol_print_date($data->doc_date, '%d%m%y');
$Tab['filler'] = ' ';
$Tab['libelle_ecriture'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref).' '.dol_string_unaccent($data->label_operation), 20), 20);
$Tab['libelle_ecriture'] = str_pad(self::trunc($data->doc_ref.' '.$data->label_operation, 20), 20);
// Credit invoice - invert sens
/*
@ -701,8 +709,8 @@ class AccountancyExport
// TODO: we should filter more than only accent to avoid wrong line size
// TODO: remove invoice number doc_ref in libelle,
// TODO: we should offer an option for customer to build the libelle using invoice number / name / date in accounting software
//$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->doc_ref) . ' ' . dol_string_unaccent($data->label_operation), 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc(dol_string_unaccent($data->label_operation), 30), 30);
//$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->doc_ref . ' ' . $data->label_operation, 30), 30);
$Tab['libelle_ecriture2'] = str_pad(self::trunc($data->label_operation, 30), 30);
$Tab['codetva'] = str_repeat(' ', 2);
// We need to keep the 10 lastest number of invoice doc_ref not the beginning part that is the unusefull almost same part

View File

@ -715,7 +715,7 @@ class DoliDBMysqli extends DoliDB
}
$tmpdatabase = preg_replace('/[^a-z0-9\.\-\_]/i', '', $database);
$sql = "SHOW TABLES FROM ".$tmpdatabase." ".$like.";";
$sql = "SHOW TABLES FROM `".$tmpdatabase."` ".$like.";";
//print $sql;
$result = $this->query($sql);
if ($result) {

View File

@ -289,6 +289,11 @@ $parameters = [
'validpaymentmethod' => &$validpaymentmethod
];
$reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif ($reshook > 0) {
print $hookmanager->resPrint;
}
// Check security token
$tmpsource = $source;
@ -2028,6 +2033,12 @@ if ($action != 'dopayment') {
'object' => $object
];
$reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif ($reshook > 0) {
print $hookmanager->resPrint;
}
if ($source == 'order' && $object->billed) {
print '<br><br><span class="amountpaymentcomplete size15x">'.$langs->trans("OrderBilled").'</span>';
} elseif ($source == 'invoice' && $object->paye) {
@ -2049,6 +2060,12 @@ if ($action != 'dopayment') {
'paymentmethod' => $paymentmethod
];
$reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif ($reshook > 0) {
print $hookmanager->resPrint;
}
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && isModEnabled('paybox')) {
print '<div class="button buttonpayment" id="div_dopayment_paybox"><span class="fa fa-credit-card"></span> <input class="" type="submit" id="dopayment_paybox" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
print '<br>';
@ -2652,9 +2669,13 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
'dopayment' => GETPOST('dopayment', 'alpha')
];
$reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
} elseif ($reshook > 0) {
print $hookmanager->resPrint;
}
}
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object);
llxFooter('', 'public');