noalyss Version-9
customer.inc.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/**
21 * \file
22 * \brief include from and concerned only the customer card and
23 * the customer category
24 */
25if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
27
28
29$low_action = $http->request("sb","string","list");
30/** \file
31 * \brief Called from the module "Gestion" to manage the customer
32 */
33$href=basename($_SERVER['PHP_SELF']);
34
35// by default open liste
36if ($low_action == "")
37 $low_action = "list";
38
39
40//-----------------------------------------------------
41// Remove a card
42//-----------------------------------------------------
43if (isset($_POST['action_fiche']))
44{
45 if ( $_POST['action_fiche'] == 'delete_card')
46 {
47 if ($g_user->check_action(FICADD) == 0)
48 {
49 alert(j(_('Vous ne pouvez pas enlever de fiche')));
50 return;
51 }
52
53 $f_id = $http->request('f_id',"number");
54
55 $fiche = new Customer($cn, $f_id);
56 $fiche->remove();
57 $low_action = "list";
58 }
59}
60
61//-----------------------------------------------------
62// list of customer
63//-----------------------------------------------------
64if ($low_action == "list")
65{
66 ?>
67 <div class="content">
68 <div>
69 <form method="get" action="<?php echo $href;?>">
70 <?php
71 echo '<h2>' . "Exercice " . $g_user->get_exercice() . '</h2>';
72 $a=$http->get("query","string","");
73 echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a);
74
75 $choice_cat=$http->request("choice_cat", "string",1);
76
77 if ( $choice_cat == 1 )
78 {
79 $sel_card=new ISelect('cat');
80 $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
81 ' where frd_id='.FICHE_TYPE_CLIENT.
82 ' order by fd_label ',1);
83 $sel_card->selected=$http->get("cat","number",-1);
84 $sel_card->javascript=' onchange="waiting_box();submit(this);"';
85 echo _('Catégorie :').$sel_card->input();
86 } else
87 {
88 $cat=$http->request('cat',"string", '');
89 echo HtmlInput::hidden("cat",$cat);
90 echo HtmlInput::hidden('choice_cat', 0);
91 }
92 $nooperation = new ICheckBox('noop');
93 $nooperation->selected = (isset($_GET['noop'])) ? true : false;
94 echo Dossier::hidden();
95
96 echo _('Inclure les clients sans opération :') . $nooperation->input();
97 ?>
98 <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
99 <input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
100 </form>
101 </div>
102 <?php
103 $client = new Customer($cn);
104 $search=$http->get("query","string","");
105 $sql = "";
106 if (isset($_GET['cat']))
107 {
108 $cat=$http->get("cat","number");
109 if ($cat!= -1)
110 $sql = sprintf(" and fd_id = %s", $cat);
111 }
112 $noop = (isset($_GET['noop'])) ? false : true;
113 echo '<div class="content">';
114 echo $client->Summary($search, 'customer', $sql, $noop);
115
116
117 echo '<br>';
118 echo '<br>';
119 echo '<br>';
120 /* Add button */
121 $f_add_button = new IButton('add_card');
122 $f_add_button->class="smallbutton";
123 $f_add_button->label = _('Créer une nouvelle fiche');
124 $f_add_button->set_attribute('ipopup', 'ipop_newcard');
125 $f_add_button->set_attribute('win_refresh', 'yes');
126// $list=$cn->make_list("select fd_id from fiche_def where frd_id=$1",array(FICHE_TYPE_CLIENT));
127 $f_add_button->set_attribute('type_cat', FICHE_TYPE_CLIENT);
128 $f_add_button->javascript = " select_card_type(this);";
129 echo $f_add_button->input();
130
131 $f_cat_button=new IButton('add_cat');
132 $f_cat_button->set_attribute('ipopup','ipop_cat');
133 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_CLIENT);
134 $f_cat_button->label=_('Ajout d\'une catégorie');
135 $f_cat_button->javascript='add_category(this)';
136 echo $f_cat_button->input();
137
138 echo '</div>';
139 echo '</div>';
140
141
142}
143/*----------------------------------------------------------------------
144 * Detail for a card, Suivi, Contact, Operation,... *
145 * cc stands for customer card
146 *----------------------------------------------------------------------*/
147if ( $low_action == 'detail')
148{
149 /* Menu */
150 require_once NOALYSS_INCLUDE.'/category_card.inc.php';
151 return;
152}
153
155?>
html_page_stop()
end tag
Definition: ac_common.php:468
j($p_string)
escape correctly php string to javascript
Definition: ac_common.php:96
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
global $g_user
if no group available , then stop
$from_poste name
$input_from type
Definition: balance.inc.php:65
$_GET['qcode']
class Customer are a specific kind of card
static hidden()
return a string to set gDossier into a FORM
static hidden($p_name, $p_value, $p_id="")
manage the http input (get , post, request) and extract from an array
Html Input.
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
const FICHE_TYPE_CLIENT
Definition: constant.php:247
const FICADD
$low_action
$http
$href
$_POST['ac']
Definition: do.php:310