Merge branch 'master' into improve-delivery-workflow-further
This commit is contained in:
commit
b303b48853
32 changed files with 331 additions and 212 deletions
|
|
@ -55,4 +55,9 @@ class StockitController < ApplicationController
|
|||
|
||||
render :partial => 'form', :locals => {:stock_article => stock_article}
|
||||
end
|
||||
|
||||
def history
|
||||
@stock_article = StockArticle.undeleted.find(params[:stock_article_id])
|
||||
@stock_changes = @stock_article.stock_changes.order('stock_changes.created_at DESC').each {|s| s.readonly!}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ class TasksController < ApplicationController
|
|||
|
||||
def create
|
||||
@task = Task.new(params[:task])
|
||||
if params[:periodic]
|
||||
@task.periodic_task_group = PeriodicTaskGroup.new
|
||||
end
|
||||
if @task.save
|
||||
redirect_to tasks_url, :notice => I18n.t('tasks.create.notice')
|
||||
else
|
||||
|
|
@ -32,13 +35,20 @@ class TasksController < ApplicationController
|
|||
def edit
|
||||
@task = Task.find(params[:id])
|
||||
@task.current_user_id = current_user.id
|
||||
if @task.periodic?
|
||||
flash.now[:alert] = I18n.t('tasks.edit.warning_periodic').html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@task = Task.find(params[:id])
|
||||
was_periodic = @task.periodic?
|
||||
@task.attributes=(params[:task])
|
||||
if @task.errors.empty? && @task.save
|
||||
flash[:notice] = I18n.t('tasks.update.notice')
|
||||
if was_periodic and not @task.periodic?
|
||||
flash[:notice] = I18n.t('tasks.update.notice_converted')
|
||||
end
|
||||
if @task.workgroup
|
||||
redirect_to workgroup_tasks_url(workgroup_id: @task.workgroup_id)
|
||||
else
|
||||
|
|
@ -53,7 +63,12 @@ class TasksController < ApplicationController
|
|||
task = Task.find(params[:id])
|
||||
# Save user_ids to update apple statistics after destroy
|
||||
user_ids = task.user_ids
|
||||
task.destroy
|
||||
if params[:periodic]
|
||||
task.periodic_task_group.exclude_tasks_before(task)
|
||||
task.periodic_task_group.destroy
|
||||
else
|
||||
task.destroy
|
||||
end
|
||||
task.update_ordergroup_stats(user_ids)
|
||||
|
||||
redirect_to tasks_url, :notice => I18n.t('tasks.destroy.notice')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue