details:   https://code.openbravo.com/erp/devel/pi/rev/616e60ce9a70
changeset: 25033:616e60ce9a70
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Fri Oct 10 11:33:59 2014 +0200
summary:   Fixes issue 27788: Manual datasources can dissallow filtering by id

If the Support Filtering foreign keys by their id field of a manual datasource 
is checked, then in their grids the foreign key columns will always be filtered 
using their identifier instead of their id.

details:   https://code.openbravo.com/erp/devel/pi/rev/8d7c6812b499
changeset: 25034:8d7c6812b499
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Fri Oct 10 11:45:06 2014 +0200
summary:   Related with issue 27788: Updates the printed name of the new field

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl
 |  5 ++++-
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
             |  3 +++
 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
           |  8 ++++++++
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
 |  6 +++---
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
    |  1 +
 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml
                                      |  4 ++--
 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml
                                        |  2 +-
 7 files changed, 22 insertions(+), 7 deletions(-)

diffs (119 lines):

diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl
   Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl
   Fri Oct 10 11:45:06 2014 +0200
@@ -47,7 +47,10 @@
   </#if>
   <#if data.lazyFiltering>
   lazyFiltering: ${data.lazyFiltering?string},
-  </#if>    
+  </#if>  
+  <#if data.alwaysFilterFksByIdentifier>
+  alwaysFilterFksByIdentifier: ${data.alwaysFilterFksByIdentifier?string},
+  </#if>   
   dummy: true
 </@compress>
 }
\ No newline at end of file
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
       Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl
       Fri Oct 10 11:45:06 2014 +0200
@@ -41,6 +41,9 @@
     <#if data.lazyFiltering>
         lazyFiltering: ${data.lazyFiltering?string},
     </#if>    
+    <#if data.alwaysFilterFksByIdentifier>
+        alwaysFilterFksByIdentifier: 
${data.alwaysFilterFksByIdentifier?string},
+    </#if>       
     //List of properties  that must be always included in this grid
     requiredGridProperties: [
     <#list data.requiredGridProperties as property>
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
     Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java
     Fri Oct 10 11:45:06 2014 +0200
@@ -46,6 +46,7 @@
 import org.openbravo.model.ad.ui.Tab;
 import org.openbravo.model.common.order.Order;
 import org.openbravo.model.common.order.OrderLine;
+import org.openbravo.service.datasource.DataSource;
 import org.openbravo.service.db.DalConnectionProvider;
 import org.openbravo.service.json.JsonConstants;
 
@@ -435,4 +436,11 @@
       return false;
     }
   }
+
+  public boolean getAlwaysFilterFksByIdentifier() {
+    DataSource dataSource = tab.getTable().getObserdsDatasource();
+    // always filter using the identifier if the grid fetches its data from a 
manual datasource and
+    // if that datasource does not support filtering foreign keys using their 
ids
+    return (dataSource != null && !dataSource.isSupportIdFkFiltering());
+  }
 }
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
   Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js
   Fri Oct 10 11:45:06 2014 +0200
@@ -167,7 +167,7 @@
     this.multipleValueSeparator = ' or ';
 
     // if the filter by identifier has been disabled using grid configuration, 
set the filter type to 'id'
-    if (this.allowFkFilterByIdentifier === false) {
+    if (this.allowFkFilterByIdentifier === false && 
!grid.alwaysFilterFksByIdentifier) {
       this.filterType = 'id';
     }
   },
@@ -394,7 +394,7 @@
       crit = this.replaceCriterionOperator(crit, value, this.operator);
     }
 
