From f9dc25cf3f3481340ed166507b96b60e2103efc6 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 6 Sep 2014 09:50:42 +0200 Subject: [PATCH 1/9] Patch Accounting Expert Module --- htdocs/accountancy/admin/card.php | 52 ++++++++++--------- htdocs/accountancy/admin/importaccounts.php | 6 +-- .../bookkeeping/balancebymonth.php | 2 +- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 4 +- .../class/accountancysystem.class.php | 4 +- htdocs/accountancy/customer/card.php | 34 +++++++----- htdocs/accountancy/customer/index.php | 5 +- htdocs/accountancy/customer/list.php | 6 +-- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/cashjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/accountancy/supplier/index.php | 7 +-- htdocs/core/menus/standard/eldy.lib.php | 15 +++--- .../tables/llx_accounting_bookkeeping.sql | 2 +- htdocs/langs/en_US/accountancy.lang | 7 +-- htdocs/langs/es_ES/accountancy.lang | 12 ++--- htdocs/langs/fr_FR/accountancy.lang | 7 +-- 18 files changed, 93 insertions(+), 78 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 43dc38ea4bb..9ebdea5fefc 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -47,31 +47,33 @@ $accounting = new AccountingAccount($db); // Action if ($action == 'add') { - $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; - - dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); - $result = $db->query($sql); - $obj = $db->fetch_object($result); - - $accounting->fk_pcg_version = $obj->pcg_version; - $accounting->pcg_type = GETPOST('pcg_type'); - $accounting->pcg_subtype = GETPOST('pcg_subtype'); - $accounting->account_number = GETPOST('account_number', 'int'); - $accounting->account_parent = GETPOST('account_parent', 'int'); - $accounting->label = GETPOST('label', 'alpha'); - $accounting->active = 1; - - $res = $accounting->create($user); - - if ($res == 0) { - } else { - if ($res == - 3) { - $_error = 1; - $action = "create"; - } - if ($res == - 4) { - $_error = 2; - $action = "create"; + if (! GETPOST('cancel', 'alpha')) { + $sql = 'SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS; + + dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); + $result = $db->query($sql); + $obj = $db->fetch_object($result); + + $accounting->fk_pcg_version = $obj->pcg_version; + $accounting->pcg_type = GETPOST('pcg_type'); + $accounting->pcg_subtype = GETPOST('pcg_subtype'); + $accounting->account_number = GETPOST('account_number', 'int'); + $accounting->account_parent = GETPOST('account_parent', 'int'); + $accounting->label = GETPOST('label', 'alpha'); + $accounting->active = 1; + + $res = $accounting->create($user); + + if ($res == 0) { + } else { + if ($res == - 3) { + $_error = 1; + $action = "create"; + } + if ($res == - 4) { + $_error = 2; + $action = "create"; + } } } Header("Location: account.php"); diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index 4354cd90cc3..b350aa8e590 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -61,7 +61,7 @@ if ($_POST["action"] == 'import') { $accounting = new AccountingAccount($db); - $monLabel = GETPOST('intitule' . $maLigneCochee); + $monLabel = GETPOST('label' . $maLigneCochee); $monParentAccount = GETPOST('AccountParent' . $maLigneCochee); $monType = GETPOST('pcgType' . $maLigneCochee); $monSubType = GETPOST('pcgSubType' . $maLigneCochee); @@ -146,7 +146,7 @@ if ($result) { print ''; print ''; - print ''; + print ''; print ''; // Colonne choix du compte @@ -164,7 +164,7 @@ if ($result) { // Colonne choix ligne a ventiler - $checked = ('intitule' == 'O') ? ' checked=checked' : ''; + $checked = ('label' == 'O') ? ' checked=checked' : ''; print ''; print ''; diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index dd9f18e82a4..120d08db09c 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -76,7 +76,7 @@ $y = $year_current; $var = true; print ''; -print ''; +print ''; $sql = "SELECT bk.numero_compte AS 'compte',"; $sql .= " ROUND(SUM(IF(MONTH(bk.doc_date)=1,bk.montant,0)),2) AS 'Janvier',"; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index c782797b9cb..9e109c7feeb 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -26,7 +26,7 @@ require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT.'accountancy/class/bookkeeping.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; // Langs $langs->load("accounting"); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 12cf9559d8d..de3bbf5c1db 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -91,9 +91,9 @@ else if ($action == 'export_csv') { else { - llxHeader('', $langs->trans("Accounting") . ' - ' . $langs->trans("Bookkeeping")); + llxHeader('', $langs->trans("Bookkeeping")); - /* +/* * List */ diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index 070f9a8071a..7ce2134d0d2 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -57,8 +57,8 @@ class AccountancySystem $now = dol_now(); $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accounting_system"; - $sql .= " (date_creation, fk_user_author, numero,intitule)"; - $sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->intitule . "')"; + $sql .= " (date_creation, fk_user_author, numero, label)"; + $sql .= " VALUES (" . $this->db->idate($now) . "," . $user->id . ",'" . $this->numero . "','" . $this->label . "')"; dol_syslog(get_class($this) . "::create sql=" . $sql, LOG_DEBUG); $resql = $this->db->query($sql); diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 08dc4b05bd9..91a0eb5df8b 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -47,16 +47,23 @@ if (! $user->rights->accounting->access) * Actions */ -if ($action == 'ventil' && $user->rights->accounting->access) { - $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; - $sql .= " SET fk_code_ventilation = " . $codeventil; - $sql .= " WHERE rowid = " . $id; +if ($action == 'ventil' && $user->rights->accounting->access) +{ + if (! GETPOST('cancel', 'alpha')) + { + $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sql .= " SET fk_code_ventilation = " . $codeventil; + $sql .= " WHERE rowid = " . $id; - dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); - $resql = $db->query($sql); - if (! $resql) { - setEventMessage($db->lasterror(), 'errors'); - } + dol_syslog("/accounting/customer/card.php sql=" . $sql, LOG_DEBUG); + $resql = $db->query($sql); + if (! $resql) { + setEventMessage($db->lasterror(), 'errors'); + } + } else { + header("Location: ./lines.php"); + exit(); + } } llxHeader("", "", "FicheVentilation"); @@ -101,7 +108,8 @@ if (! empty($id)) { print ''; print ''; - print_fiche_titre($langs->trans("Ventilation")); + $linkback=''.$langs->trans("Back").''; + print_fiche_titre($langs->trans('AccountingVentilationCustomer'),$linkback,'setup'); print '
' . $langs->trans("Intitule") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . 'Total
' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . 'Total
'; @@ -119,9 +127,11 @@ if (! empty($id)) { print ''; - print ''; - print '
' . $langs->trans("NewAccount") . ''; print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print '
 
