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

This commit is contained in:
Laurent Destailleur 2023-09-16 13:30:42 +02:00
commit fe329cfc26
4 changed files with 23 additions and 22 deletions

View file

@ -979,13 +979,13 @@ class AccountancyExport
print $date_document . $separator;
// FEC:CompteNum
print $line->numero_compte . $separator;
print length_accountg($line->numero_compte) . $separator;
// FEC:CompteLib
print dol_string_unaccent($line->label_compte) . $separator;
// FEC:CompAuxNum
print $line->subledger_account . $separator;
print length_accounta($line->subledger_account) . $separator;
// FEC:CompAuxLib
print dol_string_unaccent($line->subledger_label) . $separator;

View file

@ -509,8 +509,8 @@ if (!$error && $massaction == 'confirm_presend') {
$resaction .= '<div class="error">'.$mailfile->error.'</div>';
} else {
$result = $mailfile->sendfile();
if ($result) {
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'<br>'; // Must not contain "
if ($result > 0) {
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($mailfile->addr_from, 2), $mailfile->getValidAddress($mailfile->addr_to, 2)).'<br>'; // Must not contain "
$error = 0;

View file

@ -1237,8 +1237,8 @@ class ExpenseReport extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',";
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
$sql .= " date_valid='".$this->db->idate($this->date_valid)."',";
$sql .= " fk_user_valid = ".$user->id;
$sql .= " date_valid = '".$this->db->idate($this->date_valid)."',";
$sql .= " fk_user_valid = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
$resql = $this->db->query($sql);
@ -1261,7 +1261,7 @@ class ExpenseReport extends CommonObject
// Now we rename also files into index
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'expensereport/".$this->db->escape($this->newref)."'";
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expensereport/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expensereport/".$this->db->escape($this->ref)."' AND entity = ".((int) $this->entity);
$resql = $this->db->query($sql);
if (!$resql) {
$error++; $this->error = $this->db->lasterror();
@ -1270,15 +1270,15 @@ class ExpenseReport extends CommonObject
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
$oldref = dol_sanitizeFileName($this->ref);
$newref = dol_sanitizeFileName($num);
$dirsource = $conf->expensereport->dir_output.'/'.$oldref;
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
$dirsource = $conf->expensereport->multidir_output[$this->entity].'/'.$oldref;
$dirdest = $conf->expensereport->multidir_output[$this->entity].'/'.$newref;
if (!$error && file_exists($dirsource)) {
dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
if (@rename($dirsource, $dirdest)) {
dol_syslog("Rename ok");
// Rename docs starting with $oldref with $newref
$listoffiles = dol_dir_list($conf->expensereport->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
$listoffiles = dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref, '/'));
foreach ($listoffiles as $fileentry) {
$dirsource = $fileentry['name'];
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);

View file

@ -36,6 +36,7 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@ -531,22 +532,22 @@ if ($search_finished >= 0 && $search_finished !== '') {
$sql .= " AND p.finished = ".((int) $search_finished);
}
if ($search_accountancy_code_sell) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell', $search_accountancy_code_sell);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell', clean_account($search_accountancy_code_sell));
}
if ($search_accountancy_code_sell_intra) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_intra', $search_accountancy_code_sell_intra);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_intra', clean_account($search_accountancy_code_sell_intra));
}
if ($search_accountancy_code_sell_export) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_export', $search_accountancy_code_sell_export);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_sell_export', clean_account($search_accountancy_code_sell_export));
}
if ($search_accountancy_code_buy) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy', $search_accountancy_code_buy);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy', clean_account($search_accountancy_code_buy));
}
if ($search_accountancy_code_buy_intra) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_intra', $search_accountancy_code_buy_intra);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_intra', clean_account($search_accountancy_code_buy_intra));
}
if ($search_accountancy_code_buy_export) {
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', $search_accountancy_code_buy_export);
$sql .= natural_search($alias_product_perentity . '.accountancy_code_buy_export', clean_account($search_accountancy_code_buy_export));
}
// Add where from extra fields
@ -1776,38 +1777,38 @@ if ($resql) {
}
// Accountancy code sell
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell']['checked'])) {
print '<td>'.$obj->accountancy_code_sell.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_intra.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell_intra).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_sell_export']['checked'])) {
print '<td>'.$obj->accountancy_code_sell_export.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_sell_export).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
// Accountancy code buy
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy']['checked'])) {
print '<td>'.$obj->accountancy_code_buy.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_intra']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_intra.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy_intra).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}
}
if (!empty($arrayfields[$alias_product_perentity . '.accountancy_code_buy_export']['checked'])) {
print '<td>'.$obj->accountancy_code_buy_export.'</td>';
print '<td>'.length_accountg($obj->accountancy_code_buy_export).'</td>';
if (!$i) {
$totalarray['nbfield']++;
}