Fix: Error management. Payment date is not preselected to avoid errors.
This commit is contained in:
parent
09ae698e43
commit
e3377b1e29
@ -24,7 +24,7 @@
|
|||||||
\ingroup compta
|
\ingroup compta
|
||||||
\brief Page to create a payment
|
\brief Page to create a payment
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
include_once('./pre.inc.php');
|
include_once('./pre.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/paiement.class.php');
|
||||||
@ -47,8 +47,8 @@ $amountsresttopay=array();
|
|||||||
$addwarning=0;
|
$addwarning=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action add_paiement et confirm_paiement
|
* Action add_paiement et confirm_paiement
|
||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement')
|
if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
@ -104,11 +104,17 @@ if ($_POST['action'] == 'add_paiement' || $_POST['action'] == 'confirm_paiement'
|
|||||||
$fiche_erreur_message = '<div class="error">'.$langs->transnoentities('ErrorFieldRequired',$langs->trans('Amount')).'</div>';
|
$fiche_erreur_message = '<div class="error">'.$langs->transnoentities('ErrorFieldRequired',$langs->trans('Amount')).'</div>';
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($datepaye))
|
||||||
|
{
|
||||||
|
$fiche_erreur_message = '<div class="error">'.$langs->trans('ErrorFieldRequired',$langs->transnoentities('Date')).'</div>';
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action add_paiement
|
* Action add_paiement
|
||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'add_paiement')
|
if ($_POST['action'] == 'add_paiement')
|
||||||
{
|
{
|
||||||
if ($error)
|
if ($error)
|
||||||
@ -120,8 +126,8 @@ if ($_POST['action'] == 'add_paiement')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action confirm_paiement
|
* Action confirm_paiement
|
||||||
*/
|
*/
|
||||||
if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
|
if ($_POST['action'] == 'confirm_paiement' && $_POST['confirm'] == 'yes')
|
||||||
{
|
{
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -214,7 +220,7 @@ if ($user->societe_id > 0)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
@ -268,11 +274,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
|
|||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="2">'.$facture->client->getNomUrl(4)."</td></tr>\n";
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||||
if (!empty($_POST['remonth']) && !empty($_POST['reday']) && !empty($_POST['reyear']))
|
$html->select_date(-1,'','','',0,"add_paiement");
|
||||||
$sel_date=mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
|
||||||
else
|
|
||||||
$sel_date='';
|
|
||||||
$html->select_date($sel_date,'','','','',"add_paiement");
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td>'.$langs->trans('Comments').'</td></tr>';
|
print '<td>'.$langs->trans('Comments').'</td></tr>';
|
||||||
|
|
||||||
@ -438,17 +440,17 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'confirm_paiement' || $_P
|
|||||||
// Message d'erreur
|
// Message d'erreur
|
||||||
if ($fiche_erreur_message)
|
if ($fiche_erreur_message)
|
||||||
{
|
{
|
||||||
print '<tr><td colspan="3" align="center">'.$fiche_erreur_message.'</td></tr>';
|
print $fiche_erreur_message;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Formulaire confirmation
|
// Formulaire confirmation
|
||||||
if ($_POST["action"] == 'add_paiement')
|
if ($_POST["action"] == 'add_paiement')
|
||||||
{
|
{
|
||||||
// print '<tr><td colspan="3">';
|
// print '<tr><td colspan="3">';
|
||||||
print '<br />';
|
print '<br />';
|
||||||
$text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie));
|
$text=$langs->trans('ConfirmCustomerPayment',$totalpaiement,$langs->trans("Currency".$conf->monnaie));
|
||||||
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion);
|
$html->form_confirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion);
|
||||||
// print '</td></tr>';
|
// print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user