noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
recherche.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19// Copyright Author Dany De Bontridder danydb@aevalys.eu
20/*! \file
21 * \brief Search module
22 */
23define('ALLOWED',TRUE);
24require_once '../include/constant.php';
25require_once NOALYSS_INCLUDE.'/class/dossier.class.php';
26include_once NOALYSS_INCLUDE.'/lib/ac_common.php';
27require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
28require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php';
29require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php';
30require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
31MaintenanceMode("block.html");
32
33if ( ! isset ($_SESSION[SESSION_KEY.'g_theme']))
34{
35 echo "<h2>"._('Vous êtes déconnecté')."</h2>";
36 die();
37}
38
39html_page_start($_SESSION[SESSION_KEY.'g_theme']);
40
42
44
45$gDossier=dossier::id();
46
47require_once NOALYSS_INCLUDE.'/class/database.class.php';
48/* Admin. Dossier */
49
50$cn=Dossier::connect();
51include_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php';
52
53global $g_user;
54$g_user=new Noalyss_user($cn);
55$g_user->Check();
56/**
57 * check if 2FA is completed
58 */
59if ( ! $g_user->is_double_identified()) {
60 exit();
61}
62$act=$g_user->check_dossier($gDossier);
63// AC CODE = SEARCH
64if ($act =='P')
65{
66 redirect("extension.php?".dossier::get(),0);
67 exit();
68}
69if ( $act=='X')
70 {
71 alert(_('Accès interdit'));
72 exit();
73 }
74// display a search box
75?>
76<script>
77/**
78 * All the onload must be here otherwise the other will overwritten
79 * @returns {undefined}
80 */
81window.onload=function ()
82{
83 create_anchor_up();
84 init_scroll();
85 sorttable.init();
86}
87</script>
88<?php
90$search_box=$ledger->search_form();
91echo '<div class="content">';
92
93echo '<form method="GET">';
94echo $search_box;
95echo HtmlInput::submit("viewsearch",_("Recherche"));
96 $button_search=new IButton("button", _('Filtre'));
97$button_search->javascript=$ledger->build_search_filter();
98echo $button_search->input();
99?>
100<input type="button" class="smallbutton" onclick="window.close()" value="<?php echo _('Fermer')?>">
101
102<?php
103echo '</form>';
104
105//-----------------------------------------------------
106// Display search result
107//-----------------------------------------------------
108if ( isset ($_GET['viewsearch']))
109{
110
111 // Navigation bar
112 $step=$_SESSION[SESSION_KEY.'g_pagesize'];
113 $page=$http->get("page","number",1);
114 $offset=$http->get("offset","number",0);
115
116 if (count ($_GET) == 0)
117 $array=null;
118 else
120 $array['p_action']='ALL';
121 list($sql,$where)=$ledger->build_search_sql($array);
122 // Count nb of line
123 $max_line=$cn->count_sql($sql);
124
125 list($count,$a)=$ledger->list_operation($sql,$offset,0);
127
128 echo $bar;
129 echo $a;
130 echo $bar;
131 /*
132 * Export to csv
133 */
134 $r=HtmlInput::get_to_hidden(array('l','date_start','date_end','desc','amount_min','amount_max',
135 'qcode','accounting','unpaid','gDossier','ledger_type','tag_option'));
136 if (isset($_GET['r_jrn'])) {
137 $http=new HttpInput();
138 $a_rjrn=$http->get("r_jrn","array");
139 foreach ($a_rjrn as $k=>$v) {
140 // Protect : check that $k and $v are numeric
141 if (isNumber($k)&&isNumber($v)) {
142 $r.=HtmlInput::hidden('r_jrn['.$k.']',$v);
143 }
144 }
145 }
146 if (isset($_GET['tag'])) {
147 $http=new HttpInput();
148 $aTag=$http->get("tag","array");
149 foreach ($aTag as $k=>$v) {
150 // Protect : check that $k and $v are numeric
151 if (isNumber($k)&&isNumber($v)) {
152 $r.=HtmlInput::hidden('tag[]',$v);
153 }
154 }
155 }
156 echo '<form action="export.php" method="get">';
157 echo $r;
158 echo HtmlInput::hidden('act','CSV:histo');
159 echo HtmlInput::submit('viewsearch',_('Export vers CSV'));
160 echo HtmlInput::hidden('p_action','ALL');
161 ?>
162 <input type="button" class="smallbutton" onclick="window.close()" value="<?php echo _('Fermer')?>">
163
164<?php
165 echo '</form>';
166}
167echo '</div>';
168?>
isNumber($p_int)
MaintenanceMode($p_file)
When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the message ...
html_page_start($p_theme="", $p_script="", $p_script2="")
Default page header for each page.
alert($p_msg, $buffer=false)
alert in javascript
global $g_user
if no group available , then stop
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
_("actif, passif,charge,...")
$input_from type
$_GET['qcode']
manage the http input (get , post, request) and extract from an array
Html Input.
$count
for($e=0; $e< count($afiche); $e++) exit
load_all_script()
load all the javascript only one time
catch(\Exception $e) $bar
$search_box
Definition recherche.php:90
$button_search
Definition recherche.php:96
redirect( $p_string, $p_time=0)
redirect with javascript
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)