diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php index 2daf1580f3b..8452b6758d2 100644 --- a/htdocs/actioncomm.class.php +++ b/htdocs/actioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * Copyright (C) 2004-2005 Laurent Destailleur * * $Id$ * $Source$ @@ -39,6 +39,7 @@ class ActionComm var $db; var $date; + var $type_code; var $type; var $priority; var $user; @@ -131,17 +132,24 @@ class ActionComm */ function fetch($id) { - $sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note, a.label, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent "; - $sql .= "FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c WHERE a.id=$id AND a.fk_action=c.id;"; + global $langs; + + $sql = "SELECT ".$this->db->pdate("a.datea")." as da, a.note, a.label, c.code, c.libelle, fk_soc, fk_user_author, fk_contact, fk_facture, a.percent"; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c"; + $sql.= " WHERE a.id=$id AND a.fk_action=c.id;"; - if ($this->db->query($sql) ) + $resql=$this->db->query($sql); + if ($resql) { - if ($this->db->num_rows()) + if ($this->db->num_rows($resql)) { - $obj = $this->db->fetch_object(); + $obj = $this->db->fetch_object($resql); $this->id = $id; - $this->type = $obj->libelle; + $this->type_code = $obj->code; + $transcode=$langs->trans("Action".$obj->code); + $type_libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); + $this->type = $type_libelle; $this->libelle = $obj->label; $this->date = $obj->da; $this->note =$obj->note; @@ -152,11 +160,11 @@ class ActionComm $this->fk_facture = $obj->fk_facture; if ($this->fk_facture) { - $this->objet_url = 'Facture'; + $this->objet_url = ''.$langs->trans("Bill").''; } - $this->db->free(); } + $this->db->free($resql); } else { diff --git a/htdocs/cactioncomm.class.php b/htdocs/cactioncomm.class.php index ffcc44b58e1..7fdfa7288c5 100644 --- a/htdocs/cactioncomm.class.php +++ b/htdocs/cactioncomm.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur + * 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 @@ -21,7 +21,8 @@ * */ -/** \file htdocs/cactioncomm.class.php +/** + \file htdocs/cactioncomm.class.php \ingroup commercial \brief Fichier de la classe des types d'actions commerciales \version $Revision$ @@ -33,120 +34,147 @@ */ class CActioncomm { + var $db; + var $id; var $libelle; + var $error; + + var $type_actions=array(); + /** * \brief Constructeur * \param DB Handler d'accès base de donnée */ - function CActioncomm($DB=0) + function CActioncomm($DB) { $this->db = $DB; } /** * \brief Charge l'objet type d'action depuis la base - * \param db handle d'accès base * \param id id du type d'action à récupérer * \return int 1=ok, 0=aucune action, -1=erreur */ - function fetch($db, $id) + function fetch($id) { + + $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_actioncomm WHERE id=$id;"; + + $resql=$this->db->query($sql); + if ($resql) + { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $id; + $this->libelle = $obj->libelle; + + return 1; + } + else + { + return 0; + } - $sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."c_actioncomm WHERE id=$id;"; - - if ($db->query($sql) ) - { - if ($db->num_rows()) - { - $obj = $db->fetch_object(); - - $this->id = $id; - $this->libelle = $obj->libelle; - - $db->free(); - - return 1; - } - else - { - return 0; - } - } - else - { - print $db->error(); - return -1; - } + $this->db->free($resql); + } + else + { + $this->error=$this->db->error(); + return -1; + } } /* - * \brief Renvoi la liste des type d'actions existant - * \param active 1 ou 0 pour un filtre sur l'etat actif ou non ('' par defaut) - * \return array tableau des types d'actions actifs + * \brief Renvoi la liste des types d'actions existant + * \param active 1 ou 0 pour un filtre sur l'etat actif ou non ('' par defaut = pas de filtre) + * \return array tableau des types d'actions actifs si ok, <0 si erreur */ function liste_array($active='') { + global $langs; + $langs->load("commercial"); + $ga = array(); - $sql = "SELECT id, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm"; + $sql = "SELECT id, code, libelle"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm"; if ($active != '') { $sql.=" WHERE active=$active"; } $sql .= " ORDER BY id"; - - if ($this->db->query($sql) ) - { - $nump = $this->db->num_rows(); - - if ($nump) - { - $i = 0; - while ($i < $nump) - { - $obj = $this->db->fetch_object(); - - $ga[$obj->id] = $obj->libelle; - $i++; - } - } - return $ga; - } + + $resql=$this->db->query($sql); + if ($resql) + { + $nump = $this->db->num_rows($resql); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object($resql); + + $transcode=$langs->trans("Action".$obj->code); + $ga[$obj->id] = ($transcode!="Action".$obj->code?$transcode:$obj->libelle); + $i++; + } + } + $this->liste_array=$ga; + return $ga; + } else - { - dolibarr_print_error($this->db); - } + { + return -1; + } } /* - * \brief Renvoie le nom d'un type d'action + * \brief Renvoie le nom sous forme d'un libellé traduit d'un type d'action * \param id id du type d'action * \return string libelle du type d'action */ function get_nom($id) { - - $sql = "SELECT libelle nom FROM ".MAIN_DB_PREFIX."c_actioncomm WHERE id='$id';"; + global $langs; - $result = $this->db->query($sql); - - if ($result) + if (! isset($this->type_actions[$id])) { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object($result); - return $obj->nom; - } - $this->db->free(); - } - else { - dolibarr_print_error($db); - } - - } - + // Si valeur non disponible en cache + $sql = 'SELECT code, libelle'; + $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm'; + $sql.= " WHERE id='".$id."'"; + + $result = $this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + + $transcode=$langs->trans("Action".$obj->code); + $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); + + $this->type_actions[$id]=$libelle; // Met en cache + return $libelle; + } + $this->db->free($result); + } + else { + dolibarr_print_error($db); + } + + } + else { + // Si valeur disponible en cache + return $this->type_actions[$id]; + } + } } ?> diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 7849e7a0a9d..3aa914520da 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -317,13 +317,11 @@ if ($socid > 0) print "

