FIX Link of download main doc on vat list

This commit is contained in:
Laurent Destailleur
2021-08-06 12:18:51 +02:00
parent 591b8acd51
commit c0c46fb704
5 changed files with 27 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
@@ -135,6 +136,7 @@ if (empty($reshook)) {
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db);
$tva_static = new Tva($db); $tva_static = new Tva($db);
$bankstatic = new Account($db); $bankstatic = new Account($db);
$accountingjournal = new AccountingJournal($db); $accountingjournal = new AccountingJournal($db);
@@ -445,7 +447,13 @@ while ($i < min($num, $limit)) {
// Ref // Ref
if (!empty($arrayfields['t.rowid']['checked'])) { if (!empty($arrayfields['t.rowid']['checked'])) {
print '<td>'.$tva_static->getNomUrl(1).'</td>'; print '<td>';
print $tva_static->getNomUrl(1);
$filename = dol_sanitizeFileName($tva_static->ref);
$filedir = $conf->tax->dir_output.'/vat/'.dol_sanitizeFileName($tva_static->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$tva_static->id;
print $formfile->getDocumentsLink($tva_static->element, $filename, $filedir, '', 'valignmiddle paddingleft2imp');
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@@ -985,9 +985,10 @@ class FormFile
* @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module. * @param string $modulesubdir Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
* @param string $filedir Full path to directory to scan * @param string $filedir Full path to directory to scan
* @param string $filter Filter filenames on this regex string (Example: '\.pdf$') * @param string $filter Filter filenames on this regex string (Example: '\.pdf$')
* @param string $morecss Add more css to the download picto
* @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles
*/ */
public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '') public function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '', $morecss = 'valignmiddle')
{ {
global $conf, $langs; global $conf, $langs;
@@ -1019,7 +1020,7 @@ class FormFile
$out .= '<!-- html.formfile::getDocumentsLink -->'."\n"; $out .= '<!-- html.formfile::getDocumentsLink -->'."\n";
if (!empty($file_list)) { if (!empty($file_list)) {
$out = '<dl class="dropdown inline-block"> $out = '<dl class="dropdown inline-block">
<dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', 'valignmiddle').'</a></dt> <dt><a data-ajax="false" href="#" onClick="return false;">'.img_picto('', 'listlight', '', 0, 0, 0, '', $morecss).'</a></dt>
<dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">'; <dd><div class="multichoicedoc" style="position:absolute;left:100px;" ><ul class="ulselectedfields">';
$tmpout = ''; $tmpout = '';

View File

@@ -2235,7 +2235,7 @@ function dol_most_recent_file($dir, $regexfilter = '', $excludefilter = array('(
* Security check when accessing to a document (used by document.php, viewimage.php and webservices to get documents). * Security check when accessing to a document (used by document.php, viewimage.php and webservices to get documents).
* TODO Replace code that set $accesallowed by a call to restrictedArea() * TODO Replace code that set $accesallowed by a call to restrictedArea()
* *
* @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp') * @param string $modulepart Module of document ('module', 'module_user_temp', 'module_user' or 'module_temp'). Exemple: 'medias', 'invoice', 'logs', 'tax-vat', ...
* @param string $original_file Relative path with filename, relative to modulepart. * @param string $original_file Relative path with filename, relative to modulepart.
* @param string $entity Restrict onto entity (0=no restriction) * @param string $entity Restrict onto entity (0=no restriction)
* @param User $fuser User object (forced) * @param User $fuser User object (forced)
@@ -2263,10 +2263,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$entity = 0; $entity = 0;
} }
} }
// Fix modulepart // Fix modulepart for backward compatibility
if ($modulepart == 'users') { if ($modulepart == 'users') {
$modulepart = 'user'; $modulepart = 'user';
} }
if ($modulepart == 'tva') {
$modulepart = 'tax-vat';
}
//print 'dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity; //print 'dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity;
dol_syslog('dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity); dol_syslog('dol_check_secure_access_document modulepart='.$modulepart.' original_file='.$original_file.' entity='.$entity);
@@ -2436,7 +2439,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = 1; $accessallowed = 1;
} }
$original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file; $original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file;
} elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { } elseif (in_array($modulepart, array('tax', 'tax-vat', 'tva')) && !empty($conf->tax->dir_output)) {
// Wrapping for taxes // Wrapping for taxes
if ($fuser->rights->tax->charges->{$lire}) { if ($fuser->rights->tax->charges->{$lire}) {
$accessallowed = 1; $accessallowed = 1;

View File

@@ -736,6 +736,9 @@ textarea.centpercent {
.paddingleft2 { .paddingleft2 {
padding-<?php print $left; ?>: 2px; padding-<?php print $left; ?>: 2px;
} }
.paddingleft2imp {
padding-<?php print $left; ?>: 2px !important;
}
.paddingright { .paddingright {
padding-<?php print $right; ?>: 4px; padding-<?php print $right; ?>: 4px;
} }

View File

@@ -878,12 +878,18 @@ textarea.centpercent {
.paddingleft2 { .paddingleft2 {
padding-<?php print $left; ?>: 2px; padding-<?php print $left; ?>: 2px;
} }
.paddingleft2imp {
padding-<?php print $left; ?>: 2px !important;
}
.paddingright { .paddingright {
padding-<?php print $right; ?>: 4px; padding-<?php print $right; ?>: 4px;
} }
.paddingright2 { .paddingright2 {
padding-<?php print $right; ?>: 2px; padding-<?php print $right; ?>: 2px;
} }
.paddingright2imp {
padding-<?php print $right; ?>: 2px !important;
}
.marginleft2 { .marginleft2 {
margin-<?php print $left; ?>: 2px; margin-<?php print $left; ?>: 2px;
} }