diff --git a/htdocs/telephonie/client/commentaires.php b/htdocs/telephonie/client/commentaires.php new file mode 100644 index 00000000000..ff0cc5c1d6f --- /dev/null +++ b/htdocs/telephonie/client/commentaires.php @@ -0,0 +1,188 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require("./pre.inc.php"); + +$mesg = ''; + +llxHeader("","","Fiche client"); + +if ($cancel == $langs->trans("Cancel")) +{ + $action = ''; +} +/* + * Affichage + * + */ + +if ($_GET["id"]) +{ + $soc = new Societe($db); + $result = $soc->fetch($_GET["id"], $user); + + if ($_GET["action"] == 'add') + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."telephonie_societe_commentaire"; + $sql .= " (fk_soc, fk_user, commentaire,datec)"; + $sql .= " VALUES ('".$soc->id."','".$user->id."','".$_POST["comment"]."',now());"; + $db->query($sql); + } + + if (!$soc->perm_read) + { + print "Lecture non authorisée"; + } + + if ( $result == 1 && $soc->perm_read) + { + + $h=0; + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Contrats"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Lignes"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Factures"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Stats"); + $h++; + + $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client"; + $sql .= " WHERE fk_client = '".$soc->id."';"; + $resql = $db->query($sql); + + if ($resql) + { + $row = $db->fetch_row($resql); + $db->free($resql); + } + + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Tarifs (".$row[0].")"); + $h++; + + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Commentaires"); + $hselected = $h; + $h++; + + if ($soc->perm_perms) + { + $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id; + $head[$h][1] = $langs->trans("Permissions"); + $h++; + } + + dolibarr_fiche_head($head, $hselected, 'Client : '.$soc->nom); + + print ''; + print ''; + + print ""; + + print ''; + print ''; + + print ''; + + print '
'.$langs->trans('Name').''.$soc->nom.''.$langs->trans('Code client').''.$soc->code_client.'
".$langs->trans('Address')."".nl2br($soc->adresse)."
".$soc->cp." ".$soc->ville." ".$soc->pays."
'.$langs->trans('Phone').''.dolibarr_print_phone($soc->tel).''.$langs->trans('Fax').''.dolibarr_print_phone($soc->fax).'
'.img_edit() ." "; + print $langs->trans('RIB').''; + print $soc->display_rib(); + print '

'; + + print '
'; + print ''; + print ''; + print ''; + print "
Nouveau
commentaire'; + print '

"; + + print ''; + + /* Commentaires */ + + $sql = "SELECT c.commentaire, u.firstname, u.name, u.code"; + $sql .= " , ".$db->pdate("c.datec") ." as datec"; + $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; + $sql .= " , ".MAIN_DB_PREFIX."user as u"; + $sql .= " WHERE fk_soc = ".$soc->id; + $sql .= " AND c.fk_user = u.rowid"; + $sql .= " ORDER BY c.datec DESC"; + + $resql = $db->query($sql); + + if ($resql) + { + print ''; + print "\n"; + + while ($obj = $db->fetch_object($resql)) + { + print "\n"; + print '\n"; + print '\n"; + print "\n"; + $var=!$var; + } + $db->free($resql); + + } + else + { + print $sql; + } + + print "
Date'; + print 'CommentaireAuteur
".strftime("%d/%m/%y %H:%M",$obj->datec); + print "'.nl2br(stripslashes($obj->commentaire))."'.$obj->code."
"; + } +} +else +{ + print "Error"; +} + + +print ''; + +/* ************************************************************************** */ +/* */ +/* Barre d'action */ +/* */ +/* ************************************************************************** */ +/* +print "\n
\n
\n"; +print "id\">".$langs->trans("Ajouter un commentaire").""; +print "
"; +*/ + +$db->close(); + +llxFooter("Dernière modification $Date$ révision $Revision$"); +?>