diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 4882ce77f3c..3044338f7a8 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -573,16 +573,14 @@ if ($action == 'create') else /* *************************************************************************** */ /* */ -/* */ +/* Mode fiche */ /* */ /* *************************************************************************** */ { - - if ($facid > 0) - { - + if ($_GET["facid"] > 0) + { $fac = New Facture($db); - if ( $fac->fetch($facid, $user->societe_id) > 0) + if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) { $soc = new Societe($db, $fac->socidp); $soc->fetch($fac->socidp); @@ -598,7 +596,7 @@ else */ if ($action == 'delete') { - $html->form_confirm("$PHP_SELF?facid=$facid","Supprimer la facture","Etes-vous sûr de vouloir supprimer cette facture ?","confirm_delete"); + $html->form_confirm("$PHP_SELF?facid=$fac->id","Supprimer la facture","Etes-vous sûr de vouloir supprimer cette facture ?","confirm_delete"); } /* @@ -608,7 +606,7 @@ else if ($action == 'valid') { $numfa = facture_get_num($soc); - $html->form_confirm("$PHP_SELF?facid=$facid","Valider la facture","Etes-vous sûr de vouloir valider cette facture avec le numéro $numfa ?","confirm_valid"); + $html->form_confirm("$PHP_SELF?facid=$fac->id","Valider la facture","Etes-vous sûr de vouloir valider cette facture avec le numéro $numfa ?","confirm_valid"); } /* @@ -634,7 +632,7 @@ else } else { - print 'Classer la facture'; + print 'Classer la facture'; } print " Paiements"; @@ -653,7 +651,7 @@ else * Paiements */ $sql = "SELECT ".$db->pdate("datep")." as dp, p.amount, c.libelle as paiement_type, p.num_paiement, p.rowid"; - $sql .= " FROM llx_paiement as p, c_paiement as c WHERE p.fk_facture = $facid AND p.fk_paiement = c.id"; + $sql .= " FROM llx_paiement as p, c_paiement as c WHERE p.fk_facture = $fac->id AND p.fk_paiement = c.id"; $result = $db->query($sql); if ($result) @@ -680,7 +678,7 @@ else print ''.price($objp->amount)."$_MONNAIE\n"; if (! $fac->paye && $user->rights->facture->paiement) { - print 'Del'; + print 'Del'; } print ""; $total = $total + $objp->amount; @@ -729,7 +727,7 @@ else if ($fac->brouillon == 1 && $user->rights->facture->creer) { - print '
'; + print ''; print ''; print '\n"; if ($fac->statut == 0 && $user->rights->facture->creer) { - print ''; - print ''; } @@ -805,7 +803,7 @@ else if ($action == 'editline' && $rowid == $objp->rowid) { - print ""; + print "id\" method=\"post\">"; print ''; print ''; print ""; @@ -836,7 +834,7 @@ else */ if ($fac->statut == 0 && $user->rights->facture->creer) { - print ""; + print ''; // echo '
Remise'; print '%'; @@ -743,7 +741,7 @@ else */ $sql = "SELECT l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_taux, l.remise_percent, l.subprice"; - $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $facid ORDER BY l.rowid"; + $sql .= " FROM llx_facturedet as l WHERE l.fk_facture = $fac->id ORDER BY l.rowid"; $result = $db->query($sql); if ($result) @@ -790,10 +788,10 @@ else print ''.price($objp->subprice)."'; + print ''; print img_edit(); print ''; + print ''; print img_delete(); print '
'; print ""; print ''; @@ -871,11 +869,11 @@ else if ($fac->statut == 0 && $user->rights->facture->supprimer) { - print ""; + print ""; } elseif ($fac->statut == 1 && abs($resteapayer) > 0 && $user->rights->facture->envoyer) { - print ""; + print ""; } else { @@ -884,7 +882,7 @@ else if ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->paiement) { - print ""; + print ""; } else { @@ -895,7 +893,7 @@ else { if ($user->rights->facture->paiement) { - print ""; + print ""; } else { @@ -904,7 +902,7 @@ else } elseif ($fac->statut == 1 && $resteapayer > 0 && $user->rights->facture->envoyer) { - print ""; + print ""; } else { @@ -913,7 +911,7 @@ else if ($fac->statut > 0) { - print ''; + print ''; } else { @@ -924,7 +922,7 @@ else { if ($user->rights->facture->valider) { - print ""; + print ""; } else { @@ -935,7 +933,7 @@ else { if ($user->rights->facture->creer) { - print ""; + print ""; } else { @@ -977,7 +975,7 @@ else * */ $sql = "SELECT ".$db->pdate("a.datea")." as da, a.note"; - $sql .= " FROM llx_actioncomm as a WHERE a.fk_soc = $fac->socidp AND a.fk_action in (9,10) AND a.fk_facture = $facid"; + $sql .= " FROM llx_actioncomm as a WHERE a.fk_soc = $fac->socidp AND a.fk_action in (9,10) AND a.fk_facture = $fac->id"; $result = $db->query($sql); if ($result) @@ -1020,7 +1018,7 @@ else */ if ($action == 'classer') { - print "

\n"; + print "

id\">\n"; print ''; print '

DescriptionSupprimerid&action=delete\">SupprimerEnvoyerid&action=presend\">EnvoyerEmettre un paiementid&action=create\">Emettre un paiementClasser 'Payée'id&action=payed\">Classer 'Payée'Envoyer une relanceid&action=prerelance\">Envoyer une relanceRécurrenteRécurrenteValiderid&action=valid\">ValiderGénérer la factureid&action=pdf\">Générer la facture
'; print '
Projet'; @@ -1043,7 +1041,7 @@ else $replytomail = $user->email; $from_mail = $replytomail; - print "\n"; + print "id&action=send\">\n"; print ''; print ''; @@ -1070,7 +1068,7 @@ else $replytomail = $user->email; $from_mail = $replytomail; - print "\n"; + print "id\">\n"; print ''; print ''; print ''; @@ -1095,7 +1093,7 @@ else */ $sql = "SELECT ".$db->pdate("p.datep")." as dp, p.price, p.ref, p.rowid as propalid"; - $sql .= " FROM llx_propal as p, llx_fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $facid"; + $sql .= " FROM llx_propal as p, llx_fa_pr as fp WHERE fp.fk_propal = p.rowid AND fp.fk_facture = $fac->id"; $result = $db->query($sql); if ($result)