noalyss Version-9
supplier.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') ) die('Appel direct ne sont pas permis');
25
26$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
27/*! \file
28 * \brief Called from the module "Gestion" to manage the supplier
29 */
30$href=basename($_SERVER['PHP_SELF']);
31
32// by default open liste
33if ( $low_action == "" )
34 $low_action="list";
35
36
37//-----------------------------------------------------
38// Remove a card
39//-----------------------------------------------------
40if ( isset($_POST['action_fiche'] ) )
41{
42 if ( $_POST['action_fiche'] == 'delete_card')
43 {
44 if ( $g_user->check_action(FICADD) == 0 )
45 {
46 alert(_('Vous ne pouvez pas enlever de fiche'));
47 return;
48 }
49
50 $f_id = $http->request('f_id','number');
51
53 $fiche->remove();
54 $low_action="list";
55 }
56}
57
58//-----------------------------------------------------
59// list of supplier
60//-----------------------------------------------------
61if ( $low_action == "list" )
62{
63 $search=$http->get("query","string","");
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 echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$search);
73
74 $choice_cat=$http->request("choice_cat", "string",1);
75 if ( $choice_cat == 1 )
76 {
77 $sel_card=new ISelect('cat');
78 $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
79 ' where frd_id='.FICHE_TYPE_FOURNISSEUR.
80 ' order by fd_label ',1);
81 $sel_card->selected=$http->get("cat","number",-1);
82 $sel_card->javascript=' onchange="waiting_box();submit(this);"';
83 echo _('Catégorie :').$sel_card->input();
84 } else
85 {
86 $cat=$http->request('cat','string', '');
87 echo HtmlInput::hidden("cat",$cat);
88 echo HtmlInput::hidden('choice_cat', 0);
89 }
90 $nooperation=new ICheckBox('noop');
91 $nooperation->selected=(isset($_GET['noop']))?true:false;
92 echo _('Inclure les fournisseurs sans opération :').$nooperation->input();
93
94 ?>
95 <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
96 <input type="hidden" name="ac" value="<?php echo $http->request('ac')?>">
97 </form>
98 </div>
99 <?php
101 $sql="";
102 if (isset($_GET['cat']))
103 {
104 $cat=$http->get("cat","number");
105 if ($cat!= -1)
106 $sql = sprintf(" and fd_id = %s", $cat);
107 }
108 $noop=(isset($_GET['noop']))?false:true;
109
110 echo '<div class="content">';
111 echo $supplier->Summary($search,'supplier',$sql,$noop);
112
113
114 echo '<br>';
115 echo '<br>';
116 echo '<br>';
117 if ($g_user->check_action(FICADD)==1)
118 {
119 /* Add button */
120 $f_add_button=new IButton('add_card');
121 $f_add_button->label=_('Créer une nouvelle fiche');
122 $f_add_button->set_attribute('win_refresh','yes');
123
124 $f_add_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
125 $f_add_button->javascript=" select_card_type(this);";
126 echo $f_add_button->input();
127
128 $f_cat_button=new IButton('add_cat');
129 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
130 $f_cat_button->set_attribute('ipopup','ipop_cat');
131 $f_cat_button->label=_('Ajout d\'une catégorie');
132 $f_cat_button->javascript='add_category(this)';
133 echo $f_cat_button->input();
134 }
135
136 echo '</div>';
137 echo '</div>';
138
139
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 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_FOURNISSEUR
Definition: constant.php:249
const FICADD
$_POST['ac']
Definition: do.php:310
$low_action
global $http
global $g_user
$href