diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index e5202bbf92..4fbad39791 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -63,6 +63,11 @@ def show # Page to create a new order. def new @order = Order.new(supplier_id: params[:supplier_id]).init_dates + @checkall_articels = true + if params[:order_id] + @base_order = Order.find(params[:order_id]) + @checkall_articels = false + end end # Save a new order. diff --git a/app/views/orders/_form.html.haml b/app/views/orders/_form.html.haml index 6ed381e72b..aa4de8c60f 100644 --- a/app/views/orders/_form.html.haml +++ b/app/views/orders/_form.html.haml @@ -29,7 +29,8 @@ %i.icon-tag - for article in articles / check if the article is selected or has an error - - included = @order.article_ids.include?(article.id.to_s) + - article_ids_order = @base_order || @order + - included = article_ids_order.article_ids.include?(article.id.to_s) - row_class = '' - if included - row_class = 'selected' diff --git a/app/views/orders/index.html.haml b/app/views/orders/index.html.haml index f68451654c..11b5a9c5d8 100644 --- a/app/views/orders/index.html.haml +++ b/app/views/orders/index.html.haml @@ -58,7 +58,7 @@ = link_to t('.action_receive'), receive_order_path(order), class: 'btn btn-small btn-success' %td - = link_to t('ui.edit'), '#', class: 'btn btn-small disabled', tabindex: -1 + = link_to t('ui.copy'), new_order_path(order_id: order, supplier_id: order.supplier), class: 'btn btn-small' = link_to t('ui.show'), order, class: 'btn btn-small' = link_to t('ui.delete'), order, data: {confirm: t('.confirm_delete')}, method: :delete, class: 'btn btn-small btn-danger' diff --git a/app/views/orders/new.html.haml b/app/views/orders/new.html.haml index adda8a24b6..817d49a5ff 100644 --- a/app/views/orders/new.html.haml +++ b/app/views/orders/new.html.haml @@ -1,10 +1,10 @@ - title t('.title') = render 'form' - -- content_for :javascript do - :javascript - // select all articles by default - $(function() { - $('#checkall').click(); - }); +- if @checkall_articels + - content_for :javascript do + :javascript + // select all articles by default + $(function() { + $('#checkall').click(); + }); diff --git a/config/locales/de.yml b/config/locales/de.yml index ade556a0b5..1c88be635b 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1649,6 +1649,7 @@ de: actions: Aktionen cancel: Abbrechen close: Schließen + copy: Kopieren delete: Löschen edit: Bearbeiten marks: diff --git a/config/locales/en.yml b/config/locales/en.yml index 1cd1c7110f..f2cbef5f80 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1658,6 +1658,7 @@ en: actions: Actions cancel: Cancel close: Close + copy: Copy delete: Delete edit: Edit marks: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index c13a6747dd..d55ef36ea9 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1668,6 +1668,7 @@ fr: actions: Actions cancel: Annuler close: Fermer + copy: Copier delete: Supprimer edit: Modifier marks: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index d361b78a90..99f0001475 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1653,6 +1653,7 @@ nl: actions: Acties cancel: Annuleren close: Sluiten + copy: Kopiëren delete: Verwijder edit: Bewerk marks: