Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0032252
TypeCategorySeverityReproducibilityDate SubmittedLast Update
feature request[Retail Modules] Web POSminorhave not tried2016-02-16 23:272016-11-02 09:56
ReportermtaalView Statuspublic 
Assigned ToAugustoMauch 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionc24bbe2a056e
ProjectionnoneETAnoneTarget VersionRR16Q4
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomtaal
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0032252: Store Server Data Segmentation and Sync for BP

DescriptionSee:
http://wiki.openbravo.com/wiki/Projects:Store_Server_BP_Data_Segmentation [^]
Steps To ReproduceSee description
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0033634 closedmtaal Functional flow of BP not covered in StoreServer. 
related to design defect 0033535RR16Q4 closedmtaal Creating BP from webpos should make the BP non-standard 
has duplicate defect 0032648 closedmtaal [STORESERVER] Segmentation in "Business Partner" window is not correct. 
has duplicate design defect 0033657RR16Q4 closedAugustoMauch BP Segmentation: only use the BP by server table in case a BP is used by multiple servers/stores 
related to defect 0033727 newAugustoMauch Improve the initialization of the tables related with business partner segmentation 
related to defect 0034188 closedStoreServer More tables should be taken into account in the business partner segmentation logic 
causes design defect 0033674 closedAugustoMauch Store Server BP Data Segmentation - Table obstsyn_server_bpartner must sync from Store Server to Central Server 

-  Notes
(0086635)
AugustoMauch (manager)
2016-05-22 20:52
edited on: 2016-05-22 20:53

Changes done to a business partner will be synchronized to a store if any of these conditions are met:
- The business partner has been explicitely included in a store. The Business Partner by Server window stores the relation between business partners and stores.
- The business partner is NOT flagged as Standard Store Customer. The sales representatives and the business partners that are the default business partners of the organizations should not have that flag checked

(0086636)
AugustoMauch (manager)
2016-05-22 20:55

When a business partner is added to a store, the c_bpartner table, along with other tables related to it (these tables are defined in the Table Related with Business Partner window) are "touched" so that its relevant rows are synchronized to the store.

This event handler is the class responsible to touch the tables related with business partner: https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/file/tip/src/org/openbravo/retail/storeserver/synchronization/eventhandler/TableRelatedWithBusinessPartnerEventHandler.java [^]
(0087018)
mtaal (manager)
2016-06-06 10:23
edited on: 2016-06-06 10:24

Comments:
- check the connection usage/closing in the new routers as the new routers seem to use DAL and DAL connection which are not closed
- the simple_customer column is not updated when new user/bp is created, additional event handlers are needed
- two warnings in the code related to not-used log-member

(0087087)
hgbot (developer)
2016-06-08 11:14

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 94848d2cd44f100a8d89ef50b133050e3bd6e72c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jun 07 17:21:45 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/94848d2cd44f100a8d89ef50b133050e3bd6e72c [^]

Related with issue 32252: Improves logging, removes warning from routers

---
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerLocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/LocationRouter.java
---
(0087088)
hgbot (developer)
2016-06-08 11:14

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 2713ab5f69993948044d4b0e952530430d031fd5
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jun 07 18:35:25 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/2713ab5f69993948044d4b0e952530430d031fd5 [^]

Related with issue 32252: Routers take into account Standard Customer flag

The Is Standard Store Customer flag will be checked for those business partners that are not standard customers (i.e. they are also sales representatives or the default business
partner of a store). When one of these business partners change, all the store servers should receive these changes. This was already taken into account in the dataset table wher
e clause, but not in the routers.

---
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerLocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/LocationRouter.java
---
(0087092)
hgbot (developer)
2016-06-08 13:12

Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: c0b9b39f8e9c88d61501206b1a346dd1a8dc7f5c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 08 13:09:57 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/c0b9b39f8e9c88d61501206b1a346dd1a8dc7f5c [^]

Related with issue 32252: Prevents leaving the DAL connection open

There was a risk of leaving DAL connections open if routers implementations used DAL but forgot to close the connection. This has now been prevented by committing and closing the connection in AbstractClientFilteredRouter (a superclass of all routers defined in OB) after invoking doRouteToNodes (which is implemented by router implementations).

---
M src/org/openbravo/replication/symmetricds/extensions/AbstractClientFilteredRouter.java
---
(0087101)
hgbot (developer)
2016-06-08 18:06

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: c24bbe2a056e68cd75d409d25b7228337691d79f
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 08 18:04:13 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/c24bbe2a056e68cd75d409d25b7228337691d79f [^]

