Qual: Optimisation, on appel qu'une fois getCurrentDiscount

This commit is contained in:
Laurent Destailleur 2006-06-24 13:50:22 +00:00
parent ab45524961
commit 5a4a20ab12

View File

@ -796,6 +796,7 @@ if ($_GET['action'] == 'create')
$remise_percent = $soc->remise_client; $remise_percent = $soc->remise_client;
$remise_absolue = 0; $remise_absolue = 0;
} }
$absolute_discount=$soc->getCurrentDiscount();
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
@ -822,7 +823,6 @@ if ($_GET['action'] == 'create')
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="2">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getCurrentDiscount();
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
@ -1355,7 +1355,7 @@ else
{ {
$soc = new Societe($db, $fac->socidp); $soc = new Societe($db, $fac->socidp);
$soc->fetch($fac->socidp); $soc->fetch($fac->socidp);
$avoir_en_cours=$soc->getCurrentDiscount(); $absolute_discount=$soc->getCurrentDiscount();
$author = new User($db); $author = new User($db);
if ($fac->user_author) if ($fac->user_author)
@ -1454,7 +1454,6 @@ else
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client); if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
$absolute_discount=$soc->getCurrentDiscount();
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
@ -1912,7 +1911,7 @@ else
print '<input type="hidden" name="facid" value="'.$fac->id.'">'; print '<input type="hidden" name="facid" value="'.$fac->id.'">';
print '<tr class="liste_total"><td>'; print '<tr class="liste_total"><td>';
print $langs->trans('CustomerAbsoluteDiscount'); print $langs->trans('CustomerAbsoluteDiscount');
if ($fac->brouillon) print ' <font style="font-weight: normal">('.($avoir_en_cours?$langs->trans("CompanyHasAbsoluteDiscount",$avoir_en_cours,$langs->trans("Currency".$conf->monnaie)):$langs->trans("CompanyHasNoAbsoluteDiscount")).')</font>'; if ($fac->brouillon) print ' <font style="font-weight: normal">('.($absolute_discount?$langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie)):$langs->trans("CompanyHasNoAbsoluteDiscount")).')</font>';
print '</td>'; print '</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';