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