Fix: optimize code
Fix: better function name
This commit is contained in:
parent
8ec6346bf3
commit
64986dd12f
@ -1425,12 +1425,9 @@ if ($id > 0 || ! empty($ref))
|
||||
}
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
$object->print_title_list();
|
||||
$object->printLinesList(0,$mysoc,$soc);
|
||||
}
|
||||
|
||||
// Show object lines
|
||||
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||
|
||||
/*
|
||||
* Form to add new line
|
||||
@ -1442,13 +1439,13 @@ if ($id > 0 || ! empty($ref))
|
||||
$var=true;
|
||||
|
||||
// Add free products/services
|
||||
$object->showAddFreeProductForm(0,$mysoc,$soc);
|
||||
$object->formAddFreeProduct(0,$mysoc,$soc);
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
$object->showAddPredefinedProductForm(0,$mysoc,$soc);
|
||||
$object->formAddPredefinedProduct(0,$mysoc,$soc);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
|
||||
@ -1377,8 +1377,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
||||
print_titre($title);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$objectsrc->printOriginTitleList();
|
||||
|
||||
$objectsrc->printOriginLinesList($object);
|
||||
|
||||
print '</table>';
|
||||
@ -1783,13 +1782,8 @@ else
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
$object->print_title_list();
|
||||
$object->printLinesList(1,$mysoc,$soc);
|
||||
}
|
||||
|
||||
$numlines=sizeof($object->lines);
|
||||
// Show object lines
|
||||
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||
|
||||
/*
|
||||
* Form to add new line
|
||||
@ -1800,13 +1794,13 @@ else
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$object->showAddFreeProductForm(1,$mysoc,$soc);
|
||||
$object->formAddFreeProduct(1,$mysoc,$soc);
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
$object->showAddPredefinedProductForm(1,$mysoc,$soc);
|
||||
$object->formAddPredefinedProduct(1,$mysoc,$soc);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
|
||||
@ -1816,7 +1816,6 @@ if ($_GET['action'] == 'create')
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$objectsrc->printOriginTitleList();
|
||||
$objectsrc->printOriginLinesList($object);
|
||||
|
||||
print '</table>';
|
||||
@ -2534,11 +2533,8 @@ else
|
||||
|
||||
print '<table id="tablelines" class="noborder" width="100%">';
|
||||
|
||||
if (!empty($object->lines))
|
||||
{
|
||||
$object->print_title_list();
|
||||
$object->printLinesList(1,$mysoc,$soc);
|
||||
}
|
||||
// Show object lines
|
||||
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||
|
||||
/*
|
||||
* Form to add new line
|
||||
@ -2547,13 +2543,13 @@ else
|
||||
{
|
||||
$var=true;
|
||||
|
||||
$object->showAddFreeProductForm(1,$mysoc,$soc);
|
||||
$object->formAddFreeProduct(1,$mysoc,$soc);
|
||||
|
||||
// Add predefined products/services
|
||||
if ($conf->product->enabled || $conf->service->enabled)
|
||||
{
|
||||
$var=!$var;
|
||||
$object->showAddPredefinedProductForm(1,$mysoc,$soc);
|
||||
$object->formAddPredefinedProduct(1,$mysoc,$soc);
|
||||
}
|
||||
|
||||
// Hook of thirdparty module
|
||||
|
||||
@ -1328,7 +1328,7 @@ class CommonObject
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
* @param $dateSelector 1=Show also date range input fields
|
||||
*/
|
||||
function showAddPredefinedProductForm($dateSelector,$seller,$buyer)
|
||||
function formAddPredefinedProduct($dateSelector,$seller,$buyer)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $html,$bcnd,$var;
|
||||
@ -1343,7 +1343,7 @@ class CommonObject
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
* @param $dateSelector 1=Show also date range input fields
|
||||
*/
|
||||
function showAddFreeProductForm($dateSelector,$seller,$buyer)
|
||||
function formAddFreeProduct($dateSelector,$seller,$buyer)
|
||||
{
|
||||
global $conf,$langs,$object;
|
||||
global $html,$bcnd,$var;
|
||||
@ -1403,14 +1403,17 @@ class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML table with title list
|
||||
* Return HTML with object lines list.
|
||||
* Array $this->lines must be defined.
|
||||
* @param $dateSelector Show date input fields (if service)
|
||||
* @param $seller Object of seller third party
|
||||
* @param uyer Object of buyer third party
|
||||
* TODO Move this into page (into a lib.php file if mutualized. No code for output must be present into a business class).
|
||||
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
|
||||
*/
|
||||
function print_title_list()
|
||||
function printObjectLines($dateSelector=0,$seller,$buyer)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
if ($conf->global->PRODUIT_USE_MARKUP) print '<td align="right" width="80">'.$langs->trans('Markup').'</td>';
|
||||
@ -1423,18 +1426,7 @@ class CommonObject
|
||||
print '<td width="10"> </td>';
|
||||
print '<td nowrap="nowrap"> </td>'; // No width to allow autodim
|
||||
print "</tr>\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML with object lines list.
|
||||
* Array $this->lines must be defined.
|
||||
* @param $dateSelector Show date input fields (if service)
|
||||
* @param $seller Object of seller third party
|
||||
* @param uyer Object of buyer third party
|
||||
* TODO Move this into page (into a lib.php file if mutualized. No code for output must be present into a business class).
|
||||
*/
|
||||
function printLinesList($dateSelector=0,$seller,$buyer)
|
||||
{
|
||||
|
||||
$num = count($this->lines);
|
||||
$var = true;
|
||||
$i = 0;
|
||||
@ -1527,12 +1519,12 @@ class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML table with origin title list
|
||||
* Return HTML with list of origin lines
|
||||
*/
|
||||
function printOriginTitleList()
|
||||
function printOriginLinesList($object)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('Description').'</td>';
|
||||
@ -1540,13 +1532,7 @@ class CommonObject
|
||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Return HTML with list of origin lines
|
||||
*/
|
||||
function printOriginLinesList($object)
|
||||
{
|
||||
|
||||
$num = count($this->lines);
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user