# WARNING: head commit changed in the meantime

Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 14.0
This commit is contained in:
Laurent Destailleur 2022-04-03 17:12:45 +02:00
parent 06689a3fce
commit 440b5350df

View File

@ -19,7 +19,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** /**
* \file htdocs/compta/accounting-files.php * \file htdocs/compta/accounting-files.php
* \ingroup compta * \ingroup compta
* \brief Page to show portoflio and files of a thirdparty and download it * \brief Page to show portoflio and files of a thirdparty and download it
@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) {
$zip->addFromString('transactions.csv', $log); $zip->addFromString('transactions.csv', $log);
$zip->close(); $zip->close();
///Then download the zipped file. // Then download the zipped file.
header('Content-Type: application/zip'); header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-disposition: attachment; filename='.basename($zipname));
header('Content-Length: '.filesize($zipname)); header('Content-Length: '.filesize($zipname));
@ -588,14 +588,13 @@ foreach ($listofchoices as $choice => $val) {
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>'; print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.$disabled.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
} }
print '<input class="button" type="submit" name="search" value="'.$langs->trans("Search").'">'; print '<input type="submit" class="button small" name="search" value="'.$langs->trans("Search").'">';
print '</form>'."\n"; print '</form>'."\n";
print dol_get_fiche_end(); print dol_get_fiche_end();
if (!empty($date_start) && !empty($date_stop)) { if (!empty($date_start) && !empty($date_stop)) {
$param = 'action=searchfiles';
$param .= '&date_startday='.GETPOST('date_startday', 'int'); $param .= '&date_startday='.GETPOST('date_startday', 'int');
$param .= '&date_startmonth='.GETPOST('date_startmonth', 'int'); $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int');
$param .= '&date_startyear='.GETPOST('date_startyear', 'int'); $param .= '&date_startyear='.GETPOST('date_startyear', 'int');
@ -603,13 +602,30 @@ if (!empty($date_start) && !empty($date_stop)) {
$param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int'); $param .= '&date_stopmonth='.GETPOST('date_stopmonth', 'int');
$param .= '&date_stopyear='.GETPOST('date_stopyear', 'int'); $param .= '&date_stopyear='.GETPOST('date_stopyear', 'int');
foreach ($listofchoices as $choice => $val) { foreach ($listofchoices as $choice => $val) {
$param .= '&'.$choice.'='.(GETPOST($choice, 'int') ? 1 : 0); if (GETPOST($choice, 'int')) {
$param .= '&'.$choice.'=1';
} }
print '<form name="dl" action="'.$_SERVER["PHP_SELF"].'?action=dl" method="POST">'."\n"; }
print '<input type="hidden" name="token" value="'.currentToken().'">';
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
$filename = dol_print_date($date_start, 'dayrfc', 'tzuserrel')."-".dol_print_date($date_stop, 'dayrfc', 'tzuserrel').'_export.zip';
echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel'); echo dol_print_date($date_start, 'day', 'tzuserrel')." - ".dol_print_date($date_stop, 'day', 'tzuserrel');
print '<a class="marginleftonly small'.(empty($TData) ? ' butActionRefused' : ' butAction').'" href="'.$_SERVER["PHP_SELF"].'?action=dl&token='.newToken().'&output=file&file='.urlencode($filename).$param.'"';
if (empty($TData)) {
print " disabled";
}
print '>'."\n";
print $langs->trans("Download");
print '</a><br>';
$param .= '&action=searchfiles';
/*
print '<input type="hidden" name="token" value="'.currentToken().'">';
print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />'; print '<input type="hidden" name="date_startday" value="'.GETPOST('date_startday', 'int').'" />';
print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />'; print '<input type="hidden" name="date_startmonth" value="'.GETPOST('date_startmonth', 'int').'" />';
print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />'; print '<input type="hidden" name="date_startyear" value="'.GETPOST('date_startyear', 'int').'" />';
@ -620,8 +636,13 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">'; print '<input type="hidden" name="'.$choice.'" value="'.GETPOST($choice).'">';
} }
print '<input class="butAction butDownload" type="submit" value="'.$langs->trans("Download").'" />'; print '<input class="butAction butDownload small marginleftonly" type="submit" value="'.$langs->trans("Download").'"';
if (empty($TData)) {
print " disabled";
}
print '/>';
print '</form>'."\n"; print '</form>'."\n";
*/
print '<br>'; print '<br>';
@ -645,11 +666,9 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td class="center">'.$langs->trans("Currency").'</td>'; print '<td class="center">'.$langs->trans("Currency").'</td>';
} }
print '</tr>'; print '</tr>';
if ($result) {
$TData = dol_sort_array($filesarray, $sortfield, $sortorder);
if (empty($TData)) { if (empty($TData)) {
print '<tr class="oddeven"><td colspan="7">'.$langs->trans("NoItem").'</td>'; print '<tr class="oddeven"><td colspan="13"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td>';
if (!empty($conf->multicurrency->enabled)) { if (!empty($conf->multicurrency->enabled)) {
print '<td></td>'; print '<td></td>';
} }
@ -672,7 +691,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<tr class="oddeven '.$html_class.'">'; print '<tr class="oddeven '.$html_class.'">';
// Type // Type
print '<td>'.$langs->trans($data['item']).'</td>'; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans($data['item'])).'">'.$langs->trans($data['item']).'</td>';
// Date // Date
print '<td class="center">'; print '<td class="center">';
@ -685,7 +704,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print "</td>\n"; print "</td>\n";
// Ref // Ref
print '<td class="nowraponall">'; print '<td class="nowraponall tdoverflowmax150">';
if ($data['item'] == 'Invoice') { if ($data['item'] == 'Invoice') {
$invoice->id = $data['id']; $invoice->id = $data['id'];
@ -733,23 +752,33 @@ if (!empty($date_start) && !empty($date_stop)) {
print '</td>'; print '</td>';
// File link // File link
print '<td>'; print '<td class="tdoverflowmax150">';
if (!empty($data['files'])) { if (!empty($data['files'])) {
foreach ($data['files'] as $id => $filecursor) { foreach ($data['files'] as $id => $filecursor) {
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank">'.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'</a>&nbsp;'.$formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name']).'<br>'; $tmppreview = $formfile->showPreview($filecursor, $filecursor['modulepart'], $filecursor['subdir'].'/'.$filecursor['name'], 0);
if ($tmppreview) {
print $tmppreview;
}
$filename = ($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']);
print '<a href='.DOL_URL_ROOT.'/'.$filecursor['link'].' target="_blank" rel="noopener noreferrer" title="'.dol_escape_htmltag($filename).'">';
if (empty($tmppreview)) {
print img_picto('', 'generic', '', false, 0, 0, '', 'pictonopreview pictofixedwidth paddingright');
}
print $filename;
print '</a><br>';
} }
} }
print "</td>\n"; print "</td>\n";
// Paid // Paid
print '<td aling="left">'.$data['paid'].'</td>'; print '<td class="center">'.($data['paid'] ? yn($data['paid']) : '').'</td>';
// Total ET // Total ET
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</td>\n"; print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ht'] : -$data['amount_ht'], 'MT'))."</span></td>\n";
// Total IT // Total IT
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</td>\n"; print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_ttc'] : -$data['amount_ttc'], 'MT'))."</span></td>\n";
// Total VAT // Total VAT
print '<td align="right">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</td>\n"; print '<td align="right"><span class="amount">'.price(price2num($data['sens'] ? $data['amount_vat'] : -$data['amount_vat'], 'MT'))."</span></td>\n";
print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n"; print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($data['thirdparty_name']).'">'.dol_escape_htmltag($data['thirdparty_name'])."</td>\n";
@ -757,6 +786,7 @@ if (!empty($date_start) && !empty($date_stop)) {
print '<td class="center">'.$data['country_code']."</td>\n"; print '<td class="center">'.$data['country_code']."</td>\n";
// VAT number
print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n"; print '<td class="tdoverflowmax150 right" title="'.dol_escape_htmltag($data['vatnum']).'">'.dol_escape_htmltag($data['vatnum'])."</td>\n";
if ($data['sens']) { if ($data['sens']) {
@ -810,7 +840,7 @@ if (!empty($date_start) && !empty($date_stop)) {
} }
print "</tr>\n"; print "</tr>\n";
} }
}
print "</table>"; print "</table>";
print '</div>'; print '</div>';
} }