Fixes issue 32252: Adds event handler to keep Is Standard Customer flag updated

The value of the BusinessPartner.IsStandardCustomer flag will be false if one of these conditions are met:
- The business partner is a sales representative
- The business partner is used as the default business partner of a store (organization)
- The business partner is related to an OrganizationInfo

An event handler has been added to each one of these tables to update this flag automatically. The event handlers only set the flag to false and never back to true, because if a business partner has not been a standard customer at one point, it will remain like that from then on.

---
A src/org/openbravo/retail/storeserver/synchronization/eventhandler/BusinessPartnerEventHandlerForStandardCustomerFlag.java
A src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrganizationEventHandlerForStandardCustomerFlag.java
A src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrganizationInfoEventHandlerForStandardCustomerFlag.java
---
(0087109)
AugustoMauch (manager)
2016-06-09 09:12

When a 'Is Standard Customer' flag of a business partner is set to false, that business partner, along with its related tables, need to be synchronized to all servers.
(0087140)
hgbot (developer)
2016-06-09 17:21

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 4f0612e986ca7f8f52e02d87af9a855967c1d738
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Jun 09 17:04:55 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/4f0612e986ca7f8f52e02d87af9a855967c1d738 [^]

Related with bug 32252: Change how the business partner router gets flag value

The Is Standard Customer flag of c_bpartner is used to route business partners: if its value is false the business partner will be sent to all store servers, otherwise it will only be sent to the stores the business partner belongs to.

The router used to take the flag value from the metadata, that is the value it had in the database when the trigger captured the change. This was a problem in an event handler that "touched" the c_bpartner tables and the related ones when the flag was updated from true to false. The tables were touched inside the eventhandler, which is executed before actually commiting the change to the database, and the wrong value (true) was being used in the router. This resulted in referencial integrity errors.

To prevent this, the router will no longer take the value from the metada but from the database itself. It requires an extra query, but it is done using an indexed column so the performance is hardly affected.

---
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerRouter.java
---
(0087141)
hgbot (developer)
2016-06-09 17:21

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 9c221c39d9bb08f53ed13219a8e795d78193086d
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Jun 09 17:17:54 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/9c221c39d9bb08f53ed13219a8e795d78193086d [^]

Related with bug 32252: Refactors logic to touch c_bpartner and related tables

The logic, which used to be in the BusinessPartnerPerStoreEventHandler has been moved to its own class (BusinessPartnerAndRelatedTablesSynchronizer) because it is going to be needed in other classes.

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/BusinessPartnerPerStoreEventHandler.java
A src/org/openbravo/retail/storeserver/synchronization/process/BusinessPartnerAndRelatedTablesSynchronizer.java
---
(0087142)
hgbot (developer)
2016-06-09 17:21

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 74c4bf8b6a2446621be179afa34e9ce139a72dd4
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Thu Jun 09 17:19:15 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/74c4bf8b6a2446621be179afa34e9ce139a72dd4 [^]

Related with issue 32252: Touch c_bpartner tables if flag is set to false

Adds an event handler that will use the BusinessPartnerAndRelatedTablesSynchronizer class to touch the c_bpartner table and its related tables when the Is Standard Customer flag of c_bpartner is changed from false to true.

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/BusinessPartnerEventHandlerForStandardCustomerFlag.java
---
(0087678)
mtaal (manager)
2016-06-20 15:35

Review comments:

#1
- add more tables of the standard retail solution to the related table window
- let more tables control if a BP is a non-standard BP
- See this spreadsheet for an overview:
https://docs.google.com/spreadsheets/d/1gSSuOjaDpVjiFI4_arvQH92Z17vJhB7d1U_fc1dwn0M/edit#gid=0 [^]

#2
- the code here seems to be copied, the two subsequent lines need to get a different state I guess:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/c24bbe2a056e68cd75d409d25b7228337691d79f#l2.93 [^]

#3
- generalize the event handlers that set a BP to be non-standard, in a superclass and subclasses for each entity to check
(0087680)
mtaal (manager)
2016-06-20 15:45

#4
- the active column in servers by BP tab should as a default be set to Y

#5
- when a BP is created from webpos then the 'is standard store customer' column should be set to Y. Possibly using a customer hook in retail

#6
- should the client/org be explicitly set here? using the order organization for example:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/file/tip/src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java#l118 [^]

#7
- the code in the OrderEventHandler does not need to run if: 1) the current server is a store server, or 2) the BP is a non-standard BP
(0087784)
hgbot (developer)
2016-06-22 11:06

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: d68bbb706a4085494e5a658ef7d24c034021abd0
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 22 10:18:08 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/d68bbb706a4085494e5a658ef7d24c034021abd0 [^]

Related with issue 32252: Retrieves properly the previous state in event handler

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrganizationEventHandlerForStandardCustomerFlag.java
---
(0087785)
hgbot (developer)
2016-06-22 11:07

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 60eb421ee7849caafc339ebc13e4878f8237cbc0
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Jun 22 11:04:54 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/60eb421ee7849caafc339ebc13e4878f8237cbc0 [^]

Related with issue 32252: Fixes some of the problems found in the code review

The default values in the Business Partners by Store subtab are now calculated problem. There was a javascript error because the business partner (which acts as parent field) field was not defined in that tab. Also the tab level of that tab has been fixed.

The OrderEventHandler event handler is not executed if:
- The server is a store server
- The business partner is a non standard customer (those are synched to all store servers, no need to add them to the business partner by store table)

The client and organization of the new record are taken from the order.

---
M src-db/database/sourcedata/AD_FIELD.xml
M src-db/database/sourcedata/AD_TAB.xml
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java
---
(0087786)
AugustoMauch (manager)
2016-06-22 11:09

Code review items #1, #3 and #5 are pending to be fixed
(0089097)
mtaal (manager)
2016-08-15 12:16

#5 has been done, see issue 33535
(0089167)
hgbot (developer)
2016-08-17 09:19

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: c67137c57a5211d4080683fe5ed1fa400997a683
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Mon Aug 15 11:35:44 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/c67137c57a5211d4080683fe5ed1fa400997a683 [^]

Related with issue 32252: Adds Default Store field to Business Partner

This field will be used in addition to the obstsyn_server_bpartner table to specify the stores where a business partner is a customer. Before this changeset all this info was stored in the obstsyn_server_bpartner, but given that most of the business partner will buy from only one store, it makes sense to include that info in the c_bpartner table itself.

---
M src-db/database/model/modifiedTables/C_BPARTNER.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
M src-db/database/sourcedata/AD_FIELD.xml
---
(0089173)
hgbot (developer)
2016-08-17 10:55
edited on: 2016-08-17 10:56

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: edacffe523c3efd267703d17784dd0494e0d1cd4
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Aug 17 10:48:13 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/edacffe523c3efd267703d17784dd0494e0d1cd4 [^]

Related with issue 32252: Adds default store column to c_bpartner

Most business partners will buy only from one store. It will have better performance to include the default store in the c_bpartner location than having to create a new record for that business partner and that store in the obstsyn_server_bpartner. This change results not only in a big reduction in the volume on obstsyn_server_bpartner, but also on a big performance improvement in the queries related to business partner segmentation.

---
M src-db/database/sourcedata/AD_DATASET_TABLE.xml
M src/org/openbravo/retail/storeserver/synchronization/StoreBusinessPartnerLoaderHook.java
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerLocationRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/BusinessPartnerRouter.java
M src/org/openbravo/retail/storeserver/synchronization/router/LocationRouter.java
A src/org/openbravo/retail/storeserver/synchronization/utils/BusinessPartnerSegmentationUtils.java
---

(0090524)
mtaal (manager)
2016-10-11 10:52

Point #1 is open to be done
(0090535)
AugustoMauch (manager)
2016-10-11 15:17

Code review points #1 and #3 will be addressed in issue https://issues.openbravo.com/view.php?id=34188 [^]
(0091043)
hgbot (developer)
2016-11-01 23:37

Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 817e856e0a8fd9942bbbde50a8189982059375f2
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Tue Nov 01 23:37:07 2016 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/817e856e0a8fd9942bbbde50a8189982059375f2 [^]

Related to issue 32252: Store Server Data Segmentation and Sync for BP
Linking the BPartner to the store needs a OrderLoaderHook as the event handler
is not executing because the triggers are not enabled.

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java
---
(0091044)
mtaal (manager)
2016-11-01 23:38

Previous changesets have been reviewed, last commit should be reviewed by separate developer
(0091052)
AugustoMauch (manager)
2016-11-02 09:56

Code reviewed and verified

