diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 50073e70064..e74d24c6e19 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur * * 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 @@ -46,17 +46,12 @@ $socid = $_GET["socid"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="nom"; -} +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="nom"; llxHeader(); - /* * Action ajout notification */ @@ -106,142 +101,147 @@ if ($_GET["action"] == 'delete') $soc = new Societe($db); $soc->id = $_GET["socid"]; -if ( $soc->fetch($soc->id) ) +if ( $soc->fetch($soc->id) ) { - $h=0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($soc->client==1) + $html = new Form($db); + $langs->load("other"); + + $h=0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Company"); + $h++; + + if ($soc->client==1) { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Customer"); + $h++; } - - if ($soc->client==2) + + if ($soc->client==2) { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; + $head[$h][1] = $langs->trans("Prospect"); + $h++; } - if ($soc->fournisseur) + if ($soc->fournisseur) { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Supplier"); + $h++; } - - if ($conf->compta->enabled) { - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Accountancy"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) + + if ($conf->compta->enabled) { + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Accountancy"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Note"); + $h++; + + if ($user->societe_id == 0) { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Documents"); + $h++; } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; - $head[$h][1] = $langs->trans("Notifications"); - $hselected=$h; - $h++; - - dolibarr_fiche_head($head, $hselected, $soc->nom); - - /* - * - * - */ - - print ''; - - print ''; - print ''; - - print '"; - print '"; - - print '
'.$langs->trans("Name").''.$soc->nom.'
'.$langs->trans("Address").''.nl2br($soc->adresse).' 
'.$langs->trans('Zip').''.$soc->cp."'.$langs->trans('Town').''.$soc->ville."

'; - - print "\n"; - - print ''; - print ''; - print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name","","&socid=$socid",'',$sortfield); - print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre","","&socid=$socid",'',$sortfield); - print ''; - print ''; - - $sql = "SELECT c.name, c.firstname, a.titre,n.rowid FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n"; - $sql .= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action AND n.fk_soc = ".$soc->id; - - if ($db->query($sql)) + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Notifications"); + $hselected=$h; + $h++; + + dolibarr_fiche_head($head, $hselected, $soc->nom); + + /* + * + * + */ + + print '
 
'; + + print ''; + print ''; + + print '"; + print '"; + + print '
'.$langs->trans("Name").''.$soc->nom.'
'.$langs->trans("Address").''.nl2br($soc->adresse).' 
'.$langs->trans('Zip').''.$soc->cp."'.$langs->trans('Town').''.$soc->ville."

'; + + print "\n"; + + print ''; + print ''; + print_liste_field_titre($langs->trans("Contact"),"fiche.php","c.name","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Action"),"fiche.php","a.titre","","&socid=$socid",'',$sortfield); + print ''; + print ''; + + $sql = "SELECT c.name, c.firstname, a.titre,n.rowid"; + $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c, ".MAIN_DB_PREFIX."action_def as a, ".MAIN_DB_PREFIX."notify_def as n"; + $sql.= " WHERE n.fk_contact = c.idp AND a.rowid = n.fk_action AND n.fk_soc = ".$soc->id; + + $resql=$db->query($sql); + if ($resql) { - $num = $db->num_rows(); - $i = 0; - $var=True; - while ($i < $num) - { - $obj = $db->fetch_object( $i); - - print ''; - print ''; - print''; + print ''; + print''; - print ''; - print ''; - print '
 
'.$obj->firstname . " ".$obj->name.''.$obj->titre.''.img_delete().''; - - $i++; - $var = !$var; - } - $db->free(); + $num = $db->num_rows($resql); + $i = 0; + $var=True; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + print '
'.$obj->firstname . " ".$obj->name.''.$obj->titre.''.img_delete().''; + + $i++; + $var = !$var; + } + $db->free($resql); } - else + else { - dolibarr_print_error($db); + dolibarr_print_error($db); } - - /* - * - */ - - $sql = "SELECT a.rowid, a.titre FROM ".MAIN_DB_PREFIX."action_def as a"; - - if ($db->query($sql)) + + // Charge tableau $actions + $sql = "SELECT a.rowid, a.code, a.titre"; + $sql.= " FROM ".MAIN_DB_PREFIX."action_def as a"; + + $resql=$db->query($sql); + if ($resql) { - $num = $db->num_rows(); - $i = 0; - while ($i < $num) - { - $obj = $db->fetch_object( $i); - $actions[$obj->rowid] = $obj->titre; - $i++; - } - $db->free(); + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $obj = $db->fetch_object($resql); + $libelle=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->titre); + $actions[$obj->rowid] = $libelle; + + $i++; + } + $db->free($resql); } - else + else { - dolibarr_print_error($db); + dolibarr_print_error($db); } - - $html = new Form($db); - print '
'; - print ''; - print '
'; - $html->select_array("contactid",$soc->contact_email_array()); - print ''; - $html->select_array("actionid",$actions); - print '
'; + + print '
'; + print ''; + print ''; + $html->select_array("contactid",$soc->contact_email_array()); + print ''; + print ''; + $html->select_array("actionid",$actions); + print ''; + print ''; + print '
'; }