diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 69db41b07dc..a024a27b9ca 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -55,7 +55,7 @@ $NBLINES=4; if ($_POST["action"] == 'classin') { $facture = new Facture($db); - $facture->fetch($facid); + $facture->fetch($_POST["facid"]); $facture->classin($_POST["projetid"]); } /* @@ -214,10 +214,10 @@ if ($_GET["action"] == 'payed' && $user->rights->facture->paiement) $result = $fac->set_payed($_GET["facid"]); } -if ($action == 'canceled' && $user->rights->facture->paiement) +if ($_GET["action"] == 'canceled' && $user->rights->facture->paiement) { $fac = new Facture($db); - $result = $fac->set_canceled($facid); + $result = $fac->set_canceled($_GET["facid"]); } if ($_POST["action"] == 'setremise' && $user->rights->facture->creer) @@ -228,11 +228,10 @@ if ($_POST["action"] == 'setremise' && $user->rights->facture->creer) $fac->set_remise($user, $_POST["remise"]); } - if ($_POST["action"] == 'addligne' && $user->rights->facture->creer) { $fac = new Facture($db); - $fac->fetch($_GET["facid"]); + $fac->fetch($_POST["facid"]); $datestart=''; $dateend=''; if ($_POST["date_startyear"] && $_POST["date_startmonth"] && $_POST["date_startday"]) { @@ -241,7 +240,7 @@ if ($_POST["action"] == 'addligne' && $user->rights->facture->creer) if ($_POST["date_endyear"] && $_POST["date_endmonth"] && $_POST["date_endday"]) { $dateend=$_POST["date_endyear"].'-'.$_POST["date_endmonth"].'-'.$_POST["date_endday"]; } - $result = $fac->addline($_GET["facid"], + $result = $fac->addline($_POST["facid"], $_POST["desc"], $_POST["pu"], $_POST["qty"], @@ -251,12 +250,14 @@ if ($_POST["action"] == 'addligne' && $user->rights->facture->creer) $datestart, $dateend ); + + $_GET["facid"]=$_POST["facid"]; // Pour réaffichage de la fiche en cours d'édition } -if ($action == 'updateligne' && $user->rights->facture->creer) +if ($_POST["action"] == 'updateligne' && $user->rights->facture->creer) { - $fac = new Facture($db,"",$facid); - $fac->fetch($facid); + $fac = new Facture($db,"",$_POST["facid"]); + $fac->fetch($_POST["facid"]); $datestart=''; $dateend=''; if ($_POST["date_startyear"] && $_POST["date_startmonth"] && $_POST["date_startday"]) { @@ -266,7 +267,7 @@ if ($action == 'updateligne' && $user->rights->facture->creer) $dateend=$_POST["date_endyear"].'-'.$_POST["date_endmonth"].'-'.$_POST["date_endday"]; } - $result = $fac->updateline($rowid, + $result = $fac->updateline($_POST["rowid"], $_POST["desc"], $_POST["price"], $_POST["qty"], @@ -274,13 +275,15 @@ if ($action == 'updateligne' && $user->rights->facture->creer) $datestart, $dateend ); + + $_GET["facid"]=$_POST["facid"]; // Pour réaffichage de la fiche en cours d'édition } -if ($action == 'deleteline' && $user->rights->facture->creer) +if ($_GET["action"] == 'deleteline' && $user->rights->facture->creer) { - $fac = new Facture($db,"",$facid); - $fac->fetch($facid); - $result = $fac->deleteline($rowid); + $fac = new Facture($db,"",$_GET["facid"]); + $fac->fetch($_GET["facid"]); + $result = $fac->deleteline($_GET["rowid"]); } if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) @@ -288,7 +291,7 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) if ($user->rights->facture->supprimer ) { $fac = new Facture($db); - $fac->delete($_GET["facid"]); + $fac->delete($_POST["facid"]); $_GET["facid"] = 0 ; } } @@ -298,8 +301,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == yes) */ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') { - $fac = new Facture($db,"",$facid); - if ( $fac->fetch($facid) ) + $fac = new Facture($db,"",$_POST["facid"]); + if ( $fac->fetch($_POST["facid"]) ) { $file = FAC_OUTPUTDIR . "/" . $fac->ref . "/" . $fac->ref . ".pdf"; @@ -377,13 +380,13 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') /* * Générer ou regénérer le PDF */ -if ($action == 'pdf') +if ($_GET["action"] == 'pdf') { /* * Generation de la facture * définit dans /includes/modules/facture/modules_facture.php */ - facture_pdf_create($db, $facid); + facture_pdf_create($db, $_GET["facid"]); } @@ -433,7 +436,7 @@ if ($_GET["action"] == 'create') $soc = new Societe($db); $soc->fetch($obj->idp); - print '