noalyss Version-9
contact.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/**\brief include from client.inc.php and concerned only the contact card and
21 * the contact category
22 */
23
24if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
25
26global $g_user,$cn;
27
29
30$low_action = $http->request('sb','string','list');
31/**
32 * \file
33 * \brief Called from the module "Gestion" to manage the contact
34 */
35$href=basename($_SERVER['PHP_SELF']);
36
37// by default open liste
38if ($low_action == "")
39 $low_action = "list";
40
41
42//-----------------------------------------------------
43// Remove a card
44//-----------------------------------------------------
45if (isset($_POST['action_fiche']))
46{
47
48 if ( $_POST['action_fiche'] == 'delete_card')
49 {
50 if ( $g_user->check_action(FICADD) == 0 )
51 {
52 alert(_('Vous ne pouvez pas enlever de fiche'));
53 return;
54 }
55
56 $f_id = $http->request('f_id','number');
57
58 $fiche = new Contact($cn, $f_id);
59 $fiche->remove();
60 $low_action = "list";
61 }
62}
63
64//-----------------------------------------------------
65// list of contact
66//-----------------------------------------------------
67if ($low_action == "list")
68{
69 ?>
70 <div class="content">
71 <div>
72
73 <form method="get" action="<?php echo $href;?>">
74 <?php
75 echo dossier::hidden();
76 $a = $http->get("query","string","");
77 echo _("Cherche ").HtmlInput::filter_table_form("contact_tb", '0,1,2,3,4,5,6', 1,"query",$a);
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_CONTACT .
82 ' order by fd_label ', 1);
83 $sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
84 $sel_card->javascript = ' onchange="waiting_box();submit(this);"';
85
86 echo _('Catégorie :') . $sel_card->input();
87
88 $sl_company=new ISelect("sel_company");
89 $sl_company->value = $cn->make_array('select distinct ad_value,ad_value from fiche_detail as fd' .
90 ' join fiche as f1 on (f1.f_id=fd.f_id) join fiche_def as fdf on (f1.fd_id=fdf.fd_id)
91 where
92 ad_id='.ATTR_DEF_COMPANY. " and frd_id= ".FICHE_TYPE_CONTACT.
93 ' order by 1', 1);
94 $sl_company->selected = $http->get("sel_company","string","");
95 echo _('Société :') . $sl_company->input();
96
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 <p class="notice"><?=_("Si vous modifiez un contact, il faut recharger la page pour voir les changements")?></p>
102 </div>
103 <?php
104 $contact = new contact($cn);
105 $search =$http->get("query","string","");
106 $sql = "";
107 if (isset($_GET['cat']))
108 {
109 $cat=$http->get("cat","number");
110 $contact->filter_category($cat);
111 }
112 if (isset($_GET['sel_company']))
113 {
114 $sel_company=$http->get("sel_company");
115 $contact->filter_company($sel_company);
116 }
117 $contact->filter_active(true);
118 echo '<div class="content">';
119 echo $contact->Summary($search,"contact",$sql);
120
121
122 echo '<br>';
123 echo '<br>';
124 echo '<br>';
125 /* Add button */
126 $f_add_button = new IButton('add_card');
127 $f_add_button->label = _('Créer une nouvelle fiche');
128 $f_add_button->set_attribute('win_refresh', 'yes');
129 $f_add_button->set_attribute('type_cat', FICHE_TYPE_CONTACT);
130 $f_add_button->javascript = "select_card_type(this);";
131 echo $f_add_button->input();
132
133 $f_cat_button=new IButton('add_cat');
134 $f_cat_button->set_attribute('ipopup','ipop_cat');
135 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_CONTACT);
136 $f_cat_button->label=_('Ajout d\'une catégorie');
137 $f_cat_button->javascript='add_category(this)';
138 echo $f_cat_button->input();
139
140 echo '</div>';
141 echo '</div>';
142
143
144}
145/*----------------------------------------------------------------------
146 * Detail for a card, Suivi, Contact, Operation,... *
147 * cc stands for contact card
148 *----------------------------------------------------------------------*/
149if ( $low_action == 'detail')
150{
151 /* Menu */
152 require_once NOALYSS_INCLUDE.'/category_card.inc.php';
153 return;
154}
155
157?>
html_page_stop()
end tag
Definition: ac_common.php:468
p($p_string)
Definition: ac_common.php:39
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
$from_poste name
$input_from type
Definition: balance.inc.php:65
$_GET['qcode']
manage the http input (get , post, request) and extract from an array
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Class contact (customer, supplier...)
const ATTR_DEF_COMPANY
Definition: constant.php:230
const FICHE_TYPE_CONTACT
Definition: constant.php:251
const FICADD
$low_action
Definition: contact.inc.php:30
global $g_user
Definition: contact.inc.php:26
global $cn
Definition: contact.inc.php:26
$http
Definition: contact.inc.php:28
$href
Definition: contact.inc.php:35
$_POST['ac']
Definition: do.php:310