Skip to content

Commit

Permalink
Merge branch 'dariuszaleksiewicz-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
yandod committed Jun 24, 2014
2 parents bb6acbb + 5673254 commit 0f0c34f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/Controller/TimelogController.php
Expand Up @@ -173,12 +173,12 @@ function details()
}
}

function edit()
function edit($id = false)
{
if (!$this->TimeEntry->is_editable_by($this->current_user, $this->_project)) {
throw new NotFoundException();
}
if (empty($this->TimeEntry->data)) {
if (empty($this->TimeEntry->data)) {
$this->TimeEntry->create();
$this->TimeEntry->set(array(
'project_id' => $this->_project['Project']['id'],
Expand All @@ -188,6 +188,7 @@ function edit()
));
}
if (!empty($this->request->data)) {
$this->TimeEntry->id = $id;
$this->TimeEntry->set($this->request->data);
if ($this->TimeEntry->save()) {
$this->Session->setFlash(__('Successful update.'), 'default', array('class' => 'flash flash_notice'));
Expand Down
2 changes: 1 addition & 1 deletion app/View/Timelog/edit.ctp
@@ -1,6 +1,6 @@
<h2><?php echo __('Spent time') ?></h2>

<?php echo $this->Form->create('TimeEntry', array('url'=>'/projects/'.$main_project['Project']['identifier'].'/timelog/edit', 'class'=>'tabular')); ?>
<?php echo $this->Form->create('TimeEntry', array('url'=>'/projects/'.$main_project['Project']['identifier'].'/timelog/edit/' . (isset($this->request->params['url_param']['id']) ? $this->request->params['url_param']['id'] : ''), 'class'=>'tabular')); ?>
<?php echo $this->element('error_explanation'); ?>
<?php echo $this->Candy->back_url_hidden_field_tag(); ?>

Expand Down

0 comments on commit 0f0c34f

Please sign in to comment.