Fix sql error

This commit is contained in:
Laurent Destailleur 2017-08-24 15:39:23 +02:00
parent fbac1cfe1e
commit 7d9a18a63d
2 changed files with 8 additions and 7 deletions

View File

@ -648,12 +648,13 @@ if (empty($reshook))
if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION) if ($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT || $object->type == Facture::TYPE_SITUATION)
{ {
// If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT
$sql = 'SELECT SUM(pf.amount) as total_paiements $sql = 'SELECT SUM(pf.amount) as total_paiements
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid ORDER BY p.datep, p.tms'; WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid';
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) dol_print_error($db);
$res = $db->fetch_object($resql); $res = $db->fetch_object($resql);
$total_paiements = $res->total_paiements; $total_paiements = $res->total_paiements;
@ -4103,11 +4104,11 @@ else if ($id > 0 || ! empty($ref))
if ($objectidnext) { if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>'; print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
} else { } else {
if ($resteapayer == 0) { //if ($resteapayer == 0) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>'; // print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
} else { //} else {
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&amp;action=create&amp;accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&amp;action=create&amp;accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
} //}
} }
} }

View File

@ -107,7 +107,7 @@ SendRemindByMail=Envoyer rappel
DoPayment=Saisir réglement DoPayment=Saisir réglement
DoPaymentBack=Saisir remboursement DoPaymentBack=Saisir remboursement
ConvertToReduc=Convertir en réduction future ConvertToReduc=Convertir en réduction future
ConvertExcessReceivedToReduc=Le trop-perçu a été converti en réduction future ConvertExcessReceivedToReduc=Convertir le trop-perçu en réduction future
EnterPaymentReceivedFromCustomer=Saisie d'un règlement reçu du client EnterPaymentReceivedFromCustomer=Saisie d'un règlement reçu du client
EnterPaymentDueToCustomer=Saisie d'un remboursement d'un avoir client EnterPaymentDueToCustomer=Saisie d'un remboursement d'un avoir client
DisabledBecauseRemainderToPayIsZero=Désactivé car reste à payer est nul DisabledBecauseRemainderToPayIsZero=Désactivé car reste à payer est nul