Works on Milestone module

This commit is contained in:
Regis Houssin 2010-07-02 18:16:27 +00:00
parent f430b54cca
commit 156f60f549
2 changed files with 19 additions and 11 deletions

View File

@ -245,10 +245,10 @@ if ($_POST['action'] == 'addmilestone')
{
$milestone = new Milestone($db);
$milestone->label = $_POST['milestone_label'];
$milestone->label = $_POST['milestone_label'];
$milestone->description = $_POST['milestone_desc'];
$milestone->elementtype = $propal->element;
$milestone->fk_element = $propal->id;
$milestone->elementid = $propal->id;
$ret = $milestone->create($user);

View File

@ -783,15 +783,8 @@ class CommonObject
$rang = $row[0];
}
/* Lecture du rang max de la facture */
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$max = $row[0];
}
// Get max value for rang
$max = $this->line_max();
if ($rang < $max)
{
@ -813,6 +806,21 @@ class CommonObject
}
}
}
/**
* \brief Get max value for rang
*/
function line_max()
{
$sql = 'SELECT max(rang) FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
return $row[0];
}
}
/**
* \brief Update private note of element