From bdba8f1f3891883de97bb236b20e1c42267e1a39 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Jun 2015 23:33:25 +0200 Subject: [PATCH] Fix courrent outstanding amount not visible --- htdocs/comm/card.php | 16 +++++++++------- htdocs/compta/facture.php | 13 +++++++++---- htdocs/core/lib/company.lib.php | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6bf5c5a5dca..aa0a2f8b61a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -410,17 +410,19 @@ if ($id > 0) print ''; $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); + if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); // display amount and link to unpaid bill $outstandingBills = $object->get_OutstandingBill(); - if ($outstandingBills != 0) + print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; + print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); + if ($object->outstanding_limit != '') { - print ' ('.$langs->trans("CurrentOutstandingBill"); - print ' '; - print price($outstandingBills, '', $langs, 0, -1, -1, $conf->currency); - print ''; - if ($outstandingBills > $object->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); - print ')'; + if ($outstandingBills > $object->outstanding_limit) + print img_warning($langs->trans("OutstandingBillReached")); + //print ' / ' . price($soc->outstanding_limit); } + print ')'; + print ''; print ''; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a461d1b9c82..518a22ede78 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2502,7 +2502,9 @@ if ($action == 'create') } print '
'; -} else if ($id > 0 || ! empty($ref)) { +} +else if ($id > 0 || ! empty($ref)) +{ /* * Show object in view mode */ @@ -2522,7 +2524,8 @@ if ($action == 'create') $result = $object->fetch_thirdparty(); $soc = new Societe($db); - $soc->fetch($object->socid); + $result=$soc->fetch($object->socid); + if ($result < 0) dol_print_error($db); $selleruserevenustamp = $mysoc->useRevenueStamp(); $totalpaye = $object->getSommePaiement(); @@ -2857,7 +2860,8 @@ if ($action == 'create') $outstandingBills = $soc->get_OutstandingBill(); print ' - ' . $langs->trans('CurrentOutstandingBill') . ': '; print price($outstandingBills, '', $langs, 0, 0, - 1, $conf->currency); - if ($soc->outstanding_limit != '') { + if ($soc->outstanding_limit != '') + { if ($outstandingBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached")); print ' / ' . price($soc->outstanding_limit); @@ -2946,7 +2950,8 @@ if ($action == 'create') } else print '. '; } - if ($absolute_creditnote > 0) { + if ($absolute_creditnote > 0) + { // If validated, we show link "add credit note to payment" if ($object->statut != 1 || $object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) { if ($object->statut == 0 && $object->type != Facture::TYPE_DEPOSIT) { diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index c4385b6324e..69d17aecee4 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -504,7 +504,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='') $projecttmp = new Project($db); $i=0; - $var=false; + $var=true; while ($i < $num) { $obj = $db->fetch_object($result);