- Issue History
Date Modified Username Field Change
2016-02-16 23:27 mtaal New Issue
2016-02-16 23:27 mtaal Assigned To => mtaal
2016-02-16 23:27 mtaal Triggers an Emergency Pack => No
2016-04-11 13:46 mtaal Relationship added has duplicate 0032648
2016-05-22 20:51 AugustoMauch Status new => scheduled
2016-05-22 20:52 AugustoMauch Assigned To mtaal => AugustoMauch
2016-05-22 20:52 AugustoMauch Status scheduled => resolved
2016-05-22 20:52 AugustoMauch Resolution open => fixed
2016-05-22 20:52 AugustoMauch Note Added: 0086635
2016-05-22 20:52 AugustoMauch Note Edited: 0086635 View Revisions
2016-05-22 20:53 AugustoMauch Note Edited: 0086635 View Revisions
2016-05-22 20:55 AugustoMauch Note Added: 0086636
2016-06-06 10:23 mtaal Note Added: 0087018
2016-06-06 10:23 mtaal Status resolved => new
2016-06-06 10:23 mtaal Resolution fixed => open
2016-06-06 10:24 mtaal Note Edited: 0087018 View Revisions
2016-06-08 11:14 hgbot Checkin
2016-06-08 11:14 hgbot Note Added: 0087087
2016-06-08 11:14 hgbot Checkin
2016-06-08 11:14 hgbot Note Added: 0087088
2016-06-08 13:12 hgbot Checkin
2016-06-08 13:12 hgbot Note Added: 0087092
2016-06-08 18:06 hgbot Checkin
2016-06-08 18:06 hgbot Note Added: 0087101
2016-06-08 18:06 hgbot Status new => resolved
2016-06-08 18:06 hgbot Resolution open => fixed
2016-06-08 18:06 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/c24bbe2a056e68cd75d409d25b7228337691d79f [^]
2016-06-09 09:12 AugustoMauch Note Added: 0087109
2016-06-09 09:12 AugustoMauch Status resolved => new
2016-06-09 09:12 AugustoMauch Resolution fixed => open
2016-06-09 17:21 hgbot Checkin
2016-06-09 17:21 hgbot Note Added: 0087140
2016-06-09 17:21 hgbot Checkin
2016-06-09 17:21 hgbot Note Added: 0087141
2016-06-09 17:21 hgbot Checkin
2016-06-09 17:21 hgbot Note Added: 0087142
2016-06-09 17:22 AugustoMauch Status new => scheduled
2016-06-09 17:22 AugustoMauch Status scheduled => resolved
2016-06-09 17:22 AugustoMauch Resolution open => fixed
2016-06-13 16:53 mtaal Review Assigned To => mtaal
2016-06-20 15:35 mtaal Note Added: 0087678
2016-06-20 15:45 mtaal Note Added: 0087680
2016-06-20 15:46 mtaal Status resolved => new
2016-06-20 15:46 mtaal Resolution fixed => open
2016-06-22 11:06 hgbot Checkin
2016-06-22 11:06 hgbot Note Added: 0087784
2016-06-22 11:07 hgbot Checkin
2016-06-22 11:07 hgbot Note Added: 0087785
2016-06-22 11:09 AugustoMauch Note Added: 0087786
2016-06-30 11:57 mtaal Target Version RR16Q3 => RR16Q4
2016-08-10 12:21 mtaal Relationship added causes 0033674
2016-08-10 12:21 mtaal Relationship added related to 0033634
2016-08-10 12:25 mtaal Relationship added related to 0033535
2016-08-15 12:16 mtaal Note Added: 0089097
2016-08-17 09:19 hgbot Checkin
2016-08-17 09:19 hgbot Note Added: 0089167
2016-08-17 10:55 hgbot Checkin
2016-08-17 10:55 hgbot Note Added: 0089173
2016-08-17 10:56 AugustoMauch Note Edited: 0089173 View Revisions
2016-08-17 11:03 AugustoMauch Relationship added related to 0033727
2016-08-22 15:32 AugustoMauch Relationship added has duplicate 0033657
2016-09-05 11:47 AugustoMauch Status new => scheduled
2016-09-05 11:47 AugustoMauch Status scheduled => resolved
2016-09-05 11:47 AugustoMauch Resolution open => fixed
2016-10-11 10:52 mtaal Note Added: 0090524
2016-10-11 10:52 mtaal Status resolved => new
2016-10-11 10:52 mtaal Resolution fixed => open
2016-10-11 15:16 AugustoMauch Relationship added related to 0034188
2016-10-11 15:16 AugustoMauch Status new => scheduled
2016-10-11 15:16 AugustoMauch Status scheduled => resolved
2016-10-11 15:16 AugustoMauch Resolution open => fixed
2016-10-11 15:17 AugustoMauch Note Added: 0090535
2016-11-01 23:37 hgbot Checkin
2016-11-01 23:37 hgbot Note Added: 0091043
2016-11-01 23:38 mtaal Note Added: 0091044
2016-11-02 09:56 AugustoMauch Note Added: 0091052
2016-11-02 09:56 AugustoMauch Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker