Exemple #1
0
 def delete_task(self, task_id, modifier_id):
     task = Task.get_by_key(int(task_id))
     if task.is_trashed:
         tag.delete_tagmodels(modifier_id, model_nk=(Task.get_modelname(), task.uid), modifier_id=modifier_id)
         filex.delete_files(task.creator_id, model_nk=(Task.get_modelname(), task.uid), modifier_id=modifier_id)
         self.delete_taskcomments(task_id, modifier_id)
         self.delete_taskversions(modifier_id, task_id=task.key(), is_affected=None)
         self.delete_taskcomponents(modifier_id, task_id=task.key())
         mclog.delete_mclogs(Task.get_modelname(), task.key(), modifier_id)
         task.delete(modifier_id)
     else:
         if task.creator_id != modifier_id:
             raise Error("task_error_deletesharedtask")
         self.trash_tasks([task.uid], True, modifier_id)
     return True
Exemple #2
0
 def update_task(self, task, modifier_id):
     nt = Task.get_by_key(task.uid)
     if task.creator_id != modifier_id and nt.worksheet_id != task.worksheet_id:
         raise Error("task_error_movesharedtask")
     if nt.is_trashed : 
         raise Error("task_error_trashed_update")
     if task.t_status_code == 'task_code_closed':
         task.actual_finishdate = dtutil.localtoday(conf.get_preferred_timezone())
         if nt.actual_startdate is None:
             task.actual_startdate = dtutil.localtoday(conf.get_preferred_timezone())
     else:
         task.actual_finishdate = None
    
     if task.t_status_code == 'task_code_inprogress' and nt.t_status_code != 'task_code_inprogress' and task.actual_startdate != None:
         task.actual_startdate = dtutil.localtoday(conf.get_preferred_timezone())
     task.put(modifier_id)
     self.create_taskcomponents(task.key(), task.component_ids, modifier_id)
     self.create_taskversions(task.key(), task.affected_version_ids, True, modifier_id)
     self.create_taskversions(task.key(), task.fixed_version_ids, False, modifier_id)
     return task
Exemple #3
0
 def trash_tasks(self, task_ids, is_trashed, modifier_id):
     for task_id in task_ids:
         task = Task.get_by_key(task_id)
         task.is_trashed = is_trashed
         task.put(modifier_id)
     return True
Exemple #4
0
 def get_task(self, task_id):
     task = Task.get_by_key(task_id)
     return task
Exemple #5
0
 def move_task(self, task_id, worksheet_id, modifier_id):
     task = Task.get_by_key(task_id)
     task.worksheet_id = int(worksheet_id)
     task.put(modifier_id)
     return task
Exemple #6
0
 def recover_task(self, task_id, worksheet_id, modifier_id):
     task = Task.get_by_key(task_id)
     task.is_trashed = False
     task.worksheet_id = worksheet_id
     task.put(modifier_id)
     return task