From eaca582cb5364257dfa2403954071891004a22e5 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Sun, 7 Feb 2016 08:47:02 +0100 Subject: [PATCH] Fixed: Problem of merging - Review page init accountancy again --- htdocs/accountancy/admin/productaccount.php | 93 ++++++++++----------- htdocs/langs/en_US/accountancy.lang | 18 +++- 2 files changed, 56 insertions(+), 55 deletions(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 8f3e178b525..bb1ab366427 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -1,6 +1,6 @@ - - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -20,13 +20,14 @@ */ /** - * \file htdocs/accountancy/admin/productaccount.php + * \file htdocs/accountancy/admin/productaccount.php * \ingroup Accounting Expert - * \brief Onglet de gestion de parametrages des ventilations + * \brief To define accounting account on product / service */ require '../../main.inc.php'; // Class +require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php'; @@ -40,7 +41,11 @@ $langs->load("compta"); $langs->load("main"); $langs->load("accountancy"); -// search & action GETPOST +// Security check +if (!$user->admin) accessforbidden(); +if (empty($conf->accounting->enabled)) accessforbidden(); + +// Search & action GETPOST $action = GETPOST('action'); $codeventil_buy = GETPOST('codeventil_buy', 'array'); $codeventil_sell = GETPOST('codeventil_sell', 'array'); @@ -76,8 +81,8 @@ if (! $sortfield) $sortfield = "p.ref"; if (! $sortorder) $sortorder = "ASC"; - - // sales or purchase + +// Sales or Purchase mode ? if ($action == 'update') { if (! empty($btn_changetype)) { $error = 0; @@ -129,9 +134,9 @@ if ($action == 'update') { dol_syslog("/accountancy/admin/productaccount.php sql=" . $sql, LOG_DEBUG); if ($db->query($sql)) { - $msg .= '
' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . $monCompte . '
'; + $msg .= '
' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
'; } else { - $msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . $accounting->account_number . '
' . $sql . '
'; + $msg .= '
' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accounting->account_number) . '
' . $sql . '
'; } } @@ -144,13 +149,6 @@ if ($action == 'update') { } } -// Security check -if ($user->societe_id > 0) - accessforbidden(); - // TODO after adding menu - // if (! $user->rights->accounting->ventilation->dispatch) - // accessforbidden(); - $form = new FormVentilation($db); // Defaut AccountingAccount RowId Product / Service @@ -176,12 +174,11 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_desc = ''; } -// debug move header to top -llxHeader('', $langs->trans("Accounts")); - /* * View */ + +llxHeader('', $langs->trans("Accounts")); print '