Code rewrite : move the function HtmlInput::select_ledger into Acc_Ledger_Search::select_ledger
This commit is contained in:
parent
17e0dbd94f
commit
8cd083ccd0
3 changed files with 70 additions and 68 deletions
|
|
@ -358,71 +358,7 @@ class HtmlInput
|
|||
return $view_history;
|
||||
}
|
||||
|
||||
/**
|
||||
* return the html code to create an hidden div and a button
|
||||
* to show this DIV. This contains all the available ledgers
|
||||
* for the user in READ or RW
|
||||
*@param $selected is an array of checkbox
|
||||
*@param $div div suffix
|
||||
*@note the choosen ledger are stored in the array r_jrn (_GET)
|
||||
*/
|
||||
static function select_ledger($p_type,$p_selected,$div='')
|
||||
{
|
||||
global $g_user;
|
||||
$r = '';
|
||||
/* security : filter ledger on user */
|
||||
$p_array = $g_user->get_ledger($p_type, 3);
|
||||
|
||||
ob_start();
|
||||
|
||||
|
||||
/* create a hidden div for the ledger */
|
||||
echo '<div id="div_jrn'.$div.'" >';
|
||||
echo HtmlInput::title_box(_("Journaux"), $div."jrn_search");
|
||||
echo '<div style="padding:5px">';
|
||||
echo '<form method="GET" id="'.$div.'search_frm" onsubmit="return hide_ledger_choice(\''.$div.'search_frm\')">';
|
||||
echo HtmlInput::hidden('nb_jrn', count($p_array));
|
||||
echo _('Filtre ').HtmlInput::filter_table($div.'tb_jrn', '0,1,2', 2);
|
||||
echo '<table class="result" id="'.$div.'tb_jrn">';
|
||||
echo '<tr>';
|
||||
echo th(_('Nom'));
|
||||
echo th(_('Description'));
|
||||
echo th(_('Type'));
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
echo HtmlInput::button('sel_'.$div,_('Inverser la sélection'),' onclick = "toggle_checkbox(\''."{$div}search_frm".'\')"');
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
for ($e=0;$e<count($p_array);$e++)
|
||||
{
|
||||
$row=$p_array[$e];
|
||||
$r=new ICheckBox($div.'r_jrn'.$e,$row['jrn_def_id']);
|
||||
$idx=$row['jrn_def_id'];
|
||||
if ( $p_selected != null && in_array($row['jrn_def_id'],$p_selected))
|
||||
{
|
||||
$r->selected=true;
|
||||
}
|
||||
$class=($e%2==0)?' class="even" ':' class="odd" ';
|
||||
echo '<tr '.$class.'>';
|
||||
echo '<td style="white-space: nowrap">'.$r->input().$row['jrn_def_name'].'</td>';
|
||||
echo '<td >'.$row['jrn_def_description'].'</td>';
|
||||
echo '<td >'.$row['jrn_def_type'].'</td>';
|
||||
echo '</tr>';
|
||||
|
||||
}
|
||||
echo '</table>';
|
||||
echo HtmlInput::hidden('div',$div);
|
||||
echo HtmlInput::submit('save',_('Valider'));
|
||||
echo HtmlInput::button_close($div."jrn_search");
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
|
||||
$ret=ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*create a hidden plus button to select the cat of ledger
|
||||
*@note the selected value is stored in the array p_cat
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue