Merge pull request #3477 from aspangaro/develop-64
New Accountancy Uniformize code & rename a constant
This commit is contained in:
commit
42ac326f07
@ -4,7 +4,7 @@
|
|||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* 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>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@ -43,8 +43,12 @@ if (!$user->admin)
|
|||||||
|
|
||||||
$action = GETPOST('action', 'alpha');
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
// Other parameters ACCOUNTING_EXPORT_*
|
// Parameters ACCOUNTING_EXPORT_*
|
||||||
$list = array (
|
$main_option = array (
|
||||||
|
'ACCOUNTING_EXPORT_PREFIX_SPEC'
|
||||||
|
);
|
||||||
|
|
||||||
|
$model_option = array (
|
||||||
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
'ACCOUNTING_EXPORT_SEPARATORCSV',
|
||||||
'ACCOUNTING_EXPORT_DATE',
|
'ACCOUNTING_EXPORT_DATE',
|
||||||
'ACCOUNTING_EXPORT_PIECE',
|
'ACCOUNTING_EXPORT_PIECE',
|
||||||
@ -60,10 +64,18 @@ $list = array (
|
|||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
$format = GETPOST('format', 'alpha');
|
||||||
$modelcsv = GETPOST('modelcsv', 'int');
|
$modelcsv = GETPOST('modelcsv', 'int');
|
||||||
|
|
||||||
if (! empty($modelcsv)) {
|
if (! empty($format)) {
|
||||||
|
if (! dolibarr_set_const($db, 'ACCOUNTING_EXPORT_FORMAT', $format, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ++;
|
||||||
}
|
}
|
||||||
@ -71,7 +83,15 @@ if ($action == 'update') {
|
|||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $list as $constname ) {
|
foreach ($main_option as $constname) {
|
||||||
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($model_option as $constname) {
|
||||||
$constvalue = GETPOST($constname, 'alpha');
|
$constvalue = GETPOST($constname, 'alpha');
|
||||||
|
|
||||||
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) {
|
||||||
@ -106,9 +126,67 @@ print '<input type="hidden" name="action" value="update">';
|
|||||||
|
|
||||||
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
dol_fiche_head($head, 'export', $langs->trans("Configuration"), 0, 'cron');
|
||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
$var = true;
|
$var = true;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Main Options
|
||||||
|
*/
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td colspan="3">' . $langs->trans('MainOptions') . '</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
print '<tr ' . $bc[$var] . '>';
|
||||||
|
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>";
|
||||||
|
|
||||||
|
$num = count($main_option);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
foreach ($main_option as $key) {
|
||||||
|
$var = ! $var;
|
||||||
|
|
||||||
|
print '<tr ' . $bc[$var] . ' class="value">';
|
||||||
|
|
||||||
|
// Param
|
||||||
|
$label = $langs->trans($key);
|
||||||
|
print '<td width="50%">' . $label . '</td>';
|
||||||
|
|
||||||
|
// Value
|
||||||
|
print '<td>';
|
||||||
|
print '<input type="text" size="20" name="' . $key . '" value="' . $conf->global->$key . '">';
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
|
||||||
|
print "<br>\n";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Export model
|
||||||
|
*/
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
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>';
|
||||||
@ -143,8 +221,8 @@ print "<br>\n";
|
|||||||
* Parameters
|
* Parameters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$num = count($list);
|
$num2 = count($model_option);
|
||||||
if ($num)
|
if ($num2)
|
||||||
{
|
{
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
@ -152,7 +230,7 @@ if ($num)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV > 1) print '<tr><td colspan="2" bgcolor="red"><b>' . $langs->trans('OptionsDeactivatedForThisExportModel') . '</b></td></tr>';
|
||||||
|
|
||||||
foreach ( $list as $key ) {
|
foreach ($model_option as $key) {
|
||||||
$var = ! $var;
|
$var = ! $var;
|
||||||
|
|
||||||
print '<tr ' . $bc[$var] . ' class="value">';
|
print '<tr ' . $bc[$var] . ' class="value">';
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License fr more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
@ -25,7 +25,7 @@
|
|||||||
/**
|
/**
|
||||||
* \file htdocs/accountancy/journal/bankjournal.php
|
* \file htdocs/accountancy/journal/bankjournal.php
|
||||||
* \ingroup Accounting Expert
|
* \ingroup Accounting Expert
|
||||||
* \brief Page with sells journal
|
* \brief Page with bank journal
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
@ -66,6 +66,8 @@ $date_endday = GETPOST('date_endday');
|
|||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -421,10 +423,9 @@ if ($action == 'writeBookKeeping')
|
|||||||
if ($action == 'export_csv')
|
if ($action == 'export_csv')
|
||||||
{
|
{
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$bank_journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
|
$journal = $conf->global->ACCOUNTING_BANK_JOURNAL;
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||||
header('Content-Disposition: attachment;filename=journal_banque.csv');
|
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007-2010 Jean Heimburger <jean@tiaris.info>
|
||||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2013-2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
*
|
*
|
||||||
@ -52,6 +52,8 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -156,7 +158,6 @@ if ($result) {
|
|||||||
|
|
||||||
// Bookkeeping Write
|
// Bookkeeping Write
|
||||||
if ($action == 'writebookkeeping') {
|
if ($action == 'writebookkeeping') {
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
foreach ( $tabfac as $key => $val ) {
|
foreach ( $tabfac as $key => $val ) {
|
||||||
foreach ( $tabttc[$key] as $k => $mt ) {
|
foreach ( $tabttc[$key] as $k => $mt ) {
|
||||||
@ -246,14 +247,9 @@ $companystatic = new Fournisseur($db);
|
|||||||
if ($action == 'export_csv')
|
if ($action == 'export_csv')
|
||||||
{
|
{
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$purchase_journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
$journal = $conf->global->ACCOUNTING_PURCHASE_JOURNAL;
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
|
||||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_achats.csv";
|
|
||||||
else
|
|
||||||
$filename="journal_achats.csv";
|
|
||||||
header('Content-Disposition: attachment;filename='.$filename);
|
|
||||||
|
|
||||||
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) // Model Cegid Expert Export
|
||||||
{
|
{
|
||||||
|
|||||||
@ -54,6 +54,8 @@ $date_endmonth = GETPOST('date_endmonth');
|
|||||||
$date_endday = GETPOST('date_endday');
|
$date_endday = GETPOST('date_endday');
|
||||||
$date_endyear = GETPOST('date_endyear');
|
$date_endyear = GETPOST('date_endyear');
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
@ -191,7 +193,6 @@ if ($result) {
|
|||||||
// Bookkeeping Write
|
// Bookkeeping Write
|
||||||
if ($action == 'writebookkeeping')
|
if ($action == 'writebookkeeping')
|
||||||
{
|
{
|
||||||
$now = dol_now();
|
|
||||||
|
|
||||||
foreach ($tabfac as $key => $val)
|
foreach ($tabfac as $key => $val)
|
||||||
{
|
{
|
||||||
@ -275,14 +276,9 @@ if ($action == 'writebookkeeping')
|
|||||||
if ($action == 'export_csv')
|
if ($action == 'export_csv')
|
||||||
{
|
{
|
||||||
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
$sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV;
|
||||||
$sell_journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
$journal = $conf->global->ACCOUNTING_SELL_JOURNAL;
|
||||||
|
|
||||||
header('Content-Type: text/csv');
|
include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php';
|
||||||
if ($conf->global->EXPORT_PREFIX_SPEC)
|
|
||||||
$filename=$conf->global->EXPORT_PREFIX_SPEC."_"."journal_ventes.csv";
|
|
||||||
else
|
|
||||||
$filename="journal_ventes.csv";
|
|
||||||
header('Content-Disposition: attachment;filename='.$filename);
|
|
||||||
|
|
||||||
$companystatic = new Client($db);
|
$companystatic = new Client($db);
|
||||||
|
|
||||||
|
|||||||
28
htdocs/accountancy/tpl/export_journal.tpl.php
Normal file
28
htdocs/accountancy/tpl/export_journal.tpl.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation; either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC;
|
||||||
|
$format = $conf->global->ACCOUNTING_EXPORT_FORMAT;
|
||||||
|
|
||||||
|
$date_export = dol_print_date($now, '%Y%m%d%H%M%S');
|
||||||
|
|
||||||
|
header('Content-Type: text/csv');
|
||||||
|
if ($prefix)
|
||||||
|
$filename = $prefix . "_" . "journal_" . $journal . $date_export . "." . $format;
|
||||||
|
else
|
||||||
|
$filename = "journal_" . $journal . $date_export . "." . $format;
|
||||||
|
header('Content-Disposition: attachment;filename='.$filename);
|
||||||
0
htdocs/accountancy/tpl/index.html
Normal file
0
htdocs/accountancy/tpl/index.html
Normal file
@ -196,6 +196,11 @@ class modAccounting extends DolibarrModules
|
|||||||
"chaine",
|
"chaine",
|
||||||
"ER"
|
"ER"
|
||||||
);
|
);
|
||||||
|
$this->const[23] = array(
|
||||||
|
"ACCOUNTING_EXPORT_FORMAT",
|
||||||
|
"chaine",
|
||||||
|
"csv"
|
||||||
|
);
|
||||||
|
|
||||||
// Tabs
|
// Tabs
|
||||||
$this->tabs = array();
|
$this->tabs = array();
|
||||||
|
|||||||
@ -24,7 +24,8 @@ INSERT INTO llx_const (name, value, type, note, visible) values ('MAIN_DELAY_EXP
|
|||||||
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32);
|
||||||
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
ALTER TABLE llx_accountingaccount MODIFY COLUMN fk_pcg_version varchar(32);
|
||||||
|
|
||||||
|
UPDATE llx_const SET name = __ENCRYPT('ACCOUNTING_EXPORT_PREFIX_SPEC')__ WHERE __DECRYPT('name')__ = 'EXPORT_PREFIX_SPEC';
|
||||||
|
|
||||||
ALTER TABLE llx_accountingaccount RENAME TO llx_accounting_account;
|
ALTER TABLE llx_accountingaccount RENAME TO llx_accounting_account;
|
||||||
|
|
||||||
ALTER TABLE llx_societe ADD COLUMN model_pdf varchar(255);
|
ALTER TABLE llx_societe ADD COLUMN model_pdf varchar(255);
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,13 @@
|
|||||||
CHARSET=UTF-8
|
CHARSET=UTF-8
|
||||||
ACCOUNTING_EXPORT_SEPARATORCSV=Column separator for export file
|
ACCOUNTING_EXPORT_SEPARATORCSV=Column separator for export file
|
||||||
ACCOUNTING_EXPORT_DATE=Date format for export file
|
ACCOUNTING_EXPORT_DATE=Date format for export file
|
||||||
ACCOUNTING_EXPORT_PIECE=Export the number of piece ?
|
ACCOUNTING_EXPORT_PIECE=Export the number of piece
|
||||||
ACCOUNTING_EXPORT_GLOBAL_ACCOUNT=Export with global account ?
|
ACCOUNTING_EXPORT_GLOBAL_ACCOUNT=Export with global account
|
||||||
ACCOUNTING_EXPORT_LABEL=Export the label ?
|
ACCOUNTING_EXPORT_LABEL=Export the label
|
||||||
ACCOUNTING_EXPORT_AMOUNT=Export the amount ?
|
ACCOUNTING_EXPORT_AMOUNT=Export the amount
|
||||||
ACCOUNTING_EXPORT_DEVISE=Export the devise ?
|
ACCOUNTING_EXPORT_DEVISE=Export the devise
|
||||||
|
Selectformat=Select the format for the file
|
||||||
|
ACCOUNTING_EXPORT_PREFIX_SPEC=Specify the prefix for the file name
|
||||||
|
|
||||||
Accounting=Accounting
|
Accounting=Accounting
|
||||||
Globalparameters=Global parameters
|
Globalparameters=Global parameters
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user