Fix: optimize code
Fix: better function name
This commit is contained in:
parent
8ec6346bf3
commit
64986dd12f
@ -1426,11 +1426,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
print '<table id="tablelines" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
if (!empty($object->lines))
|
// Show object lines
|
||||||
{
|
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||||
$object->print_title_list();
|
|
||||||
$object->printLinesList(0,$mysoc,$soc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Form to add new line
|
* Form to add new line
|
||||||
@ -1442,13 +1439,13 @@ if ($id > 0 || ! empty($ref))
|
|||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
// Add free products/services
|
// Add free products/services
|
||||||
$object->showAddFreeProductForm(0,$mysoc,$soc);
|
$object->formAddFreeProduct(0,$mysoc,$soc);
|
||||||
|
|
||||||
// Add predefined products/services
|
// Add predefined products/services
|
||||||
if ($conf->product->enabled || $conf->service->enabled)
|
if ($conf->product->enabled || $conf->service->enabled)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$object->showAddPredefinedProductForm(0,$mysoc,$soc);
|
$object->formAddPredefinedProduct(0,$mysoc,$soc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
|
|||||||
@ -1378,7 +1378,6 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$objectsrc->printOriginTitleList();
|
|
||||||
$objectsrc->printOriginLinesList($object);
|
$objectsrc->printOriginLinesList($object);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -1783,13 +1782,8 @@ else
|
|||||||
|
|
||||||
print '<table id="tablelines" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
if (!empty($object->lines))
|
// Show object lines
|
||||||
{
|
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||||
$object->print_title_list();
|
|
||||||
$object->printLinesList(1,$mysoc,$soc);
|
|
||||||
}
|
|
||||||
|
|
||||||
$numlines=sizeof($object->lines);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Form to add new line
|
* Form to add new line
|
||||||
@ -1800,13 +1794,13 @@ else
|
|||||||
{
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$object->showAddFreeProductForm(1,$mysoc,$soc);
|
$object->formAddFreeProduct(1,$mysoc,$soc);
|
||||||
|
|
||||||
// Add predefined products/services
|
// Add predefined products/services
|
||||||
if ($conf->product->enabled || $conf->service->enabled)
|
if ($conf->product->enabled || $conf->service->enabled)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$object->showAddPredefinedProductForm(1,$mysoc,$soc);
|
$object->formAddPredefinedProduct(1,$mysoc,$soc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook of thirdparty module
|
// Hook of thirdparty module
|
||||||
|
|||||||
@ -1816,7 +1816,6 @@ if ($_GET['action'] == 'create')
|
|||||||
|
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
$objectsrc->printOriginTitleList();
|
|
||||||
$objectsrc->printOriginLinesList($object);
|
$objectsrc->printOriginLinesList($object);
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -2534,11 +2533,8 @@ else
|
|||||||
|
|
||||||
print '<table id="tablelines" class="noborder" width="100%">';
|
print '<table id="tablelines" class="noborder" width="100%">';
|
||||||
|
|
||||||
if (!empty($object->lines))
|
// Show object lines
|
||||||
{
|
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);
|
||||||
$object->print_title_list();
|
|
||||||
$object->printLinesList(1,$mysoc,$soc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Form to add new line
|
* Form to add new line
|
||||||
@ -2547,13 +2543,13 @@ else
|
|||||||
{
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
$object->showAddFreeProductForm(1,$mysoc,$soc);
|
$object->formAddFreeProduct(1,$mysoc,$soc);
|
||||||
|
|
||||||
// Add predefined products/services
|
// Add predefined products/services
|
||||||
if ($conf->product->enabled || $conf->service->enabled)
|
if ($conf->product->enabled || $conf->service->enabled)
|
||||||
{
|
{
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
$object->showAddPredefinedProductForm(1,$mysoc,$soc);
|
$object->formAddPredefinedProduct(1,$mysoc,$soc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook of thirdparty module
|
// 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.
|
* 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
|
* @param $dateSelector 1=Show also date range input fields
|
||||||
*/
|
*/
|
||||||
function showAddPredefinedProductForm($dateSelector,$seller,$buyer)
|
function formAddPredefinedProduct($dateSelector,$seller,$buyer)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$object;
|
global $conf,$langs,$object;
|
||||||
global $html,$bcnd,$var;
|
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.
|
* 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
|
* @param $dateSelector 1=Show also date range input fields
|
||||||
*/
|
*/
|
||||||
function showAddFreeProductForm($dateSelector,$seller,$buyer)
|
function formAddFreeProduct($dateSelector,$seller,$buyer)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$object;
|
global $conf,$langs,$object;
|
||||||
global $html,$bcnd,$var;
|
global $html,$bcnd,$var;
|
||||||
@ -1403,11 +1403,14 @@ 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).
|
* 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;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -1423,18 +1426,7 @@ class CommonObject
|
|||||||
print '<td width="10"> </td>';
|
print '<td width="10"> </td>';
|
||||||
print '<td nowrap="nowrap"> </td>'; // No width to allow autodim
|
print '<td nowrap="nowrap"> </td>'; // No width to allow autodim
|
||||||
print "</tr>\n";
|
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);
|
$num = count($this->lines);
|
||||||
$var = true;
|
$var = true;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@ -1527,9 +1519,9 @@ class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return HTML table with origin title list
|
* Return HTML with list of origin lines
|
||||||
*/
|
*/
|
||||||
function printOriginTitleList()
|
function printOriginLinesList($object)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
@ -1540,13 +1532,7 @@ class CommonObject
|
|||||||
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
print '<td align="right">'.$langs->trans('PriceUHT').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
print '<td align="right">'.$langs->trans('Qty').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
|
print '<td align="right">'.$langs->trans('ReductionShort').'</td></tr>';
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return HTML with list of origin lines
|
|
||||||
*/
|
|
||||||
function printOriginLinesList($object)
|
|
||||||
{
|
|
||||||
$num = count($this->lines);
|
$num = count($this->lines);
|
||||||
$var = true;
|
$var = true;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user