spree_backend 3.4.1 → 3.4.2

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: 73e4381d1f23f046d523eb25fec4d634975b4e44
4
- data.tar.gz: 4c2d7e6180f068273b2cff0912ef9f694a6ee5ae
3
+ metadata.gz: 0b1a51ff1bd5e5f0730f0cddb303706c14d1fdf8
4
+ data.tar.gz: 15e8cf70f3ad56a8b143e7a1c361f22307b19e8d
5
5
  SHA512:
6
- metadata.gz: dbeeb481268869fa3ca8ac8eb17d1a8716615b8ee1db41f61afb34f0abc152b7c47116c1c170720cb9445e26f845580e684302d0518f70adc172a412931e6c2b
7
- data.tar.gz: 5f34945fdb76b1f38c0257e14801360e5f249a9bb7600bec3311150574218cc22e04673a62544f539a2b61e271adb1cb01974a89ed01d412c4e15bce3470141d
6
+ metadata.gz: 345e63ee9cdcdf344c19a5041118ce258b0f9945d6d718adb58701752d4daf0b826bb2aaad21b77afce678c8f31f5a76978f7de55d712fb21f91e99c41cb1b37
7
+ data.tar.gz: e818d85b39617c87d600389a4e5beae33501448ce1c9326a86c9c8a1a7776fcdd6622ffe21771d1aea4774e17717cb6a6dbe8f2d46a719b72a3d2f1e8fa5f2b6
@@ -31,7 +31,14 @@ $(document).ready(function() {
31
31
  cache: true,
32
32
  data: function(term, page) {
33
33
  return {
34
- q: term,
34
+ q: {
35
+ 'm': 'or',
36
+ 'email_start': term,
37
+ 'ship_address_firstname_start': term,
38
+ 'ship_address_lastname_start': term,
39
+ 'bill_address_firstname_start': term,
40
+ 'bill_address_lastname_start': term
41
+ },
35
42
  token: Spree.api_key
36
43
  }
37
44
  },
@@ -43,9 +43,23 @@ $(document).ready(function () {
43
43
  var del = $(this);
44
44
  var shipment_number = del.data('shipment-number');
45
45
  var variant_id = del.data('variant-id');
46
+ var shipment = _.findWhere(shipments, {number: shipment_number + ''});
47
+ var url = Spree.routes.shipments_api + "/" + shipment_number + '/remove';
46
48
 
47
49
  toggleItemEdit();
48
- adjustShipmentItems(shipment_number, variant_id, 0);
50
+
51
+ $.ajax({
52
+ type: "PUT",
53
+ url: Spree.url(url),
54
+ data: {
55
+ variant_id: variant_id,
56
+ token: Spree.api_key
57
+ }
58
+ }).done(function( msg ) {
59
+ window.location.reload();
60
+ }).fail(function(msg) {
61
+ alert(msg.responseJSON.message)
62
+ });
49
63
  }
50
64
  return false;
51
65
  });
@@ -145,13 +159,16 @@ adjustShipmentItems = function(shipment_number, variant_id, quantity){
145
159
 
146
160
  var url = Spree.routes.shipments_api + "/" + shipment_number;
147
161
 
148
- var new_quantity = 0;
149
- if(inventory_units.length<quantity){
162
+ var previous_quantity = inventory_units.reduce(function(accumulator, current_unit, _index, _array) {
163
+ return accumulator + current_unit.quantity;
164
+ }, 0);
165
+
166
+ if(previous_quantity<quantity){
150
167
  url += "/add"
151
- new_quantity = (quantity - inventory_units.length);
152
- }else if(inventory_units.length>quantity){
168
+ new_quantity = (quantity - previous_quantity);
169
+ }else if(previous_quantity>quantity){
153
170
  url += "/remove"
154
- new_quantity = (inventory_units.length - quantity);
171
+ new_quantity = (previous_quantity - quantity);
155
172
  }
156
173
  url += '.json';
157
174
 
@@ -264,7 +281,7 @@ completeItemSplit = function(event) {
264
281
  }).error(function(msg) {
265
282
  alert(msg.responseJSON['message']);
266
283
  }).done(function(msg) {
267
- window.Spree.advanceOrder();
284
+ window.location.reload();
268
285
  });
269
286
  } else {
270
287
  // TRANSFER TO AN EXISTING SHIPMENT
@@ -282,7 +299,7 @@ completeItemSplit = function(event) {
282
299
  }).error(function(msg) {
283
300
  alert(msg.responseJSON['message']);
284
301
  }).done(function(msg) {
285
- window.Spree.advanceOrder();
302
+ window.location.reload();
286
303
  });
287
304
  }
288
305
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.1
4
+ version: 3.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-20 00:00:00.000000000 Z
11
+ date: 2017-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_api
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.1
19
+ version: 3.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.1
26
+ version: 3.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spree_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.4.1
33
+ version: 3.4.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.4.1
40
+ version: 3.4.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bootstrap-sass
43
43
  requirement: !ruby/object:Gem::Requirement