From 1ddbe41cffe997c1cab0daa83c8902e1be5ee637 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 1 Jul 2011 16:18:10 +0000 Subject: [PATCH] Fix: jquery payment not stable --- htdocs/compta/ajaxpayment.php | 16 +++++----- htdocs/compta/paiement.php | 58 +++++++++++++++++------------------ 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index e52efc22fac..cc7174a2c54 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011 Auguria * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,20 +24,22 @@ require('../main.inc.php'); +print_r($_POST); + // Getting the posted keys=>values, sanitize the ones who are from text inputs - // from text inputs : total amount +// from text inputs : total amount $amountPayment = price2num($_POST['amountPayment']); $amountPayment = is_numeric($amountPayment)? $amountPayment : 0; // is a value - // from text inputs : invoice amount payment +// from text inputs : invoice amount payment $amounts = $_POST['amounts']; // is an array (need a foreach) -foreach ($amounts as $key => &$value) +foreach ($amounts as $key => $value) { $value = price2num($value); - if(!is_numeric($value))unset($amounts[$key]); + if (!is_numeric($value)) unset($amounts[$key]); } - // from dolibarr's object (no need to check) +// from dolibarr's object (no need to check) $remains = $_POST['remains']; - // from DOM elements : imgId (equals invoice id) +// from DOM elements : imgId (equals invoice id) $currentInvId = $_POST['imgClicked']; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 9c37d7b3b22..ec6ad090caa 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -24,7 +24,7 @@ * \file htdocs/compta/paiement.php * \ingroup compta * \brief Page to create a payment - * \version $Id: paiement.php,v 1.107 2011/07/01 15:19:32 cdelambert Exp $ + * \version $Id: paiement.php,v 1.108 2011/07/01 16:18:10 hregis Exp $ */ require('../main.inc.php'); @@ -272,6 +272,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie jQuery(\'.fieldrequireddyn\').removeClass(\'fieldrequired\'); } }); + }); + '."\n"; + } + + if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) + { + print "\n".''."\n"; + }); + '."\n"; } print '
'; @@ -367,18 +367,18 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('Comments').''; $rowspan=5; - if ($conf->use_javascript_ajax) $rowspan++; + if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) $rowspan++; // Payment mode print ''.$langs->trans('PaymentMode').''; $html->select_types_paiements((GETPOST('paiementcode')?GETPOST('paiementcode'):$facture->mode_reglement_code),'paiementcode','',2); print "\n"; print ''; - print ''; + print ''; print ''; // Payment amount - if ($conf->use_javascript_ajax) + if (! empty($conf->global->MAIN_JS_ON_PAYMENT)) { print ''.$langs->trans('AmountPayment').''; print ''; @@ -682,5 +682,5 @@ if (! GETPOST('action')) $db->close(); -llxFooter('$Date: 2011/07/01 15:19:32 $ - $Revision: 1.107 $'); +llxFooter('$Date: 2011/07/01 16:18:10 $ - $Revision: 1.108 $'); ?>