mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-14 21:12:46 +01:00
Compare commits
20 Commits
phpstan-ba
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c39939fb21 | ||
|
|
263cba5c0e | ||
|
|
4cffb37310 | ||
|
|
9ff559a0ad | ||
|
|
6a80ef4019 | ||
|
|
0a12caf313 | ||
|
|
e2cd37a178 | ||
|
|
c940376446 | ||
|
|
efdbf9a95c | ||
|
|
b487a95d86 | ||
|
|
053cd4e020 | ||
|
|
3e2598f8ff | ||
|
|
e266a42545 | ||
|
|
dec9dfc06b | ||
|
|
8e4762b2e1 | ||
|
|
02656bbcb8 | ||
|
|
1eda4e6157 | ||
|
|
85c8612c87 | ||
|
|
dc5b719065 | ||
|
|
58d1254212 |
@@ -571,6 +571,8 @@ script:
|
||||
# Execute phpunit, check its exit status and that the phpunit output shows a test summary
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php | tee /dev/tty | grep -qE "(OK .*[0-9]+ tests.*[0-9]+ assertions|Tests: [0-9]+)" ; phpunitresult=$((PIPESTATUS[0]?PIPESTATUS[0]:PIPESTATUS[2]))
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
echo "Content of end of apache error.log"
|
||||
sudo tail -n 200 /var/log/apache2/travis_error_log
|
||||
# Comment next line if you want to go to the end to see the dolibarr.log file.
|
||||
[ $phpunitresult == 0 ] || exit $phpunitresult
|
||||
echo
|
||||
|
||||
@@ -432,6 +432,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/admin/emailcollector_card.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$contextpage in empty\(\) always exists and is not falsy\.$#'
|
||||
identifier: empty.variable
|
||||
count: 1
|
||||
path: ../../../htdocs/admin/emailcollector_list.php
|
||||
|
||||
-
|
||||
message: '#^Left side of && is always true\.$#'
|
||||
identifier: booleanAnd.leftAlwaysTrue
|
||||
@@ -7812,6 +7818,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/oauth/generic_oauthcallback.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$state might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../../htdocs/core/modules/oauth/github_oauthcallback.php
|
||||
|
||||
-
|
||||
message: '#^Strict comparison using \=\=\= between null and null will always evaluate to true\.$#'
|
||||
identifier: identical.alwaysTrue
|
||||
@@ -14466,6 +14478,12 @@ parameters:
|
||||
count: 1
|
||||
path: ../../../htdocs/societe/canvas/company/tpl/card_view.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$socid might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 3
|
||||
path: ../../../htdocs/societe/canvas/company/tpl/card_view.tpl.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$objcanvas might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -235,8 +235,8 @@ if ($action == 'export' && $user->hasRight('accounting', 'mouvements', 'lire'))
|
||||
|
||||
if ($exportType === 'csv') {
|
||||
$sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV');
|
||||
$filename = 'balance';
|
||||
$type_export = 'balance';
|
||||
$filename = 'balance'; // Used by the tpl
|
||||
$type_export = 'balance'; // Used by the tpl
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
foreach ($object->lines as $line) {
|
||||
|
||||
@@ -30,6 +30,13 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../../main.inc.php';
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
|
||||
@@ -41,14 +48,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("accountancy", "compta"));
|
||||
|
||||
@@ -851,15 +850,26 @@ if ($action == 'export_file') {
|
||||
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC
|
||||
|| getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC2
|
||||
) {
|
||||
$except = array();
|
||||
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_INVOICE_SOURCE_FILE')) {
|
||||
$except[] = $langs->trans('Invoice');
|
||||
}
|
||||
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_EXPENSEREPORT_SOURCE_FILE')) {
|
||||
$except[] = $langs->trans('ExpenseReport');
|
||||
}
|
||||
if (getDolGlobalInt('ACCOUNTING_EXPORT_REMOVE_SUPPLIERINVOICE_SOURCE_FILE')) {
|
||||
$except[] = $langs->trans('SupplierInvoice');
|
||||
}
|
||||
|
||||
$form_question['notifiedexportfull'] = array(
|
||||
'name' => 'notifiedexportfull',
|
||||
'type' => 'checkbox',
|
||||
'label' => $langs->trans('NotifiedExportFull'),
|
||||
'label' => $langs->trans('NotifiedExportFull').(empty($except) ? '' : ' <spanc class="opacitymedium">(Except '.join(', ', $except).')</span>'),
|
||||
'value' => 'false',
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 390, 700);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', '', 'export_fileconfirm', $form_question, '', 1, 390, 700);
|
||||
}
|
||||
|
||||
// Print form confirm
|
||||
|
||||
@@ -382,12 +382,12 @@ class AccountancyExport
|
||||
*/
|
||||
public function export(&$TData, $formatexportset, $withAttachment = 0, $downloadMode = 1, $outputMode = 1, $noouput = 1)
|
||||
{
|
||||
global $db, $conf, $langs; // The tpl file use $db
|
||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
global $db, $conf, $langs; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
global $search_date_end, $hookmanager; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
|
||||
// Define name of file to save
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset); // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
$type_export = 'general_ledger'; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
|
||||
$completefilename = '';
|
||||
$exportFile = null;
|
||||
@@ -422,7 +422,8 @@ class AccountancyExport
|
||||
top_httphead($mimetype, 1);
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||
// Set var $completefilename and add HTTP header.
|
||||
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; // TODO Fix this: A tpl is for rendering data on output. For including common code, we must use .inc.php
|
||||
|
||||
if ($outputMode == 1 || $outputMode == 2) {
|
||||
if ($outputMode == 1) {
|
||||
@@ -902,8 +903,13 @@ class AccountancyExport
|
||||
|
||||
$end_line = "\r\n";
|
||||
|
||||
$conf->cache['archiveFileList_notfound'] = array();
|
||||
|
||||
// We should use dol_now function not time however this is wrong date to transfer in accounting
|
||||
$i = 0;
|
||||
foreach ($objectLines as $line) {
|
||||
$i++;
|
||||
|
||||
// Clean some data
|
||||
$line->doc_ref = dol_string_unaccent($line->doc_ref);
|
||||
|
||||
@@ -1034,12 +1040,14 @@ class AccountancyExport
|
||||
$tab['num_piece3'] = str_pad(substr(self::trunc($line->doc_ref, 20), -10), 10);
|
||||
$tab['reserved'] = str_repeat(' ', 10); // position 159
|
||||
$tab['currency_amount'] = str_repeat(' ', 13); // position 169
|
||||
|
||||
// get document file
|
||||
$attachmentFileName = '';
|
||||
if ($withAttachment == 1) {
|
||||
$attachmentFileKey = trim((string) $line->piece_num);
|
||||
|
||||
if (!isset($archiveFileList[$attachmentFileKey])) {
|
||||
// We complete the $archiveFileList to add the file to the existing list (first entry was filled when function was called, we add here the next one)
|
||||
$objectDirPath = '';
|
||||
$objectFileName = dol_sanitizeFileName($line->doc_ref);
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
@@ -1053,33 +1061,45 @@ class AccountancyExport
|
||||
$objectDirPath = !empty($conf->fournisseur->facture->multidir_output[$conf->entity]) ? $conf->fournisseur->facture->multidir_output[$conf->entity] : $conf->fournisseur->facture->dir_output;
|
||||
$objectDirPath .= '/'.rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
|
||||
}
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = str_pad(self::trunc((string) $line->piece_num, 8), 8, '0', STR_PAD_LEFT);
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
|
||||
if ($objectDirPath && empty($conf->cache['archiveFileList_notfound'][$attachmentFileKey])) {
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
|
||||
$fileFoundPath = '';
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = str_pad(self::trunc((string) $line->piece_num, 8), 8, '0', STR_PAD_LEFT);
|
||||
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($fileFoundPath)) {
|
||||
// Use also a cache if no file were found
|
||||
$conf->cache['archiveFileList_notfound'][$attachmentFileKey] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1087,6 +1107,7 @@ class AccountancyExport
|
||||
$attachmentFileName = $archiveFileList[$attachmentFileKey]['name'];
|
||||
}
|
||||
}
|
||||
|
||||
if (dol_strlen((string) $attachmentFileName) == 12) {
|
||||
$tab['attachment'] = $attachmentFileName; // position 182
|
||||
} else {
|
||||
@@ -1462,11 +1483,16 @@ class AccountancyExport
|
||||
print $output;
|
||||
}
|
||||
|
||||
$conf->cache['archiveFileList_notfound'] = array();
|
||||
|
||||
$i = 0;
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
//var_dump($line->id);
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$i++;
|
||||
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
|
||||
@@ -1475,6 +1501,8 @@ class AccountancyExport
|
||||
|
||||
$refInvoice = '';
|
||||
$invoice = null;
|
||||
// TODO The fetch of invoice is just to get the ->id, ->ref (and ->ref_supplier for supplier invoice) so
|
||||
// may be we can get them into the $objectLines and reuse a generic static objectinstead ?
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
// Customer invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
@@ -1567,6 +1595,7 @@ class AccountancyExport
|
||||
$attachmentFileKey = trim((string) $line->piece_num);
|
||||
|
||||
if (!isset($archiveFileList[$attachmentFileKey])) {
|
||||
// We complete the $archiveFileList to add the file to the existing list (first entry was filled when function was called, we add here the next one)
|
||||
$objectDirPath = '';
|
||||
$objectFileName = dol_sanitizeFileName($line->doc_ref);
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
@@ -1584,33 +1613,45 @@ class AccountancyExport
|
||||
$objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
|
||||
}
|
||||
}
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = $line->doc_ref;
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
|
||||
if ($objectDirPath && empty($conf->cache['archiveFileList_notfound'][$attachmentFileKey])) {
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
|
||||
$fileFoundPath = ''; // The path of last file found
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = $line->doc_ref;
|
||||
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($fileFoundPath)) {
|
||||
// Use also a cache if no file were found
|
||||
$conf->cache['archiveFileList_notfound'][$attachmentFileKey] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1683,10 +1724,15 @@ class AccountancyExport
|
||||
print $output;
|
||||
}
|
||||
|
||||
$conf->cache['archiveFileList_notfound'] = array();
|
||||
|
||||
$i = 0;
|
||||
foreach ($objectLines as $line) {
|
||||
if ($line->debit == 0 && $line->credit == 0) {
|
||||
//unset($array[$line]);
|
||||
} else {
|
||||
$i++;
|
||||
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_lettering = dol_print_date($line->date_lettering, '%Y%m%d');
|
||||
@@ -1695,6 +1741,8 @@ class AccountancyExport
|
||||
|
||||
$refInvoice = '';
|
||||
$invoice = null;
|
||||
// TODO The fetch of invoice is just to get the ->id, ->ref (and ->ref_supplier for supplier invoice) so
|
||||
// may be we can get them into the $objectLines and reuse a generic static objectinstead ?
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
// Customer invoice
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
@@ -1787,6 +1835,7 @@ class AccountancyExport
|
||||
$attachmentFileKey = trim((string) $line->piece_num);
|
||||
|
||||
if (!isset($archiveFileList[$attachmentFileKey])) {
|
||||
// We complete the $archiveFileList to add the file to the existing list (first entry was filled when function was called, we add here the next one)
|
||||
$objectDirPath = '';
|
||||
$objectFileName = dol_sanitizeFileName($line->doc_ref);
|
||||
if ($line->doc_type == 'customer_invoice') {
|
||||
@@ -1804,33 +1853,45 @@ class AccountancyExport
|
||||
$objectDirPath .= '/' . rtrim(get_exdir($invoice->id, 2, 0, 0, $invoice, 'invoice_supplier'), '/');
|
||||
}
|
||||
}
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = $line->doc_ref;
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
|
||||
if ($objectDirPath && empty($conf->cache['archiveFileList_notfound'][$attachmentFileKey])) {
|
||||
$arrayofinclusion = array();
|
||||
// If it is a supplier invoice, we want to use last uploaded file
|
||||
$arrayofinclusion[] = '^'.preg_quote($objectFileName, '/').(($line->doc_type == 'supplier_invoice') ? '.+' : '').'\.pdf$';
|
||||
|
||||
$fileFoundPath = ''; // The path of last file found
|
||||
$fileFoundList = dol_dir_list($objectDirPath.'/'.$objectFileName, 'files', 0, implode('|', $arrayofinclusion), '(\.meta|_preview.*\.png)$', 'date', SORT_DESC, 0, 1);
|
||||
|
||||
if (!empty($fileFoundList)) {
|
||||
$attachmentFileNameTrunc = $line->doc_ref;
|
||||
|
||||
foreach ($fileFoundList as $fileFound) {
|
||||
if (strstr($fileFound['name'], $objectFileName)) {
|
||||
// skip native invoice pdfs (canelle)
|
||||
// We want to retrieve an attachment representative of the supplier invoice, not a fake document generated by Dolibarr.
|
||||
if ($line->doc_type == 'supplier_invoice') {
|
||||
if ($fileFound['name'] === $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
} elseif ($fileFound['name'] !== $objectFileName.'.pdf') {
|
||||
continue;
|
||||
}
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
$fileFoundPath = $objectDirPath.'/'.$objectFileName.'/'.$fileFound['name'];
|
||||
if (file_exists($fileFoundPath)) {
|
||||
$archiveFileList[$attachmentFileKey] = array(
|
||||
'path' => $fileFoundPath,
|
||||
'name' => $attachmentFileNameTrunc.'.pdf',
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($fileFoundPath)) {
|
||||
// Use also a cache if no file were found
|
||||
$conf->cache['archiveFileList_notfound'][$attachmentFileKey] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// $formatexportset must be defined
|
||||
// $downloadMode =0 for direct download or =1 to download after writing files or =-1 not to download files
|
||||
|
||||
'
|
||||
@phan-var-force int $formatexportset
|
||||
@phan-var-force string $type_export
|
||||
@@ -34,10 +31,13 @@
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
*
|
||||
* @var string $action
|
||||
* @var int $formatexportset
|
||||
* @var string $type_export
|
||||
* @var string $filename
|
||||
* @var int<-1,1> $downloadMode
|
||||
* @var string $search_date_end
|
||||
* @var int<-1,1> $downloadMode Value =0 for direct download or =1 to download after writing files or =-1 not to download files
|
||||
*/
|
||||
|
||||
// Protection to avoid direct call of template
|
||||
@@ -53,13 +53,10 @@ $nodateexport = getDolGlobalInt('ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME');
|
||||
$siren = getDolGlobalString('MAIN_INFO_SIREN');
|
||||
|
||||
$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S');
|
||||
$startaccountingperiod = '';
|
||||
$endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d');
|
||||
|
||||
|
||||
if (empty($downloadMode)) {
|
||||
header('Content-Type: text/csv');
|
||||
}
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
|
||||
@@ -123,5 +120,6 @@ if (is_object($hookmanager)) {
|
||||
}
|
||||
|
||||
if (empty($downloadMode)) {
|
||||
header('Content-Type: text/csv');
|
||||
header('Content-Disposition: attachment;filename=' . $completefilename);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ if ($action == 'update') {
|
||||
$constvalue = str_replace('_ID', '', $key);
|
||||
$newconstvalue = $constvalue;
|
||||
if (GETPOSTISSET($constvalue.'_NAME')) {
|
||||
$newconstvalue = preg_replace('/-.*$/', '', $constvalue).'-'.GETPOST($constvalue.'_NAME');
|
||||
$newconstvalue = preg_replace('/-.*$/', '', $constvalue).'-'.preg_replace('/[^a-z]/', '', GETPOST($constvalue.'_NAME'));
|
||||
}
|
||||
|
||||
if (GETPOSTISSET($constvalue.'_ID')) {
|
||||
|
||||
@@ -826,7 +826,7 @@ if ($num > 0) {
|
||||
// Output of last run
|
||||
print '<td class="small minwidth150">';
|
||||
if (!empty($obj->lastoutput)) {
|
||||
print '<div class="twolinesmax lineheightsmall classfortooltip" title="'.dol_escape_htmltag($obj->lastoutput, 1, 1).'">';
|
||||
print '<div class="twolinesmax lineheightsmall classfortooltip" title="'.dolPrintHTMLForAttribute($obj->lastoutput, 1, 1).'">';
|
||||
print dol_trunc(dolGetFirstLineOfText($obj->lastoutput, 2), 100);
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@@ -714,3 +714,9 @@ UPDATE llx_c_tva SET type_vat = 0 WHERE type_vat < 0;
|
||||
-- We can't have this on by default because we may have old payment mode using something else than stripe and account matching the pk_xxx rule.
|
||||
--update llx_societe_rib set ext_payment_site = 'StripeLive' where stripe_account like '%pk_live%' AND ext_payment_site IS NULL;
|
||||
--update llx_societe_rib set ext_payment_site = 'StripeTest' where stripe_account like '%pk_test%' AND ext_payment_site IS NULL;
|
||||
|
||||
-- Delete entry in llx_const for 'OAUTH_XXXX-abc def' when there is a space between avc and def.
|
||||
DELETE FROM llx_const WHERE name like 'OAUTH_%-% %_ID';
|
||||
|
||||
|
||||
--SELECT fr.rowid, fr.titre as fr.title, fr.nb_gen_done, fr.nb_gen_max, (SELECT COUNT(f.rowid) FROM llx_facture as f WHERE f.fk_fac_rec_source = fr.rowid) as nb_invoices FROM llx_facture_rec as fr WHERE fr.nb_gen_max > 0 AND fr.nb_gen_done >= fr.nb_gen_max AND fr.nb_gen_done > 0 AND fr.nb_gen_done <> (SELECT COUNT(f.rowid) FROM llx_facture as f WHERE f.fk_fac_rec_source = fr.rowid);
|
||||
|
||||
@@ -37,6 +37,7 @@ Language_en_IE=English (Ireland)
|
||||
Language_en_IN=English (India)
|
||||
Language_en_MY=English (Myanmar)
|
||||
Language_en_NZ=English (New Zealand)
|
||||
Language_en_PH=English (Philippines)
|
||||
Language_en_SA=English (Saudi Arabia)
|
||||
Language_en_SG=English (Singapore)
|
||||
Language_en_US=English (United States)
|
||||
|
||||
@@ -1346,7 +1346,7 @@ $moreforfilter .= '</div>';
|
||||
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
|
||||
$langs->load("categories");
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_USER, $search_category_user_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("UsersCategoryShort"));
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_USER, $search_category_user_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->transnoentitiesnoconv("UsersCategoryShort"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1368,7 +1368,7 @@ if ($user->hasRight('user', 'user', 'lire')) {
|
||||
// Filter on project categories
|
||||
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("ProjectsCategoryShort"));
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->transnoentitiesnoconv("ProjectsCategoryShort"));
|
||||
}
|
||||
|
||||
// Filter on customer categories
|
||||
|
||||
@@ -902,9 +902,13 @@ if ($action == 'charge' && isModEnabled('stripe')) { // Test on permission not r
|
||||
$_SESSION["currencyCodeType"] = $currency; // currency really used for payment (coming from Stripe). Will be used for check in paymentok.php.
|
||||
$_SESSION["paymentType"] = '';
|
||||
$_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip
|
||||
$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
|
||||
$_SESSION['TRANSACTIONID'] = (is_object($charge) ? $charge->id : (is_object($paymentintent) ? $paymentintent->id : ''));
|
||||
$_SESSION['errormessage'] = $errormessage;
|
||||
if (!getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')) {
|
||||
$_SESSION['payerID'] = is_object($customer) ? $customer->id : '';
|
||||
} else {
|
||||
$_SESSION['payerID'] = '';
|
||||
}
|
||||
|
||||
dol_syslog("Action charge stripe STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION=".getDolGlobalInt('STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION')." ip=".$remoteip, LOG_DEBUG, 0, '_payment');
|
||||
dol_syslog("_SERVER[HTTP_X_FORWARDED_HOST] = ".(empty($_SERVER["HTTP_X_FORWARDED_HOST"]) ? '' : dol_escape_htmltag($_SERVER["HTTP_X_FORWARDED_HOST"])), LOG_DEBUG, 0, '_payment');
|
||||
|
||||
@@ -601,7 +601,7 @@ div.buttonpayment input:focus {
|
||||
div.buttonpayment input {
|
||||
background-color: unset;
|
||||
color: #fff;
|
||||
border-bottom: unset;
|
||||
border: unset;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
@@ -7569,7 +7569,7 @@ li.select2-selection__choice {
|
||||
margin-top: 0.25em !important;
|
||||
}
|
||||
.select2-selection--multiple input.select2-search__field {
|
||||
border-bottom: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.select2-search__field
|
||||
@@ -7784,6 +7784,7 @@ select.multiselectononeline {
|
||||
min-height: unset;
|
||||
height: 2.2em !important;
|
||||
opacity: 0;
|
||||
min-width: 50px;
|
||||
/* width: 1px !important; */
|
||||
}
|
||||
|
||||
|
||||
@@ -770,7 +770,7 @@ input.buttonpayment, button.buttonpayment, div.buttonpayment {
|
||||
|
||||
div.buttonpayment input {
|
||||
background-color: unset;
|
||||
border-bottom: unset;
|
||||
border: unset;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
color: #333;
|
||||
@@ -7407,7 +7407,7 @@ li.select2-selection__choice {
|
||||
margin-top: 4px !important;
|
||||
}
|
||||
.select2-selection--multiple input.select2-search__field {
|
||||
border-bottom: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.select2-search__field
|
||||
{
|
||||
@@ -7615,6 +7615,7 @@ select.multiselectononeline {
|
||||
height: 28px !important;
|
||||
opacity: 0;
|
||||
/* width: 1px !important; */
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 767px)
|
||||
|
||||
@@ -171,7 +171,7 @@ class FactureTest extends CommonClassTest
|
||||
true,
|
||||
// Not comparing:
|
||||
array(
|
||||
'newref','oldref','id','lines','client','thirdparty','brouillon', 'fk_user_author', 'user_modification_id', 'date_creation','date_validation','datem','date_modification',
|
||||
'newref','oldcopy','oldref','id','lines','client','thirdparty','brouillon', 'fk_user_author', 'user_modification_id', 'date_creation','date_validation','datem','date_modification',
|
||||
'ref','statut','status','paye','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement',
|
||||
'cond_reglement_doc', 'modelpdf',
|
||||
'multicurrency_total_ht','multicurrency_total_tva', 'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx',
|
||||
|
||||
Reference in New Issue
Block a user