Openbravo Issue Tracking System - Retail Modules
View Issue Details
0036568Retail ModulesStoreServerpublic2017-08-01 12:282017-09-01 12:34
mtaal 
mtaal 
normalmajorhave not tried
closedopen 
5
 
RR17Q4RR17Q4 
AugustoMauch
No
0036568: Gift card synchronization should only replicate local gift cards
The current logic replicates all gift cards and also all their transactions to each store.
For large organizations this is too much and only local gift cards need to be present in the store.

A local gift card is defined:
- not belonging to an org with type 'legal with accounting', and
- not having a type with only-org=N

Install multi-server
Enable synchronized mode
Install gift can gift card sync module
Adapt the dataset and synchronized table setup to provided the requested logic.

Test plan:
https://docs.google.com/a/openbravo.com/spreadsheets/d/1_r9-_O94bOsjRtvsI31gJZQMzZ-rolTjOxAtgiNqqtI/edit?usp=sharing [^]
No tags attached.
pdf Gift Card Email Discussion.pdf (178,928) 2017-08-01 12:29
https://issues.openbravo.com/file_download.php?file_id=10942&type=bug
Issue History
2017-08-01 12:28mtaalNew Issue
2017-08-01 12:28mtaalAssigned To => mtaal
2017-08-01 12:28mtaalTriggers an Emergency Pack => No
2017-08-01 12:29mtaalFile Added: Gift Card Email Discussion.pdf
2017-08-01 12:39mtaalNote Added: 0098306
2017-08-01 13:03mtaalReview Assigned To => AugustoMauch
2017-08-01 17:11hgbotCheckin
2017-08-01 17:11hgbotNote Added: 0098314
2017-08-01 17:11hgbotStatusnew => resolved
2017-08-01 17:11hgbotResolutionopen => fixed
2017-08-01 17:11hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/1248af7cf74a54f2c6bae35a2580a047b1b8fd21 [^]
2017-08-01 19:14hgbotCheckin
2017-08-01 19:14hgbotNote Added: 0098320
2017-08-03 14:16AugustoMauchNote Added: 0098375
2017-08-03 14:16AugustoMauchStatusresolved => new
2017-08-03 14:16AugustoMauchResolutionfixed => open
2017-08-22 13:48hgbotCheckin
2017-08-22 13:48hgbotNote Added: 0098577
2017-08-22 13:48hgbotStatusnew => resolved
2017-08-22 13:48hgbotResolutionopen => fixed
2017-08-22 13:48hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/1248af7cf74a54f2c6bae35a2580a047b1b8fd21 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/41df8f2375c17cc2b2a9951ad251cd6076e5d72e [^]
2017-08-24 14:12hgbotCheckin
2017-08-24 14:12hgbotNote Added: 0098635
2017-08-28 00:46hgbotCheckin
2017-08-28 00:46hgbotNote Added: 0098664
2017-08-29 23:08hgbotCheckin
2017-08-29 23:08hgbotNote Added: 0098712
2017-08-30 12:25hgbotCheckin
2017-08-30 12:25hgbotNote Added: 0098731
2017-08-31 10:23AugustoMauchNote Added: 0098744
2017-08-31 10:23AugustoMauchStatusresolved => new
2017-08-31 10:23AugustoMauchResolutionfixed => open
2017-08-31 10:50hgbotCheckin
2017-08-31 10:50hgbotNote Added: 0098745
2017-09-01 12:34AugustoMauchStatusnew => scheduled
2017-09-01 12:34AugustoMauchStatusscheduled => resolved
2017-09-01 12:34AugustoMauchNote Added: 0098774
2017-09-01 12:34AugustoMauchStatusresolved => closed
2017-09-01 12:34AugustoMauchFixed in Version => RR17Q4

Notes
(0098306)
mtaal   
2017-08-01 12:39   
Docs:
http://wiki.openbravo.com/wiki/Retail:Store_Server#Replicating_Gift_Cards [^]
(0098314)
hgbot   
2017-08-01 17:11   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: 1248af7cf74a54f2c6bae35a2580a047b1b8fd21
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Aug 01 17:11:40 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/1248af7cf74a54f2c6bae35a2580a047b1b8fd21 [^]

Fixes issue 36568: Gift card synchronization should only replicate local gift cards

Changes:
- use the store data channel
- implemented a new GiftCardRouter
- use the gift card router it in case of replicating central to store for gift cards and gift card products
- updated the dataset queries for gift card to use the global versus local definition

---
M src-db/database/sourcedata/AD_DATASET_TABLE.xml
M src-db/database/sourcedata/STRSYNC_SYNCHRONIZEDTABLE.xml
---
(0098320)
hgbot   
2017-08-01 19:14   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: 4d127261eed75e8257bcbcdfe3047a59caf2fca8
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Aug 01 19:14:39 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/4d127261eed75e8257bcbcdfe3047a59caf2fca8 [^]

Related to issue 36568: Gift card synchronization should only replicate local gift cards
Added files missed by previous commit

