diff --git a/module/weekly/model.php b/module/weekly/model.php index ba0beca66f..0e3f95cc8c 100755 --- a/module/weekly/model.php +++ b/module/weekly/model.php @@ -807,17 +807,17 @@ class weeklyModel extends model { /* Set milestone report data. */ $report = new stdclass(); - $report->addedBy = 'system'; - $report->addedDate = helper::now(); + $report->addedBy = 'system'; + $report->addedDate = helper::now(); + $report->templateType = 'projectReport'; + $report->module = 'milestone'; $stages = $this->dao->select('id,name,project')->from(TABLE_PROJECT)->where('type')->eq('stage')->andWhere('milestone')->eq('1')->fetchAll('id'); foreach($stages as $stageID => $stage) { - $report->project = $stage->project; - $report->execution = $stageID; - $report->title = sprintf($this->lang->weekly->milestoneTitle, $stage->name); - $report->templateType = 'projectReport'; - $report->module = 'milestone'; + $report->project = $stage->project; + $report->execution = $stageID; + $report->title = sprintf($this->lang->weekly->milestoneTitle, $stage->name); $this->dao->insert(TABLE_DOC)->data($report)->exec(); }