noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
supplier.inc.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00020 /*!\brief include from supplier.inc.php and concerned only the supplier card and
00021  * the supplier category
00022  */
00023 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00024 require_once("class_iselect.php");
00025 require_once("class_ihidden.php");
00026 require_once("class_supplier.php");
00027 require_once("class_ibutton.php");
00028 require_once('class_iaction.php');
00029 require_once('class_fiche_def.php');
00030 require_once('class_iaction.php');
00031 require_once('class_fiche_def.php');
00032 require_once('class_ipopup.php');
00033 global $g_user;
00034 
00035 $low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
00036 /*! \file
00037  * \brief Called from the module "Gestion" to manage the supplier
00038  */
00039 $href=basename($_SERVER['PHP_SELF']);
00040 
00041 // by default open liste
00042 if ( $low_action  == "" )
00043     $low_action="list";
00044 
00045 
00046 //-----------------------------------------------------
00047 // Remove a card
00048 //-----------------------------------------------------
00049 if ( isset($_POST['delete_card'] ) )
00050 {
00051     if ( $g_user->check_action(FICADD) == 0 )
00052     {
00053         alert('Vous  ne pouvez pas enlever de fiche');
00054         return;
00055     }
00056 
00057     $f_id=$_REQUEST['f_id'];
00058 
00059     $fiche=new Supplier($cn,$f_id);
00060     $fiche->remove();
00061     $low_action="list";
00062 
00063 }
00064 
00065 //-----------------------------------------------------
00066 //    list of supplier
00067 //-----------------------------------------------------
00068 if ( $low_action == "list" )
00069 {
00070 
00071     ?>
00072     <div class="content">
00073                            <div>
00074                                         <form method="get" action="<?php echo $href; ?>">
00075         <?php
00076         echo '<h2>' . "Exercice " . $g_user->get_exercice() . '</h2>';
00077         echo dossier::hidden();
00078     $a=(isset($_GET['query']))?$_GET['query']:"";
00079     printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
00080             $a);
00081     $sel_card=new ISelect('cat');
00082     $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
00083                                      ' where  frd_id='.FICHE_TYPE_FOURNISSEUR.
00084                                      ' order by fd_label ',1);
00085     $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
00086     $sel_card->javascript=' onchange="submit(this);"';
00087     echo _('Catégorie :').$sel_card->input();
00088     $nooperation=new ICheckBox('noop');
00089     $nooperation->selected=(isset($_GET['noop']))?true:false;
00090     echo _('Inclure les fournisseurs sans opération :').$nooperation->input();
00091 
00092     ?>
00093     <input type="submit" class="button" name="submit_query" value="<?php echo _('recherche')?>">
00094                                            <input type="hidden" name="ac" value="<?php echo $_REQUEST['ac']?>">
00095                                                                      </form>
00096                                                                      </div>
00097                                                                      <?php
00098                                                                      $supplier=new Supplier($cn);
00099     $search=(isset($_GET['query']))?$_GET['query']:"";
00100     $sql="";
00101     if ( isset($_GET['cat']))
00102 {
00103         if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
00104     }
00105     $noop=(isset($_GET['noop']))?false:true;
00106 
00107     echo '<div class="content">';
00108     echo $supplier->Summary($search,'supplier',$sql,$noop);
00109 
00110 
00111     echo '<br>';
00112     echo '<br>';
00113     echo '<br>';
00114         if  ($g_user->check_action(FICADD)==1)
00115         {
00116                 /* Add button */
00117                 $f_add_button=new IButton('add_card');
00118                 $f_add_button->label=_('Créer une nouvelle fiche');
00119                 $f_add_button->set_attribute('win_refresh','yes');
00120 
00121                 $f_add_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
00122                 $f_add_button->javascript=" select_card_type(this);";
00123                 echo $f_add_button->input();
00124 
00125                 $f_cat_button=new IButton('add_cat');
00126                 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_FOURNISSEUR);
00127                 $f_cat_button->set_attribute('ipopup','ipop_cat');
00128                 $f_cat_button->label=_('Ajout d\'une catégorie');
00129                 $f_cat_button->javascript='add_category(this)';
00130                 echo $f_cat_button->input();
00131         }
00132 
00133     echo '</div>';
00134     echo '</div>';
00135 
00136 
00137 }
00138 /*----------------------------------------------------------------------
00139  * Detail for a card, Suivi, Contact, Operation,... *
00140  * cc stands for supplier card
00141  *----------------------------------------------------------------------*/
00142 if ( $low_action == 'detail')
00143 {
00144     /* Menu */
00145     require_once('category_card.inc.php');
00146     exit();
00147 }
00148 
00149 
00150 
00151 html_page_stop();
00152 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations