From 39b992484f9f05472ad7eb99dfea9a0a86e37986 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 7 Nov 2004 14:40:02 +0000 Subject: [PATCH] Fix: La liste des produits services ne doit pas s'afficher si les modules ne sont pas actifs --- htdocs/comm/addpropal.php | 223 +++++++++++++++++++++----------------- 1 file changed, 123 insertions(+), 100 deletions(-) diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 4dde08f0506..9a60e7c2d41 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -20,10 +20,20 @@ * $Source$ * */ + +/*! + \file htdocs/comm/prospect/prospect.php + \ingroup prospect + \brief Page de la liste des prospects + \version $Revision$ +*/ + require("./pre.inc.php"); require("./propal_model_pdf.class.php"); +$langs->load("propal"); $langs->load("projects"); +$langs->load("companies"); $user->getrights('propale'); @@ -39,7 +49,7 @@ if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/module llxHeader(); -print_titre("Nouvelle proposition commerciale"); +print_titre($langs->trans("NewProp")); /* * @@ -71,43 +81,41 @@ if ($_GET["action"] == 'create') print "
id."\" method=\"post\">"; print ""; - print ''; - - print ''; + print '
Société'.$soc->nom.'
'; + print ''; + print ''; - print ""; - + print ''; print ''; - print ''; - print ''."\n"; - print ''; + print ""; + + print ''; + print ''; + /* - * * Destinataire de la propale - * */ - print "'; - /* - * - * Projet associé - * - */ - print ''; + print ''; + if ($conf->projet->enabled) { + + /* + * Projet associé + */ + print ''; + } + else { + print ''; + } - print ''; print ''; print '
'.$langs->trans("Ref").''; print $langs->trans("Comments").'
Date"; - print_date_select(); - print "
'.$langs->trans("Company").''.$soc->nom.''; print ''; + print '
Auteur'.$user->fullname.'
Numéro
Validité jours
".$langs->trans("Date").""; + print_date_select(); + print "
'.$langs->trans("Author").''.$user->fullname.'
Durée de validité '.$langs->trans("days").'
Contact\n"; + print "
".$langs->trans("Contact")."\n"; $sql = "SELECT p.idp, p.name, p.firstname, p.poste, p.phone, p.fax, p.email FROM ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " WHERE p.fk_soc = ".$soc->id; if ( $db->query($sql) ) { - $langs->load("companies"); - $i = 0 ; $numdest = $db->num_rows(); if ($numdest==0) { - print 'Cette societe n\'a pas de contact, veuillez en créer un avant de faire votre proposition commerciale
'; - print ''.$langs->trans("AddContact").''; + print 'Cette societe n\'a pas de contact, veuillez en créer un avant de faire votre proposition commerciale
'; + print ''.$langs->trans("AddContact").''; } else { @@ -119,9 +127,11 @@ if ($_GET["action"] == 'create') print ''; + print '>'.$contact->firstname.' '.$contact->name; + if ($contact->email) { print ' <'.$contact->email.'>'; } + print ''; $i++; } print ''; @@ -129,54 +139,59 @@ if ($_GET["action"] == 'create') $db->free(); } - else - { - print $db->error(); - } - - - print '
Projet'; - print ''; - - $sql = "SELECT p.rowid, p.title FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc =".$soc->id; - - if ( $db->query($sql) ) - { - $i = 0 ; - $numprojet = $db->num_rows(); - - if ($numprojet==0) - { - print 'Cette société n\'a pas de projet.
'; - print 'id.'&action=create>Créer un projet'; - } - else - { - print ''; - } - $db->free(); - } else { dolibarr_print_error($db); } + + print '
'.$langs->trans("Project").''; + print ''; + + $sql = "SELECT p.rowid, p.title FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc =".$soc->id; + + if ( $db->query($sql) ) + { + $i = 0 ; + $numprojet = $db->num_rows(); + + if ($numprojet==0) + { + print 'Cette société n\'a pas de projet.
'; + print 'id.'&action=create>'.$langs->trans("AddProject").''; + } + else + { + print ''; + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } + + print '
 Modèle'; $html = new Form($db); @@ -184,46 +199,54 @@ if ($_GET["action"] == 'create') $html->select_array("modelpdf",$modelpdf->liste_array(),PROPALE_ADDON_PDF); print "
"; - /* - * - * Liste des elements - * - */ - $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p "; - $sql .= " WHERE envente = 1"; - $sql .= " ORDER BY ref DESC"; - if ( $db->query($sql) ) - { - $opt = ""; - if ($result) - { - $num = $db->num_rows(); $i = 0; - while ($i < $num) - { - $objp = $db->fetch_object(); - $opt .= "\n"; - $i++; - } - } - $db->free(); - } - else - { - print $db->error(); - } + print '
'; - print_titre("Services/Produits"); + if ($conf->produit->enabled || $conf->service->enabled) { + /* + * Liste les produits/services prédéfinis + */ + $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p "; + $sql .= " WHERE envente = 1"; + $sql .= " ORDER BY ref DESC"; + if ( $db->query($sql) ) + { + $opt = ""; + if ($result) + { + $num = $db->num_rows(); $i = 0; + while ($i < $num) + { + $objp = $db->fetch_object(); + $opt .= "\n"; + $i++; + } + } + $db->free(); + } + else + { + dolibarr_print_error($db); + } + + $titre=$langs->trans("ProductsAndServices"); + $lib=$langs->trans("Product").'/'.$langs->trans("Services"); + + print_titre($titre); + + print ''; + print ''; + for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++) + { + print ''; + print ''; + print ''; + } + + print "
'.$lib.''.$langs->trans("Qty").'Remise
%
"; - print ''; - print ''; - for ($i = 1 ; $i <= PROPALE_NEW_FORM_NB_PRODUCT ; $i++) - { - print ''; - print ''; - print ''; - } - - print "
ProduitQuan.Remise
%
"; + print '
'; + } + /* * Si il n'y a pas de contact pour la societe on ne permet pas la creation de propale */