[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/telephonie/client/ -> commentaires.php (source)

   1  <?PHP
   2  /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: commentaires.php,v 1.3 2005/11/22 13:35:58 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/commentaires.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  $mesg = '';
  26  
  27  llxHeader("","","Fiche client");
  28  
  29  if ($cancel == $langs->trans("Cancel"))
  30  {
  31    $action = '';
  32  }
  33  /*
  34   * Affichage
  35   *
  36   */
  37  
  38  if ($_GET["id"])
  39  {
  40    $soc = new Societe($db);
  41    $result = $soc->fetch($_GET["id"], $user);
  42  
  43    if ($_GET["action"] == 'add')
  44      {
  45        $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_commentaire";
  46        $sql .= " (fk_soc, fk_user, commentaire,datec)";
  47        $sql .= " VALUES ('".$soc->id."','".$user->id."','".$_POST["comment"]."',now());";
  48        $db->query($sql);
  49      }
  50  
  51    if ($_GET["action"] == 'del')
  52      {
  53        $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire";
  54        $sql .= " WHERE rowid = '".$_GET["commid"]."'";
  55        $sql .= " AND fk_user = '".$user->id."';";
  56        $db->query($sql);
  57      }
  58  
  59    if (!$soc->perm_read)
  60      {
  61        print "Lecture non authorisée";
  62      }
  63  
  64    if ( $result == 1 && $soc->perm_read)
  65      { 
  66  
  67        $h=0;
  68        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id;
  69        $head[$h][1] = $langs->trans("Contrats");
  70        $h++;
  71        
  72        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id;
  73        $head[$h][1] = $langs->trans("Lignes");
  74        $h++;
  75        
  76        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id;
  77        $head[$h][1] = $langs->trans("Factures");
  78        $h++;
  79        
  80        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id;
  81        $head[$h][1] = $langs->trans("Stats");
  82        $h++;
  83        
  84        $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client";
  85        $sql .= " WHERE fk_client = '".$soc->id."';";
  86        $resql = $db->query($sql);
  87        
  88        if ($resql)
  89      {
  90        $row = $db->fetch_row($resql);
  91        $db->free($resql);
  92      }
  93        
  94        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id;
  95        $head[$h][1] = $langs->trans("Tarifs (".$row[0].")");
  96        $h++;
  97        
  98        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id;
  99        $head[$h][1] = $langs->trans("Commentaires");
 100        $hselected = $h;
 101        $h++;
 102        
 103        if ($soc->perm_perms)
 104      {
 105        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id;
 106        $head[$h][1] = $langs->trans("Permissions");
 107        $h++;
 108      }
 109        
 110        dolibarr_fiche_head($head, $hselected, 'Client : '.$soc->nom);
 111        
 112        print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
 113        print '<tr><td width="20%">'.$langs->trans('Name').'</td><td>'.$soc->nom.'</td><td>'.$langs->trans('Code client').'</td><td>'.$soc->code_client.'</td></tr>';
 114        
 115        print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."<br>".$soc->cp." ".$soc->ville." ".$soc->pays."</td></tr>";
 116        
 117        print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel).'</td>';
 118        print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax).'</td></tr>';
 119        
 120        print '<tr><td><a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'">'.img_edit() ."</a>&nbsp;";
 121        print $langs->trans('RIB').'</td><td colspan="3">';
 122        print $soc->display_rib();
 123        print '</td></tr>';
 124        
 125        print '</table><br />';
 126        
 127        print '<form method="POST" action="commentaires.php?id='.$soc->id.'&action=add">';
 128        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';      
 129        print '<tr><td width="15%" valign="center">Nouveau<br>commentaire';
 130        print '</td><td><textarea cols="60" rows="3" name="comment"></textarea></td>';
 131        print '<td><input type="submit" value="Ajouter"></td></tr>';
 132        print "</table></form><br />";
 133        
 134        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 135        
 136        /* Commentaires */
 137        
 138        $sql = "SELECT c.commentaire, u.firstname, u.name, u.code, c.rowid, c.fk_user";
 139        $sql .= " , ".$db->pdate("c.datec") ." as datec";
 140        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c";
 141        $sql .= " , ".MAIN_DB_PREFIX."user as u";
 142        $sql .= " WHERE fk_soc = ".$soc->id;
 143        $sql .= " AND c.fk_user = u.rowid";
 144        $sql .= " ORDER BY c.datec DESC";
 145        
 146        $resql = $db->query($sql);
 147        
 148        if ($resql)
 149      {
 150        print '<tr class="liste_titre"><td width="15%" valign="center">Date';
 151        print '</td><td>Commentaire</td><td align="center">Auteur</td><td>&nbsp;</td>';
 152        print "</tr>\n";
 153        
 154        while ($obj = $db->fetch_object($resql))
 155          {
 156            print "<tr $bc[$var]><td>".strftime("%d/%m/%y %H:%M",$obj->datec);
 157            print "</td>\n";
 158            print '<td>'.nl2br(stripslashes($obj->commentaire))."</td>\n";
 159            print '<td align="center">'.$obj->code."</td>\n";
 160            print '<td align="center">&nbsp;';
 161            if ($obj->fk_user == $user->id)
 162          {
 163            print '<a href="commentaires.php?id='.$soc->id.'&amp;commid='.$obj->rowid.'&amp;action=del">';
 164            print img_delete().'</a>';
 165          }
 166            print "</td></tr>\n";
 167            $var=!$var;          
 168          }
 169        $db->free($resql);      
 170      }
 171        else
 172      {
 173        print $sql;
 174      }      
 175        print "</table>";
 176      }
 177  }
 178  else
 179  {
 180    print "Error";
 181  }
 182  
 183  
 184  print '</div>';
 185  
 186  /* ************************************************************************** */
 187  /*                                                                            */ 
 188  /* Barre d'action                                                             */ 
 189  /*                                                                            */ 
 190  /* ************************************************************************** */
 191  /*
 192  print "\n<br>\n<div class=\"tabsAction\">\n";
 193  print "<a class=\"tabAction\" href=\"commentaires.php?action=add&amp;id=$soc->id\">".$langs->trans("Ajouter un commentaire")."</a>";
 194  print "</div>";
 195  */
 196  
 197  $db->close();
 198  
 199  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/22 13:35:58 $ r&eacute;vision $Revision: 1.3 $</em>");
 200  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics