spree_repeat_order 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4272177e4ab193ae6d44bbe06734a7a64ef71720
|
4
|
+
data.tar.gz: a4d9315577742e88f62b8171297552dd61ba2a48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac636e5983be435046974a61e8722bed2c6761a295f669fcac6ec29daaa5cc279cdea570942696ef610e5ac9fab7672f3aba3819ca30a371aac4ab20930a7211
|
7
|
+
data.tar.gz: e1fc4334270edbd24cb02a32d22c7c4bf8988b5eaa1e8c54f0c0ef8d22cd4aa1d0f4abd37ba992b4990a3e8d1b36fbf678122714e937d7e2064a122d55e9cd52
|
@@ -8,7 +8,13 @@ module Spree
|
|
8
8
|
|
9
9
|
duplicate_order(past_order, new_order)
|
10
10
|
|
11
|
-
|
11
|
+
success = true
|
12
|
+
success = success && !past_order.completed_at.blank?
|
13
|
+
success = success && new_order.save
|
14
|
+
success = success && new_order.next #ADDRESS
|
15
|
+
success = success && new_order.next #DELIVERY
|
16
|
+
|
17
|
+
if success
|
12
18
|
flash[:success] = "The order has been duplicated. The new order id is #{new_order.number}"
|
13
19
|
redirect_to(admin_orders_path)
|
14
20
|
else
|
@@ -21,6 +27,8 @@ module Spree
|
|
21
27
|
private
|
22
28
|
|
23
29
|
def duplicate_order(past_order, new_order)
|
30
|
+
new_order.email = past_order.email
|
31
|
+
|
24
32
|
new_line_items = []
|
25
33
|
past_order.line_items.each do |line_item|
|
26
34
|
new_line_items << line_item.dup
|
@@ -78,17 +78,18 @@ describe Spree::Admin::RepeatedOrdersController do
|
|
78
78
|
it 'should create new order with same line items' do
|
79
79
|
ship_address = FactoryGirl.create(:address)
|
80
80
|
bill_address = FactoryGirl.create(:address)
|
81
|
-
past_order = FactoryGirl.create(:
|
82
|
-
line_item = FactoryGirl.create(:line_item, order: past_order)
|
81
|
+
past_order = FactoryGirl.create(:completed_order_with_totals, ship_address: ship_address, bill_address: bill_address)
|
83
82
|
|
84
83
|
spree_post :create, number: past_order.number
|
84
|
+
response.should redirect_to('/admin/orders')
|
85
85
|
|
86
86
|
last_order = Spree::Order.last
|
87
|
-
last_order.line_items.count.should ==
|
87
|
+
last_order.line_items.count.should == past_order.line_items.count
|
88
|
+
last_order.state.should == 'delivery'
|
89
|
+
last_order.ship_address.firstname = past_order.ship_address.firstname
|
90
|
+
last_order.bill_address.firstname = past_order.bill_address.firstname
|
88
91
|
end
|
89
92
|
|
90
|
-
it 'should save order in delivery state'
|
91
|
-
|
92
93
|
end
|
93
94
|
|
94
95
|
|
data/spree_repeat_order.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.platform = Gem::Platform::RUBY
|
4
4
|
s.name = 'spree_repeat_order'
|
5
|
-
s.version = '2.1.
|
5
|
+
s.version = '2.1.5'
|
6
6
|
s.summary = 'Makes it possible to repeat an existing order with one click'
|
7
7
|
s.description = ''
|
8
8
|
s.required_ruby_version = '>= 2.0.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_repeat_order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Trindade
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|