The deprecated method get_OutstandingBill has been removed. You can use

getOutstandingBills() instead.
This commit is contained in:
Laurent Destailleur 2019-08-29 00:45:02 +02:00
parent c10f755619
commit 05c9e97fe4
7 changed files with 50 additions and 93 deletions

View File

@ -17,6 +17,9 @@ Following changes may create regressions for some external modules, but were nec
* Removed the method liste_array() of project class. It was not used by core code. * Removed the method liste_array() of project class. It was not used by core code.
* The function show_theme() hase been renamed into showSkins() * The function show_theme() hase been renamed into showSkins()
* Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency. * Rename 'module_part' parameter into 'modulepart' into document APIs, for consistency.
* The deprecated method get_OutstandingBill has been removed. You can use getOutstandingBills() instead.
***** ChangeLog for 10.0.1 compared to 10.0.0 ***** ***** ChangeLog for 10.0.1 compared to 10.0.0 *****

View File

@ -2248,7 +2248,8 @@ $formquestion = array_merge($formquestion, array(
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
print '</td><td class="right">'; print '</td><td class="right">';
print price($soc->get_OutstandingBill()) . ' / '; $arrayoutstandingbills = $soc->getOutstandingBills();
print price($arrayoutstandingbills['opened']) . ' / ';
print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -2138,7 +2138,8 @@ if ($action == 'create' && $usercancreate)
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
print '</td><td>'; print '</td><td>';
print price($soc->get_OutstandingBill()) . ' / '; $arrayoutstandingbills = $soc->getOutstandingBills();
print price($arrayoutstandingbills['opened']) . ' / ';
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';

View File

@ -2761,7 +2761,8 @@ if ($action == 'create')
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $soc->id . '">';
// Outstanding Bill // Outstanding Bill
$outstandingBills = $soc->get_OutstandingBill(); $arrayoutstandingbills = $soc->getOutstandingBills();
$outstandingBills = $arrayoutstandingbills['opened'];
print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
if ($soc->outstanding_limit != '') if ($soc->outstanding_limit != '')

View File

@ -343,7 +343,8 @@ if ($action == 'create')
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
print '<input type="hidden" name="socid" value="' . $soc->id . '">'; print '<input type="hidden" name="socid" value="' . $soc->id . '">';
// Outstanding Bill // Outstanding Bill
$outstandingBills = $soc->get_OutstandingBill(); $arrayoutstandingbills = $soc->getOutstandingBills();
$outstandingBills = $arrayoutstandingbills['opened'];
print ' (' . $langs->trans('CurrentOutstandingBill') . ': '; print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency); print price($outstandingBills, '', $langs, 0, 0, -1, $conf->currency);
if ($soc->outstanding_limit != '') if ($soc->outstanding_limit != '')

View File

@ -3913,20 +3913,17 @@ class Societe extends CommonObject
while($obj=$this->db->fetch_object($resql)) { while($obj=$this->db->fetch_object($resql)) {
$tmpobject->id=$obj->rowid; $tmpobject->id=$obj->rowid;
if ($obj->fk_statut != Facture::STATUS_DRAFT // Not a draft
&& ! ($obj->fk_statut == Facture::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice
if ($obj->fk_statut != 0 // Not a draft
&& ! ($obj->fk_statut == 3 && $obj->close_code == 'replaced') // Not a replaced invoice
) )
{ {
$outstandingTotal+= $obj->total_ht; $outstandingTotal+= $obj->total_ht;
$outstandingTotalIncTax+= $obj->total_ttc; $outstandingTotalIncTax+= $obj->total_ttc;
} }
if ($obj->paye == 0 if ($obj->paye == 0
&& $obj->fk_statut != 0 // Not a draft && $obj->fk_statut != Facture::STATUS_DRAFT // Not a draft
&& $obj->fk_statut != 3 // Not abandonned && $obj->fk_statut != Facture::STATUS_ABANDONED // Not abandonned
&& $obj->fk_statut != 2) // Not classified as paid && $obj->fk_statut != Facture::STATUS_CLOSED) // Not classified as paid
//$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason //$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason
{ {
$paiement = $tmpobject->getSommePaiement(); $paiement = $tmpobject->getSommePaiement();
@ -3947,54 +3944,6 @@ class Societe extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return amount of bill not paid
*
* @return int Amount in debt for thirdparty
* @deprecated
* @see getOutstandingBills()
*/
public function get_OutstandingBill()
{
// phpcs:enable
/* Accurate value of remain to pay is to sum remaintopay for each invoice
$paiement = $invoice->getSommePaiement();
$creditnotes=$invoice->getSumCreditNotesUsed();
$deposits=$invoice->getSumDepositsUsed();
$alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT');
$remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT');
*/
$sql = "SELECT rowid, total_ttc FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE fk_soc = ". $this->id;
$sql .= " AND entity IN (".getEntity('invoice').")";
$sql .= " AND paye = 0";
$sql .= " AND fk_statut <> 0"; // Not a draft
$sql .= " AND entity IN (".getEntity('invoice').")";
//$sql .= " AND (fk_statut <> 3 OR close_code <> 'abandon')"; // Not abandonned for undefined reason
$sql .= " AND fk_statut <> 3"; // Not abandonned
$sql .= " AND fk_statut <> 2"; // Not clasified as paid
dol_syslog("get_OutstandingBill", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
{
$outstandingAmount = 0;
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$tmpobject=new Facture($this->db);
while($obj=$this->db->fetch_object($resql)) {
$tmpobject->id=$obj->rowid;
$paiement = $tmpobject->getSommePaiement();
$creditnotes = $tmpobject->getSumCreditNotesUsed();
$deposits = $tmpobject->getSumDepositsUsed();
$outstandingAmount+= $obj->total_ttc - $paiement - $creditnotes - $deposits;
}
return $outstandingAmount;
}
else
return 0;
}
/** /**
* Return label of status customer is prospect/customer * Return label of status customer is prospect/customer
* *
@ -4007,7 +3956,7 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Renvoi le libelle d'un statut donne * Return the label of the customer/prospect status
* *
* @param int $statut Id statut * @param int $statut Id statut
* @return string Libelle du statut * @return string Libelle du statut

View File

@ -1616,7 +1616,8 @@ if ($action == 'create')
print '<tr><td>'; print '<tr><td>';
print $langs->trans('OutstandingBill'); print $langs->trans('OutstandingBill');
print '</td><td class=right colspan="3">'; print '</td><td class=right colspan="3">';
print price($soc->get_OutstandingBill()) . ' / '; $arrayoutstandingbills = $soc->getOutstandingBills('supplier');
$outstandingBills = $arrayoutstandingbills['opened'];
print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency); print price($soc->outstanding_limit, 0, '', 1, - 1, - 1, $conf->currency);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';