Fix export of various payments.
This commit is contained in:
parent
0093671a04
commit
4cf6e483ca
@ -95,7 +95,7 @@ print '</td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("ExportCsvSeparator").'</td>';
|
||||
print '<td width="60" align="center">'."<input size=\"3\" class=\"flat\" type=\"text\" name=\"EXPORT_CSV_SEPARATOR_TO_USE\" value=\"".(empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE)."\"></td>";
|
||||
print '<td width="60" align="center"><input class="flat width50" maxlength="3" type="text" name="EXPORT_CSV_SEPARATOR_TO_USE" value="'.(empty($conf->global->EXPORT_CSV_SEPARATOR_TO_USE) ? ',' : $conf->global->EXPORT_CSV_SEPARATOR_TO_USE).'"></td>';
|
||||
print '<td class="right"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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 <a href=""aaa""><strong>html<br>content</strong></a> 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');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user