Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2017-11-06 19:29:14 +01:00
commit 1f1809dd3e
3 changed files with 291 additions and 127 deletions

View File

@ -5,6 +5,7 @@
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -47,12 +48,40 @@ $action = GETPOST('action', 'alpha');
// Parameters ACCOUNTING_EXPORT_* // Parameters ACCOUNTING_EXPORT_*
$main_option = array ( $main_option = array (
'ACCOUNTING_EXPORT_PREFIX_SPEC' 'ACCOUNTING_EXPORT_PREFIX_SPEC',
); );
$configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param];
$listformat = $configuration[format];
$listcr = $configuration[cr];
$model_option = array ( $model_option = array (
'ACCOUNTING_EXPORT_SEPARATORCSV', '1' => array(
'ACCOUNTING_EXPORT_DATE' 'label' => 'ACCOUNTING_EXPORT_FORMAT',
'param' => $listformat,
),
'2' => array(
'label' => 'ACCOUNTING_EXPORT_SEPARATORCSV',
'param' => '',
),
'3' => array(
'label' => 'ACCOUNTING_EXPORT_ENDLINE',
'param' => $listcr,
),
'4' => array(
'label' => 'ACCOUNTING_EXPORT_DATE',
'param' => '',
),
//'ACCOUNTING_EXPORT_PIECE',
//'ACCOUNTING_EXPORT_GLOBAL_ACCOUNT',
//'ACCOUNTING_EXPORT_LABEL',
//'ACCOUNTING_EXPORT_AMOUNT',
//'ACCOUNTING_EXPORT_DEVISE',
); );
/* /*
@ -61,24 +90,15 @@ $model_option = array (
if ($action == 'update') { if ($action == 'update') {
$error = 0; $error = 0;
$format = GETPOST('format', 'alpha'); $modelcsv = GETPOST('ACCOUNTING_EXPORT_MODELCSV', 'int');
$modelcsv = GETPOST('modelcsv', 'int');
if (! empty($format)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
} else {
$error ++;
}
if (! empty($modelcsv)) { if (! empty($modelcsv)) {
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) { if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
$error ++; $error ++;
} }
if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) { //if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity); // dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
} //}
} else { } else {
$error ++; $error ++;
} }
@ -91,16 +111,22 @@ if ($action == 'update') {
} }
} }
foreach ( $model_option as $constname ) { foreach ($listparam[$modelcsv] as $key => $value ) {
$constvalue = GETPOST($constname, 'alpha'); $constante = $key;
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { if (strpos($constante, 'ACCOUNTING')!==false) {
$error ++; $constvalue = GETPOST($key, 'alpha');
} if (! dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
$error ++;
}
}
} }
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); // reload
$configuration = AccountancyExport::getTypeConfig();
$listparam = $configuration[param];
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
@ -117,11 +143,57 @@ $form = new Form($db);
// $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>'; // $linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">' . $langs->trans("BackToModuleList") . '</a>';
print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup'); print load_fiche_titre($langs->trans('ConfigAccountingExpert'), $linkback, 'title_setup');
$head = admin_accounting_prepare_head();
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n";
print ' {'."\n";
foreach ($listparam as $key => $param) {
print ' if (jQuery("#ACCOUNTING_EXPORT_MODELCSV").val()=="'.$key.'")'."\n";
print ' {'."\n";
print ' //console.log("'.$param[label].'");'."\n";
if (empty($param[ACCOUNTING_EXPORT_FORMAT])) {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$conf->global->ACCOUNTING_EXPORT_FORMAT.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").val("'.$param[ACCOUNTING_EXPORT_FORMAT].'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_FORMAT").removeAttr("disabled");'."\n";
}
if (empty($param[ACCOUNTING_EXPORT_SEPARATORCSV])) {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").val("'.$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_SEPARATORCSV").removeAttr("disabled");'."\n";
}
if (empty($param[ACCOUNTING_EXPORT_ENDLINE])) {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_ENDLINE").removeAttr("disabled");'."\n";
}
if (empty($param[ACCOUNTING_EXPORT_DATE])) {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").prop("disabled", true);'."\n";
} else {
print ' jQuery("#ACCOUNTING_EXPORT_DATE").val("'.$conf->global->ACCOUNTING_EXPORT_DATE.'");'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_DATE").removeAttr("disabled");'."\n";
}
print ' }'."\n";
}
print ' }'."\n";
print ' initfields();'."\n";
print ' jQuery("#ACCOUNTING_EXPORT_MODELCSV").change(function() {'."\n";
print ' initfields();'."\n";
print ' });'."\n";
print '})'."\n";
print '</script>'."\n";
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
$var = true; dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'technic');
/* /*
* Main Options * Main Options
@ -132,7 +204,6 @@ print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('Options') . '</td>'; print '<td colspan="3">' . $langs->trans('Options') . '</td>';
print "</tr>\n"; print "</tr>\n";
$var = ! $var;
$num = count($main_option); $num = count($main_option);
if ($num) { if ($num) {
@ -146,7 +217,7 @@ if ($num) {
// Value // Value
print '<td>'; print '<td>';
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">'; print '<input type="text" size="20" id="'.$key.'" name="' . $key . '" value="' . $conf->global->$key . '">';
print '</td></tr>'; print '</td></tr>';
} }
} }
@ -164,7 +235,6 @@ print '<tr class="liste_titre">';
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>'; print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
print '</tr>'; print '</tr>';
$var = ! $var;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>'; print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
@ -175,7 +245,7 @@ if (! $conf->use_javascript_ajax) {
} else { } else {
print '<td>'; print '<td>';
$listmodelcsv = AccountancyExport::getType(); $listmodelcsv = AccountancyExport::getType();
print $form->selectarray("modelcsv", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0); print $form->selectarray("ACCOUNTING_EXPORT_MODELCSV", $listmodelcsv, $conf->global->ACCOUNTING_EXPORT_MODELCSV, 0);
print '</td>'; print '</td>';
} }
@ -195,39 +265,21 @@ if ($num2) {
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>'; print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
print "</tr>\n"; print "</tr>\n";
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL) foreach ( $model_option as $key) {
{
print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
}
print '<tr class="oddeven">';
print '<td width="50%">' . $langs->trans("Selectformat") . '</td>';
if (! $conf->use_javascript_ajax) {
print '<td class="nowrap">';
print $langs->trans("NotAvailableWhenAjaxDisabled");
print "</td>";
} else {
print '<td>';
$listformat = array (
'csv' => $langs->trans("csv"),
'txt' => $langs->trans("txt")
);
print $form->selectarray("format", $listformat, $conf->global->ACCOUNTING_EXPORT_FORMAT, 0);
print '</td>';
}
print "</td></tr>";
foreach ( $model_option as $key ) {
print '<tr class="oddeven value">'; print '<tr class="oddeven value">';
// Param // Param
$label = $langs->trans($key); $label = $key[label];
print '<td width="50%">' . $label . '</td>'; print '<td width="50%">' . $langs->trans($label) . '</td>';
// Value // Value
print '<td>'; print '<td>';
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">'; if (is_array($key[param])) {
print $form->selectarray($label, $key[param], $conf->global->$label, 0);
} else {
print '<input type="text" size="20" id="'. $label .'" name="' . $key[label] . '" value="' . $conf->global->$label . '">';
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -6,6 +6,7 @@
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr> * Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
* Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com> * Copyright (C) 2016-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -49,6 +50,7 @@ class AccountancyExport
public static $EXPORT_TYPE_EBP = 7; public static $EXPORT_TYPE_EBP = 7;
public static $EXPORT_TYPE_COGILOG = 8; public static $EXPORT_TYPE_COGILOG = 8;
public static $EXPORT_TYPE_AGIRIS = 9; public static $EXPORT_TYPE_AGIRIS = 9;
public static $EXPORT_TYPE_CONFIGURABLE = 10;
/** /**
* *
@ -78,11 +80,11 @@ class AccountancyExport
$this->db = &$db; $this->db = &$db;
$this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
$this->end_line = "\n"; $this->end_line = empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?"\n":($conf->global->ACCOUNTING_EXPORT_ENDLINE==1?"\n":"\r\n");
} }
/** /**
* Array wit all export type available (key + label) * Array with all export type available (key + label)
* *
* @return array of type * @return array of type
*/ */
@ -98,10 +100,73 @@ class AccountancyExport
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'), self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'), self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'), self::$EXPORT_TYPE_COGILOG => $langs->trans('Modelcsv_cogilog'),
self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris') self::$EXPORT_TYPE_AGIRIS => $langs->trans('Modelcsv_agiris'),
); self::$EXPORT_TYPE_CONFIGURABLE => $langs->trans('Modelcsv_configurable'),
);
} }
/**
* Array with all export type available (key + label) and parameters for config
*
* @return array of type
*/
public static function getTypeConfig() {
global $conf, $langs;
return array (
'param' => array(
self::$EXPORT_TYPE_NORMAL => array(
'label' => $langs->trans('Modelcsv_normal'),
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
),
self::$EXPORT_TYPE_CEGID => array(
'label' => $langs->trans('Modelcsv_CEGID'),
),
self::$EXPORT_TYPE_COALA => array(
'label' => $langs->trans('Modelcsv_COALA'),
),
self::$EXPORT_TYPE_BOB50 => array(
'label' => $langs->trans('Modelcsv_bob50'),
),
self::$EXPORT_TYPE_CIEL => array(
'label' => $langs->trans('Modelcsv_ciel'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_QUADRATUS => array(
'label' => $langs->trans('Modelcsv_quadratus'),
'ACCOUNTING_EXPORT_FORMAT' => 'txt',
),
self::$EXPORT_TYPE_EBP => array(
'label' => $langs->trans('Modelcsv_ebp'),
),
self::$EXPORT_TYPE_COGILOG => array(
'label' => $langs->trans('Modelcsv_cogilog'),
),
self::$EXPORT_TYPE_AGIRIS => array(
'label' => $langs->trans('Modelcsv_agiris'),
),
self::$EXPORT_TYPE_CONFIGURABLE => array(
'label' => $langs->trans('Modelcsv_configurable'),
'ACCOUNTING_EXPORT_FORMAT' => empty($conf->global->ACCOUNTING_EXPORT_FORMAT)?'txt':$conf->global->ACCOUNTING_EXPORT_FORMAT,
'ACCOUNTING_EXPORT_SEPARATORCSV' => empty($conf->global->ACCOUNTING_EXPORT_SEPARATORCSV)?',':$conf->global->ACCOUNTING_EXPORT_SEPARATORCSV,
'ACCOUNTING_EXPORT_ENDLINE' => empty($conf->global->ACCOUNTING_EXPORT_ENDLINE)?1:$conf->global->ACCOUNTING_EXPORT_ENDLINE,
'ACCOUNTING_EXPORT_DATE' => empty($conf->global->ACCOUNTING_EXPORT_DATE)?'%d%m%Y':$conf->global->ACCOUNTING_EXPORT_DATE,
),
),
'cr'=> array (
'1' => $langs->trans("Unix"),
'2' => $langs->trans("Windows")
),
'format' => array (
'csv' => $langs->trans("csv"),
'txt' => $langs->trans("txt")
),
);
}
/** /**
* Download the export * Download the export
* *
@ -151,6 +216,9 @@ class AccountancyExport
case self::$EXPORT_TYPE_AGIRIS : case self::$EXPORT_TYPE_AGIRIS :
$this->exportAgiris($TData); $this->exportAgiris($TData);
break; break;
case self::$EXPORT_TYPE_CONFIGURABLE :
$this->exportConfigurable($TData);
break;
default: default:
$this->errors[] = $langs->trans('accountancy_error_modelnotfound'); $this->errors[] = $langs->trans('accountancy_error_modelnotfound');
break; break;
@ -191,7 +259,8 @@ class AccountancyExport
public function exportCegid($objectLines) { public function exportCegid($objectLines) {
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";"; $separator = ";";
$end_line = "\n";
print $date . $separator; print $date . $separator;
print $line->code_journal . $separator; print $line->code_journal . $separator;
@ -201,7 +270,7 @@ class AccountancyExport
print price($line->montant) . $separator; print price($line->montant) . $separator;
print $line->label_operation . $separator; print $line->label_operation . $separator;
print $line->doc_ref; print $line->doc_ref;
print $this->end_line; print $end_line;
} }
} }
@ -215,24 +284,26 @@ class AccountancyExport
public function exportCogilog($objectLines) { public function exportCogilog($objectLines) {
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
$separator = ";";
$end_line = "\n";
print $line->code_journal . $this->separator; print $line->code_journal . $separator;
print $date . $this->separator; print $date . $separator;
print $line->piece_num . $this->separator; print $line->piece_num . $separator;
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $separator;
print '' . $this->separator; print '' . $separator;
print $line->label_operation . $this->separator; print $line->label_operation . $separator;
print $date . $this->separator; print $date . $separator;
if ($line->sens=='D') { if ($line->sens=='D') {
print price($line->montant) . $this->separator; print price($line->montant) . $separator;
print '' . $this->separator; print '' . $separator;
}elseif ($line->sens=='C') { }elseif ($line->sens=='C') {
print '' . $this->separator; print '' . $separator;
print price($line->montant) . $this->separator; print price($line->montant) . $separator;
} }
print $line->doc_ref . $this->separator; print $line->doc_ref . $separator;
print $line->label_operation . $this->separator; print $line->label_operation . $separator;
print $this->end_line; print $end_line;
} }
} }
@ -245,18 +316,21 @@ class AccountancyExport
*/ */
public function exportCoala($objectLines) { public function exportCoala($objectLines) {
// Coala export // Coala export
$separator = ";";
$end_line = "\n";
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator; print $date . $separator;
print $line->code_journal . $this->separator; print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $separator;
print $line->piece_num . $this->separator; print $line->piece_num . $separator;
print $line->doc_ref . $this->separator; print $line->doc_ref . $separator;
print price($line->debit) . $this->separator; print price($line->debit) . $separator;
print price($line->credit) . $this->separator; print price($line->credit) . $separator;
print 'E' . $this->separator; print 'E' . $separator;
print length_accountg($line->subledger_account) . $this->separator; print length_accountg($line->subledger_account) . $separator;
print $this->end_line; print $end_line;
} }
} }
@ -270,28 +344,31 @@ class AccountancyExport
public function exportBob50($objectLines) { public function exportBob50($objectLines) {
// Bob50 // Bob50
$separator = ";";
$end_line = "\n";
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
print $line->piece_num . $this->separator; print $line->piece_num . $separator;
$date = dol_print_date($line->doc_date, '%d/%m/%Y'); $date = dol_print_date($line->doc_date, '%d/%m/%Y');
print $date . $this->separator; print $date . $separator;
if (empty($line->subledger_account)) { if (empty($line->subledger_account)) {
print 'G' . $this->separator; print 'G' . $separator;
print length_accounta($line->numero_compte) . $this->separator; print length_accounta($line->numero_compte) . $separator;
} else { } else {
if (substr($line->numero_compte, 0, 3) == '411') { if (substr($line->numero_compte, 0, 3) == '411') {
print 'C' . $this->separator; print 'C' . $separator;
} }
if (substr($line->numero_compte, 0, 3) == '401') { if (substr($line->numero_compte, 0, 3) == '401') {
print 'F' . $this->separator; print 'F' . $separator;
} }
print length_accountg($line->subledger_account) . $this->separator; print length_accountg($line->subledger_account) . $separator;
} }
print price($line->debit) . $this->separator; print price($line->debit) . $separator;
print price($line->credit) . $this->separator; print price($line->credit) . $separator;
print dol_trunc($line->label_operation, 32) . $this->separator; print dol_trunc($line->label_operation, 32) . $separator;
print $this->end_line; print $end_line;
} }
} }
@ -305,7 +382,7 @@ class AccountancyExport
public function exportCiel(&$TData) { public function exportCiel(&$TData) {
global $conf; global $conf;
$this->end_line ="\r\n"; $end_line ="\r\n";
$i = 1; $i = 1;
$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be yyyymmdd
@ -328,7 +405,7 @@ class AccountancyExport
$Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34); $Tab['intitule_compte'] = str_pad(self::trunc($data->label_operation, 34), 34);
$Tab['end'] = 'O2003'; $Tab['end'] = 'O2003';
$Tab['end_line'] = $this->end_line; $Tab['end_line'] = $end_line;
print implode($Tab); print implode($Tab);
$i ++; $i ++;
@ -345,7 +422,7 @@ class AccountancyExport
public function exportQuadratus(&$TData) { public function exportQuadratus(&$TData) {
global $conf; global $conf;
$this->end_line ="\r\n"; $end_line ="\r\n";
$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy
foreach ( $TData as $data ) { foreach ( $TData as $data ) {
@ -380,7 +457,7 @@ class AccountancyExport
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10); $Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
$Tab['filler4'] = str_repeat(' ', 73); $Tab['filler4'] = str_repeat(' ', 73);
$Tab['end_line'] = $this->end_line; $Tab['end_line'] = $end_line;
print implode($Tab); print implode($Tab);
} }
@ -396,24 +473,25 @@ class AccountancyExport
*/ */
public function exportEbp($objectLines) { public function exportEbp($objectLines) {
$this->separator = ','; $separator = ',';
$end_line = "\n";
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->id . $this->separator; print $line->id . $separator;
print $date . $this->separator; print $date . $separator;
print $line->code_journal . $this->separator; print $line->code_journal . $separator;
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $separator;
print substr(length_accountg($line->numero_compte),0,2) . $this->separator; print substr(length_accountg($line->numero_compte),0,2) . $separator;
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator; print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator;
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator; print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator;
print price2num($line->montant).$this->separator; print price2num($line->montant).$separator;
print $line->sens.$this->separator; print $line->sens.$separator;
print $date . $this->separator; print $date . $separator;
print 'EUR'; print 'EUR';
print $this->end_line; print $end_line;
} }
} }
@ -427,33 +505,64 @@ class AccountancyExport
*/ */
public function exportAgiris($objectLines) { public function exportAgiris($objectLines) {
$this->separator = ';'; $separator = ';';
$end_line = "\n";
foreach ( $objectLines as $line ) { foreach ( $objectLines as $line ) {
$date = dol_print_date($line->doc_date, '%d%m%Y'); $date = dol_print_date($line->doc_date, '%d%m%Y');
print $line->piece_num . $this->separator; print $line->piece_num . $separator;
print $line->label_operation . $this->separator; print $line->label_operation . $separator;
print $date . $this->separator; print $date . $separator;
print $line->label_operation . $this->separator; print $line->label_operation . $separator;
if (empty($line->subledger_account)) { if (empty($line->subledger_account)) {
print length_accountg($line->numero_compte) . $this->separator; print length_accountg($line->numero_compte) . $separator;
} else { } else {
print length_accounta($line->subledger_account) . $this->separator; print length_accounta($line->subledger_account) . $separator;
} }
print $line->doc_ref . $this->separator; print $line->doc_ref . $separator;
print price($line->debit) . $this->separator; print price($line->debit) . $separator;
print price($line->credit) . $this->separator; print price($line->credit) . $separator;
print price($line->montant).$this->separator; print price($line->montant) . $separator;
print $line->sens.$this->separator; print $line->sens . $separator;
print $line->code_journal; print $line->code_journal;
print $this->end_line; print $end_line;
} }
} }
/**
* Export format : Configurable
*
* @param array $objectLines data
*
* @return void
*/
public function exportConfigurable($objectLines) {
global $conf;
foreach ($objectLines as $line) {
$tab = array();
// export configurable
$date = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE);
$tab[] = $date;
$tab[] = $line->doc_ref;
$tab[] = $line->piece_num;
$tab[] = $line->label_operation;
$tab[] = length_accountg($line->numero_compte);
$tab[] = length_accounta($line->subledger_account);
$tab[] = price($line->debit);
$tab[] = price($line->credit);
$tab[] = price($line->montant);
$tab[] = $line->code_journal;
$separator = $this->separator;
print implode($separator, $tab) . $this->end_line;
}
}
/** /**
* *

View File

@ -7,6 +7,8 @@ ACCOUNTING_EXPORT_LABEL=Export label
ACCOUNTING_EXPORT_AMOUNT=Export amount ACCOUNTING_EXPORT_AMOUNT=Export amount
ACCOUNTING_EXPORT_DEVISE=Export currency ACCOUNTING_EXPORT_DEVISE=Export currency
Selectformat=Select the format for the file Selectformat=Select the format for the file
ACCOUNTING_EXPORT_FORMAT=Select the format for the file
ACCOUNTING_EXPORT_ENDLINE=Select the carriage return type
ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name
ThisService=This service ThisService=This service
ThisProduct=This product ThisProduct=This product
@ -252,6 +254,7 @@ Modelcsv_quadratus=Export towards Quadratus QuadraCompta
Modelcsv_ebp=Export towards EBP Modelcsv_ebp=Export towards EBP
Modelcsv_cogilog=Export towards Cogilog Modelcsv_cogilog=Export towards Cogilog
Modelcsv_agiris=Export towards Agiris (Test) Modelcsv_agiris=Export towards Agiris (Test)
Modelcsv_configurable=Export Configurable
ChartofaccountsId=Chart of accounts Id ChartofaccountsId=Chart of accounts Id
## Tools - Init accounting account on product / service ## Tools - Init accounting account on product / service