From 964d282b4a72923c1c16c4830ce9f8e395088b22 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 5 Dec 2007 13:37:39 +0000 Subject: [PATCH] Fix: uniformisation du code --- htdocs/comm/fiche.php | 10 ++-- htdocs/comm/prospect/fiche.php | 52 +++++++++++++-------- htdocs/fourn/fiche.php | 83 +++++++++++++++++++++------------- 3 files changed, 91 insertions(+), 54 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index e9f26f1a902..f139d3faf05 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -33,7 +33,7 @@ require_once("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); @@ -847,9 +847,9 @@ if ($socid > 0) $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; $sql.= " c.code as acode, c.libelle,"; $sql.= " u.login, u.rowid,"; - $sql.= " sp.name, sp.firstname"; + $sql.= " sp.name, sp.firstname"; $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; $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"; @@ -928,7 +928,7 @@ if ($socid > 0) print ''; // Libellé - print "$obj->label"; + print ''.$obj->label.''; // Contact pour cette action if ($obj->fk_contact > 0) @@ -951,7 +951,7 @@ if ($socid > 0) print ''; // Statut - print ''.$actionstatic->LibStatut($obj->percent,3).''; + print ''.$actionstatic->LibStatut($obj->percent,3).''; print "\n"; $i++; diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index fb78a97d6c6..925f8adbaf9 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -32,7 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/prospect.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); -require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); +if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); $langs->load('companies'); $langs->load('projects'); @@ -90,6 +90,7 @@ llxHeader(); if ($socid > 0) { + $actionstatic=new ActionComm($db); $societe = new Prospect($db, $socid); $result = $societe->fetch($socid); if ($result < 0) @@ -316,7 +317,8 @@ if ($socid > 0) * */ print ''; - print ''; + print ''; + print ''; $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code as acode, c.libelle, u.login, 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 "; @@ -383,13 +385,12 @@ if ($socid > 0) } else { - print ''; + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print ''; } - print ""; + print ''; // Contact pour cette action if ($obj->fk_contact) { @@ -401,6 +402,10 @@ if ($socid > 0) } print ''; + + // Statut + print ''; + print "\n"; $i++; } @@ -415,9 +420,14 @@ if ($socid > 0) * Listes des actions effectuées */ print '
'.$langs->trans("ActionsToDo").' 
'.$langs->trans("ActionsToDo").' 
'.img_object($langs->trans("ShowAction"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''.$actionstatic->getNomUrl(1,16).'$obj->label'.$obj->label.''.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'; - print ''; + print ''; + print ''; - $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, c.code as acode, c.libelle, a.propalrowid, a.fk_user_author, fk_contact, u.login, u.rowid "; + $sql = "SELECT a.id, a.label,"; + $sql.= " ".$db->pdate("a.datea")." as da,"; + $sql.= " a.propalrowid, a.fk_user_author, a.fk_contact, a.percent,"; + $sql.= " c.code as acode, c.libelle,"; + $sql.= " u.login, 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 = ".$societe->id; $sql .= " AND u.rowid = a.fk_user_author"; @@ -459,12 +469,11 @@ if ($socid > 0) print ''; // Action - print ''; print ''; print ''; + + // Libellé + print ''; // Contact pour cette action if ($obj->fk_contact) @@ -489,11 +501,15 @@ if ($socid > 0) print ''; } - print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; + print ''; + + // Statut + print ''; + print "\n"; $i++; } - $db->free(); + $db->free($result); } else { diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 4bf57899918..474be7f0e0a 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -31,6 +31,7 @@ require('./pre.inc.php'); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $user->getrights(); @@ -74,6 +75,8 @@ if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0 * Mode fiche */ $societe = new Fournisseur($db); +$actionstatic = new ActionComm($db); +$contactstatic = new Contact($db); if ( $societe->fetch($socid) ) { @@ -367,14 +370,17 @@ if ( $societe->fetch($socid) ) */ print_titre($langs->trans("ActionsOnCompany")); print '
'.$langs->trans("ActionsDone").'
'.$langs->trans("ActionsDone").'
 '; - print ''.img_object($langs->trans("ShowTask"),"task"); - $transcode=$langs->trans("Action".$obj->acode); - $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle); - print $libelle; - print ''; + print ''; + $actionstatic->code=$obj->acode; + $actionstatic->libelle=$obj->libelle; + $actionstatic->id=$obj->id; + print ''.$actionstatic->getNomUrl(1,16).''; @@ -476,6 +485,9 @@ if ($socid > 0) } else print ' '; print ''.$obj->label.' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'; - print ''; + print ''; - $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code as acode, c.libelle, u.login, 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 = ".$societe->id; - $sql .= " AND u.rowid = a.fk_user_author"; - $sql .= " AND c.id=a.fk_action AND a.percent < 100"; - $sql .= " ORDER BY a.datep DESC, a.id DESC"; + $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code as acode, c.libelle, u.login,"; + $sql.= " a.propalrowid, a.fk_user_author, a.fk_contact, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; + $sql.= " WHERE a.fk_soc = ".$societe->id; + $sql.= " AND u.rowid = a.fk_user_author"; + $sql.= " AND c.id=a.fk_action AND a.percent < 100"; + $sql.= " ORDER BY a.datep DESC, a.id DESC"; $result=$db->query($sql); if ($result) @@ -442,17 +448,24 @@ if ( $societe->fetch($socid) ) print ''; // Contact pour cette action - if ($obj->fk_contact) - { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } else { - print ''; - } + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } // Auteur print ''; + + // Statut + print ''; + print "\n"; $i++; } @@ -467,13 +480,16 @@ if ( $societe->fetch($socid) ) * Listes des actions effectuées */ print '
'.$langs->trans("ActionsToDoShort").' 
'.$langs->trans("ActionsToDoShort").' 
'.$obj->label.''.img_object($langs->trans("ShowContact"),"contact").' '.$contact->getFullName($langs).' '.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'
'; - print ''; + print ''; + print ''; - $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da,"; + $sql = "SELECT a.id, a.label, ".$db->pdate("a.datea")." as da, a.percent,"; $sql.= " a.propalrowid, a.fk_facture, a.fk_user_author, a.fk_contact,"; $sql.= " c.code as acode, c.libelle,"; - $sql.= " u.login, u.rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u "; + $sql.= " u.login, u.rowid,"; + $sql.= " sp.name, sp.firstname"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; $sql.= " WHERE a.fk_soc = ".$societe->id; $sql.= " AND u.rowid = a.fk_user_author"; $sql.= " AND c.id=a.fk_action AND a.percent = 100"; @@ -527,7 +543,7 @@ if ( $societe->fetch($socid) ) print ''; print ''; - // Objet li + // Objet lie print ''; - // Libell + // Libelle print ""; // Contact pour cette action - if ($obj->fk_contact) - { - $contact = new Contact($db); - $contact->fetch($obj->fk_contact); - print ''; - } - else - { - print ''; - } + if ($obj->fk_contact > 0) + { + $contactstatic->name=$obj->name; + $contactstatic->firstname=$obj->firstname; + $contactstatic->id=$obj->fk_contact; + print ''; + } + else + { + print ''; + } // Auteur print ''; + + // Statut + print ''; + print "\n"; $i++; }
'.$langs->trans("ActionsDoneShort").'
'.$langs->trans("ActionsDoneShort").'
'; if ($obj->propalrowid) { @@ -544,23 +560,28 @@ if ( $societe->fetch($socid) ) else print ' '; print '$obj->label'.img_object($langs->trans("ShowContact"),"contact").' '.$contact->getFullName($langs).' '.$contactstatic->getNomUrl(1).' '.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''.$actionstatic->LibStatut($obj->percent,3).'