Skip to content

Commit

Permalink
FIX issue on version < 5
Browse files Browse the repository at this point in the history
  • Loading branch information
bgenere committed Feb 23, 2017
1 parent 5e4d4dd commit f87e53d
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions cultivationprogress.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
$cultivationprojectid = setIsCultivationProject();
$cultivationproject = new Project($db);
$cultivationproject->fetch($cultivationprojectid);
$cultivationproject->getLinesArray($user);
//$cultivationproject->getLinesArray($user);

$sort = getsort();

Expand Down Expand Up @@ -143,8 +143,9 @@ function displaySearchForm(Project $cultivationproject, $filter, $sort)
print '<td>' . $form->select_date($filter['dateend'], 'dateend', 0, 0, 0, "dateend", 1, 1, 1) . '</td>';
print '</tr>';
// Tasks
$tasks = Array();
foreach ($cultivationproject->lines as $task) {
$tasks = array();
$lines = getProjectTasks($cultivationproject);
foreach ($lines as $task) {
$tasks[$task->ref] = $task->label;
array_multisort($tasks);
}
Expand Down Expand Up @@ -504,3 +505,35 @@ function getPlotProgress(Project $project, $sort, $filter)
}
}

function getProjectTasks(Project $project)
{
Global $db, $conf, $user, $langs;

$tasks = array();

$sql = "SELECT";
$sql .= " pt.ref as ref,";
$sql .= " pt.label as label";
$sql .= " FROM " . MAIN_DB_PREFIX . "projet_task as pt ";
$sql .= " WHERE ";
$sql .= " pt.fk_projet =" . $project->id;

$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$totalnboflines = $num;

$i = 0;
while ($i < $num) {
$row = $db->fetch_object($resql);
$tasks[$i] = $row;
$i ++;
}
$db->free($resql);
return $tasks;
} else {
dol_print_error($db);
return null;
}
}

0 comments on commit f87e53d

Please sign in to comment.