Пример #1
0
 function action_edit()
 {
     foreach (Get::val('ids') as $task_id) {
         // Edit or close? If we have a resolution_reason, then close! otherwise, edit.
         if (Post::val('resolution_reason')) {
             Backend::close_task($task_id, Post::val('resolution_reason'), Post::val('closure_comment'), Post::val('mark100'));
         } elseif (count(Post::val('changes'))) {
             $task = Flyspray::GetTaskDetails($task_id);
             $args = $task;
             // import previous values
             foreach (Post::val('changes') as $change) {
                 $args[$change] = Post::val($change);
             }
             if (is_array($args['assigned_to'])) {
                 $args['assigned_to'] = implode(';', $task['assigned_to_uname']);
             }
             Backend::edit_task($task, $args);
         }
     }
     return array(SUBMIT_OK, L('masseditsuccessful'));
 }
Пример #2
0
                                     VALUES  (?, ?)', array($id, $assignee));
                            }
                        }
                    }
                }
                // set success message
                $_SESSION['SUCCESS'] = L('tasksupdated');
                break;
            } else {
                if (!Post::val('resolution_reason')) {
                    Flyspray::show_error(L('noclosereason'));
                    break;
                }
                $task_ids = Post::val('ids');
                foreach ($task_ids as $task_id) {
                    $task = Flyspray::GetTaskDetails($task_id);
                    if (!$user->can_close_task($task)) {
                        continue;
                    }
                    if ($task['is_closed']) {
                        continue;
                    }
                    Backend::close_task($task_id, Post::val('resolution_reason'), Post::val('closure_comment', ''), Post::val('mark100', false));
                }
                $_SESSION['SUCCESS'] = L('taskclosedmsg');
                break;
            }
        } else {
            Flyspray::show_error(L('massopsdisabled'));
        }
}
Пример #3
0
            }
            foreach (array('opened', 'closed', 'reopened', 'assigned') as $type) {
                if (count(${$type})) {
                    $message .= L($type . 'tasks') . ':' . "\n" . implode("\n", ${$type}) . "\n\n";
                }
            }
            if (Notifications::send_now($pms, ADDRESS_USER, NOTIFY_DIGEST, array('message' => $message))) {
                $db->x->execParam('UPDATE {projects} SET last_digest = ? WHERE project_id = ?', array(time(), $project['project_id']));
            }
        }
        ############ Task four: Close tasks ############
        $tasks = $db->query('SELECT t.*, c.date_added, max(c.date_added) FROM {tasks} t
                        LEFT JOIN {comments} c ON t.task_id = c.task_id
                            WHERE is_closed = 0 AND close_after > 0
                         GROUP BY t.task_id');
        while ($row = $tasks->FetchRow()) {
            if (max($row['date_added'], $row['last_edited_time']) + $row['close_after'] < time()) {
                Backend::close_task($row['task_id'], $row['resolution_reason'], $row['closure_comment'], false);
                $db->x->execParam('UPDATE {tasks} SET close_after = 0 WHERE task_id = ?', $row['task_id']);
            }
        }
        //wait 10 minutes for the next loop.
        if (php_sapi_name() !== 'cli') {
            sleep(600);
        }
    } while (php_sapi_name() !== 'cli');
    //forever ¡¡¡ ( oh well. a least will not stop unless killed or the server restarted)
    @register_shutdown_function('unlink', Flyspray::get_tmp_dir() . '/flysprayreminders.run');
} else {
    die('You are not authorized to start the remider daemon.');
}
Пример #4
0
 function action_close($task)
 {
     global $user, $db, $fs, $proj;
     if (!$user->can_close_task($task)) {
         return array(ERROR_PERMS);
     }
     if ($task['is_closed']) {
         return array(ERROR_INPUT, L('taskalreadyclosed'));
     }
     if (!Post::val('resolution_reason')) {
         return array(ERROR_RECOVER, L('noclosereason'));
     }
     if (Post::num('close_after_num') && Post::num('close_after_type')) {
         // prepare auto close
         $db->x->execParam('UPDATE  {tasks}
                          SET  closed_by = ?, closure_comment = ?,
                               resolution_reason = ?, last_edited_time = ?,
                               last_edited_by = ?, close_after = ?, percent_complete = ?
                        WHERE  task_id = ?', array($user->id, Post::val('closure_comment', ''), Post::val('resolution_reason'), time(), $user->id, Post::num('close_after_num') * Post::num('close_after_type'), (bool) Post::num('mark100') * 100, $task['task_id']));
         return array(SUBMIT_OK, L('taskautoclosedmsg'));
     }
     Backend::close_task($task['task_id'], Post::val('resolution_reason'), Post::val('closure_comment', ''), Post::val('mark100', false));
     return array(SUBMIT_OK, L('taskclosedmsg'));
 }