diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index f07da4889ce..a7cb9e760ac 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -22,13 +22,13 @@ * */ -/*! - \file htdocs/comm/fiche.php - \ingroup commercial - \brief Onglet client de la fiche societe - \version $Revision$ +/** + \file htdocs/comm/fiche.php + \ingroup commercial + \brief Onglet client de la fiche societe + \version $Revision$ */ - + require("./pre.inc.php"); require("../contact.class.php"); require("../actioncomm.class.php"); @@ -44,243 +44,234 @@ llxHeader('',$langs->trans('CustomerCard')); $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; -if ($sortorder == "") { - $sortorder="ASC"; -} -if ($sortfield == "") { - $sortfield="nom"; -} +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="nom"; if ($_GET["action"] == 'attribute_prefix') { - $societe = new Societe($db, $_GET["socid"]); - $societe->attribute_prefix($db, $_GET["socid"]); + $societe = new Societe($db, $_GET["socid"]); + $societe->attribute_prefix($db, $_GET["socid"]); } if ($action == 'recontact') { - $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; - $result = $db->query($sql); + $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; + $result = $db->query($sql); } if ($action == 'stcomm') { - if ($stcommid <> 'null' && $stcommid <> $oldstcomm) + if ($stcommid <> 'null' && $stcommid <> $oldstcomm) { - $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; - $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')"; - $result = @$db->query($sql); - - if ($result) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; - $result = $db->query($sql); - } - else - { - $errmesg = "ERREUR DE DATE !"; - } + $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; + $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')"; + $result = @$db->query($sql); + + if ($result) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=$socid"; + $result = $db->query($sql); + } + else + { + $errmesg = "ERREUR DE DATE !"; + } } - if ($actioncommid) + if ($actioncommid) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; - $result = @$db->query($sql); - - if (!$result) - { - $errmesg = "ERREUR DE DATE !"; - } + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; + $result = @$db->query($sql); + + if (!$result) + { + $errmesg = "ERREUR DE DATE !"; + } } } /* * Recherche * - * */ if ($mode == 'search') { - if ($mode-search == 'soc') { - $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; - $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - } - - if ( $db->query($sql) ) { - if ( $db->num_rows() == 1) { - $obj = $db->fetch_object(); - $socid = $obj->idp; + if ($mode-search == 'soc') { + $sql = "SELECT s.idp FROM ".MAIN_DB_PREFIX."societe as s "; + $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; + } + + if ( $db->query($sql) ) { + if ( $db->num_rows() == 1) { + $obj = $db->fetch_object(); + $socid = $obj->idp; + } + $db->free(); } - $db->free(); - } } -/* - * - */ $_socid = $_GET["socid"]; + /* * Sécurité si un client essaye d'accéder à une autre fiche que la sienne */ -if ($user->societe_id > 0) +if ($user->societe_id > 0) { - $_socid = $user->societe_id; + $_socid = $user->societe_id; } + + /********************************************************************************* * * Mode fiche * - * - *********************************************************************************/ + *********************************************************************************/ if ($_socid > 0) { - // On recupere les donnees societes par l'objet - $objsoc = new Societe($db); - $objsoc->id=$_socid; - $objsoc->fetch($_socid,$to); - - $dac = strftime("%Y-%m-%d %H:%M", time()); - if ($errmesg) - { - print "$errmesg
"; - } - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($objsoc->client==1) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Customer");; - $h++; - } - if ($objsoc->client==2) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($objsoc->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - if ($conf->compta->enabled) { - $langs->load("compta"); - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Accountancy"); - $h++; - } + // On recupere les donnees societes par l'objet + $objsoc = new Societe($db); + $objsoc->id=$_socid; + $objsoc->fetch($_socid,$to); - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Note"); - $h++; - - if ($user->societe_id == 0) + $dac = strftime("%Y-%m-%d %H:%M", time()); + if ($errmesg) { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; + print "$errmesg
"; } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - if ($user->societe_id == 0) + + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Company"); + $h++; + + if ($objsoc->client==1) { - $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; - $head[$h][1] = 'Bookmark'; - $head[$h][2] = 'image'; - $h++; + $hselected=$h; + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Customer");; + $h++; } - - dolibarr_fiche_head($head, $hselected, $objsoc->nom); - - /* - * - * - */ - print ''; - print '\n"; - + + if ($conf->compta->enabled) { + $langs->load("compta"); + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Accountancy"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Note"); + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Documents"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Notifications"); + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT."/comm/index.php?socidp=$objsoc->id&action=add_bookmark"; + $head[$h][1] = 'Bookmark'; + $head[$h][2] = 'image'; + $h++; + } + + dolibarr_fiche_head($head, $hselected, $objsoc->nom); + + /* + * + * + */ + print '
'; - print ''; - - print ''; - print "'; - - print ''; - print '"; - - print ""; - print '"; - - print ""; - print '"; - print ''; - - print ''; - print ''; - - print "
'.$langs->trans("Name").''; - print $objsoc->nom; - print ''.$objsoc->code_client.'
".$langs->trans("Address")."".nl2br($objsoc->adresse); - - print '
'.$objsoc->cp." ".$objsoc->ville; - print '
'.$objsoc->pays.'
'.$langs->trans("Phone").''.dolibarr_print_phone($objsoc->tel).' Fax'.dolibarr_print_phone($objsoc->fax).' 
'.$langs->trans("Web")."url\">$objsoc->url 
".$langs->transcountry("ProfId1",$objsoc->pays_code)."siren\">$objsoc->siren '.$langs->trans("Prefix").''; - if ($objsoc->prefix_comm) + if ($objsoc->client==2) { - print $objsoc->prefix_comm; + $hselected=$h; + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$obj->socid; + $head[$h][1] = $langs->trans("Prospect"); + $h++; } - else + if ($objsoc->fournisseur) { - print "[id&action=attribute_prefix\">Attribuer]"; + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Supplier"); + $h++; } - - print "
".$langs->trans("Type")." $objsoc->typentEffectif$objsoc->effectif
'; - print $langs->trans("CustomerDiscount").''.$objsoc->remise_client." %'; - print img_edit($langs->trans("Modify")); - print ""; - print '
Remise exceptionnelles'; - print ''; - print img_edit($langs->trans("Modify")); - print ""; - print '
"; - - print "
"; - - /* - * - */ - print "
'; + print '\n"; + print '"; print "
'; + print ''; + + print ''; + print "'; + + print ''; + print '"; + + print ""; + print '"; + + print ""; + print '"; + print ''; + + print ''; + print ''; + + print "
'.$langs->trans("Name").''; + print $objsoc->nom; + print ''.$objsoc->code_client.'
".$langs->trans("Address")."".nl2br($objsoc->adresse); + + print '
'.$objsoc->cp." ".$objsoc->ville; + print '
'.$objsoc->pays.'
'.$langs->trans("Phone").''.dolibarr_print_phone($objsoc->tel).' Fax'.dolibarr_print_phone($objsoc->fax).' 
'.$langs->trans("Web")."url\">$objsoc->url 
".$langs->transcountry("ProfId1",$objsoc->pays_code)."siren\">$objsoc->siren '.$langs->trans("Prefix").''; + if ($objsoc->prefix_comm) + { + print $objsoc->prefix_comm; + } + else + { + print "[id&action=attribute_prefix\">Attribuer]"; + } + + print "
".$langs->trans("Type")." $objsoc->typentEffectif$objsoc->effectif
'; + print $langs->trans("CustomerDiscount").''.$objsoc->remise_client." %'; + print img_edit($langs->trans("Modify")); + print ""; + print '
Remise exceptionnelles'; + print ''; + print img_edit($langs->trans("Modify")); + print ""; + print '
"; + + print "
"; + + print "
'; - + // Nbre max d'éléments des petites listes $MAXLIST=4; - + /* * Dernieres propales */ if ($conf->propal->enabled) { print ''; - + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.remise, ".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id"; $sql .= " AND s.idp = ".$objsoc->id; $sql .= " ORDER BY p.datep DESC"; - + if ( $db->query($sql) ) { $var=true; @@ -315,20 +306,20 @@ if ($_socid > 0) } print "
"; } - + /* * Dernieres commandes */ if($conf->commande->enabled) { print ''; - + $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.total_ht, p.ref, ".$db->pdate("p.date_commande")." as dp"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as p"; $sql .= " WHERE p.fk_soc = s.idp "; $sql .= " AND s.idp = $objsoc->id"; $sql .= " ORDER BY p.date_commande DESC"; - + if ( $db->query($sql) ) { $var=true; @@ -359,38 +350,39 @@ if ($_socid > 0) } print "
"; } - + /* * Derniers projets associés */ if ($conf->projet->enabled) { print ''; - + $sql = "SELECT p.rowid,p.title,p.ref,".$db->pdate("p.dateo")." as do"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " WHERE p.fk_soc = $objsoc->id"; $sql .= " ORDER BY p.dateo DESC"; - - if ( $db->query($sql) ) { + + $result=$db->query($sql); + if ($result) { $var=true; $i = 0 ; - $num = $db->num_rows(); + $num = $db->num_rows($result); if ($num > 0) { print ""; print ''; print ''; } while ($i < $num && $i < $MAXLIST) { - $obj = $db->fetch_object(); + $obj = $db->fetch_object($result); $var = !$var; print ""; print ''; - + print ""; $i++; } - $db->free(); + $db->free($result); } else { @@ -398,15 +390,11 @@ if ($_socid > 0) } print "
'.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
'.$obj->title.'".$obj->ref ."
"; } - - /* - * - * - */ + print "
\n"; - - + + /* * Barre d'action * @@ -414,336 +402,331 @@ if ($_socid > 0) print '
'; if ($conf->propal->enabled && $user->rights->propale->creer) - { - $langs->load("propal"); - print ''.$langs->trans("AddProp").''; - } + { + $langs->load("propal"); + print ''.$langs->trans("AddProp").''; + } if ($user->rights->contrat->creer) - { - $langs->load("contracts"); - print ''.$langs->trans("AddContract").''; - } + { + $langs->load("contracts"); + print ''.$langs->trans("AddContract").''; + } if ($conf->commande->enabled && $user->rights->commande->creer) - { - $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; - } + { + $langs->load("orders"); + print ''.$langs->trans("AddOrder").''; + } if ($conf->projet->enabled && $user->rights->projet->creer) - { - print ''.$langs->trans("AddProject").''; - } + { + print ''.$langs->trans("AddProject").''; + } if ($conf->fichinter->enabled) - { - print 'Intervention'; - } + { + print 'Intervention'; + } + + print ''.$langs->trans("AddContact").''; - print ''.$langs->trans("AddContact").''; - print '
'; print '
'; - - /* - * - * - * - */ + if ($action == 'changevalue') - { - print "
"; - print "
id\" method=\"post\">"; - print ""; - print "Cette société est un cabinet de recrutement : "; - print ""; - print "trans("Valid")."\">"; - print "
\n"; - } + { + print "
"; + print "
id\" method=\"post\">"; + print ""; + print "Cette société est un cabinet de recrutement : "; + print ""; + print "trans("Valid")."\">"; + print "
\n"; + } else - { - /* - * - * Liste des contacts - * - */ - if ($conf->clicktodial->enabled) - { - $user->fetch_clicktodial(); // lecture des infos de clicktodial - } + { + /* + * + * Liste des contacts + * + */ + if ($conf->clicktodial->enabled) + { + $user->fetch_clicktodial(); // lecture des infos de clicktodial + } - print ''; - - print ''; - print ''; - print ''; - print ""; - print ''; - print ""; - - $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; - $sql .= " WHERE p.fk_soc = $objsoc->id"; - $sql .= " ORDER by p.datec"; + print '
'.$langs->trans("Firstname").' '.$langs->trans("Lastname").''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'  
'; - $result = $db->query($sql); - $i = 0 ; $num = $db->num_rows(); $tag = True; + print ''; + print ''; + print ''; + print ""; + print ''; + print ""; - while ($i < $num) - { - $obj = $db->fetch_object(); - $var = !$var; - print ""; - - print ''; - print ''; - print ''; - print ''; - print ''; - - print ''; - - print ''; - - print "\n"; - $i++; - $tag = !$tag; - } - print "
'.$langs->trans("Firstname").' '.$langs->trans("Lastname").''.$langs->trans("Poste").''.$langs->trans("Tel").''.$langs->trans("Fax").''.$langs->trans("EMail").'  
'; - print ''; - print img_object($langs->trans("Show"),"contact"); - print ' '.$obj->firstname.' '. $obj->name.' '; - - if (trim($obj->note)) - { - print '
'.nl2br(trim($obj->note)); - } - print '
'.$obj->poste.' '; + $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email, p.note "; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; + $sql .= " WHERE p.fk_soc = $objsoc->id"; + $sql .= " ORDER by p.datec"; - /* - * Lien click to dial - */ - - if (strlen($obj->phone) && $user->clicktodial_enabled == 1) - { - print ''; - print img_phone_out("Appel émis") ; - } - print ''; - print ''.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->fax).' '.$obj->email.' '; - print "idp\">"; - print img_edit(); - print ''; - print img_object($langs->trans("Rendez-Vous"),"action"); - print '
"; - - print "
"; - - /* - * Listes des actions a faire - * - */ - print ''; - print ''; - print ''; - print '\n"; + $i++; + $tag = !$tag; + } + print "
'.$langs->trans("ActionsToDo").' '.$langs->trans("AddActionToDo").'
'; - - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_soc = $objsoc->id "; - $sql .= " AND u.rowid = a.fk_user_author"; - $sql .= " AND c.id=a.fk_action AND a.percent < 100"; - $sql .= " ORDER BY a.datea DESC, a.id DESC"; + $result = $db->query($sql); + $i = 0; + $num = $db->num_rows($result); + $tag = true; - if ( $db->query($sql) ) { - print "\n"; + while ($i < $num) + { + $obj = $db->fetch_object($result); + $var = !$var; + print ""; - $i = 0 ; $num = $db->num_rows(); - while ($i < $num) { - $var = !$var; + print '"; + if (trim($obj->note)) + { + print '
'.nl2br(trim($obj->note)); + } + print ''; + print ''; + print ''; - print "\n"; - } - else - { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } + /* + * Lien click to dial + */ - if ($oldmonth == strftime("%Y%b",$obj->da) ) - { - //print ''; - print "\n"; - } - else - { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; + if (strlen($obj->phone) && $user->clicktodial_enabled == 1) + { + print ''; + print img_phone_out("Appel émis") ; + } + print ''; + print ''; + print ''; - print ''; + print ''; - if ($obj->propalrowid) - { - print ''; - } - else - { - print ''; - } - /* - * Contact pour cette action - * - */ - if ($obj->fk_contact) { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } else { - print ''; - } + print ''; - /* - */ - print ''; - print "\n"; - $i++; - } - print "
'; + print ''; + print img_object($langs->trans("Show"),"contact"); + print ' '.$obj->firstname.' '. $obj->name.' '; - $obj = $db->fetch_object(); - print "
'.$obj->poste.' '; - if ($oldyear == strftime("%Y",$obj->da) ) - { - //print '|" .strftime("%Y",$obj->da)."" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)."'; + print ''.dolibarr_print_phone($obj->phone).' '.dolibarr_print_phone($obj->fax).' '.$obj->email.'  '; + print "idp\">"; + print img_edit(); + print ''.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.' '; + print img_object($langs->trans("Rendez-Vous"),"action"); + print ''.$obj->code.'
"; + print "
"; - $db->free(); - } else { - dolibarr_print_error($db); - } - print ""; + print "
"; - /* - * Listes des actions effectuees - */ - print ''; - print ''; - print ''; - print '
'.$langs->trans("ActionsDone").'
'; + /* + * Listes des actions a faire + * + */ + print ''; + print ''; + print ''; + print '
'.$langs->trans("ActionsToDo").' '.$langs->trans("AddActionToDo").'
'; - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; - $sql .= " WHERE a.fk_soc = $objsoc->id "; - $sql .= " AND u.rowid = a.fk_user_author"; - $sql .= " AND c.id=a.fk_action AND a.percent = 100"; - $sql .= " ORDER BY a.datea DESC, a.id DESC"; + $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; + $sql .= " WHERE a.fk_soc = $objsoc->id "; + $sql .= " AND u.rowid = a.fk_user_author"; + $sql .= " AND c.id=a.fk_action AND a.percent < 100"; + $sql .= " ORDER BY a.datea DESC, a.id DESC"; - if ( $db->query($sql) ) - { - print ''; - - $i = 0 ; - $num = $db->num_rows(); - $oldyear=''; - $oldmonth=''; - while ($i < $num) - { - $var = !$var; - - $obj = $db->fetch_object(); - print ""; - - if ($oldyear == strftime("%Y",$obj->da) ) - { - print ''; - } - else - { - print "\n"; - $oldyear = strftime("%Y",$obj->da); - } - - if ($oldmonth == strftime("%Y%b",$obj->da) ) - { - print ''; - } - else - { - print "\n"; - $oldmonth = strftime("%Y%b",$obj->da); - } - - print "\n"; - print "\n"; - - print ''; - - if ($obj->propalrowid) - { - print ''; - } - else - { - print ''; - } - /* - * Contact pour cette action - * - */ - if ($obj->fk_contact) - { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } - else - { - print ''; - } - /* - */ - print ''; - print "\n"; - $i++; - } - print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("Showcontact"),"contact").' '.$contact->fullname.' '.$obj->code.'
"; - - $db->free(); - } - else - { - dolibarr_print_error($db); - } - print "
"; - /* - * - * Notes sur la societe - * - */ - if ($objsoc->note) - { - print ''; - print ""; - print "
".nl2br($objsoc->note)."
"; - } - /* - * - * - * - */ + $result=$db->query($sql); + if ($result) { + print "\n"; + + $i = 0 ; $num = $db->num_rows($result); + while ($i < $num) { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) + { + //print ''; + print "\n"; + } + else + { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) + { + //print ''; + print "\n"; + } + else + { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + if ($obj->propalrowid) + { + print ''; + } + else + { + print ''; + } + /* + * Contact pour cette action + * + */ + if ($obj->fk_contact) { + $contact = new Contact($db); + $contact->fetch($obj->fk_contact); + print ''; + } else { + print ''; + } + + /* + */ + print ''; + print "\n"; + $i++; + } + print "
|" .strftime("%Y",$obj->da)."" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowContact"),"contact").' '.$contact->fullname.' '.$obj->code.'
"; + + $db->free($result); + } else { + dolibarr_print_error($db); + } + print "
"; + + /* + * Listes des actions effectuees + */ + print ''; + print ''; + print ''; + print '
'.$langs->trans("ActionsDone").'
'; + + $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid "; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; + $sql .= " WHERE a.fk_soc = $objsoc->id "; + $sql .= " AND u.rowid = a.fk_user_author"; + $sql .= " AND c.id=a.fk_action AND a.percent = 100"; + $sql .= " ORDER BY a.datea DESC, a.id DESC"; + + $result=$db->query($sql); + if ($result) + { + print ''; + + $i = 0 ; + $num = $db->num_rows($result); + $oldyear=''; + $oldmonth=''; + while ($i < $num) + { + $var = !$var; + + $obj = $db->fetch_object($result); + print ""; + + if ($oldyear == strftime("%Y",$obj->da) ) + { + print ''; + } + else + { + print "\n"; + $oldyear = strftime("%Y",$obj->da); + } + + if ($oldmonth == strftime("%Y%b",$obj->da) ) + { + print ''; + } + else + { + print "\n"; + $oldmonth = strftime("%Y%b",$obj->da); + } + + print "\n"; + print "\n"; + + print ''; + + if ($obj->propalrowid) + { + print ''; + } + else + { + print ''; + } + /* + * Contact pour cette action + * + */ + if ($obj->fk_contact) + { + $contact = new Contact($db); + $contact->fetch($obj->fk_contact); + print ''; + } + else + { + print ''; + } + /* + */ + print ''; + print "\n"; + $i++; + } + print "
|" .strftime("%Y",$obj->da)."|" .strftime("%b",$obj->da)."" .strftime("%d",$obj->da)."" .strftime("%H:%M",$obj->da)." '.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("ShowTask"),"task").' '.$obj->libelle.''.img_object($langs->trans("Showcontact"),"contact").' '.$contact->fullname.' '.$obj->code.'
"; + + $db->free($result); + } + else + { + dolibarr_print_error($db); + } + print "
"; + + /* + * + * Notes sur la societe + * + */ + if ($objsoc->note) + { + print ''; + print ""; + print "
".nl2br($objsoc->note)."
"; + } } - } else { +} else { dolibarr_print_error($db); - } +} $db->close();