diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 1197595e43e..e8aa11b80c4 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2001-2004 Rodolphe Quiedeville * * 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 @@ -27,7 +27,7 @@ if (defined("PROPALE_ADDON") && is_readable(DOL_DOCUMENT_ROOT ."/includes/module require(DOL_DOCUMENT_ROOT ."/includes/modules/propale/".PROPALE_ADDON.".php"); } -$sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = $socidp;"; +$sql = "SELECT s.nom, s.idp, s.prefix_comm FROM ".MAIN_DB_PREFIX."societe as s WHERE s.idp = ".$_GET["socidp"]; $result = $db->query($sql); if ($result) @@ -49,7 +49,7 @@ print_titre("Nouvelle proposition commerciale"); * Creation d'une nouvelle propale * */ -if ($action == 'create') +if ($_GET["action"] == 'create') { $obj = PROPALE_ADDON; $modPropale = new $obj; @@ -66,12 +66,12 @@ if ($action == 'create') } } - print "
"; + print ""; print ""; print ''; - print ''; + print ''; print '"; @@ -91,44 +91,53 @@ if ($action == 'create') * Destinataire de la propale * */ - print "'; /* * * Projet associé * */ - print ''; print ''; print '
Société'.$objsoc->nom.'
Société'.$objsoc->nom.''; print "Commentaires
Contact
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 = ".$_GET["socidp"]; if ( $db->query($sql) ) { $i = 0 ; $numdest = $db->num_rows(); - while ($i < $numdest) + + if ($numdest==0) { - $contact = $db->fetch_object( $i); - print ''; - $i++; + print 'Cette societe n\'a pas de contact, veuillez en créer un avant de faire votre proposition commerciale
'; + print 'Ajouter un contact'; } + else + { + print "'; + } + $db->free(); } else { print $db->error(); } - print ''; + - if ($numdest==0) - { - print 'Cette societe n\'a pas de contact, veuillez en creer un avant de faire de propale
'; - print 'Ajouter un contact'; - } print '
Projet
Projet'; print ''; $sql = "SELECT p.rowid, p.title FROM ".MAIN_DB_PREFIX."projet as p WHERE p.fk_soc = $socidp"; @@ -137,11 +146,23 @@ if ($action == 'create') { $i = 0 ; $numprojet = $db->num_rows(); - while ($i < $numprojet) + + if ($numprojet==0) { - $projet = $db->fetch_object($i); - print ""; - $i++; + print 'Cette société n\'a pas de projet.
'; + print 'Créer un projet'; + } + else + { + print ''; } $db->free(); } @@ -149,12 +170,8 @@ if ($action == 'create') { print $db->error(); } - print ''; - if ($numprojet==0) - { - print 'Cette societe n\'a pas de projet.
'; - print 'Créer un projet'; - } + + print '
Modèle';