noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
contact.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 client.inc.php and concerned only the contact card and
00021  * the contact 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_contact.php");
00027 require_once("class_ibutton.php");
00028 require_once('class_fiche_def.php');
00029 
00030 
00031 
00032 $low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
00033 /** \file
00034  * \brief Called from the module "Gestion" to manage the contact
00035  */
00036 $href=basename($_SERVER['PHP_SELF']);
00037 
00038 // by default open liste
00039 if ($low_action == "")
00040     $low_action = "list";
00041 
00042 
00043 //-----------------------------------------------------
00044 // Remove a card
00045 //-----------------------------------------------------
00046 if (isset($_POST['delete_card']))
00047 {
00048     if ($g_user->check_action(FICADD) == 0)
00049     {
00050         alert(j(_('Vous  ne pouvez pas enlever de fiche')));
00051         return;
00052     }
00053 
00054     $f_id = $_REQUEST['f_id'];
00055 
00056     $fiche = new Contact($cn, $f_id);
00057     $fiche->remove();
00058     $low_action = "list";
00059 }
00060 
00061 //-----------------------------------------------------
00062 //    list of contact
00063 //-----------------------------------------------------
00064 if ($low_action == "list")
00065 {
00066     ?>
00067     <div class="content">
00068         <div>
00069         <form method="get" action="<?php echo $href;?>">
00070                 <?php
00071                 echo dossier::hidden();
00072                 $a = (isset($_GET['query'])) ? $_GET['query'] : "";
00073                 printf(_('Recherche') . HtmlInput::filter_table("contact_tb", "0,1,2,3,4,5,6", 1));
00074                 $sel_card = new ISelect('cat');
00075                 $sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def ' .
00076                         ' where  frd_id=' . FICHE_TYPE_CONTACT .
00077                         ' order by fd_label ', 1);
00078                 $sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
00079                 $sel_card->javascript = ' onchange="submit(this);"';
00080 
00081                 echo _('Catégorie :') . $sel_card->input();
00082 
00083                 $sl_company=new ISelect("sel_company");
00084                 $sl_company->value = $cn->make_array('select distinct ad_value,ad_value from fiche_detail as fd' .
00085                         ' join fiche as f1 on (f1.f_id=fd.f_id) join fiche_def as fdf on (f1.fd_id=fdf.fd_id)
00086                                 where
00087                                 ad_id='.ATTR_DEF_COMPANY. " and frd_id= ".FICHE_TYPE_CONTACT.
00088                         ' order by 1', 1);
00089                 $sl_company->selected = (isset($_GET['sel_company'])) ? $_GET['sel_company'] : '';
00090                 echo _('Société :') . $sl_company->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         $client = new contact($cn);
00099         $search = (isset($_GET['query'])) ? $_GET['query'] : "";
00100         $sql = "";
00101         if (isset($_GET['cat']))
00102         {
00103             if ($_GET['cat'] != -1)
00104                 $sql = sprintf(" and fd_id = %d", $_GET['cat']);
00105         }
00106         if (isset($_GET['sel_company']))
00107         {
00108             if ($_GET['sel_company'] != '' && $_GET['sel_company'] != -1)
00109                 {
00110 
00111                         $client->company=$_GET['sel_company'];
00112                 }
00113         }
00114 
00115         echo '<div class="content">';
00116         echo $client->Summary($search,"contact",$sql);
00117 
00118 
00119         echo '<br>';
00120         echo '<br>';
00121         echo '<br>';
00122         /* Add button */
00123         $f_add_button = new IButton('add_card');
00124         $f_add_button->label = _('Créer une nouvelle fiche');
00125         $f_add_button->set_attribute('win_refresh', 'yes');
00126         $f_add_button->set_attribute('type_cat', FICHE_TYPE_CONTACT);
00127         $f_add_button->javascript = " select_card_type(this);";
00128         echo $f_add_button->input();
00129 
00130     $f_cat_button=new IButton('add_cat');
00131     $f_cat_button->set_attribute('ipopup','ipop_cat');
00132     $f_cat_button->set_attribute('type_cat',FICHE_TYPE_CONTACT);
00133     $f_cat_button->label=_('Ajout d\'une catégorie');
00134     $f_cat_button->javascript='add_category(this)';
00135     echo $f_cat_button->input();
00136 
00137         echo '</div>';
00138     echo '</div>';
00139 
00140 
00141 }
00142 /*----------------------------------------------------------------------
00143  * Detail for a card, Suivi, Contact, Operation,... *
00144  * cc stands for contact card
00145  *----------------------------------------------------------------------*/
00146 if ( $low_action == 'detail')
00147 {
00148     /* Menu */
00149     require_once('category_card.inc.php');
00150     exit();
00151 }
00152 
00153     html_page_stop();
00154 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations