Merge branch '11.0' of github.com:Dolibarr/dolibarr into 11.0

This commit is contained in:
florian HENRY 2020-06-01 10:05:07 +02:00
commit face2d644e
16 changed files with 102 additions and 54 deletions

View File

@ -2282,7 +2282,7 @@ class Adherent extends CommonObject
$sql.= " WHERE a.fk_adherent_type = t.rowid"; $sql.= " WHERE a.fk_adherent_type = t.rowid";
$sql.= " AND a.statut = 1"; $sql.= " AND a.statut = 1";
$sql.= " AND a.entity IN (".getEntity('adherent').")"; $sql.= " AND a.entity IN (".getEntity('adherent').")";
$sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = 1)"; $sql.= " AND ((a.datefin IS NULL or a.datefin < '".$this->db->idate($now)."') AND t.subscription = '1')";
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)

View File

@ -1208,7 +1208,7 @@ if (empty($reshook))
} }
// Add link between credit note and origin // Add link between credit note and origin
if (!empty($object->fk_facture_source)) { if (!empty($object->fk_facture_source) && $id > 0) {
$facture_source->fetch($object->fk_facture_source); $facture_source->fetch($object->fk_facture_source);
$facture_source->fetchObjectLinked(); $facture_source->fetchObjectLinked();

View File

@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('banks', 'categories', 'widthdrawals')); $langs->loadLangs(array('banks', 'categories', 'widthdrawals'));
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'contractlist'; // To manage different context of search
// Security check // Security check
$socid = GETPOST('socid', 'int'); $socid = GETPOST('socid', 'int');
if ($user->socid) $socid=$user->socid; if ($user->socid) $socid=$user->socid;
@ -102,7 +104,9 @@ if ($result)
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$urladd = "&amp;statut=".$statut; $param = '';
$param .= "&statut=".$statut;
if ($limit != $conf->liste_limit) $param .= '&limit=' . $limit;
$selectedfields = ''; $selectedfields = '';
@ -123,7 +127,7 @@ if ($result)
print '<input type="hidden" name="page" value="'.$page.'">'; print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">'; print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit); print_barre_liste($langs->trans("WithdrawalsReceipts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
$moreforfilter = ''; $moreforfilter = '';

View File

@ -212,8 +212,8 @@ abstract class CommonDocGenerator
'company_idprof6'=>$object->idprof6, 'company_idprof6'=>$object->idprof6,
'company_note_public'=>$object->note_public, 'company_note_public'=>$object->note_public,
'company_note_private'=>$object->note_private, 'company_note_private'=>$object->note_private,
'company_default_bank_iban'=>$object->bank_account->iban, 'company_default_bank_iban'=>(is_object($object->bank_account) ? $object->bank_account->iban : ''),
'company_default_bank_bic'=>$object->bank_account->bic 'company_default_bank_bic'=>(is_object($object->bank_account) ? $object->bank_account->bic : '')
); );
// Retrieve extrafields // Retrieve extrafields

View File

