diff --git a/htdocs/accountancy/class/html.formventilation.class.php b/htdocs/accountancy/class/html.formventilation.class.php
index abd66a7885d..a596d481d9c 100644
--- a/htdocs/accountancy/class/html.formventilation.class.php
+++ b/htdocs/accountancy/class/html.formventilation.class.php
@@ -2,6 +2,7 @@
/* Copyright (C) 2013-2014 Florian Henry
* Copyright (C) 2013-2014 Olivier Geffroy
* Copyright (C) 2013-2014 Alexandre Spangaro
+ * Copyright (C) 2015 Ari Elbaz (elarifr)
*
* 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
@@ -91,10 +92,13 @@ class FormVentilation extends Form
* @param string $htmlname Name of field in html form
* @param int $showempty Add an empty field
* @param array $event Event options
+ * @param int $select_in $selectid value is a aa.rowid (0 default) or aa.account_number (1)
+ * @param int $select_out set value returned by select 0=rowid (default), 1=account_number
+ * @param int $aabase set accountingaccount base class to display empty=all or from 1 to 8 will display only account beginning by
*
* @return string String with HTML select
*/
- function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array())
+ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $aabase = '')
{
global $conf;
@@ -116,21 +120,26 @@ class FormVentilation extends Form
if ($showempty)
$out .= '';
$num = $this->db->num_rows($resql);
+ $trunclength = defined('ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT') ? $conf->global->ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT : '50';
$i = 0;
if ($num) {
while ( $i < $num ) {
$obj = $this->db->fetch_object($resql);
$label = $obj->account_number . ' - ' . $obj->label;
-
+ $label = dol_trunc($label, $trunclength);
+ if ($select_in == 0 ) $select_value_in = $obj->rowid;
+ if ($select_in == 1 ) $select_value_in = $obj->account_number;
+ if ($select_out == 0 ) $select_value_out = $obj->rowid;
+ if ($select_out == 1 ) $select_value_out = $obj->account_number;
// Remember guy's we store in database llx_facturedet the rowid of accountingaccount and not the account_number
// Because same account_number can be share between different accounting_system and do have the same meaning
- if (($selectid != '') && $selectid == $obj->rowid) {
+ if (($selectid != '') && $selectid == $select_value_in) {
// $out .= '';
- $out .= '';
+ $out .= '';
} else {
// $out .= '';
- $out .= '';
+ $out .= '';
}
$i ++;
}