From 2f4ff66c43507c791309eddcc1e18585a72b3fd0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 20 Jan 2017 14:10:57 +0100
Subject: [PATCH] Minor fixes

---
 htdocs/comm/card.php                      |  8 ++++++--
 htdocs/compta/facture.php                 |  4 +++-
 htdocs/core/class/commoninvoice.class.php | 12 ++++++++----
 htdocs/langs/en_US/bills.lang             |  8 +++++---
 htdocs/theme/eldy/style.css.php           |  3 +++
 htdocs/theme/md/style.css.php             |  3 +++
 6 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php
index d37cb327ec5..495105ee78c 100644
--- a/htdocs/comm/card.php
+++ b/htdocs/comm/card.php
@@ -776,7 +776,9 @@ if ($id > 0)
 
 			    print '<tr class="liste_titre">';
 				print '<td colspan="6"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).'</td>';
-				print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td></tr></table></td>';
+				print '<td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/contrat/list.php?socid='.$object->id.'">'.$langs->trans("AllContracts").' <span class="badge">'.$num.'</span></a></td>';
+				//print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/contract/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
+				print '</tr></table></td>';
 				print '</tr>';
 			}
 			$i = 0;
@@ -837,7 +839,9 @@ if ($id > 0)
 		        print '<table class="noborder" width="100%">';
 
 			    print '<tr class="liste_titre">';
-				print '<td colspan="4"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td></tr></table></td>';
+				print '<td colspan="3"><table width="100%" class="nobordernopadding"><tr><td>'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).'</td><td align="right"><a class="notasortlink" href="'.DOL_URL_ROOT.'/fichinter/list.php?socid='.$object->id.'">'.$langs->trans("AllInterventions").' <span class="badge">'.$num.'</span></td>';
+				print '<td width="20px" align="right"><a href="'.DOL_URL_ROOT.'/fichinter/stats/index.php?socid='.$object->id.'">'.img_picto($langs->trans("Statistics"),'stats').'</a></td>';
+				print '</tr></table></td>';
 				print '</tr>';
 				$var=!$var;
 			}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 91267578197..16fdc406db9 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -3736,6 +3736,8 @@ else if ($id > 0 || ! empty($ref))
     } 
     else // Credit note
     {
+        $cssforamountpaymentcomplete='';
+        
         // Total already paid back
         print '<tr><td colspan="' . $nbcols . '" align="right">';
         print $langs->trans('AlreadyPaidBack');
@@ -3751,7 +3753,7 @@ else if ($id > 0 || ! empty($ref))
         else
             print $langs->trans('ExcessPaydBack');
         print ' :</td>';
-        print '<td align="right" bgcolor="#f0f0f0"><b>' . price($sign * $resteapayeraffiche) . '</b></td>';
+        print '<td align="right"'.($resteapayeraffiche?' class="amountremaintopayback"':(' class="'.$cssforamountpaymentcomplete.'"')).'>' . price($sign * $resteapayeraffiche) . '</td>';
         print '<td class="nowrap">&nbsp;</td></tr>';
 
         // Sold credit note
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 30ea6639196..05cf0b4c3cb 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -233,7 +233,7 @@ abstract class CommonInvoice extends CommonObject
 	 *	@param      int		$status        	Id status
 	 *	@param      int		$mode          	0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto
 	 *	@param		integer	$alreadypaid	0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise)
-	 *	@param		int		$type			Type facture
+	 *	@param		int		$type			Type invoice
 	 *	@return     string        			Libelle du statut
 	 */
 	function LibStatut($paye,$status,$mode=0,$alreadypaid=-1,$type=0)
@@ -255,8 +255,8 @@ abstract class CommonInvoice extends CommonObject
 			}
 			else
 			{
-				if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted');
-				elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted');
+				if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted');       // credit note
+				elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted');             // deposit invoice
 				else return $langs->trans('Bill'.$prefix.'StatusPaid');
 			}
 		}
@@ -340,7 +340,11 @@ abstract class CommonInvoice extends CommonObject
 				if ($status == 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusDraft').' </span>'.img_picto($langs->trans('BillStatusDraft'),'statut0');
 				if (($status == 3 || $status == 2) && $alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusCanceled').' </span>'.img_picto($langs->trans('BillStatusCanceled'),'statut5');
 				if (($status == 3 || $status == 2) && $alreadypaid > 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' </span>'.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7');
-				if ($alreadypaid <= 0) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
+				if ($alreadypaid <= 0) 
+				{
+				    if ($type == 2) return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' </span>'.img_picto($langs->trans('StatusNotRefunded'),'statut1');
+				    return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusNotPaid').' </span>'.img_picto($langs->trans('BillStatusNotPaid'),'statut1');
+				}
 				return '<span class="xhideonsmartphone">'.$langs->trans('Bill'.$prefix.'StatusStarted').' </span>'.img_picto($langs->trans('BillStatusStarted'),'statut3');
 			}
 			else
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index f16fdf25413..ae5b3a3be1e 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -113,22 +113,24 @@ BillStatus=Invoice status
 StatusOfGeneratedInvoices=Status of generated invoices
 BillStatusDraft=Draft (needs to be validated)
 BillStatusPaid=Paid
-BillStatusPaidBackOrConverted=Paid or converted into discount
+BillStatusPaidBackOrConverted=Refund or converted into discount
 BillStatusConverted=Paid (ready for final invoice)
 BillStatusCanceled=Abandoned
 BillStatusValidated=Validated (needs to be paid)
 BillStatusStarted=Started
 BillStatusNotPaid=Not paid
+BillStatusNotRefunded=Not refunded
 BillStatusClosedUnpaid=Closed (unpaid)
 BillStatusClosedPaidPartially=Paid (partially)
 BillShortStatusDraft=Draft
 BillShortStatusPaid=Paid
-BillShortStatusPaidBackOrConverted=Processed
+BillShortStatusPaidBackOrConverted=Refund or converted
 BillShortStatusConverted=Processed
 BillShortStatusCanceled=Abandoned
 BillShortStatusValidated=Validated
 BillShortStatusStarted=Started
 BillShortStatusNotPaid=Not paid
+BillShortStatusNotRefunded=Not refunded
 BillShortStatusClosedUnpaid=Closed
 BillShortStatusClosedPaidPartially=Paid (partially)
 PaymentStatusToValidShort=To validate
@@ -203,7 +205,7 @@ AlreadyPaidNoCreditNotesNoDeposits=Already paid (without credit notes and deposi
 Abandoned=Abandoned
 RemainderToPay=Remaining unpaid
 RemainderToTake=Remaining amount to take
-RemainderToPayBack=Remaining amount to pay back
+RemainderToPayBack=Remaining amount to refund
 Rest=Pending
 AmountExpected=Amount claimed
 ExcessReceived=Excess received
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 249a77a2258..5e354590eb8 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -606,6 +606,9 @@ div.myavailability {
 	color: #880000;
 	font-weight: bold;
 }
+.amountremaintopayback {
+	font-weight: bold;
+}
 .savingdocmask {
 	margin-top: 6px;
 	margin-bottom: 12px;
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 07d02674611..2698b258e65 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -583,6 +583,9 @@ div.myavailability {
 	color: #880000;
 	font-weight: bold;
 }
+.amountremaintopayback {
+	font-weight: bold;
+}
 .savingdocmask {
 	margin-top: 6px;
 	margin-bottom: 12px;
-- 
GitLab