From c1e77daeb1208e9c944e93725cbe5cbeb775f9ad Mon Sep 17 00:00:00 2001 From: aspangaro Date: Tue, 15 Dec 2015 20:48:06 +0100 Subject: [PATCH] New: Accountancy add a function to remove all zero at the right of the account. Thanks to Florian --- htdocs/core/lib/accounting.lib.php | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 0b1bfb8f4fc..502e83010f7 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -99,23 +99,9 @@ function accounting_prepare_head(AccountingAccount $object) */ function clean_account($account) { - global $conf; - - // Clean parameters - $i = strlen($account); - - if ($i >= 1) { - if (substr($account, -1) == 0) { - while ( $i >= 1 ) { - $account = substr($account, $i); - - $i --; - } - return $account; - } - } else { - return $account; - } + $account = rtrim($account,"0"); + + return $account; } /**