Move warning at correct place.
Fix: Reset of amount was not working
This commit is contained in:
parent
b7190d2609
commit
8ec50fce23
@ -389,7 +389,7 @@ if ($id > 0)
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer);
|
print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer);
|
||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',price($object->outstanding_limit));
|
print $form->editfieldval("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer,'amount',($object->outstanding_limit != '' ? price($object->outstanding_limit) : ''));
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2083,6 +2083,16 @@ if ($action == 'create')
|
|||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
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
|
||||||
|
$outstandigBills=$soc->get_OutstandingBill();
|
||||||
|
print ' ('.$langs->trans('CurrentOutstandingBill').': ';
|
||||||
|
print price($outstandigBills,'',$langs,0,0,-1,$conf->currency);
|
||||||
|
if ($soc->outstanding_limit != '')
|
||||||
|
{
|
||||||
|
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||||
|
print ' / '.price($soc->outstanding_limit);
|
||||||
|
}
|
||||||
|
print ')';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2312,23 +2322,6 @@ if ($action == 'create')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty
|
|
||||||
/*
|
|
||||||
if ($soc->outstanding_limit)
|
|
||||||
{
|
|
||||||
$outstandigBills=$soc->get_OutstandingBill();
|
|
||||||
// Outstanding Bill
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans('OutstandingBill');
|
|
||||||
print '</td><td align="right" colspan="2">';
|
|
||||||
print price($outstandigBills);
|
|
||||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
|
||||||
print ' / '.price($soc->outstanding_limit);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Other attributes
|
// Other attributes
|
||||||
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
$parameters=array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"');
|
||||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||||
@ -2877,7 +2870,18 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
print ' '.$soc->getNomUrl(1,'compta');
|
print ' '.$soc->getNomUrl(1,'compta');
|
||||||
print ' (<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>)';
|
print ' ';
|
||||||
|
print '(<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?socid='.$object->socid.'">'.$langs->trans('OtherBills').'</a>';
|
||||||
|
// Outstanding Bill
|
||||||
|
$outstandigBills=$soc->get_OutstandingBill();
|
||||||
|
print ' - '.$langs->trans('CurrentOutstandingBill').': ';
|
||||||
|
print price($outstandigBills,'',$langs,0,0,-1,$conf->currency);
|
||||||
|
if ($soc->outstanding_limit != '')
|
||||||
|
{
|
||||||
|
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||||
|
print ' / '.price($soc->outstanding_limit);
|
||||||
|
}
|
||||||
|
print ')';
|
||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
@ -3317,23 +3321,6 @@ else if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// TODO This is nt a roperty of invoice so should not appears here but as a warning on thirdparty
|
|
||||||
/*
|
|
||||||
if ($soc->outstandingbill)
|
|
||||||
{
|
|
||||||
$outstandingBills=$soc->get_OutstandingBill();
|
|
||||||
// Outstanding Bill
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans('OutstandingBill');
|
|
||||||
print '</td><td align="right">';
|
|
||||||
print price($outstandingBills);
|
|
||||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
|
||||||
print ' / '.price($soc->outstandingbill);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
print '<tr><td>'.$langs->trans('AmountHT').'</td>';
|
||||||
print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>';
|
print '<td align="right" colspan="3" nowrap>'.price($object->total_ht,1,'',1,-1,-1,$conf->currency).'</td></tr>';
|
||||||
|
|||||||
@ -196,7 +196,7 @@ class Form
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
|
if ($typeofdata == 'email') $ret.=dol_print_email($value,0,0,0,0,1);
|
||||||
elseif ($typeofdata == 'amount') $ret.=price($value,'',$langs);
|
elseif ($typeofdata == 'amount') $ret.=($value != '' ? price($value,'',$langs) : '');
|
||||||
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
|
elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value);
|
||||||
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
||||||
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
|
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
|
||||||
|
|||||||
@ -398,6 +398,7 @@ InActivity=Open
|
|||||||
ActivityCeased=Closed
|
ActivityCeased=Closed
|
||||||
ActivityStateFilter=Activity status
|
ActivityStateFilter=Activity status
|
||||||
ProductsIntoElements=List of products into
|
ProductsIntoElements=List of products into
|
||||||
|
CurrentOutstandingBill=Current outstanding bill
|
||||||
OutstandingBill=Max. for outstanding bill
|
OutstandingBill=Max. for outstanding bill
|
||||||
OutstandingBillReached=Reached max. for outstanding bill
|
OutstandingBillReached=Reached max. for outstanding bill
|
||||||
# Monkey
|
# Monkey
|
||||||
|
|||||||
@ -398,6 +398,7 @@ InActivity=En activité
|
|||||||
ActivityCeased=Clos
|
ActivityCeased=Clos
|
||||||
ActivityStateFilter=Statut d'activité
|
ActivityStateFilter=Statut d'activité
|
||||||
ProductsIntoElements=Liste des produits dans les %s
|
ProductsIntoElements=Liste des produits dans les %s
|
||||||
|
CurrentOutstandingBill=Montant encours
|
||||||
OutstandingBill=Montant max. en attente
|
OutstandingBill=Montant max. en attente
|
||||||
OutstandingBillReached=Montant max. endetté
|
OutstandingBillReached=Montant max. endetté
|
||||||
# Monkey
|
# Monkey
|
||||||
|
|||||||
@ -2821,25 +2821,28 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
$outstanding = price2num($this->outstanding_limit);
|
$outstanding = price2num($this->outstanding_limit);
|
||||||
|
|
||||||
// Positionne l'encours de facturaiton
|
// Set outstanding amount
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||||
$sql.= " outstanding_limit=".$outstanding;
|
$sql.= " outstanding_limit= ".($outstanding!=''?$outstanding:'null');
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::set_outstanding sql=".$sql);
|
dol_syslog(get_class($this)."::set_outstanding sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$this->db->rollback();
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
$this->error=$this->db->lasterror();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user