[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 213/219: Code rewrite : move the function Htm
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 213/219: Code rewrite : move the function HtmlInput::select_ledger into Acc_Ledger_Search::select_ledger |
Date: |
Mon, 18 Dec 2017 13:23:04 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 8cd083ccd0ee98c8c0d28816918a26b69d10f9ac
Author: Dany De Bontridder <address@hidden>
Date: Sat Dec 16 10:27:01 2017 +0100
Code rewrite : move the function HtmlInput::select_ledger into
Acc_Ledger_Search::select_ledger
---
include/ajax/ajax_ledger_show.php | 5 ++-
include/class/acc_ledger_search.class.php | 67 ++++++++++++++++++++++++++++++-
include/lib/html_input.class.php | 66 +-----------------------------
3 files changed, 70 insertions(+), 68 deletions(-)
diff --git a/include/ajax/ajax_ledger_show.php
b/include/ajax/ajax_ledger_show.php
index 2557270..efaa80d 100644
--- a/include/ajax/ajax_ledger_show.php
+++ b/include/ajax/ajax_ledger_show.php
@@ -14,12 +14,13 @@
*/
if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
+require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
if ( ! isset ($r_jrn)) { $r_jrn=null;}
$ctl='div_jrn'.$div;
ob_start();
-echo HtmlInput::select_ledger($type,$r_jrn, $div);
+$ledger=new Acc_Ledger_Search($type,1,$ctl);
+echo $ledger->select_ledger($r_jrn,$div);
$response = ob_get_clean();
$html = escape_xml($response);
diff --git a/include/class/acc_ledger_search.class.php
b/include/class/acc_ledger_search.class.php
index c739bba..cd84656 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -241,7 +241,7 @@ class Acc_Ledger_Search
* - 1 means all the ledger of this type
* - 0 No have the "Tous les journaux" availables
*/
- private function build_search_filter()
+ function build_search_filter()
{
$json=json_encode(["div"=>$this->div, "ledger_type"=>$this->type,
"all_type"=>$this->all,
"dossier"=>Dossier::id()]);
@@ -1047,5 +1047,70 @@ class Acc_Ledger_Search
$r.='</table>';
return array($count, $r);
}
+ /**
+ * 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
+ address@hidden $p_selected is an array of checkbox
+ address@hidden $p_div div suffix for the list of ledgers
+ address@hidden the choosen ledger are stored in the array r_jrn (_GET)
+ */
+ function select_ledger($p_selected,$p_div)
+ {
+ global $g_user;
+ $r = '';
+ /* security : filter ledger on user */
+ $p_array = $g_user->get_ledger($this->type, 3);
+
+ ob_start();
+
+
+ /* create a hidden div for the ledger */
+ echo '<div id="div_jrn'.$p_div.'" >';
+ echo HtmlInput::title_box(_("Journaux"), $p_div."jrn_search");
+ echo '<div style="padding:5px">';
+ echo '<form method="GET" id="'.$p_div.'search_frm" onsubmit="return
hide_ledger_choice(\''.$p_div.'search_frm\')">';
+ echo HtmlInput::hidden('nb_jrn', count($p_array));
+ echo _('Filtre ').HtmlInput::filter_table($p_div.'tb_jrn', '0,1,2', 2);
+ echo '<table class="result" id="'.$p_div.'tb_jrn">';
+ echo '<tr>';
+ echo th(_('Nom'));
+ echo th(_('Description'));
+ echo th(_('Type'));
+ echo '</tr>';
+ echo '<tr>';
+ echo '<td>';
+ echo HtmlInput::button('sel_'.$p_div,_('Inverser la sélection'),'
onclick = "toggle_checkbox(\''."{$p_div}search_frm".'\')"');
+ echo '</td>';
+ echo '</tr>';
+ for ($e=0;$e<count($p_array);$e++)
+ {
+ $row=$p_array[$e];
+ $r=new ICheckBox($p_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',$p_div);
+ echo HtmlInput::submit('save',_('Valider'));
+ echo HtmlInput::button_close($p_div."jrn_search");
+ echo '</form>';
+ echo '</div>';
+ echo '</div>';
+
+ $ret=ob_get_contents();
+ ob_end_clean();
+ return $ret;
+ }
}
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index a153306..18909af 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -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
- address@hidden $selected is an array of checkbox
- address@hidden $div div suffix
- address@hidden 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
address@hidden the selected value is stored in the array p_cat
- [Noalyss-commit] [noalyss] 151/219: HttpInput: Exception if the type is not known, correct the use of numeric instead of number, (continued)
- [Noalyss-commit] [noalyss] 151/219: HttpInput: Exception if the type is not known, correct the use of numeric instead of number, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 218/219: Task #1506 : improve error message when adding a card, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 214/219: Esthetic CSS : add cursor pointer, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 210/219: Task #1381 Favori de filtre dans recherche, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 205/219: Accounting : error message if accounting is too large # Conflicts: # html/js/card.js, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 194/219: Select_box : fix position, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 176/219: Change autocomplete and adapt Icard setWidth is false + indicator icon for ICard, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 202/219: ManageTable.js : change Manage.delete by Manage.remove, because delete is a reserved keyword, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 181/219: Fix ID problem, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 163/219: Code cleaning, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 213/219: Code rewrite : move the function HtmlInput::select_ledger into Acc_Ledger_Search::select_ledger,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 197/219: Task #001381 : enlève , ajout de la nouvelle liste dans la liste, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 183/219: Icon move / fix, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 211/219: Bug : in recherche the ledger choice is transparent, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 162/219: Constant add an exception code for duplicate, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 190/219: Database : get_value throw an error if SQL failed, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 30/219: Task #0001443: opérations rapprochées : bug quand on utilise des tva avec autoliquidation 1. Correct export CSV 2. Improve code : new function Acc_Reconciliation:get_amount_noautovat, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 133/219: #0001414: LETTRAGE - montants différents non indiqués Les montants différents pour un lettrage sont marqués avec un triangle orange Changement des requêtes SQL , peut avoir un prob. de performance pour gros volume, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 70/219: Task #0001475: VEN / ACH opération prédéfinie , il manque le bouton "Fermer", Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 131/219: Bug : correct catch clause , getMessage is wrong must be replaced by message, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 203/219: Task #0001507: Click sur détail opérations apparaît trop haut Fixed for IE8 : use documentElement.scrollTop, Dany De Bontridder, 2017/12/18