diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e4f0b1fb53e..947d3f3cc19 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -104,7 +104,7 @@ if ($HTTP_POST_VARS["action"] == 'add') if ($id) { propale_pdf_create($db, $id, $HTTP_POST_VARS["modelpdf"]); - $propalid = $id; + $_GET["propalid"] = $id; } } @@ -236,12 +236,17 @@ if ($_GET["propalid"]) $propal = new Propal($db); $propal->fetch($_GET["propalid"]); - /* - * - */ - print ""; - print ""; - print "
Proposition commerciale : $propal->ref
"; + $societe = new Societe($db); + $societe->fetch($propal->soc_id); + + $head[0][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id; + $head[0][1] = "Proposition commerciale : $propal->ref"; + $h = 1; + $a = 0; + $head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id; + $head[$h][1] = "Note"; + + dolibarr_fiche_head($head, $a); /* * Confirmation de la suppression de la propale @@ -277,18 +282,18 @@ if ($_GET["propalid"]) print ""; print ''; + print ''.$societe->nom.''; print ''; - print '"; - if ($obj->fk_projet) + if ($propal->projet_id) { $projet = new Project($db); - $projet->fetch($obj->fk_projet); + $projet->fetch($propal->projet_id); print ''; @@ -367,7 +372,7 @@ if ($_GET["propalid"]) { print ""; } - print "\n"; + print "\n"; $sql = "SELECT pt.rowid, p.label as product, p.ref, pt.price, pt.qty, p.rowid as prodid, pt.tva_tx, pt.remise_percent, pt.subprice"; $sql .= " FROM ".MAIN_DB_PREFIX."propaldet as pt, ".MAIN_DB_PREFIX."product as p WHERE pt.fk_product = p.rowid AND pt.fk_propal = $propal->id"; @@ -391,16 +396,12 @@ if ($_GET["propalid"]) print "\n"; print ''; print ''; - if ($obj->statut == 0 && $user->rights->propale->creer) + if ($propal->statut == 0 && $user->rights->propale->creer) { print ''; } - else - { - print ''; - } print ""; $i++; @@ -424,7 +425,7 @@ if ($_GET["propalid"]) print "\n"; print ''; print ""; - if ($obj->statut == 0 && $user->rights->propale->creer) + if ($propal->statut == 0 && $user->rights->propale->creer) { print '
Société'; - if ($objp->client == 1) + if ($societe->client == 1) { - $url ='fiche.php?socid='.$obj->idp; + $url ='fiche.php?socid='.$societe->id; } else { - $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$obj->idp; + $url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id; } - print ''.$obj->nom.'Statut'.$obj->lst.'
Date'.strftime("%A %d %B %Y",$obj->dp); + print '
Date'.strftime("%A %d %B %Y",$propal->date); if ($propal->fin_validite) { print " (".strftime("%d %B %Y",$propal->fin_validite).")"; @@ -304,10 +309,10 @@ if ($_GET["propalid"]) print 'Note :
'. nl2br($propal->note)."
Projet'; print ''; print $projet->title.'
 
".$objp->qty."'.$objp->remise_percent.' %'.price($objp->subprice).''; print img_delete(); print '-
".$objp->qty."'.$objp->remise_percent.' %".price($objp->subprice)."'; print img_delete(); @@ -439,7 +440,7 @@ if ($_GET["propalid"]) } } - if ($obj->statut == 0 && $user->rights->propale->creer) + if ($propal->statut == 0 && $user->rights->propale->creer) { $sql = "SELECT p.rowid,p.label,p.ref,p.price FROM ".MAIN_DB_PREFIX."product as p WHERE p.envente=1 ORDER BY p.nbvente DESC LIMIT 20"; // RyXéo on a ORDER BY p.ref et pas de limit @@ -508,102 +509,71 @@ if ($_GET["propalid"]) /* * Actions */ - if ($obj->statut < 2) + print ''; + if ($propal->statut < 2) { - print '

'; + print '

'; - if ($obj->statut == 0) + if ($propal->statut == 0) { if ($user->rights->propale->supprimer) { - print "
"; - } - else - { - print ""; + print "id&action=delete\">Supprimer"; } + } else { - if ($obj->statut == 1 && $user->rights->propale->cloturer) + if ($propal->statut == 1 && $user->rights->propale->cloturer) { - print ""; - } - else - { - print ""; + print "id&action=statut\">Cloturer"; } } - print ''; + /* * */ - if ($obj->statut < 2 && $user->rights->propale->creer) + if ($propal->statut < 2 && $user->rights->propale->creer) { - print '"; - } - else - { - print ''; + print 'id&action=pdf\">Générer"; } + /* * */ - if ($obj->statut == 1) + if ($propal->statut == 1) { $file = PROPALE_OUTPUTDIR. "/$obj->ref/$obj->ref.pdf"; if (file_exists($file)) { if ($user->rights->propale->envoyer) { - print ""; - } - else - { - print ''; + print "id&action=presend\">Envoyer la proposition"; } + } - else - { - print ''; - } - } - else - { - print ""; } /* * */ - if ($obj->statut == 0) + if ($propal->statut == 0) { if ($user->rights->propale->valider) { - print ""; - } - else - { - print ''; + print "id&valid=1\">Valider"; } + } - elseif ($obj->statut == 1) + elseif ($propal->statut == 1) { if ($user->rights->propale->creer) { - print ""; - } - else - { - print ''; + print "id&action=modif\">Modifier"; } } - else - { - print ''; - } - print "
id&action=delete\">Supprimer-id&action=statut\">Cloturer--id&action=pdf\">Générer-"; - print "id&action=presend\">Envoyer la proposition-! Proposition non génerée !-id&valid=1\">Valider-id&action=modif\">Modifier--
"; + + print ""; } /* @@ -612,13 +582,13 @@ if ($_GET["propalid"]) */ if ($action == 'send') { - $file = PROPALE_OUTPUTDIR . "/$obj->ref/$obj->ref.pdf"; + $file = PROPALE_OUTPUTDIR . "/$propal->ref/$propal->ref.pdf"; if (file_exists($file)) { - $subject = "Notre proposition commerciale $obj->ref"; + $subject = "Notre proposition commerciale $propal->ref"; $filepath[0] = $file ; - $filename[0] = "$obj->ref.pdf"; + $filename[0] = "$propal->ref.pdf"; $mimetype[0] = "application/pdf"; $filepath[1] = $_FILES['addedfile']['tmp_name']; $filename[1] = $_FILES['addedfile']['name']; @@ -662,7 +632,7 @@ if ($_GET["propalid"]) print ''; - $file = PROPALE_OUTPUTDIR . "/$obj->ref/$obj->ref.pdf"; + $file = PROPALE_OUTPUTDIR . "/$propal->ref/$propal->ref.pdf"; if (file_exists($file)) { print ""; @@ -761,7 +731,7 @@ if ($_GET["propalid"]) $from_name = $user->fullname ; //$conf->propal->fromtoname; $from_mail = $user->email; //conf->propal->fromtomail; - $message = "Veuillez trouver ci-joint notre proposition commerciale $obj->ref\n\nCordialement\n\n"; + $message = "Veuillez trouver ci-joint notre proposition commerciale $propal->ref\n\nCordialement\n\n"; print "id&action=send\">\n"; print "\n";
PDF