Fix get custom odt templates

This commit is contained in:
Laurent Destailleur 2020-12-16 18:10:40 +01:00
parent 21c2fae00c
commit 82710e54a8
5 changed files with 19 additions and 7 deletions

View File

@ -2260,6 +2260,11 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
$accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file)));
$original_file = $dolibarr_main_data_root.'/'.$original_file;
} // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log
elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root))
{
$accessallowed = $user->admin;
$original_file = $dolibarr_main_data_root.'/doctemplates/'.$original_file;
} // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip
elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root))
{
$accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file)));

View File

@ -3210,7 +3210,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected',
'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'billa', 'billr', 'billd', 'bookmark', 'bom', 'building',
'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cron', 'cubes',
'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'delete', 'dolly', 'dollyrevert', 'donation', 'download', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt',
'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group',
'help', 'holiday',
'intervention', 'label', 'language', 'list', 'listlight', 'lot',

View File

@ -169,10 +169,14 @@ class doc_generic_order_odt extends ModelePDFCommandes
if ($nbofiles)
{
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
foreach ($listoffiles as $file)
{
$texte .= $file['name'].'<br>';
// Show list of found files
foreach ($listoffiles as $file)
{
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=orders/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
}
}
$texte .= '</div>';
}

View File

@ -168,10 +168,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
if ($nbofiles)
{
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
// Show list of found files
foreach ($listoffiles as $file)
{
$texte .= $file['name'].'<br>';
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=invoices/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
}
$texte .= '</div>';
}

View File

@ -172,13 +172,15 @@ class doc_generic_proposal_odt extends ModelePDFPropales
if ($nbofiles)
{
$texte .= '<div id="div_'.get_class($this).'" class="hidden">';
$texte .= '<div id="div_'.get_class($this).'" class="hiddenx">';
// Show list of found files
foreach ($listoffiles as $file)
{
$texte .= $file['name'].'<br>';
$texte .= '- '.$file['name'].' <a href="'.DOL_URL_ROOT.'/document.php?modulepart=doctemplates&file=proposals/'.urlencode(basename($file['name'])).'">'.img_picto('', 'listlight').'</a><br>';
}
$texte .= '</div>';
// Set default template for different status of proposal
if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0)
{
// Model for creation