'; + + print '
    '; + print ''; } else { print "Error"; diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index a9723b72497..2df4d675b20 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -28,6 +28,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; // Langs $langs->load("compta"); @@ -118,7 +119,7 @@ $var = true; print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -169,7 +170,7 @@ if ($resql) { while ( $i < $num ) { $row = $db->fetch_row($resql); - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index b67069cdf69..02602262e2c 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -27,9 +27,9 @@ require '../../main.inc.php'; // Class -require_once DOL_DOCUMENT_ROOT.'compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'product/class/product.class.php'; -require_once DOL_DOCUMENT_ROOT.'accountancy/class/html.formventilation.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; // Langs $langs->load("compta"); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4a57482a2d7..f2d5a586b37 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -264,7 +264,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $compte->intitule; + $bookkeeping->label_compte = $compte->label; $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0 ? $mt : 0); diff --git a/htdocs/accountancy/journal/cashjournal.php b/htdocs/accountancy/journal/cashjournal.php index f278a458ab5..33b1e4359c1 100644 --- a/htdocs/accountancy/journal/cashjournal.php +++ b/htdocs/accountancy/journal/cashjournal.php @@ -244,7 +244,7 @@ if ($action == 'writeBookKeeping') { $bookkeeping->fk_docdet = $val["fk_bank"]; $bookkeeping->code_tiers = $tabcompany[$key]['code_client']; $bookkeeping->numero_compte = $k; - $bookkeeping->label_compte = $compte->intitule; + $bookkeeping->label_compte = $compte->label; $bookkeeping->montant = ($mt < 0 ? - $mt : $mt); $bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->debit = ($mt >= 0 ? $mt : 0); diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index f1f61b0062a..3fb8cbc6927 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -34,7 +34,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'); +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/client.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3136be313e6..67426f8adb6 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -27,6 +27,7 @@ require '../../main.inc.php'; // Class require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; // Langs $langs->load("compta"); @@ -93,7 +94,7 @@ llxHeader('', $langs->trans("SuppliersVentilation")); $textprevyear = "" . img_previous() . ""; $textnextyear = " " . img_next() . ""; -print_fiche_titre($langs->trans("VentilationComptableSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); +print_fiche_titre($langs->trans("AccountingVentilationSupplier") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print '' . $langs->trans("DescVentilSupplier") . ''; print ''; @@ -104,7 +105,7 @@ $var = true; print '
