noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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/*!
22 * \file
23 * \brief Search module
24 * \see javascript search_reconcile
25
26\param dossier_id int in $_GET dossier id needed to connect to the right folder
27\param ctlc in $_GET string of DOM ID that receives the result when operation is selected
28\param tiers in $_GET
29\param amount_id float in $_GET amount to search
30\param target in $_GET element to update
31\param hide_operation in $_GET
32\param single_operation in $_GET
33 */
34
35/**
36 * @var $op comes from $_GET['op'] , that is the parameter from ajax to select the action (route) to perform.
37 * @var $g_user type of Noalyss_User , connected user
38 */
39if (!defined('ALLOWED'))
40 die('Appel direct ne sont pas permis');
41require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
42
43global $http;
44$gDossier=dossier::id();
45
46/* Admin. Dossier */
47
48$cn=Dossier::connect();
49// display a search box
50
51
52$base=basename($_SERVER['PHP_SELF']);
53
54$inside=false;
55$tiers=$http->get("tiers", "string", "");
56// With the amount id, we find the amount in a html elt
57$http->set_empty(0);
58if (isset($_GET['amount_id']))
59{
60 put_global(array(
61 array("key"=>'amount_min', 'value'=>$http->get('amount_id',"number",0)),
62 array("key"=>'amount_max', 'value'=>$http->get('amount_id',"number",0))
63 ));
64}
65$target=$http->get("target", "string", "");
66$hide_operation=$http->get("hide_operation","string","");
67
69
70if ($base=='recherche.php'||$base=='do.php')
71{
72 echo '<div class="content" >';
73 echo '<form method="GET">';
74}
75else
76{
77 $action="";
79 echo HtmlInput::title_box(_('Recherche'), $target);
80 echo '<form name="search_form_ajx" id="search_form_ajx" onsubmit="search_operation(this);return false">';
81 echo HtmlInput::get_to_hidden(array('ctlc', 'ledger'));
82 echo HtmlInput::hidden("target", $target);
83 $inside=true;
84}
85echo HtmlInput::hidden("tiers", $tiers);
86echo $ledger->search_form();
87echo HtmlInput::submit("viewsearch", _("Recherche"));
89echo '</form>';
90
91if (isset($_GET['amount_min'])&&isset($_GET['amount_max'])&&($_GET['amount_max']!=0||$_GET['amount_min']!=0 ))
92{
93 $_GET['viewsearch']=1;
95 array
96 (
97 array('key'=>'ledger_type', 'value'=>'ALL')
98 )
99 );
100}
101//-----------------------------------------------------
102// Display search result, value from the search FORM
103//
104//-----------------------------------------------------
105if (isset($_GET['viewsearch']))
106{
107
108 // Navigation bar
110 $page=$http->get("page","number",1);
111 $offset=$http->get("offset","number",0);
112
113 if (count($_GET)==0)
114 $array=null;
115 else
117
118 $array['p_action']='ALL';
119 if (!isset($array['date_start'])||!isset($array['date_end']))
120 {
121 // get first date of current exercice
122 list($array['date_start'], $array['date_end'])=$g_user->get_limit_current_exercice();
123 }
124 $array['hide_operation']=$hide_operation;
125 $array['single_operation']=$http->get("single_operation");
126
127 list($sql, $where)=$ledger->build_search_sql($array);
128 // Count nb of line
129 $max_line=$cn->count_sql($sql);
130 $target=$http->get("target");
131 list($count, $content)=$ledger->list_operation_to_reconcile($sql, $target);
133
134 if (!$inside)
135 {
136 echo $bar;
137 }
138 else
139 {
140 if ($step<$max_line)
141 {
142 echo '<h2 class="notice">'._('Liste limitée à ').$step._(' enregistrements. Le nombre d\'enregistrements trouvés est de ').$max_line.'</h2>';
143 }
144 }
145 echo '<form method="get" onsubmit="set_reconcile(this);return false">';
146 echo HtmlInput::hidden("single_operation", $array['single_operation']);
147 echo HtmlInput::hidden("tiers", $tiers);
148 echo HtmlInput::submit("upd_rec", _("Mettre à jour"));
149 echo HtmlInput::get_to_hidden(array('ctlc', 'amount_id', 'ledger'));
150 echo HtmlInput::get_to_hidden(array('l', 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcodesearch_op',
151 'accounting', 'unpaid', 'gDossier', 'ledger_type'));
152 echo $content;
153 echo HtmlInput::submit("upd_rec", _("Mettre à jour"));
154 if (!$inside)
155 {
156 echo $bar;
157 }
158
159 if (isset($_GET[$op.'r_jrn']))
160 {
161 foreach ($_GET[$op.'r_jrn'] as $k=> $v) echo HtmlInput::hidden($op.'r_jrn['.$k.']', $v);
162 }
163 echo '</form>';
164}
165echo '</div>';
166?>
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
global $g_user
if no group available , then stop
$base
$op
_("actif, passif,charge,...")
$_GET['qcode']
static button_close($div_name, $class='smallbutton')
close button for the HTML popup
static hidden($p_name, $p_value, $p_id="")
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
const MAX_RECONCILE
Definition constant.php:146
$count
catch(\Exception $e) $bar
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)