mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
1f1809dd3e
|
|
@ -5,6 +5,7 @@
|
|||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -47,12 +48,40 @@ $action = GETPOST('action', 'alpha');
|
|||
|
||||
// Parameters ACCOUNTING_EXPORT_*
|
||||
$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 (
|
||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||
'ACCOUNTING_EXPORT_DATE'
|
||||
'1' => array(
|
||||
'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') {
|
||||
$error = 0;
|
||||
|
||||
$format = GETPOST('format', 'alpha');
|
||||
$modelcsv = GETPOST('modelcsv', 'int');
|
||||
|
||||
if (! empty($format)) {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
$modelcsv = GETPOST('ACCOUNTING_EXPORT_MODELCSV', 'int');
|
||||
|
||||
if (! empty($modelcsv)) {
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_MODELCSV', $modelcsv, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
||||
dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
//if ($modelcsv==AccountancyExport::$EXPORT_TYPE_QUADRATUS || $modelcsv==AccountancyExport::$EXPORT_TYPE_CIEL) {
|
||||
// dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', 'txt', 'chaine', 0, '', $conf->entity);
|
||||
//}
|
||||
} else {
|
||||
$error ++;
|
||||
}
|
||||
|
|
@ -91,16 +111,22 @@ if ($action == 'update') {
|
|||
}
|
||||
}
|
||||
|
||||
foreach ( $model_option as $constname ) {
|
||||
$constvalue = GETPOST($constname, 'alpha');
|
||||
foreach ($listparam[$modelcsv] as $key => $value ) {
|
||||
$constante = $key;
|
||||
|
||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
if (strpos($constante, 'ACCOUNTING')!==false) {
|
||||
$constvalue = GETPOST($key, 'alpha');
|
||||
if (! dolibarr_set_const($db, $constante, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
// reload
|
||||
$configuration = AccountancyExport::getTypeConfig();
|
||||
$listparam = $configuration[param];
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
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>';
|
||||
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 '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
$var = true;
|
||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), -1, 'technic');
|
||||
|
||||
/*
|
||||
* Main Options
|
||||
|
|
@ -132,7 +204,6 @@ print '<tr class="liste_titre">';
|
|||
print '<td colspan="3">' . $langs->trans('Options') . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = ! $var;
|
||||
|
||||
$num = count($main_option);
|
||||
if ($num) {
|
||||
|
|
@ -146,7 +217,7 @@ if ($num) {
|
|||
|
||||
// Value
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +235,6 @@ print '<tr class="liste_titre">';
|
|||
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var = ! $var;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td width="50%">' . $langs->trans("Selectmodelcsv") . '</td>';
|
||||
|
|
@ -175,7 +245,7 @@ if (! $conf->use_javascript_ajax) {
|
|||
} else {
|
||||
print '<td>';
|
||||
$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>';
|
||||
}
|
||||
|
|
@ -195,39 +265,21 @@ if ($num2) {
|
|||
print '<td colspan="3">' . $langs->trans('OtherOptions') . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > AccountancyExport::$EXPORT_TYPE_NORMAL)
|
||||
{
|
||||
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 ) {
|
||||
foreach ( $model_option as $key) {
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
print '<td width="50%">' . $label . '</td>';
|
||||
// Param
|
||||
$label = $key[label];
|
||||
print '<td width="50%">' . $langs->trans($label) . '</td>';
|
||||
|
||||
// Value
|
||||
print '<td>';
|
||||
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||
print '<td>';
|
||||
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>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2016 Pierre-Henry Favre <phf@atm-consulting.fr>
|
||||
* 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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -49,7 +50,8 @@ class AccountancyExport
|
|||
public static $EXPORT_TYPE_EBP = 7;
|
||||
public static $EXPORT_TYPE_COGILOG = 8;
|
||||
public static $EXPORT_TYPE_AGIRIS = 9;
|
||||
|
||||
public static $EXPORT_TYPE_CONFIGURABLE = 10;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var string[] Error codes (or messages)
|
||||
|
|
@ -78,11 +80,11 @@ class AccountancyExport
|
|||
|
||||
$this->db = &$db;
|
||||
$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
|
||||
*/
|
||||
|
|
@ -98,10 +100,73 @@ class AccountancyExport
|
|||
self::$EXPORT_TYPE_QUADRATUS => $langs->trans('Modelcsv_quadratus'),
|
||||
self::$EXPORT_TYPE_EBP => $langs->trans('Modelcsv_ebp'),
|
||||
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
|
||||
*
|
||||
|
|
@ -151,6 +216,9 @@ class AccountancyExport
|
|||
case self::$EXPORT_TYPE_AGIRIS :
|
||||
$this->exportAgiris($TData);
|
||||
break;
|
||||
case self::$EXPORT_TYPE_CONFIGURABLE :
|
||||
$this->exportConfigurable($TData);
|
||||
break;
|
||||
default:
|
||||
$this->errors[] = $langs->trans('accountancy_error_modelnotfound');
|
||||
break;
|
||||
|
|
@ -191,7 +259,8 @@ class AccountancyExport
|
|||
public function exportCegid($objectLines) {
|
||||
foreach ( $objectLines as $line ) {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$separator = ";";
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
|
|
@ -201,7 +270,7 @@ class AccountancyExport
|
|||
print price($line->montant) . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $line->doc_ref;
|
||||
print $this->end_line;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -215,24 +284,26 @@ class AccountancyExport
|
|||
public function exportCogilog($objectLines) {
|
||||
foreach ( $objectLines as $line ) {
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
print $line->code_journal . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print $line->piece_num . $this->separator;
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print '' . $this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print $line->code_journal . $separator;
|
||||
print $date . $separator;
|
||||
print $line->piece_num . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print '' . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $date . $separator;
|
||||
if ($line->sens=='D') {
|
||||
print price($line->montant) . $this->separator;
|
||||
print '' . $this->separator;
|
||||
print price($line->montant) . $separator;
|
||||
print '' . $separator;
|
||||
}elseif ($line->sens=='C') {
|
||||
print '' . $this->separator;
|
||||
print price($line->montant) . $this->separator;
|
||||
print '' . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
}
|
||||
print $line->doc_ref . $this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
print $this->end_line;
|
||||
print $line->doc_ref . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,18 +316,21 @@ class AccountancyExport
|
|||
*/
|
||||
public function exportCoala($objectLines) {
|
||||
// Coala export
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ( $objectLines as $line ) {
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
print $date . $this->separator;
|
||||
print $line->code_journal . $this->separator;
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print $line->piece_num . $this->separator;
|
||||
print $line->doc_ref . $this->separator;
|
||||
print price($line->debit) . $this->separator;
|
||||
print price($line->credit) . $this->separator;
|
||||
print 'E' . $this->separator;
|
||||
print length_accountg($line->subledger_account) . $this->separator;
|
||||
print $this->end_line;
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print $line->piece_num . $separator;
|
||||
print $line->doc_ref . $separator;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print 'E' . $separator;
|
||||
print length_accountg($line->subledger_account) . $separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -270,28 +344,31 @@ class AccountancyExport
|
|||
public function exportBob50($objectLines) {
|
||||
|
||||
// Bob50
|
||||
$separator = ";";
|
||||
$end_line = "\n";
|
||||
|
||||
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');
|
||||
print $date . $this->separator;
|
||||
print $date . $separator;
|
||||
|
||||
if (empty($line->subledger_account)) {
|
||||
print 'G' . $this->separator;
|
||||
print length_accounta($line->numero_compte) . $this->separator;
|
||||
print 'G' . $separator;
|
||||
print length_accounta($line->numero_compte) . $separator;
|
||||
} else {
|
||||
if (substr($line->numero_compte, 0, 3) == '411') {
|
||||
print 'C' . $this->separator;
|
||||
print 'C' . $separator;
|
||||
}
|
||||
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->credit) . $this->separator;
|
||||
print dol_trunc($line->label_operation, 32) . $this->separator;
|
||||
print $this->end_line;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print dol_trunc($line->label_operation, 32) . $separator;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -305,7 +382,7 @@ class AccountancyExport
|
|||
public function exportCiel(&$TData) {
|
||||
global $conf;
|
||||
|
||||
$this->end_line ="\r\n";
|
||||
$end_line ="\r\n";
|
||||
|
||||
$i = 1;
|
||||
$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['end'] = 'O2003';
|
||||
|
||||
$Tab['end_line'] = $this->end_line;
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
$i ++;
|
||||
|
|
@ -345,7 +422,7 @@ class AccountancyExport
|
|||
public function exportQuadratus(&$TData) {
|
||||
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
|
||||
foreach ( $TData as $data ) {
|
||||
|
|
@ -380,7 +457,7 @@ class AccountancyExport
|
|||
$Tab['num_piece3'] = str_pad(self::trunc($data->piece_num, 10), 10);
|
||||
$Tab['filler4'] = str_repeat(' ', 73);
|
||||
|
||||
$Tab['end_line'] = $this->end_line;
|
||||
$Tab['end_line'] = $end_line;
|
||||
|
||||
print implode($Tab);
|
||||
}
|
||||
|
|
@ -396,24 +473,25 @@ class AccountancyExport
|
|||
*/
|
||||
public function exportEbp($objectLines) {
|
||||
|
||||
$this->separator = ',';
|
||||
$separator = ',';
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ( $objectLines as $line ) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->id . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print $line->code_journal . $this->separator;
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print substr(length_accountg($line->numero_compte),0,2) . $this->separator;
|
||||
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $this->separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$this->separator;
|
||||
print price2num($line->montant).$this->separator;
|
||||
print $line->sens.$this->separator;
|
||||
print $date . $this->separator;
|
||||
print $line->id . $separator;
|
||||
print $date . $separator;
|
||||
print $line->code_journal . $separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
print substr(length_accountg($line->numero_compte),0,2) . $separator;
|
||||
print '"'.dol_trunc($line->label_operation,40,'right','UTF-8',1).'"' . $separator;
|
||||
print '"'.dol_trunc($line->piece_num,15,'right','UTF-8',1).'"'.$separator;
|
||||
print price2num($line->montant).$separator;
|
||||
print $line->sens.$separator;
|
||||
print $date . $separator;
|
||||
print 'EUR';
|
||||
print $this->end_line;
|
||||
print $end_line;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -427,33 +505,64 @@ class AccountancyExport
|
|||
*/
|
||||
public function exportAgiris($objectLines) {
|
||||
|
||||
$this->separator = ';';
|
||||
$separator = ';';
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ( $objectLines as $line ) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->piece_num . $this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
print $date . $this->separator;
|
||||
print $line->label_operation . $this->separator;
|
||||
print $line->piece_num . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
print $date . $separator;
|
||||
print $line->label_operation . $separator;
|
||||
|
||||
if (empty($line->subledger_account)) {
|
||||
print length_accountg($line->numero_compte) . $this->separator;
|
||||
print length_accountg($line->numero_compte) . $separator;
|
||||
} else {
|
||||
print length_accounta($line->subledger_account) . $this->separator;
|
||||
print length_accounta($line->subledger_account) . $separator;
|
||||
}
|
||||
|
||||
print $line->doc_ref . $this->separator;
|
||||
print price($line->debit) . $this->separator;
|
||||
print price($line->credit) . $this->separator;
|
||||
print price($line->montant).$this->separator;
|
||||
print $line->sens.$this->separator;
|
||||
print $line->doc_ref . $separator;
|
||||
print price($line->debit) . $separator;
|
||||
print price($line->credit) . $separator;
|
||||
print price($line->montant) . $separator;
|
||||
print $line->sens . $separator;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ ACCOUNTING_EXPORT_LABEL=Export label
|
|||
ACCOUNTING_EXPORT_AMOUNT=Export amount
|
||||
ACCOUNTING_EXPORT_DEVISE=Export currency
|
||||
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
|
||||
ThisService=This service
|
||||
ThisProduct=This product
|
||||
|
|
@ -252,6 +254,7 @@ Modelcsv_quadratus=Export towards Quadratus QuadraCompta
|
|||
Modelcsv_ebp=Export towards EBP
|
||||
Modelcsv_cogilog=Export towards Cogilog
|
||||
Modelcsv_agiris=Export towards Agiris (Test)
|
||||
Modelcsv_configurable=Export Configurable
|
||||
ChartofaccountsId=Chart of accounts Id
|
||||
|
||||
## Tools - Init accounting account on product / service
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user