adm.inc.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta 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  *   PhpCompta 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 PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 4822 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 /*!\brief include from adm.inc.php and concerned only the customer card and
00022  * the customer category
00023  */
00024 require_once("class_iselect.php");
00025 require_once("class_ihidden.php");
00026 require_once("class_customer.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 require_once('class_admin.php');
00034 
00035 global $g_user;
00036 
00037 $low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
00038 /*! \file
00039  * \brief Called from the module "Gestion" to manage the customer
00040  */
00041 $href=basename($_SERVER['PHP_SELF']);
00042 
00043 // by default open liste
00044 if ( $low_action  == "" )
00045     $low_action="list";
00046 
00047 
00048 //-----------------------------------------------------
00049 // Remove a card
00050 //-----------------------------------------------------
00051 if ( isset($_POST['delete_card'] ) )
00052 {
00053     if ( $g_user->check_action(FICADD) == 0 )
00054     {
00055         alert('Vous  ne pouvez pas enlever de fiche');
00056         return;
00057     }
00058 
00059     $f_id=$_REQUEST['f_id'];
00060 
00061     $fiche=new Admin($cn,$f_id);
00062     $fiche->remove();
00063     $low_action="list";
00064 
00065 }
00066 
00067 //-----------------------------------------------------
00068 //    list of customer
00069 //-----------------------------------------------------
00070 if ( $low_action == "list" )
00071 {
00072 
00073     ?>
00074     <div class="content">
00075                            <div>
00076                                         <form method="get" action="<?php echo $href; ?>">
00077                                                                   <?php
00078                                                                   echo dossier::hidden();
00079     $a=(isset($_GET['query']))?$_GET['query']:"";
00080     printf (_('Recherche').' <input class="input_text" type="text" name="query" value="%s">',
00081             $a);
00082         echo HtmlInput::request_to_hidden(array('ac'));
00083     $sel_card=new ISelect('cat');
00084     $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
00085                                      ' where  frd_id='.FICHE_TYPE_ADM_TAX.
00086                                      ' order by fd_label ',1);
00087     $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
00088     $sel_card->javascript=' onchange="submit(this);"';
00089     echo _('Catégorie :').$sel_card->input();
00090 
00091     ?>
00092     <input type="submit" class="button" name="submit_query" value="<?=_('recherche')?>">
00093          <input type="hidden" name="p_action" value="adm">
00094                                                                      </form>
00095                                                                      </div>
00096                                                                      <?php
00097                                                                      $adm=new Admin($cn);
00098     $search=(isset($_GET['query']))?$_GET['query']:"";
00099     $sql="";
00100     if ( isset($_GET['cat']))
00101         {
00102         if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
00103     }
00104 
00105     echo '<div class="content">';
00106     echo $adm->Summary($search,'adm',$sql);
00107 
00108 
00109     echo '<br>';
00110     echo '<br>';
00111     echo '<br>';
00112         if  ($g_user->check_action(FICADD)==1)
00113         {
00114                 /* Add button */
00115                 $f_add_button=new IButton('add_card');
00116                 $f_add_button->label=_('Créer une nouvelle fiche');
00117                 $f_add_button->set_attribute('ipopup','ipop_newcard');
00118                 $f_add_button->set_attribute('win_refresh','yes');
00119 
00120                 $f_add_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
00121                 $f_add_button->javascript=" select_card_type(this);";
00122                 echo $f_add_button->input();
00123 
00124                 $f_cat_button=new IButton('add_cat');
00125                 $f_cat_button->set_attribute('ipopup','ipop_cat');
00126                 $f_cat_button->set_attribute('type_cat',FICHE_TYPE_ADM_TAX);
00127                 $f_cat_button->label=_('Ajout d\'une catégorie');
00128                 $f_cat_button->javascript='add_category(this)';
00129                 echo $f_cat_button->input();
00130         }
00131     echo '</div>';
00132     echo '</div>';
00133 
00134 
00135 }
00136 /*----------------------------------------------------------------------
00137  * Detail for a card, Suivi, Contact, Operation,... *
00138  * cc stands for customer card
00139  *----------------------------------------------------------------------*/
00140 if ( $low_action == 'detail')
00141 {
00142     /* Menu */
00143     require_once('category_card.inc.php');
00144     exit();
00145 }
00146 
00147 
00148 
00149 html_page_stop();
00150 ?>