Works on Milestone module
This commit is contained in:
parent
0c3d8b58f1
commit
f430b54cca
@ -141,6 +141,8 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
|
||||
$propal->fetch($_GET["id"]);
|
||||
$propal->fetch_client();
|
||||
$result = $propal->delete_product($_GET['lineid']);
|
||||
// reorder lines
|
||||
if ($result) $propal->line_order(true);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
@ -1409,31 +1411,29 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
$lines = $propal->getLinesArray();
|
||||
|
||||
// Show lines
|
||||
if (! empty($lines) )
|
||||
// Milestone module
|
||||
if ($conf->milestone->enabled)
|
||||
{
|
||||
print_title_list();
|
||||
|
||||
// Milestone module
|
||||
if ($conf->milestone->enabled)
|
||||
{
|
||||
$milestone = new Milestone($db);
|
||||
$milestone->getObjectMilestones($propal);
|
||||
$milestone = new Milestone($db);
|
||||
$milestone->getObjectMilestones($propal);
|
||||
$sublines = $propal->getLinesArray(false);
|
||||
|
||||
if (! empty($milestone->lines))
|
||||
{
|
||||
print_milestone_list($milestone, $propal, $lines);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_lines_list($propal, $lines);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (! empty($milestone->lines))
|
||||
{
|
||||
print_title_list();
|
||||
print_milestone_list($milestone, $sublines, $propal, $lines);
|
||||
}
|
||||
else if (! empty($lines) )
|
||||
{
|
||||
print_title_list();
|
||||
print_lines_list($propal, $lines);
|
||||
}
|
||||
}
|
||||
else if (! empty($lines) )
|
||||
{
|
||||
print_title_list();
|
||||
print_lines_list($propal, $lines);
|
||||
}
|
||||
|
||||
/*
|
||||
* Form to add new line
|
||||
|
||||
@ -2151,21 +2151,21 @@ class Propal extends CommonObject
|
||||
/**
|
||||
* \brief Return an array of propal lines
|
||||
*/
|
||||
function getLinesArray()
|
||||
function getLinesArray($order=true)
|
||||
{
|
||||
$lines = array();
|
||||
|
||||
$sql = 'SELECT pt.rowid, pt.description, pt.fk_product, pt.fk_remise_except,';
|
||||
$sql.= ' pt.qty, pt.tva_tx, pt.remise_percent, pt.subprice, pt.info_bits,';
|
||||
$sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.marge_tx, pt.marque_tx, pt.pa_ht, pt.special_code,';
|
||||
$sql.= ' pt.date_start,';
|
||||
$sql.= ' pt.date_end,';
|
||||
$sql.= ' pt.product_type,';
|
||||
$sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang,';
|
||||
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid,';
|
||||
$sql.= ' p.description as product_desc';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid';
|
||||
$sql.= ' WHERE pt.fk_propal = '.$this->id;
|
||||
if ($order) $sql.= ' AND pt.rang <> 0';
|
||||
if (! $order) $sql.= ' AND pt.rang = 0';
|
||||
$sql.= ' ORDER BY pt.rang ASC, pt.rowid';
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
@ -2199,6 +2199,7 @@ class Propal extends CommonObject
|
||||
$lines[$i]->marge_tx = $obj->marge_tx;
|
||||
$lines[$i]->marque_tx = $obj->marque_tx;
|
||||
$lines[$i]->special_code = $obj->special_code;
|
||||
$lines[$i]->rang = $obj->rang;
|
||||
$lines[$i]->date_start = $this->db->jdate($obj->date_start);
|
||||
$lines[$i]->date_end = $this->db->jdate($obj->date_end);
|
||||
|
||||
|
||||
@ -698,6 +698,7 @@ class CommonObject
|
||||
$sql = 'SELECT count(rowid) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||
$sql.= ' WHERE '.$this->fk_element.'='.$this->id;
|
||||
if (! $renum) $sql.= ' AND rang = 0';
|
||||
if ($renum) $sql.= ' AND rang <> 0';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -3459,4 +3459,17 @@ function picto_from_langcode($codelang)
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Define the style of background color of line
|
||||
*/
|
||||
function bcStyle($impair='impair', $pair='pair')
|
||||
{
|
||||
$bc=array();
|
||||
|
||||
$bc[0]='class="'.$impair.'"';
|
||||
$bc[1]='class="'.$pair.'"';
|
||||
|
||||
return $bc;
|
||||
}
|
||||
|
||||
?>
|
||||
@ -162,7 +162,7 @@ function print_line($propal,$line,$var=true,$num=0,$i=0)
|
||||
global $db;
|
||||
global $conf,$langs,$user;
|
||||
global $html,$bc;
|
||||
|
||||
|
||||
// Show product and description
|
||||
$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
|
||||
|
||||
@ -675,8 +675,7 @@ if (! defined('NOREQUIRETRAN'))
|
||||
}
|
||||
|
||||
// Define some constants used for style of arrays
|
||||
$bc[0]="class=\"impair\"";
|
||||
$bc[1]="class=\"pair\"";
|
||||
$bc = bcStyle();
|
||||
|
||||
// Constants used to defined number of lines in textarea
|
||||
if (empty($conf->browser->firefox))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user