Move warning at correct place.
Fix: Reset of amount was not working
This commit is contained in:
parent
b7190d2609
commit
8ec50fce23
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -198,7 +198,7 @@ if ($id > 0)
|
||||
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
|
||||
@ -272,7 +272,7 @@ if ($id > 0)
|
||||
{
|
||||
print '<td>'.$langs->trans('Skype').'</td><td colspan="3">'.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
// Assujeti a TVA ou pas
|
||||
print '<tr>';
|
||||
print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';
|
||||
@ -389,7 +389,7 @@ if ($id > 0)
|
||||
print '<td>';
|
||||
print $form->editfieldkey("OutstandingBill",'OutstandingBill',$object->outstanding_limit,$object,$user->rights->societe->creer);
|
||||
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 '</tr>';
|
||||
}
|
||||
|
||||
@ -2083,6 +2083,16 @@ if ($action == 'create')
|
||||
print '<td colspan="2">';
|
||||
print $soc->getNomUrl(1);
|
||||
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>';
|
||||
}
|
||||
else
|
||||
@ -2312,23 +2322,6 @@ if ($action == 'create')
|
||||
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
|
||||
$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
|
||||
@ -2877,7 +2870,18 @@ else if ($id > 0 || ! empty($ref))
|
||||
else
|
||||
{
|
||||
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>';
|
||||
|
||||
@ -3317,23 +3321,6 @@ else if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
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
|
||||
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>';
|
||||
|
||||
@ -136,7 +136,7 @@ class Form
|
||||
|
||||
// Check parameters
|
||||
if (empty($typeofdata)) return 'ErrorBadParameter';
|
||||
|
||||
|
||||
// When option to edit inline is activated
|
||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && ! preg_match('/^select;|datehourpicker/',$typeofdata)) // FIXME add jquery timepicker
|
||||
{
|
||||
@ -194,9 +194,9 @@ class Form
|
||||
$ret.='</form>'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
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 ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day');
|
||||
elseif ($typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour');
|
||||
|
||||
@ -398,6 +398,7 @@ InActivity=Open
|
||||
ActivityCeased=Closed
|
||||
ActivityStateFilter=Activity status
|
||||
ProductsIntoElements=List of products into
|
||||
CurrentOutstandingBill=Current outstanding bill
|
||||
OutstandingBill=Max. for outstanding bill
|
||||
OutstandingBillReached=Reached max. for outstanding bill
|
||||
# Monkey
|
||||
|
||||
@ -398,6 +398,7 @@ InActivity=En activité
|
||||
ActivityCeased=Clos
|
||||
ActivityStateFilter=Statut d'activité
|
||||
ProductsIntoElements=Liste des produits dans les %s
|
||||
CurrentOutstandingBill=Montant encours
|
||||
OutstandingBill=Montant max. en attente
|
||||
OutstandingBillReached=Montant max. endetté
|
||||
# Monkey
|
||||
|
||||
@ -2821,24 +2821,27 @@ class Societe extends CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Clean parameters
|
||||
$outstanding = price2num($this->outstanding_limit);
|
||||
|
||||
// Positionne l'encours de facturaiton
|
||||
// Set outstanding amount
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " outstanding_limit=".$outstanding;
|
||||
$sql.= " outstanding_limit= ".($outstanding!=''?$outstanding:'null');
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_outstanding sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user