diff --git a/htdocs/admin/export.php b/htdocs/admin/export.php
index d066197b580..ae7faafa937 100644
--- a/htdocs/admin/export.php
+++ b/htdocs/admin/export.php
@@ -95,7 +95,7 @@ print '';
print '
';
print '| '.$langs->trans("ExportCsvSeparator").' | ';
-print ''."global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\"> | ";
+print ' | ';
print ' | ';
print '
';
diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php
index 973e7ae536a..f4691ceb611 100644
--- a/htdocs/core/modules/export/export_csv.modules.php
+++ b/htdocs/core/modules/export/export_csv.modules.php
@@ -329,7 +329,6 @@ class ExportCsv extends ModeleExports
global $conf;
$addquote = 0;
-
// Rule Dolibarr: No HTML
//print $charset.' '.$newvalue."\n";
//$newvalue=dol_string_nohtmltag($newvalue,0,$charset);
diff --git a/htdocs/core/modules/modBanque.class.php b/htdocs/core/modules/modBanque.class.php
index 5b1e35df141..11912cf778a 100644
--- a/htdocs/core/modules/modBanque.class.php
+++ b/htdocs/core/modules/modBanque.class.php
@@ -211,19 +211,31 @@ class modBanque extends DolibarrModules
$this->export_fields_array[$r] = array(
'v.rowid'=>'VariousPaymentId', 'v.label'=>'VariousPaymentLabel', 'v.datev'=>'DateValue', 'v.datep'=>'DateOperation',
'v.num_payment'=>'ChequeOrTransferNumber', 'v.amount'=>'Amount', 'v.sens'=>'Sens',
- 't.fk_typepayment'=>"List:c_paiement:libelle:label", 'v.accountancy_code'=>'AccountAccounting', 'v.subledger_account'=>'SubledgerAccount',
- 'p.title'=>'Project', 'v.note'=>'Note', 'v.datec'=>'DateCreation'
+ 'cp.id'=>"PaymentMode",
+ 'v.accountancy_code'=>'AccountAccounting', 'v.subledger_account'=>'SubledgerAccount',
+ 'v.note'=>'Note', 'v.datec'=>'DateCreation',
+ 'p.ref'=>'ProjectRef', 'p.title'=>'ProjectLabel'
+ );
+ $this->export_TypeFields_array[$r] = array(
+ 'v.rowid'=>'Text', 'v.label'=>'Text', 'v.datep'=>'Date', 'v.datev'=>'Date',
+ 'v.num_payment'=>'Text', 'v.amount'=>'Numeric', 'v.sens'=>'Numeric',
+ 'cp.id'=>'List:c_paiement:code:id:code',
+ "v.accountancy_code"=>"Text", "v.subledger_account"=>"Text",
+ "v.note"=>"Text", 'v.datec'=>"Date",
+ "p.ref"=>"Text", "p.title"=>"Text"
);
- $this->export_TypeFields_array[$r] = array('v.rowid'=>'Text', 'v.label'=>'Text', 'v.datep'=>'Date', 'v.datev'=>'Date', 'v.num_payment'=>'Text', 'v.amount'=>'Numeric', 'v.sens'=>'Boolean', 'v.fk_typepayment'=>'Text', "v.accountancy_code"=>"Text", "v.subledger_account"=>"Text", "p.title"=>"Text", "v.note"=>"Text", 'v.datec'=>"Date");
$this->export_entities_array[$r] = array(
'v.rowid'=>'payment', 'v.label'=>'payment', 'v.datev'=>'payment', 'v.datep'=>'payment',
'v.num_payment'=>'payment', 'v.amount'=>'payment', 'v.sens'=>'payment',
- 'v.fk_typepayment'=>'payment', 'v.accountancy_code'=>'payment', 'v.subledger_account'=>"payment", "p.title"=>"project",
- 'v.note'=>"payment", 'v.datec'=>"payment"
+ 'cp.id'=>'payment',
+ 'v.accountancy_code'=>'payment', 'v.subledger_account'=>"payment",
+ 'v.note'=>"payment", 'v.datec'=>"payment",
+ "p.ref"=>"project", "p.title"=>"project"
);
$this->export_sql_start[$r] = 'SELECT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'payment_various as v';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet as p ON v.fk_projet = p.rowid";
+ $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."c_paiement as cp ON v.fk_typepayment = cp.id";
$this->export_sql_end[$r] .= ' WHERE v.entity IN ('.getEntity('payment_various').')';
$this->export_sql_order[$r] = ' ORDER BY v.datep';
}
diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php
index 4d4b3626f75..c7d7f4eea89 100644
--- a/htdocs/exports/class/export.class.php
+++ b/htdocs/exports/class/export.class.php
@@ -539,6 +539,7 @@ class Export
if (empty($this->array_export_fields) || !is_array($this->array_export_fields))
{
$this->error = "ErrorBadParameter";
+ dol_syslog($this->error, LOG_ERR);
return -1;
}
diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
index 710dcedab65..e76948808bb 100644
--- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
+++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql
@@ -28,7 +28,7 @@
-- Note: fields with type BLOB/TEXT can't have default value.
--- Missing in v12
+-- Missing in v12 or lower
ALTER TABLE llx_prelevement_bons ADD COLUMN type varchar(16) DEFAULT 'debit-order';
diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php
index cf1cafe74b1..2a3cb079baf 100644
--- a/test/phpunit/ExportTest.php
+++ b/test/phpunit/ExportTest.php
@@ -141,6 +141,9 @@ class ExportTest extends PHPUnit\Framework\TestCase
$model='csv';
+ $conf->global->EXPORT_CSV_SEPARATOR_TO_USE = ',';
+ print 'EXPORT_CSV_SEPARATOR_TO_USE = '.$conf->global->EXPORT_CSV_SEPARATOR_TO_USE;
+
// Creation of class to export using model ExportXXX
$dir = DOL_DOCUMENT_ROOT . "/core/modules/export/";
$file = "export_".$model.".modules.php";
@@ -161,7 +164,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
print __METHOD__." valtotest=".$valtotest."\n";
$result = $objmodel->csvClean($valtotest, $langs->charset_output);
print __METHOD__." result=".$result."\n";
- $this->assertEquals($result, '"A string with , and ; inside"');
+ $this->assertEquals($result, '"A string with , and ; inside"', 'Error in csvClean for '.$file);
$valtotest='A string with " inside';
print __METHOD__." valtotest=".$valtotest."\n";
@@ -182,7 +185,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
$this->assertEquals($result, '"A string with html
content inside"');
// Same tests with strict mode
- $conf->global->USE_STRICT_CSV_RULES=1;
+ $conf->global->USE_STRICT_CSV_RULES = 1;
$valtotest='A simple string';
print __METHOD__." valtotest=".$valtotest."\n";
@@ -245,7 +248,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
print "Process build_file for model = ".$model."\n";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
- $expectedresult=1;
+ $expectedresult = 1;
$this->assertEquals($expectedresult, $result, 'Error in CSV export');
$model='tsv';
@@ -360,7 +363,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Build export file
$sql = "";
$result=$objexport->build_file($user, $model, $datatoexport, $array_selected, array(), $sql);
- $expectedresult=1;
+ $expectedresult = 1;
$this->assertEquals($expectedresult, $result, "Call build_file() to export ".$exportfile.' failed');
$result=dol_is_file($exportfile);
$this->assertTrue($result, 'File '.$exportfile.' not found');