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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0031524
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSmajoralways2015-11-18 14:112015-12-29 13:06
ReportermalsasuaView Statuspublic 
Assigned Tomario_castello 
PriorityhighResolutionfixedFixed in VersionRR16Q1
StatusclosedFix in branchFixed in SCM revision1578af5dacef
ProjectionnoneETAnoneTarget Version
OSLinux 32 bitDatabasePostgreSQLJava version1.6.0_18
OS VersionCommunity ApplianceDatabase version8.3.9Ant version1.7.1
Product VersionSCM revision 
Review Assigned Tojorge-garcia
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0031524: hook 'OBPOS_PreCustomerSave' is not working fine

Descriptionthe hook OBPOS_PreCustomerSave is not working fine:
. it is not possible to access to customer object
. it is not possible to cancel
Steps To Reproduce. add the next hook:
OB.MobileApp.model.hookManager.registerHook('OBPOS_PreCustomerSave', function (args, callbacks) {
  // execute all your logic here
  debugger;
});

Proposed Solutionfile: org.openbravo.retail.posterminal/js/pointofsale/view/subwindows/customers/components/sharedcomponents.js

add propossed hooks (comments)


  saveCustomer: function (inSender, inEvent) {
    var me = this,
        sw = me.subWindow;

    function getCustomerValues(params) {
      me.waterfall('onSaveChange', {
        customer: params.customer
      });
    }

    function goToViewWindow(sw, params) {
      if (sw.caller === 'mainSubWindow') {
        sw.doChangeSubWindow({
          newWindow: {
            name: 'customerView',
            params: {
              navigateOnClose: 'mainSubWindow',
              businessPartner: params.customer
            }
          }
        });
      } else {
        sw.doChangeSubWindow({
          newWindow: {
            name: 'customerView',
            params: {
              navigateOnClose: 'customerAdvancedSearch',
              businessPartner: params.customer
            }
          }
        });
      }
    }

    if (this.customer === undefined) {
      this.model.get('customer').newCustomer();
      this.waterfall('onSaveChange', {
        customer: this.model.get('customer')
      });
      this.adjustNames(this.model.get('customer'));
      //Hook here OBPOS_BeforeCustomerSave
      //arg1: customer: this.model.get('customer')
      //arg2: isNew: true
      //callback
      //if (args.cancelOperation) {
      // return
      //}
      var success = this.model.get('customer').saveCustomer();
      if (success) {
        goToViewWindow(sw, {
          customer: OB.UTIL.clone(this.model.get('customer'))
        });
      }
    } else {
      var that = this;
      this.model.get('customer').loadById(this.customer.get('id'), function (customer) {
        getCustomerValues({
          customer: customer
        });
        that.adjustNames(customer);
        //Hook here OBPOS_BeforeCustomerSave
        //arg1: customer: customer
        //arg2: isNew: false
        //callback
        //if (args.cancelOperation) {
        // return
        //}
        var success = customer.saveCustomer();
        if (success) {
          goToViewWindow(sw, {
            customer: customer
          });
        }
      });
    }
  },

Propossed name for the hook: OBPOS_BeforeCustomerSave
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0081965)
Orekaria (administrator)
2015-11-18 22:34
edited on: 2015-11-18 22:35

Cancelation:
The hook can be canceled with the args.passValidation = false value

Customer object:
If the args.meObject.customer is assigned, that customer will be taken
All the available information at that stage can be retrieved within the args.meObject.model value

(0082599)
guilleaer (manager)
2015-12-07 16:39

Don't forget to update the documentation when hook is created
(0082879)
hgbot (developer)
2015-12-19 02:54

Repository: tools/automation/pi-mobile
Changeset: 20539d6c1789a0b3e5c9450a794e97d32c1b76d6
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Fri Dec 18 19:54:18 2015 -0600
URL: http://code.openbravo.com/tools/automation/pi-mobile/rev/20539d6c1789a0b3e5c9450a794e97d32c1b76d6 [^]

Related to issue 31524: Added automation test

---
A src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/system/I31524_HookBeforeCustomerSaveCancelling.java
---
(0082880)
hgbot (developer)
2015-12-19 06:47

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 1578af5dacef7b5fa7fd1c14a3b422de55cf7a75
Author: Mario Castello <mario.castello <at> peoplewalking.com>
Date: Fri Dec 18 23:46:51 2015 -0600
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1578af5dacef7b5fa7fd1c14a3b422de55cf7a75 [^]

Fixed issue 31524: Added new hook OBPOS_BeforeCustomerSave

---
M web/org.openbravo.retail.posterminal/js/pointofsale/view/subwindows/customers/components/sharedcomponents.js
---
(0083046)
jorge-garcia (reporter)
2015-12-29 13:06

Code review and testing OK

- Issue History
Date Modified Username Field Change
2015-11-18 14:11 malsasua New Issue
2015-11-18 14:11 malsasua Assigned To => Retail
2015-11-18 14:11 malsasua Resolution time => 1452121200
2015-11-18 14:11 malsasua Triggers an Emergency Pack => No
2015-11-18 14:12 malsasua Resolution time 1452121200 => 1450566000
2015-11-18 22:34 Orekaria Note Added: 0081965
2015-11-18 22:34 Orekaria Status new => feedback
2015-11-18 22:35 Orekaria Note Edited: 0081965 View Revisions
2015-11-18 22:35 Orekaria Note Edited: 0081965 View Revisions
2015-12-07 12:27 malsasua Status feedback => new
2015-12-07 12:30 Orekaria Status new => acknowledged
2015-12-07 16:39 guilleaer Note Added: 0082599
2015-12-07 16:39 guilleaer Proposed Solution updated
2015-12-12 18:07 Orekaria Summary hook "OBPOS_PreCustomerSave" is not working fine => hook 'OBPOS_PreCustomerSave' is not working fine
2015-12-14 16:23 mario_castello Assigned To Retail => mario_castello
2015-12-14 16:23 mario_castello Status acknowledged => scheduled
2015-12-19 02:54 hgbot Checkin
2015-12-19 02:54 hgbot Note Added: 0082879
2015-12-19 06:47 hgbot Checkin
2015-12-19 06:47 hgbot Note Added: 0082880
2015-12-19 06:47 hgbot Status scheduled => resolved
2015-12-19 06:47 hgbot Resolution open => fixed
2015-12-19 06:47 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/1578af5dacef7b5fa7fd1c14a3b422de55cf7a75 [^]
2015-12-29 12:36 jorge-garcia Review Assigned To => jorge-garcia
2015-12-29 13:06 jorge-garcia Note Added: 0083046
2015-12-29 13:06 jorge-garcia Status resolved => closed
2015-12-29 13:06 jorge-garcia Fixed in Version => RR16Q1


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker