diff --git a/htdocs/telephonie/client/commentaires.php b/htdocs/telephonie/client/commentaires.php index ff0cc5c1d6f..24b1be84762 100644 --- a/htdocs/telephonie/client/commentaires.php +++ b/htdocs/telephonie/client/commentaires.php @@ -48,6 +48,14 @@ if ($_GET["id"]) $db->query($sql); } + if ($_GET["action"] == 'del') + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire"; + $sql .= " WHERE rowid = '".$_GET["commid"]."'"; + $sql .= " AND fk_user = '".$user->id."';"; + $db->query($sql); + } + if (!$soc->perm_read) { print "Lecture non authorisée"; @@ -56,111 +64,112 @@ if ($_GET["id"]) 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=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++; - - $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) + } + + 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, c.rowid"; + $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)) { - $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 '
Date'; + print 'CommentaireAuteur
'; - 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"; + print '\n"; + print '\n"; + print ''; print "\n"; - - while ($obj = $db->fetch_object($resql)) - { - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $var=!$var; - } - $db->free($resql); - + $var=!$var; } - else - { - print $sql; - } - - print "
Date'; - print 'CommentaireAuteur
".strftime("%d/%m/%y %H:%M",$obj->datec); + print "'.nl2br(stripslashes($obj->commentaire))."'.$obj->code."'; + print ''; + print img_delete().'
".strftime("%d/%m/%y %H:%M",$obj->datec); - print "'.nl2br(stripslashes($obj->commentaire))."'.$obj->code."
"; + $db->free($resql); + } + else + { + print $sql; + } + print ""; } } else