Openbravo Issue Tracking System - Retail Modules
View Issue Details
0027751Retail ModulesDiscounts and Promotionspublic2014-10-03 12:082014-12-30 23:22
mtaal 
Orekaria 
normalmajorhave not tried
closedfixed 
5
 
RR14Q4RR14Q4 
mtaal
No
No
0027751: Revert dependency on mobile core

Adding dependency on mobile.core will force direct ERP users of this module to also install mobile.core.

The issue affected only prepackaged Q4

a. the dependency was added because the javascript generated file had the discounts code inserted before the mobile.core code, and thus, the discounts code being out of reach of the mobile.core APIs and functions

b. when the dependency was added, the problem was that direct ERP users of this module were forced to install mobile.core

c. after removing the dependency, the discounts stopped working because enyo was the one initializing the methods that discounts needed to work (instead of mobile.core as its now in Q4)

A fix has been made so the discounts javascript code is appended after the mobile.core
.
Solution is to revert this changeset:
https://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/7a87fa636987 [^]
No tags attached.
Issue History
2014-10-03 12:08mtaalNew Issue
2014-10-03 12:08mtaalAssigned To => Orekaria
2014-10-03 12:08mtaalOBNetwork customer => No
2014-10-03 12:08mtaalTriggers an Emergency Pack => No
2014-10-03 13:02hgbotCheckin
2014-10-03 13:02hgbotNote Added: 0070690
2014-10-03 13:02hgbotStatusnew => resolved
2014-10-03 13:02hgbotResolutionopen => fixed
2014-10-03 13:02hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/a4d4091b3673dba49dd1258ce0ad103cba463f5b [^]
2014-10-03 13:41mtaalReview Assigned To => mtaal
2014-10-03 13:41mtaalNote Added: 0070691
2014-10-03 13:41mtaalStatusresolved => closed
2014-10-03 13:41mtaalFixed in Version => RR14Q4
2014-10-04 17:02OrekariaNote Added: 0070710
2014-10-04 17:02OrekariaStatusclosed => new
2014-10-04 17:02OrekariaResolutionfixed => open
2014-10-04 17:02OrekariaFixed in VersionRR14Q4 =>
2014-10-04 17:14hgbotCheckin
2014-10-04 17:14hgbotNote Added: 0070711
2014-10-04 17:14hgbotStatusnew => resolved
2014-10-04 17:14hgbotResolutionopen => fixed
2014-10-04 17:14hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/a4d4091b3673dba49dd1258ce0ad103cba463f5b [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1330a04d606c6f32eb8e06c7142e91ce9d8dbf15 [^]
2014-10-04 17:14hgbotCheckin
2014-10-04 17:14hgbotNote Added: 0070712
2014-10-04 17:14hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1330a04d606c6f32eb8e06c7142e91ce9d8dbf15 [^] => http://code.openbravo.com/erp/devel/pi/rev/9e26e16a3877d87ce79a7bf85a5a919b24cd7c1d [^]
2014-10-05 10:13mtaalNote Added: 0070715
2014-10-05 10:13mtaalStatusresolved => new
2014-10-05 10:13mtaalResolutionfixed => open
2014-10-05 10:38mtaalNote Edited: 0070715bug_revision_view_page.php?bugnote_id=0070715#r6734
2014-10-05 11:02mtaalNote Edited: 0070715bug_revision_view_page.php?bugnote_id=0070715#r6735
2014-10-05 11:03mtaalNote Edited: 0070715bug_revision_view_page.php?bugnote_id=0070715#r6736
2014-10-06 09:45hgbotCheckin
2014-10-06 09:45hgbotNote Added: 0070725
2014-10-06 09:45hgbotStatusnew => resolved
2014-10-06 09:45hgbotResolutionopen => fixed
2014-10-06 09:45hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/9e26e16a3877d87ce79a7bf85a5a919b24cd7c1d [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1dc9dc1c4a2e4d5069ba23fc0b673efeeacc7f38 [^]
2014-10-06 09:45hgbotCheckin
2014-10-06 09:45hgbotNote Added: 0070726
2014-10-06 09:45hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1dc9dc1c4a2e4d5069ba23fc0b673efeeacc7f38 [^] => http://code.openbravo.com/erp/devel/pi/rev/04065681d156f159f421dc981b776f0e1e1d87f2 [^]
2014-10-06 10:23mtaalNote Added: 0070727
2014-10-06 10:55hgbotCheckin
2014-10-06 10:55hgbotNote Added: 0070731
2014-10-06 10:55hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/pi/rev/04065681d156f159f421dc981b776f0e1e1d87f2 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/b31f866bf762e7fc3b7c2f9b34ff3a0a1d2108f3 [^]
2014-10-06 16:03hgbotCheckin
2014-10-06 16:03hgbotNote Added: 0070744
2014-10-06 17:12mtaalNote Added: 0070747
2014-10-06 17:12mtaalStatusresolved => closed
2014-10-06 17:12mtaalFixed in Version => RR14Q4
2014-10-06 22:06mtaalDescription Updatedbug_revision_view_page.php?rev_id=6743#r6743
2014-10-06 22:06mtaalProposed Solution updated
2014-12-30 23:22hudsonbotCheckin
2014-12-30 23:22hudsonbotNote Added: 0072895
2014-12-30 23:22hudsonbotCheckin
2014-12-30 23:22hudsonbotNote Added: 0072898

Notes
(0070690)
hgbot   
2014-10-03 13:02   
Repository: erp/pmods/org.openbravo.retail.discounts
Changeset: a4d4091b3673dba49dd1258ce0ad103cba463f5b
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Fri Oct 03 13:01:42 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.discounts/rev/a4d4091b3673dba49dd1258ce0ad103cba463f5b [^]

Backed out issue 27341 changeset: 7a87fa636987. Fixes issue 27751

Adding dependency on mobile.core forces direct ERP users of this module to also install mobile.core

---
M src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
---
(0070691)
mtaal   
2014-10-03 13:41   
Reviewed
(0070710)
Orekaria   
2014-10-04 17:02   
Discounts have stopped working in the WebPOS
(0070711)
hgbot   
2014-10-04 17:14   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 1330a04d606c6f32eb8e06c7142e91ce9d8dbf15
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Sat Oct 04 17:13:48 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1330a04d606c6f32eb8e06c7142e91ce9d8dbf15 [^]

Fixes issue 27751: discounts is enforced to be dependent of mobile.core

a. If the discounts module is dependent of mobile.core, the ERP is forced to install mobile.core, which is unwanted.
b. If the discounts module is not dependent of mobile.core, the javascript files are inserted before the mobile.core javascript files. This behavior prevent discounts to be computed

A hack has been inserted until better decoupling of mobile from the ERP is made

---
M src/org/openbravo/mobile/core/MobileCoreComponentServlet.java
A src/org/openbravo/mobile/core/MobileCoreKernelUtils.java
---
(0070712)
hgbot   
2014-10-04 17:14   
Repository: erp/devel/pi
Changeset: 9e26e16a3877d87ce79a7bf85a5a919b24cd7c1d
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Sat Oct 04 17:13:51 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9e26e16a3877d87ce79a7bf85a5a919b24cd7c1d [^]

Fixes issue 27751: discounts is enforced to be dependent of mobile.core

a. If the discounts module is dependent of mobile.core, the ERP is forced to install mobile.core, which is unwanted.
b. If the discounts module is not dependent of mobile.core, the javascript files are inserted before the mobile.core javascript files. This behavior prevent discounts to be computed

A hack has been inserted until better decoupling of mobile from the ERP is made

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
---
(0070715)
mtaal   
2014-10-05 10:13   
(edited on: 2014-10-05 11:03)
Some changes:
- make the id's of the modules static private final and declare them in the beginning of the class using capital names (see example of usage below)
- in the overridden method only keep the if-part you added
- add a return at the end of your if statement
- in kernelutils make ModuleDependencyCycleException private again
- add a call to super at the end of the overridden method

So then the overriding method in MobileCoreKernelUtils becomes something like this:
protected int computeLowLevelCode(Module module, List<Module> modules) {
    // Note: doesn't do the if in case the module is already in the modules list
    // this is a dependency cycle handled by the super implementation
   if (module.getId().equals(DISCOUNTS_MOD_ID) && !modules.contains(module)) {
       Module core = OBDal.getInstance().get(Module.class, MOBILE_CORE_MOD_ID);
       return 1 + computeLowLevelCode(core, new ArrayList<Module>());
    }
    super.computeLowLevelCode(module, modules);
}

(0070725)
hgbot   
2014-10-06 09:45   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 1dc9dc1c4a2e4d5069ba23fc0b673efeeacc7f38
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Mon Oct 06 09:44:57 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/1dc9dc1c4a2e4d5069ba23fc0b673efeeacc7f38 [^]

Fixes issue 27751: discounts module dependent on mobile.core (refactor)
- refactored the overriden computeLowLevelCode method
- public class made private

---
M src/org/openbravo/mobile/core/MobileCoreKernelUtils.java
---
(0070726)
hgbot   
2014-10-06 09:45   
Repository: erp/devel/pi
Changeset: 04065681d156f159f421dc981b776f0e1e1d87f2
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Mon Oct 06 09:44:38 2014 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/04065681d156f159f421dc981b776f0e1e1d87f2 [^]

Fixes issue 27751: discounts module dependent on mobile.core (refactor)
- refactored the overriden computeLowLevelCode method
- public class made private

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/KernelUtils.java
---
(0070727)
mtaal   
2014-10-06 10:23   
[10:17:47] Martin Taal: thanks the code can be more simplified
[10:17:57] Martin Taal: the static instance member can go
[10:18:01] Martin Taal: the getInstance also
[10:18:09] Martin Taal: and then in the MobileCoreComponentServlet
[10:18:18] Martin Taal: do new MobileCoreKernelUtils()
[10:18:23] Martin Taal: instead of MobileCoreKernelUtils.getInstance()
[10:18:30] Martin Taal: also there are some comment lines in the MobileCoreKernelUtils
[10:18:34] Martin Taal: which can go
[10:18:46] Martin Taal: the commented static and log member
(0070731)
hgbot   
2014-10-06 10:55   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: b31f866bf762e7fc3b7c2f9b34ff3a0a1d2108f3
Author: Rafa Alonso <rafael.alonso <at> openbravo.com>
Date: Mon Oct 06 10:54:47 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/b31f866bf762e7fc3b7c2f9b34ff3a0a1d2108f3 [^]

Fixes issue 27751: discounts module dependent on mobile.core (refactor II)

---
M src/org/openbravo/mobile/core/MobileCoreComponentServlet.java
M src/org/openbravo/mobile/core/MobileCoreKernelUtils.java
---
(0070744)
hgbot   
2014-10-06 16:03   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 4ef52af25de15a48bc9db3e0e94ab5caede4b01f
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Mon Oct 06 16:03:20 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/4ef52af25de15a48bc9db3e0e94ab5caede4b01f [^]

Related to issue 27751, discounts module dependent on mobile.core (refactor), cosmetic change
Small cosmetic change, removed unneeded code

---
M src/org/openbravo/mobile/core/MobileCoreKernelUtils.java
---
(0070747)
mtaal   
2014-10-06 17:12   
Reviewed and tested
(0072895)
hudsonbot   
2014-12-30 23:22   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/6525fe229e06 [^]
Maturity status: Test
(0072898)
hudsonbot   
2014-12-30 23:22   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/6525fe229e06 [^]
Maturity status: Test