Qual: dissociation treatment for greater flexibility

This commit is contained in:
Regis Houssin 2010-07-01 12:01:21 +00:00
parent 12fc4438ca
commit c753597c02
2 changed files with 316 additions and 285 deletions

View File

@ -1407,9 +1407,20 @@ if ($id > 0 || ! empty($ref))
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Milestone module
if ($conf->milestone->enabled)
{
$milestone = new Milestone($db);
$milestoneListArray = $milestone->getObjectMilestonesArray($propal);
}
// Show lines // Show lines
$lines = $propal->getLinesArray(); $lines = $propal->getLinesArray();
if (! empty($lines) ) print_lines($propal, $lines); if (! empty($lines) )
{
print_title_list();
print_lines_list($propal, $lines);
}
/* /*
* Form to add new line * Form to add new line

View File

@ -111,17 +111,13 @@ function propal_prepare_head($propal)
} }
/** /**
* \brief Return HTML table with list of propal lines * \brief Return HTML table with title list
* \param propal Object propal * \param propal Object propal
* \param lines Array of propal lines * \param lines Array of propal lines
*/ */
function print_lines($propal,$lines) function print_title_list()
{ {
global $db; global $conf,$langs;
global $conf,$langs,$user;
global $html,$bc;
$product_static = new Product($db);
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('Description').'</td>';
@ -133,7 +129,15 @@ function print_lines($propal,$lines)
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>'; print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td width="48" colspan="3">&nbsp;</td>'; print '<td width="48" colspan="3">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
}
/**
* \brief Return HTML with proposal lines
* \param propal Object proposal
* \param lines Proposal lines
*/
function print_lines_list($propal,$lines)
{
$num = count($lines); $num = count($lines);
$var = true; $var = true;
$i = 0; $i = 0;
@ -142,6 +146,23 @@ function print_lines($propal,$lines)
{ {
$var=!$var; $var=!$var;
print_line($propal,$line,$var,$num,$i);
$i++;
}
}
/**
* \brief Return HTML with selected proposal line
* \param propal Object proposal
* \param line Selected proposal line
*/
function print_line($propal,$line,$var=true,$num=0,$i=0)
{
global $db;
global $conf,$langs,$user;
global $html,$bc;
// Show product and description // Show product and description
$type=$line->product_type?$line->product_type:$line->fk_product_type; $type=$line->product_type?$line->product_type:$line->fk_product_type;
// Try to enhance type detection using date_start and date_end for free lines where type // Try to enhance type detection using date_start and date_end for free lines where type
@ -157,6 +178,8 @@ function print_lines($propal,$lines)
// Produit // Produit
if ($line->fk_product > 0) if ($line->fk_product > 0)
{ {
$product_static = new Product($db);
print '<td>'; print '<td>';
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne; print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne;
@ -209,9 +232,8 @@ function print_lines($propal,$lines)
if ($type==1) $text = img_object($langs->trans('Service'),'service'); if ($type==1) $text = img_object($langs->trans('Service'),'service');
else $text = img_object($langs->trans('Product'),'product'); else $text = img_object($langs->trans('Product'),'product');
print $text.' '.nl2br($line->description); print $text.' '.nl2br($line->description);
// Show range // Show range
print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); print_date_range($line->date_start,$line->date_end);
} }
print "</td>\n"; print "</td>\n";
} }
@ -417,8 +439,6 @@ function print_lines($propal,$lines)
print "</form>\n"; print "</form>\n";
} }
$i++;
}
} }
?> ?>