From 90e68247892467885bf8448004ec2c783013f3df Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Feb 2008 12:56:01 +0000 Subject: [PATCH] Fix: If ref not provided, form is shown again with correct supplier. --- htdocs/fourn/facture/fiche.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 2895b7b6395..1650d10d7ea 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -18,15 +18,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/fourn/facture/fiche.php \ingroup facture, fournisseur - \brief Page des la fiche facture fournisseur - \version $Revision$ + \brief Page for supplier invoice card + \version $Id$ */ require_once('./pre.inc.php'); @@ -126,27 +124,21 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) { if ($_POST['facnumber']) { - $datefacture = mktime(12,0,0, + $datefacture = dolibarr_mktime(12,0,0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $tva = 0; - $amo = price2num($_POST['amount']); - $tva = (price2num($_POST['tva_tx']) * $amo) / 100 ; - $remise = 0; - $total = $tva + $amo; - $db->begin(); // Creation facture $facfou = new FactureFournisseur($db); $facfou->ref = $_POST['facnumber']; - $facfou->socid = $_POST['socid']; + $facfou->socid = $_POST['socid']; $facfou->libelle = $_POST['libelle']; $facfou->date = $datefacture; - $facfou->date_echeance = mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); + $facfou->date_echeance = dolibarr_mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); $facfou->note = $_POST['note']; $facid = $facfou->create($user); @@ -182,6 +174,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) $db->rollback(); $mesg='
'.$facfou->error.'
'; $_GET['action']='create'; + $_GET['socid']=$_POST['socid']; } else { @@ -195,12 +188,14 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) $db->rollback(); $mesg='
'.$facfou->error.'
'; $_GET['action']='create'; + $_GET['socid']=$_POST['socid']; } } else { $mesg='
'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Ref')).'
'; $_GET['action']='create'; + $_GET['socid']=$_POST['socid']; } }