From 72c56ce6767f8c4a864962082b5134e6ecd6aeec Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 24 Jun 2003 20:53:25 +0000 Subject: [PATCH] bug fix code cleaning --- htdocs/compta/propal.php3 | 128 +++++++++++++++++++++++--------------- 1 file changed, 78 insertions(+), 50 deletions(-) diff --git a/htdocs/compta/propal.php3 b/htdocs/compta/propal.php3 index 628767fb080..c15bb2597a2 100644 --- a/htdocs/compta/propal.php3 +++ b/htdocs/compta/propal.php3 @@ -39,13 +39,16 @@ $db = new Db(); if ($action == 'setstatut') { /* - * Cloture de la propale + * Classée la facture comme facturée */ $propal = new Propal($db); $propal->id = $propalid; $propal->cloture($user->id, $statut, $note); -} elseif ( $action == 'delete' ) { +} + +if ( $action == 'delete' ) + { $sql = "DELETE FROM llx_propal WHERE rowid = $propalid;"; if ( $db->query($sql) ) { @@ -63,6 +66,7 @@ if ($action == 'setstatut') $propalid = 0; $brouillon = 1; } + /* * * Mode fiche @@ -100,9 +104,9 @@ if ($propalid) $color1 = "#e0e0e0"; - print ""; + print '
'; - print ''; + print ''; print ""; // @@ -146,9 +150,9 @@ if ($propalid) * */ print ""; - $file = $conf->propal->outputdir. "/$obj->ref/$obj->ref.pdf"; + $file = PROPALE_OUTPUTDIR. "/$obj->ref/$obj->ref.pdf"; if (file_exists($file)) { - print ''; + print ''; } print ''; /* @@ -161,19 +165,20 @@ if ($propalid) print "
'.translate("Company").''.$obj->nom.'
Société'.$obj->nom.'Note :
". nl2br($obj->note)."
PDF'.$obj->ref.'.pdf
'.$obj->ref.'.pdf
"; - if ($action == 'statut') { - print "
"; - print ""; - print "'; - print '

'; - print "
"; - } - + if ($action == 'statut') + { + print "
"; + print ""; + print "'; + print '

'; + print "
"; + } + print ""; /* @@ -183,40 +188,63 @@ if ($propalid) /* * Factures associees */ - $sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.author, f.paye"; + $sql = "SELECT f.facnumber, f.amount,".$db->pdate("f.datef")." as df, f.rowid as facid, f.fk_user_author, f.paye"; $sql .= " FROM llx_facture as f, llx_fa_pr as fp WHERE fp.fk_facture = f.rowid AND fp.fk_propal = $propalid"; $result = $db->query($sql); - if ($result) { - $num = $db->num_rows(); - $i = 0; $total = 0; - print "
Facture(s) associée(s)
"; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - - $var=True; - while ($i < $num) { - $objp = $db->fetch_object( $i); - $var=!$var; - print ""; - print "\n"; - print "\n"; - print "\n"; - print ''; - print ""; - $total = $total + $objp->amount; - $i++; + if ($result) + { + $num = $db->num_rows(); + $i = 0; $total = 0; + print "
"; + if ($num > 1) + { + print_titre("Factures associées"); + } + else + { + print_titre("Facture associée"); + } + print '
NumDateAuteurPrix
facid\">$objp->facnumber"; - if ($objp->paye) { print " (payée)"; } - print "".strftime("%d %B %Y",$objp->df)."$objp->author'.price($objp->amount).'
'; + print ""; + print ""; + print ""; + print ""; + print ''; + print "\n"; + + $var=True; + while ($i < $num) + { + $objp = $db->fetch_object( $i); + $var=!$var; + print ""; + print "\n"; + print "\n"; + if ($objp->fk_user_author <> $user->id) + { + $fuser = new User($db, $objp->fk_user_author); + $fuser->fetch(); + print "\n"; + } + else + { + print "\n"; + } + print ''; + print ""; + $total = $total + $objp->amount; + $i++; + } + print "\n"; + print "
NumDateAuteurPrix
facid\">$objp->facnumber"; + if ($objp->paye) + { + print " (payée)"; + } + print "".strftime("%d %B %Y",$objp->df)."".$fuser->fullname."".$user->fullname."'.price($objp->amount).'
Total : $total Euros HT
"; + $db->free(); } - print "Total : $total Euros HT\n"; - print ""; - $db->free(); - } print ""; /* * Actions @@ -226,7 +254,7 @@ if ($propalid) if ($obj->statut == 2) { - print ''; + print ''; print "Emettre une facture"; } else