' . $langs->trans("Account") . '' . $langs->trans("Intitule") . '' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '
' . $row[0] . '
' . length_accountg($row[0]) . '' . $row[1] . '' . price($row[2]) . '' . price($row[3]) . '
'; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -157,7 +158,7 @@ if ($resql) { $row = $db->fetch_row($resql); - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 2ca71223ff2..1ea86faad11 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -868,13 +868,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/customer/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); - $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier'); - if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); - if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); + if (! empty($conf->fournisseur->enabled)) + { + $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier'); + if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); + if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); + } - $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookeeping'); - if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); + if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); + if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); } // Rapports diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 856d4d058d7..54f24b1ea80 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -35,5 +35,5 @@ CREATE TABLE llx_accounting_bookkeeping fk_user_author integer NOT NULL, import_key varchar(14), code_journal varchar(10) DEFAULT NULL, - piece_num integer NOT NULL + piece_num integer NOT NULL ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 1dabe2cf8e3..3d06c7f28b6 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -20,6 +20,7 @@ Selectmodelcsv=Select a model of export Modelcsv_normal=Classic export Modelcsv_CEGID=Export towards CEGID Expert BackToChartofaccounts=Return chart of accounts +Back=Return Definechartofaccounts=Define a chart of accounts Selectchartofaccounts=Select a chart of accounts @@ -46,9 +47,9 @@ WriteBookKeeping=Record accounts in general ledger Bookkeeping=General ledger AccountBalanceByMonth=Account balance by month -VentilationComptable=Accounting ventilation -VentilationComptableSupplier=Accounting ventilation supplier -Intitule=Label +AccountingVentilation=Accounting ventilation +AccountingVentilationSupplier=Accounting ventilation supplier +AccountingVentilationCustomer=Accounting ventilation customer Line=Line CAHTF=Total purchase supplier HT diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index da8251cd96d..8c83a64fd84 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -22,6 +22,7 @@ Selectmodelcsv=Seleccione una plantilla de exportación Modelcsv_normal=Exportación clásica Modelcsv_CEGID=Exportar a Cegid Expert BackToChartofaccounts=Volver al plan contable +Back=Volver Definechartofaccounts=Definir la contabilidad Selectchartofaccounts=Seleccione un plan contable @@ -49,14 +50,9 @@ WriteBookKeeping=Registrar los asientos en el libro mayor Bookkeeping=libro mayor AccountBalanceByMonth=Saldo Mensual -VentilationComptable=desglose de Contabilidad -VentilationComptableSupplier=Proveedor de cuentas de ventilación -Intitule=título -Line=línea - -VentilationComptable=desglose de Contabilidad -VentilationComptableSupplier=Contabilización compras -Intitule=título +AccountingVentilation=desglose de Contabilidad +AccountingVentilationSupplier=Proveedor de cuentas de ventilación +AccountingVentilationCustomer=Cliente de cuentas de ventilación Line=línea Ventilate=contabilizar diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 9ee15ac2720..227915195eb 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -20,6 +20,7 @@ Selectmodelcsv=Sélectionnez un modèle d'export Modelcsv_normal=Export classique Modelcsv_CEGID=Export vers CEGID Expert BackToChartofaccounts=Retour plan comptable +Back=Retour Definechartofaccounts=Définir un plan comptable Selectchartofaccounts=Sélectionnez un plan comptable @@ -46,9 +47,9 @@ WriteBookKeeping=Comptabiliser les écritures dans le grand livre Bookkeeping=Grand livre AccountBalanceByMonth=Balance mensuelle -VentilationComptable=Ventilation comptable -VentilationComptableSupplier=Ventilation comptable fournisseur -Intitule=Intitulé +AccountingVentilation=Ventilation comptable +AccountingVentilationSupplier=Ventilation comptable fournisseur +AccountingVentilationCustomer=Ventilation comptable client Line=Ligne CAHTF=Total achat fournisseur HT From fad9fe71bc873770f62433d60d46c7476f231ed7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sat, 6 Sep 2014 14:45:35 +0200 Subject: [PATCH 2/9] Sort out type & subtype by Chart of accounts --- htdocs/accountancy/class/accountingaccount.class.php | 4 ++-- htdocs/accountancy/class/html.formventilation.class.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 6e0d16c6d6b..82c3ec3ca10 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -126,8 +126,8 @@ class AccountingAccount if (isset($this->active)) $this->active = trim($this->active); - // Check parameters - // Put here code to add control on parameters values + // Check parameters + // Put here code to add control on parameters values // Insert request $sql = "INSERT INTO " . MAIN_DB_PREFIX . "accountingaccount("; diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php index 7385219780b..33bb33a2353 100644 --- a/htdocs/accountancy/class/html.formventilation.class.php +++ b/htdocs/accountancy/class/html.formventilation.class.php @@ -166,7 +166,9 @@ class FormVentilation extends Form $out = ''; $sql = "SELECT DISTINCT pcg_type "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_type"; dol_syslog(get_class($this) . "::select_pcgtype sql=" . $sql, LOG_DEBUG); @@ -220,7 +222,9 @@ class FormVentilation extends Form $out = ''; $sql = "SELECT DISTINCT pcg_subtype "; - $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount "; + $sql .= " FROM " . MAIN_DB_PREFIX . "accountingaccount as aa"; + $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; + $sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS; $sql .= " ORDER BY pcg_subtype"; dol_syslog(get_class($this) . "::select_pcgsubtype sql=" . $sql, LOG_DEBUG); From 56071cb14213a3c1f13118a6254441ca79404cc1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 8 Sep 2014 20:35:41 +0200 Subject: [PATCH 3/9] Uniformize presentation of supplier index with customer index --- htdocs/accountancy/supplier/index.php | 84 +++++++++++++-------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 67426f8adb6..cd6ef6bcb53 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -104,21 +104,21 @@ $y = $year_current; $var = true; print '
' . $langs->trans("Account") . '' . $langs->trans("Intitule") . '' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '
' . $row[0] . '
' . length_accountg($row[0]) . '' . $row[1] . '' . price($row[2]) . '' . price($row[3]) . '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; $sql = "SELECT IF(aa.account_number IS NULL, 'Non pointe', aa.account_number) AS 'code comptable',"; $sql .= " IF(aa.label IS NULL, 'Non pointe', aa.label) AS 'Intitulé',"; @@ -184,20 +184,20 @@ print "
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $langs->trans("Account") . '' . $langs->trans("Label") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
\n"; print "
\n"; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; $sql = "SELECT '" . $langs->trans("CAHTF") . "' AS 'Total',"; $sql .= " ROUND(SUM(IF(MONTH(ff.datef)=1,ffd.total_ht,0)),2) AS 'Janvier',"; @@ -233,19 +233,19 @@ if ($resql) { $row = $db->fetch_row($resql); print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $i ++; From 289f46977bdbba7b4ae31c9527ee60478a65da4c Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 8 Sep 2014 21:19:05 +0200 Subject: [PATCH 4/9] List financial journals into admin --- htdocs/accountancy/admin/journaux.php | 65 ++++++++++++++------------- htdocs/langs/en_US/accountancy.lang | 4 +- htdocs/langs/es_ES/accountancy.lang | 4 +- htdocs/langs/fr_FR/accountancy.lang | 4 +- 4 files changed, 38 insertions(+), 39 deletions(-) diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index 49938781ace..f9aea2242c5 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -102,7 +102,7 @@ foreach ( $list as $key ) { // Param $label = $langs->trans($key); - print ''; + print ''; // Value print '
' . $langs->trans("Total") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $langs->trans("Total") . '' . $langs->trans("JanuaryMin") . '' . $langs->trans("FebruaryMin") . '' . $langs->trans("MarchMin") . '' . $langs->trans("AprilMin") . '' . $langs->trans("MayMin") . '' . $langs->trans("JuneMin") . '' . $langs->trans("JulyMin") . '' . $langs->trans("AugustMin") . '' . $langs->trans("SeptemberMin") . '' . $langs->trans("OctoberMin") . '' . $langs->trans("NovemberMin") . '' . $langs->trans("DecemberMin") . '' . $langs->trans("Total") . '
' . $row[0] . '' . $row[1] . '' . price($row[2]) . '' . price($row[3]) . '' . price($row[4]) . '' . price($row[5]) . '' . price($row[6]) . '' . price($row[7]) . '' . price($row[8]) . '' . price($row[9]) . '' . price($row[10]) . '' . price($row[11]) . '' . price($row[12]) . '' . price($row[13]) . '' . $row[1] . '' . price($row[2]) . '' . price($row[3]) . '' . price($row[4]) . '' . price($row[5]) . '' . price($row[6]) . '' . price($row[7]) . '' . price($row[8]) . '' . price($row[9]) . '' . price($row[10]) . '' . price($row[11]) . '' . price($row[12]) . '' . price($row[13]) . '
'; @@ -117,44 +117,49 @@ print '
'; -// Bank account -$sql = "SELECT ba.rowid, ba.ref , ba.label, ba.bank , ba.account_number, ba.code_journal "; -$sql .= " FROM ".MAIN_DB_PREFIX."lx_bank_account as ba"; -$sql .= " WHERE ba.clos = 0" ; -$sql .= " ORDER BY label"; +print ''; +print ''; +print ''; +print "\n"; -dol_syslog('accountancy/admin/journaux.php:: $sql='.$sql); +// Bank account +$sql = "SELECT rowid, label, accountancy_journal"; +$sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; +$sql.= " WHERE entity = ".$conf->entity; +$sql.= " AND clos = 0"; +$sql.= " ORDER BY label"; $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); + $numr = $db->num_rows($resql); $i = 0; + if ($numr > 0) + + while ($i < $numr) + { + $objp = $db->fetch_object($resql); + + $var = ! $var; + + print ''; + + // Param + print ''; + + // Value + print ''; + + $i++; + } } +else dol_print_error($db); +$db->free($resql); -print '
' . $langs->trans('JournalFinancial') . '
'; + print ''; + print '
'; -print ''; -print ''; -print "\n"; - -$form2 = new Form($db); - -$account = new Account($db); -foreach ( $resql as $key ) { - $var = ! $var; - - print ''; - - // Param - $label = $langs->trans($key); - print ''; - - // Value - print ''; -} +print "
' . $langs->trans('JournauxTresorerie') . '
'; - print ''; - print '
\n"; print '
'; print ''; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 3d06c7f28b6..6745b56daf1 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -11,10 +11,8 @@ MenuTools=Tools ConfigAccountingExpert=Configuration of the module accounting expert Journaux=Journals +JournalFinancial=Financial journals Exports=Exports -About=About -Contributors=Contributors -Investors=Investors Modelcsv=Model of export Selectmodelcsv=Select a model of export Modelcsv_normal=Classic export diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index 8c83a64fd84..afcb8456a5d 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -13,10 +13,8 @@ Export=Exportación ConfigAccountingExpert=Configuración del módulo contable Journaux=Diarios +JournalFinancial=Diarios Exports=Exportaciones -About=acerca de -Contributors=Colaboradores -Investors=Inversores Modelcsv=Plantilla de Exportación Selectmodelcsv=Seleccione una plantilla de exportación Modelcsv_normal=Exportación clásica diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 227915195eb..72c7475fd1d 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -11,10 +11,8 @@ MenuTools=Outils ConfigAccountingExpert=Configuration du module comptabilité expert Journaux=Journaux +JournalFinancial=Journaux de trésorerie Exports=Exports -About=A propos -Contributors=Contributeurs -Investors=Investisseurs Modelcsv=Modèle d'export Selectmodelcsv=Sélectionnez un modèle d'export Modelcsv_normal=Export classique From 1223be1e5b6fd6a5170e8fc746b883e0cac5f3df Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 8 Sep 2014 21:51:40 +0200 Subject: [PATCH 5/9] Move language key into admin.lang file --- htdocs/admin/index.php | 1 - htdocs/core/menus/standard/empty.php | 2 +- htdocs/langs/en_US/admin.lang | 2 ++ 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 043efc92059..bbedab346d1 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -25,7 +25,6 @@ require '../main.inc.php'; $langs->load("admin"); $langs->load("companies"); -$langs->load("accountancy"); if (!$user->admin) accessforbidden(); diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index d8b8d0f04cb..83f54c050d6 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -115,7 +115,6 @@ class MenuManager $this->menu->add("/admin/modules.php", $langs->trans("Modules"),1); $this->menu->add("/admin/menus.php", $langs->trans("Menus"),1); $this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1); - $this->menu->add("/accountancy/admin/account.php", $langs->trans("Chartofaccounts"),1); $this->menu->add("/admin/fiscalyear.php", $langs->trans("Fiscalyear"),1); $this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1); $this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1); @@ -125,6 +124,7 @@ class MenuManager $this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1); $this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1); $this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1); + if (! empty($conf->accounting->enabled)) $this->menu->add("/accountancy/admin/account.php", $langs->trans("Chartofaccounts"),1); $this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1); // ***** END ***** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c9eacc5a8eb..13003ea5cf3 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -45,6 +45,8 @@ ErrorModuleRequireDolibarrVersion=Error, this module requires Dolibarr version % ErrorDecimalLargerThanAreForbidden=Error, a precision higher than %s is not supported. DictionarySetup=Dictionary setup Dictionary=Dictionaries +Chartofaccounts=Chart of accounts +Fiscalyear=Fiscal years ErrorReservedTypeSystemSystemAuto=Value 'system' and 'systemauto' for type is reserved. You can use 'user' as value to add your own record ErrorCodeCantContainZero=Code can't contain value 0 DisableJavascript=Disable JavaScript and Ajax functions (Recommended for blind person or text browsers) From 8f818529a6f97700aa4c178912f748be19339831 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 9 Sep 2014 21:19:15 +0200 Subject: [PATCH 6/9] Remove right "accounting->access" & debug menu --- htdocs/core/menus/standard/eldy.lib.php | 12 ++++++------ htdocs/core/modules/modAccounting.class.php | 12 ++---------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index b45e76bee8c..85781a8dc91 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -870,15 +870,15 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/accountancy/supplier/index.php?leftmenu=ventil_supplier",$langs->trans("SuppliersVentilation"),0,$user->rights->accounting->ventilation->read, '', $mainmenu, 'ventil_supplier'); - if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); - if (empty($leftmenu) || $leftmenu=="ventil_customer") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); + if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/list.php",$langs->trans("ToDispatch"),1,$user->rights->accounting->ventilation->read); + if (empty($leftmenu) || $leftmenu=="ventil_supplier") $newmenu->add("/accountancy/supplier/lines.php",$langs->trans("Dispatched"),1,$user->rights->accounting->ventilation->read); } - $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookeeping'); - if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); - if (empty($leftmenu) || $leftmenu=="bookeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); + $newmenu->add("/accountancy/bookkeeping/list.php?leftmenu=bookkeeping",$langs->trans("Bookkeeping"),0,$user->rights->accounting->mouvements->lire, '', $mainmenu, 'bookkeeping'); + if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/listbyyear.php",$langs->trans("ByYear"),1,$user->rights->accounting->mouvements->lire); + if (empty($leftmenu) || $leftmenu=="bookkeeping") $newmenu->add("/accountancy/bookkeeping/balancebymonth.php.php",$langs->trans("AccountBalanceByMonth"),1,$user->rights->accounting->mouvements->lire); - $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->close, '', $mainmenu, 'fiscalyear'); + $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy", $langs->trans("Fiscalyear"),0,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); } // Rapports diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 8035a60284d..9a544b1ece0 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -182,15 +182,7 @@ class modAccounting extends DolibarrModules $this->rights = array(); // Permission array used by this module $r = 0; - $this->rights[$r][0] = 50401; // TODO Goal of this permission compared to others ??? - $this->rights[$r][1] = 'Access_accountancy'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'access'; - $this->rights[$r][5] = ''; - $r++; - - $this->rights[$r][0] = 50402; + $this->rights[$r][0] = 50401; $this->rights[$r][1] = 'Read ventilation'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; @@ -198,7 +190,7 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = 'read'; $r++; - $this->rights[$r][0] = 50403; + $this->rights[$r][0] = 50402; $this->rights[$r][1] = 'Dispatched ventilation'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; From 25b66e0491a3ef34d41b9eb98ef75ba09a5bbff1 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 9 Sep 2014 22:34:49 +0200 Subject: [PATCH 7/9] Add linkback into accountancy admin --- htdocs/accountancy/admin/export.php | 3 ++- htdocs/accountancy/admin/index.php | 3 ++- htdocs/accountancy/admin/journaux.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 448ce32cb18..c8b8c8a7d97 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -86,7 +86,8 @@ llxHeader(); $form = new Form($db); -print_fiche_titre($langs->trans('ConfigAccountingExpert')); +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup'); $head = admin_accounting_prepare_head(null); diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 9abd2899af4..66f5efef04d 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -146,7 +146,8 @@ llxHeader(); $form = new Form($db); -print_fiche_titre($langs->trans('ConfigAccountingExpert')); +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup'); $head = admin_accounting_prepare_head($accounting); diff --git a/htdocs/accountancy/admin/journaux.php b/htdocs/accountancy/admin/journaux.php index f9aea2242c5..77b7d15e1c3 100644 --- a/htdocs/accountancy/admin/journaux.php +++ b/htdocs/accountancy/admin/journaux.php @@ -80,7 +80,8 @@ llxHeader(); $form = new Form($db); -print_fiche_titre($langs->trans('ConfigAccountingExpert')); +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans('ConfigAccountingExpert'),$linkback,'setup'); $head = admin_accounting_prepare_head(null); From 4c52a6ee6f4c3ca4a4c5f78c3e9cadc7dd8f4343 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 10 Sep 2014 04:53:18 +0200 Subject: [PATCH 8/9] Add admin page into salaries to manage accountancy --- htdocs/admin/salaries.php | 118 ++++++++++++++++++++++ htdocs/core/modules/modSalaries.class.php | 13 ++- htdocs/langs/en_US/salaries.lang | 2 + 3 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 htdocs/admin/salaries.php diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php new file mode 100644 index 00000000000..453db8e4203 --- /dev/null +++ b/htdocs/admin/salaries.php @@ -0,0 +1,118 @@ + + * + * 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 . + * + */ + +/** + * \file htdocs/admin/salaries.php + * \ingroup Salaries + * \brief Setup page to configure salaries module + */ + +require '../main.inc.php'; + +// Class +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; + +$langs->load("admin"); +$langs->load("salaries"); + +// Security check +if (!$user->admin) + accessforbidden(); + +$action = GETPOST('action', 'alpha'); + +// Other parameters COMPTA_* & ACCOUNTING_* +$list = array ( + 'SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', + 'SALARIES_ACCOUNTING_ACCOUNT_CHARGE' +); + +/* + * Actions + */ + +if ($action == 'update') +{ + $error = 0; + + foreach ($list as $constname) { + $constvalue = GETPOST($constname, 'alpha'); + + if (!dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { + $error++; + } + } + + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } +} + +/* + * View + */ + +llxHeader(); + +$form = new Form($db); + +$linkback=''.$langs->trans("BackToModuleList").''; +print_fiche_titre($langs->trans('ConfigSalaries'),$linkback,'setup'); + +print '
'; +print ''; +print ''; + +/* + * Params + */ +print ''; +print ''; +print ''; +print "\n"; + +foreach ($list as $key) +{ + $var=!$var; + + print ''; + + // Param + $label = $langs->trans($key); + print ''; + + // Value + print ''; +} + +print ''; + +print ''; +print "
' . $langs->trans('Options') . '
'; + print ''; + print '
\n"; + +print '
'; + +llxFooter(); +$db->close(); \ No newline at end of file diff --git a/htdocs/core/modules/modSalaries.class.php b/htdocs/core/modules/modSalaries.class.php index f8a99b99aab..c82e3d83784 100644 --- a/htdocs/core/modules/modSalaries.class.php +++ b/htdocs/core/modules/modSalaries.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Alexandre Spangaro * * 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 @@ -66,7 +67,7 @@ class modSalaries extends DolibarrModules $this->dirs = array("/salaries/temp"); // Config pages - $this->config_page_url = array(); + $this->config_page_url = array('salaries.php'); // Dependances $this->depends = array(); @@ -76,6 +77,16 @@ class modSalaries extends DolibarrModules // Constants $this->const = array(); + $this->const[0] = array( + "SALARIES_ACCOUNTING_ACCOUNT_PAYMENT", + "chaine", + "421" + ); + $this->const[1] = array( + "SALARIES_ACCOUNTING_ACCOUNT_CHARGE", + "chaine", + "641" + ); // Boxes $this->boxes = array(); diff --git a/htdocs/langs/en_US/salaries.lang b/htdocs/langs/en_US/salaries.lang index edca71a1829..84eba6fc2bd 100644 --- a/htdocs/langs/en_US/salaries.lang +++ b/htdocs/langs/en_US/salaries.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - users +SALARIES_ACCOUNTING_ACCOUNT_PAYMENT=Accountancy code for salaries payments +SALARIES_ACCOUNTING_ACCOUNT_CHARGE=Accountancy code for financial charge Salary=Salary Salaries=Salaries Employee=Employee From 495a261bfda01c3eecfdb54771ef3ed20d6ffdc7 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Wed, 10 Sep 2014 20:47:27 +0200 Subject: [PATCH 9/9] Add special thanks to developpers & contributors of module accounting. --- ChangeLog | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 977ac4123ea..26c693fa486 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,7 +69,20 @@ For users: - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. New experimental module: -- New: Module Accounting Expert to manage accountancy +- New: Module Accounting Expert to manage accountancy + Special Thanks to developpers : + Olivier Geffroy + Alexandre Spangaro + Ari Elbaz + Florian Henry + Juanjo Menent + + And to the contributors : + Jeff Info 2000 euros + Nord Anim 120 euros + Hydroflex 120 euros + Asysteo 120 euros + Fournisseur médical 120 euros For translators: - Update language files.