noalyss Version-9
ajax_search_operation.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21/*! \file
22 * \brief Search module
23 */
24if (!defined('ALLOWED'))
25 die('Appel direct ne sont pas permis');
26require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
27
28global $http;
30
31/* Admin. Dossier */
32
34// display a search box
35
36
37$base=basename($_SERVER['PHP_SELF']);
38$inside=false;
39$tiers=$http->get("tiers", "string", "");
40// With the amount id, we find the amount in a html elt
41$http->set_empty(0);
42if (isset($_GET['amount_id']))
43{
44 put_global(array(
45 array("key"=>'amount_min', 'value'=>$http->get('amount_id',"number",0)),
46 array("key"=>'amount_max', 'value'=>$http->get('amount_id',"number",0))
47 ));
48}
49$target=$http->get("target", "string", "");
50$hide_operation=$http->get("hide_operation","string","");
51
53
54if ($base=='recherche.php'||$base=='do.php')
55{
56 echo '<div class="content" >';
57 echo '<form method="GET">';
58}
59else
60{
61 $action="";
63 echo HtmlInput::title_box(_('Recherche'), $target);
64 echo '<form name="search_form_ajx" id="search_form_ajx" onsubmit="search_operation(this);return false">';
65 echo HtmlInput::get_to_hidden(array('ctlc', 'ledger'));
66 echo HtmlInput::hidden("target", $target);
67 $inside=true;
68}
69echo HtmlInput::hidden("tiers", $tiers);
70echo $ledger->search_form();
71echo HtmlInput::submit("viewsearch", _("Recherche"));
73echo '</form>';
74
75if (isset($_GET['amount_min'])&&isset($_GET['amount_max'])&&($_GET['amount_max']!=0||$_GET['amount_min']!=0 ))
76{
77 $_GET['viewsearch']=1;
79 array
80 (
81 array('key'=>'ledger_type', 'value'=>'ALL')
82 )
83 );
84}
85//-----------------------------------------------------
86// Display search result
87//-----------------------------------------------------
88if (isset($_GET['viewsearch']))
89{
90
91 // Navigation bar
93 $page=$http->get("page","number",1);
94 $offset=$http->get("offset","number",0);
95
96 if (count($_GET)==0)
97 $array=null;
98 else
100
101 $array['p_action']='ALL';
102 if (!isset($array['date_start'])||!isset($array['date_end']))
103 {
104 // get first date of current exercice
105 list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice();
106 }
107 $array['hide_operation']=$hide_operation;
108 $array['single_operation']=$http->get("single_operation");
109
110 list($sql, $where)=$ledger->build_search_sql($array);
111 // Count nb of line
112 $max_line=$cn->count_sql($sql);
113 $target=$http->get("target");
114 list($count, $content)=$ledger->list_operation_to_reconcile($sql, $target);
116
117 if (!$inside)
118 {
119 echo $bar;
120 }
121 else
122 {
123 if ($step<$max_line)
124 {
125 echo '<h2 class="notice">'._('Liste limitée à ').$step._(' enregistrements. Le nombre d\'enregistrements trouvés est de ').$max_line.'</h2>';
126 }
127 }
128 echo '<form method="get" onsubmit="set_reconcile(this);return false">';
129 echo HtmlInput::hidden("single_operation", $array['single_operation']);
130 echo HtmlInput::hidden("tiers", $tiers);
131 echo HtmlInput::submit("upd_rec", _("Mettre à jour"));
132 echo HtmlInput::get_to_hidden(array('ctlc', 'amount_id', 'ledger'));
133 echo HtmlInput::get_to_hidden(array('l', 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcodesearch_op',
134 'accounting', 'unpaid', 'gDossier', 'ledger_type'));
135 echo $content;
136 echo HtmlInput::submit("upd_rec", _("Mettre à jour"));
137 if (!$inside)
138 {
139 echo $bar;
140 }
141
142 if (isset($_GET[$op.'r_jrn']))
143 {
144 foreach ($_GET[$op.'r_jrn'] as $k=> $v) echo HtmlInput::hidden($op.'r_jrn['.$k.']', $v);
145 }
146 echo '</form>';
147}
148echo '</div>';
149?>
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
Definition: ac_common.php:1233
global $g_user
if no group available , then stop
$action
$op
Definition: ajax_admin.php:38
global $http
if(isset($_GET['amount_id'])) $target
$input_from id
Definition: balance.inc.php:63
$_GET['qcode']
static connect()
static button_close($div_name, $class='smallbutton')
close button for the HTML popup
static hidden($p_name, $p_value, $p_id="")
static title_box($p_name, $p_div, $p_mod="close", $p_js="", $p_draggable="n", $p_enlarge='n')
Title for boxes, you can customize the symbol thanks symbol with the mode "custom".
static get_to_hidden($array)
transform $_GET data to hidden
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
const MAX_RECONCILE
Definition: constant.php:142
$count
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)
Definition: user_common.php:76
$content
Definition: xml.php:17