details:   https://code.openbravo.com/erp/devel/pi/rev/1a725f0ecbe0
changeset: 20160:1a725f0ecbe0
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Fri Apr 19 22:56:51 2013 +0200
summary:   Related to issue 23596: added 'requestParams' variable

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js
 |   2 +-
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
     |  13 +++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r df60e05286a8 -r 1a725f0ecbe0 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js
        Fri Apr 19 20:36:08 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-clone-order.js
        Fri Apr 19 22:56:51 2013 +0200
@@ -18,4 +18,4 @@
  */
 
 // Create a button to clone a sales order ('Sales Order' tab)
-OB.ToolbarUtils.createCloneButton('org.openbravo.client.application.businesslogic.CloneOrderActionHandler',
 ['186', '294'], OB.I18N.getLabel('OBUIAPP_WantToCloneOrder'));
\ No newline at end of file
+OB.ToolbarUtils.createCloneButton('org.openbravo.client.application.businesslogic.CloneOrderActionHandler',
 null, ['186', '294'], OB.I18N.getLabel('OBUIAPP_WantToCloneOrder'));
\ No newline at end of file
diff -r df60e05286a8 -r 1a725f0ecbe0 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Fri Apr 19 20:36:08 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/toolbar/ob-toolbar.js
    Fri Apr 19 22:56:51 2013 +0200
@@ -1678,10 +1678,11 @@
 };
 
 
-// ** {{{ OB.ToolbarUtils.createCloneButton(/*String*/ actionHandler, 
/*Array[String]*/ tabIds, /*String*/ askMsg, /*Integer*/ sortOrder, /*Boolean*/ 
editRecordAfterClone, /*String*/ buttonId, /*Boolean*/ overwriteIfExists, 
/*Array[String]*/ tabIdsToAvoid}}} **
+// ** {{{ OB.ToolbarUtils.createCloneButton(/*String*/ actionHandler, 
/*Object*/ requestParams, /*Array[String]*/ tabIds, /*String*/ askMsg, 
/*Integer*/ sortOrder, /*Boolean*/ editRecordAfterClone, /*String*/ buttonId, 
/*Boolean*/ overwriteIfExists, /*Array[String]*/ tabIdsToAvoid}}} **
 // Automatically set up a clone button for the provided tabs
 // Parameters:
 // * {{{actionHandler}}}:  action handler which processes and returns the 
cloned record
+// * {{{requestParams}}}: (Optional) aditional parameters to send to the 
action handler
 // * {{{tabIds}}}: (Optional, all tabs will be included by default) array of 
tabIds where this button will be shown
 // * {{{askMsg}}}: (Optional, 'OBUIAPP_WantToCloneRecord' by default) Text 
that will be displayed when the button be pressed.
 // * {{{sortOrder}}}: (Optional, '100' by default) Position in the toolbar of 
the clone button.
@@ -1689,7 +1690,7 @@
 // * {{{buttonId}}}: (Optional, random by default) Don't set it unless you 
plan to do advanced coding with this button (as, for example, overwrite it 
later in another place).
 // * {{{overwriteIfExists}}}: (Optional, false by default) To be able to 
overwrite a particular existing clone button. The buttonId should match with 
the overwritten one.
 // * {{{tabIdsToAvoid}}}: (Optional, no tabs to avoid by default) array of 
tabIds where this button should not be shown
-OB.ToolbarUtils.createCloneButton = function (actionHandler, tabIds, askMsg, 
sortOrder, editRecordAfterClone, buttonId, overwriteIfExists, tabIdsToAvoid) {
+OB.ToolbarUtils.createCloneButton = function (actionHandler, requestParams, 
tabIds, askMsg, sortOrder, editRecordAfterClone, buttonId, overwriteIfExists, 
tabIdsToAvoid) {
   var cloneButtonProps = isc.addProperties({}, 
isc.OBToolbar.CLONE_BUTTON_PROPERTIES);
 
   if (!askMsg) {
@@ -1713,12 +1714,12 @@
         callback;
 
     callback = function (ok) {
-      var requestParams;
+      if (!requestParams) {
+        requestParams = {};
+      }
+      requestParams.recordId = view.viewGrid.getSelectedRecord().id;
 
       if (ok) {
-        requestParams = {
-          recordId: view.viewGrid.getSelectedRecord().id
-        };
         OB.RemoteCallManager.call(actionHandler, {}, requestParams, function 
(rpcResponse, data, rpcRequest) {
           var recordIndex = 
view.viewGrid.getRecordIndex(view.viewGrid.getSelectedRecord()) + 1,
               recordsData = 
view.viewGrid.getDataSource().recordsFromObjects(data)[0];

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to