Fix creation of tax payment
This commit is contained in:
parent
ad0fa3c33a
commit
4c23363400
@ -414,7 +414,7 @@ class Account extends CommonObject
|
|||||||
{
|
{
|
||||||
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
$sql = "SELECT code FROM ".MAIN_DB_PREFIX."c_paiement";
|
||||||
$sql.= " WHERE id=".$oper;
|
$sql.= " WHERE id=".$oper;
|
||||||
$sql.= " AND entity = " . getEntity('c_paiement') . ")";
|
$sql.= " AND entity IN (" . getEntity('c_paiement') . ")";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -60,18 +60,21 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
|
|
||||||
if (! $_POST["paiementtype"] > 0)
|
if (! $_POST["paiementtype"] > 0)
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("PaymentMode")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
if ($datepaye == '')
|
if ($datepaye == '')
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("Date"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("Date")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
|
if (! empty($conf->banque->enabled) && ! $_POST["accountid"] > 0)
|
||||||
{
|
{
|
||||||
$mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit"));
|
setEventMessages($langs->trans("ErrorFieldRequired",$langs->transnoentities("AccountToCredit")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
|
$action = 'create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -91,7 +94,8 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
if (count($amounts) <= 0)
|
if (count($amounts) <= 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg='ErrorNoPaymentDefined';
|
setEventMessages($langs->trans("ErrorNoPaymentDefined"), null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -112,18 +116,20 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
$paymentid = $paiement->create($user, (GETPOST('closepaidcontrib')=='on'?1:0));
|
||||||
if ($paymentid < 0)
|
if ($paymentid < 0)
|
||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
$error++;
|
||||||
$error++;
|
setEventMessages($paiement->error, null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)',$_POST['accountid'],'','');
|
$result=$paiement->addPaymentToBank($user,'payment_sc','(SocialContributionPayment)', GETPOST('accountid','int'),'','');
|
||||||
if (! $result > 0)
|
if (! ($result > 0))
|
||||||
{
|
{
|
||||||
$errmsg=$paiement->error;
|
$error++;
|
||||||
$error++;
|
setEventMessages($paiement->error, null, 'errors');
|
||||||
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +147,6 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm=='yes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_GET["action"]='create';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,7 +271,7 @@ if ($action == 'create')
|
|||||||
{
|
{
|
||||||
$objp = $charge;
|
$objp = $charge;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
|
|||||||
@ -159,8 +159,7 @@ if ($action == 'valide')
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/index.php">' . $langs->trans("BackToList") . '</a>';
|
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/sociales/payments.php">' . $langs->trans("BackToList") . '</a>';
|
||||||
$linkback = '';
|
|
||||||
|
|
||||||
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
|
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'id', '');
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user