@ -1686,8 +1686,13 @@ class ExtraFields
} }
elseif ($type == 'select') elseif ($type == 'select')
{ {
if ($langfile && $param['options'][$value]) $value = $langs->trans($param['options'][$value]); $valstr = $param['options'][$value];
else $value = $param['options'][$value]; if (($pos = strpos($valstr, "|")) !== false)
{
$valstr = substr($valstr, 0, $pos);
}
if ($langfile && $valstr) $value = $langs->trans($valstr);
else $value = $valstr;
} }
elseif ($type == 'sellist') elseif ($type == 'sellist')
{ {

View File

@ -3711,7 +3711,8 @@ class Form
$sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc'; $sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc';
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture';
$sql .= ' WHERE entity IN ('.getEntity('invoice').')'; $sql .= ' WHERE entity IN ('.getEntity('invoice').')';
$sql .= ' AND situation_counter>=1'; $sql .= ' AND situation_counter >= 1';
$sql .= ' AND type <> 2';
$sql .= ' ORDER by situation_cycle_ref, situation_counter desc'; $sql .= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) { if ($resql && $this->db->num_rows($resql) > 0) {

View File

@ -1269,7 +1269,8 @@ class FormFile
} }
else else
{ {
print dol_trunc($file['name'], 200); $filenametoshow = preg_replace('/\.noexe$/', '', $file['name']);
print dol_trunc($filenametoshow, 200);
print '</a>'; print '</a>';
} }
// Preview link // Preview link

View File

@ -870,7 +870,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
{ {
$rel_filetorenamebefore = preg_replace('/^[\\/]/', '', $rel_filetorenamebefore); $rel_filetorenamebefore = preg_replace('/^[\\/]/', '', $rel_filetorenamebefore);
$rel_filetorenameafter = preg_replace('/^[\\/]/', '', $rel_filetorenameafter); $rel_filetorenameafter = preg_replace('/^[\\/]/', '', $rel_filetorenameafter);
//var_dump($rel_filetorenamebefore.' - '.$rel_filetorenameafter); //var_dump($rel_filetorenamebefore.' - '.$rel_filetorenameafter);exit;
dol_syslog("Try to rename also entries in database for full relative path before = ".$rel_filetorenamebefore." after = ".$rel_filetorenameafter, LOG_DEBUG); dol_syslog("Try to rename also entries in database for full relative path before = ".$rel_filetorenamebefore." after = ".$rel_filetorenameafter, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
@ -893,6 +893,7 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
$ecmfile->filepath = $rel_dir; $ecmfile->filepath = $rel_dir;
$ecmfile->filename = $filename; $ecmfile->filename = $filename;
$resultecm = $ecmfile->update($user); $resultecm = $ecmfile->update($user);
} }
elseif ($resultecm == 0) // If no entry were found for src files, create/update target file elseif ($resultecm == 0) // If no entry were found for src files, create/update target file
@ -995,7 +996,7 @@ function dolCheckVirus($src_file)
* @param integer $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error']) * @param integer $uploaderrorcode Value of PHP upload error code ($_FILES['field']['error'])
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @param string $varfiles _FILES var name * @param string $varfiles _FILES var name
* @return int|string >0 if OK, <0 or string if KO * @return int|string 1 if OK, 2 if OK and .noexe appended, <0 or string if KO
* @see dol_move() * @see dol_move()
*/ */
function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan = 0, $uploaderrorcode = 0, $nohook = 0, $varfiles = 'addedfile') function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan = 0, $uploaderrorcode = 0, $nohook = 0, $varfiles = 'addedfile')
@ -1005,6 +1006,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
$reshook = 0; $reshook = 0;
$file_name = $dest_file; $file_name = $dest_file;
$successcode = 1;
if (empty($nohook)) if (empty($nohook))
{ {
@ -1055,6 +1057,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
if (isAFileWithExecutableContent($dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED)) if (isAFileWithExecutableContent($dest_file) && empty($conf->global->MAIN_DOCUMENT_IS_OUTSIDE_WEBROOT_SO_NOEXE_NOT_REQUIRED))
{ {
$file_name .= '.noexe'; $file_name .= '.noexe';
$successcode = 2;
} }
// Security: // Security:
@ -1109,7 +1112,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
{ {
if (!empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK)); if (!empty($conf->global->MAIN_UMASK)) @chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK));
dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG); dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
return 1; // Success return $successcode; // Success
} }
else else
{ {
@ -1118,7 +1121,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
} }
} }
return 1; // Success return $successcode; // Success
} }
/** /**
@ -1173,8 +1176,6 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
} }
else else
{ {
$error = 0;
//print "x".$file." ".$disableglob;exit; //print "x".$file." ".$disableglob;exit;
$file_osencoded = dol_osencode($file); // New filename encoded in OS filesystem encoding charset $file_osencoded = dol_osencode($file); // New filename encoded in OS filesystem encoding charset
if (empty($disableglob) && !empty($file_osencoded)) if (empty($disableglob) && !empty($file_osencoded))
@ -1197,10 +1198,11 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
$rel_filetodelete = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filename); $rel_filetodelete = preg_replace('/^'.preg_quote(DOL_DATA_ROOT, '/').'/', '', $filename);
if (!preg_match('/(\/temp\/|\/thumbs\/|\.meta$)/', $rel_filetodelete)) // If not a tmp file if (!preg_match('/(\/temp\/|\/thumbs\/|\.meta$)/', $rel_filetodelete)) // If not a tmp file
{ {
$rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete);
if (is_object($db) && $indexdatabase) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1) if (is_object($db) && $indexdatabase) // $db may not be defined when lib is in a context with define('NOREQUIREDB',1)
{ {
$rel_filetodelete = preg_replace('/^[\\/]/', '', $rel_filetodelete);
$rel_filetodelete = preg_replace('/\.noexe$/', '', $rel_filetodelete);
dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG); dol_syslog("Try to remove also entries in database for full relative path = ".$rel_filetodelete, LOG_DEBUG);
include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php';
$ecmfile = new EcmFiles($db); $ecmfile = new EcmFiles($db);
@ -1564,6 +1566,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$destfile = dol_string_nohtmltag($destfile); $destfile = dol_string_nohtmltag($destfile);
$destfull = dol_string_nohtmltag($destfull); $destfull = dol_string_nohtmltag($destfull);
// Move file from temp directory to final directory. A .noexe may also be appended on file name.
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles); $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles);
if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists' if (is_numeric($resupload) && $resupload > 0) // $resupload can be 'ErrorFileAlreadyExists'
@ -1600,10 +1603,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
// Update table of files // Update table of files
if ($donotupdatesession == 1) if ($donotupdatesession == 1)
{ {
$result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0); $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile).($resupload == 2 ? '.noexe' : ''), $TFile['name'][$i], 'uploaded', 0);
if ($result < 0) if ($result < 0)
{ {
setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); setEventMessages('WarningFailedToAddFileIntoDatabaseIndex', '', 'warnings');
} }
} }
@ -1714,7 +1717,7 @@ function dol_remove_file_process($filenb, $donotupdatesession = 0, $donotdeletef
* See also commonGenerateDocument that also add/update database index when a file is generated. * See also commonGenerateDocument that also add/update database index when a file is generated.
* *
* @param string $dir Directory name (full real path without ending /) * @param string $dir Directory name (full real path without ending /)
* @param string $file File name * @param string $file File name (May end with '.noexe')
* @param string $fullpathorig Full path of origin for file (can be '') * @param string $fullpathorig Full path of origin for file (can be '')
* @param string $mode How file was created ('uploaded', 'generated', ...) * @param string $mode How file was created ('uploaded', 'generated', ...)
* @param int $setsharekey Set also the share key * @param int $setsharekey Set also the share key
@ -1730,7 +1733,7 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo
if (!preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir if (!preg_match('/[\\/]temp[\\/]|[\\/]thumbs|\.meta$/', $rel_dir)) // If not a tmp dir
{ {
$filename = basename($file); $filename = basename(preg_replace('/\.noexe$/', '', $file));
$rel_dir = preg_replace('/[\\/]$/', '', $rel_dir); $rel_dir = preg_replace('/[\\/]$/', '', $rel_dir);
$rel_dir = preg_replace('/^[\\/]/', '', $rel_dir); $rel_dir = preg_replace('/^[\\/]/', '', $rel_dir);

View File

@ -1275,7 +1275,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1);
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
$pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); $pdf->MultiCell($largcol2, $tab2_hl, price(price2num($tvaval, 'MT'), 0, $outputlangs), 0, 'R', 1);
} }
} }

View File

@ -178,7 +178,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
print '</td></tr>'; print '</td></tr>';
} }
else // Show filtree when ajax is disabled (rare) else // Show file tree when ajax is disabled (rare)
{ {
print '<tr><td style="padding-left: 20px">'; print '<tr><td style="padding-left: 20px">';
@ -212,7 +212,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
<div class="pane-in ecm-in-layout-center"> <div class="pane-in ecm-in-layout-center">
<div id="ecmfileview" class="ecmfileview"> <div id="ecmfileview" class="ecmfileview">
<?php <?php
// Start right panel // Start right panel - List of content of a directory
$mode='noajax'; $mode='noajax';

View File

@ -138,7 +138,7 @@ class EcmFiles extends CommonObject
$this->entity = trim($this->entity); $this->entity = trim($this->entity);
} }
if (isset($this->filename)) { if (isset($this->filename)) {
$this->filename = trim($this->filename); $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));
} }
if (isset($this->filepath)) { if (isset($this->filepath)) {
$this->filepath = trim($this->filepath); $this->filepath = trim($this->filepath);
@ -346,12 +346,13 @@ class EcmFiles extends CommonObject
$sql .= " t.src_object_id"; $sql .= " t.src_object_id";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql.= ' WHERE 1 = 1'; $sql.= ' WHERE 1 = 1';
/* Fetching this table depends on filepath+filename, it must not depends on entity /* Fetching this table depends on filepath+filename, it must not depends on entity because filesystem on disk does not know what is Dolibarr entities
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND entity IN (" . getEntity('ecmfiles') . ")"; $sql .= " AND entity IN (" . getEntity('ecmfiles') . ")";
}*/ }*/
if ($relativepath) { if ($relativepath) {
$sql .= " AND t.filepath = '" . $this->db->escape(dirname($relativepath)) . "' AND t.filename = '".$this->db->escape(basename($relativepath))."'"; $relativepathwithnoexe = preg_replace('/\.noexe$/', '', $relativepath); // We must never have the .noexe into the database
$sql .= " AND t.filepath = '" . $this->db->escape(dirname($relativepath)) . "' AND t.filename = '".$this->db->escape(basename($relativepathwithnoexe))."'";
$sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index $sql .= " AND t.entity = ".$conf->entity; // unique key include the entity so each company has its own index
} }
elseif (! empty($ref)) { // hash of file path elseif (! empty($ref)) { // hash of file path
@ -564,10 +565,11 @@ class EcmFiles extends CommonObject
$this->entity = trim($this->entity); $this->entity = trim($this->entity);
} }
if (isset($this->filename)) { if (isset($this->filename)) {
$this->filename = trim($this->filename); $this->filename = preg_replace('/\.noexe$/', '', trim($this->filename));
} }
if (isset($this->filepath)) { if (isset($this->filepath)) {
$this->filepath = trim($this->filepath); $this->filepath = trim($this->filepath);
$this->filepath = preg_replace('/[\\/]+$/', '', $this->filepath); // Remove last /
} }
if (isset($this->fullpath_orig)) { if (isset($this->fullpath_orig)) {
$this->fullpath_orig = trim($this->fullpath_orig); $this->fullpath_orig = trim($this->fullpath_orig);

View File

@ -139,6 +139,12 @@ if ($action == 'update')
$oldfile = $olddir.$oldlabel; $oldfile = $olddir.$oldlabel;
$newfile = $newdir.$newlabel; $newfile = $newdir.$newlabel;
$newfileformove = $newfile;
// If old file end with .noexe, new file must also end with .noexe
if (preg_match('/\.noexe$/', $oldfile) && ! preg_match('/\.noexe$/', $newfileformove)) {
$newfileformove .= '.noexe';
}
//var_dump($oldfile);var_dump($newfile);exit;
// Now we update index of file // Now we update index of file
$db->begin(); $db->begin();
@ -146,7 +152,7 @@ if ($action == 'update')
//print $oldfile.' - '.$newfile; //print $oldfile.' - '.$newfile;
if ($newlabel != $oldlabel) if ($newlabel != $oldlabel)
{ {
$result = dol_move($oldfile, $newfile); // This include update of database $result = dol_move($oldfile, $newfileformove); // This include update of database
if (!$result) if (!$result)
{ {
$langs->load('errors'); $langs->load('errors');
@ -190,7 +196,7 @@ if ($action == 'update')
$object->entity = $conf->entity; $object->entity = $conf->entity;
$object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument); $object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument);
$object->filename = $newlabel; $object->filename = $newlabel;
$object->label = md5_file(dol_osencode($newfile)); // hash of file content $object->label = md5_file(dol_osencode($newfileformove)); // hash of file content
$object->fullpath_orig = ''; $object->fullpath_orig = '';
$object->gen_or_uploaded = 'unknown'; $object->gen_or_uploaded = 'unknown';
$object->description = ''; // indexed content $object->description = ''; // indexed content
@ -208,6 +214,11 @@ if ($action == 'update')
$db->commit(); $db->commit();
$urlfile = $newlabel; $urlfile = $newlabel;
// If old file end with .noexe, new file must also end with .noexe
if (preg_match('/\.noexe$/', $newfileformove)) {
$urlfile .= '.noexe';
}
header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'&section='.urlencode($section)); header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'&section='.urlencode($section));
exit; exit;
} }
@ -264,9 +275,13 @@ while ($tmpecmdir && $result > 0)
$i++; $i++;
} }
$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfile);
$s = img_picto('', 'object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s.' -> '; $s = img_picto('', 'object_dir').' <a href="'.DOL_URL_ROOT.'/ecm/index.php">'.$langs->trans("ECMRoot").'</a> -> '.$s.' -> ';
if ($action == 'edit') $s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfile.'">'; if ($action == 'edit') $s .= '<input type="text" name="label" class="quatrevingtpercent" value="'.$urlfiletoshow.'">';
else $s .= $urlfile; else $s .= $urlfiletoshow;
$morehtml = '';
$object->ref = ''; // Force to hide ref $object->ref = ''; // Force to hide ref
dol_banner_tab($object, '', $morehtml, 0, '', '', $s); dol_banner_tab($object, '', $morehtml, 0, '', '', $s);
@ -289,10 +304,9 @@ print dol_print_size($totalsize);
print '</td></tr>'; print '</td></tr>';
*/ */
// Hash of file content
print '<tr><td>'.$langs->trans("HashOfFileContent").'</td><td>'; print '<tr><td>'.$langs->trans("HashOfFileContent").'</td><td>';
$object = new EcmFiles($db); $object = new EcmFiles($db);
//$filenametosearch=basename($filepath);
//$filedirtosearch=basedir($filepath);
$object->fetch(0, '', $filepathtodocument); $object->fetch(0, '', $filepathtodocument);
if (!empty($object->label)) if (!empty($object->label))
{ {

View File

@ -124,15 +124,17 @@ if ($action == 'confirm_deletefile')
if (GETPOST('confirm') == 'yes') if (GETPOST('confirm') == 'yes')
{ {
// GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections. // GETPOST('urlfile','alpha') is full relative URL from ecm root dir. Contains path of all sections.
//var_dump(GETPOST('urlfile'));exit;
$upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:''); $upload_dir = $conf->ecm->dir_output.($relativepath?'/'.$relativepath:'');
$file = $upload_dir . "/" . GETPOST('urlfile', 'alpha'); $file = $upload_dir . "/" . GETPOST('urlfile', 'alpha');
//var_dump($file);exit;
$ret=dol_delete_file($file); // This include also the delete from file index in database. $ret=dol_delete_file($file); // This include also the delete from file index in database.
if ($ret) if ($ret)
{ {
setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile', 'alpha')), null, 'mesgs'); $urlfiletoshow = GETPOST('urlfile', 'alpha');
$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfiletoshow);
setEventMessages($langs->trans("FileWasRemoved", $urlfiletoshow), null, 'mesgs');
$result=$ecmdir->changeNbOfFiles('-'); $result=$ecmdir->changeNbOfFiles('-');
} }
else else

View File

@ -75,8 +75,6 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC"; if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) if (!$sortfield)
{ {
//if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sortfield="fd.date";
//else
$sortfield = "f.ref"; $sortfield = "f.ref";
} }
@ -203,7 +201,7 @@ foreach ($arrayfields as $tmpkey => $tmpval)
$sql = "SELECT"; $sql = "SELECT";
$sql .= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,"; $sql .= " f.ref, f.rowid, f.fk_statut, f.description, f.datec as date_creation, f.tms as date_update, f.note_private,";
if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= "fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,"; if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= " fd.rowid as lineid, fd.description as descriptiondetail, fd.date as dp, fd.duree,";
$sql .= " s.nom as name, s.rowid as socid, s.client"; $sql .= " s.nom as name, s.rowid as socid, s.client";
if (!empty($conf->projet->enabled)) { if (!empty($conf->projet->enabled)) {
$sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title"; $sql .= ", pr.rowid as projet_id, pr.ref as projet_ref, pr.title as projet_title";
@ -245,7 +243,7 @@ if ($search_contrat_ref) {
$sql .= natural_search('c.ref', $search_contrat_ref); $sql .= natural_search('c.ref', $search_contrat_ref);
} }
if ($search_desc) { if ($search_desc) {
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc); if (empty($conf->global->FICHINTER_DISABLE_DETAILS) && $atleastonefieldinlines) $sql .= natural_search(array('f.description', 'fd.description'), $search_desc);
else $sql .= natural_search(array('f.description'), $search_desc); else $sql .= natural_search(array('f.description'), $search_desc);
} }
if ($search_status != '' && $search_status >= 0) { if ($search_status != '' && $search_status >= 0) {

View File

@ -255,3 +255,4 @@ WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different re
WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report
WarningProjectClosed=Project is closed. You must re-open it first. WarningProjectClosed=Project is closed. You must re-open it first.
WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list. WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list.
WarningFailedToAddFileIntoDatabaseIndex=Warnin, failed to add file entry into ECM database index table

View File

@ -643,6 +643,12 @@ class Societe extends CommonObject
*/ */
public $multicurrency_code; public $multicurrency_code;
/**
* @var Account Default BAN account
*/
public $bank_account;
/** /**
* Constructor * Constructor
* *
@ -4194,6 +4200,17 @@ class Societe extends CommonObject
} }
} }
if (! isset($this->bank_account)) {
require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php';
$bac = new CompanyBankAccount($this->db);
$result = $bac->fetch(0, $this->id);
if ($result > 0) {
$this->bank_account = $bac;
} else {
$this->bank_account = '';
}
}
$modelpath = "core/modules/societe/doc/"; $modelpath = "core/modules/societe/doc/";
$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);