---
A src-db/database/sourcedata/STRSYNC_CUSTOM_ROUTER.xml
A src/org/openbravo/retail/giftcards/synchronization/GiftCardRouter.java
---
(0098375)
AugustoMauch   
2017-08-03 14:16   
I reviewed the issue, and I think there is still one scenario that is not properly handled. If the central server is offline, the global giftcard will be created on the store. Once it is online again, the global giftcard will be synchronized from the store server to the central server. So far so good.

The problem is that from then on, the giftcard will not get updates (the central server does not send to the store updates for global giftcards), and will be kept in the store potentially outdated. If then someone looks for this giftcard when the store server is offline, it will received the potentially updated version.

There are two ways to approach this problem:
- To add a field to the giftcard instance table, to store the server where the giftcard was created. Then in the central server the router can take this into account, and send the updates done to the global giftcard to the store where it was created.
- Change the search filter so that only local giftcards can be found in the store server. That way, the global giftcard will not be retrievable by the POS in the store server, and the request will be redirected to the central server. I prefere this option, because it goes in line with the concept of the central server being the owner of the global giftcards.
(0098577)
hgbot   
2017-08-22 13:48   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: 41df8f2375c17cc2b2a9951ad251cd6076e5d72e
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Aug 22 13:47:34 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/41df8f2375c17cc2b2a9951ad251cd6076e5d72e [^]

Fixes issue 36568: Gift card synchronization should only replicate local gift cards
Sync also global giftcards which are from a local order. Updated also the dataset to export the needed gift card information.

---
M src-db/database/sourcedata/AD_DATASET_TABLE.xml
M src/org/openbravo/retail/giftcards/synchronization/GiftCardRouter.java
---
(0098635)
hgbot   
2017-08-24 14:12   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: c81dcbba1ef2a67280f52b1f84f4e35375748ae0
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Aug 24 14:11:48 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/c81dcbba1ef2a67280f52b1f84f4e35375748ae0 [^]

Related with issue 36568: Refactors the GiftCardRouter

Three small changes have been done:
- Diamond operator is used to create instance of HashSet
- Uses equalsIgnoreCase instead of equals(string.toLowerCase(...)))
- Breaks up isGlobalGiftCard in two methods to improve readability

---
M src/org/openbravo/retail/giftcards/synchronization/GiftCardRouter.java
---
(0098664)
hgbot   
2017-08-28 00:46   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: 678937dc3b566be7c936a12617e689dd966b0ea6
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Aug 28 00:46:07 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/678937dc3b566be7c936a12617e689dd966b0ea6 [^]

Related with issue 36568: export global gift card to origin store
Also export the global gift card to the original store in the dataset and router

---
M src-db/database/sourcedata/AD_DATASET_TABLE.xml
M src/org/openbravo/retail/giftcards/synchronization/GiftCardRouter.java
---
(0098712)
hgbot   
2017-08-29 23:08   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: db6c7063dae4e4f265be5debb7cf769cc0d421e7
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Aug 29 23:08:19 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/db6c7063dae4e4f265be5debb7cf769cc0d421e7 [^]

Related with issue 36568: export global gift card to origin store

STRSYNC_SYNCHRONIZEDTABLE: Sync gift card transactions bidirectional
GiftCardCurrentAmountWriterFilterAdapter: recompute product quantity and amounts in the correct way based on delete/update/insert of gift card transaction
GiftCardRouter: route also on the basis of the organisation of the payment

---
M src-db/database/sourcedata/STRSYNC_SYNCHRONIZEDTABLE.xml
M src/org/openbravo/retail/giftcards/synchronization/GiftCardCurrentAmountWriterFilterAdapter.java
M src/org/openbravo/retail/giftcards/synchronization/GiftCardRouter.java
---
(0098731)
hgbot   
2017-08-30 12:25   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: dc5517aabb9f0d66b8fa77b88301468615172bd1
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Aug 30 12:24:36 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/dc5517aabb9f0d66b8fa77b88301468615172bd1 [^]

Related with issue 36568:GiftCardCurrentAmountWriterFilterAdapter clean up

The following changes have been done:
- Diamond operator is used
- Uses constant strings for "m_product_id" and "V"
- Adds comment to initialize to specify why it is empty
- Extract methods to handle the code for inserts, updates and deletions separately

---
M src/org/openbravo/retail/giftcards/synchronization/GiftCardCurrentAmountWriterFilterAdapter.java
---
(0098744)
AugustoMauch   
2017-08-31 10:23   
Point #17 of the test plan [1] not satisfied. Giftcard transaction are synchronized, but they sometimes reference entries from c_order that are not present in the target store.


[1] https://docs.google.com/spreadsheets/d/1_r9-_O94bOsjRtvsI31gJZQMzZ-rolTjOxAtgiNqqtI/edit#gid=0 [^]
(0098745)
hgbot   
2017-08-31 10:50   
Repository: erp/pmods/org.openbravo.retail.giftcards.synchronization
Changeset: fd502e3e203675d90a4e9608697df69a4e7e1013
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Thu Aug 31 10:50:12 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.giftcards.synchronization/rev/fd502e3e203675d90a4e9608697df69a4e7e1013 [^]

Related with issue 36568: add exclude order and order line from gift card transaction

---
A src-db/database/sourcedata/STRSYNC_EXCLUDEDCOL.xml
---
(0098774)
AugustoMauch   
2017-09-01 12:34   
Code reviewed and verified