From 98a46fd335221f55d7f52012752b0737b6ead828 Mon Sep 17 00:00:00 2001 From: aspangaro Date: Mon, 28 Mar 2016 08:21:02 +0200 Subject: [PATCH] NEW: Accountancy Use clean_account to remove 0 at the right when we create an account in chart of accounts --- htdocs/accountancy/admin/card.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 7810ad4f3ef..c07c1f6b301 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,6 +1,6 @@ - - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -18,9 +18,9 @@ */ /** - * \file htdocs/accountancy/admin/card.php - * \ingroup Accounting Expert - * \brief Card accounting account + * \file htdocs/accountancy/admin/card.php + * \ingroup Advanced accountancy + * \brief Card of accounting account */ require '../../main.inc.php'; @@ -55,11 +55,14 @@ if ($action == 'add') { dol_syslog('accountancy/admin/card.php:: $sql=' . $sql); $result = $db->query($sql); $obj = $db->fetch_object($result); + + // Clean code + $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right $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'); + $accounting->account_number = $account_number; $accounting->account_parent = GETPOST('account_parent', 'int'); $accounting->label = GETPOST('label', 'alpha'); $accounting->active = 1; @@ -89,10 +92,13 @@ if ($action == 'add') { $result2 = $db->query($sql); $obj = $db->fetch_object($result2); + // Clean code + $account_number = clean_account(GETPOST('account_number')); // Accounting account without zero on the right + $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'); + $accounting->account_number = $account_number; $accounting->account_parent = GETPOST('account_parent', 'int'); $accounting->label = GETPOST('label', 'alpha');