/** * Update time record billed state * * @param void * @return null */ function update_billed_state() { if ($this->active_time->isNew()) { $this->httpError(HTTP_ERR_NOT_FOUND); } // if if (!$this->active_time->canChangeBillableStatus($this->logged_user)) { $this->httpError(HTTP_ERR_FORBIDDEN); } // if if ($this->request->isSubmitted()) { $to = $this->request->get('to') ? BILLABLE_STATUS_BILLED : BILLABLE_STATUS_BILLABLE; $this->active_time->setBillableStatus($to); $this->active_time->save(); if ($this->active_time->isBilled()) { print open_html_tag('a', array('href' => $this->active_time->getUpdateBilledStateUrl(false), 'class' => 'mark_time_record_as_billed', 'title' => lang('Billed ...'))) . '<img src="' . get_image_url('dollar-small.gif') . '" alt="" /></a>'; } else { print open_html_tag('a', array('href' => $this->active_time->getUpdateBilledStateUrl(true), 'class' => 'mark_time_record_as_billed', 'title' => lang('Not billed ...'))) . '<img src="' . get_image_url('gray-dollar-small.gif') . '" alt="" /></a>'; } // if die; } else { $this->httpError(HTTP_ERR_BAD_REQUEST); } // if sleep(3); print 'tup'; die; }