"; /* - * * Listes des actions a faire - * */ print ''; print ''; - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; + $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; $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 = $societe->id "; $sql .= " AND u.rowid = a.fk_user_author"; @@ -372,12 +370,19 @@ if ($socid > 0) print ''; @@ -422,9 +427,7 @@ if ($socid > 0) } /* - * * Listes des actions effectuees - * */ $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, u.code, a.propalrowid, a.fk_user_author, fk_contact, u.rowid, a.note "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 4f96a069bff..4425981ef4e 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -102,7 +102,10 @@ if ($resql) { $obj = $db->fetch_object($resql); $var=!$var; - print ""; + print ""; $i++; } print "
'.$langs->trans("ActionsToDo").'
'; if ($obj->propalrowid) { - print ''.$obj->libelle.''; + print ''; + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''; } else { print ''.img_object($langs->trans("ShowAction"),"task").' '; - print $obj->libelle.''; + $transcode=$langs->trans("Action".$obj->acode); + $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); + print $libelle; + print ''; } print '
id."\">".$obj->libelle."".$obj->cc."
id."\">"; + print img_action($langs->trans("Show"),$obj->id).' '; + print $langs->trans("StatusProspect".$obj->id); + print "".$obj->cc."

"; @@ -149,7 +152,7 @@ if ($conf->propal->enabled) */ print ''; -$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; +$sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.idp = a.fk_soc AND a.fk_user_action = $user->id"; $sql .= " ORDER BY a.datea DESC"; @@ -171,9 +174,13 @@ if ($resql) $obj = $db->fetch_object($resql); $var=!$var; - print "".strftime("%d %b %Y",$obj->da).""; - print '".img_object($langs->trans("ShowAction"),"task").' '."$obj->libelle $obj->label"; - print ''.$obj->sname.''; + print "".dolibarr_print_date($obj->da).""; + + $transcode=$langs->trans("Action".$obj->code); + $libelle=($transcode!="Action".$obj->code?$transcode:$obj->libelle); + print '".img_object($langs->trans("ShowAction"),"task").' '.$libelle.''; + + print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->sname.''; $i++; } print "
"; @@ -212,7 +219,7 @@ if ( $db->query($sql) ) print "rowid."\">"; print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; - print "idp\">$obj->nom\n"; + print "idp\">".img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom."\n"; print ""; print dolibarr_print_date($obj->dp)."\n"; print "".price($obj->price)."\n"; diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 783523d9487..fd580e78c3b 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -6,7 +6,8 @@ Customers=Customers Prospect=Prospect Prospects=Prospects DeleteAction=Delete a task -AddAction=Add a task +AddAction=Add task +AddAnAction=Add a task AddActionRendezVous=Add a Rendez-Vous task ConfirmDeleteAction=Are you sure you want to delete this task ? CardAction=Task card @@ -17,6 +18,7 @@ TaskRDV=Rendez-vous TaskRDVWith=Rendez-vous with %s ShowTask=Show task SalesRepresentative=Sales representative +SalesRepresentatives=Sales representatives ErrorWrongCode=Wrong code NoSalesRepresentativeAffected=No particular sales representative affected ShowCustomer=Show customer @@ -27,4 +29,15 @@ LastDoneTasks=Last done tasks LastRecordedTasks=Last recorded tasks DoneAndToDoTasksFor=Done and To do tasks for DoneAndToDoTasks=Done and To do tasks -SendPropalRef=Send commercial proposal %s \ No newline at end of file +SendPropalRef=Send commercial proposal %s +StatusActionToDo=To do +StatusActionDone=Done +StatusActionInProcess=In process +ActionAC_TEL=Phone call +ActionAC_FAX=Send fax +ActionAC_PROP=Send proposal +ActionAC_EMAIL=Send Email +ActionAC_RDV=Take a date +ActionAC_FAC=Send billing +ActionAC_REL=Send billing (reminder) +ActionAC_CLO=Clôture \ No newline at end of file diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index f4ebfa43dcc..9b204532a46 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -73,6 +73,11 @@ TE_GROUP=Large company TE_MEDIUM=Small or medium company TE_ADMIN=Governemental TE_OTHER=Other +StatusProspect-1=Do not contact +StatusProspect0=Never contacted +StatusProspect1=To contact +StatusProspect2=Contact in process +StatusProspect3=Contact done ChangeDoNotContact=Change status to 'Do not contact' ChangeNeverContacted=Change status to 'Never contacted' ChangeToContact=Change status to 'To contact' diff --git a/htdocs/langs/fr_FR/commercial.lang b/htdocs/langs/fr_FR/commercial.lang index f55aa4f8f69..4e876f530ce 100644 --- a/htdocs/langs/fr_FR/commercial.lang +++ b/htdocs/langs/fr_FR/commercial.lang @@ -7,6 +7,7 @@ Prospect=Prospect Prospects=Prospects DeleteAction=Effacer une action AddAction=Créer action +AddAnAction=Créer une action AddActionRendezVous=Créer une action Rendez-Vous ConfirmDeleteAction=Etes-vous sûr de vouloir effacer cet action ? CardAction=Fiche action @@ -17,6 +18,7 @@ TaskRDV=Rendez-vous TaskRDVWith=Rendez-vous avec %s ShowTask=Afficher action SalesRepresentative=Commercial +SalesRepresentatives=Commerciaux ErrorWrongCode=Code incorrect NoSalesRepresentativeAffected=Aucun commercial particulier affecté ShowCustomer=Show customer @@ -27,4 +29,15 @@ LastDoneTasks=Derni LastRecordedTasks=Dernières actions enregistrées DoneAndToDoTasksFor=Liste des actions commerciales réalisées ou à faire pour DoneAndToDoTasks=Liste des actions commerciales réalisées ou à faire -SendPropalRef=Envoi proposition commerciale %s \ No newline at end of file +SendPropalRef=Envoi proposition commerciale %s +StatusActionToDo=A faire +StatusActionDone=Réalisé +StatusActionInProcess=En cours +ActionAC_TEL=Appel téléphonique +ActionAC_FAX=Envoi fax +ActionAC_PROP=Envoi proposition +ActionAC_EMAIL=Envoi EMail +ActionAC_RDV=Prendre Rendez-vous +ActionAC_FAC=Envoi facturation +ActionAC_REL=Relance facturation +ActionAC_CLO=Close diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index db7c361d938..cc20901ad1d 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -73,6 +73,11 @@ TE_GROUP=Grande soci TE_MEDIUM=PME/PMI TE_ADMIN=Administration TE_OTHER=Autre +StatusProspect-1=Ne pas contacter +StatusProspect0=Jamais contacté +StatusProspect1=A contacter +StatusProspect2=Contact en cours +StatusProspect3=Contact réalisé ChangeDoNotContact=Changer statut à 'Ne pas contacter' ChangeNeverContacted=Changer statut à 'Jamais contacté' ChangeToContact=Changer statut à 'A contacter'