-    if (this.allowFkFilterByIdentifier === false) {
+    if (this.allowFkFilterByIdentifier === false && 
!this.grid.view.alwaysFilterFksByIdentifier) {
       this.filterType = 'id';
     }
 
@@ -554,7 +554,7 @@
   },
 
   handleChanged: function (value) {
-    if (this._pickingValue || this.allowFkFilterByIdentifier === false) {
+    if (!this.grid.sourceWidget.alwaysFilterFksByIdentifier && 
(this._pickingValue || this.allowFkFilterByIdentifier === false)) {
       // if the filter text has changed because a value has been ficked from 
the filter drop down, use the id filter
       // do this also if the only filter type allowed is 'id'
       this.filterType = 'id';
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js
      Fri Oct 10 11:45:06 2014 +0200
@@ -142,6 +142,7 @@
 
     this.orderByClause = this.gridProperties.orderByClause;
     this.sqlOrderByClause = this.gridProperties.sqlOrderByClause;
+    this.alwaysFilterFksByIdentifier = 
this.gridProperties.alwaysFilterFksByIdentifier;
 
     this.checkboxFieldProperties = isc.addProperties({}, 
this.checkboxFieldProperties | {}, {
       canFilter: true,
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml
--- 
a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml
        Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml
        Fri Oct 10 11:45:06 2014 +0200
@@ -62,8 +62,8 @@
 <!--8D2CB81FF7474F4180695E423B6B7829-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--8D2CB81FF7474F4180695E423B6B7829-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8D2CB81FF7474F4180695E423B6B7829-->  
<COLUMNNAME><![CDATA[Idfkfiltering]]></COLUMNNAME>
-<!--8D2CB81FF7474F4180695E423B6B7829-->  <NAME><![CDATA[Support filtering 
foreign keys by their ID]]></NAME>
-<!--8D2CB81FF7474F4180695E423B6B7829-->  <PRINTNAME><![CDATA[Support filtering 
foreign keys by their ID]]></PRINTNAME>
+<!--8D2CB81FF7474F4180695E423B6B7829-->  <NAME><![CDATA[Support Filtering 
Foreign Key Columns Using Their ID]]></NAME>
+<!--8D2CB81FF7474F4180695E423B6B7829-->  <PRINTNAME><![CDATA[Support Filtering 
Foreign Key Columns Using Their ID]]></PRINTNAME>
 <!--8D2CB81FF7474F4180695E423B6B7829-->  <DESCRIPTION><![CDATA[If this flag is 
checked, when a foreign key is filtered by selecting a value from the filter 
drop down, the foreign key will be filtered using its id.]]></DESCRIPTION>
 <!--8D2CB81FF7474F4180695E423B6B7829-->  <HELP><![CDATA[If this flag is 
checked, when a foreign key is filtered by selecting a value from the filter 
drop down, the foreign key will be filtered using its id. If this flag is not 
checked, the foreign key will be filtered using its identifier. ]]></HELP>
 <!--8D2CB81FF7474F4180695E423B6B7829-->  
<AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
diff -r 49bb687fd5ea -r 8d7c6812b499 
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml
--- 
a/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml
  Thu Oct 09 18:49:16 2014 +0200
+++ 
b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml
  Fri Oct 10 11:45:06 2014 +0200
@@ -259,7 +259,7 @@
 <!--6A71A186573D4AD3819455A65678D21B-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--6A71A186573D4AD3819455A65678D21B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--6A71A186573D4AD3819455A65678D21B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--6A71A186573D4AD3819455A65678D21B-->  <NAME><![CDATA[Support filtering 
foreign keys by their ID]]></NAME>
+<!--6A71A186573D4AD3819455A65678D21B-->  <NAME><![CDATA[Support Filtering 
Foreign Key Columns Using Their ID]]></NAME>
 <!--6A71A186573D4AD3819455A65678D21B-->  <DESCRIPTION><![CDATA[If this flag is 
checked, when a foreign key is filtered by selecting a value from the filter 
drop down, the foreign key will be filtered using its id.]]></DESCRIPTION>
 <!--6A71A186573D4AD3819455A65678D21B-->  <HELP><![CDATA[If this flag is 
checked, when a foreign key is filtered by selecting a value from the filter 
drop down, the foreign key will be filtered using its id. If this flag is not 
checked, the foreign key will be filtered using its identifier. ]]></HELP>
 <!--6A71A186573D4AD3819455A65678D21B-->  
<ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>

------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to