CI: merge back from main
authorRM packaging bot <staff.rm@openbravo.com>
Tue, 08 Mar 2011 16:19:56 +0100
changeset 11109 451c8bcaa1cc
parent 11106 94bf671228f7 (diff)
parent 11108 e044f1628b10 (current diff)
child 11110 fb8d3320754b
CI: merge back from main
--- a/build.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/build.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -926,7 +926,7 @@
                    modules="${module}"
                    stoponerror="true"/>
 
-    <validateModules moduleJavaPackage="${module}" failOnError="false" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
+    <validateModules moduleJavaPackage="${module}" failOnError="true" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
 
     <antcall target="obx.export.database" />
     <antcall target="obx.export.config.script" />
Binary file modules/org.openbravo.advpaymentmngt/build/classes/org/openbravo/advpaymentmngt/modulescript/CreateAccountingConfigurationData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/modifiedTables/FIN_RECONCILIATION.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+  <database name="MODIFIED TABLE FIN_RECONCILIATION">
+    <table name="FIN_RECONCILIATION" primaryKey="FIN_RECONCILIATION_KEY">
+      <column name="EM_APRM_PROCESS_RECONCILIATION" primaryKey="false" required="false" type="VARCHAR" size="60" autoIncrement="false">
+        <default><![CDATA[P]]></default>
+        <onCreateDefault/>
+      </column>
+    </table>
+  </database>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/model/views/APRM_RECONCILIATION_V.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/model/views/APRM_RECONCILIATION_V.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
   <database name="VIEW APRM_RECONCILIATION_V">
-    <view name="APRM_RECONCILIATION_V"><![CDATA[SELECT fin_reconciliation.fin_reconciliation_id AS aprm_reconciliation_v_id, fin_reconciliation.fin_reconciliation_id, fin_reconciliation.ad_client_id, fin_reconciliation.ad_org_id, fin_reconciliation.created, fin_reconciliation.createdby, fin_reconciliation.updated, fin_reconciliation.updatedby, fin_reconciliation.isactive, fin_reconciliation.fin_financial_account_id, fin_reconciliation.documentno, fin_reconciliation.c_doctype_id, fin_reconciliation.dateto, fin_reconciliation.statementdate, fin_reconciliation.endingbalance, fin_reconciliation.startingbalance, fin_reconciliation.docstatus, fin_reconciliation.processing, fin_reconciliation.processed, fin_reconciliation.posted, fin_reconciliation.printdetailed, fin_reconciliation.printsummary, COALESCE(item.item_no, 0) AS item_no, COALESCE(item.item_amt, 0) AS item_amt, COALESCE(unrec.unrec_no, 0) AS unrec_no, COALESCE(unrec.unrec_amt, 0) AS unrec_amt, COALESCE(outstanding.payment_no, 0) AS payment_no, COALESCE(outstanding.payment_amt, 0) AS payment_amt, COALESCE(outstanding.deposit_no, 0) AS deposit_no, COALESCE(outstanding.deposit_amt, 0) AS deposit_amt, (SELECT ad_table.ad_table_id
+    <view name="APRM_RECONCILIATION_V"><![CDATA[SELECT fin_reconciliation.fin_reconciliation_id AS aprm_reconciliation_v_id, fin_reconciliation.fin_reconciliation_id, fin_reconciliation.ad_client_id, fin_reconciliation.ad_org_id, fin_reconciliation.created, fin_reconciliation.createdby, fin_reconciliation.updated, fin_reconciliation.updatedby, fin_reconciliation.isactive, fin_reconciliation.fin_financial_account_id, fin_reconciliation.documentno, fin_reconciliation.c_doctype_id, fin_reconciliation.dateto, fin_reconciliation.statementdate, fin_reconciliation.endingbalance, fin_reconciliation.startingbalance, fin_reconciliation.docstatus, fin_reconciliation.processing, fin_reconciliation.processed, fin_reconciliation.posted, fin_reconciliation.printdetailed, fin_reconciliation.em_aprm_process_reconciliation AS process_reconciliation, fin_reconciliation.printsummary, COALESCE(item.item_no, 0) AS item_no, COALESCE(item.item_amt, 0) AS item_amt, COALESCE(unrec.unrec_no, 0) AS unrec_no, COALESCE(unrec.unrec_amt, 0) AS unrec_amt, COALESCE(outstanding.payment_no, 0) AS payment_no, COALESCE(outstanding.payment_amt, 0) AS payment_amt, COALESCE(outstanding.deposit_no, 0) AS deposit_no, COALESCE(outstanding.deposit_amt, 0) AS deposit_amt, (SELECT ad_table.ad_table_id
 FROM ad_table
 WHERE lower(ad_table.tablename) = 'fin_reconciliation') AS forced_table_id
 FROM fin_reconciliation
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -666,6 +666,41 @@
 <!--57D5BC1D263243128DCD16E2836AE3E1-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--57D5BC1D263243128DCD16E2836AE3E1--></AD_COLUMN>
 
+<!--63454E73F07B4C908EB1268C41F5DE8A--><AD_COLUMN>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_COLUMN_ID><![CDATA[63454E73F07B4C908EB1268C41F5DE8A]]></AD_COLUMN_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <NAME><![CDATA[Process Reconciliation]]></NAME>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <DESCRIPTION><![CDATA[Process Reconciliation Document]]></DESCRIPTION>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <HELP><![CDATA[Used to process and reactivate reconciliation documents]]></HELP>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <COLUMNNAME><![CDATA[Process_Reconciliation]]></COLUMNNAME>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_TABLE_ID><![CDATA[0DFF5BACFB964FDABAA5042C8809C813]]></AD_TABLE_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_REFERENCE_VALUE_ID><![CDATA[36972531DA994BB38ECB91993058282F]]></AD_REFERENCE_VALUE_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <SEQNO><![CDATA[350]]></SEQNO>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_ELEMENT_ID><![CDATA[C8E8009C6BF5427EA930515F217F768E]]></AD_ELEMENT_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_PROCESS_ID><![CDATA[FF8080812E2F8EAE012E2F94CF470014]]></AD_PROCESS_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <POSITION><![CDATA[23]]></POSITION>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <ISAUTOSAVE><![CDATA[N]]></ISAUTOSAVE>
+<!--63454E73F07B4C908EB1268C41F5DE8A-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--63454E73F07B4C908EB1268C41F5DE8A--></AD_COLUMN>
+
 <!--68C853FD393C4620A3947EC34C416B9A--><AD_COLUMN>
 <!--68C853FD393C4620A3947EC34C416B9A-->  <AD_COLUMN_ID><![CDATA[68C853FD393C4620A3947EC34C416B9A]]></AD_COLUMN_ID>
 <!--68C853FD393C4620A3947EC34C416B9A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1762,7 +1797,7 @@
 <!--82EFB8E4045319C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045319C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045319C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045319C9E040007F01003778-->  <POSITION><![CDATA[23]]></POSITION>
+<!--82EFB8E4045319C9E040007F01003778-->  <POSITION><![CDATA[24]]></POSITION>
 <!--82EFB8E4045319C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045319C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045319C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1793,7 +1828,7 @@
 <!--82EFB8E4045419C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045419C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045419C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045419C9E040007F01003778-->  <POSITION><![CDATA[24]]></POSITION>
+<!--82EFB8E4045419C9E040007F01003778-->  <POSITION><![CDATA[25]]></POSITION>
 <!--82EFB8E4045419C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045419C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045419C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1824,7 +1859,7 @@
 <!--82EFB8E4045519C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045519C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045519C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045519C9E040007F01003778-->  <POSITION><![CDATA[25]]></POSITION>
+<!--82EFB8E4045519C9E040007F01003778-->  <POSITION><![CDATA[26]]></POSITION>
 <!--82EFB8E4045519C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045519C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045519C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1855,7 +1890,7 @@
 <!--82EFB8E4045619C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045619C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045619C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045619C9E040007F01003778-->  <POSITION><![CDATA[26]]></POSITION>
+<!--82EFB8E4045619C9E040007F01003778-->  <POSITION><![CDATA[27]]></POSITION>
 <!--82EFB8E4045619C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045619C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045619C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1886,7 +1921,7 @@
 <!--82EFB8E4045719C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045719C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045719C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045719C9E040007F01003778-->  <POSITION><![CDATA[27]]></POSITION>
+<!--82EFB8E4045719C9E040007F01003778-->  <POSITION><![CDATA[28]]></POSITION>
 <!--82EFB8E4045719C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045719C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045719C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1917,7 +1952,7 @@
 <!--82EFB8E4045819C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045819C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045819C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045819C9E040007F01003778-->  <POSITION><![CDATA[28]]></POSITION>
+<!--82EFB8E4045819C9E040007F01003778-->  <POSITION><![CDATA[29]]></POSITION>
 <!--82EFB8E4045819C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045819C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045819C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1948,7 +1983,7 @@
 <!--82EFB8E4045919C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045919C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045919C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045919C9E040007F01003778-->  <POSITION><![CDATA[29]]></POSITION>
+<!--82EFB8E4045919C9E040007F01003778-->  <POSITION><![CDATA[30]]></POSITION>
 <!--82EFB8E4045919C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045919C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045919C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -1979,7 +2014,7 @@
 <!--82EFB8E4045A19C9E040007F01003778-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--82EFB8E4045A19C9E040007F01003778-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--82EFB8E4045A19C9E040007F01003778-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--82EFB8E4045A19C9E040007F01003778-->  <POSITION><![CDATA[30]]></POSITION>
+<!--82EFB8E4045A19C9E040007F01003778-->  <POSITION><![CDATA[31]]></POSITION>
 <!--82EFB8E4045A19C9E040007F01003778-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--82EFB8E4045A19C9E040007F01003778-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--82EFB8E4045A19C9E040007F01003778-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -2046,7 +2081,7 @@
 <!--8448D679EF655513E040007F01001B17-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--8448D679EF655513E040007F01001B17-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--8448D679EF655513E040007F01001B17-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--8448D679EF655513E040007F01001B17-->  <POSITION><![CDATA[31]]></POSITION>
+<!--8448D679EF655513E040007F01001B17-->  <POSITION><![CDATA[32]]></POSITION>
 <!--8448D679EF655513E040007F01001B17-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--8448D679EF655513E040007F01001B17-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--8448D679EF655513E040007F01001B17-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -3179,6 +3214,42 @@
 <!--F30A5F00B30D407B8C05119E8B91A275-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--F30A5F00B30D407B8C05119E8B91A275--></AD_COLUMN>
 
+<!--F362B84F4718449EAD840F1C25667B37--><AD_COLUMN>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_COLUMN_ID><![CDATA[F362B84F4718449EAD840F1C25667B37]]></AD_COLUMN_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F362B84F4718449EAD840F1C25667B37-->  <NAME><![CDATA[EM_APRM_Process_Reconciliation]]></NAME>
+<!--F362B84F4718449EAD840F1C25667B37-->  <DESCRIPTION><![CDATA[Process Reconciliation Document]]></DESCRIPTION>
+<!--F362B84F4718449EAD840F1C25667B37-->  <HELP><![CDATA[Used to process and reactivate reconciliation documents]]></HELP>
+<!--F362B84F4718449EAD840F1C25667B37-->  <COLUMNNAME><![CDATA[EM_APRM_Process_Reconciliation]]></COLUMNNAME>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_TABLE_ID><![CDATA[B1B7075C46934F0A9FD4C4D0F1457B42]]></AD_TABLE_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_REFERENCE_VALUE_ID><![CDATA[FF8080812E443491012E443C053A001A]]></AD_REFERENCE_VALUE_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--F362B84F4718449EAD840F1C25667B37-->  <DEFAULTVALUE><![CDATA[P]]></DEFAULTVALUE>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--F362B84F4718449EAD840F1C25667B37-->  <SEQNO><![CDATA[240]]></SEQNO>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_ELEMENT_ID><![CDATA[C8E8009C6BF5427EA930515F217F768E]]></AD_ELEMENT_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_PROCESS_ID><![CDATA[FF8080812E2F8EAE012E2F94CF470014]]></AD_PROCESS_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--F362B84F4718449EAD840F1C25667B37-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--F362B84F4718449EAD840F1C25667B37-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--F362B84F4718449EAD840F1C25667B37-->  <POSITION><![CDATA[22]]></POSITION>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--F362B84F4718449EAD840F1C25667B37-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--F362B84F4718449EAD840F1C25667B37-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--F362B84F4718449EAD840F1C25667B37--></AD_COLUMN>
+
 <!--F79D0173541B42CD9F41A58D53929BFA--><AD_COLUMN>
 <!--F79D0173541B42CD9F41A58D53929BFA-->  <AD_COLUMN_ID><![CDATA[F79D0173541B42CD9F41A58D53929BFA]]></AD_COLUMN_ID>
 <!--F79D0173541B42CD9F41A58D53929BFA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -225,4 +225,17 @@
 <!--8BBA8342ED3C20FFE040007F01002E9B-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--8BBA8342ED3C20FFE040007F01002E9B--></AD_ELEMENT>
 
+<!--C8E8009C6BF5427EA930515F217F768E--><AD_ELEMENT>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <AD_ELEMENT_ID><![CDATA[C8E8009C6BF5427EA930515F217F768E]]></AD_ELEMENT_ID>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <COLUMNNAME><![CDATA[Process_Reconciliation]]></COLUMNNAME>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <NAME><![CDATA[Process Reconciliation]]></NAME>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <PRINTNAME><![CDATA[Process Reconciliation]]></PRINTNAME>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <DESCRIPTION><![CDATA[Process Reconciliation Document]]></DESCRIPTION>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <HELP><![CDATA[Used to process and reactivate reconciliation documents]]></HELP>
+<!--C8E8009C6BF5427EA930515F217F768E-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C8E8009C6BF5427EA930515F217F768E--></AD_ELEMENT>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -1580,6 +1580,32 @@
 <!--6217B6E7C2CA46E8A399B7B4178F8CEC-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
 <!--6217B6E7C2CA46E8A399B7B4178F8CEC--></AD_FIELD>
 
+<!--6376408E4B3B4208825144CBD72F54CA--><AD_FIELD>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_FIELD_ID><![CDATA[6376408E4B3B4208825144CBD72F54CA]]></AD_FIELD_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <NAME><![CDATA[Reconciliation Process]]></NAME>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <DESCRIPTION><![CDATA[Manages processing of reconciliation documents]]></DESCRIPTION>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_TAB_ID><![CDATA[C095D2CC39704DBE8B906B7CD7710968]]></AD_TAB_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_COLUMN_ID><![CDATA[63454E73F07B4C908EB1268C41F5DE8A]]></AD_COLUMN_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <DISPLAYLOGIC><![CDATA[@Processed@='Y']]></DISPLAYLOGIC>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <SEQNO><![CDATA[192]]></SEQNO>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--6376408E4B3B4208825144CBD72F54CA-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--6376408E4B3B4208825144CBD72F54CA--></AD_FIELD>
+
 <!--642FBD2AB83147E395BF96708345108D--><AD_FIELD>
 <!--642FBD2AB83147E395BF96708345108D-->  <AD_FIELD_ID><![CDATA[642FBD2AB83147E395BF96708345108D]]></AD_FIELD_ID>
 <!--642FBD2AB83147E395BF96708345108D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -3401,7 +3427,7 @@
 <!--82F2E8A160CE472CE040007F01005324-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--82F2E8A160CE472CE040007F01005324-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
 <!--82F2E8A160CE472CE040007F01005324-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
-<!--82F2E8A160CE472CE040007F01005324-->  <SEQNO><![CDATA[190]]></SEQNO>
+<!--82F2E8A160CE472CE040007F01005324-->  <SEQNO><![CDATA[186]]></SEQNO>
 <!--82F2E8A160CE472CE040007F01005324-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--82F2E8A160CE472CE040007F01005324-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--82F2E8A160CE472CE040007F01005324-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -583,4 +583,26 @@
 <!--FCDC2F10EAAD46A5A24BCEC2BF017A05-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--FCDC2F10EAAD46A5A24BCEC2BF017A05--></AD_MESSAGE>
 
+<!--FF8080812E44C5F1012E44D2099A001A--><AD_MESSAGE>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <AD_MESSAGE_ID><![CDATA[FF8080812E44C5F1012E44D2099A001A]]></AD_MESSAGE_ID>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <VALUE><![CDATA[APRM_FutureReconciliationExists]]></VALUE>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <MSGTEXT><![CDATA[Action can not be performed as a later reconciliation exists. First reactivate and delete later reconciliations.]]></MSGTEXT>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--FF8080812E44C5F1012E44D2099A001A-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E44C5F1012E44D2099A001A--></AD_MESSAGE>
+
+<!--FF8080812E44C5F1012E44D35D750020--><AD_MESSAGE>
+<!--FF8080812E44C5F1012E44D35D750020-->  <AD_MESSAGE_ID><![CDATA[FF8080812E44C5F1012E44D35D750020]]></AD_MESSAGE_ID>
+<!--FF8080812E44C5F1012E44D35D750020-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E44C5F1012E44D35D750020-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E44C5F1012E44D35D750020-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E44C5F1012E44D35D750020-->  <VALUE><![CDATA[APRM_ReconciliationNoLines]]></VALUE>
+<!--FF8080812E44C5F1012E44D35D750020-->  <MSGTEXT><![CDATA[Reconciliation contains no line. At least one cleared item is required for a reconciliation document to be processed.]]></MSGTEXT>
+<!--FF8080812E44C5F1012E44D35D750020-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--FF8080812E44C5F1012E44D35D750020-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E44C5F1012E44D35D750020--></AD_MESSAGE>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -216,4 +216,16 @@
 <!--FF73C27402EB45558A1925859CD484F0-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--FF73C27402EB45558A1925859CD484F0--></AD_MODEL_OBJECT>
 
+<!--FF8080812E437710012E43BE26A3000E--><AD_MODEL_OBJECT>
+<!--FF8080812E437710012E43BE26A3000E-->  <AD_MODEL_OBJECT_ID><![CDATA[FF8080812E437710012E43BE26A3000E]]></AD_MODEL_OBJECT_ID>
+<!--FF8080812E437710012E43BE26A3000E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E437710012E43BE26A3000E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E437710012E43BE26A3000E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E437710012E43BE26A3000E-->  <ACTION><![CDATA[P]]></ACTION>
+<!--FF8080812E437710012E43BE26A3000E-->  <CLASSNAME><![CDATA[org.openbravo.advpaymentmngt.process.FIN_ReconciliationProcess]]></CLASSNAME>
+<!--FF8080812E437710012E43BE26A3000E-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--FF8080812E437710012E43BE26A3000E-->  <AD_PROCESS_ID><![CDATA[FF8080812E2F8EAE012E2F94CF470014]]></AD_PROCESS_ID>
+<!--FF8080812E437710012E43BE26A3000E-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--FF8080812E437710012E43BE26A3000E--></AD_MODEL_OBJECT>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -338,4 +338,23 @@
 <!--F68F2890E96D4D85A1DEF0274D105BCE-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
 <!--F68F2890E96D4D85A1DEF0274D105BCE--></AD_PROCESS>
 
+<!--FF8080812E2F8EAE012E2F94CF470014--><AD_PROCESS>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <AD_PROCESS_ID><![CDATA[FF8080812E2F8EAE012E2F94CF470014]]></AD_PROCESS_ID>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <VALUE><![CDATA[ReconciliationProcess]]></VALUE>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <NAME><![CDATA[Reconciliation Process]]></NAME>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <DESCRIPTION><![CDATA[Manages processing of reconciliation documents]]></DESCRIPTION>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ACCESSLEVEL><![CDATA[1]]></ACCESSLEVEL>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISUSERSTARTABLE><![CDATA[N]]></ISUSERSTARTABLE>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISREPORT><![CDATA[N]]></ISREPORT>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISDIRECTPRINT><![CDATA[N]]></ISDIRECTPRINT>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISJASPER><![CDATA[N]]></ISJASPER>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <ISEXTERNALSERVICE><![CDATA[N]]></ISEXTERNALSERVICE>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E2F8EAE012E2F94CF470014-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
+<!--FF8080812E2F8EAE012E2F94CF470014--></AD_PROCESS>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -22,4 +22,26 @@
 <!--800BEB6BDA99409194CADF23988D7B6D-->  <AD_ELEMENT_ID><![CDATA[152]]></AD_ELEMENT_ID>
 <!--800BEB6BDA99409194CADF23988D7B6D--></AD_PROCESS_PARA>
 
+<!--FF8080812E2F8EAE012E2F98D9680030--><AD_PROCESS_PARA>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_PROCESS_PARA_ID><![CDATA[FF8080812E2F8EAE012E2F98D9680030]]></AD_PROCESS_PARA_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <NAME><![CDATA[Action]]></NAME>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <DESCRIPTION><![CDATA[A drop down list box indicating the next step to take.]]></DESCRIPTION>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <HELP><![CDATA[The Action field indicates the Action to be performed for this element.]]></HELP>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_PROCESS_ID><![CDATA[FF8080812E2F8EAE012E2F94CF470014]]></AD_PROCESS_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_REFERENCE_ID><![CDATA[17]]></AD_REFERENCE_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_REFERENCE_VALUE_ID><![CDATA[36972531DA994BB38ECB91993058282F]]></AD_REFERENCE_VALUE_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_VAL_RULE_ID><![CDATA[FF8080812E448A62012E44943A160017]]></AD_VAL_RULE_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <COLUMNNAME><![CDATA[action]]></COLUMNNAME>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <DEFAULTVALUE><![CDATA[@Process_Reconciliation@]]></DEFAULTVALUE>
+<!--FF8080812E2F8EAE012E2F98D9680030-->  <AD_ELEMENT_ID><![CDATA[152]]></AD_ELEMENT_ID>
+<!--FF8080812E2F8EAE012E2F98D9680030--></AD_PROCESS_PARA>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -109,4 +109,17 @@
 <!--F903F726B41A49D3860243101CEEBA25-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--F903F726B41A49D3860243101CEEBA25--></AD_REFERENCE>
 
+<!--FF8080812E443491012E443C053A001A--><AD_REFERENCE>
+<!--FF8080812E443491012E443C053A001A-->  <AD_REFERENCE_ID><![CDATA[FF8080812E443491012E443C053A001A]]></AD_REFERENCE_ID>
+<!--FF8080812E443491012E443C053A001A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E443491012E443C053A001A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E443491012E443C053A001A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E443491012E443C053A001A-->  <NAME><![CDATA[APRM_Reconciliation process actions]]></NAME>
+<!--FF8080812E443491012E443C053A001A-->  <DESCRIPTION><![CDATA[Reconciliation process actions]]></DESCRIPTION>
+<!--FF8080812E443491012E443C053A001A-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E443491012E443C053A001A-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--FF8080812E443491012E443C053A001A-->  <PARENTREFERENCE_ID><![CDATA[17]]></PARENTREFERENCE_ID>
+<!--FF8080812E443491012E443C053A001A-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--FF8080812E443491012E443C053A001A--></AD_REFERENCE>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -118,4 +118,27 @@
 <!--C5D1596D065545B49156C1F9426C9E14-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--C5D1596D065545B49156C1F9426C9E14--></AD_REF_LIST>
 
+<!--FF8080812E443491012E443C4ED60020--><AD_REF_LIST>
+<!--FF8080812E443491012E443C4ED60020-->  <AD_REF_LIST_ID><![CDATA[FF8080812E443491012E443C4ED60020]]></AD_REF_LIST_ID>
+<!--FF8080812E443491012E443C4ED60020-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E443491012E443C4ED60020-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E443491012E443C4ED60020-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E443491012E443C4ED60020-->  <VALUE><![CDATA[R]]></VALUE>
+<!--FF8080812E443491012E443C4ED60020-->  <NAME><![CDATA[Reactivate]]></NAME>
+<!--FF8080812E443491012E443C4ED60020-->  <DESCRIPTION><![CDATA[Reconciliation process actions]]></DESCRIPTION>
+<!--FF8080812E443491012E443C4ED60020-->  <AD_REFERENCE_ID><![CDATA[FF8080812E443491012E443C053A001A]]></AD_REFERENCE_ID>
+<!--FF8080812E443491012E443C4ED60020-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E443491012E443C4ED60020--></AD_REF_LIST>
+
+<!--FF8080812E443491012E443CA7460027--><AD_REF_LIST>
+<!--FF8080812E443491012E443CA7460027-->  <AD_REF_LIST_ID><![CDATA[FF8080812E443491012E443CA7460027]]></AD_REF_LIST_ID>
+<!--FF8080812E443491012E443CA7460027-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E443491012E443CA7460027-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E443491012E443CA7460027-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E443491012E443CA7460027-->  <VALUE><![CDATA[P]]></VALUE>
+<!--FF8080812E443491012E443CA7460027-->  <NAME><![CDATA[Process Reconciliation]]></NAME>
+<!--FF8080812E443491012E443CA7460027-->  <AD_REFERENCE_ID><![CDATA[FF8080812E443491012E443C053A001A]]></AD_REFERENCE_ID>
+<!--FF8080812E443491012E443CA7460027-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E443491012E443CA7460027--></AD_REF_LIST>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_VAL_RULE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_VAL_RULE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -33,4 +33,15 @@
 <!--575E470ABADB4C278132C957A78C47E3-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--575E470ABADB4C278132C957A78C47E3--></AD_VAL_RULE>
 
+<!--FF8080812E448A62012E44943A160017--><AD_VAL_RULE>
+<!--FF8080812E448A62012E44943A160017-->  <AD_VAL_RULE_ID><![CDATA[FF8080812E448A62012E44943A160017]]></AD_VAL_RULE_ID>
+<!--FF8080812E448A62012E44943A160017-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E448A62012E44943A160017-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E448A62012E44943A160017-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E448A62012E44943A160017-->  <NAME><![CDATA[APRM_Process Reconciliation valid actions]]></NAME>
+<!--FF8080812E448A62012E44943A160017-->  <TYPE><![CDATA[S]]></TYPE>
+<!--FF8080812E448A62012E44943A160017-->  <CODE><![CDATA[((@Process_Reconciliation@ = 'P' AND AD_Ref_List.value='P') OR (@Process_Reconciliation@ = 'R' AND AD_Ref_List.value='R') OR (@Process_Reconciliation@ is null))]]></CODE>
+<!--FF8080812E448A62012E44943A160017-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--FF8080812E448A62012E44943A160017--></AD_VAL_RULE>
+
 </data>
--- a/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/CreateAccountingConfiguration_data.xsql	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/org/openbravo/advpaymentmngt/modulescript/CreateAccountingConfiguration_data.xsql	Tue Mar 08 16:19:56 2011 +0100
@@ -70,7 +70,6 @@
             and c_periodcontrol.docbasetype = ad_ref_list.value
             and c_periodcontrol.ad_org_id = a.ad_org_id)
       group by c_period.ad_client_id, c_period.c_period_id, ad_ref_list.value, a.ad_org_id
-      order by c_period.c_period_id, ad_ref_list.value, a.ad_org_id
       ]]>
     </Sql>
   </SqlMethod>
--- a/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/CreateAccountingConfigurationData.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src-util/modulescript/src/src/org/openbravo/advpaymentmngt/modulescript/CreateAccountingConfigurationData.java	Tue Mar 08 16:19:56 2011 +0100
@@ -213,8 +213,7 @@
       "            where c_periodcontrol.c_period_id = c_period.c_period_id" +
       "            and c_periodcontrol.docbasetype = ad_ref_list.value" +
       "            and c_periodcontrol.ad_org_id = a.ad_org_id)" +
-      "      group by c_period.ad_client_id, c_period.c_period_id, ad_ref_list.value, a.ad_org_id" +
-      "      order by c_period.c_period_id, ad_ref_list.value, a.ad_org_id";
+      "      group by c_period.ad_client_id, c_period.c_period_id, ad_ref_list.value, a.ad_org_id";
 
     int updateCount = 0;
     PreparedStatement st = null;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.html	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.html	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -56,64 +56,64 @@
   var frm = document.frmMain;
   var opt = frm.inpTransactionType.value;
   if (frm.inpMainDate.value==null || frm.inpMainDate.value=="") {
-	setWindowElementFocus(frm.inpMainDate);
+    setWindowElementFocus(frm.inpMainDate);
     showJSMessage(7);
     return false;
   }
   if (opt == 'P') {
     var chk = frm.inpPaymentId;
-	if (chk === undefined) {
-	  showJSMessage('NoDataSelected');
+    if (chk === undefined) {
+      showJSMessage('NoDataSelected');
       return false;
-	} else if (chk.length === undefined) {
-	  if (!chk.checked) {
-	    showJSMessage('NoDataSelected');
-        return false;	  
-	  }
-	} else {
-	  var isAnyChecked = false;
-	  var total = chk.length;
-	  for (var i=0;i<total;i++) {
-	    if (chk[i].checked) {
-	      isAnyChecked = true;
-	    }
-	  }
-	  if (!isAnyChecked) {
+    } else if (chk.length === undefined) {
+      if (!chk.checked) {
+        showJSMessage('NoDataSelected');
+        return false;     
+      }
+    } else {
+      var isAnyChecked = false;
+      var total = chk.length;
+      for (var i=0;i<total;i++) {
+        if (chk[i].checked) {
+          isAnyChecked = true;
+        }
+      }
+      if (!isAnyChecked) {
         showJSMessage('NoDataSelected');
         return false;
       }
-	}
+    }
   } else if (opt == 'GL') {
     if (frm.inpGLItemId.value==null || frm.inpGLItemId.value=="") {
       setWindowElementFocus(frm.inpGLItemId);
       showJSMessage(7);
       return false;
-    } else if (frm.paramDebitAmountGLItem.value == "") {
-      setWindowElementFocus(frm.paramDebitAmountGLItem);
+    } else if (frm.paramDepositAmountGLItem.value == "") {
+      setWindowElementFocus(frm.paramDepositAmountGLItem);
       showJSMessage(7);
       return false;
-    } else if (frm.paramCreditAmountGLItem.value == "") {
-      setWindowElementFocus(frm.paramCreditAmountGLItem);
+    } else if (frm.paramPaymentAmountGLItem.value == "") {
+      setWindowElementFocus(frm.paramPaymentAmountGLItem);
       showJSMessage(7);
       return false;
-    } else if ( (compare(frm.paramDebitAmountGLItem.value, '==', 0) && compare(frm.paramCreditAmountGLItem.value, '==', 0)) ||
-                (compare(frm.paramDebitAmountGLItem.value, '!=', 0) && compare(frm.paramCreditAmountGLItem.value, '!=', 0)) ) {
-      setWindowElementFocus(frm.paramCreditAmountGLItem);
+    } else if ( (compare(frm.paramDepositAmountGLItem.value, '==', 0) && compare(frm.paramPaymentAmountGLItem.value, '==', 0)) ||
+                (compare(frm.paramDepositAmountGLItem.value, '!=', 0) && compare(frm.paramPaymentAmountGLItem.value, '!=', 0)) ) {
+      setWindowElementFocus(frm.paramPaymentAmountGLItem);
       showJSMessage('APRM_JSAMOUNTDIFFTOZERO');
       return false;
     }
   } else if (opt == 'F') {
-    if (frm.paramDebitAmount.value == "") {
-      setWindowElementFocus(frm.paramDebitAmount);
+    if (frm.paramDepositAmount.value == "") {
+      setWindowElementFocus(frm.paramDepositAmount);
       showJSMessage(7);
       return false;
-    } else if (frm.paramCreditAmount.value == "") {
-      setWindowElementFocus(frm.paramCreditAmount);
+    } else if (frm.paramPaymentAmount.value == "") {
+      setWindowElementFocus(frm.paramPaymentAmount);
       showJSMessage(7);
       return false;
-    } else if ( (compare(frm.paramDebitAmount.value, '==', 0) && compare(frm.paramCreditAmount.value, '==', 0)) ||
-                (compare(frm.paramDebitAmount.value, '!=', 0) && compare(frm.paramCreditAmount.value, '!=', 0)) ) {
-      setWindowElementFocus(frm.paramCreditAmount);
+    } else if ( (compare(frm.paramDepositAmount.value, '==', 0) && compare(frm.paramPaymentAmount.value, '==', 0)) ||
+                (compare(frm.paramDepositAmount.value, '!=', 0) && compare(frm.paramPaymentAmount.value, '!=', 0)) ) {
+      setWindowElementFocus(frm.paramPaymentAmount);
       showJSMessage('APRM_JSAMOUNTDIFFTOZERO');
       return false;
     }
@@ -514,32 +514,32 @@
                     <td class="Textbox_ContentCell">
                       <table style="border: 0px none; border-collapse: collapse;">
                         <tr><td style="padding-top: 0px;">
-                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpDebitAmount" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramDebitAmount"/>
+                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpDepositAmount" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramDepositAmount"/>
                         </td></tr>
                       </table>
-                      <span id="paramDebitAmountinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramDepositAmountinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="invalid" colspan="2"><div name="invalidText" id="paramDebitAmountinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
+                            <td class="invalid" colspan="2"><div name="invalidText" id="paramDepositAmountinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                           </tr>
                         </tbody></table>
                       </span>
-                      <span id="paramDebitAmountmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramDepositAmountmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="missing" colspan="2"><div name="missingText" id="paramDebitAmountmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
+                            <td class="missing" colspan="2"><div name="missingText" id="paramDepositAmountmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                           </tr>
                           </tbody></table>
                       </span>
                     </td>
                     <td class="FieldButton_ContentCell">
-                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpDebitAmount', document.frmMain.inpDebitAmount.value, false);return false;">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpDepositAmount', document.frmMain.inpDepositAmount.value, false);return false;">
                       <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                         <tr>
                           <td class="FieldButton_bg">
@@ -560,32 +560,32 @@
                     <td class="Textbox_ContentCell">
                       <table style="border: 0px none; border-collapse: collapse;">
                         <tr><td style="padding-top: 0px;">
-                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpCreditAmount" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramCreditAmount"/>
+                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpPaymentAmount" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramPaymentAmount"/>
                         </td></tr>
                       </table>
-                      <span id="paramCreditAmountinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramPaymentAmountinvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="invalid" colspan="2"><div name="invalidText" id="paramCreditAmountinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
+                            <td class="invalid" colspan="2"><div name="invalidText" id="paramPaymentAmountinvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                           </tr>
                         </tbody></table>
                       </span>
-                      <span id="paramCreditAmountmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramPaymentAmountmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="missing" colspan="2"><div name="missingText" id="paramCreditAmountmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
+                            <td class="missing" colspan="2"><div name="missingText" id="paramPaymentAmountmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                           </tr>
                           </tbody></table>
                       </span>
                     </td>
                     <td class="FieldButton_ContentCell">
-                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpCreditAmount', document.frmMain.inpCreditAmount.value, false);return false;">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpPaymentAmount', document.frmMain.inpPaymentAmount.value, false);return false;">
                       <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                         <tr>
                           <td class="FieldButton_bg">
@@ -646,32 +646,32 @@
                     <td class="Textbox_ContentCell">
                     <table style="border: 0px none; border-collapse: collapse;">
                         <tr><td style="padding-top: 0px;">
-                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpDebitAmountGLItem" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramDebitAmountGLItem"/>
+                          <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpDepositAmountGLItem" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramDepositAmountGLItem"/>
                       </td></tr>
                     </table>
-                      <span id="paramDebitAmountGLIteminvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramDepositAmountGLIteminvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="invalid" colspan="2"><div name="invalidText" id="paramDebitAmountGLIteminvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
+                            <td class="invalid" colspan="2"><div name="invalidText" id="paramDepositAmountGLIteminvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                           </tr>
                         </tbody></table>
                       </span>
-                      <span id="paramDebitAmountGLItemmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramDepositAmountGLItemmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="missing" colspan="2"><div name="missingText" id="paramDebitAmountGLItemmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
+                            <td class="missing" colspan="2"><div name="missingText" id="paramDepositAmountGLItemmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                           </tr>
                           </tbody></table>
                       </span>
                     </td>
                     <td class="FieldButton_ContentCell">
-                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpDebitAmountGLItem', document.frmMain.inpDebitAmountGLItem.value, false);return false;">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpDepositAmountGLItem', document.frmMain.inpDepositAmountGLItem.value, false);return false;">
                       <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                         <tr>
                           <td class="FieldButton_bg">
@@ -692,32 +692,32 @@
                     <td class="Textbox_ContentCell">
                     <table style="border: 0px none; border-collapse: collapse;">
                       <tr><td style="padding-top: 0px;">
-                        <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpCreditAmountGLItem" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramCreditAmountGLItem"/>
+                        <input type="text" onblur="numberInputEvent('onblur', this);" onfocus="numberInputEvent('onfocus', this);" outputformat="euroEdition" onchange="numberInputEvent('onchange', this); return true;" onpaste="changeToEditingMode('onpaste');" oncut="changeToEditingMode('oncut');" onkeypress="changeToEditingMode('onkeypress');" onkeydown="changeToEditingMode('onkeydown'); numberInputEvent('onkeydown', this, event);" onkeyup="" name="inpPaymentAmountGLItem" maxlength="22" value="" required="true" class="dojoValidateValid required TextBox_btn_OneCell_width number" id="paramPaymentAmountGLItem"/>
                       </td></tr>
                     </table>
-                      <span id="paramCreditAmountGLIteminvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramPaymentAmountGLIteminvalidSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="invalid" colspan="2"><div name="invalidText" id="paramCreditAmountGLIteminvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
+                            <td class="invalid" colspan="2"><div name="invalidText" id="paramPaymentAmountGLIteminvalidSpanText" class="TextBox_MsgContainer_div2">* The value entered is not valid.</div></td>
                           </tr>
                         </tbody></table>
                       </span>
-                      <span id="paramCreditAmountGLItemmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
+                      <span id="paramPaymentAmountGLItemmissingSpan" style="display: none;" class="TextBox_MsgContainer_span">
                         <table class="TextBox_MsgContainer_table">
                           <tbody><tr class="TextBox_MsgContainer_tr">
                             <td class="TextBox_MsgContainer_td"><div class="TextBox_MsgContainer_div"></div></td><td></td>
                           </tr>
                           <tr>
-                            <td class="missing" colspan="2"><div name="missingText" id="paramCreditAmountGLItemmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
+                            <td class="missing" colspan="2"><div name="missingText" id="paramPaymentAmountGLItemmissingSpanText" class="TextBox_MsgContainer_div2">* This value is required.</div></td>
                           </tr>
                           </tbody></table>
                       </span>
                     </td>
                     <td class="FieldButton_ContentCell">
-                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpCreditAmountGLItem', document.frmMain.inpCreditAmountGLItem.value, false);return false;">
+                      <a class="FieldButtonLink" href="#" onfocus="setWindowElementFocus(this); window.status='Amount From'; return true;" onblur=" window.status=''; return true;" onkeypress="this.className='FieldButtonLink_active'; return true;" onkeyup="this.className='FieldButtonLink_focus'; return true;"  onclick="calculator('frmMain.inpPaymentAmountGLItem', document.frmMain.inpPaymentAmountGLItem.value, false);return false;">
                       <table class="FieldButton" onmouseout="this.className='FieldButton';window.status='';return true;" onmouseover="this.className='FieldButton_hover';window.status='';return true;" onmousedown="this.className='FieldButton_active';return true;" onmouseup="this.className='FieldButton';return true;" id="NoPackageslinkCalc">
                         <tr>
                           <td class="FieldButton_bg">
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -101,20 +101,20 @@
       String strTransactionDate = vars.getStringParameter("inpMainDate", "");
 
       String strGLItemId = vars.getStringParameter("inpGLItemId", "");
-      String strGLItemDebitAmount = vars.getNumericParameter("inpDebitAmountGLItem", "");
-      String strGLItemCreditAmount = vars.getNumericParameter("inpCreditAmountGLItem", "");
+      String strGLItemDepositAmount = vars.getNumericParameter("inpDepositAmountGLItem", "");
+      String strGLItemPaymentAmount = vars.getNumericParameter("inpPaymentAmountGLItem", "");
       String strGLItemDescription = vars.getStringParameter("inpGLItemDescription", "");
 
-      String strFeeDebitAmount = vars.getNumericParameter("inpDebitAmount", "");
-      String strFeeCreditAmount = vars.getNumericParameter("inpCreditAmount", "");
+      String strFeeDepositAmount = vars.getNumericParameter("inpDepositAmount", "");
+      String strFeePaymentAmount = vars.getNumericParameter("inpPaymentAmount", "");
       String strFeeDescription = vars.getStringParameter("inpFeeDescription", "");
 
       String strFinBankStatementLineId = vars.getStringParameter("inpFinBankStatementLineId", "",
           IsIDFilter.instance);
 
       saveAndCloseWindow(response, vars, strTabId, strFinancialAccountId, selectedPaymentsIds,
-          strTransactionType, strGLItemId, strGLItemDebitAmount, strGLItemCreditAmount,
-          strFeeDebitAmount, strFeeCreditAmount, strTransactionDate, strFinBankStatementLineId,
+          strTransactionType, strGLItemId, strGLItemDepositAmount, strGLItemPaymentAmount,
+          strFeeDepositAmount, strFeePaymentAmount, strTransactionDate, strFinBankStatementLineId,
           strGLItemDescription, strFeeDescription);
     }
 
@@ -122,8 +122,8 @@
 
   private void saveAndCloseWindow(HttpServletResponse response, VariablesSecureApp vars,
       String strTabId, String strFinancialAccountId, String selectedPaymentIds,
-      String strTransactionType, String strGLItemId, String strGLItemDebitAmount,
-      String strGLItemCreditAmount, String strFeeDebitAmount, String strFeeCreditAmount,
+      String strTransactionType, String strGLItemId, String strGLItemDepositAmount,
+      String strGLItemPaymentAmount, String strFeeDepositAmount, String strFeePaymentAmount,
       String strTransactionDate, String strFinBankStatementLineId, String strGLItemDescription,
       String strFeeDescription) throws IOException, ServletException {
 
@@ -132,27 +132,27 @@
     OBError msg = new OBError();
     OBContext.setAdminMode();
     try {
-      // SALES = DEPOSIT = DEBIT
-      // PURCHASE = PAYMENT = CREDIT
+      // SALES = DEPOSIT
+      // PURCHASE = PAYMENT
       if (strTransactionType.equals("P")) { // Payment
 
         List<FIN_Payment> selectedPayments = FIN_Utility.getOBObjectList(FIN_Payment.class,
             selectedPaymentIds);
 
         for (FIN_Payment p : selectedPayments) {
-          BigDecimal debitAmt = BigDecimal.ZERO;
-          BigDecimal creditAmt = BigDecimal.ZERO;
+          BigDecimal depositAmt = BigDecimal.ZERO;
+          BigDecimal paymentAmt = BigDecimal.ZERO;
 
           if (p.isReceipt()) {
             if (p.getAmount().compareTo(BigDecimal.ZERO) == -1)
-              creditAmt = p.getAmount().abs();
+              paymentAmt = p.getAmount().abs();
             else
-              debitAmt = p.getAmount();
+              depositAmt = p.getAmount();
           } else {
             if (p.getAmount().compareTo(BigDecimal.ZERO) == -1)
-              debitAmt = p.getAmount().abs();
+              depositAmt = p.getAmount().abs();
             else
-              creditAmt = p.getAmount();
+              paymentAmt = p.getAmount();
           }
           String description = null;
           if (p.getDescription() != null) {
@@ -162,8 +162,8 @@
           FIN_FinaccTransaction finTrans = dao.getNewFinancialTransaction(p.getOrganization(), p
               .getCurrency(), p.getAccount(), TransactionsDao.getTransactionMaxLineNo(p
               .getAccount()) + 10, p, description, FIN_Utility.getDate(strTransactionDate), null, p
-              .isReceipt() ? "RDNC" : "PWNC", debitAmt, creditAmt, null, null, null,
-              p.isReceipt() ? "BPD" : "BPW", FIN_Utility.getDate(strTransactionDate));
+              .isReceipt() ? "RDNC" : "PWNC", depositAmt, paymentAmt, null, null, null, p
+              .isReceipt() ? "BPD" : "BPW", FIN_Utility.getDate(strTransactionDate));
 
           TransactionsDao.process(finTrans);
           if (!"".equals(strFinBankStatementLineId)) {
@@ -176,8 +176,8 @@
         }
 
       } else if (strTransactionType.equals("GL")) { // GL Item
-        BigDecimal glItemDebitAmt = new BigDecimal(strGLItemDebitAmount);
-        BigDecimal glItemCreditAmt = new BigDecimal(strGLItemCreditAmount);
+        BigDecimal glItemDepositAmt = new BigDecimal(strGLItemDepositAmount);
+        BigDecimal glItemPaymentAmt = new BigDecimal(strGLItemPaymentAmount);
 
         FIN_FinancialAccount account = OBDal.getInstance().get(FIN_FinancialAccount.class,
             strFinancialAccountId);
@@ -185,13 +185,13 @@
         String description = strGLItemDescription.isEmpty() ? Utility.messageBD(this,
             "APRM_GLItem", vars.getLanguage())
             + ": " + glItem.getName() : strGLItemDescription;
-        boolean isReceipt = (glItemDebitAmt.compareTo(glItemCreditAmt) >= 0);
+        boolean isReceipt = (glItemDepositAmt.compareTo(glItemPaymentAmt) >= 0);
 
         // Currency, Organization, paymentDate,
         FIN_FinaccTransaction finTrans = dao.getNewFinancialTransaction(account.getOrganization(),
             account.getCurrency(), account, TransactionsDao.getTransactionMaxLineNo(account) + 10,
             null, description, FIN_Utility.getDate(strTransactionDate), glItem, isReceipt ? "RDNC"
-                : "PWNC", glItemDebitAmt, glItemCreditAmt, null, null, null, isReceipt ? "BPD"
+                : "PWNC", glItemDepositAmt, glItemPaymentAmt, null, null, null, isReceipt ? "BPD"
                 : "BPW", FIN_Utility.getDate(strTransactionDate));
 
         TransactionsDao.process(finTrans);
@@ -201,18 +201,18 @@
         }
 
       } else if (strTransactionType.equals("F")) { // Fee
-        BigDecimal feeDebitAmt = new BigDecimal(strFeeDebitAmount);
-        BigDecimal feeCreditAmt = new BigDecimal(strFeeCreditAmount);
+        BigDecimal feeDepositAmt = new BigDecimal(strFeeDepositAmount);
+        BigDecimal feePaymentAmt = new BigDecimal(strFeePaymentAmount);
         FIN_FinancialAccount account = OBDal.getInstance().get(FIN_FinancialAccount.class,
             strFinancialAccountId);
-        boolean isReceipt = (feeDebitAmt.compareTo(feeCreditAmt) >= 0);
+        boolean isReceipt = (feeDepositAmt.compareTo(feePaymentAmt) >= 0);
         String description = strFeeDescription.isEmpty() ? Utility.messageBD(this, "APRM_BankFee",
             vars.getLanguage()) : strFeeDescription;
 
         FIN_FinaccTransaction finTrans = dao.getNewFinancialTransaction(account.getOrganization(),
             account.getCurrency(), account, TransactionsDao.getTransactionMaxLineNo(account) + 10,
             null, description, FIN_Utility.getDate(strTransactionDate), null, isReceipt ? "RDNC"
-                : "PWNC", feeDebitAmt, feeCreditAmt, null, null, null, "BF", FIN_Utility
+                : "PWNC", feeDepositAmt, feePaymentAmt, null, null, null, "BF", FIN_Utility
                 .getDate(strTransactionDate));
 
         TransactionsDao.process(finTrans);
@@ -279,17 +279,17 @@
           "dateFormat.java");
       SimpleDateFormat dateFormater = new SimpleDateFormat(dateFormat);
 
-      xmlDocument.setParameter("debitAmount", bsl.getDramount().toString());
-      xmlDocument.setParameter("creditAmount", bsl.getCramount().toString());
-      xmlDocument.setParameter("debitAmountGLItem", bsl.getDramount().toString());
-      xmlDocument.setParameter("creditAmountGLItem", bsl.getCramount().toString());
+      xmlDocument.setParameter("depositAmount", bsl.getCramount().toString());
+      xmlDocument.setParameter("paymentAmount", bsl.getDramount().toString());
+      xmlDocument.setParameter("depositAmountGLItem", bsl.getCramount().toString());
+      xmlDocument.setParameter("paymentAmountGLItem", bsl.getDramount().toString());
       xmlDocument.setParameter("mainDate", dateFormater.format(bsl.getTransactionDate()));
 
     } else {
-      xmlDocument.setParameter("debitAmount", BigDecimal.ZERO.toString());
-      xmlDocument.setParameter("creditAmount", BigDecimal.ZERO.toString());
-      xmlDocument.setParameter("debitAmountGLItem", BigDecimal.ZERO.toString());
-      xmlDocument.setParameter("creditAmountGLItem", BigDecimal.ZERO.toString());
+      xmlDocument.setParameter("depositAmount", BigDecimal.ZERO.toString());
+      xmlDocument.setParameter("paymentAmount", BigDecimal.ZERO.toString());
+      xmlDocument.setParameter("depositAmountGLItem", BigDecimal.ZERO.toString());
+      xmlDocument.setParameter("paymentAmountGLItem", BigDecimal.ZERO.toString());
     }
 
     response.setContentType("text/html; charset=UTF-8");
@@ -356,8 +356,8 @@
     empty.put("paymentInfo", "");
     empty.put("paymentDescription", "");
     empty.put("paymentDate", "");
-    empty.put("debitAmount", "");
-    empty.put("creditAmount", "");
+    empty.put("depositAmount", "");
+    empty.put("paymentAmount", "");
     ArrayList<HashMap<String, String>> result = new ArrayList<HashMap<String, String>>();
     result.add(empty);
     return FieldProviderFactory.getFieldProviderArray(result);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransaction.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -30,10 +30,10 @@
     <PARAMETER id="paramMainDate" name="mainDate" attribute="value"/>
     <PARAMETER id="paramMainDate" name="dateDisplayFormat" attribute="displayformat" replace="xx"/>
     <PARAMETER id="paramMainDate" name="dateDisplayFormat" attribute="saveformat" replace="yy"/>
-    <PARAMETER id="paramDebitAmount" name="debitAmount" attribute="value" format="euroEdition"/>
-    <PARAMETER id="paramCreditAmount" name="creditAmount" attribute="value" format="euroEdition"/>
-    <PARAMETER id="paramDebitAmountGLItem" name="debitAmountGLItem" attribute="value" format="euroEdition"/>
-    <PARAMETER id="paramCreditAmountGLItem" name="creditAmountGLItem" attribute="value" format="euroEdition"/>
+    <PARAMETER id="paramDepositAmount" name="depositAmount" attribute="value" format="euroEdition"/>
+    <PARAMETER id="paramPaymentAmount" name="paymentAmount" attribute="value" format="euroEdition"/>
+    <PARAMETER id="paramDepositAmountGLItem" name="depositAmountGLItem" attribute="value" format="euroEdition"/>
+    <PARAMETER id="paramPaymentAmountGLItem" name="paymentAmountGLItem" attribute="value" format="euroEdition"/>
     <PARAMETER id="paramDateFrom" name="dateDisplayFormat" attribute="displayformat" replace="xx"/>
     <PARAMETER id="paramDateFrom" name="dateDisplayFormat" attribute="saveformat" replace="yy"/>
     <PARAMETER id="paramDateTo" name="dateDisplayFormat" attribute="displayformat" replace="xx"/>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransactionGrid.srpt	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransactionGrid.srpt	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -23,7 +23,7 @@
     <td class="DataGrid_Body_Cell" id="fieldPayment">xx</td>
     <td class="DataGrid_Body_Cell" title="zz" id="fieldDescription">xxDescription</td>
     <td class="DataGrid_Body_Cell" id="fieldDate">xx12/12/2009</td>
-    <td class="DataGrid_Body_Cell_Amount" id="fieldDebitAmount">xx150.00</td>
-    <td class="DataGrid_Body_Cell_Amount" id="fieldCreditAmount">xx60.00</td>
+    <td class="DataGrid_Body_Cell_Amount" id="fieldDepositAmount">xx150.00</td>
+    <td class="DataGrid_Body_Cell_Amount" id="fieldPaymentAmount">xx60.00</td>
   </tr>
 </div>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransactionGrid.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddTransactionGrid.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -30,8 +30,8 @@
     <FIELD id="fieldDescription">paymentDescriptionTrunc</FIELD>
     <FIELD id="fieldDescription" attribute="title" replace="zz">paymentDescription</FIELD>
     <FIELD id="fieldDate">paymentDate</FIELD>
-    <FIELD id="fieldDebitAmount" format="euroEdition">debitAmount</FIELD>
-    <FIELD id="fieldCreditAmount" format="euroEdition">creditAmount</FIELD>
+    <FIELD id="fieldDepositAmount" format="euroEdition">depositAmount</FIELD>
+    <FIELD id="fieldPaymentAmount" format="euroEdition">paymentAmount</FIELD>
 
     <SECTION id="sectionLinesDetail"/>
   </structure>
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ExecutePayments.java	Tue Mar 08 16:19:56 2011 +0100
@@ -67,7 +67,15 @@
           IsIDFilter.instance);
       String strTabId = vars.getGlobalVariable("inpTabId", "ExecutePayments|Tab_ID", "",
           IsIDFilter.instance);
-      PaymentExecutionProcess executionProcess = getExecutionProcess(vars, strWindowId);
+
+      PaymentExecutionProcess executionProcess = null;
+      try {
+        OBContext.setAdminMode(true);
+        executionProcess = getExecutionProcess(vars, strWindowId);
+      } finally {
+        OBContext.restorePreviousMode();
+      }
+
       if (executionProcess == null) {
         OBError message = Utility
             .translateError(this, vars, vars.getLanguage(), Utility.parseTranslation(this, vars,
@@ -86,8 +94,8 @@
           IsIDFilter.instance);
       final String executionProcess = vars.getRequiredStringParameter("inpExecutionProcess",
           IsIDFilter.instance);
-      processAndClose(response, vars, strWindowId, dao.getObject(PaymentExecutionProcess.class,
-          executionProcess), payments, dao.getObject(Organization.class, strOrganizationId));
+      processAndClose(response, vars, strWindowId, executionProcess, payments, dao.getObject(
+          Organization.class, strOrganizationId));
     }
   }
 
@@ -136,13 +144,15 @@
   }
 
   private void processAndClose(HttpServletResponse response, VariablesSecureApp vars,
-      String strWindowId, PaymentExecutionProcess executionProcess, String strPayments,
-      Organization organization) throws ServletException, IOException {
+      String strWindowId, String execProcess, String strPayments, Organization organization)
+      throws ServletException, IOException {
     log4j.debug("Output: Execute Payments process and close");
     dao = new AdvPaymentMngtDao();
     OBError result = new OBError();
     OBContext.setAdminMode();
     try {
+      PaymentExecutionProcess executionProcess = dao.getObject(PaymentExecutionProcess.class,
+          execProcess);
       List<PaymentExecutionProcessParameter> executionProcessInParameters = dao
           .getInPaymentExecutionParameters(executionProcess);
       HashMap<String, String> parameters = null;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.html	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.html	Tue Mar 08 16:19:56 2011 +0100
@@ -472,12 +472,12 @@
                       <tr>
                         <td colspan="5" style="text-align: center; font-weight: bold;">Imported Bank Statement Lines</td>
                         <td style="text-align: center;"></td>
-                        <td colspan="4" style="text-align: center; font-weight: bold;">Transactions in Openbravo</td>
+                        <td colspan="5" style="text-align: center; font-weight: bold;">Transactions in Openbravo</td>
                       </tr>
                       <tr style="border-top: thin solid gray;">
                         <td colspan="5" style="border-right: thin solid gray;"><span class="LabelText">Show</span><span><select name="inpPaymentTypeFilter" class="ComboKey Combo_TwoCells_width required" id="inpPaymentTypeFilter" onchange="loadGrid(); return true;"><option value="" class="discard">Deposits and payments</option></select></span>&nbsp;&nbsp;<span>Cleared</span><span><input type="checkbox" name="inpShowCleared" id="inpShowCleared" value="Y" onclick="loadGrid(); return true;" /></span></td>
                         <td style="text-align: center;"></td>
-                        <td colspan="4" style="border-left: thin solid gray;"></span>&nbsp;&nbsp;<span>Hide transactions after statement date</span>&nbsp;&nbsp;<span><input type="checkbox" name="inphideDate" id="fieldhideDate" value="Y" onClick="loadGrid(); return true;"/></span>&nbsp;&nbsp;<span>Ending Date</span>&nbsp;&nbsp;<span type="LabelText" id="paramDateTo"></span></td>
+                        <td colspan="5" style="border-left: thin solid gray;"></span>&nbsp;&nbsp;<span>Hide transactions after statement date</span>&nbsp;&nbsp;<span><input type="checkbox" name="inphideDate" id="fieldhideDate" value="Y" onClick="loadGrid(); return true;"/></span>&nbsp;&nbsp;<span>Ending Date</span>&nbsp;&nbsp;<span type="LabelText" id="paramDateTo"></span></td>
                       </tr>
                       <tr class="DataGrid_Body_Row">
                         <th class="DataGrid_Header_LineNoCell DataGrid_Body_Cell_CheckBox" width="25">
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/MatchTransaction.java	Tue Mar 08 16:19:56 2011 +0100
@@ -96,6 +96,14 @@
           .get(FIN_FinancialAccount.class, strFinancialAccountId), "N");
       int reconciledItems = 0;
       if (reconciliation != null) {
+        if (isManualReconciliation(reconciliation)) {
+          OBDal.getInstance().rollbackAndClose();
+          OBError message = Utility.translateError(this, vars, vars.getLanguage(), Utility
+              .parseTranslation(this, vars, vars.getLanguage(), "@APRM_ReconciliationMixed@"));
+          vars.setMessage(strTabId, message);
+          printPageClosePopUp(response, vars, Utility.getTabURL(strTabId, "R", true));
+          return;
+        }
         OBContext.setAdminMode();
         try {
           getSnapShot(reconciliation);
@@ -286,6 +294,7 @@
           .getBankStatementLineMaxDate(financialAccount));
       reconciliation.setProcessed(process);
       reconciliation.setDocumentStatus(process ? "CO" : "DR");
+      reconciliation.setAPRMProcessReconciliation(process ? "R" : "P");
       OBDal.getInstance().save(reconciliation);
       OBDal.getInstance().flush();
     } catch (Exception ex) {
@@ -357,14 +366,6 @@
       printPageClosePopUp(response, vars, Utility.getTabURL(strTabId, "R", true));
       return;
     }
-    if (isManualReconciliation(reconciliation)) {
-      OBDal.getInstance().rollbackAndClose();
-      OBError message = Utility.translateError(this, vars, vars.getLanguage(), Utility
-          .parseTranslation(this, vars, vars.getLanguage(), "@APRM_ReconciliationMixed@"));
-      vars.setMessage(strTabId, message);
-      printPageClosePopUp(response, vars, Utility.getTabURL(strTabId, "R", true));
-      return;
-    }
     try {
       ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "",
           "0CC268ED2E8D4B0397A0DCBBFA2237DE", "", Utility.getContext(this, vars,
@@ -595,9 +596,11 @@
   }
 
   private void getSnapShot(FIN_Reconciliation reconciliation) {
-    // First remove old temp info if exists
+    if (reconciliation == null)
+      return;
     OBContext.setAdminMode();
     try {
+      // First remove old temp info if exists
       List<FIN_ReconciliationLineTemp> oldTempLines = reconciliation
           .getFINReconciliationLineTempList();
       for (FIN_ReconciliationLineTemp oldtempLine : oldTempLines) {
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/ProcessInvoice.java	Tue Mar 08 16:19:56 2011 +0100
@@ -143,7 +143,15 @@
         } else
           vars.setMessage(strTabId, myMessage);
       }
-      List<FIN_Payment> payments = dao.getPendingExecutionPayments(strC_Invoice_ID);
+
+      List<FIN_Payment> payments = null;
+      try {
+        OBContext.setAdminMode(true);
+        payments = dao.getPendingExecutionPayments(strC_Invoice_ID);
+      } finally {
+        OBContext.restorePreviousMode();
+      }
+
       if (payments != null && payments.size() > 0) {
         vars.setSessionValue("ExecutePayments|Window_ID", strWindowId);
         vars.setSessionValue("ExecutePayments|Tab_ID", strTabId);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/Reconciliation.java	Tue Mar 08 16:19:56 2011 +0100
@@ -211,6 +211,7 @@
       reconciliation.setEndingDate(FIN_Utility.getDateTime(strStatementDate));
       reconciliation.setDocumentStatus(process ? "CO" : "DR");
       reconciliation.setProcessed(process);
+      reconciliation.setAPRMProcessReconciliation(process ? "R" : "P");
       OBDal.getInstance().save(reconciliation);
       OBDal.getInstance().flush();
 
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2010 Openbravo SLU
+ * All portions are Copyright (C) 2010-2011 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  *************************************************************************
@@ -24,8 +24,8 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+
 import org.hibernate.criterion.Criterion;
-
 import org.hibernate.criterion.Expression;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.advpaymentmngt.APRMPendingPaymentFromInvoice;
@@ -825,19 +825,19 @@
       FieldProvider[] data = FieldProviderFactory.getFieldProviderArray(paymentOBList);
 
       for (int i = 0; i < data.length; i++) {
-        BigDecimal debitAmt = BigDecimal.ZERO;
-        BigDecimal creditAmt = BigDecimal.ZERO;
+        BigDecimal depositAmt = BigDecimal.ZERO;
+        BigDecimal paymentAmt = BigDecimal.ZERO;
 
         if (FIN_Payments[i].isReceipt()) {
           if (FIN_Payments[i].getAmount().compareTo(BigDecimal.ZERO) == -1)
-            creditAmt = FIN_Payments[i].getAmount().abs();
+            paymentAmt = FIN_Payments[i].getAmount().abs();
           else
-            debitAmt = FIN_Payments[i].getAmount();
+            depositAmt = FIN_Payments[i].getAmount();
         } else {
           if (FIN_Payments[i].getAmount().compareTo(BigDecimal.ZERO) == -1)
-            debitAmt = FIN_Payments[i].getAmount().abs();
+            depositAmt = FIN_Payments[i].getAmount().abs();
           else
-            creditAmt = FIN_Payments[i].getAmount();
+            paymentAmt = FIN_Payments[i].getAmount();
         }
 
         FieldProviderFactory.setField(data[i], "paymentId", FIN_Payments[i].getId());
@@ -858,8 +858,8 @@
 
         FieldProviderFactory.setField(data[i], "paymentDate", dateFormater.format(
             FIN_Payments[i].getPaymentDate()).toString());
-        FieldProviderFactory.setField(data[i], "debitAmount", debitAmt.toString());
-        FieldProviderFactory.setField(data[i], "creditAmount", creditAmt.toString());
+        FieldProviderFactory.setField(data[i], "depositAmount", depositAmt.toString());
+        FieldProviderFactory.setField(data[i], "paymentAmount", paymentAmt.toString());
         FieldProviderFactory.setField(data[i], "rownum", "" + i);
       }
 
@@ -949,7 +949,7 @@
       }
 
       obc.add(exp.getCriterion()); // compoundexp will be always != null because
-                                   // finAccsMethods.isEmpty() == false
+      // finAccsMethods.isEmpty() == false
     }
     return obc.list();
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_ReconciliationProcess.java	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,159 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.advpaymentmngt.process;
+
+import java.util.List;
+
+import org.hibernate.criterion.Expression;
+import org.hibernate.criterion.Order;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.database.ConnectionProvider;
+import org.openbravo.erpCommon.utility.OBError;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.model.financialmgmt.payment.FIN_BankStatement;
+import org.openbravo.model.financialmgmt.payment.FIN_Reconciliation;
+import org.openbravo.scheduling.ProcessBundle;
+
+public class FIN_ReconciliationProcess implements org.openbravo.scheduling.Process {
+  private static AdvPaymentMngtDao dao;
+
+  public void execute(ProcessBundle bundle) throws Exception {
+    dao = new AdvPaymentMngtDao();
+    OBError msg = new OBError();
+    msg.setType("Success");
+    msg.setTitle(Utility.messageBD(bundle.getConnection(), "Success", bundle.getContext()
+        .getLanguage()));
+
+    OBContext.setAdminMode();
+    try {
+      // retrieve custom params
+      final String strAction = (String) bundle.getParams().get("action");
+
+      // retrieve standard params
+      final String recordID = (String) bundle.getParams().get("Aprm_Reconciliation_V_ID");
+      final FIN_Reconciliation reconciliation = dao.getObject(FIN_Reconciliation.class, recordID);
+      final VariablesSecureApp vars = bundle.getContext().toVars();
+      final ConnectionProvider conProvider = bundle.getConnection();
+      reconciliation.setProcessNow(true);
+      OBDal.getInstance().save(reconciliation);
+      OBDal.getInstance().flush();
+      if (strAction.equals("P")) {
+        // Check lines exist
+        if (reconciliation.getFINReconciliationLineVList().size() == 0) {
+          msg.setType("Error");
+          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+              "@APRM_ReconciliationNoLines@" + ": " + reconciliation.getDocumentNo()));
+          bundle.setResult(msg);
+          return;
+        }
+        reconciliation.setProcessed(true);
+        reconciliation.setAPRMProcessReconciliation("R");
+        reconciliation.setDocumentStatus("CO");
+        OBDal.getInstance().save(reconciliation);
+        OBDal.getInstance().flush();
+
+        // ***********************
+        // Reactivate Reconciliation
+        // ***********************
+      } else if (strAction.equals("R")) {
+        // Already Posted Document
+        if ("Y".equals(reconciliation.getPosted())) {
+          msg.setType("Error");
+          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+              "@PostedDocument@" + ": " + reconciliation.getDocumentNo()));
+          bundle.setResult(msg);
+          return;
+        }
+        // Transaction exists
+        if (!isLastReconciliation(reconciliation)) {
+          msg.setType("Error");
+          msg.setTitle(Utility.messageBD(conProvider, "Error", vars.getLanguage()));
+          msg.setMessage(Utility.parseTranslation(conProvider, vars, vars.getLanguage(),
+              "@APRM_FutureReconciliationExists@"));
+          bundle.setResult(msg);
+          return;
+        }
+        reconciliation.setProcessed(false);
+        OBDal.getInstance().save(reconciliation);
+        OBDal.getInstance().flush();
+        reconciliation.setDocumentStatus("DR");
+        reconciliation.setAPRMProcessReconciliation("P");
+        OBDal.getInstance().save(reconciliation);
+        OBDal.getInstance().flush();
+      }
+      reconciliation.setProcessNow(false);
+      OBDal.getInstance().save(reconciliation);
+      OBDal.getInstance().flush();
+      bundle.setResult(msg);
+    } catch (final Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      e.printStackTrace(System.err);
+      msg.setType("Error");
+      msg.setTitle(Utility.messageBD(bundle.getConnection(), "Error", bundle.getContext()
+          .getLanguage()));
+      msg.setMessage(FIN_Utility.getExceptionMessage(e));
+      bundle.setResult(msg);
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
+  private boolean isLastReconciliation(FIN_Reconciliation reconciliation) {
+    final OBCriteria<FIN_Reconciliation> obc = OBDal.getInstance().createCriteria(
+        FIN_Reconciliation.class);
+    obc.add(Expression.ge(FIN_Reconciliation.PROPERTY_ENDINGDATE, reconciliation.getEndingDate()));
+    obc.add(Expression.gt(FIN_Reconciliation.PROPERTY_CREATIONDATE, reconciliation
+        .getCreationDate()));
+    obc.add(Expression.eq(FIN_Reconciliation.PROPERTY_ACCOUNT, reconciliation.getAccount()));
+    obc.addOrder(Order.asc(FIN_Reconciliation.PROPERTY_ENDINGDATE));
+    obc.addOrder(Order.asc(FIN_Reconciliation.PROPERTY_CREATIONDATE));
+    final List<FIN_Reconciliation> reconciliations = obc.list();
+    if (reconciliations.size() == 0) {
+      return true;
+    } else if (reconciliations.size() == 1) {
+      if (reconciliations.get(0).isProcessed()) {
+        return false;
+      } else if (reconciliations.get(0).getFINReconciliationLineVList().size() == 0) {
+        FIN_Reconciliation reconciliationToDelete = OBDal.getInstance().get(
+            FIN_Reconciliation.class, reconciliations.get(0).getId());
+        for (FIN_BankStatement bst : reconciliationToDelete.getFINBankStatementList()) {
+          FIN_BankStatement bankstatement = OBDal.getInstance().get(FIN_BankStatement.class,
+              bst.getId());
+          bankstatement.setFINReconciliation(null);
+          OBDal.getInstance().save(bankstatement);
+          OBDal.getInstance().flush();
+        }
+        OBDal.getInstance().remove(reconciliationToDelete);
+        OBDal.getInstance().flush();
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+}
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -116,7 +116,7 @@
 <!--2052DF26669F4864B295C17502F53E38-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2052DF26669F4864B295C17502F53E38-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2052DF26669F4864B295C17502F53E38-->  <VALUE><![CDATA[OBUIAPP_EditInGrid]]></VALUE>
-<!--2052DF26669F4864B295C17502F53E38-->  <MSGTEXT><![CDATA[Edit in Grid]]></MSGTEXT>
+<!--2052DF26669F4864B295C17502F53E38-->  <MSGTEXT><![CDATA[Edit in grid ]]></MSGTEXT>
 <!--2052DF26669F4864B295C17502F53E38-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--2052DF26669F4864B295C17502F53E38-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--2052DF26669F4864B295C17502F53E38--></AD_MESSAGE>
@@ -750,6 +750,17 @@
 <!--FF8080812DDB247F012DDCFAB5EC01A4-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8080812DDB247F012DDCFAB5EC01A4--></AD_MESSAGE>
 
+<!--FF8080812E8126B7012E8134F22F0013--><AD_MESSAGE>
+<!--FF8080812E8126B7012E8134F22F0013-->  <AD_MESSAGE_ID><![CDATA[FF8080812E8126B7012E8134F22F0013]]></AD_MESSAGE_ID>
+<!--FF8080812E8126B7012E8134F22F0013-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E8126B7012E8134F22F0013-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E8126B7012E8134F22F0013-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E8126B7012E8134F22F0013-->  <VALUE><![CDATA[OBUIAPP_ExportGrid]]></VALUE>
+<!--FF8080812E8126B7012E8134F22F0013-->  <MSGTEXT><![CDATA[Export to Spreadsheet]]></MSGTEXT>
+<!--FF8080812E8126B7012E8134F22F0013-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8080812E8126B7012E8134F22F0013-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8080812E8126B7012E8134F22F0013--></AD_MESSAGE>
+
 <!--FF8081812D6761CF012D676DF2A70045--><AD_MESSAGE>
 <!--FF8081812D6761CF012D676DF2A70045-->  <AD_MESSAGE_ID><![CDATA[FF8081812D6761CF012D676DF2A70045]]></AD_MESSAGE_ID>
 <!--FF8081812D6761CF012D676DF2A70045-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1124,4 +1135,411 @@
 <!--FF8081812E0F2FB1012E0F3248D5000B-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8081812E0F2FB1012E0F3248D5000B--></AD_MESSAGE>
 
+<!--FF8081812E7BA4E8012E7BABECB30008--><AD_MESSAGE>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BA4E8012E7BABECB30008]]></AD_MESSAGE_ID>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <VALUE><![CDATA[OBUIAPP_Delete]]></VALUE>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <MSGTEXT><![CDATA[Delete]]></MSGTEXT>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BA4E8012E7BABECB30008-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BA4E8012E7BABECB30008--></AD_MESSAGE>
+
+<!--FF8081812E7BA4E8012E7BAD022D001A--><AD_MESSAGE>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BA4E8012E7BAD022D001A]]></AD_MESSAGE_ID>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <VALUE><![CDATA[OBUIAPP_EditInForm]]></VALUE>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <MSGTEXT><![CDATA[Edit in form]]></MSGTEXT>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BA4E8012E7BAD022D001A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BA4E8012E7BAD022D001A--></AD_MESSAGE>
+
+<!--FF8081812E7BA4E8012E7BAD74830021--><AD_MESSAGE>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BA4E8012E7BAD74830021]]></AD_MESSAGE_ID>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <VALUE><![CDATA[OBUIAPP_CreateRecordInGrid]]></VALUE>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <MSGTEXT><![CDATA[New record in grid]]></MSGTEXT>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BA4E8012E7BAD74830021-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BA4E8012E7BAD74830021--></AD_MESSAGE>
+
+<!--FF8081812E7BA4E8012E7BADC6FE0028--><AD_MESSAGE>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BA4E8012E7BADC6FE0028]]></AD_MESSAGE_ID>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <VALUE><![CDATA[OBUIAPP_CreateRecordInForm]]></VALUE>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <MSGTEXT><![CDATA[New record in form]]></MSGTEXT>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BA4E8012E7BADC6FE0028-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BA4E8012E7BADC6FE0028--></AD_MESSAGE>
+
+<!--FF8081812E7BEED8012E7BFA9EC0000D--><AD_MESSAGE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_MESSAGE_ID><![CDATA[FF8081812E7BEED8012E7BFA9EC0000D]]></AD_MESSAGE_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <VALUE><![CDATA[OBUIAPP_SaveClose]]></VALUE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <MSGTEXT><![CDATA[Save and close form view ]]></MSGTEXT>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E7BEED8012E7BFA9EC0000D-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BEED8012E7BFA9EC0000D--></AD_MESSAGE>
+
+<!--FF8081812E867351012E867555F90008--><AD_MESSAGE>
+<!--FF8081812E867351012E867555F90008-->  <AD_MESSAGE_ID><![CDATA[FF8081812E867351012E867555F90008]]></AD_MESSAGE_ID>
+<!--FF8081812E867351012E867555F90008-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E867351012E867555F90008-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E867351012E867555F90008-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E867351012E867555F90008-->  <VALUE><![CDATA[OBUIAPP_UndoChanges]]></VALUE>
+<!--FF8081812E867351012E867555F90008-->  <MSGTEXT><![CDATA[Undo changes]]></MSGTEXT>
+<!--FF8081812E867351012E867555F90008-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E867351012E867555F90008-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E867351012E867555F90008--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91304C6F000C--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91304C6F000C-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91304C6F000C]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91304C6F000C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91304C6F000C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91304C6F000C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91304C6F000C-->  <VALUE><![CDATA[OBUIAPP_Clear]]></VALUE>
+<!--FF8081812E912BB3012E91304C6F000C-->  <MSGTEXT><![CDATA[Clear]]></MSGTEXT>
+<!--FF8081812E912BB3012E91304C6F000C-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91304C6F000C-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91304C6F000C--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91319A280016--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91319A280016-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91319A280016]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91319A280016-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91319A280016-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91319A280016-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91319A280016-->  <VALUE><![CDATA[OBUIAPP_SelectDateRange]]></VALUE>
+<!--FF8081812E912BB3012E91319A280016-->  <MSGTEXT><![CDATA[Select Date Range]]></MSGTEXT>
+<!--FF8081812E912BB3012E91319A280016-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91319A280016-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91319A280016--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91322DF70019--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91322DF70019-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91322DF70019]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91322DF70019-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91322DF70019-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91322DF70019-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91322DF70019-->  <VALUE><![CDATA[OBUIAPP_fromDateOnlyPrefix]]></VALUE>
+<!--FF8081812E912BB3012E91322DF70019-->  <MSGTEXT><![CDATA[Since]]></MSGTEXT>
+<!--FF8081812E912BB3012E91322DF70019-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91322DF70019-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91322DF70019--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91326D8E001B--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91326D8E001B-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91326D8E001B]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91326D8E001B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91326D8E001B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91326D8E001B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91326D8E001B-->  <VALUE><![CDATA[OBUIAPP_toDateOnlyPrefix]]></VALUE>
+<!--FF8081812E912BB3012E91326D8E001B-->  <MSGTEXT><![CDATA[before]]></MSGTEXT>
+<!--FF8081812E912BB3012E91326D8E001B-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91326D8E001B-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91326D8E001B--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91329CBF001D--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91329CBF001D-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91329CBF001D]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91329CBF001D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91329CBF001D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91329CBF001D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91329CBF001D-->  <VALUE><![CDATA[OBUIAPP_pickerIconPrompt]]></VALUE>
+<!--FF8081812E912BB3012E91329CBF001D-->  <MSGTEXT><![CDATA[Show Date Chooser]]></MSGTEXT>
+<!--FF8081812E912BB3012E91329CBF001D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91329CBF001D-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91329CBF001D--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E9134734B0026--><AD_MESSAGE>
+<!--FF8081812E912BB3012E9134734B0026-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E9134734B0026]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E9134734B0026-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E9134734B0026-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E9134734B0026-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E9134734B0026-->  <VALUE><![CDATA[OBUIAPP_Yesterday]]></VALUE>
+<!--FF8081812E912BB3012E9134734B0026-->  <MSGTEXT><![CDATA[Yesterday]]></MSGTEXT>
+<!--FF8081812E912BB3012E9134734B0026-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E9134734B0026-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E9134734B0026--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913494000028--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913494000028-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913494000028]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913494000028-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913494000028-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913494000028-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913494000028-->  <VALUE><![CDATA[OBUIAPP_Tomorrow]]></VALUE>
+<!--FF8081812E912BB3012E913494000028-->  <MSGTEXT><![CDATA[Tomorrow]]></MSGTEXT>
+<!--FF8081812E912BB3012E913494000028-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913494000028-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913494000028--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E9135478A002A--><AD_MESSAGE>
+<!--FF8081812E912BB3012E9135478A002A-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E9135478A002A]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E9135478A002A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E9135478A002A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E9135478A002A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E9135478A002A-->  <VALUE><![CDATA[OBUIAPP_Current_day_of_last_week]]></VALUE>
+<!--FF8081812E912BB3012E9135478A002A-->  <MSGTEXT><![CDATA[Current day of last week]]></MSGTEXT>
+<!--FF8081812E912BB3012E9135478A002A-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E9135478A002A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E9135478A002A--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91359A27002C--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91359A27002C-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91359A27002C]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91359A27002C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91359A27002C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91359A27002C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91359A27002C-->  <VALUE><![CDATA[OBUIAPP_Current_day_of_next_week]]></VALUE>
+<!--FF8081812E912BB3012E91359A27002C-->  <MSGTEXT><![CDATA[Current day of next week]]></MSGTEXT>
+<!--FF8081812E912BB3012E91359A27002C-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91359A27002C-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91359A27002C--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91360278002E--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91360278002E-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91360278002E]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91360278002E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91360278002E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91360278002E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91360278002E-->  <VALUE><![CDATA[OBUIAPP_Current_day_of_last_month]]></VALUE>
+<!--FF8081812E912BB3012E91360278002E-->  <MSGTEXT><![CDATA[Current day of last month]]></MSGTEXT>
+<!--FF8081812E912BB3012E91360278002E-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91360278002E-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91360278002E--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913666110030--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913666110030-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913666110030]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913666110030-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913666110030-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913666110030-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913666110030-->  <VALUE><![CDATA[OBUIAPP_Current_day_of_next_month]]></VALUE>
+<!--FF8081812E912BB3012E913666110030-->  <MSGTEXT><![CDATA[Current day of next month]]></MSGTEXT>
+<!--FF8081812E912BB3012E913666110030-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913666110030-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913666110030--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E91383CE40032--><AD_MESSAGE>
+<!--FF8081812E912BB3012E91383CE40032-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E91383CE40032]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E91383CE40032-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E91383CE40032-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E91383CE40032-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E91383CE40032-->  <VALUE><![CDATA[OBUIAPP_milliseconds_ago]]></VALUE>
+<!--FF8081812E912BB3012E91383CE40032-->  <MSGTEXT><![CDATA[N milliseconds ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E91383CE40032-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E91383CE40032-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E91383CE40032--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913893820034--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913893820034-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913893820034]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913893820034-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913893820034-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913893820034-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913893820034-->  <VALUE><![CDATA[OBUIAPP_seconds_ago]]></VALUE>
+<!--FF8081812E912BB3012E913893820034-->  <MSGTEXT><![CDATA[N seconds ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913893820034-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913893820034-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913893820034--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E9139884E0041--><AD_MESSAGE>
+<!--FF8081812E912BB3012E9139884E0041-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E9139884E0041]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E9139884E0041-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E9139884E0041-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E9139884E0041-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E9139884E0041-->  <VALUE><![CDATA[OBUIAPP_minutes_ago]]></VALUE>
+<!--FF8081812E912BB3012E9139884E0041-->  <MSGTEXT><![CDATA[N minutes ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E9139884E0041-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E9139884E0041-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E9139884E0041--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E9139D3780046--><AD_MESSAGE>
+<!--FF8081812E912BB3012E9139D3780046-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E9139D3780046]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E9139D3780046-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E9139D3780046-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E9139D3780046-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E9139D3780046-->  <VALUE><![CDATA[OBUIAPP_hours_ago]]></VALUE>
+<!--FF8081812E912BB3012E9139D3780046-->  <MSGTEXT><![CDATA[N hours ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E9139D3780046-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E9139D3780046-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E9139D3780046--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913A2E79004C--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913A2E79004C-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913A2E79004C]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913A2E79004C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913A2E79004C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913A2E79004C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913A2E79004C-->  <VALUE><![CDATA[OBUIAPP_days_ago]]></VALUE>
+<!--FF8081812E912BB3012E913A2E79004C-->  <MSGTEXT><![CDATA[N days ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913A2E79004C-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913A2E79004C-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913A2E79004C--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913A6F6A0051--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913A6F6A0051]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <VALUE><![CDATA[OBUIAPP_weeks_ago]]></VALUE>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <MSGTEXT><![CDATA[N weeks ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913A6F6A0051-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913A6F6A0051--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913AA71D0054--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913AA71D0054-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913AA71D0054]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913AA71D0054-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913AA71D0054-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913AA71D0054-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913AA71D0054-->  <VALUE><![CDATA[OBUIAPP_months_ago]]></VALUE>
+<!--FF8081812E912BB3012E913AA71D0054-->  <MSGTEXT><![CDATA[N months ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913AA71D0054-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913AA71D0054-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913AA71D0054--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913AF51C005B--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913AF51C005B-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913AF51C005B]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913AF51C005B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913AF51C005B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913AF51C005B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913AF51C005B-->  <VALUE><![CDATA[OBUIAPP_quarters_ago]]></VALUE>
+<!--FF8081812E912BB3012E913AF51C005B-->  <MSGTEXT><![CDATA[N quarters ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913AF51C005B-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913AF51C005B-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913AF51C005B--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913B27C3005E--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913B27C3005E-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913B27C3005E]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913B27C3005E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913B27C3005E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913B27C3005E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913B27C3005E-->  <VALUE><![CDATA[OBUIAPP_years_ago]]></VALUE>
+<!--FF8081812E912BB3012E913B27C3005E-->  <MSGTEXT><![CDATA[N years ago]]></MSGTEXT>
+<!--FF8081812E912BB3012E913B27C3005E-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913B27C3005E-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913B27C3005E--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913C5DE60064--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913C5DE60064-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913C5DE60064]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913C5DE60064-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913C5DE60064-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913C5DE60064-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913C5DE60064-->  <VALUE><![CDATA[OBUIAPP_milliseconds_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913C5DE60064-->  <MSGTEXT><![CDATA[N milliseconds from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913C5DE60064-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913C5DE60064-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913C5DE60064--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913D01A6006E--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913D01A6006E-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913D01A6006E]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913D01A6006E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913D01A6006E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913D01A6006E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913D01A6006E-->  <VALUE><![CDATA[OBUIAPP_seconds_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913D01A6006E-->  <MSGTEXT><![CDATA[N seconds from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913D01A6006E-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913D01A6006E-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913D01A6006E--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913D3F4D0071--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913D3F4D0071]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <VALUE><![CDATA[OBUIAPP_minutes_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <MSGTEXT><![CDATA[N minutes from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913D3F4D0071-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913D3F4D0071--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913D7F9B0076--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913D7F9B0076]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <VALUE><![CDATA[OBUIAPP_hours_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <MSGTEXT><![CDATA[N hours from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913D7F9B0076-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913D7F9B0076--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913DDC70007B--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913DDC70007B-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913DDC70007B]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913DDC70007B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913DDC70007B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913DDC70007B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913DDC70007B-->  <VALUE><![CDATA[OBUIAPP_days_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913DDC70007B-->  <MSGTEXT><![CDATA[N days from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913DDC70007B-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913DDC70007B-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913DDC70007B--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913E2624007E--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913E2624007E-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913E2624007E]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913E2624007E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913E2624007E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913E2624007E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913E2624007E-->  <VALUE><![CDATA[OBUIAPP_weeks_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913E2624007E-->  <MSGTEXT><![CDATA[N weeks from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913E2624007E-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913E2624007E-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913E2624007E--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913E65190081--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913E65190081-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913E65190081]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913E65190081-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913E65190081-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913E65190081-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913E65190081-->  <VALUE><![CDATA[OBUIAPP_months_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913E65190081-->  <MSGTEXT><![CDATA[N months from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913E65190081-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913E65190081-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913E65190081--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913EAA910084--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913EAA910084-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913EAA910084]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913EAA910084-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913EAA910084-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913EAA910084-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913EAA910084-->  <VALUE><![CDATA[OBUIAPP_quarters_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913EAA910084-->  <MSGTEXT><![CDATA[N quarters from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913EAA910084-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913EAA910084-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913EAA910084--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E913EDED20087--><AD_MESSAGE>
+<!--FF8081812E912BB3012E913EDED20087-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E913EDED20087]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E913EDED20087-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E913EDED20087-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E913EDED20087-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E913EDED20087-->  <VALUE><![CDATA[OBUIAPP_years_from_now]]></VALUE>
+<!--FF8081812E912BB3012E913EDED20087-->  <MSGTEXT><![CDATA[N years from now]]></MSGTEXT>
+<!--FF8081812E912BB3012E913EDED20087-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E913EDED20087-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E913EDED20087--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E914469EE009A--><AD_MESSAGE>
+<!--FF8081812E912BB3012E914469EE009A-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E914469EE009A]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E914469EE009A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E914469EE009A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E914469EE009A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E914469EE009A-->  <VALUE><![CDATA[OBUIAPP_To]]></VALUE>
+<!--FF8081812E912BB3012E914469EE009A-->  <MSGTEXT><![CDATA[To]]></MSGTEXT>
+<!--FF8081812E912BB3012E914469EE009A-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E914469EE009A-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E914469EE009A--></AD_MESSAGE>
+
+<!--FF8081812E912BB3012E9144BF08009F--><AD_MESSAGE>
+<!--FF8081812E912BB3012E9144BF08009F-->  <AD_MESSAGE_ID><![CDATA[FF8081812E912BB3012E9144BF08009F]]></AD_MESSAGE_ID>
+<!--FF8081812E912BB3012E9144BF08009F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E912BB3012E9144BF08009F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E912BB3012E9144BF08009F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E912BB3012E9144BF08009F-->  <VALUE><![CDATA[OBUIAPP_From]]></VALUE>
+<!--FF8081812E912BB3012E9144BF08009F-->  <MSGTEXT><![CDATA[From]]></MSGTEXT>
+<!--FF8081812E912BB3012E9144BF08009F-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--FF8081812E912BB3012E9144BF08009F-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E912BB3012E9144BF08009F--></AD_MESSAGE>
+
 </data>
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_PREFERENCE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -28,7 +28,9 @@
   {"id": "TabSet_ActivateTab9", "keyComb": {"ctrl": true, "alt": true, "key": "9"}},
   {"id": "TabSet_closeAllTabs", "keyComb": {"ctrl": true, "alt": true, "key": "0"}},
   {"id": "TabSet_ActivateRightTab", "keyComb": {"ctrl": true, "alt": true, "key": "+"}},
-  {"id": "TabSet_ActivateLeftTab", "keyComb": {"ctrl": true, "alt": true, "key": "-"}}
+  {"id": "TabSet_ActivateLeftTab", "keyComb": {"ctrl": true, "alt": true, "key": "-"}},
+  {"id": "Grid_EditInForm", "keyComb": {"ctrl": true, "alt": false, "key": "f2"}},
+  {"id": "Grid_EditInGrid", "keyComb": {"ctrl": false, "alt": false, "key": "f2"}}
 ]]]></VALUE>
 <!--5EE6D055A7FE4C4DA7EB557F6C61D0EA-->  <PROPERTY><![CDATA[OBUIAPP_KeyboardShortcuts]]></PROPERTY>
 <!--5EE6D055A7FE4C4DA7EB557F6C61D0EA-->  <ISPROPERTYLIST><![CDATA[Y]]></ISPROPERTYLIST>
@@ -60,6 +62,7 @@
 <!--7EE6D055A7FE4C4DA7EB557F6C61D0EC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7EE6D055A7FE4C4DA7EB557F6C61D0EC-->  <VALUE><![CDATA[[
   {"id": "ToolBar_Save", "keyComb": {"ctrl": true, "alt": true, "key": "S"}},
+  {"id": "ToolBar_SaveClose", "keyComb": {"ctrl": true, "alt": true, "key": "X"}},
   {"id": "ToolBar_NewRow", "keyComb": {"ctrl": true, "alt": true, "key": "I"}},
   {"id": "ToolBar_NewDoc", "keyComb": {"ctrl": true, "alt": true, "key": "N"}},
   {"id": "ToolBar_Eliminate", "keyComb": {"ctrl": true, "alt": true, "key": "D"}},
--- a/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -163,4 +163,16 @@
 <!--FF8081812DB867FE012DB86CD07D0017-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
 <!--FF8081812DB867FE012DB86CD07D0017--></AD_REF_LIST>
 
+<!--FF8081812E7BEED8012E7C2FCFB30063--><AD_REF_LIST>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_REF_LIST_ID><![CDATA[FF8081812E7BEED8012E7C2FCFB30063]]></AD_REF_LIST_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <VALUE><![CDATA[OBUIAPP_RecentViewList]]></VALUE>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <NAME><![CDATA[Recent views shown in the workspace]]></NAME>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <DESCRIPTION><![CDATA[Recent views shown in the workspace]]></DESCRIPTION>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063-->  <AD_MODULE_ID><![CDATA[9BA0836A3CD74EE4AB48753A47211BCC]]></AD_MODULE_ID>
+<!--FF8081812E7BEED8012E7C2FCFB30063--></AD_REF_LIST>
+
 </data>
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-field.js.ftl	Tue Mar 08 16:19:56 2011 +0100
@@ -45,15 +45,9 @@
           <#if fieldDefinition.showIf != "">
           showIf: function(item, value, form, values) {            
             var context = form.view.getContextInfo(false, true, true),
-                currentValues = values || form.view.getCurrentValues(), i;
-
-            // Fixing null values to match 2.50 behaviour '' == null
-            for(i in currentValues) { 
-              if(currentValues.hasOwnProperty(i) && 
-                 currentValues[i] === null) {
-                currentValues[i] = '';
-              }
-            }
+                currentValues = values || form.view.getCurrentValues();
+            
+            OB.Utilities.fixNull250(currentValues);
 
             return context && (${fieldDefinition.showIf});
           },          
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-tab.js.ftl	Tue Mar 08 16:19:56 2011 +0100
@@ -70,6 +70,7 @@
        <#if field.showIf != "">
        , displayIf: function(item, value, form, currentValues) {
          currentValues = currentValues || form.view.getCurrentValues();
+         OB.Utilities.fixNull250(currentValues);
          var context = form.view.getContextInfo(false, true, true);
          return context && (${field.showIf});
        }
@@ -77,6 +78,7 @@
        <#if field.readOnlyIf != "">
        , readOnlyIf: function(item, value, form, currentValues) {
          currentValues = currentValues || form.view.getCurrentValues();
+         OB.Utilities.fixNull250(currentValues);
          var context = form.view.getContextInfo(false, true, true);
          return context && (${field.readOnlyIf});
        }
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java	Tue Mar 08 16:19:56 2011 +0100
@@ -774,13 +774,9 @@
         calloutsToCall.remove(calloutClassName);
         lastfieldChangedList.remove(lastFieldChanged);
         Object calloutInstance = calloutClass.newInstance();
-        Method method = null;
         Method init = null;
         Method service = null;
         for (Method m : calloutClass.getMethods()) {
-          if (m.getName().equals("doPost")) {
-            method = m;
-          }
           if (m.getName().equals("init") && m.getParameterTypes().length == 1) {
             init = m;
           }
@@ -789,7 +785,7 @@
           }
         }
 
-        if (method == null || init == null || service == null) {
+        if (init == null || service == null) {
           log.info("Couldn't find method in Callout " + calloutClassName);
         } else {
           RequestContext rq = RequestContext.get();
@@ -803,8 +799,10 @@
           init.invoke(calloutInstance, initArgs);
           CalloutHttpServletResponse fakeResponse = new CalloutHttpServletResponse(rq.getResponse());
           Object[] arguments = { rq.getRequest(), fakeResponse };
+
+          // We invoke the service method. This method will automatically call the doPost() method
+          // of the callout servlet
           service.invoke(calloutInstance, arguments);
-          method.invoke(calloutInstance, arguments);
           String calloutResponse = fakeResponse.getOutputFromWriter();
 
           // Now we parse the callout response and modify the stored values of the columns modified
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-application-menu.js	Tue Mar 08 16:19:56 2011 +0100
@@ -113,8 +113,9 @@
     var isClassicEnvironment = OB.Utilities.useClassicMode(item.windowId);
     var selectedView = null;
     if (item.tabId) {
-      selectedView = OB.Utilities.openView(item.windowId, item.tabId, item.title);
+      selectedView = OB.Utilities.openView(item.windowId, item.tabId, item.title, null, null, item.icon);
       selectedView.type = item.type;
+      selectedView.icon = item.icon;
       if (selectedView) {
         OB.RecentUtilities.addRecent('UINAVBA_MenuRecentList', selectedView);
       }
@@ -138,6 +139,7 @@
     } else if (item.externalUrl) {
       selectedView = {viewId: 'OBExternalPage', contentsURL: item.externalUrl, id: item.externalUrl, command: 'DEFAULT', tabTitle: item.title};
     }
+    selectedView.icon = item.icon;
     selectedView.type = item.type;
     OB.RecentUtilities.addRecent('UINAVBA_MenuRecentList', selectedView);
     OB.Layout.ViewManager.openView(selectedView.viewId, selectedView);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js	Tue Mar 08 16:19:56 2011 +0100
@@ -22,9 +22,11 @@
 // * OBSearchItem: item used for search fields.
 // * OBFormButton: button used in forms.
 // * OBTextItem: string/text item
+// * OBLinkItem: string/text/link item
 // * OBTextAreaItem: string/text-area item
 // * OBDateItem: FormItem for dates
 // * OBDateTimeItem: FormItem for DateTime
+// * OBMiniDateRangeItem: FormItem for dates
 // * OBNumber: FormItem for numbers
 // * OBYesNoItem: combo box for yes/no values
 // * OBLinkTitleItem: an interface supporting a link button in the title.
@@ -37,6 +39,7 @@
 isc.ClassFactory.defineClass('OBCheckboxItem', CheckboxItem);
 
 isc.OBCheckboxItem.addProperties({
+  operator: 'equals',
   // no validation on change or exit here
   textBoxStyle: 'OBFormFieldLabel',
   showValueIconOver: true,
@@ -52,6 +55,7 @@
 isc.ClassFactory.defineInterface('OBLinkTitleItem');
 
 isc.OBLinkTitleItem.addProperties({
+  operator: 'iContains',
   showLinkIcon: true,
   
   linkButtonClick: function(){
@@ -103,6 +107,7 @@
 }(this));
 
 isc.OBSearchItem.addProperties({
+  operator: 'iContains',
   showPickerIcon: true,
   canFocus: true,
   showFocused: true,
@@ -286,6 +291,8 @@
 isc.ClassFactory.defineClass('OBPAttributeSearchItem', OBSearchItem);
 
 isc.OBPAttributeSearchItem.addProperties({
+  operator: 'iContains',
+
   showPicker: function(){
     if (this.isDisabled()) {
       return;
@@ -317,6 +324,7 @@
 
 // add specific properties here
 isc.OBEncryptedItem.addProperties({
+  operator: 'iContains',
   changed : function(form,item,value) {
     this.form.setValue(item.name + '.cleartext', value);
   }
@@ -337,14 +345,41 @@
 isc.ClassFactory.defineClass('OBTextItem', TextItem);
 
 isc.OBTextItem.addProperties({
+  operator: 'iContains',
   validateOnExit: true
 });
 
+//== OBLinkItem ==
+//Input for normal strings (links) with an added icon to navigate to the link  
+isc.ClassFactory.defineClass('OBLinkItem', TextItem);
+
+isc.OBLinkItem.addProperties({
+  validateOnExit: true,
+  icons: [{
+    src : '[SKIN]/../../org.openbravo.client.application/images/form/search_picker.png',
+    click: function(form, item) {
+      var url = item.getValue();
+      if(!url || url.indexOf('://') == -1) {
+        return;
+      }
+      window.open(url);
+    }
+  }],
+  validate: function() {
+    var url = this.getValue();
+    if(!url) {
+      return true;
+    }
+    return OB.Utilities.isValidURL(url);
+  }
+});
+
 //== OBFKFilterTextItem ==
 //Input used for filtering on FK fields.
 isc.ClassFactory.defineClass('OBFKFilterTextItem', TextItem);
 
 isc.OBFKFilterTextItem.addProperties({
+  operator: 'iContains',
   validateOnExit: false,
   validateOnChange: false
 });
@@ -354,6 +389,7 @@
 isc.ClassFactory.defineClass('OBTextAreaItem', TextAreaItem);
 
 isc.OBTextAreaItem.addProperties({
+  operator: 'iContains',
   validateOnExit: true
 });
 
@@ -430,20 +466,37 @@
 isc.ClassFactory.defineClass('OBListItem', ComboBoxItem);
 
 isc.OBListItem.addProperties({
-
+  operator: 'equals',
   showPickListOnKeypress: true,  
   cachePickListResults: false,
   validateOnExit: true,  
   completeOnTab: true,
-  // setting this to false means that the change handler is called when picking
-  // a value and not earlier
 
   // NOTE: Setting this property to false fixes the issue when using the mouse to pick a value
   // FIXME: Sometimes the field label gets a red color (a blink)
   // addUnknownValues: false,
 
   selectOnFocus: true,
+  
+  // is overridden to keep track that a value has been explicitly picked
+  pickValue : function (value) {
+    this._pickedValue = true;
+    this.Super('pickValue', arguments);
+    delete this._pickedValue;
+  },
 
+  changed: function() {
+    this.Super('changed', arguments);
+    // if not picking a value then don't do a fic call
+    // otherwise every keypress would result in a fic call
+    if (!this._pickedValue) {
+      return;
+    }
+    if (this._hasChanged && this.form && this.form.handleItemChange) {
+      this.form.handleItemChange(this);
+    }
+  },
+  
   pickListProperties: {
     showHeaderContextMenu: false
   },
@@ -469,6 +522,7 @@
 isc.ClassFactory.defineClass('OBListFilterItem', OBListItem);
 
 isc.OBListFilterItem.addProperties({
+  operator: 'equals'
 });
 
 // == OBFKItem ==
@@ -478,7 +532,7 @@
 isc.ClassFactory.mixInInterface('OBFKItem', 'OBLinkTitleItem');
 
 isc.OBFKItem.addProperties({
-  textMatchStyle: 'substring',
+  operator: 'iContains',
     
   // set the identifier field also, that's what gets displayed in the grid
   changed: function (form, item, value) {
@@ -493,6 +547,7 @@
 isc.ClassFactory.defineClass('OBYesNoItem', SelectItem);
 
 isc.OBYesNoItem.addProperties({
+  operator: 'equals',
   mapValueToDisplay: function(value, a, b, c){
     return OB.Utilities.getYesNoDisplayValue(value);
   },
@@ -531,6 +586,7 @@
 isc.ClassFactory.defineClass('OBTimeItem', TimeItem);
 
 isc.OBTimeItem.addProperties({
+  operator: 'equals',
   validateOnExit: true,
   showHint: false,
   displayFormat: 'to24HourTime',
@@ -540,6 +596,31 @@
   longTimeFormat: 'HH:MM:SS'
 });
 
+//== OBMiniDateRangeItem ==
+//OBMiniDateRangeItem inherits from SmartClient MiniDateRangeItem
+//Is used for filtering date and time fields.
+
+isc.ClassFactory.defineClass('OBDateRangeDialog', isc.DateRangeDialog);
+
+isc.OBDateRangeDialog.addProperties({
+  // trick: overridden to let the ok and clear button change places
+  addAutoChild: function(name, props) {
+    if (name === 'okButton') {
+      return this.Super('addAutoChild', ['clearButton', { title: this.clearButtonTitle}]);
+    } else if (name === 'clearButton') {
+      return this.Super('addAutoChild', ['okButton', { title: this.okButtonTitle}]);
+    } else {
+      return this.Super('addAutoChild', arguments);
+    }
+  }
+});
+
+isc.ClassFactory.defineClass('OBMiniDateRangeItem', isc.MiniDateRangeItem);
+
+isc.OBMiniDateRangeItem.addProperties({
+  rangeDialogConstructor: isc.OBDateRangeDialog
+});
+
 // == OBDateItem ==
 // OBDateItem inherits from SmartClient DateItem
 // adds autocomplete and formatting based on the Openbravo date pattern
@@ -728,6 +809,7 @@
 
 // == OBDateItem properties ==
 isc.OBDateItem.addProperties({
+  operator: 'equals',
   // ** {{{ pickerConstructor }}} **
   // Picker constructor class
   pickerConstructor: 'OBDateChooser',
@@ -892,6 +974,7 @@
 // = OBNumberItem =
 // The Openbravo numeric form item.
 isc.OBNumberItem.addProperties({
+  operator: 'equals',
   typeInstance: null,
   
   keyPressFilterNumeric: '[0-9.,-=]',
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-grid.js	Tue Mar 08 16:19:56 2011 +0100
@@ -94,6 +94,22 @@
     }
     
     this.filterEditorProperties = {
+
+      setEditValue : function (rowNum, colNum, newValue, suppressDisplay, suppressChange) {
+        // prevent any setting of non fields in the filter editor
+        // this prevents a specific issue that smartclient will set a value
+        // in the {field.name}._identifier (for example warehouse._identifier)
+        // because it thinks that the field does not have its own datasource
+        if (isc.isA.String(colNum) && !this.getField(colNum)) {
+          return;
+        }
+        return this.Super('setEditValue', arguments);
+      },
+        
+      getValuesAsCriteria : function (advanced, textMatchStyle, returnNulls) {
+        return this.Super('getValuesAsCriteria', [true, textMatchStyle, returnNulls]);
+      },
+      
       // is needed to display information in the checkbox field 
       // header in the filter editor row
       isCheckboxField: function(){
@@ -140,18 +156,50 @@
       // after applying the filter the grid will set the criteria
       // back in the filtereditor effectively clearing
       // the filter field. The code here repairs/prevents this.
-      setValuesAsCriteria : function (criteria, refresh) {
+      setValuesAsCriteria: function (criteria, refresh) {
+        // create an edit form right away
+        if (!this.getEditForm()) {
+          this.makeEditForm();
+        }
+        var prop, fullPropName;
         // make a copy so that we don't change the object
         // which is maybe used somewhere else
-        criteria = isc.addProperties({}, criteria);
-        var index, prop;
-
-        for (prop in criteria) {
-          if (criteria.hasOwnProperty(prop) && prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
-            value = criteria[prop];
-            index = prop.lastIndexOf('.');
-            prop = prop.substring(0, index);
-            criteria[prop] = value;
+        criteria = isc.clone(criteria);
+        var internCriteria = criteria.criteria;
+        if (internCriteria) {
+          // now remove anything which is not a field
+          // otherwise smartclient will keep track of them and send them again
+          var fields = this.getEditForm().getFields();
+          for (i = internCriteria.length - 1; i >=0; i--) {
+            prop = internCriteria[i].fieldName;
+            // happens when the internCriteria[i], is again an advanced criteria
+            if (!prop) {
+              continue;
+            }
+            fullPropName = prop;
+            if (prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
+              var index = prop.lastIndexOf('.');
+              prop = prop.substring(0, index);
+            }
+            var fnd = false;
+            for (var j = 0; j < fields.length; j++) {
+              if (fields[j].displayField === fullPropName) {
+                fnd = true;
+                break;
+              }
+              if (fields[j].name === prop) {
+                internCriteria[i].fieldName = prop;
+                fnd = true;
+                break;
+              }
+              if (fields[j].name === fullPropName) {
+                fnd = true;
+                break;
+              }
+            }
+            if (!fnd) {
+              internCriteria.removeAt(i);
+            }
           }
         }
 
@@ -245,19 +293,41 @@
     if (this.filterClause) {
       return true;
     }
-    for (var prop in criteria) {
-      if (criteria.hasOwnProperty(prop)) {
-        var value = criteria[prop];
-        // see the description in setValuesAsCriteria above
-        if (prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
-          var index = prop.lastIndexOf('.');
-          prop = prop.substring(0, index);
-        }
-        
-        var field = this.filterEditor.getField(prop);
-        if (this.isValidFilterField(field) && (value === false || value || value === 0)) {
+    if (!criteria) {
+      return false;
+    }
+    return this.isGridFilteredWithCriteria(criteria.criteria);
+  },
+  
+  isGridFilteredWithCriteria: function(criteria) {
+    if (!criteria) {
+      return false;
+    }
+    for (var i = 0; i < criteria.length; i++) {
+      var criterion = criteria[i];
+      var prop = criterion.fieldName;
+      var fullPropName = prop;
+      if (!prop) {
+        if (this.isGridFilteredWithCriteria(criterion.criteria)) {
           return true;
         }
+        continue;
+      }
+      var value = criterion.value;
+      // see the description in setValuesAsCriteria above
+      if (prop.endsWith('.' + OB.Constants.IDENTIFIER)) {
+        var index = prop.lastIndexOf('.');
+        prop = prop.substring(0, index);
+      }
+      
+      var field = this.filterEditor.getField(prop);
+      if (this.isValidFilterField(field) && (value === false || value || value === 0)) {
+        return true;
+      }
+      
+      field = this.filterEditor.getField(fullPropName);
+      if (this.isValidFilterField(field) && (value === false || value || value === 0)) {
+        return true;
       }
     }
     return false;
@@ -285,7 +355,9 @@
       _operationType: 'fetch',
       _noCount: true, // never do count for export
       exportAs: expProp.exportAs || 'csv',
-      exportToFile: true
+      viewState: expProp.viewState,
+      exportToFile: true,
+      _textMatchStyle: 'substring'
     }, this.getCriteria());
     
     OB.Utilities.postThroughHiddenForm(dsURL, d);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-recent-utilities.js	Tue Mar 08 16:19:56 2011 +0100
@@ -95,7 +95,11 @@
       var currentRecentValue = this.getRecentValue(propertyName);
       var currentIndex = -1;
       for (var i = 0; i < currentRecentValue.length; i++) {
-        if (currentRecentValue[i] &&
+        // if the title is the same then assume they are the same
+        if (currentRecentValue[i].tabTitle && 
+            choiceObject.tabTitle && choiceObject.tabTitle === currentRecentValue[i].tabTitle) {
+          currentIndex = i;
+        } else if (currentRecentValue[i] &&
         currentRecentValue[i].id === choiceObject.id) {
           // found it
           currentIndex = i;
@@ -128,4 +132,5 @@
   
   // Initialize RemoteCallManager object
   rcutils = OB.RecentUtilities = new RecentUtilities();
+  OB.RecentUtilitiesClass = RecentUtilities;
 })(OB, isc);
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js	Tue Mar 08 16:19:56 2011 +0100
@@ -195,9 +195,11 @@
     leftMemberButtons = [isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_DOC_BUTTON_PROPERTIES),
                    isc.OBToolbarIconButton.create(isc.OBToolbar.NEW_ROW_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.SAVE_BUTTON_PROPERTIES), 
+                   isc.OBToolbarIconButton.create(isc.OBToolbar.SAVECLOSE_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.UNDO_BUTTON_PROPERTIES), 
                    isc.OBToolbarIconButton.create(isc.OBToolbar.DELETE_BUTTON_PROPERTIES), 
-                   isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES)];
+                   isc.OBToolbarIconButton.create(isc.OBToolbar.REFRESH_BUTTON_PROPERTIES),
+                   isc.OBToolbarIconButton.create(isc.OBToolbar.EXPORT_BUTTON_PROPERTIES)];
     
     // Look for specific toolabr buttons for this tab
     if (this.iconToolbarButtons) {
@@ -545,22 +547,34 @@
   isActiveView: function() {
     return this.standardWindow.activeView === this;
   },
-  
+    
   setAsActiveView: function(){
     this.standardWindow.setActiveView(this);
   },
   
+  setTargetRecordInWindow: function(recordId) {
+    if (this.isActiveView()) {
+      this.standardWindow.setTargetInformation(this.tabId, recordId);
+    }
+  },
+  
   setActiveViewProps: function(state){
     if (state) {
       this.toolBar.show();
       this.activeBar.setActive(true);
       this.setViewFocus();
+      this.viewGrid.setActive(true);
+      // if we are in form view
+      if (this.isShowingForm && !this.viewForm.isNew) {        
+        this.setTargetRecordInWindow(this.viewGrid.getSelectedRecord().id);
+      }
     } else {
       
       // close any editors we may have
       this.viewGrid.closeAnyOpenEditor();
       
       this.toolBar.hide();
+      this.viewGrid.setActive(false);
       this.activeBar.setActive(false);
       // note we can not check on viewForm visibility as 
       // the grid and form can both be hidden when changing
@@ -751,11 +765,11 @@
   
   // ** {{{ editNewRecordGrid }}} **
   // Opens the inline grid editing for a new record.
-  editNewRecordGrid: function() {
+  editNewRecordGrid: function(rowNum) {
     if (this.isShowingForm) {
       this.switchFormGridVisibility();      
     }
-    this.viewGrid.startEditingNew();
+    this.viewGrid.startEditingNew(rowNum);
   },
   
   // ** {{{ editRecord }}} **
@@ -778,7 +792,7 @@
       // also handle the case that there are unsaved values in the grid
       // show them in the form
       var rowNum = this.viewGrid.getRecordIndex(record);
-      this.viewForm.editRecord(this.viewGrid.getEditedRecord(rowNum), preventFocus);
+      this.viewForm.editRecord(this.viewGrid.getEditedRecord(rowNum), preventFocus, this.viewGrid.recordHasChanges(rowNum));
     }
   },
   
@@ -960,7 +974,7 @@
   },
   
   hasSelectionStateChanged: function() {
-    return (this.viewGrid.getSelectedRecords().length !== this.lastRecordSelectedCount || 
+    return ((this.viewGrid.getSelectedRecords() && this.viewGrid.getSelectedRecords().length !== this.lastRecordSelectedCount) || 
         (this.viewGrid.getSelectedRecord() && this.viewGrid.getSelectedRecord().id !== this.lastRecordSelected.id)) || 
       (this.lastRecordSelected && !this.viewGrid.getSelectedRecord());
   },
@@ -1268,7 +1282,16 @@
     
     var callback = function(ok){
       var i, data, deleteData, error, recordInfos = [], removeCallBack = function(resp, data, req){
-        if (resp.status === isc.RPCResponse.STATUS_SUCCESS) {
+        var localData = resp.dataObject || resp.data || data;
+        if (!localData) {
+          // bail out, an error occured which should be displayed to the user now
+          return;
+        }
+        var status = resp.status;
+        if (localData.hasOwnProperty('status')) {
+          status = localData.status;
+        }
+        if (status === isc.RPCResponse.STATUS_SUCCESS) {
           if (view.isShowingForm) {
             view.switchFormGridVisibility();
           }
@@ -1285,10 +1308,14 @@
           view.refreshParentRecord();
         } else {
           // get the error message from the dataObject 
-          if (resp.dataObject && resp.dataObject.response && resp.dataObject.response.error && resp.dataObject.response.error.message) {
-            error = resp.dataObject.response.error;
+          if (localData.response && localData.response.error && localData.response.error.message) {
+            error = localData.response.error;
             if (error.type && error.type === 'user') {
               view.messageBar.setLabel(isc.OBMessageBar.TYPE_ERROR, null, error.message, error.params);
+            } else if (error.message && error.params) {
+                view.messageBar.setLabel(isc.OBMessageBar.TYPE_ERROR, null, error.message, error.params);
+            } else if (error.message) {
+              view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, error.message);
             } else {
               view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('OBUIAPP_DeleteResult', [0]));
             }
@@ -1319,11 +1346,11 @@
     isc.ask(msg, callback);
   },
   
-  newRow: function() {
+  newRow: function(rowNum) {
     var actionObject = {
         target: this,
         method: this.editNewRecordGrid,
-        parameters: null
+        parameters: [rowNum]
       };
     this.standardWindow.doActionAfterAutoSave(actionObject, true);
   },
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-window.js	Tue Mar 08 16:19:56 2011 +0100
@@ -292,7 +292,6 @@
   draw: function(){
     var standardWindow = this, targetEntity;
     var ret = this.Super('draw', arguments);
-    
     if (this.targetTabId) {
       for (var i = 0; i < this.views.length; i++) {
         if (this.views[i].tabId === this.targetTabId) {
@@ -365,6 +364,10 @@
     result.windowId = this.windowId;
     result.viewId = this.getClassName();
     result.tabTitle = this.tabTitle;
+    if (this.targetTabId) {
+      result.targetTabId = this.targetTabId;
+      result.targetRecordId = this.targetRecordId;
+    }
     return result;
   },
   
@@ -381,6 +384,12 @@
     return this.isEqualParams(params) && viewName === this.getClassName();
   },
   
+  setTargetInformation: function(tabId, recordId) {
+    this.targetTabId = tabId;
+    this.targetRecordId = recordId;
+    OB.Layout.HistoryManager.updateHistory();
+  },
+  
   storeViewState: function(){
 	var result={};
     for (var i = 0; i < this.views.length; i++) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-statusbar.js	Tue Mar 08 16:19:56 2011 +0100
@@ -18,44 +18,48 @@
  */
 isc.ClassFactory.defineClass('OBStatusBarLeftBar', isc.HLayout);
 
-isc.OBStatusBarLeftBar.addProperties({
-  // to allow setting the active view when clicking in the statusbar 
-  canFocus: true
-});
+isc.OBStatusBarLeftBar.addProperties( {
+  // to allow setting the active view when clicking in the statusbar
+    canFocus : true
+  });
 
 isc.ClassFactory.defineClass('OBStatusBarTextLabel', isc.Label);
 
-isc.OBStatusBarTextLabel.addProperties({
-  // to allow setting the active view when clicking in the statusbar 
-  canFocus: true
-});
+isc.OBStatusBarTextLabel.addProperties( {
+  // to allow setting the active view when clicking in the statusbar
+    canFocus : true
+  });
 
 isc.ClassFactory.defineClass('OBStatusBarIconButtonBar', isc.HLayout);
 
-isc.OBStatusBarIconButtonBar.addProperties({
-  // to allow setting the active view when clicking in the statusbar 
-  canFocus: true
-});
+isc.OBStatusBarIconButtonBar.addProperties( {
+  // to allow setting the active view when clicking in the statusbar
+    canFocus : true
+  });
 
 isc.ClassFactory.defineClass('OBStatusBarIconButton', isc.ImgButton);
 
-isc.OBStatusBarIconButton.addProperties({
-  buttonType: null,
-  view: null,
-  // to allow setting the active view when clicking in the statusbar 
-  canFocus: true,
-  
+isc.OBStatusBarIconButton.addProperties( {
+  buttonType : null,
+  view : null,
+  // to allow setting the active view when clicking in the statusbar
+  canFocus : true,
+
   // always go through the autosave of the window
-  action: function() {
+  action : function() {
+    // don't do autosave if new and nothing changed
+    if (this.buttonType === 'close' && !this.view.viewForm.hasChanged && this.view.viewForm.isNew) {
+      this.view.standardWindow.setDirtyEditForm(null);
+    }
     var actionObject = {
-      target: this,
-      method: this.doAction,
-      parameters: []
+      target : this,
+      method : this.doAction,
+      parameters : []
     };
     this.view.standardWindow.doActionAfterAutoSave(actionObject, true);
   },
-  
-  doAction: function(){
+
+  doAction : function() {
     var rowNum, newRowNum, newRecord;
     if (this.buttonType === 'previous') {
       this.view.editNextPreviousRecord(false);
@@ -70,116 +74,120 @@
       this.view.messageBar.hide();
     }
   },
-  
-  initWidget: function(){
+
+  initWidget : function() {
     if (this.initWidgetStyle) {
       this.initWidgetStyle();
     }
     this.Super('initWidget', arguments);
   }
-  
+
 });
 
-
 isc.ClassFactory.defineClass('OBStatusBar', isc.HLayout);
 
-isc.OBStatusBar.addProperties({
-  view: null,
-  iconButtonGroupSpacerWidth: 0, //Set in the skin
-  
-  nextButton: null,
-  previousButton: null,
-  newIcon: null,
-  showingIcon: false,
-  
-  initWidget: function(){
-    this.stateLabel = isc.OBStatusBarTextLabel.create({
-      contents: '&nbsp;',
-      width: '100%',
-      height: '100%'
+isc.OBStatusBar.addProperties( {
+  view : null,
+  iconButtonGroupSpacerWidth : 0, // Set in the skin
+
+  nextButton : null,
+  previousButton : null,
+  newIcon : null,
+  showingIcon : false,
+
+  initWidget : function() {
+    this.stateLabel = isc.OBStatusBarTextLabel.create( {
+      contents : '&nbsp;',
+      width : '100%',
+      height : '100%'
     });
-      
-    this.leftStatusBar = isc.OBStatusBarLeftBar.create({});
+
+    this.leftStatusBar = isc.OBStatusBarLeftBar.create( {});
     this.leftStatusBar.addMember(this.stateLabel);
-    
-    this.previousButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'previous',
-      prompt: OB.I18N.getLabel('OBUIAPP_PREVIOUSBUTTON')
+
+    this.previousButton = isc.OBStatusBarIconButton.create( {
+      view : this.view,
+      buttonType : 'previous',
+      prompt : OB.I18N.getLabel('OBUIAPP_PREVIOUSBUTTON')
     });
-    this.nextButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'next',
-      prompt: OB.I18N.getLabel('OBUIAPP_NEXTBUTTON')
+    this.nextButton = isc.OBStatusBarIconButton.create( {
+      view : this.view,
+      buttonType : 'next',
+      prompt : OB.I18N.getLabel('OBUIAPP_NEXTBUTTON')
     });
-    var closeButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'close',
-      prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON')
+    this.closeButton = isc.OBStatusBarIconButton.create( {
+      view : this.view,
+      buttonType : 'close',
+      prompt : OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON')
     });
-    this.maximizeButton = isc.OBStatusBarIconButton.create({
-      view: this.view,
-      buttonType: 'maximize',
-      prompt: OB.I18N.getLabel('OBUIAPP_MAXIMIZEBUTTON')
+    this.maximizeButton = isc.OBStatusBarIconButton.create( {
+      view : this.view,
+      buttonType : 'maximize',
+      prompt : OB.I18N.getLabel('OBUIAPP_MAXIMIZEBUTTON')
     });
-    this.restoreButton = isc.OBStatusBarIconButton.create({
-      visibility: 'hidden',
-      view: this.view,
-      buttonType: 'restore',
-      prompt: OB.I18N.getLabel('OBUIAPP_RESTOREBUTTON')
+    this.restoreButton = isc.OBStatusBarIconButton.create( {
+      visibility : 'hidden',
+      view : this.view,
+      buttonType : 'restore',
+      prompt : OB.I18N.getLabel('OBUIAPP_RESTOREBUTTON')
     });
-    var buttonSpacer = isc.HLayout.create({
-      width: this.iconButtonGroupSpacerWidth
+    var buttonSpacer = isc.HLayout.create( {
+      width : this.iconButtonGroupSpacerWidth
     });
-    var buttonBar = isc.OBStatusBarIconButtonBar.create({});
-    
-    buttonBar.addMembers([this.previousButton, this.nextButton, buttonSpacer, this.maximizeButton, this.restoreButton, closeButton]);
-    for (var i = 0; i < buttonBar.members.length; i++) {
+    var buttonBar = isc.OBStatusBarIconButtonBar.create( {});
+
+    buttonBar.addMembers( [ this.previousButton, this.nextButton, buttonSpacer,
+        this.maximizeButton, this.restoreButton, this.closeButton ]);
+    for ( var i = 0; i < buttonBar.members.length; i++) {
       if (buttonBar.members[i].buttonType) {
-        OB.TestRegistry.register('org.openbravo.client.application.statusbar.button.' + buttonBar.members[i].buttonType + '.' + this.view.tabId, buttonBar.members[i]);        
+        OB.TestRegistry.register(
+            'org.openbravo.client.application.statusbar.button.' + buttonBar.members[i].buttonType + '.' + this.view.tabId,
+            buttonBar.members[i]);
       }
     }
 
     this.checkedIcon = isc.Img.create(this.checkedIconDefaults);
     this.newIcon = isc.Img.create(this.newIconDefaults);
-    this.spacer = isc.LayoutSpacer.create({width: 14});
+    this.spacer = isc.LayoutSpacer.create( {
+      width : 14
+    });
     this.leftStatusBar.addMember(this.spacer, 0);
 
-    this.addMembers([this.leftStatusBar, buttonBar]);
+    this.addMembers( [ this.leftStatusBar, buttonBar ]);
     return this.Super('initWidget', arguments);
   },
-  
-  addIcon: function(icon) {
+
+  addIcon : function(icon) {
     // remove any existing icon or spacer
-    this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
-    this.leftStatusBar.addMember(icon, 0);    
-  },
-  
-  removeIcon: function() {
-    // remove any existing icon or spacer
-    this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
-    this.leftStatusBar.addMember(this.spacer, 0);
-  },
-  
-  setNewState: function(isNew) {
-    this.previousButton.setDisabled(isNew);
-    this.nextButton.setDisabled(isNew);
-    if (isNew) {
-      this.setStateLabel('OBUIAPP_New', this.newIcon);
-    }
-  },
-  
-  setStateLabel: function (labelCode, icon) {
-    var msg = '&nbsp;';
-    if (labelCode) {
-      msg = OB.I18N.getLabel(labelCode);
-    }
-    this.stateLabel.setContents(msg);
-    if (icon) {
-      this.addIcon(icon);
-    } else {
-      this.removeIcon(icon);
-    }
+  this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
+  this.leftStatusBar.addMember(icon, 0);
+},
+
+removeIcon : function() {
+  // remove any existing icon or spacer
+  this.leftStatusBar.removeMember(this.leftStatusBar.members[0]);
+  this.leftStatusBar.addMember(this.spacer, 0);
+},
+
+setNewState : function(isNew) {
+  this.previousButton.setDisabled(isNew);
+  this.nextButton.setDisabled(isNew);
+  if (isNew) {
+    this.setStateLabel('OBUIAPP_New', this.newIcon);
   }
-  
+},
+
+setStateLabel : function(labelCode, icon) {
+  var msg = '&nbsp;';
+  if (labelCode) {
+    msg = OB.I18N.getLabel(labelCode);
+  }
+  this.stateLabel.setContents(msg);
+  if (icon) {
+    this.addIcon(icon);
+  } else {
+    this.removeIcon(icon);
+  }
+}
+
 });
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-toolbar.js	Tue Mar 08 16:19:56 2011 +0100
@@ -25,6 +25,7 @@
   TYPE_DELETE: 'eliminate',
   TYPE_UNDO: 'undo',
   TYPE_REFRESH: 'refresh',
+  TYPE_EXPORT: 'export',
   
   SAVE_BUTTON_PROPERTIES: {
     action: function(){
@@ -33,31 +34,74 @@
     disabled: true,
     buttonType: 'save',
     prompt: OB.I18N.getLabel('OBUIAPP_SaveRow'),
-    updateState: function() {
-      var view = this.view, form = view.viewForm, hasErrors = false, editRow;      
+    updateState: function(){
+      var view = this.view, form = view.viewForm, hasErrors = false, editRow;
       if (view.isShowingForm) {
-        this.setDisabled(!form.isNew && (form.isSaving || form.readOnly || 
-              !view.hasValidState() || !form.hasChanged));
+        this.setDisabled(!form.isNew &&
+        (form.isSaving || form.readOnly ||
+        !view.hasValidState() ||
+        !form.hasChanged));
       } else if (view.isEditingGrid) {
-          form = view.viewGrid.getEditForm();
-          editRow = view.viewGrid.getEditRow();
-          hasErrors = view.viewGrid.rowHasErrors(editRow);
-          this.setDisabled(!form.isNew && !hasErrors && (form.isSaving || form.readOnly || 
-                !view.hasValidState() || !form.hasChanged));
+        form = view.viewGrid.getEditForm();
+        editRow = view.viewGrid.getEditRow();
+        hasErrors = view.viewGrid.rowHasErrors(editRow);
+        this.setDisabled(!form.isNew && !hasErrors &&
+        (form.isSaving || form.readOnly ||
+        !view.hasValidState() ||
+        !form.hasChanged));
       } else {
-        // enable when supporting grid editing
         this.setDisabled(true);
       }
     },
     keyboardShortcutId: 'ToolBar_Save'
   },
+  SAVECLOSE_BUTTON_PROPERTIES: {
+    action: function(){
+      var actionObject = {
+        target: this,
+        method: this.saveAndClose,
+        parameters: []
+      };
+      this.view.standardWindow.doActionAfterAutoSave(actionObject, true);      
+    },
+    
+    saveAndClose: function(){
+      this.view.switchFormGridVisibility();
+      this.view.messageBar.hide();
+    },
+    
+    buttonType: 'savecloseX',
+    prompt: OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON'),
+    updateState: function(){
+      var view = this.view, form = view.viewForm;
+      if (view.isShowingForm) {
+        this.setDisabled(false);
+        var saveDisabled = (!form.isNew &&
+        (form.isSaving || form.readOnly ||
+        !view.hasValidState() ||
+        !form.hasChanged));
+        if (saveDisabled) {
+          this.buttonType = 'savecloseX';
+          this.prompt = OB.I18N.getLabel('OBUIAPP_CLOSEBUTTON');
+        } else {
+          this.buttonType = 'saveclose';
+          this.prompt = OB.I18N.getLabel('OBUIAPP_SaveClose');
+        }
+      } else {
+        this.setDisabled(true);
+      }
+      this.resetBaseStyle();
+    },
+    keyboardShortcutId: 'ToolBar_SaveClose'
+  },
   NEW_ROW_BUTTON_PROPERTIES: {
     action: function(){
-      this.view.newRow();
+      // do -1 because the newrow logic adds one
+      this.view.newRow(this.view.viewGrid.getDrawArea()[0] - 1);
     },
     buttonType: 'newRow',
     prompt: OB.I18N.getLabel('OBUIAPP_NewRow'),
-    updateState: function() {
+    updateState: function(){
       var view = this.view;
       this.setDisabled(view.isShowingForm || view.readOnly || view.singleRecord || !view.hasValidState());
     },
@@ -69,7 +113,7 @@
     },
     buttonType: 'newDoc',
     prompt: OB.I18N.getLabel('OBUIAPP_NewDoc'),
-    updateState: function() {
+    updateState: function(){
       var view = this.view, form = view.viewForm;
       if (view.isShowingForm) {
         this.setDisabled(form.isSaving || view.readOnly || view.singleRecord || !view.hasValidState());
@@ -86,24 +130,26 @@
     disabled: true,
     buttonType: 'eliminate',
     prompt: OB.I18N.getLabel('OBUIAPP_DeleteRow'),
-    updateState: function() {
-      var view = this.view, form = view.viewForm, grid = view.viewGrid, selectedRecords=grid.getSelectedRecords();
-      for (var i = 0; i < selectedRecords.length; i++){
-        if(!grid.isWritable(selectedRecords[i])) {
+    updateState: function(){
+      var view = this.view, form = view.viewForm, grid = view.viewGrid, selectedRecords = grid.getSelectedRecords();
+      for (var i = 0; i < selectedRecords.length; i++) {
+        if (!grid.isWritable(selectedRecords[i])) {
           this.setDisabled(true);
           return;
         }
-        if(selectedRecords[i]._new) {
+        if (selectedRecords[i]._new) {
           this.setDisabled(true);
           return;
         }
       }
       if (view.isShowingForm) {
-        this.setDisabled(form.isSaving || form.readOnly || view.singleRecord || 
-            !view.hasValidState() || form.isNew);
+        this.setDisabled(form.isSaving || form.readOnly || view.singleRecord ||
+        !view.hasValidState() ||
+        form.isNew);
       } else {
-        this.setDisabled(view.readOnly || view.singleRecord || !view.hasValidState() || 
-            !grid.getSelectedRecords() || grid.getSelectedRecords().length === 0);
+        this.setDisabled(view.readOnly || view.singleRecord || !view.hasValidState() ||
+        !grid.getSelectedRecords() ||
+        grid.getSelectedRecords().length === 0);
       }
     },
     keyboardShortcutId: 'ToolBar_Eliminate'
@@ -115,7 +161,7 @@
     disabled: false,
     buttonType: 'refresh',
     prompt: OB.I18N.getLabel('OBUIAPP_RefreshData'),
-    updateState: function() {
+    updateState: function(){
       var view = this.view, form = view.viewForm;
       if (view.isShowingForm) {
         this.setDisabled(form.isSaving || form.isNew || !view.hasValidState());
@@ -132,44 +178,66 @@
     disabled: true,
     buttonType: 'undo',
     prompt: OB.I18N.getLabel('OBUIAPP_Undo'),
-    updateState: function() {
+    updateState: function(){
       var view = this.view, form = view.viewForm, grid = view.viewGrid, hasErrors = false, editRow;
       if (view.isShowingForm) {
-        this.setDisabled(form.isSaving || form.readOnly || !view.hasValidState() || 
-            !form.hasChanged);
+        this.setDisabled(form.isSaving || form.readOnly || !view.hasValidState() ||
+        !form.hasChanged);
       } else if (view.isEditingGrid) {
         editRow = view.viewGrid.getEditRow();
         hasErrors = view.viewGrid.rowHasErrors(editRow);
         form = grid.getEditForm();
-        this.setDisabled(!form.isNew && !hasErrors && (form.isSaving || form.readOnly || 
-              !view.hasValidState() || !form.hasChanged));
+        this.setDisabled(!form.isNew && !hasErrors &&
+        (form.isSaving || form.readOnly ||
+        !view.hasValidState() ||
+        !form.hasChanged));
       } else {
         var selectedRecords = grid.getSelectedRecords(), allRowsHaveErrors = true;
-        for (var i = 0; i < selectedRecords.length; i++){
+        for (var i = 0; i < selectedRecords.length; i++) {
           var rowNum = grid.getRecordIndex(selectedRecords[i]);
           allRowsHaveErrors = allRowsHaveErrors && grid.rowHasErrors(rowNum);
         }
-        this.setDisabled(selectedRecords.length === 0 || !allRowsHaveErrors); 
+        this.setDisabled(selectedRecords.length === 0 || !allRowsHaveErrors);
       }
     },
     keyboardShortcutId: 'ToolBar_Undo'
   },
+  EXPORT_BUTTON_PROPERTIES: {
+    action: function(){
+      var requestProperties = {
+        exportAs: 'csv',
+        exportDisplay: 'download',
+        params: {
+          exportToFile: true
+        }
+      };
+      requestProperties.viewState = this.view.viewGrid.getViewState();
+      this.view.viewGrid.exportData(requestProperties);
+    },
+    disabled: false,
+    buttonType: 'export',
+    prompt: OB.I18N.getLabel('OBUIAPP_ExportGrid'),
+    updateState: function(){
+      this.setDisabled(this.view.isShowingForm);
+    },
+    keyboardShortcutId: 'ToolBar_Export'
+  },
   // This offers a mechanism to add properties at runtime to buttons created through
   // templates and java
   BUTTON_PROPERTIES: {
-    'audit' : {
+    'audit': {
       updateState: function(){
         var view = this.view, form = view.viewForm, grid = view.viewGrid;
         var selectedRecords = grid.getSelectedRecords();
         var disabled = false;
         if (selectedRecords && selectedRecords.length > 1) {
-            disabled = true;
+          disabled = true;
         } else if (view.isShowingForm && form.isNew) {
           disabled = true;
         } else if (view.isEditingGrid && grid.getEditForm().isNew) {
           disabled = true;
-        } else if (selectedRecords && selectedRecords.length > 0 && selectedRecords[0].updated && selectedRecords[0].creationDate && selectedRecords[0].updated.getTime() === selectedRecords[0].creationDate.getTime()){
-          disabled = true;          
+        } else if (selectedRecords && selectedRecords.length > 0 && selectedRecords[0].updated && selectedRecords[0].creationDate && selectedRecords[0].updated.getTime() === selectedRecords[0].creationDate.getTime()) {
+          disabled = true;
         }
         this.setDisabled(disabled);
       }
@@ -185,14 +253,11 @@
   randomId: null,
   initWidget: function(){
     this.Super('initWidget', arguments);
-    function getRandomId() {
-      var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz',
-          stringLength = 8,
-          randomString = '',
-          i, rnum;
+    function getRandomId(){
+      var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz', stringLength = 8, randomString = '', i, rnum;
       for (i = 0; i < stringLength; i++) {
         rnum = Math.floor(Math.random() * chars.length);
-        randomString += chars.substring(rnum,rnum+1);
+        randomString += chars.substring(rnum, rnum + 1);
       }
       return randomString;
     }
@@ -270,7 +335,7 @@
   // 
   // NOTE: new buttons should implement the updateState method.
   //
-  updateButtonState: function(noSetSession) {
+  updateButtonState: function(noSetSession){
     for (i = 0; i < this.leftMembers.length; i++) {
       if (this.leftMembers[i].updateState) {
         this.leftMembers[i].updateState();
@@ -280,7 +345,7 @@
     // and refresh the process toolbar buttons
     this.refreshCustomButtons(noSetSession);
   },
-
+  
   // ** {{{ getLeftMember(member) }}} **
   //
   // It works just for left side members.
@@ -719,12 +784,8 @@
       }
     }
     
-    var buttons = this.getRightMembers(),
-        numOfSelRecords = 0,
-        isNew = this.view.viewForm.isNew,
-        hideAllButtons = typeof(isNew)!=='undefined' && !isNew && 
-                         (!this.view.isShowingForm && (!this.view.viewGrid.getSelectedRecords() || this.view.viewGrid.getSelectedRecords().length !== 1)),
-        currentValues = this.view.getCurrentValues();
+    var buttons = this.getRightMembers(), numOfSelRecords = 0, isNew = this.view.viewForm.isNew, hideAllButtons = typeof(isNew) !== 'undefined' && !isNew &&
+    (!this.view.isShowingForm && (!this.view.viewGrid.getSelectedRecords() || this.view.viewGrid.getSelectedRecords().length !== 1)), currentValues = this.view.getCurrentValues();
     
     if (this.view.viewGrid.getSelectedRecords()) {
       numOfSelRecords = this.view.viewGrid.getSelectedRecords().length;
@@ -734,55 +795,55 @@
       var formView = this.view.viewForm, me = this;
       // Call FIC to obtain possible session attributes and set them in form
       requestParams = {
-          MODE: 'SETSESSION',
-          PARENT_ID: this.view.getParentId(),
-          TAB_ID: this.view.tabId,
-          ROW_ID: currentValues.id
-        };
+        MODE: 'SETSESSION',
+        PARENT_ID: this.view.getParentId(),
+        TAB_ID: this.view.tabId,
+        ROW_ID: currentValues.id
+      };
+      
+      OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', {}, requestParams, function(response, data, request){
+        var sessionAttributes = data.sessionAttributes, auxInputs = data.auxiliaryInputValues;
+        if (sessionAttributes) {
+          formView.sessionAttributes = sessionAttributes;
+        }
         
-        OB.RemoteCallManager.call('org.openbravo.client.application.window.FormInitializationComponent', {}, requestParams, function(response, data, request){
-         var sessionAttributes = data.sessionAttributes, auxInputs = data.auxiliaryInputValues;
-         if (sessionAttributes) {
-           formView.sessionAttributes = sessionAttributes;
-         }
-         
-         if (auxInputs) {
-           this.auxInputs = {};
-           for (var prop in auxInputs) {
-             if (auxInputs.hasOwnProperty(prop)) {
-               formView.setValue(prop, auxInputs[prop].value);
-               formView.auxInputs[prop] = auxInputs[prop].value;
-             }
-           }
-         }
-         
-         doRefresh(buttons, currentValues, false, me);
-        });
+        if (auxInputs) {
+          this.auxInputs = {};
+          for (var prop in auxInputs) {
+            if (auxInputs.hasOwnProperty(prop)) {
+              formView.setValue(prop, auxInputs[prop].value);
+              formView.auxInputs[prop] = auxInputs[prop].value;
+            }
+          }
+        }
+        
+        doRefresh(buttons, currentValues, false, me);
+      });
     } else {
       currentValues = this.view.getCurrentValues();
       doRefresh(buttons, currentValues, hideAllButtons, this);
-    } 
+    }
   },
-
-  visibilityChanged: function(state) {
+  
+  visibilityChanged: function(state){
     if (state) {
       this.enableShortcuts();
     } else {
       this.disableShortcuts();
     }
   },
-
-  draw: function() {
+  
+  draw: function(){
     this.Super('draw', arguments);
     this.defineRightMembersShortcuts();
     this.enableShortcuts();
   },
-
+  
   rightMembersShortcuts: [],
-
-  defineRightMembersShortcuts: function() {
+  
+  defineRightMembersShortcuts: function(){
     var i, j, k, l, id, character, position;
-    function isAssignedCharacter(character, me) {
+    function isAssignedCharacter(character, me){
       character = character.toString();
       character = character.toUpperCase();
       for (k = 0; k < me.rightMembersShortcuts.length; k++) {
@@ -793,14 +854,13 @@
       return false;
     }
     for (i = 0; i < this.rightMembers.length; i++) {
-      var title = this.rightMembers[i].realTitle,
-          haveToContinue = true;
+      var title = this.rightMembers[i].realTitle, haveToContinue = true;
       this.rightMembersShortcuts[i] = [];
       if (haveToContinue) { // Check if free character and assign
-       haveToContinue = true;
-       for (j = 0; j < title.length; j++) {
-          if (!isAssignedCharacter(title.substring(j,j+1), this)) {
-            this.rightMembersShortcuts[i][0] = title.substring(j,j+1).toUpperCase();
+        haveToContinue = true;
+        for (j = 0; j < title.length; j++) {
+          if (!isAssignedCharacter(title.substring(j, j + 1), this)) {
+            this.rightMembersShortcuts[i][0] = title.substring(j, j + 1).toUpperCase();
             this.rightMembersShortcuts[i][1] = j + 1;
             haveToContinue = false;
             break;
@@ -809,12 +869,12 @@
       }
       if (haveToContinue) { // Check if free number and assign
         haveToContinue = true;
-        for (l = 1; l < 10 ; l++) {
+        for (l = 1; l < 10; l++) {
           if (!isAssignedCharacter(l, this)) {
-             this.rightMembersShortcuts[i][0] = l;
-             this.rightMembersShortcuts[i][1] = 'end';
-             haveToContinue = false;
-             break;
+            this.rightMembersShortcuts[i][0] = l;
+            this.rightMembersShortcuts[i][1] = 'end';
+            haveToContinue = false;
+            break;
           }
         }
       }
@@ -827,8 +887,8 @@
       this.rightMembers[i].keyboardShortcutPosition = this.rightMembersShortcuts[i][1];
     }
   },
-
-  enableShortcuts: function() {
+  
+  enableShortcuts: function(){
     if (this.leftMembers) {
       for (i = 0; i < this.leftMembers.length; i++) {
         if (this.leftMembers[i].enableShortcut) {
@@ -845,8 +905,8 @@
       }
     }
   },
-
-  disableShortcuts: function() {
+  
+  disableShortcuts: function(){
     if (this.leftMembers) {
       for (i = 0; i < this.leftMembers.length; i++) {
         if (this.leftMembers[i].disableShortcut) {
@@ -862,7 +922,7 @@
       }
     }
   },
-
+  
   addMembers: 'null',
   
   leftMembers: [],
@@ -912,9 +972,9 @@
     
     this.setBaseStyle('OBToolbarIconButton_icon_' + this.buttonType + this.customState + extraClass + 'OBToolbarIconButton');
   },
-
+  
   keyboardShortcutId: null,
-  enableShortcut: function() {
+  enableShortcut: function(){
     if (this.keyboardShortcutId) {
       var me = this;
       var ksAction = function(){
@@ -925,9 +985,11 @@
       OB.KeyboardManager.KS.set(this.keyboardShortcutId, ksAction);
     }
   },
-  disableShortcut: function() {
+  disableShortcut: function(){
     if (this.keyboardShortcutId) {
-      OB.KeyboardManager.KS.set(this.keyboardShortcutId, function() { return true; });
+      OB.KeyboardManager.KS.set(this.keyboardShortcutId, function(){
+        return true;
+      });
     }
   }
 });
@@ -946,15 +1008,15 @@
   action: function(){
     alert(this.title);
   },
-  initWidget: function() {
+  initWidget: function(){
     this.Super('initWidget', arguments);
     this.realTitle = this.title;
   },
-
+  
   keyboardShortcutId: null,
   keyboardShortcutCharacter: null,
   keyboardShortcutPosition: null,
-  enableShortcut: function() {
+  enableShortcut: function(){
     if (this.keyboardShortcutId) {
       var me = this;
       var newTitle = this.realTitle;
@@ -966,19 +1028,31 @@
       if (this.keyboardShortcutPosition === 'end') {
         newTitle = newTitle + ' (<u>' + this.keyboardShortcutCharacter + '</u>)';
       } else {
-        newTitle = newTitle.substring(0, this.keyboardShortcutPosition-1) + '<u>' + newTitle.substring(this.keyboardShortcutPosition-1, this.keyboardShortcutPosition) + '</u>' + newTitle.substring(this.keyboardShortcutPosition, newTitle.length);
+        newTitle = newTitle.substring(0, this.keyboardShortcutPosition - 1) + '<u>' + newTitle.substring(this.keyboardShortcutPosition - 1, this.keyboardShortcutPosition) + '</u>' + newTitle.substring(this.keyboardShortcutPosition, newTitle.length);
       }
       this.setTitle(newTitle);
       if (this.keyboardShortcutPosition) { // If 'this.keyboardShortcutPosition' equals 0 means that there is no shortcut assigned
-        OB.KeyboardManager.KS.set(this.keyboardShortcutId, ksAction, null, {'ctrl': true, 'alt': true, 'shift': true, 'key': this.keyboardShortcutCharacter});
+        OB.KeyboardManager.KS.set(this.keyboardShortcutId, ksAction, null, {
+          'ctrl': true,
+          'alt': true,
+          'shift': true,
+          'key': this.keyboardShortcutCharacter
+        });
       }
     }
   },
-  disableShortcut: function() {
+  disableShortcut: function(){
     if (this.keyboardShortcutId) {
       var newTitle = this.realTitle;
       this.setTitle(newTitle);
-      OB.KeyboardManager.KS.set(this.keyboardShortcutId, function() { return true; }, '', {'ctrl': true, 'alt': true, 'shift': true, 'key': 'xyz'});
+      OB.KeyboardManager.KS.set(this.keyboardShortcutId, function(){
+        return true;
+      }, '', {
+        'ctrl': true,
+        'alt': true,
+        'shift': true,
+        'key': 'xyz'
+      });
     }
   }
 });
@@ -993,45 +1067,43 @@
     return;
   }
   
-  var popupParams = 'Command=DEFAULT', 
-      allProperties = view.getContextInfo(false, true),
-      sessionProperties = view.getContextInfo(true, true);
-
+  var popupParams = 'Command=DEFAULT', allProperties = view.getContextInfo(false, true), sessionProperties = view.getContextInfo(true, true);
+  
   for (var param in allProperties) {
     if (allProperties.hasOwnProperty(param)) {
       var value = allProperties[param];
       
       if (typeof value === 'boolean') {
-        value = value?'Y':'N';
+        value = value ? 'Y' : 'N';
       }
       
       popupParams += '&' + param + '=' + value;
     }
   }
   
-  popupParams += '&inppdfpath='+url;
-  popupParams += '&inphiddenkey='+view.standardProperties.inpKeyName;
-  popupParams += '&inpdirectprint='+(directPrint?'Y':'N');
+  popupParams += '&inppdfpath=' + url;
+  popupParams += '&inphiddenkey=' + view.standardProperties.inpKeyName;
+  popupParams += '&inpdirectprint=' + (directPrint ? 'Y' : 'N');
   
   var selectedIds = '';
-  for (var i = 0; i < selectedRecords.length; i++){
-    selectedIds += (i > 0?',':'') + selectedRecords[i].id;
+  for (var i = 0; i < selectedRecords.length; i++) {
+    selectedIds += (i > 0 ? ',' : '') + selectedRecords[i].id;
   }
   
-  popupParams += '&inphiddenvalue='+selectedIds;
+  popupParams += '&inphiddenvalue=' + selectedIds;
   
-  view.setContextInfo(sessionProperties, function() {
-    OB.Layout.ClassicOBCompatibility.Popup.open('print', 0, 0, OB.Application.contextUrl + '/businessUtility/PrinterReports.html?'+popupParams, '', window, false, false, true);
+  view.setContextInfo(sessionProperties, function(){
+    OB.Layout.ClassicOBCompatibility.Popup.open('print', 0, 0, OB.Application.contextUrl + '/businessUtility/PrinterReports.html?' + popupParams, '', window, false, false, true);
   });
 };
 
 OB.ToolbarUtils.showAuditTrail = function(view){
   var selectedRecords = view.viewGrid.getSelectedRecords();
-
+  
   if (selectedRecords.length > 1) {
     var setWarning = {
       set: function(label){
-      view.messageBar.setMessage(OBMessageBar.TYPE_WARNING, '', label);
+        view.messageBar.setMessage(OBMessageBar.TYPE_WARNING, '', label);
       }
     };
     OB.I18N.getLabel('JS28', null, setWarning, 'set');
@@ -1046,7 +1118,7 @@
     popupParams += '&inpRecordId=' + view.viewGrid.getSelectedRecord().id;
   }
   
-  OB.Layout.ClassicOBCompatibility.Popup.open('audit', 900, 600, OB.Application.contextUrl + '/businessUtility/AuditTrail.html?'+popupParams, '', window, false, false, true);
+  OB.Layout.ClassicOBCompatibility.Popup.open('audit', 900, 600, OB.Application.contextUrl + '/businessUtility/AuditTrail.html?' + popupParams, '', window, false, false, true);
 };
 
 OB.ToolbarUtils.showTree = function(view){
@@ -1055,5 +1127,5 @@
   popupParams += '&Command=DEFAULT';
   popupParams += '&inpTabId=' + view.tabId;
   popupParams += '&hideMenu=true&noprefs=true';
-  OB.Layout.ClassicOBCompatibility.Popup.open('tree', 750, 625, OB.Application.contextUrl + '/security/Menu.html?'+popupParams, '', window, false, false, true);
+  OB.Layout.ClassicOBCompatibility.Popup.open('tree', 750, 625, OB.Application.contextUrl + '/security/Menu.html?' + popupParams, '', window, false, false, true);
 };
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-utilities.js	Tue Mar 08 16:19:56 2011 +0100
@@ -24,10 +24,27 @@
 // ** {{{OB.Utilities.createLoadingLayout}}} **
 // Creates a layout with the loading image.
 OB.Utilities.createLoadingLayout = function(){
-  var mainLayout = isc.HLayout.create({styleName: OB.LoadingPrompt.mainLayoutStyleName, width: '100%', height: '100%', align: 'center', defaultLayoutAlign: 'center'});
-  var loadingLayout = isc.HLayout.create({styleName: OB.LoadingPrompt.loadingLayoutStyleName, width: 1, height: 1, overflow: 'visible'});
+  var mainLayout = isc.HLayout.create({
+    styleName: OB.LoadingPrompt.mainLayoutStyleName,
+    width: '100%',
+    height: '100%',
+    align: 'center',
+    defaultLayoutAlign: 'center'
+  });
+  var loadingLayout = isc.HLayout.create({
+    styleName: OB.LoadingPrompt.loadingLayoutStyleName,
+    width: 1,
+    height: 1,
+    overflow: 'visible'
+  });
   mainLayout.addMember(loadingLayout);
-  loadingLayout.addMember(isc.Label.create({contents: OB.I18N.getLabel('OBUIAPP_LOADING'), styleName: 'OBLoadingPromptLabel', width: 1, height: 1, overflow: 'visible'}));
+  loadingLayout.addMember(isc.Label.create({
+    contents: OB.I18N.getLabel('OBUIAPP_LOADING'),
+    styleName: 'OBLoadingPromptLabel',
+    width: 1,
+    height: 1,
+    overflow: 'visible'
+  }));
   loadingLayout.addMember(isc.Img.create(OB.LoadingPrompt.loadingImage));
   return mainLayout;
 };
@@ -79,30 +96,30 @@
 // If action is null/undefined then nothing is done and undefined is returned.
 // When the action is called the result of the action is returned.
 OB.Utilities.callAction = function(action){
-  function IEApplyHack(method, object, parameters) {
+  function IEApplyHack(method, object, parameters){
     if (!object) {
       object = window;
     }
     if (!parameters) {
       parameters = [];
     }
-
+    
     object.customApplyMethod = method;
-
+    
     var argsString = [];
-    for(var i = 0; i < parameters.length; i++) {
+    for (var i = 0; i < parameters.length; i++) {
       argsString[i] = 'parameters[' + i + ']';
     }
-
+    
     var argsList = argsString.join(",");
-
+    
     var result = eval('object.customApplyMethod(' + argsList + ');');
-
+    
     delete object.customApplyMethod;
-
+    
     return result;
   }
-
+  
   if (!action) {
     return;
   }
@@ -147,6 +164,37 @@
   return false;
 };
 
+// ** {{{OB.Utilities.openDirectTab}}} **
+// Open a view using a tab id and record id. The tab can be a child tab. If the record id
+// is not set then the tab is opened in grid mode. If command is not set then default is
+// used.
+OB.Utilities.openDirectTab = function(tabId, recordId, command){
+  var callback = function(response, data, request){
+    command = command || 'DEFAULT';
+    var view = {
+      viewId: '_' + data.windowId,
+      tabTitle: data.tabTitle,
+      windowId: data.windowId,
+      tabId: data.tabId,
+      command: command
+    };
+    // new is only supported for the top tab
+    if (command !== 'NEW') {
+      view.targetTabId = tabId;
+    }
+      
+    if (recordId) {
+      view.targetRecordId = recordId;
+    }
+    OB.Layout.ViewManager.openView(view.viewId, view);
+  };
+  
+  OB.RemoteCallManager.call('org.openbravo.client.application.ComputeWindowActionHandler', {}, {
+    'tabId': tabId,
+    'recordId': recordId
+  }, callback);
+};
+
 // ** {{{OB.Utilities.openView}}} **
 // Open a view taking into account if a specific window should be opened in classic mode or not.
 // Returns the object used to open the window.
@@ -233,6 +281,21 @@
   }
   return msgString;
 };
+// ** {{{OB.Utilities.getUrlParameters}}} **
+// Returns the url parameters as a javascript object. Note works for simple cases
+// where no & is used for character encoding, this is fine for most cases.
+OB.Utilities.getUrlParameters = function(){
+  var vars = {}, hash, href = window.location.href, hashes = href.slice(href.indexOf('?') + 1).split('&');
+  
+  for (var i = 0; i < hashes.length; i++) {
+    hash = hashes[i].split('=');
+    if (hash[i] && hash[i].contains('#')) {
+      hash[i] = hash[i].substring(0, hash[i].indexOf('#'));
+    }
+    vars[hash[0]] = hash[1];
+  }
+  return vars;
+};
 
 // ** {{{OB.Utilities.hasUrlParameter}}} **
 // Returns true if the url has a certain parameter with a certain value.
@@ -320,12 +383,10 @@
 // ** {{{ OB.Utilities.registerClassicPopupInTestRegistry(/*String*/ url, /*Object*/ obj }}} **
 // Registers the obj as a classic popup
 OB.Utilities.registerClassicPopupInTestRegistry = function(url, obj){
-  console.log('Before --> ' + url);
   if (url.startsWith('/')) {
     var index = url.indexOf('/', 1);
     url = url.substring(index + 1);
   }
-  console.log('After --> ' + url);
   OB.TestRegistry.register('org.openbravo.classicpopup.' + url, obj);
 };
 
@@ -433,7 +494,7 @@
 // ** {{{ OB.Utilities.getYesNoDisplayValue }}} **
 // Returns the Yes label if the passed value is true, the No label if false.
 OB.Utilities.getYesNoDisplayValue = function(/* Boolean */value){
-  if (value) {
+  if (value === true || value === 'true') {
     return OB.I18N.getLabel('OBUISC_Yes');
   } else if (value === false) {
     return OB.I18N.getLabel('OBUISC_No');
@@ -536,3 +597,44 @@
   
   OB.GlobalHiddenForm.submit();
 };
+
+// ** {{{ OB.Utilities.updateSmartClientComponentValue }}} **
+//
+// Updates the value of a smartclient component.
+//
+// Parameters:
+// * {{{input}}}: the input field (html dom input element)
+// * {{{component}}}: the Smartclient component (must have a setValue function)
+OB.Utilities.updateSmartClientComponentValue = function(/* Object */input, /* Object */ component){
+  component.setValue(input.value);
+};
+
+//** {{{ OB.Utilities.fixNull250 }}} **
+//
+// Transforms null values into '' to adapt display logic to 2.50 behavior.
+//
+// Parameters:
+// * {{{currentValues}}}: array of values
+OB.Utilities.fixNull250 = function(currentValues){
+  var i;
+  for (i in currentValues) {
+    if (currentValues.hasOwnProperty(i) &&
+    currentValues[i] === null) {
+      currentValues[i] = '';
+    }
+  }
+};
+
+// ** {{{ OB.Utilities.isValidURL}}} **
+// Checks if a String is a valid URL
+//
+// Parameters:
+// * {{{url}}}: String url
+OB.Utilities.isValidURL = function(url){
+  // Validation based on: http://view.jquery.com/trunk/plugins/validate/jquery.validate.js
+  // Note: http://localhost is not a valid URL, http://localhost.localdomain is a valid one
+  if (!url) {
+    return false;
+  }
+  return (/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i).test(url);
+};
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js	Tue Mar 08 16:19:56 2011 +0100
@@ -107,9 +107,15 @@
     }
   },
   
-  editRecord: function(record, preventFocus){
+  editRecord: function(record, preventFocus, hasChanges){
     var ret = this.Super('editRecord', arguments);
     this.doEditRecordActions(preventFocus, false);
+    if (hasChanges) {
+      this.setHasChanged(true);
+    }
+    
+    this.view.setTargetRecordInWindow(record.id);
+    
     return ret;
   },
   
@@ -186,10 +192,12 @@
     // 16064: Autosave error is triggered when closing a tab, even if the form wasn't touched
     // https://issues.openbravo.com/view.php?id=16064
     // this is inline with current behavior
-//    if (isNew) {
-//      // signal that autosave is needed after this
-//      this.view.standardWindow.setDirtyEditForm(this);
-//    }
+    // NOTE: changed to reset the edit form when closing the form, so only there
+    // so autosave always works except when closing if nothing has changed
+    if (isNew) {
+      // signal that autosave is needed after this
+      this.view.standardWindow.setDirtyEditForm(this);
+    }
   },
   
   // reset the focus item to the first item which can get focus
@@ -469,7 +477,11 @@
       if (this.getFocusItem()) {
         if (this.allItemsDisabled) {
           this.getFocusItem().blurItem();
+          this.redraw();
+          this.view.viewGrid.refreshEditRow();
         } else {
+          this.redraw();
+          this.view.viewGrid.refreshEditRow();
           // reset the canfocus
           for (var i = 0; i < this.getFields().length; i++) {
             delete this.getFields()[i].canFocus;
@@ -479,7 +491,6 @@
           }
         }
       }
-      this.view.viewGrid.refreshEditRow();
     }
   },
   
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js	Tue Mar 08 16:19:56 2011 +0100
@@ -202,6 +202,24 @@
       filterEditorType: 'StaticTextItem'
     });
     
+    var grid = this;
+    var menuItems = [{
+        title: OB.I18N.getLabel('OBUIAPP_CreateRecordInGrid'),
+        click: function(){
+          grid.deselectAllRecords();
+          grid.startEditingNew();
+        }
+      }, {
+        title: OB.I18N.getLabel('OBUIAPP_CreateRecordInForm'),
+        click: function(){
+          grid.deselectAllRecords();
+          grid.view.newDocument();
+        }
+      }
+    ];
+    
+    this.contextMenu = this.getMenuConstructor().create({items: menuItems});
+    
     var ret = this.Super('initWidget', arguments);
     
     this.noDataEmptyMessage = OB.I18N.getLabel('OBUISC_ListGrid.loadingDataMessage'); // OB.I18N.getLabel('OBUIAPP_GridNoRecords')
@@ -313,6 +331,58 @@
     }
     return this.Super('headerClick', arguments);
   },
+
+  // handle the del key when rows have been selected
+  bodyKeyPress : function (event, eventInfo) {
+    if (event.keyName === 'Delete' && this.getSelectedRecords().length > 0) {
+      this.view.deleteSelectedRows();
+      return;      
+    }
+    return this.Super('bodyKeyPress', arguments);
+  },
+
+  // called when the view gets activated
+  setActive: function(active) {
+    if (active) {
+      this.enableKeyBoardShortCuts();
+    } else {
+      this.disableKeyBoardShortCuts();
+    }    
+  },
+
+  disableKeyBoardShortCuts: function() {
+    OB.KeyboardManager.KS.set('Grid_EditInGrid', function() { return true; });
+    OB.KeyboardManager.KS.set('Grid_EditInForm', function() { return true; });
+  },
+  
+  enableKeyBoardShortCuts: function() {
+    var grid = this;
+    var editInGridAction = function(){
+      if (grid.getSelectedRecords().length === 1) {    
+        grid.endEditing();
+        grid.startEditing(grid.getRecordIndex(grid.getSelectedRecords()[0]));
+      }
+    };
+    OB.KeyboardManager.KS.set('Grid_EditInGrid', editInGridAction);
+    var editInFormAction = function(){
+      if (grid.getSelectedRecords().length === 1) {          
+        grid.endEditing();
+        grid.view.editRecord(grid.getSelectedRecords()[0]);
+      }
+    };
+    OB.KeyboardManager.KS.set('Grid_EditInForm', editInFormAction);
+  },
+
+  // overridden to set the enterkeyaction to nextrowstart in cases the current row
+  // is the last being edited  
+  getNextEditCell : function (rowNum, colNum, editCompletionEvent) {
+    // past the last row
+    if (editCompletionEvent === isc.ListGrid.ENTER_KEYPRESS && rowNum === (this.getTotalRows() - 1)) {
+      // move to the next row
+      return this.findNextEditCell(rowNum +1, 0, 1, true, true);
+    }
+    return this.Super('getNextEditCell', arguments);
+  },
   
   deselectAllRecords: function(preventUpdateSelectInfo, autoSaveDone){
     if (!autoSaveDone) {
@@ -613,8 +683,7 @@
   },
   
   getInitialCriteria: function(){
-    var criteria = this.Super('getInitialCriteria', arguments);
-    
+    var criteria = this.Super('getInitialCriteria', arguments);   
     return this.convertCriteria(criteria);
   },
   
@@ -623,35 +692,31 @@
     criteria = this.convertCriteria(criteria);
     return criteria;
   },
-  
+    
   convertCriteria: function(criteria){
-    var selectedValues, prop, fld, value;
+    var selectedValues, prop, fld, value, i, criterion, fldName;
     
-    criteria = isc.addProperties({}, criteria || {});
+    if (!criteria) {
+      criteria = {
+        operator: 'and', 
+        _constructor: "AdvancedCriteria", 
+        criteria:[]};
+    } else {
+      criteria = isc.clone(criteria);
+    }
+    
+    if (!criteria.criteria) {
+      criteria.criteria = [];
+    }
     
     if (this.targetRecordId) {
       // do not filter on anything with a targetrecord
-      criteria = {};
+      criteria = {
+        operator: 'and', 
+        _constructor: "AdvancedCriteria", 
+        criteria:[]};
       // remove the filter clause we don't want to use
       this.filterClause = null;
-      criteria._targetRecordId = this.targetRecordId;
-    }
-    
-    // filter criteria for foreign key fields should be on the identifier
-    // note is again repaired in the filtereditor setValuesAsCriteria
-    // see the ob-grid.js 
-    for (prop in criteria) {
-      if (criteria.hasOwnProperty(prop)) {
-        if (prop === this.view.parentProperty) {
-          continue;
-        }
-        fld = this.getField(prop);
-        if (fld && fld.foreignKeyField) {
-          value = criteria[prop];
-          delete criteria[prop];
-          criteria[prop + '.' + OB.Constants.IDENTIFIER] = value;
-        }
-      }
     }
     
     // note pass in criteria otherwise infinite looping!
@@ -659,41 +724,86 @@
     
     if (this.view.parentProperty) {
       selectedValues = this.view.parentView.viewGrid.getSelectedRecords();
+      var parentPropertyFilterValue = -1;
       if (selectedValues.length === 0) {
-        criteria[this.view.parentProperty] = '-1';
+        parentPropertyFilterValue = '-1';
       } else if (selectedValues.length > 1) {
-        criteria[this.view.parentProperty] = '-1';
+        parentPropertyFilterValue = '-1';
       } else {
-        criteria[this.view.parentProperty] = selectedValues[0][OB.Constants.ID];
+        parentPropertyFilterValue = selectedValues[0][OB.Constants.ID];
+      }
+      var fnd = false;
+      var innerCriteria = criteria.criteria;
+      for (i = 0; i < innerCriteria.length; i++) {
+        criterion = innerCriteria[i];
+        fldName = criterion.fieldName;
+        if (fldName === this.view.parentProperty) {
+          fnd = true;
+          criterion.operator = 'equals';
+          criterion.value = parentPropertyFilterValue;
+          break;
+        }
+      }
+      if (!fnd) {
+        innerCriteria.add({
+          fieldName: this.view.parentProperty,
+          operator: 'equals',
+          value: parentPropertyFilterValue
+        });
       }
     }
-    
+        // get rid of some unneeded stuff in the criteria
+    if (criteria && criteria.criteria) {
+      var internalCriteria = criteria.criteria;
+      for (i = (internalCriteria.length - 1); i >= 0; i--) {
+        var shouldRemove = false;
+        criterion = internalCriteria[i];
+        if (criterion.fieldName && criterion.fieldName.startsWith('_')) {
+          shouldRemove = true;
+        } else if (isc.isA.emptyString(criterion.value)) {
+          shouldRemove = true;
+        }
+        if (shouldRemove) {
+          internalCriteria.removeAt(i);
+        }
+      }
+    }
+
+    this.checkShowFilterFunnelIcon(criteria);
+
+    return criteria;
+  },
+  
+  onFetchData: function(criteria, requestProperties) {    
+    requestProperties = requestProperties || {};
+    requestProperties.params = requestProperties.params || {};
+    var params = requestProperties.params;
+            
+    if (this.targetRecordId) {
+      params._targetRecordId = this.targetRecordId;
+    }
+
     // prevent the count operation
-    criteria[isc.OBViewGrid.NO_COUNT_PARAMETER] = 'true';
+    params[isc.OBViewGrid.NO_COUNT_PARAMETER] = 'true';
     
     if (this.orderByClause) {
-      criteria[OB.Constants.ORDERBY_PARAMETER] = this.orderByClause;
+      params[OB.Constants.ORDERBY_PARAMETER] = this.orderByClause;
     }
-    
+
+    // add all the new session properties context info to the requestProperties
+    isc.addProperties(params, this.view.getContextInfo(true, false));
+          
     if (this.filterClause) {
       if (this.whereClause) {
-        criteria[OB.Constants.WHERE_PARAMETER] = ' ((' + this.whereClause + ') and (' + this.filterClause + ")) ";
+        params[OB.Constants.WHERE_PARAMETER] = ' ((' + this.whereClause + ') and (' + this.filterClause + ")) ";
       } else {
-        criteria[OB.Constants.WHERE_PARAMETER] = this.filterClause;
+        params[OB.Constants.WHERE_PARAMETER] = this.filterClause;
       }
-      this.checkShowFilterFunnelIcon(criteria);
     } else if (this.whereClause) {
-      criteria[OB.Constants.WHERE_PARAMETER] = this.whereClause;
-      this.checkShowFilterFunnelIcon(criteria);
+      params[OB.Constants.WHERE_PARAMETER] = this.whereClause;
     } else {
-      criteria[OB.Constants.WHERE_PARAMETER] = null;
-      this.checkShowFilterFunnelIcon(criteria);
+      params[OB.Constants.WHERE_PARAMETER] = null;
     }
-    
-    // add all the new session properties context info to the criteria
-    isc.addProperties(criteria, this.view.getContextInfo(true, false));
-    
-    return criteria;
   },
   
   createNew: function(){
@@ -760,7 +870,7 @@
   // +++++++++++++++++++++++++++++ Context menu on record click +++++++++++++++++++++++
   
   cellContextClick: function(record, rowNum, colNum){
-    //this.handleRecordSelection(null, record, rowNum, null, colNum, null, null, true);
+    this.handleRecordSelection(null, record, rowNum, null, colNum, null, null, true);
     this.view.setAsActiveView();
     var ret = this.Super('cellContextClick', arguments);
     return ret;
@@ -769,15 +879,41 @@
   makeCellContextItems: function(record, rowNum, colNum){
     var sourceWindow = this.view.standardWindow.windowId;
     var menuItems = [];
+    var recordsSelected = this.getSelectedRecords().length > 0;
+    var singleSelected = this.getSelectedRecords().length === 1;
     var field = this.getField(colNum);
     var grid = this;
+    if (recordsSelected) {
+      var allSelectedHaveErrors = true;
+      for (var i = 0; i < this.getSelectedRecords().length; i++) {
+        var localRowNum = this.getRecordIndex(this.getSelectedRecords()[i]);
+        if (!this.rowHasErrors(localRowNum)) {
+          allSelectedHaveErrors = false;
+          break;
+        }
+      }
+      if (allSelectedHaveErrors) {
+        menuItems.add({
+          title: OB.I18N.getLabel('OBUIAPP_UndoChanges'),
+          click: function(){
+            grid.view.undo();
+          }
+        });
+      }
+    }
     menuItems.add({
-      title: OB.I18N.getLabel('OBUIAPP_CreateNewRecord'),
+      title: OB.I18N.getLabel('OBUIAPP_CreateRecordInGrid'),
       click: function(){
         grid.startEditingNew(rowNum);
       }
     });
-    if (this.canEdit && this.isWritable(record) && !this.view.readOnly) {
+    menuItems.add({
+      title: OB.I18N.getLabel('OBUIAPP_CreateRecordInForm'),
+      click: function(){
+        grid.view.newDocument();
+      }
+    });
+    if (singleSelected && this.canEdit && this.isWritable(record) && !this.view.readOnly) {
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_EditInGrid'),
         click: function(){
@@ -785,8 +921,15 @@
           grid.startEditing(rowNum, colNum);
         }
       });
+      menuItems.add({
+        title: OB.I18N.getLabel('OBUIAPP_EditInForm'),
+        click: function(){
+          grid.endEditing();
+          grid.view.editRecord(record);
+        }
+      });
     }
-    if (field.canFilter) {
+    if (singleSelected && field.canFilter) {
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_UseAsFilter'),
         click: function(){
@@ -806,7 +949,7 @@
         }
       });
     }
-    if (field.foreignKeyField) {
+    if (singleSelected && field.foreignKeyField) {
       menuItems.add({
         title: OB.I18N.getLabel('OBUIAPP_OpenOnTab'),
         click: function(){
@@ -819,6 +962,14 @@
         }
       });
     }
+    if (recordsSelected && !this.view.readOnly && this.allSelectedRecordsWritable()) {
+      menuItems.add({
+        title: OB.I18N.getLabel('OBUIAPP_Delete'),
+        click: function(){
+          grid.view.deleteSelectedRows();
+        }
+      });
+    }
     
     return menuItems;
   },
@@ -1051,9 +1202,11 @@
   // +++++++++++++++++ functions for the editing +++++++++++++++++
   
   startEditingNew: function(rowNum){
-    var insertRow = this.getDrawArea()[0];
+    var insertRow;
     if (rowNum || rowNum === 0) {
       insertRow = rowNum + 1;
+    } else {
+      insertRow = this.getTotalRows();
     }
     this.createNewRecordForEditing(insertRow);
     this.startEditing(insertRow);
@@ -1076,6 +1229,7 @@
     };
     
     this.data.insertCacheData(record, rowNum);
+    this.scrollToRow(rowNum);
     this.updateRowCountDisplay();
     this.redraw();
   },
@@ -1487,6 +1641,9 @@
   
   // we are being reshown, get new values for the combos
   visibilityChanged: function(visible){
+    if (visible && this.view.isActiveView()) {      
+      this.enableKeyBoardShortCuts();
+    }
     if (visible && this.getEditRow()) {
       this.getEditForm().doChangeFICCall();
     }
@@ -1499,6 +1656,16 @@
     return !record._readOnly;
   },
   
+  allSelectedRecordsWritable: function() {
+    for (var i = 0; i < this.getSelectedRecords().length; i++) {
+      var record = this.getSelectedRecords()[i];
+      if (!this.isWritable(record)) {
+        return false;
+      }
+    }
+    return true;    
+  },
+  
   setRecordErrorMessage: function(rowNum, msg){
     var record = this.getRecord(rowNum);
     if (!record) {
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-manager.js	Tue Mar 08 16:19:56 2011 +0100
@@ -38,13 +38,17 @@
   var tabSet = M.TabSet;
   
   function ViewManager(){
+    // keep the last 5 opened views
+    this.recentManager.recentNum = 5;
   }
   
   ViewManager.prototype = {
   
-    // if true then certain functions are disab
+    // if true then certain functions are disabled
     inStateHandling: false,
     
+    recentManager: new OB.RecentUtilitiesClass(),
+    
     // ** {{ ViewManager.views }} **
     // Collection of opened views
     views: {
@@ -209,6 +213,19 @@
     
       params = params || {};
       
+      // only add closable views to the recent items, this prevents the workspace
+      // view from being displayed, explicitly doing !== false to catch 
+      // views which don't have this set at all
+      // don't store OBPopupClassicWindow in the viewmanager 
+      // don't store direct links to a target tab, this should be set in a different
+      // property
+      if (!params.targetTabId && params.canClose !== false && !vmgr.inStateHandling && params.viewId !== 'OBPopupClassicWindow') {
+        // add and set a default icon
+        vmgr.recentManager.addRecent('OBUIAPP_RecentViewList', 
+            isc.addProperties({icon: '[SKINIMG]../../org.openbravo.client.application/images/application-menu/iconWindow.png'}, 
+                params));
+      }
+      
       //
       // Returns the function implementation of a View
       //
@@ -495,6 +512,15 @@
       if (!viewTabId) {
         this.openView(viewId, viewParams, null);
       }
+      
+      // check if a tabId was passed as a url param
+      // only do this if there is no other history
+      if (!historyId) {
+        var urlParams = OB.Utilities.getUrlParameters();
+        if (urlParams.tabId) {
+          OB.Utilities.openDirectTab(urlParams.tabId, urlParams.recordId, urlParams.command);
+        }
+      }
     }
   };
   
Binary file modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-saveclose.png has changed
Binary file modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/images/toolbar/iconButton-savecloseX.png has changed
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-dialog-styles.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-dialog-styles.js	Tue Mar 08 16:19:56 2011 +0100
@@ -17,7 +17,6 @@
  ************************************************************************
  */
 
-
 /* Changes the skin of isc.Dialog */
 
 isc.Dialog.addProperties({
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-form-styles.js	Tue Mar 08 16:19:56 2011 +0100
@@ -49,6 +49,7 @@
   textBoxStyle: 'OBFormFieldInput'
 });
 
+
 isc.OBTimeItem.addProperties({
   errorOrientation: 'left',
   height: 21,
@@ -148,6 +149,25 @@
   newTabIconSize: 8
 });
 
+isc.OBLinkItem.addProperties({
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldInput',
+  pickerIconHeight: 21,
+  pickerIconWidth: 21,
+  height: 21,
+  pickerIconSrc: '[SKINIMG]../../org.openbravo.client.application/images/form/search_picker.png',
+  clearIcon: {
+    showHover: true,
+    height: 15,
+    width: 15,
+    src: '[SKINIMG]../../org.openbravo.client.application/images/form/clear-field.png',    
+    prompt: OB.I18N.getLabel('OBUIAPP_ClearIconPrompt')
+  },
+  newTabIconSrc: '[SKINIMG]../../org.openbravo.client.application/images/form/ico-to-new-tab.png',
+  newTabIconSize: 8
+});
+
 
 isc.OBDateChooser.addProperties({
   headerStyle: 'OBDateChooserButton',
@@ -196,7 +216,6 @@
   nextMonthIconHeight: 16
 });
 
-
 OB.OBDateItemStyleProperties = {
   cellStyle: 'OBFormField',
   titleStyle: 'OBFormFieldLabel',
@@ -229,6 +248,178 @@
   errorOrientation: 'left'
 });
 
+/* =====================================================================
+ * Date range filter item and dialog
+ =======================================================================*/
+
+isc.OBDateRangeDialog.addProperties({
+  // rounded frame edges
+  showEdges: true,
+  edgeImage: '[SKIN]/../../../org.openbravo.client.application/images/popup/border.png',
+  customEdges: null,
+  edgeSize: 2,
+  edgeTop: 27,
+  edgeBottom: 2,
+  edgeOffsetTop: 2,
+  edgeOffsetRight: 2,
+  edgeOffsetBottom: 2,
+  showHeaderBackground: false, // part of edges
+  showHeaderIcon: true,
+  isModal : true,
+  showModalMask : true,
+  dragAppearance : 'target',
+
+  // clear backgroundColor and style since corners are rounded
+  backgroundColor: null,
+  border: null,
+  styleName: 'OBPopup',
+  edgeCenterBackgroundColor: '#FFFFFF',
+  bodyColor: 'transparent',
+  bodyStyle: 'OBPopupBody',
+  headerStyle: 'OBPopupHeader',
+
+  layoutMargin: 0,
+  membersMargin: 0,
+
+  showShadow: false,
+  shadowDepth: 5,
+  width: 400,
+  height: 160
+});
+
+isc.OBDateRangeDialog.changeDefaults('headerDefaults', {
+  layoutMargin: 0,
+  height: 25
+});
+
+isc.OBDateRangeDialog.changeDefaults('headerLabelDefaults', {
+  wrap : false,
+  width : '100%',
+  inherentWidth : true,
+  styleName: 'OBPopupHeaderText',
+  align: isc.Canvas.CENTER
+});
+
+isc.OBDateRangeDialog.changeDefaults('buttonLayoutDefaults', {
+  align: 'center'
+});
+
+isc.OBDateRangeDialog.changeDefaults('closeButtonDefaults', {
+  baseStyle: 'OBPopupIconClose',
+  src: '[SKIN]/../../org.openbravo.client.application/images/popup/close.png',
+  width: 24,
+  height: 20
+});
+
+isc.OBDateRangeDialog.changeDefaults('headerIconProperties', {
+  styleName: 'OBPopupHeaderIcon',
+  src: '[SKIN]/../../org.openbravo.client.application/images/popup/iconHeader.png',
+  width: 20,
+  height: 16
+});
+
+isc.OBDateRangeDialog.addProperties({
+  clearButtonConstructor: isc.OBFormButton,
+  cancelButtonConstructor: isc.OBFormButton,
+  okButtonConstructor: isc.OBFormButton,
+  okButtonTitle: OB.I18N.getLabel('OBUISC_Dialog.OK_BUTTON_TITLE'),
+  clearButtonTitle: OB.I18N.getLabel('OBUIAPP_Clear'),
+  cancelButtonTitle: OB.I18N.getLabel('OBUISC_Dialog.CANCEL_BUTTON_TITLE'),
+  headerTitle: OB.I18N.getLabel('OBUIAPP_SelectDateRange')
+});
+
+isc.OBMiniDateRangeItem.changeDefaults('pickerIconDefaults', {
+  width: 21,
+  height: 21,
+  src: '[SKIN]/../../org.openbravo.client.application/images/form/date_control.png'
+});
+
+isc.OBMiniDateRangeItem.addProperties({
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldInput',
+  fromDateOnlyPrefix: OB.I18N.getLabel('OBUIAPP_fromDateOnlyPrefix'),
+  toDateOnlyPrefix: OB.I18N.getLabel('OBUIAPP_toDateOnlyPrefix'),
+  pickerIconPrompt: OB.I18N.getLabel('OBUIAPP_pickerIconPrompt')
+});
+
+isc.DateRangeItem.changeDefaults('dateRangeFormDefaults', {
+  titleSuffix: '</b>',
+  titlePrefix: '<b>',
+  requiredTitleSuffix: ' *</b>',
+  requiredRightTitlePrefix: '<b>* ',
+  rightTitlePrefix: '<b>',
+  rightTitleSuffix: '</b>'
+});
+
+isc.DateRangeItem.addProperties({
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldInput',
+  fromTitle: OB.I18N.getLabel('OBUIAPP_From'),
+  toTitle: OB.I18N.getLabel('OBUIAPP_To')
+});
+
+isc.RelativeDateItem.addProperties({
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldSelectInput',
+  controlStyle: 'OBFormFieldSelectControl',
+  timeUnitOptions: ['day', 'week', 'month', 'quarter', 'year'],
+  todayTitle: OB.I18N.getLabel('OBUISC_DateChooser.todayButtonTitle'),
+  
+  millisecondsAgoTitle: OB.I18N.getLabel('OBUIAPP_milliseconds_ago'),
+  secondsAgoTitle: OB.I18N.getLabel('OBUIAPP_seconds_ago'),
+  minutesAgoTitle: OB.I18N.getLabel('OBUIAPP_minutes_ago'),  
+  hoursAgoTitle: OB.I18N.getLabel('OBUIAPP_hours_ago'),
+  daysAgoTitle: OB.I18N.getLabel('OBUIAPP_days_ago'),
+  weeksAgoTitle: OB.I18N.getLabel('OBUIAPP_weeks_ago'),
+  monthsAgoTitle: OB.I18N.getLabel('OBUIAPP_months_ago'),
+  quartersAgoTitle: OB.I18N.getLabel('OBUIAPP_quarters_ago'),
+  yearsAgoTitle: OB.I18N.getLabel('OBUIAPP_years_ago'),
+  
+  millisecondsFromNowTitle: OB.I18N.getLabel('OBUIAPP_milliseconds_from_now'),
+  secondsFromNowTitle: OB.I18N.getLabel('OBUIAPP_seconds_from_now'),
+  minutesFromNowTitle: OB.I18N.getLabel('OBUIAPP_minutes_from_now'),
+  hoursFromNowTitle: OB.I18N.getLabel('OBUIAPP_hours_from_now'),
+  daysFromNowTitle: OB.I18N.getLabel('OBUIAPP_days_from_now'),
+  weeksFromNowTitle: OB.I18N.getLabel('OBUIAPP_weeks_from_now'),
+  monthsFromNowTitle: OB.I18N.getLabel('OBUIAPP_months_from_now'),
+  quartersFromNowTitle: OB.I18N.getLabel('OBUIAPP_quarters_from_now'),
+  yearsFromNowTitle: OB.I18N.getLabel('OBUIAPP_years_from_now'),
+  
+  presetOptions: {
+    "$today" : OB.I18N.getLabel('OBUISC_DateChooser.todayButtonTitle'),
+    "$yesterday" : OB.I18N.getLabel('OBUIAPP_Yesterday'),
+    "$tomorrow" : OB.I18N.getLabel('OBUIAPP_Tomorrow'),
+    "-1w" : OB.I18N.getLabel('OBUIAPP_Current_day_of_last_week'),
+    "+1w" : OB.I18N.getLabel('OBUIAPP_Current_day_of_next_week'),
+    "-1m" : OB.I18N.getLabel('OBUIAPP_Current_day_of_last_month'),
+    "+1m" : OB.I18N.getLabel('OBUIAPP_Current_day_of_next_month')
+  }
+});
+
+isc.RelativeDateItem.changeDefaults('valueFieldDefaults', {
+  cellStyle: 'OBFormField',
+  titleStyle: 'OBFormFieldLabel',
+  textBoxStyle: 'OBFormFieldSelectInput',
+  controlStyle: 'OBFormFieldSelectControl',
+  pickerIconSrc: '[SKIN]/../../org.openbravo.client.application/images/form/comboBoxPicker.png',
+  pickerIconWidth: 21,
+  pickerIconHeight: 21
+});
+
+isc.RelativeDateItem.changeDefaults('pickerIconDefaults', {
+  width: 21,
+  height: 21,
+  src: '[SKIN]/../../org.openbravo.client.application/images/form/date_control.png'
+});
+
+isc.RelativeDateItem.addProperties({
+  displayFormat: OB.Format.date,
+  inputFormat: OB.Format.date,
+  pickerConstructor: 'OBDateChooser'
+});
 
 /* =====================================================================
  * SectionItem Button Styles
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.css	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.css	Tue Mar 08 16:19:56 2011 +0100
@@ -118,6 +118,18 @@
   background-image: url(./images/toolbar/iconButton-save.png);
 }
 
+.OBToolbarIconButton_icon_saveclose {
+  background-repeat: no-repeat;
+  background-position: center center;
+  background-image: url(./images/toolbar/iconButton-saveclose.png);
+}
+
+.OBToolbarIconButton_icon_savecloseX {
+  background-repeat: no-repeat;
+  background-position: center center;
+  background-image: url(./images/toolbar/iconButton-savecloseX.png);
+}
+
 .OBToolbarIconButton_icon_createCopy {
   background-repeat: no-repeat;
   background-position: center center;
--- a/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.application/web/org.openbravo.userinterface.smartclient/openbravo/skins/3.00/org.openbravo.client.application/ob-toolbar-styles.js	Tue Mar 08 16:19:56 2011 +0100
@@ -21,7 +21,7 @@
 isc.OBToolbar.addProperties({
   width: '100%',
   height: 45,
-  leftMargin: 30,
+  leftMargin: 6,
   rightMargin: 4,
   leftMembersMargin: 4,
   rightMembersMargin: 12
--- a/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src-db/database/sourcedata/OBCLKER_UIDEFINITION.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -66,7 +66,7 @@
 <!--30ABBB2416964B3CB1C4E1608974843B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--30ABBB2416964B3CB1C4E1608974843B-->  <AD_MODULE_ID><![CDATA[4B828F4D03264080AA1D2057B13F613C]]></AD_MODULE_ID>
 <!--30ABBB2416964B3CB1C4E1608974843B-->  <AD_REFERENCE_ID><![CDATA[800101]]></AD_REFERENCE_ID>
-<!--30ABBB2416964B3CB1C4E1608974843B-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.StringUIDefinition]]></CLASSNAME>
+<!--30ABBB2416964B3CB1C4E1608974843B-->  <CLASSNAME><![CDATA[org.openbravo.client.kernel.reference.LinkUIDefinition]]></CLASSNAME>
 <!--30ABBB2416964B3CB1C4E1608974843B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--30ABBB2416964B3CB1C4E1608974843B--></OBCLKER_UIDEFINITION>
 
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateTimeUIDefinition.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateTimeUIDefinition.java	Tue Mar 08 16:19:56 2011 +0100
@@ -18,7 +18,6 @@
  */
 package org.openbravo.client.kernel.reference;
 
-
 /**
  * Implementation of the date time ui definition.
  * 
@@ -36,9 +35,4 @@
     return "OBDateTimeItem";
   }
 
-  @Override
-  public String getFilterEditorType() {
-    return "OBDateItem";
-  }
-
 }
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/DateUIDefinition.java	Tue Mar 08 16:19:56 2011 +0100
@@ -24,6 +24,7 @@
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.domaintype.PrimitiveDomainType;
 import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.model.ad.ui.Field;
 
 /**
  * Implementation of the date ui definition.
@@ -55,6 +56,16 @@
     return "OBDateItem";
   }
 
+  @Override
+  public String getFilterEditorType() {
+    return "OBMiniDateRangeItem";
+  }
+
+  @Override
+  public String getFilterEditorProperties(Field field) {
+    return ", filterOnKeypress: true" + super.getFilterEditorProperties(field);
+  }
+
   private SimpleDateFormat getClassicFormat() {
     String pattern = RequestContext.get().getSessionAttribute("#AD_JAVADATEFORMAT").toString();
     if (dateFormat == null || !pattern.equals(lastUsedPattern)) {
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKSearchUIDefinition.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKSearchUIDefinition.java	Tue Mar 08 16:19:56 2011 +0100
@@ -29,7 +29,6 @@
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.data.Sqlc;
 import org.openbravo.model.ad.domain.ModelImplementation;
 import org.openbravo.model.ad.domain.ModelImplementationMapping;
 import org.openbravo.model.ad.domain.Reference;
@@ -124,9 +123,9 @@
       final List<String> outFields = new ArrayList<String>();
       for (SelectorColumn selectorColumn : selector.getADSelectorColumnList()) {
         if (selectorColumn.isActive()) {
-          String columnName = selectorColumn.getDBColumnName()
+          String columnName = selectorColumn.getName()
               + (selectorColumn.getSuffix() != null ? selectorColumn.getSuffix() : "");
-          columnName = "inp" + Sqlc.TransformaNombreColumna(columnName);
+          columnName = "inp" + columnName;
           if (selectorColumn.getColumnType().equals("I")) {
             inFields.add(columnName);
           } else {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/LinkUIDefinition.java	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,63 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.client.kernel.reference;
+
+import org.openbravo.model.ad.ui.Field;
+
+/**
+ * Implementation of the Link UI definition.
+ * 
+ */
+public class LinkUIDefinition extends UIDefinition {
+
+  @Override
+  public String getParentType() {
+    return "link";
+  }
+
+  @Override
+  public String getFormEditorType() {
+    return "OBLinkItem";
+  }
+
+  @Override
+  public String getFilterEditorType() {
+    return "OBTextItem";
+  }
+
+  @Override
+  public String getGridFieldProperties(Field field) {
+    Long length = field.getDisplayedLength();
+    if (length == null || length == 0) {
+      length = field.getColumn().getLength();
+    }
+    // custom override
+    if (field.getColumn().getDBColumnName().compareToIgnoreCase("documentno") == 0) {
+      length = new Long(20);
+    }
+    return getShowHoverGridFieldSettings(field) + ", width: isc.OBGrid.getDefaultColumnWidth("
+        + length + ")" + super.getGridFieldProperties(field);
+  }
+
+  @Override
+  public String getFilterEditorProperties(Field field) {
+    return ", filterOnKeypress: true" + super.getFilterEditorProperties(field);
+  }
+
+}
--- a/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-dynamic-js.ftl	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/templates/application-dynamic-js.ftl	Tue Mar 08 16:19:56 2011 +0100
@@ -26,11 +26,11 @@
         name : '${(data.user.name!'')?js_string}',
         email : '${(data.user.email!'')?js_string}',
         roleId: '${data.role.id}',
-        roleName: '${data.role.name}',
+        roleName: '${data.role.name?js_string}',
         clientId: '${data.client.id}',
-        clientName: '${data.client.name}',
+        clientName: '${data.client.name?js_string}',
         organizationId: '${data.organization.id}',
-        organizationName: '${data.organization.name}'
+        organizationName: '${data.organization.name?js_string}'
 };
 
 OB.AccessibleEntities = {
--- a/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/URLWidgetProvider.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.myob/src/org/openbravo/client/myob/URLWidgetProvider.java	Tue Mar 08 16:19:56 2011 +0100
@@ -21,7 +21,10 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.NonUniqueResultException;
+import org.hibernate.criterion.Expression;
 import org.openbravo.base.exception.OBException;
+import org.openbravo.dal.service.OBDao;
 
 /**
  * Responsible for creating the URL Widgets.
@@ -51,10 +54,17 @@
       final JSONObject jsonObject = super.getWidgetClassDefinition();
       final JSONObject parameters = new JSONObject();
       jsonObject.put(WidgetProvider.PARAMETERS, parameters);
-      if (!getWidgetClass().getOBKMOWidgetURLList().isEmpty()) {
-        parameters.put(SRC, getWidgetClass().getOBKMOWidgetURLList().get(0).getURL());
-      } else {
-        log.warn("URLWidget does not have a URL defined.");
+      try {
+        final WidgetURL widgetURL = (WidgetURL) OBDao.getFilteredCriteria(WidgetURL.class,
+            Expression.eq(WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass())).uniqueResult();
+        if (widgetURL != null) {
+          parameters.put(SRC, widgetURL.getURL());
+        } else {
+          log.warn("URLWidget does not have a URL defined.");
+          parameters.put(SRC, "");
+        }
+      } catch (NonUniqueResultException e) {
+        log.warn("URLWidget has more than one active URL defined.", e);
         parameters.put(SRC, "");
       }
       if (jsonObject.getJSONArray(WidgetProvider.FIELDDEFINITIONS).length() > 0) {
@@ -68,20 +78,23 @@
   }
 
   public JSONObject getWidgetInstanceDefinition(WidgetInstance widgetInstance) {
+    final JSONObject jsonObject = new JSONObject();
     try {
-      final JSONObject jsonObject = new JSONObject();
       addDefaultWidgetProperties(jsonObject, widgetInstance);
       final JSONObject parameters = jsonObject.getJSONObject(WidgetProvider.PARAMETERS);
-      if (widgetInstance.getWidgetClass().getOBKMOWidgetURLList().isEmpty()) {
+      final WidgetURL widgetURL = (WidgetURL) OBDao.getFilteredCriteria(WidgetURL.class,
+          Expression.eq(WidgetURL.PROPERTY_WIDGETCLASS, getWidgetClass())).uniqueResult();
+      if (widgetURL != null) {
+        parameters.put(SRC, widgetURL.getURL());
+      } else {
         log.error("No url widget defined for widget class " + widgetInstance.getWidgetClass());
-      } else {
-        parameters
-            .put(SRC, widgetInstance.getWidgetClass().getOBKMOWidgetURLList().get(0).getURL());
       }
-      return jsonObject;
+    } catch (NonUniqueResultException e) {
+      log.error("More than one active url defined for widget " + widgetInstance.getWidgetClass(), e);
     } catch (Exception e) {
       throw new OBException(e);
     }
+    return jsonObject;
   }
 
   @Override
--- a/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.client.myob/web/org.openbravo.client.myob/js/ob-myopenbravo.js	Tue Mar 08 16:19:56 2011 +0100
@@ -115,7 +115,7 @@
     this.setRecentList(recentViewsLinksLayout);
 
     OB.PropertyStore.addListener(function(propertyName, currentValue, newValue){
-      if (propertyName === 'UINAVBA_RecentLaunchList') {
+      if (propertyName === 'OBUIAPP_RecentViewList') {
         me.setRecentList(recentViewsLinksLayout);
       }
     });
@@ -337,13 +337,10 @@
     layout.removeMembers(layout.members);
     
     // reads the list of recents and displays them
-    recentList = OB.RecentUtilities.getRecentValue('UINAVBA_RecentLaunchList');
+    recentList = OB.Layout.ViewManager.recentManager.getRecentValue('OBUIAPP_RecentViewList');
     if (recentList && recentList.length > 0) {
     
       handleClickFunction = function(){
-        if (this.updateRecent) {
-          OB.RecentUtilities.addRecent('UINAVBA_RecentLaunchList', this.recent);
-        }
         if (this.recent.viewId) {
           OB.Layout.ViewManager.openView(this.recent.viewId, this.recent);
         } else {
@@ -367,6 +364,12 @@
             }
           }
 
+          // if the recent was added through quick create then repair this
+          // https://issues.openbravo.com/view.php?id=16132
+          if (recent.command === 'NEW') {
+            recent.command = 'DEFAULT';
+          }
+          
           lbl = isc.Label.create({
             contents: recent.tabTitle,
             recent: recent,
@@ -384,7 +387,7 @@
           });
           entryLayout.addMember(lbl);
           // if a standard window then show the new icon
-          if (recent.tabId && !recent.singleRecord && !recent.readOnly) {
+          if (recent.windowId && !recent.singleRecord && !recent.readOnly) {
             // make a copy
             newRecent = isc.addProperties({}, recent);
             newRecent.command = 'NEW';
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_PREFERENCE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,14 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<data>
+<!--FF8080812E804F64012E805A54F70007--><AD_PREFERENCE>
+<!--FF8080812E804F64012E805A54F70007-->  <AD_PREFERENCE_ID><![CDATA[FF8080812E804F64012E805A54F70007]]></AD_PREFERENCE_ID>
+<!--FF8080812E804F64012E805A54F70007-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E804F64012E805A54F70007-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E804F64012E805A54F70007-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E804F64012E805A54F70007-->  <ATTRIBUTE><![CDATA[CSVFieldSeparator]]></ATTRIBUTE>
+<!--FF8080812E804F64012E805A54F70007-->  <VALUE><![CDATA[,]]></VALUE>
+<!--FF8080812E804F64012E805A54F70007-->  <ISPROPERTYLIST><![CDATA[N]]></ISPROPERTYLIST>
+<!--FF8080812E804F64012E805A54F70007-->  <AD_MODULE_ID><![CDATA[A44B9BA75C354D8FB2E3F7D6EB6BFDC4]]></AD_MODULE_ID>
+<!--FF8080812E804F64012E805A54F70007--></AD_PREFERENCE>
+
+</data>
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServlet.java	Tue Mar 08 16:19:56 2011 +0100
@@ -22,9 +22,13 @@
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Vector;
 
@@ -46,10 +50,14 @@
 import org.openbravo.client.kernel.BaseKernelServlet;
 import org.openbravo.client.kernel.KernelUtils;
 import org.openbravo.client.kernel.OBUserException;
+import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.core.SessionHandler;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.SessionInfo;
+import org.openbravo.erpCommon.businessUtility.Preferences;
 import org.openbravo.erpCommon.security.UsageAudit;
+import org.openbravo.erpCommon.utility.PropertyException;
 import org.openbravo.service.json.JsonConstants;
 import org.openbravo.service.json.JsonUtils;
 import org.openbravo.service.web.InvalidContentException;
@@ -164,10 +172,8 @@
           log.error("Error trying to apply datasource filter with class: " + filterClass, e);
         }
       }
-
       // now do the action
       String result = getDataSource(request).fetch(parameters);
-
       boolean isExport = "true".equals(parameters.get("exportToFile"));
       if (isExport) {
         String exportAs = parameters.get("exportAs");
@@ -175,7 +181,7 @@
           exportAs = "csv";
         }
         if ("csv".equals(exportAs)) {
-          writeResultCSV(response, result);
+          writeResultCSV(request, response, parameters, result);
         } else {
           log.error("Unsupported export format: " + exportAs);
         }
@@ -422,47 +428,129 @@
     w.close();
   }
 
-  private void writeResultCSV(HttpServletResponse response, String result) throws IOException,
-      JSONException {
+  private void writeResultCSV(HttpServletRequest request, HttpServletResponse response,
+      Map<String, String> parameters, String result) throws IOException, JSONException {
     response.setContentType("text/csv; charset=UTF-8");
     response.setHeader("Content-Disposition", "attachment; filename=ExportedData.csv");
+    VariablesSecureApp vars = new VariablesSecureApp(request);
 
     JSONObject jsonResult = new JSONObject(result);
     JSONArray data = jsonResult.getJSONObject("response").getJSONArray("data");
+    String fieldSeparator;
+    try {
+      fieldSeparator = Preferences.getPreferenceValue("CSVFieldSeparator", false, null, null,
+          OBContext.getOBContext().getUser(), null, null);
+    } catch (PropertyException e) {
+      log.warn("CSV Field Separator couldn't be found. Using default separator: ,");
+      fieldSeparator = ",";
+    }
 
+    List<String> fieldProperties = new ArrayList<String>();
+    if (parameters.get("viewState") != null
+        && !parameters.get("viewState").toString().equals("undefined")) {
+      String viewStateO = parameters.get("viewState");
+      String viewStateWithoutParenthesis = viewStateO.substring(1, viewStateO.length() - 1);
+      JSONObject viewState = new JSONObject(viewStateWithoutParenthesis);
+      String fieldA = viewState.getString("field");
+      JSONArray fields = new JSONArray(fieldA);
+      for (int i = 0; i < fields.length(); i++) {
+        JSONObject field = fields.getJSONObject(i);
+        if (field.has("visible") && !field.getBoolean("visible")) {
+          // The field is not visible. We should not export it
+          continue;
+        }
+        if (field.getString("name").equals("_checkboxField")
+            || field.getString("name").equals("_editLink")) {
+          continue;
+        }
+        fieldProperties.add(field.getString("name"));
+      }
+    }
     StringBuffer csv = new StringBuffer();
     if (data.length() > 0) {
-      final JSONObject headerRow = data.getJSONObject(0);
-
-      final Iterator<?> itKeys = headerRow.keys();
-      Vector<String> keys = new Vector<String>();
-      boolean isFirst = true;
-      while (itKeys.hasNext()) {
-        if (isFirst) {
-          isFirst = false;
-        } else {
-          csv.append(",");
+      if (fieldProperties.size() > 0) {
+        // If the request came with the view state information, we get the properties from there
+        for (int i = 0; i < fieldProperties.size(); i++) {
+          if (i > 0) {
+            csv.append(fieldSeparator);
+          }
+          csv.append("\"").append(fieldProperties.get(i)).append("\"");
         }
-        String key = (String) itKeys.next();
-        keys.add(key);
-        csv.append("'").append(key).append("'");
+      } else {
+        // If not, we get them from the JSONObject itself
+        final JSONObject headerRow = data.getJSONObject(0);
+        final Iterator<?> itKeysF = headerRow.keys();
+        Vector<String> keys = new Vector<String>();
+        boolean isFirst = true;
+        while (itKeysF.hasNext()) {
+          String key = (String) itKeysF.next();
+          if (key.endsWith("_identifier")) {
+            continue;
+          }
+          if (fieldProperties.size() > 0 && !fieldProperties.contains(key)) {
+            // Field is not visible. We don't show it
+            continue;
+          }
+          if (isFirst) {
+            isFirst = false;
+          } else {
+            csv.append(fieldSeparator);
+          }
+          keys.add(key);
+          csv.append("'").append(key).append("'");
+        }
       }
 
       for (int i = 0; i < data.length(); i++) {
         JSONObject row = data.getJSONObject(i);
         csv.append("\n");
-        isFirst = true;
-        for (String key : keys) {
+        final Iterator<?> itKeys;
+        if (fieldProperties.size() > 0) {
+          itKeys = fieldProperties.iterator();
+        } else {
+          itKeys = row.keys();
+        }
+        boolean isFirst = true;
+        while (itKeys.hasNext()) {
+          String key = (String) itKeys.next();
+          if (key.endsWith("_identifier")) {
+            continue;
+          }
+          if (fieldProperties.size() > 0 && !fieldProperties.contains(key)) {
+            // Field is not visible. We don't show it
+            continue;
+          }
           if (isFirst) {
             isFirst = false;
           } else {
-            csv.append(",");
+            csv.append(fieldSeparator);
           }
-          Object keyValue = row.get(key);
-          if (keyValue instanceof String) {
-            Replace.replace((String) keyValue, "\"", "\"\"");
+          if (!row.has(key)) {
+            continue;
           }
-          csv.append("\"").append(keyValue).append("\"");
+          Object keyValue = row.has(key + "._identifier") ? row.get(key + "._identifier") : row
+              .get(key);
+          if (keyValue instanceof Number && keyValue != null) {
+            keyValue = keyValue.toString().replace(".",
+                vars.getSessionValue("#DecimalSeparator|generalQtyEdition").substring(0, 1));
+          }
+          if ((keyValue instanceof Date) && keyValue != null) {
+            // TODO This currently will never happen. Dates in JSONObjects are represented as
+            // Strings, and therefore keyValue will never be Date or DateTime. Once a BaseOBObject
+            // is exported instead of a JSONObject, this will be done properly
+            String pattern = RequestContext.get().getSessionAttribute("#AD_JAVADATEFORMAT")
+                .toString();
+            SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
+            dateFormat.setLenient(true);
+            keyValue = dateFormat.format((Date) keyValue);
+          }
+          if (keyValue != null && !keyValue.toString().equals("null")) {
+            keyValue = Replace.replace(keyValue.toString(), "\"", "\"\"");
+          } else {
+            keyValue = "";
+          }
+          keyValue = "\"" + keyValue + "\"";
+          csv.append(keyValue);
         }
       }
     }
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Tue Mar 08 16:19:56 2011 +0100
@@ -64,11 +64,6 @@
 
       parameters.put(JsonConstants.USE_ALIAS, "true");
 
-      // System.err.println(">>>>>>>>>>>>>>>>>>>>>>>>>>" + new Date());
-      // for (String key : parameters.keySet()) {
-      // System.err.println(key + ": " + parameters.get(key));
-      // }
-
       return DefaultJsonDataService.getInstance().fetch(parameters);
     } finally {
       OBContext.restorePreviousMode();
@@ -139,6 +134,7 @@
     if (additionalPropParameter != null) {
       additionalProperties.append(additionalPropParameter);
     }
+
     // get the additionalproperties from the properties
     for (DataSourceProperty dsProp : dsProperties) {
       final Map<String, Object> params = dsProp.getUIDefinition().getDataSourceParameters();
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/templates/datasource.ftl	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/templates/datasource.ftl	Tue Mar 08 16:19:56 2011 +0100
@@ -29,17 +29,18 @@
 <#if data.getParameter("_onlyGenerateCreateStatement") != "">
     <@generateDataSource data=data/>
 </#if>
-<#if data.getParameter("create") != "">
+<#if data.getParameter("_create") != "">
     <@generateDataSource data=data/>;
 </#if>
 
 <#macro generateDataSource data>
     OB.Datasource.create({
         createClassName: '${data.dataSourceClassName?js_string}',
-<#if data.getParameter("_onlyGenerateCreateStatement") == "" || data.getParameter("create") != "">
+<#if data.getParameter("_onlyGenerateCreateStatement") == "" || data.getParameter("_create") != "">
         ID:'${data.id}',
 </#if>
-        dataURL:'${data.dataUrl?js_string}${data.name?js_string}'
+        titleField: OB.Constants.IDENTIFIER
+        , dataURL:'${data.dataUrl?js_string}${data.name?js_string}'
         , recordXPath: '/response/data', dataFormat: 'json'
         , operationBindings:  [{operationType: 'fetch', dataProtocol: 'postParams', requestProperties:{httpMethod: 'POST'}} 
         , {operationType: 'add', dataProtocol: 'postMessage'}
--- a/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.datasource/web/org.openbravo.service.datasource/js/ob-datasource-utilities.js	Tue Mar 08 16:19:56 2011 +0100
@@ -84,7 +84,7 @@
 
   var rpcRequest = {};
   rpcRequest.params = {
-    'create' : true
+    '_create' : true
   };
   if (doNew) {
     rpcRequest.params._new = true;
@@ -124,5 +124,12 @@
 isc.ClassFactory.defineClass('OBRestDataSource', isc.RestDataSource);
 
 isc.OBRestDataSource.addProperties({
+  sendDSRequest: function(dsRequest) {
+	//TODO: Report an issue to SmartClient - This part is a work around
+    if (dsRequest.params && this.requestProperties && this.requestProperties.params) {
+      isc.addProperties(dsRequest.params, this.requestProperties.params);
+    }
+    this.Super('sendDSRequest', arguments);
+  }
 });
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,990 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2009 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.service.json;
+
+import java.math.BigDecimal;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.model.Entity;
+import org.openbravo.base.model.ModelProvider;
+import org.openbravo.base.model.Property;
+import org.openbravo.base.structure.IdentifierProvider;
+import org.openbravo.base.util.Check;
+import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.service.db.DalConnectionProvider;
+
+/**
+ * Translates an advanced criteria/filter object into a HQL query. Also takes into account session
+ * and other parameters.
+ * 
+ * @author mtaal
+ */
+public class AdvancedQueryBuilder {
+
+  private static final String PARAM_DELIMITER = "@";
+  private static final String ALIAS_PREFIX = "alias_";
+  private static final char ESCAPE_CHAR = '|';
+
+  private static final String OPERATOR_AND = "and";
+  static final String OPERATOR_OR = "or";
+
+  private static final String OPERATOR_EQUALS = "equals";
+  private static final String OPERATOR_NOTEQUAL = "notEqual";
+  private static final String OPERATOR_IEQUALS = "iEquals";
+  private static final String OPERATOR_INOTEQUAL = "iNotEqual";
+  private static final String OPERATOR_GREATERTHAN = "greaterThan";
+  private static final String OPERATOR_LESSTHAN = "lessThan";
+  private static final String OPERATOR_GREATEROREQUAL = "greaterOrEqual";
+  private static final String OPERATOR_LESSOREQUAL = "lessOrEqual";
+  private static final String OPERATOR_CONTAINS = "contains";
+  private static final String OPERATOR_STARTSWITH = "startsWith";
+  private static final String OPERATOR_ENDSWITH = "endsWith";
+  private static final String OPERATOR_ICONTAINS = "iContains";
+  private static final String OPERATOR_ISTARTSWITH = "iStartsWith";
+  private static final String OPERATOR_IENDSWITH = "iEndsWith";
+  private static final String OPERATOR_NOTCONTAINS = "notContains";
+  private static final String OPERATOR_NOTSTARTSWITH = "notStartsWith";
+  private static final String OPERATOR_NOTENDSWITH = "notEndsWith";
+  private static final String OPERATOR_INOTCONTAINS = "iNotContains";
+  private static final String OPERATOR_INOTSTARTSWITH = "iNotStartsWith";
+  private static final String OPERATOR_INOTENDSWITH = "iNotEndsWith";
+  // private static final String OPERATOR_REGEXP = "regexp";
+  // private static final String OPERATOR_IREGEXP = "iregexp";
+  private static final String OPERATOR_ISNULL = "isNull";
+  private static final String OPERATOR_NOTNULL = "notNull";
+  private static final String OPERATOR_INSET = "inSet";
+  private static final String OPERATOR_NOTINSET = "notInSet";
+  private static final String OPERATOR_EQUALSFIELD = "equalsField";
+  private static final String OPERATOR_NOTEQUALFIELD = "notEqualField";
+  private static final String OPERATOR_GREATERTHANFIElD = "greaterThanField";
+  private static final String OPERATOR_LESSTHANFIELD = "lessThanField";
+  private static final String OPERATOR_GREATEROREQUALFIELD = "greaterOrEqualField";
+  private static final String OPERATOR_LESSOREQUALFIEld = "lessOrEqualField";
+  private static final String OPERATOR_CONTAINSFIELD = "containsField";
+  private static final String OPERATOR_STARTSWITHFIELD = "startsWithField";
+  private static final String OPERATOR_ENDSWITHFIELD = "endsWithField";
+  private static final String OPERATOR_NOT = "not";
+  private static final String OPERATOR_BETWEEN = "between";
+  private static final String OPERATOR_BETWEENINCLUSIVE = "betweenInclusive";
+
+  private static final long serialVersionUID = 1L;
+
+  private JSONObject criteria = null;
+
+  private Map<String, String> filterParameters = new HashMap<String, String>();
+  private List<Object> typedParameters = new ArrayList<Object>();
+  private Entity entity;
+  private String mainAlias = null;
+  private int aliasIndex = 0;
+  private List<JoinDefinition> joinDefinitions = new ArrayList<JoinDefinition>();
+  private String orderBy;
+
+  private String orderByClause = null;
+  private String whereClause = null;
+  private String joinClause = null;
+
+  // keeps track if during parsing the criteria one or more or's are encountered.
+  private int orNesting = 0;
+
+  private SimpleDateFormat simpleDateFormat = JsonUtils.createDateFormat();
+
+  public Entity getEntity() {
+    return entity;
+  }
+
+  public void setEntity(String entityName) {
+    this.entity = ModelProvider.getInstance().getEntity(entityName);
+  }
+
+  public void setEntity(Entity entity) {
+    this.entity = entity;
+  }
+
+  /**
+   * Translates the filter criteria ({@link #addFilterParameter(String, String)}) to a valid HQL
+   * where clause (without the 'where' keyword). After calling this method the method
+   * {@link #getNamedParameters()} can be called. Note that currently only filtering on string and
+   * boolean properties is supported. Also filtering on the identifier of a referenced business
+   * object is supported.
+   * 
+   * @return a valid where clause or an empty string if not set.
+   */
+  public String getWhereClause() {
+
+    if (whereClause != null) {
+      return whereClause;
+    }
+
+    Check.isNotNull(entity, "Entity must be set");
+
+    // parse the criteria themselves
+    if (criteria.has("operator")) {
+      try {
+        whereClause = parseCriteria(criteria);
+      } catch (JSONException e) {
+        throw new OBException(e);
+      }
+    }
+    if (whereClause == null) {
+      whereClause = "";
+    }
+    whereClause = addWhereOrgParameters(whereClause);
+    whereClause = substituteParameters(whereClause);
+
+    if (whereClause.trim().length() > 0) {
+      whereClause = " where " + whereClause;
+    }
+
+    return whereClause;
+  }
+
+  private String addWhereOrgParameters(String where) {
+    String localWhereClause = where;
+    // add the organization parameter
+    if (filterParameters.containsKey(JsonConstants.ORG_PARAMETER)) {
+      final String value = filterParameters.get(JsonConstants.ORG_PARAMETER);
+      final StringBuilder orgPart = new StringBuilder();
+      if (entity.isOrganizationEnabled() && value != null && value.length() > 0) {
+        final Set<String> orgs = OBContext.getOBContext().getOrganizationStructureProvider()
+            .getNaturalTree(value);
+        if (orgs.size() > 0) {
+          if (getMainAlias() != null) {
+            orgPart.append(" " + getMainAlias() + ".organization in (");
+          } else {
+            orgPart.append(" organization in (");
+          }
+          boolean addComma = false;
+          for (String org : orgs) {
+            if (addComma) {
+              orgPart.append(",");
+            }
+            orgPart.append("'" + org + "'");
+            addComma = true;
+          }
+          orgPart.append(") ");
+        }
+      }
+      if (localWhereClause == null || localWhereClause.length() == 0) {
+        localWhereClause = orgPart.length() > 0 ? orgPart.toString() : "";
+      } else {
+        localWhereClause = "(" + localWhereClause + ")"
+            + (orgPart.length() > 0 ? " and " + orgPart.toString() : "");
+      }
+    }
+    // add the special whereParameter
+    final String whereParameter = filterParameters.get(JsonConstants.WHERE_PARAMETER);
+    if (whereParameter != null && !whereParameter.equals("null") && whereParameter.length() > 0) {
+      if (localWhereClause.length() > 0) {
+        localWhereClause = " (" + localWhereClause + ") and (" + whereParameter + ") ";
+      } else {
+        localWhereClause = " " + whereParameter;
+      }
+    }
+    return localWhereClause;
+  }
+
+  private String substituteParameters(String where) {
+
+    // add some default filter parameters which are substituted
+    filterParameters
+        .put(JsonConstants.QUERY_PARAM_USER, OBContext.getOBContext().getUser().getId());
+    if (!filterParameters.containsKey(JsonConstants.QUERY_PARAM_CLIENT)) {
+      filterParameters.put(JsonConstants.QUERY_PARAM_CLIENT, OBContext.getOBContext().getUser()
+          .getId());
+    }
+
+    String localWhereClause = where;
+    // handle special transactional range parameter
+    if (localWhereClause.contains(JsonConstants.QUERY_PARAM_TRANSACTIONAL_RANGE)) {
+      final String alias = getTypedParameterAlias();
+      String windowId = RequestContext.get().getRequestParameter("windowId");
+      if (windowId == null) {
+        windowId = "";
+      }
+      final String range = Utility.getTransactionalDate(new DalConnectionProvider(false),
+          RequestContext.get().getVariablesSecureApp(), windowId);
+      final int rangeNum = Integer.parseInt(range);
+      final Calendar cal = Calendar.getInstance();
+      cal.add(Calendar.DAY_OF_MONTH, -1 * rangeNum);
+      localWhereClause = localWhereClause.replace(JsonConstants.QUERY_PARAM_TRANSACTIONAL_RANGE,
+          alias);
+      typedParameters.add(cal.getTime());
+    }
+
+    if (localWhereClause.contains(JsonConstants.QUERY_PARAM_CLIENT)) {
+      final String alias = getTypedParameterAlias();
+      String clientId = (String) DalUtil.getId(OBContext.getOBContext().getCurrentClient());
+      localWhereClause = localWhereClause.replace(JsonConstants.QUERY_PARAM_CLIENT, alias);
+      typedParameters.add(clientId);
+    }
+    localWhereClause = setRequestParameters(localWhereClause);
+    return substituteContextParameters(localWhereClause);
+  }
+
+  private String parseCriteria(JSONObject jsonCriteria) throws JSONException {
+    // a constructor so the content is an advanced criteria
+    if (jsonCriteria.has("_constructor")) {
+      return parseAdvancedCriteria(jsonCriteria);
+    }
+    return parseSingleClause(jsonCriteria);
+  }
+
+  private String parseSingleClause(JSONObject jsonCriteria) throws JSONException {
+    String operator = jsonCriteria.getString("operator");
+
+    if (operator.equals(OPERATOR_BETWEEN)) {
+      return parseBetween(jsonCriteria, false);
+    }
+    if (operator.equals(OPERATOR_BETWEENINCLUSIVE)) {
+      return parseBetween(jsonCriteria, true);
+    }
+
+    String fieldName = jsonCriteria.getString("fieldName");
+    Object value = jsonCriteria.has("value") ? jsonCriteria.get("value") : null;
+
+    if (operator.equals(OPERATOR_ISNULL)) {
+      operator = OPERATOR_EQUALS;
+      value = null;
+    } else if (operator.equals(OPERATOR_NOTNULL)) {
+      operator = OPERATOR_NOTEQUAL;
+      value = null;
+    }
+
+    return parseSimpleClause(fieldName, operator, value);
+  }
+
+  private String parseBetween(JSONObject jsonCriteria, boolean inclusive) throws JSONException {
+    final String fieldName = jsonCriteria.getString("fieldName");
+    final Object start = jsonCriteria.get("start");
+    final Object end = jsonCriteria.get("end");
+    final String leftClause = parseSimpleClause(fieldName, inclusive ? OPERATOR_GREATEROREQUAL
+        : OPERATOR_GREATERTHAN, start);
+    final String rightClause = parseSimpleClause(fieldName, inclusive ? OPERATOR_LESSOREQUAL
+        : OPERATOR_LESSTHAN, end);
+    if (leftClause != null && rightClause != null) {
+      return "(" + leftClause + " and " + rightClause + ")";
+    }
+    return null;
+  }
+
+  private String parseSimpleClause(String fieldName, String operator, Object value)
+      throws JSONException {
+    final List<Property> properties = JsonUtils.getPropertiesOnPath(getEntity(), fieldName);
+    if (properties.isEmpty()) {
+      return null;
+    }
+    final Property property = properties.get(properties.size() - 1);
+    if (property == null) {
+      return null;
+    }
+
+    String leftClause = buildFieldClause(properties, property, fieldName, operator);
+    String hqlOperator = getHqlOperator(operator);
+    // special case
+    if (value != null && value.toString().contains(JsonConstants.IN_PARAMETER_SEPARATOR)) {
+      hqlOperator = "in";
+    }
+
+    String rightClause = buildRightClause(property, operator, value);
+
+    if (isNot(operator)) {
+      return "not(" + leftClause + " " + hqlOperator + " " + rightClause + ")";
+    } else {
+      return leftClause + " " + hqlOperator + " " + rightClause;
+    }
+  }
+
+  private String buildRightClause(Property property, String operator, Object value)
+      throws JSONException {
+    if (value == null) {
+      return null;
+    }
+    // the right side can be a field
+    if (operator.equals(OPERATOR_EQUALSFIELD) || operator.equals(OPERATOR_NOTEQUALFIELD)
+        || operator.equals(OPERATOR_GREATERTHANFIElD) || operator.equals(OPERATOR_LESSTHANFIELD)
+        || operator.equals(OPERATOR_GREATEROREQUALFIELD)
+        || operator.equals(OPERATOR_LESSOREQUALFIEld) || operator.equals(OPERATOR_CONTAINSFIELD)
+        || operator.equals(OPERATOR_STARTSWITHFIELD) || operator.equals(OPERATOR_ENDSWITHFIELD)) {
+      final List<Property> properties = JsonUtils
+          .getPropertiesOnPath(getEntity(), value.toString());
+      if (properties.isEmpty()) {
+        return null;
+      }
+      final Property fieldProperty = properties.get(properties.size() - 1);
+      if (property == null) {
+        return null;
+      }
+      return buildFieldClause(properties, fieldProperty, value.toString(), operator);
+    } else {
+      return buildValueClause(property, operator, value);
+    }
+  }
+
+  private String buildFieldClause(List<Property> properties, Property property, String fieldName,
+      String operator) {
+
+    String clause = null;
+    if (orNesting > 0) {
+      clause = resolveJoins(properties, fieldName);
+    } else if (getMainAlias() != null) {
+      clause = getMainAlias() + "." + fieldName.trim();
+    } else {
+      clause = fieldName;
+    }
+
+    // get rid of the identifier and replace it with the real property name
+    // or with the concatenation if there are multiple parts
+    // NOTE: the if and else check against the key variable and not the leftwherepart
+    // because the key contains the original string (with the _identifier part).
+    // Within the if the leftWherePart is used because it contains the join aliases
+    if (fieldName.equals(JsonConstants.IDENTIFIER)
+        || fieldName.endsWith("." + JsonConstants.IDENTIFIER)) {
+      clause = computeLeftWhereClauseForIdentifier(property, fieldName, clause);
+    }
+
+    if (!property.isPrimitive()) {
+      clause = clause + ".id";
+    }
+
+    if (ignoreCase(operator)) {
+      clause = "upper(" + clause + ")";
+    }
+    return clause;
+  }
+
+  private String buildValueClause(Property property, String operator, Object value)
+      throws JSONException {
+    Object localValue = value;
+
+    // if the value consists of multiple parts then filtering won't work
+    // only search on the first part then, is pragmatic but very workable
+    if (localValue != null && localValue.toString().contains(IdentifierProvider.SEPARATOR)) {
+      final int separatorIndex = localValue.toString().indexOf(IdentifierProvider.SEPARATOR);
+      localValue = localValue.toString().substring(0, separatorIndex);
+    }
+
+    if (ignoreCase(operator)) {
+      localValue = localValue.toString().toUpperCase();
+    }
+
+    final String alias = getTypedParameterAlias();
+    String clause;
+    if (isLike(operator)) {
+      clause = alias + " escape '" + ESCAPE_CHAR + "' ";
+    } else {
+      clause = alias;
+    }
+
+    if (!property.isPrimitive()) {
+      // an in parameter use it...
+      if (localValue.toString().contains(JsonConstants.IN_PARAMETER_SEPARATOR)) {
+        final List<String> values = new ArrayList<String>();
+        final String[] separatedValues = localValue.toString().split(
+            JsonConstants.IN_PARAMETER_SEPARATOR);
+        for (String separatedValue : separatedValues) {
+          values.add(separatedValue);
+        }
+        clause = "(" + clause + ")";
+        localValue = values;
+      }
+    }
+
+    try {
+      localValue = getTypeSafeValue(operator, property, localValue);
+    } catch (IllegalArgumentException e) {
+      // ignore errors in formatting etc to be robust
+      return null;
+    }
+    typedParameters.add(localValue);
+    return clause;
+  }
+
+  private Object getTypeSafeValue(String operator, Property property, Object value)
+      throws JSONException {
+    if (value == null) {
+      return value;
+    }
+    // a FK
+    if (!property.isPrimitive()) {
+      return value;
+    }
+    if (isLike(operator)) {
+      if (operator.equals(OPERATOR_CONTAINS) || operator.equals(OPERATOR_ICONTAINS)
+          || operator.equals(OPERATOR_CONTAINSFIELD)) {
+        return "%" + escapeLike(value.toString().toUpperCase()).replaceAll(" ", "%") + "%";
+      } else if (operator.equals(OPERATOR_STARTSWITH) || operator.equals(OPERATOR_ISTARTSWITH)
+          || operator.equals(OPERATOR_STARTSWITHFIELD)) {
+        return escapeLike(value.toString().toUpperCase()).replaceAll(" ", "%") + "%";
+      } else {
+        return "%" + escapeLike(value.toString());
+      }
+    }
+
+    if (operator.equals(OPERATOR_INSET) || operator.equals(OPERATOR_NOTINSET)) {
+      final List<Object> typedValues = new ArrayList<Object>();
+      final JSONArray values = (JSONArray) value;
+      for (int i = 0; i < values.length(); i++) {
+        typedValues.add(getTypeSafeValue(OPERATOR_EQUALS, property, values.get(i)));
+      }
+      return typedValues;
+    }
+
+    if (Boolean.class == property.getPrimitiveObjectType()) {
+      return new Boolean(value.toString());
+    } else if (property.isNumericType()) {
+      try {
+        final BigDecimal bdValue = new BigDecimal(value.toString());
+        if (Long.class == property.getPrimitiveObjectType()) {
+          return bdValue.longValue();
+        } else if (Integer.class == property.getPrimitiveObjectType()) {
+          return bdValue.intValue();
+        } else {
+          return bdValue;
+        }
+      } catch (NumberFormatException e) {
+        throw new IllegalArgumentException(e);
+      }
+    } else if (Date.class.isAssignableFrom(property.getPrimitiveObjectType())) {
+      try {
+        return simpleDateFormat.parse(value.toString());
+      } catch (Exception e) {
+        throw new IllegalArgumentException(e);
+      }
+    }
+    return value;
+  }
+
+  private String computeLeftWhereClauseForIdentifier(Property property, String key,
+      String leftWherePart) {
+
+    // the identifierProperties are read from the owning entity of the
+    // property, that should work fine, as this last property is always part of the
+    // identifier
+    final List<Property> identifierProperties = property.getEntity().getIdentifierProperties();
+    Check.isTrue(identifierProperties.contains(property), "Property " + property
+        + " not part of identifier of " + property.getEntity());
+    final String prefix;
+    final int index = leftWherePart.lastIndexOf(".");
+    if (key.equals(JsonConstants.IDENTIFIER)) {
+      prefix = getMainAlias() + ".";
+    } else if (index == -1) {
+      prefix = "";
+    } else {
+      // the + 1 makes sure that the dot is included
+      prefix = leftWherePart.substring(0, index + 1);
+    }
+    return createIdentifierLeftClause(identifierProperties, prefix);
+  }
+
+  private String parseAdvancedCriteria(JSONObject advancedCriteria) throws JSONException {
+    final String operator = advancedCriteria.getString("operator");
+    if (operator.equals(OPERATOR_NOT)) {
+      final String clause = parseStructuredClause(advancedCriteria.getJSONArray("criteria"), "or");
+      if (clause != null) {
+        return " not(" + clause + ")";
+      }
+      return null;
+    }
+    if (operator.equals(OPERATOR_AND)) {
+      return parseStructuredClause(advancedCriteria.getJSONArray("criteria"), "and");
+    }
+    if (operator.equals(OPERATOR_OR)) {
+      orNesting++;
+      final String value = parseStructuredClause(advancedCriteria.getJSONArray("criteria"), "or");
+      orNesting--;
+      return value;
+    }
+    throw new IllegalArgumentException("Unsupported operation " + operator);
+  }
+
+  private String parseStructuredClause(JSONArray clauses, String hqlOperator) throws JSONException {
+    final StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < clauses.length(); i++) {
+      final JSONObject clause = clauses.getJSONObject(i);
+      final String clauseString = parseCriteria(clause);
+      if (clauseString != null) {
+        if (sb.length() > 0) {
+          sb.append(" " + hqlOperator + " ");
+        }
+        sb.append(" " + clauseString + " ");
+      }
+    }
+    if (sb.length() > 0) {
+      return "(" + sb.toString() + ")";
+    }
+    return null;
+  }
+
+  private boolean isLike(String operator) {
+    return operator.equals(OPERATOR_ICONTAINS) || operator.equals(OPERATOR_IENDSWITH)
+        || operator.equals(OPERATOR_ISTARTSWITH) || operator.equals(OPERATOR_CONTAINS)
+        || operator.equals(OPERATOR_ENDSWITH) || operator.equals(OPERATOR_STARTSWITH)
+        || operator.equals(OPERATOR_CONTAINSFIELD) || operator.equals(OPERATOR_ENDSWITHFIELD)
+        || operator.equals(OPERATOR_STARTSWITHFIELD);
+  }
+
+  private boolean ignoreCase(String operator) {
+    return operator.equals(OPERATOR_IEQUALS) || operator.equals(OPERATOR_INOTEQUAL)
+        || operator.equals(OPERATOR_ICONTAINS) || operator.equals(OPERATOR_IENDSWITH)
+        || operator.equals(OPERATOR_ISTARTSWITH);
+  }
+
+  private boolean isNot(String operator) {
+    return operator.equals(OPERATOR_NOTCONTAINS) || operator.equals(OPERATOR_NOTENDSWITH)
+        || operator.equals(OPERATOR_NOTSTARTSWITH) || operator.equals(OPERATOR_INOTCONTAINS)
+        || operator.equals(OPERATOR_INOTENDSWITH) || operator.equals(OPERATOR_INOTSTARTSWITH)
+        || operator.equals(OPERATOR_NOT) || operator.equals(OPERATOR_NOTINSET);
+  }
+
+  private String getHqlOperator(String operator) {
+    if (operator.equals(OPERATOR_EQUALS)) {
+      return "=";
+    } else if (operator.equals(OPERATOR_NOTEQUAL)) {
+      return "!=";
+    } else if (operator.equals(OPERATOR_IEQUALS)) {
+      return "=";
+    } else if (operator.equals(OPERATOR_INOTEQUAL)) {
+      return "!=";
+    } else if (operator.equals(OPERATOR_GREATERTHAN)) {
+      return ">";
+    } else if (operator.equals(OPERATOR_LESSTHAN)) {
+      return "<";
+    } else if (operator.equals(OPERATOR_GREATEROREQUAL)) {
+      return ">=";
+    } else if (operator.equals(OPERATOR_LESSOREQUAL)) {
+      return "<=";
+    } else if (operator.equals(OPERATOR_CONTAINS)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_STARTSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_ENDSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_ICONTAINS)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_ISTARTSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_IENDSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_NOTCONTAINS)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_NOTSTARTSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_NOTENDSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_INOTCONTAINS)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_INOTSTARTSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_INOTENDSWITH)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_EQUALSFIELD)) {
+      return "=";
+    } else if (operator.equals(OPERATOR_NOTEQUALFIELD)) {
+      return "!=";
+    } else if (operator.equals(OPERATOR_GREATERTHANFIElD)) {
+      return ">";
+    } else if (operator.equals(OPERATOR_LESSTHANFIELD)) {
+      return "<";
+    } else if (operator.equals(OPERATOR_GREATEROREQUALFIELD)) {
+      return ">=";
+    } else if (operator.equals(OPERATOR_LESSOREQUALFIEld)) {
+      return "<=";
+    } else if (operator.equals(OPERATOR_CONTAINSFIELD)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_STARTSWITHFIELD)) {
+      return "like";
+    } else if (operator.equals(OPERATOR_ENDSWITHFIELD)) {
+      return "like";
+    }
+    // todo throw exception
+    return null;
+  }
+
+  private String substituteContextParameters(String currentWhereClause) {
+    // This method will check for any remaining @param@s
+    // If there are still some in the whereclause, they will be resolved by calling the getContext()
+    // method
+    if (!currentWhereClause.contains("@")) {
+      return currentWhereClause;
+    }
+    String localWhereClause = currentWhereClause;
+    while (localWhereClause.contains("@")) {
+      int firstAtIndex = localWhereClause.indexOf("@");
+      String prefix = localWhereClause.substring(0, firstAtIndex);
+      String restOfClause = localWhereClause.substring(firstAtIndex + 1);
+      int secondAtIndex = restOfClause.indexOf("@");
+      if (secondAtIndex == -1) {
+        // No second @. We return the clause as it is
+        return localWhereClause;
+      }
+      String suffix = restOfClause.substring(secondAtIndex + 1);
+      String param = restOfClause.substring(0, secondAtIndex);
+      String paramValue = Utility.getContext(new DalConnectionProvider(false), RequestContext.get()
+          .getVariablesSecureApp(), param, RequestContext.get().getRequestParameter("windowId"));
+      localWhereClause = prefix + getTypedParameterAlias() + suffix;
+      typedParameters.add(paramValue);
+    }
+    return localWhereClause;
+  }
+
+  private String setRequestParameters(String currentWhereClause) {
+    // no parameters
+    if (!currentWhereClause.contains(PARAM_DELIMITER)) {
+      return currentWhereClause;
+    }
+    String localWhereClause = currentWhereClause;
+    for (String key : filterParameters.keySet()) {
+      if (!key.startsWith(PARAM_DELIMITER) || !key.endsWith(PARAM_DELIMITER)) {
+        continue;
+      }
+      final int index = localWhereClause.toLowerCase().indexOf(key.toLowerCase());
+      if (index != -1) {
+        localWhereClause = localWhereClause.substring(0, index) + getTypedParameterAlias() + " "
+            + localWhereClause.substring(index + key.length());
+        typedParameters.add(filterParameters.get(key));
+      }
+    }
+
+    return localWhereClause;
+  }
+
+  private String getTypedParameterAlias() {
+    return ":" + ALIAS_PREFIX + typedParameters.size();
+  }
+
+  /**
+   * @return an empty String if there is no join clause, in other cases a String like the following
+   *         is returned " as e left join e.bank as alias_1"
+   */
+  public String getJoinClause() {
+    if (joinClause != null) {
+      return joinClause;
+    }
+
+    // make sure that the join clauses are computed
+    getWhereClause();
+    getOrderByClause();
+
+    if (getMainAlias() == null) {
+      return "";
+    }
+    final StringBuilder sb = new StringBuilder();
+    sb.append(" as " + getMainAlias() + " ");
+    for (JoinDefinition joinDefinition : joinDefinitions) {
+      sb.append(joinDefinition.getJoinStatement());
+    }
+    sb.append(" ");
+    joinClause = sb.toString();
+    return joinClause;
+  }
+
+  /**
+   * Converts the value of the sortBy member into a valid order by clause in a HQL query. The method
+   * handles special cases as sorting by the identifier properties and descending which is
+   * controlled with a minus sign before the property name.
+   * 
+   * @return a valid order by clause (or an empty string if no sorting)
+   */
+  protected String getOrderByClause() {
+    if (orderByClause != null) {
+      return orderByClause;
+    }
+    if (orderBy == null || orderBy.trim().length() == 0) {
+      orderByClause = "";
+      return orderByClause;
+    }
+    final StringBuilder sb = new StringBuilder(" order by ");
+    boolean firstElement = true;
+    for (String localOrderBy : orderBy.split(",")) {
+      if (!firstElement) {
+        sb.append(",");
+      }
+      sb.append(getOrderByClausePart(localOrderBy.trim()));
+      firstElement = false;
+    }
+    orderByClause = sb.toString();
+    return orderByClause;
+  }
+
+  protected String getOrderByClausePart(String orderByParam) {
+    String localOrderBy = orderByParam;
+    final boolean asc = !localOrderBy.startsWith("-");
+    String direction = "";
+    if (!asc) {
+      localOrderBy = localOrderBy.substring(1);
+      direction = " desc ";
+    }
+
+    final List<String> paths = new ArrayList<String>();
+
+    // handle the following case:
+    // table.window.identifier as the sort string
+    boolean isIdenfitier = localOrderBy.equals(JsonConstants.IDENTIFIER)
+        || localOrderBy.endsWith("." + JsonConstants.IDENTIFIER);
+    if (isIdenfitier) {
+      Entity searchEntity = getEntity();
+      // a path to an entity, find the last entity
+      final String prefix;
+      if (!localOrderBy.equals(JsonConstants.IDENTIFIER)) {
+        // be lazy get the last property, it belongs to the last entity
+        final Property prop = DalUtil.getPropertyFromPath(searchEntity, localOrderBy);
+        Check.isNotNull(prop, "Property path " + localOrderBy + " is not valid for entity "
+            + searchEntity);
+        searchEntity = prop.getEntity();
+        prefix = localOrderBy.substring(0, localOrderBy.lastIndexOf(".") + 1);
+      } else {
+        prefix = "";
+      }
+      for (Property prop : searchEntity.getIdentifierProperties()) {
+        if (prop.isOneToMany()) {
+          // not supported ignoring it
+          continue;
+        }
+        if (!prop.isPrimitive()) {
+          // get identifier properties from target entity
+          // TODO: currently only supports one level, recursive
+          // calls have the danger of infinite loops in case of
+          // wrong identifier definitions in the AD
+          final Entity targetEntity = prop.getTargetEntity();
+          for (Property targetEntityProperty : targetEntity.getIdentifierProperties()) {
+            paths.add(prefix + prop.getName() + "." + targetEntityProperty.getName());
+          }
+        } else {
+          paths.add(prefix + prop.getName());
+        }
+      }
+    } else {
+      paths.add(localOrderBy);
+    }
+
+    final StringBuilder sb = new StringBuilder();
+    boolean addComma = false;
+    for (String path : paths) {
+      if (addComma) {
+        sb.append(", ");
+      }
+      addComma = true;
+      final String resolvedPath = resolveJoins(JsonUtils.getPropertiesOnPath(getEntity(), path),
+          path);
+      sb.append(resolvedPath);
+      sb.append(direction);
+    }
+    return sb.toString();
+  }
+
+  // Creates a Hibernate concatenation if there are multiple identifierproperties
+  // note prefix includes the dot at the end
+  private String createIdentifierLeftClause(List<Property> identifierProperties, String prefix) {
+    final StringBuilder sb = new StringBuilder();
+    for (Property prop : identifierProperties) {
+      if (sb.length() > 0) {
+        sb.append(" || '" + IdentifierProvider.SEPARATOR + "' || ");
+      }
+      // note to_char is added to handle null values correctly
+      if (prop.getReferencedProperty() == null) {
+        sb.append("COALESCE(to_char(" + prefix + prop.getName() + "),'')");
+      } else {
+        final List<Property> newIdentifierProperties = prop.getReferencedProperty().getEntity()
+            .getIdentifierProperties();
+        sb
+            .append(createIdentifierLeftClause(newIdentifierProperties, prefix + prop.getName()
+                + "."));
+      }
+    }
+
+    return "(" + sb.toString() + ")";
+  }
+
+  /**
+   * @return true if one of the filter parameters is the {@link JsonConstants#ORG_PARAMETER}.
+   */
+  public boolean hasOrganizationParameter() {
+    final String value = filterParameters.get(JsonConstants.ORG_PARAMETER);
+    return value != null && value.trim().length() > 0;
+  }
+
+  /**
+   * Add a filter parameter, the method {@link #getWhereClause()} will try to convert the String
+   * value to a typed parameter.
+   * 
+   * @param key
+   *          the filter key, can be direct property or a referenced property.
+   * @param value
+   *          the value as a String
+   */
+  public void addFilterParameter(String key, String value) {
+    // ignore these
+    if (value == null) {
+      return;
+    }
+    whereClause = null;
+    typedParameters.clear();
+    filterParameters.put(key, value);
+  }
+
+  public Map<String, Object> getNamedParameters() {
+    final Map<String, Object> parameters = new HashMap<String, Object>();
+    for (int i = 0; i < typedParameters.size(); i++) {
+      parameters.put(ALIAS_PREFIX + Integer.toString(i), typedParameters.get(i));
+    }
+    return parameters;
+  }
+
+  public void setDoOr(boolean doOr) {
+    if (doOr) {
+      orNesting++;
+    }
+    // in case of join always do outer joining
+    setMainAlias(JsonConstants.MAIN_ALIAS);
+  }
+
+  // Resolves the list of properties against existing join definitions
+  // creates new join definitions when necessary
+  private String resolveJoins(List<Property> props, String originalPath) {
+    String alias = getMainAlias();
+    if (alias == null) {
+      return originalPath;
+    }
+    int index = 0;
+    int joinedPropertyIndex = -1;
+    for (Property prop : props) {
+      boolean found = false;
+      for (JoinDefinition joinDefinition : joinDefinitions) {
+        if (joinDefinition.appliesTo(alias, prop)) {
+          alias = joinDefinition.getJoinAlias();
+          joinedPropertyIndex = index;
+          found = true;
+          break;
+        }
+      }
+      if (!found) {
+        // no more joins, leave
+        break;
+      }
+      index++;
+    }
+    // check if any new JoinDefinitions should be created
+    for (int i = (joinedPropertyIndex + 1); i < props.size(); i++) {
+      final Property prop = props.get(i);
+      if (prop.isPrimitive()) {
+        break;
+      }
+      // a joinable property
+      final JoinDefinition joinDefinition = new JoinDefinition();
+      joinDefinition.setOwnerAlias(alias);
+      joinDefinition.setJoinAlias(getNewUniqueAlias());
+      joinDefinition.setProperty(prop);
+      joinDefinitions.add(joinDefinition);
+
+      // move the result up to use the new JoinDefinition
+      alias = joinDefinition.getJoinAlias();
+      joinedPropertyIndex = i;
+    }
+    if (joinedPropertyIndex == (props.size() - 1)) {
+      return alias;
+    }
+    return alias + "." + props.get(props.size() - 1).getName();
+  }
+
+  private String getNewUniqueAlias() {
+    return ALIAS_PREFIX + (aliasIndex++);
+  }
+
+  private class JoinDefinition {
+    private Property property;
+    private String joinAlias;
+    private String ownerAlias;
+
+    public boolean appliesTo(String checkAlias, Property checkProperty) {
+      return checkAlias.equals(ownerAlias) && checkProperty == property;
+    }
+
+    public String getJoinStatement() {
+      return " left outer join " + ownerAlias + "." + property.getName() + " as " + joinAlias;
+    }
+
+    public void setProperty(Property property) {
+      this.property = property;
+    }
+
+    public String getJoinAlias() {
+      return joinAlias;
+    }
+
+    public void setJoinAlias(String joinAlias) {
+      this.joinAlias = joinAlias;
+    }
+
+    public void setOwnerAlias(String ownerAlias) {
+      this.ownerAlias = ownerAlias;
+    }
+  }
+
+  public String getMainAlias() {
+    return mainAlias;
+  }
+
+  public void setMainAlias(String mainAlias) {
+    this.mainAlias = mainAlias;
+  }
+
+  public String getOrderBy() {
+    return orderBy;
+  }
+
+  public void setOrderBy(String orderBy) {
+    this.orderBy = orderBy;
+    // do outer joining if the order by has more than 1 dot
+    if (orderBy.indexOf(".") != -1 && orderBy.indexOf(".") != orderBy.lastIndexOf(".")) {
+      setMainAlias(JsonConstants.MAIN_ALIAS);
+    }
+  }
+
+  private String escapeLike(String value) {
+    if (value == null || value.trim().length() == 0) {
+      return value;
+    }
+    String localValue = value.replace(ESCAPE_CHAR + "", ESCAPE_CHAR + ESCAPE_CHAR + "");
+    localValue = localValue.replace("_", ESCAPE_CHAR + "_");
+    localValue = localValue.replace("%", ESCAPE_CHAR + "%");
+    return localValue;
+  }
+
+  public JSONObject getCriteria() {
+    return criteria;
+  }
+
+  public void setCriteria(JSONObject criteria) {
+    this.criteria = criteria;
+  }
+}
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DataEntityQueryService.java	Tue Mar 08 16:19:56 2011 +0100
@@ -21,12 +21,17 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.Query;
+import org.hibernate.ScrollMode;
+import org.hibernate.ScrollableResults;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.structure.BaseOBObject;
 import org.openbravo.base.util.Check;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.dal.service.OBQuery;
-import org.openbravo.service.json.QueryBuilder.TextMatching;
 
 /**
  * Implements a service which can handle different types of query and paging options. This class
@@ -51,7 +56,7 @@
   private Integer maxResults = null;
 
   private boolean filterOnActive = true;
-  private QueryBuilder queryBuilder = new QueryBuilder();
+  private AdvancedQueryBuilder queryBuilder = new AdvancedQueryBuilder();
 
   /**
    * Count the records which fit in the filter criteria.
@@ -81,6 +86,20 @@
    * @return the list of retrieved objects from the db.
    */
   public List<BaseOBObject> list() {
+    return buildOBQuery().list();
+  }
+
+  /**
+   * @return a result which can be scrolled forward only and the results are not cached
+   */
+  public ScrollableResults scroll() {
+    final Query qry = buildOBQuery().createQuery();
+    qry.setFetchSize(1000);
+    qry.setCacheable(false);
+    return qry.scroll(ScrollMode.FORWARD_ONLY);
+  }
+
+  private OBQuery<BaseOBObject> buildOBQuery() {
     final String whereOrderBy = queryBuilder.getJoinClause() + queryBuilder.getWhereClause()
         + queryBuilder.getOrderByClause();
 
@@ -105,7 +124,7 @@
 
     obq.setNamedParameters(queryBuilder.getNamedParameters());
 
-    return obq.list();
+    return obq;
   }
 
   public int getRowNumber(String targetRecordId) {
@@ -165,16 +184,18 @@
    *          the following values are allowed: startsWith, substring, exact
    */
   public void setTextMatching(String textMatchingName) {
-    if (textMatchingName == null) {
-      return;
+  }
+
+  public void setCriteria(JSONObject criteria) {
+    try {
+      queryBuilder.setCriteria(criteria);
+      if (criteria.has("operator")
+          && AdvancedQueryBuilder.OPERATOR_OR.equals(criteria.getString("operator"))) {
+        setDoOrExpression();
+      }
+    } catch (JSONException e) {
+      throw new OBException(e);
     }
-    for (TextMatching textMatching : TextMatching.values()) {
-      if (textMatching.name().equalsIgnoreCase(textMatchingName)) {
-        queryBuilder.setTextMatching(textMatching);
-        return;
-      }
-    }
-    throw new UnsupportedOperationException("Text matching " + textMatchingName + " not supported ");
   }
 
   public void addFilterParameter(String key, String value) {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Tue Mar 08 16:19:56 2011 +0100
@@ -27,6 +27,7 @@
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.ScrollableResults;
 import org.openbravo.base.exception.OBException;
 import org.openbravo.base.provider.OBProvider;
 import org.openbravo.base.structure.BaseOBObject;
@@ -88,54 +89,23 @@
         final String startRowStr = parameters.get(JsonConstants.STARTROW_PARAMETER);
         final String endRowStr = parameters.get(JsonConstants.ENDROW_PARAMETER);
 
-        final DataEntityQueryService queryService = OBProvider.getInstance().get(
-            DataEntityQueryService.class);
-        queryService.setEntityName(entityName);
-
-        if (parameters.containsKey(JsonConstants.USE_ALIAS)) {
-          queryService.setUseAlias();
-        }
-        // set the filter parameters
-        for (String key : parameters.keySet()) {
-          if (!key.startsWith("_")) {
-            queryService.addFilterParameter(key, parameters.get(key));
-          } else if (key.equals(JsonConstants.WHERE_PARAMETER)
-              || key.equals(JsonConstants.IDENTIFIER) || key.equals(JsonConstants.ORG_PARAMETER)) {
-            // the _where is used in a special way
-            queryService.addFilterParameter(key, parameters.get(key));
-          }
-        }
-
-        if (parameters.get(JsonConstants.OR_EXPRESSION_PARAMETER) != null) {
-          queryService.setDoOrExpression();
-        }
-        if (parameters.get(JsonConstants.NO_ACTIVE_FILTER) != null
-            && parameters.get(JsonConstants.NO_ACTIVE_FILTER).equals("true")) {
-          queryService.setFilterOnActive(false);
-        }
-
-        if (parameters.containsKey(JsonConstants.TEXTMATCH_PARAMETER_OVERRIDE)) {
-          queryService.setTextMatching(parameters.get(JsonConstants.TEXTMATCH_PARAMETER_OVERRIDE));
-        } else {
-          queryService.setTextMatching(parameters.get(JsonConstants.TEXTMATCH_PARAMETER));
-        }
-
         boolean preventCountOperation = !parameters.containsKey(JsonConstants.NOCOUNT_PARAMETER)
             || "true".equals(parameters.get(JsonConstants.NOCOUNT_PARAMETER));
 
-        // only do the count if a paging request is done
-        // note preventCountOperation variable is considered further below
+        final DataEntityQueryService queryService = createSetQueryService(parameters);
+
+        queryService.setEntityName(entityName);
+
+        // only do the count if a paging request is done and it has not been prevented
+        // explicitly
         boolean doCount = false;
         int count = -1;
         int startRow = 0;
         int computedMaxResults = Integer.MAX_VALUE;
         if (startRowStr != null) {
-          startRow = Integer.parseInt(startRowStr);
-          queryService.setFirstResult(startRow);
           doCount = true;
         }
-
-        if (endRowStr != null && endRowStr != null) {
+        if (endRowStr != null) {
           int endRow = Integer.parseInt(endRowStr);
           computedMaxResults = endRow - startRow + 1;
           // note computedmaxresults must be set before
@@ -146,36 +116,11 @@
             // set count here, is corrected in specific cases later
             count = endRow;
           }
-          queryService.setMaxResults(computedMaxResults);
-          doCount = true;
         } else {
-          // can't do this if there is no endrow...
+          // can't do count if there is no endrow...
           preventCountOperation = false;
         }
 
-        final String sortBy = parameters.get(JsonConstants.SORTBY_PARAMETER);
-        if (sortBy != null) {
-          queryService.setOrderBy(sortBy);
-        } else if (parameters.get(JsonConstants.ORDERBY_PARAMETER) != null) {
-          queryService.setOrderBy(parameters.get(JsonConstants.ORDERBY_PARAMETER));
-        }
-
-        // compute a new startrow if the targetrecordid was passed in
-        int targetRowNumber = -1;
-        if (parameters.containsKey(JsonConstants.TARGETRECORDID_PARAMETER)) {
-          final String targetRecordId = parameters.get(JsonConstants.TARGETRECORDID_PARAMETER);
-          targetRowNumber = queryService.getRowNumber(targetRecordId);
-          if (targetRowNumber != -1) {
-            startRow = targetRowNumber;
-            // if the startrow is really low, then just read from 0
-            // to make sure that we have a full page of data to display
-            if (startRow < (computedMaxResults / 2)) {
-              startRow = 0;
-            }
-            queryService.setFirstResult(startRow);
-          }
-        }
-
         if (doCount && !preventCountOperation) {
           count = queryService.count();
         }
@@ -220,9 +165,6 @@
       jsonResponse.put(JsonConstants.RESPONSE_STATUS, JsonConstants.RPCREQUEST_STATUS_SUCCESS);
       jsonResult.put(JsonConstants.RESPONSE_RESPONSE, jsonResponse);
 
-      // if (jsonObjects.size() > 0) {
-      // System.err.println(jsonObjects.get(0));
-      // }
       return jsonResult.toString();
 
     } catch (Throwable t) {
@@ -231,6 +173,132 @@
     }
   }
 
+  public void fetch(Map<String, String> parameters, QueryResultWriter writer) {
+    final String entityName = parameters.get(JsonConstants.ENTITYNAME);
+    final DataEntityQueryService queryService = createSetQueryService(parameters);
+    queryService.setEntityName(entityName);
+
+    final DataToJsonConverter toJsonConverter = OBProvider.getInstance().get(
+        DataToJsonConverter.class);
+    toJsonConverter.setAdditionalProperties(JsonUtils.getAdditionalProperties(parameters));
+
+    final ScrollableResults scrollableResults = queryService.scroll();
+    while (scrollableResults.next()) {
+      final Object result = scrollableResults.get()[0];
+      final JSONObject json = toJsonConverter.toJsonObject((BaseOBObject) result,
+          DataResolvingMode.FULL);
+      writer.write(json);
+      OBDal.getInstance().getSession().evict(result);
+    }
+  }
+
+  private DataEntityQueryService createSetQueryService(Map<String, String> parameters) {
+    final String entityName = parameters.get(JsonConstants.ENTITYNAME);
+    final String startRowStr = parameters.get(JsonConstants.STARTROW_PARAMETER);
+    final String endRowStr = parameters.get(JsonConstants.ENDROW_PARAMETER);
+
+    final DataEntityQueryService queryService = OBProvider.getInstance().get(
+        DataEntityQueryService.class);
+    queryService.setEntityName(entityName);
+
+    if (parameters.containsKey(JsonConstants.USE_ALIAS)) {
+      queryService.setUseAlias();
+    }
+    // set the where/org filter parameters
+    for (String key : parameters.keySet()) {
+      if (key.equals(JsonConstants.WHERE_PARAMETER) || key.equals(JsonConstants.IDENTIFIER)
+          || key.equals(JsonConstants.ORG_PARAMETER)) {
+        queryService.addFilterParameter(key, parameters.get(key));
+      }
+    }
+    queryService.setCriteria(buildCriteria(parameters, queryService));
+
+    if (parameters.get(JsonConstants.NO_ACTIVE_FILTER) != null
+        && parameters.get(JsonConstants.NO_ACTIVE_FILTER).equals("true")) {
+      queryService.setFilterOnActive(false);
+    }
+
+    if (parameters.containsKey(JsonConstants.TEXTMATCH_PARAMETER_OVERRIDE)) {
+      queryService.setTextMatching(parameters.get(JsonConstants.TEXTMATCH_PARAMETER_OVERRIDE));
+    } else {
+      queryService.setTextMatching(parameters.get(JsonConstants.TEXTMATCH_PARAMETER));
+    }
+
+    // only do the count if a paging request is done
+    // note preventCountOperation variable is considered further below
+    int startRow = 0;
+    int computedMaxResults = Integer.MAX_VALUE;
+    if (startRowStr != null) {
+      startRow = Integer.parseInt(startRowStr);
+      queryService.setFirstResult(startRow);
+    }
+
+    if (endRowStr != null) {
+      int endRow = Integer.parseInt(endRowStr);
+      computedMaxResults = endRow - startRow + 1;
+      queryService.setMaxResults(computedMaxResults);
+    }
+
+    final String sortBy = parameters.get(JsonConstants.SORTBY_PARAMETER);
+    if (sortBy != null) {
+      queryService.setOrderBy(sortBy);
+    } else if (parameters.get(JsonConstants.ORDERBY_PARAMETER) != null) {
+      queryService.setOrderBy(parameters.get(JsonConstants.ORDERBY_PARAMETER));
+    }
+
+    // compute a new startrow if the targetrecordid was passed in
+    int targetRowNumber = -1;
+    if (parameters.containsKey(JsonConstants.TARGETRECORDID_PARAMETER)) {
+      final String targetRecordId = parameters.get(JsonConstants.TARGETRECORDID_PARAMETER);
+      targetRowNumber = queryService.getRowNumber(targetRecordId);
+      if (targetRowNumber != -1) {
+        startRow = targetRowNumber;
+        // if the startrow is really low, then just read from 0
+        // to make sure that we have a full page of data to display
+        if (startRow < (computedMaxResults / 2)) {
+          startRow = 0;
+        }
+        queryService.setFirstResult(startRow);
+      }
+    }
+    return queryService;
+  }
+
+  private JSONObject buildCriteria(Map<String, String> parameters,
+      DataEntityQueryService queryService) {
+    try {
+      final JSONObject criteria = new JSONObject();
+
+      if (parameters.get(JsonConstants.OR_EXPRESSION_PARAMETER) != null) {
+        criteria.put("operator", "or");
+      } else {
+        criteria.put("operator", "and");
+      }
+      criteria.put("_constructor", "AdvancedCriteria");
+
+      final List<JSONObject> criteriaObjects = new ArrayList<JSONObject>();
+      if (parameters.containsKey("criteria")) {
+        final String[] criteriaStrs = parameters.get("criteria").split(
+            JsonConstants.IN_PARAMETER_SEPARATOR);
+        for (String criteriaStr : criteriaStrs) {
+          final JSONObject criteriaJSONObject = new JSONObject(criteriaStr);
+          if (criteriaJSONObject.has("fieldName")) {
+            final String fieldName = criteriaJSONObject.getString("fieldName");
+            if (!fieldName.startsWith("_")) {
+              criteriaObjects.add(criteriaJSONObject);
+            }
+          } else {
+            criteriaObjects.add(criteriaJSONObject);
+          }
+        }
+      }
+      criteria.put("criteria", new JSONArray(criteriaObjects));
+      return criteria;
+    } catch (JSONException e) {
+      throw new OBException(e);
+    }
+  }
+
   private void addWritableAttribute(List<JSONObject> jsonObjects) throws JSONException {
     for (JSONObject jsonObject : jsonObjects) {
       if (!jsonObject.has("client") || !jsonObject.has("organization")) {
@@ -424,4 +492,8 @@
     }
     return jsonRepresentation;
   }
+
+  public static abstract class QueryResultWriter {
+    public abstract void write(JSONObject json);
+  }
 }
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/CustomQuerySelectorDatasource.java	Tue Mar 08 16:19:56 2011 +0100
@@ -31,6 +31,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.hibernate.Query;
+import org.hibernate.criterion.Expression;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.domaintype.BigDecimalDomainType;
 import org.openbravo.base.model.domaintype.BooleanDomainType;
@@ -40,7 +41,9 @@
 import org.openbravo.client.application.ParameterUtils;
 import org.openbravo.client.kernel.RequestContext;
 import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBDao;
 import org.openbravo.service.datasource.ReadOnlyDataSourceService;
 import org.openbravo.service.json.JsonConstants;
 import org.openbravo.service.json.JsonUtils;
@@ -75,7 +78,8 @@
     try {
 
       Selector sel = OBDal.getInstance().get(Selector.class, selectorId);
-      List<SelectorField> fields = sel.getOBUISELSelectorFieldList();
+      List<SelectorField> fields = OBDao.getActiveOBObjectList(sel,
+          Selector.PROPERTY_OBUISELSELECTORFIELDLIST);
 
       // Parse the HQL in case that optional filters are required
       String HQL = parseOptionalFilters(parameters, sel, xmlDateFormat);
@@ -171,7 +175,9 @@
 
     StringBuffer defaultExpressionsFilter = new StringBuffer();
     boolean hasFilter = false;
-    for (SelectorField field : sel.getOBUISELSelectorFieldList()) {
+    List<SelectorField> fields = OBDao.getActiveOBObjectList(sel,
+        Selector.PROPERTY_OBUISELSELECTORFIELDLIST);
+    for (SelectorField field : fields) {
       if (StringUtils.isEmpty(field.getClauseLeftPart())) {
         continue;
       }
@@ -342,19 +348,21 @@
       }
     }
 
-    // If sortByClause is empty set default sort options. Order by first shown column.
+    // If sortByClause is empty set default sort options.
     if (sortByClause.length() == 0) {
-      String fieldName = "";
-      Long sortNumber = Long.MAX_VALUE;
-      for (SelectorField selField : sel.getOBUISELSelectorFieldList()) {
-        if (selField.isShowingrid() && selField.getSortno() < sortNumber) {
-          sortNumber = selField.getSortno();
-          fieldName = selField.getDisplayColumnAlias();
+      OBCriteria<SelectorField> selFieldsCrit = OBDao.getFilteredCriteria(SelectorField.class,
+          Expression.eq(SelectorField.PROPERTY_OBUISELSELECTOR, sel), Expression.eq(
+              SelectorField.PROPERTY_SHOWINGRID, true));
+      selFieldsCrit.addOrderBy(SelectorField.PROPERTY_SORTNO, true);
+      for (SelectorField selField : selFieldsCrit.list()) {
+        int fieldSortIndex = getFieldSortIndex(selField.getDisplayColumnAlias(), sel);
+        if (fieldSortIndex > 0) {
+          sortByClause.append(fieldSortIndex + ", ");
         }
       }
-      int fieldSortIndex = getFieldSortIndex(fieldName, sel);
-      if (fieldSortIndex > 0) {
-        sortByClause.append(fieldSortIndex);
+      // Delete last 2 characters: ", "
+      if (sortByClause.length() > 0) {
+        sortByClause.delete(sortByClause.length() - 3, sortByClause.length() - 1);
       }
     }
     String result = "";
@@ -415,4 +423,5 @@
     }
     return 0;
   }
+
 }
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponent.java	Tue Mar 08 16:19:56 2011 +0100
@@ -29,6 +29,8 @@
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
+import org.hibernate.criterion.Criterion;
+import org.hibernate.criterion.Expression;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
@@ -41,11 +43,13 @@
 import org.openbravo.client.kernel.Component;
 import org.openbravo.client.kernel.ComponentProvider;
 import org.openbravo.client.kernel.Template;
+import org.openbravo.client.kernel.reference.FKComboUIDefinition;
 import org.openbravo.client.kernel.reference.UIDefinition;
 import org.openbravo.client.kernel.reference.UIDefinitionController;
 import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBDao;
 import org.openbravo.dal.service.OBQuery;
 import org.openbravo.data.Sqlc;
 import org.openbravo.model.ad.module.Module;
@@ -76,6 +80,7 @@
   private static final String CUSTOM_QUERY_DS = "F8DD408F2F3A414188668836F84C21AF";
 
   private org.openbravo.userinterface.selector.Selector selector;
+  private List<SelectorField> selectorFields;
   private List<SelectorFieldTrl> selectorFieldTrls;
   private static OutSelectorField IdOutField;
   private static OutSelectorField IdentifierOutField;
@@ -134,21 +139,29 @@
         + " has a null datasource and a null property");
   }
 
-  public static String getAdditionalProperties(Selector selector) {
+  public static String getAdditionalProperties(Selector selector, boolean onlyDisplayField) {
+    if (onlyDisplayField
+        && (selector.getDisplayfield() == null || !selector.getDisplayfield().isActive())) {
+      return "";
+    }
     final StringBuilder extraProperties = new StringBuilder();
-    if (selector.getDisplayfield() == null || !selector.getDisplayfield().isActive()) {
-      return extraProperties.toString();
+    for (SelectorField selectorField : selector.getOBUISELSelectorFieldList()) {
+      if (onlyDisplayField && selectorField != selector.getDisplayfield()) {
+        continue;
+      }
+      if (!selectorField.isActive()) {
+        continue;
+      }
+      String fieldName = getPropertyOrDataSourceField(selectorField);
+      final DomainType domainType = getDomainType(selectorField);
+      if (domainType instanceof ForeignKeyDomainType) {
+        fieldName = fieldName + "." + JsonConstants.IDENTIFIER;
+      }
+      if (extraProperties.length() > 0) {
+        extraProperties.append(",");
+      }
+      extraProperties.append(fieldName);
     }
-    SelectorField selectorField = selector.getDisplayfield();
-    String fieldName = getPropertyOrDataSourceField(selectorField);
-
-    // handle the case that the field is a foreign key
-    // in that case always show the identifier
-    final DomainType domainType = getDomainType(selectorField);
-    if (domainType instanceof ForeignKeyDomainType) {
-      fieldName = fieldName + "." + JsonConstants.IDENTIFIER;
-    }
-    extraProperties.append(fieldName);
     return extraProperties.toString();
   }
 
@@ -197,7 +210,7 @@
       final Entity entity = getEntity();
       if (entity != null) {
         for (Property prop : entity.getIdentifierProperties()) {
-          for (SelectorField selectorField : getSelector().getOBUISELSelectorFieldList()) {
+          for (SelectorField selectorField : getActiveSelectorFields()) {
             if (selectorField.getProperty() != null
                 && selectorField.getProperty().equals(prop.getName())) {
               return selectorField.getProperty();
@@ -219,6 +232,14 @@
     return selector;
   }
 
+  private List<SelectorField> getActiveSelectorFields() {
+    if (selectorFields == null) {
+      selectorFields = OBDao.getActiveOBObjectList(getSelector(),
+          Selector.PROPERTY_OBUISELSELECTORFIELDLIST);
+    }
+    return selectorFields;
+  }
+
   public String getColumnName() {
     Check.isTrue(hasParameter(SelectorConstants.PARAM_COLUMN_NAME), "The "
         + SelectorConstants.PARAM_COLUMN_NAME + " parameter must be set");
@@ -318,11 +339,14 @@
     return "null";
   }
 
+  /**
+   * @return true if there is at least one active field shown in grid
+   */
   public String getShowSelectorGrid() {
-    for (SelectorField selectorField : getSelector().getOBUISELSelectorFieldList()) {
-      if (selectorField.isShowingrid()) {
-        return Boolean.TRUE.toString();
-      }
+    if (OBDao.getFilteredCriteria(SelectorField.class,
+        Expression.eq(SelectorField.PROPERTY_OBUISELSELECTOR, getSelector()),
+        Expression.eq(SelectorField.PROPERTY_SHOWINGRID, true)).count() > 0) {
+      return Boolean.TRUE.toString();
     }
     return Boolean.FALSE.toString();
   }
@@ -366,7 +390,7 @@
 
     final Map<String, Object> dsParameters = new HashMap<String, Object>(getParameters());
     dsParameters.put(DataSourceConstants.DS_ONLY_GENERATE_CREATESTATEMENT, true);
-    final String extraProperties = getAdditionalProperties(getSelector());
+    final String extraProperties = getAdditionalProperties(getSelector(), false);
     if (extraProperties.length() > 0) {
       dsParameters.put(JsonConstants.ADDITIONAL_PROPERTIES_PARAMETER, extraProperties.toString());
     }
@@ -398,10 +422,7 @@
   public String getExtraSearchFields() {
     final String displayField = getDisplayField();
     final StringBuilder sb = new StringBuilder();
-    for (SelectorField selectorField : getSelector().getOBUISELSelectorFieldList()) {
-      if (!selectorField.isActive()) {
-        continue;
-      }
+    for (SelectorField selectorField : getActiveSelectorFields()) {
       String fieldName = getPropertyOrDataSourceField(selectorField);
       if (fieldName.equals(displayField)) {
         continue;
@@ -447,8 +468,7 @@
 
   public List<OutSelectorField> getOutFields() {
     List<OutSelectorField> outFields = new ArrayList<OutSelectorField>();
-    final List<SelectorField> sortedFields = new ArrayList<SelectorField>(getSelector()
-        .getOBUISELSelectorFieldList());
+    final List<SelectorField> sortedFields = new ArrayList<SelectorField>(getActiveSelectorFields());
 
     final String tabId = getParameter(SelectorConstants.PARAM_TAB_ID);
 
@@ -522,14 +542,13 @@
 
     OBContext.setAdminMode();
     try {
-      for (final SelectorField field : getSelector().getOBUISELSelectorFieldList()) {
-        if (!Boolean.TRUE.equals(field.isOutfield())) {
-          continue;
-        }
-
-        if (field.getSuffix() == null || "".equals(field.getSuffix())) {
-          continue;
-        }
+      final Criterion selectorConstraint = Expression.eq(SelectorField.PROPERTY_OBUISELSELECTOR,
+          getSelector());
+      final Criterion isOutFieldConstraint = Expression.eq(SelectorField.PROPERTY_ISOUTFIELD, true);
+      final Criterion hasSuffixConstraint = Expression.isNotNull(SelectorField.PROPERTY_SUFFIX);
+      List<SelectorField> fields = OBDao.getFilteredCriteria(SelectorField.class,
+          selectorConstraint, isOutFieldConstraint, hasSuffixConstraint).list();
+      for (final SelectorField field : fields) {
         hiddenInputs.put(columnName + field.getSuffix(), getElementString.replaceAll("@id@",
             columnName + field.getSuffix()));
       }
@@ -565,14 +584,10 @@
   private List<LocalSelectorField> getSelectorFields(boolean pickList, boolean popupGrid) {
     final List<LocalSelectorField> result = new ArrayList<LocalSelectorField>();
 
-    final List<SelectorField> sortedFields = new ArrayList<SelectorField>(getSelector()
-        .getOBUISELSelectorFieldList());
+    final List<SelectorField> sortedFields = new ArrayList<SelectorField>(getActiveSelectorFields());
     Collections.sort(sortedFields, new SelectorFieldComparator());
 
     for (SelectorField selectorField : sortedFields) {
-      if (!selectorField.isActive()) {
-        continue;
-      }
       if (popupGrid && !selectorField.isShowingrid()) {
         continue;
       }
@@ -599,6 +614,7 @@
       localSelectorField.setFilter(!pickList && selectorField.isFilterable());
       localSelectorField.setDomainType(domainType);
       localSelectorField.setUIDefinition(getUIDefinition(selectorField));
+      localSelectorField.setSelectorField(selectorField);
 
       // determine format
       // if (selectorField.getProperty() != null) {
@@ -695,6 +711,7 @@
     private boolean sort;
     private DomainType domainType;
     private UIDefinition uiDefinition;
+    private SelectorField selectorField;
 
     public DomainType getDomainType() {
       return domainType;
@@ -730,6 +747,10 @@
 
     public String getFilterEditorProperties() {
       if (getUIDefinition() != null) {
+        if (getUIDefinition() instanceof FKComboUIDefinition) {
+          return ", filterOperator: 'equals', filterOnKeypress: true, canFilter:true, required: false, filterEditorType: 'OBSelectorFilterSelectItem', filterEditorProperties: {entity: '"
+              + getEntityName() + "', displayField: '" + JsonConstants.IDENTIFIER + "'}";
+        }
         return getUIDefinition().getFilterEditorProperties(null);
       }
       return ", filterEditorType: 'OBTextItem'";
@@ -823,6 +844,29 @@
     public void setUIDefinition(UIDefinition uiDefinition) {
       this.uiDefinition = uiDefinition;
     }
+
+    public void setSelectorField(SelectorField selectorField) {
+      this.selectorField = selectorField;
+    }
+
+    public SelectorField getSelectorField() {
+      return selectorField;
+    }
+
+    public String getEntityName() {
+      if (selectorField == null) {
+        return null;
+      }
+      if (selectorField.getObuiselSelector().getTable() != null
+          && selectorField.getProperty() != null) {
+        final String entityName = selectorField.getObuiselSelector().getTable().getName();
+        final Entity entity = ModelProvider.getInstance().getEntity(entityName);
+        final Property property = DalUtil.getPropertyFromPath(entity, selectorField.getProperty());
+        return property.getTargetEntity().getName();
+      }
+      return null;
+    }
+
   }
 
   /**
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponentProvider.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorComponentProvider.java	Tue Mar 08 16:19:56 2011 +0100
@@ -63,6 +63,9 @@
         "web/org.openbravo.userinterface.selector/js/ob-selector-link-widget.js", true, false));
     resources.add(createStaticResource(
         "web/org.openbravo.userinterface.selector/js/ob-selector-item.js", false, true));
+    resources.add(createStaticResource(
+        "web/org.openbravo.userinterface.selector/js/ob-selector-filter-select-item.js", false,
+        true));
 
     resources.add(createStaticResource(
         "web/org.openbravo.userinterface.smartclient/openbravo/skins/"
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/SelectorDefaultFilterActionHandler.java	Tue Mar 08 16:19:56 2011 +0100
@@ -19,7 +19,6 @@
 package org.openbravo.userinterface.selector;
 
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 import javax.enterprise.context.ApplicationScoped;
@@ -30,23 +29,12 @@
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONObject;
 import org.hibernate.criterion.Expression;
-import org.openbravo.base.model.Entity;
-import org.openbravo.base.model.ModelProvider;
-import org.openbravo.base.model.Property;
-import org.openbravo.base.model.Reference;
-import org.openbravo.base.model.domaintype.DomainType;
-import org.openbravo.base.model.domaintype.ForeignKeyDomainType;
-import org.openbravo.base.structure.BaseOBObject;
-import org.openbravo.base.util.Check;
 import org.openbravo.client.application.OBBindings;
 import org.openbravo.client.kernel.BaseActionHandler;
 import org.openbravo.client.kernel.KernelConstants;
-import org.openbravo.dal.core.DalUtil;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
-import org.openbravo.service.json.JsonConstants;
-import org.openbravo.service.json.JsonUtils;
 
 /**
  * 
@@ -93,28 +81,7 @@
           if (sel.isCustomQuery()) {
             result.put(f.getDisplayColumnAlias(), exprResult);
           } else {
-            final DomainType domainType = getDomainType(f);
             String fieldName = f.getProperty();
-            if (domainType instanceof ForeignKeyDomainType) {
-              final String entityName = f.getObuiselSelector().getTable().getName();
-              final Entity entity = ModelProvider.getInstance().getEntity(entityName);
-              final List<Property> properties = JsonUtils.getPropertiesOnPath(entity, f
-                  .getProperty());
-              if (!properties.isEmpty()) {
-                final Property property = properties.get(properties.size() - 1);
-
-                @SuppressWarnings("unchecked")
-                Class<? extends BaseOBObject> o = (Class<? extends BaseOBObject>) Class
-                    .forName(property.getReferencedProperty().getEntity().getClassName());
-                String identifier = OBDal.getInstance().get(o, exprResult).getIdentifier();
-                if (identifier != null) {
-                  exprResult = identifier;
-                }
-              }
-
-              fieldName = fieldName + "." + JsonConstants.IDENTIFIER;
-            }
-
             result.put(fieldName, exprResult);
           }
         } catch (Exception e) {
@@ -141,29 +108,4 @@
     }
     return params;
   }
-
-  private DomainType getDomainType(SelectorField selectorField) {
-    if (selectorField.getObuiselSelector().getTable() != null
-        && selectorField.getProperty() != null) {
-      final String entityName = selectorField.getObuiselSelector().getTable().getName();
-      final Entity entity = ModelProvider.getInstance().getEntity(entityName);
-      final Property property = DalUtil.getPropertyFromPath(entity, selectorField.getProperty());
-      Check.isNotNull(property, "Property " + selectorField.getProperty() + " not found in Entity "
-          + entity);
-      return property.getDomainType();
-    } else if (selectorField.getObuiselSelector().getTable() != null
-        && selectorField.getObuiselSelector().isCustomQuery()
-        && selectorField.getReference() != null) {
-      return getDomainType(selectorField.getReference().getId());
-    } else if (selectorField.getObserdsDatasourceField().getReference() != null) {
-      return getDomainType(selectorField.getObserdsDatasourceField().getReference().getId());
-    }
-    return null;
-  }
-
-  private DomainType getDomainType(String referenceId) {
-    final Reference reference = ModelProvider.getInstance().getReference(referenceId);
-    Check.isNotNull(reference, "No reference found for referenceid " + referenceId);
-    return reference.getDomainType();
-  }
 }
--- a/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/src/org/openbravo/userinterface/selector/reference/FKSelectorUIDefinition.java	Tue Mar 08 16:19:56 2011 +0100
@@ -86,11 +86,12 @@
     final Map<String, Object> params = new HashMap<String, Object>();
     final Reference reference = OBDal.getInstance().get(Reference.class, getReference().getId());
     for (Selector selector : reference.getOBUISELSelectorList()) {
-      if (selector.isActive()) {
-        final String extraProperties = SelectorComponent.getAdditionalProperties(selector);
+      if (selector.isActive() && selector.getTable() != null) {
+        final String extraProperties = SelectorComponent.getAdditionalProperties(selector, true);
         if (extraProperties.length() > 0) {
           params.put(JsonConstants.ADDITIONAL_PROPERTIES_PARAMETER, extraProperties);
         }
+        return params;
       }
     }
     return params;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-filter-select-item.js	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,39 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+isc.ClassFactory.defineClass('OBSelectorFilterSelectItem', SelectItem);
+
+isc.OBSelectorFilterSelectItem.addProperties({
+  operator: 'equals',
+  valueField: OB.Constants.ID,
+
+  init: function() {
+    OB.Datasource.get(this.entity, this);
+    this.Super('init', arguments);
+  },
+  
+  // prevent ids from showing up
+  mapValueToDisplay : function (value) {
+    var ret = this.Super('mapValueToDisplay', arguments);
+    if (ret === value) {
+      return '';
+    }
+    return ret;
+  }
+
+});
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Tue Mar 08 16:19:56 2011 +0100
@@ -51,11 +51,22 @@
     });
     
     OB.Utilities.applyDefaultValues(this.selectorGridFields, this.defaultSelectorGridField);
-    
+
+    var operator;
+    if (this.selector.popupTextMatchStyle === 'substring') {
+      operator = 'iContains';
+    } else {
+      operator = 'iStartsWith';      
+    }
+
     for (var i = 0; i < this.selectorGridFields.length; i++) {
       if (this.selectorGridFields[i].disableFilter) {
         this.selectorGridFields[i].canFilter = false;
       }
+      // override the operator on the grid field level
+      if (this.selectorGridFields[i].operator === 'iContains' || !this.selectorGridFields[i].operator) {
+        this.selectorGridFields[i].operator = operator; 
+      }
     }
     
     this.selectorGrid = isc.OBGrid.create({
@@ -73,37 +84,29 @@
       dataSource: this.dataSource,
       showFilterEditor: true,
       sortField: this.displayField,
-      filterData: function(criteria, callback, requestProperties){
-        return this.Super('filterData', [this.convertCriteria(criteria), callback, requestProperties]);
-      },
-      fetchData: function(criteria, callback, requestProperties){
-        return this.Super('fetchData', [this.convertCriteria(criteria), callback, requestProperties]);
-      },
-      convertCriteria: function(criteria){
       
-        if (!criteria) {
-          criteria = {};
-        }
-        
+      onFetchData: function(criteria, requestProperties) {
+        requestProperties = requestProperties || {};
+        requestProperties.params = requestProperties.params || {};
+
         // on purpose not sending the third boolean param
-        isc.addProperties(criteria, this.selector.form.view.getContextInfo(false, true));
-        
+        isc.addProperties(requestProperties.params, this.selector.form.view.getContextInfo(false, true));
+
         // also adds the special ORG parameter
         if (this.selector.form.getField('organization')) {
-          criteria[OB.Constants.ORG_PARAMETER] = this.selector.form.getValue('organization');
-        } else if (criteria.inpadOrgId) {
-          criteria[OB.Constants.ORG_PARAMETER] = criteria.inpadOrgId;
+          requestProperties.params[OB.Constants.ORG_PARAMETER] = this.selector.form.getValue('organization');
+        } else if (requestProperties.params.inpadOrgId) {
+          requestProperties.params[OB.Constants.ORG_PARAMETER] = requestProperties.params.inpadOrgId;
         }
-        criteria[OB.Constants.WHERE_PARAMETER] = this.selector.whereClause;
-        
+        requestProperties.params[OB.Constants.WHERE_PARAMETER] = this.selector.whereClause;
+
         // set the default sort option
-        criteria[OB.Constants.SORTBY_PARAMETER] = this.displayField;
-        criteria[OB.Constants.TEXT_MATCH_PARAMETER_OVERRIDE] = this.selector.popupTextMatchStyle;
-        
-        criteria._selectorDefinitionId = this.selector.selectorDefinitionId;
-        criteria._requestType = 'Window';
-        return criteria;
+        requestProperties.params[OB.Constants.SORTBY_PARAMETER] = this.displayField;
+
+        requestProperties.params._selectorDefinitionId = this.selector.selectorDefinitionId;
+        requestProperties.params._requestType = 'Window';
       },
+
       dataArrived: function(){
       
         this.Super('dataArrived', arguments);
@@ -136,7 +139,7 @@
         width: this.buttonBarSpace
       }), cancelButton, isc.LayoutSpacer.create({})]
     })];
-    return this.Super('initWidget', arguments);
+    this.Super('initWidget', arguments);
   },
   
   setFilterEditorProperties: function(gridFields){
@@ -173,7 +176,7 @@
       
       gridField.filterEditorProperties.showLabel = false;
       gridField.filterEditorProperties.showTitle = false;
-      
+      gridField.filterEditorProperties.selectorWindow = selectorWindow;
       gridField.filterEditorProperties.textMatchStyle = selectorWindow.selector.popupTextMatchStyle;
       
       // add the icon on the right to the other icons
@@ -197,20 +200,21 @@
   
   closeClick: function() {
     this.hide(arguments);
-	},
+  },
 
   hide: function(){
     this.Super('hide', arguments);
     this.selector.focusInItem();
   },
-  
-  show: function(){
+
+  show: function(applyDefaultFilter){
     // draw now already otherwise the filter does not work the
     // first time    
     var ret = this.Super('show', arguments);
-    this.selectorGrid.setFilterEditorCriteria(this.defaultFilter);
-    this.selectorGrid.filterByEditor();
-
+    if (applyDefaultFilter) {
+      this.selectorGrid.setFilterEditorCriteria(this.defaultFilter);
+      this.selectorGrid.filterByEditor();
+    }
     if(this.selectorGrid.isDrawn()) {
       this.selectorGrid.focusInFilterEditor();
     } else {
@@ -250,7 +254,7 @@
     // adds the selector id to filter used to get filter information
     defaultFilter._selectorDefinitionId = this.selector.selectorDefinitionId;
     this.defaultFilter = defaultFilter;
-    this.show();
+    this.show(true);
   },
   
   setValueInField: function(){
@@ -362,7 +366,12 @@
     } else {
       this.handleOutFields(record);
       this.setValue(record[this.valueField]);
-      this.form.setValue(this.name + '.' + this.displayField, record[this.name + '.' + this.displayField]);
+      this.form.setValue(this.name + '.' + this.displayField, record[this.displayField]);
+      if (!this.valueMap) {
+        this.valueMap = {};
+      }
+      this.valueMap[record[this.valueField]] = record[this.displayField];
+      this.updateValueMap();    
     }
     if (this.form && this.form.handleItemChange) {
       this._hasChanged = true;
@@ -407,55 +416,68 @@
     return ret;
   },
   
-  getPickListFilterCriteria: function(){
-    var criteria = isc.addProperties({}, this.Super('getPickListFilterCriteria', arguments) || {}), defValue, prop;
+  filterDataBoundPickList : function (requestProperties, dropCache){
+    requestProperties = requestProperties || {};
+    requestProperties.params = requestProperties.params || {};
     
-    // sometimes the value is passed as a filter criteria
-    // remove it
-    if (this.getValueFieldName() && criteria[this.getValueFieldName()]) {
-      criteria[this.getValueFieldName()] = null;
+    // sometimes the value is passed as a filter criteria remove it
+    if (this.getValueFieldName() && requestProperties.params[this.getValueFieldName()]) {
+      requestProperties.params[this.getValueFieldName()] = null;
     }
             
     // do not prevent the count operation
-    criteria[isc.OBViewGrid.NO_COUNT_PARAMETER] = 'false';
+    requestProperties.params[isc.OBViewGrid.NO_COUNT_PARAMETER] = 'false';
 
     // on purpose not passing the third boolean param
-    isc.addProperties(criteria, this.form.view.getContextInfo(false, true));
+    isc.addProperties(requestProperties.params, this.form.view.getContextInfo(false, true));
     
     // also add the special ORG parameter
     if (this.form.getField('organization')) {
-      criteria[OB.Constants.ORG_PARAMETER] = this.form.getValue('organization');
-    } else if (criteria.inpadOrgId) {
-      criteria[OB.Constants.ORG_PARAMETER] = criteria.inpadOrgId;
+      requestProperties.params[OB.Constants.ORG_PARAMETER] = this.form.getValue('organization');
+    } else if (requestProperties.params.inpadOrgId) {
+      requestProperties.params[OB.Constants.ORG_PARAMETER] = requestProperties.params.inpadOrgId;
     }
     
     // adds the selector id to filter used to get filter information
-    criteria._selectorDefinitionId = this.selectorDefinitionId;
+    requestProperties.params._selectorDefinitionId = this.selectorDefinitionId;
     
     // only filter if the display field is also passed
     // the displayField filter is not passed when the user clicks the drop-down button
-    if (criteria[this.displayField]) {
+    if (requestProperties.params[this.displayField]) {
       for (var i = 0; i < this.extraSearchFields.length; i++) {
-        if (!criteria[this.extraSearchFields[i]]) {
-          criteria[this.extraSearchFields[i]] = criteria[this.displayField];
+        if (!requestProperties.params[this.extraSearchFields[i]]) {
+          requestProperties.params[this.extraSearchFields[i]] = requestProperties.params[this.displayField];
         }
       }
       
       // for the suggestion box it is one big or
-      criteria[OB.Constants.OR_EXPRESSION] = 'true';
+      requestProperties.params[OB.Constants.OR_EXPRESSION] = 'true';
     }
     
     // add field's default filter expressions
-    criteria.filterClass = 'org.openbravo.userinterface.selector.SelectorDataSourceFilter';
+    requestProperties.params.filterClass = 'org.openbravo.userinterface.selector.SelectorDataSourceFilter';
     
     // the additional where clause
-    criteria[OB.Constants.WHERE_PARAMETER] = this.whereClause;
+    requestProperties.params[OB.Constants.WHERE_PARAMETER] = this.whereClause;
     
     // and sort according to the display field
     // initially
-    criteria[OB.Constants.SORTBY_PARAMETER] = this.displayField;
+    requestProperties.params[OB.Constants.SORTBY_PARAMETER] = this.displayField;
     
-    return criteria;
+    return this.Super('filterDataBoundPickList', [requestProperties, dropCache]);
+  },
+  
+  mapValueToDisplay : function (value) {
+    var ret = this.Super('mapValueToDisplay', arguments);
+    if (ret === value && this.isDisabled()) {
+      return '';
+    }
+    if (ret === value && !this.valueMap) {
+      this.valueMap = {};
+      this.valueMap[value] = '';
+      return '';
+    }
+    return ret;
   }
 });
 
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-widget.js	Tue Mar 08 16:19:56 2011 +0100
@@ -232,6 +232,14 @@
           changed = oldValue !== newValue;
           this.selector.openbravoField.value = newValue;
           this.selector.selectorField.setValue(newValue);
+          
+          // set the value in the valuemap so it shows up correctly without loading
+          // all the info again
+          if (!this.selector.selectorField.valueMap) {
+            this.selector.selectorField.valueMap = {};
+          }
+          this.selector.selectorField.valueMap[newValue] = selected[this.selector.displayField];
+          this.selector.selectorField.updateValueMap();
         } else {
           changed = oldValue !== '';
           this.selector.openbravoField.value = '';
--- a/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Tue Mar 08 16:18:20 2011 +0100
+++ b/modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js	Tue Mar 08 16:19:56 2011 +0100
@@ -29,6 +29,23 @@
 // for all our date/times we use GMT on both the server and the client
 Time.setDefaultDisplayTimezone(0);
 
+//Let the click on an ImgButton and Button fall through to its action method 
+isc.ImgButton.addProperties({
+  click: function() {
+    if (this.action) {
+      this.action();
+    }
+  }
+});
+
+isc.Button.addProperties({
+  click: function() {
+    if (this.action) {
+      this.action();
+    }
+  }
+});
+
 // NOTE BEWARE: methods/props added here will overwrite and NOT extend FormItem
 // properties! 
 isc.FormItem.addProperties({
--- a/referencedata/sampledata/F_B_International_Group.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/referencedata/sampledata/F_B_International_Group.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -89228,6 +89228,24 @@
     <active>true</active>
     <editableField>true</editableField>
   </ADProcessAccess>
+  <ADProcessAccess id="4028E6C72E90F5E7012E90F8FAA9000A">
+    <id>4028E6C72E90F5E7012E90F8FAA9000A</id>
+    <process id="6AD04479EC134BD4826077F36B709876"/>
+    <role id="FF8081812250326E012250353BDE0005"/>
+    <client id="FF8080812AFBCB14012AFBD3E373001F"/>
+    <organization id="0"/>
+    <active>true</active>
+    <editableField>false</editableField>
+  </ADProcessAccess>
+  <ADProcessAccess id="4028E6C72E90F5E7012E90F9DB260012">
+    <id>4028E6C72E90F5E7012E90F9DB260012</id>
+    <process id="6AD04479EC134BD4826077F36B709876"/>
+    <role id="A9904A6C65FF43788A584E5A2268449D"/>
+    <client id="FF8080812AFBCB14012AFBD3E373001F"/>
+    <organization id="0"/>
+    <active>true</active>
+    <editableField>false</editableField>
+  </ADProcessAccess>
   <ADProcessAccess id="402C89DC54C04D4A83AE8040107121AE">
     <id>402C89DC54C04D4A83AE8040107121AE</id>
     <process id="101"/>
--- a/src-core/src/org/openbravo/database/ConnectionProviderImpl.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-core/src/org/openbravo/database/ConnectionProviderImpl.java	Tue Mar 08 16:19:56 2011 +0100
@@ -40,6 +40,10 @@
   String rdbms = "";
   String contextName = "openbravo";
 
+  public ConnectionProviderImpl(Properties properties) throws PoolNotFoundException {
+    create(properties, false, "openbravo");
+  }
+
   public ConnectionProviderImpl(String file) throws PoolNotFoundException {
     this(file, false, "openbravo");
   }
@@ -55,6 +59,18 @@
 
   private void create(String file, boolean isRelative, String _context)
       throws PoolNotFoundException {
+    Properties properties = new Properties();
+    try {
+      properties.load(new FileInputStream(file));
+      create(properties, isRelative, _context);
+    } catch (IOException e) {
+      log4j.error("Error loading properties", e);
+    }
+  }
+
+  private void create(Properties properties, boolean isRelative, String _context)
+      throws PoolNotFoundException {
+
     log4j.debug("Creating ConnectionProviderImpl");
     if (_context != null && !_context.equals(""))
       contextName = _context;
@@ -70,24 +86,18 @@
     String dbSessionConfig = null;
     String rdbms = null;
 
-    Properties properties = new Properties();
-    try {
-      properties.load(new FileInputStream(file));
-      poolName = properties.getProperty("bbdd.poolName", "myPool");
-      dbDriver = properties.getProperty("bbdd.driver");
-      dbServer = properties.getProperty("bbdd.url");
-      dbLogin = properties.getProperty("bbdd.user");
-      dbPassword = properties.getProperty("bbdd.password");
-      minConns = new Integer(properties.getProperty("bbdd.minConns", "1"));
-      maxConns = new Integer(properties.getProperty("bbdd.maxConns", "10"));
-      maxConnTime = new Double(properties.getProperty("maxConnTime", "0.5"));
-      dbSessionConfig = properties.getProperty("bbdd.sessionConfig");
-      rdbms = properties.getProperty("bbdd.rdbms");
-      if (rdbms.equalsIgnoreCase("POSTGRE"))
-        dbServer += "/" + properties.getProperty("bbdd.sid");
-    } catch (IOException e) {
-      log4j.error("Error loading properties", e);
-    }
+    poolName = properties.getProperty("bbdd.poolName", "myPool");
+    dbDriver = properties.getProperty("bbdd.driver");
+    dbServer = properties.getProperty("bbdd.url");
+    dbLogin = properties.getProperty("bbdd.user");
+    dbPassword = properties.getProperty("bbdd.password");
+    minConns = new Integer(properties.getProperty("bbdd.minConns", "1"));
+    maxConns = new Integer(properties.getProperty("bbdd.maxConns", "10"));
+    maxConnTime = new Double(properties.getProperty("maxConnTime", "0.5"));
+    dbSessionConfig = properties.getProperty("bbdd.sessionConfig");
+    rdbms = properties.getProperty("bbdd.rdbms");
+    if (rdbms.equalsIgnoreCase("POSTGRE"))
+      dbServer += "/" + properties.getProperty("bbdd.sid");
 
     if (log4j.isDebugEnabled()) {
       log4j.debug("poolName: " + poolName);
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- a/src-db/database/model/functions/C_CURRENCY_RATE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/functions/C_CURRENCY_RATE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -88,7 +88,7 @@
       WHERE C_Currency_ID = v_CurrencyFrom
         AND C_Currency_ID_To = v_CurrencyTo
         AND ConversionRateType = v_RateType
-        AND v_ConvDate BETWEEN ValidFrom AND ValidTo
+        AND TRUNC(v_ConvDate) BETWEEN ValidFrom AND ValidTo
         AND AD_Client_ID IN ('0', p_Client_ID)
         AND AD_Org_ID IN ('0', p_Org_ID)
         AND IsActive = 'Y'
--- a/src-db/database/model/functions/C_INVOICE_POST.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/functions/C_INVOICE_POST.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -626,7 +626,6 @@
         END IF;
         END_PROCESSING:=TRUE;
       END IF;
-      EXCEPTION WHEN OTHERS THEN RAISE NO_DATA_FOUND;
     END; -- FOR COMMIT
   END IF;--FINISH_PROCESS
   IF (NOT FINISH_PROCESS AND NOT END_PROCESSING) THEN
--- a/src-db/database/model/functions/C_YEARPERIODS.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/functions/C_YEARPERIODS.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -46,6 +46,7 @@
     v_Year_Str VARCHAR(20) ;
     v_User_ID VARCHAR2(32);
     v_year_num NUMBER;
+    v_language VARCHAR2(6);
   BEGIN
     --  Update AD_PInstance
     --  DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing');
@@ -67,8 +68,13 @@
       ORDER BY p.SeqNo
       )
     LOOP
+      IF Cur_Parameter.ParameterName = 'AD_LANGUAGE_ID' THEN
+        SELECT AD_LANGUAGE INTO v_language FROM AD_LANGUAGE WHERE AD_LANGUAGE_ID = Cur_Parameter.P_String;
+        v_language := COALESCE(v_language, 'en_US');
+      END IF;
       v_Year_ID:=Cur_Parameter.Record_ID;
     END LOOP; -- Get Parameter
+    
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Year_ID) ;
     --  Get C_Year Record
     DBMS_OUTPUT.PUT_LINE('Get Year info') ;
@@ -131,7 +137,10 @@
             v_NextNo, v_Client_ID, v_Org_ID, 'Y',
             now(), v_User_ID, now(), v_User_ID,
             v_Year_ID, v_MonthNo, TO_DATE(ADD_MONTHS(v_StartDate, v_MonthNo-1)), 'S',
-	        (SELECT SUBSTR(name, 1,3) || '-' || SUBSTR(year,3,2) FROM AD_MONTH, C_YEAR WHERE TO_NUMBER(value)=v_MonthNo AND c_year_id=v_Year_ID)
+            (SELECT SUBSTR(COALESCE(AD_MONTH_TRL.NAME, AD_MONTH.NAME), 1,3) || '-' || SUBSTR(C_YEAR.YEAR,3,2)
+                 FROM AD_MONTH LEFT OUTER JOIN AD_MONTH_TRL ON AD_MONTH.AD_MONTH_ID = AD_MONTH_TRL.AD_MONTH_ID AND AD_MONTH_TRL.AD_LANGUAGE = v_language, C_YEAR
+                 WHERE  TO_NUMBER(AD_MONTH.VALUE) = v_MonthNo
+                 AND C_YEAR.C_YEAR_ID = v_Year_ID)
            );
         DBMS_OUTPUT.PUT_LINE('Month Added') ;
       END IF;
--- a/src-db/database/model/prescript-PostgreSql.sql	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/prescript-PostgreSql.sql	Tue Mar 08 16:19:56 2011 +0100
@@ -1395,7 +1395,7 @@
   v_md5 = ''; 
   --Checksum for PL functions
   for i in (
-	select upper(proname) as proname, p.proname as realname, pronargs, oidvectortypes(p.proargtypes)
+	select upper(proname) as proname, p.proname as realname, pronargs, oidvectortypes(p.proargtypes) as proargtypes
 	from pg_proc p, pg_namespace n 
          where  pronamespace = n.oid   and n.nspname=current_schema() 
          and p.oid not in (select tgfoid   from pg_trigger) 
@@ -1413,7 +1413,7 @@
        from pg_proc p
       where p.proname = i.realname
         and p.pronargs = i.pronargs
-        and p.proargtypes = i.proargtypes;
+        and oidvectortypes(p.proargtypes) = i.proargtypes;
         
       v_md5 := md5(v_md5||aux);
 
@@ -1431,7 +1431,7 @@
 	     AND pg_catalog.pg_function_is_visible(pg_proc.oid)
 	     AND pg_proc.proname = i.realname
              and pg_proc.pronargs = i.pronargs
-             and pg_proc.proargtypes = i.proargtypes
+             and oidvectortypes(pg_proc.proargtypes) = i.proargtypes
 	     and (pg_proc.proargmodes is not null
 	     or pg_proc.proargnames is not null)
 		 ORDER BY 1,2;
--- a/src-db/database/model/tables/C_PERIODCONTROL.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/tables/C_PERIODCONTROL.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -62,6 +62,11 @@
       <foreign-key foreignTable="AD_ORG" name="C_PERIODCONTROL_AD_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
+      <index name="C_PERIODCONTROL_DOCBASE" unique="false">
+        <index-column name="C_PERIOD_ID"/>
+        <index-column name="DOCBASETYPE"/>
+        <index-column name="AD_ORG_ID"/>
+      </index>
       <index name="C_PERIODCONTROL_PERIOD" unique="false">
         <index-column name="C_PERIOD_ID"/>
       </index>
--- a/src-db/database/model/views/M_PRODUCT_STOCK_V.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/model/views/M_PRODUCT_STOCK_V.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
   <database name="VIEW M_PRODUCT_STOCK_V">
-    <view name="M_PRODUCT_STOCK_V"><![CDATA[SELECT p.m_product_id || sd.m_storage_detail_id AS m_product_stock_v_id, l.ad_client_id, l.ad_org_id, l.isactive, sd.created, sd.createdby, sd.updated, sd.updatedby, sd.m_product_id, sd.qtyonhand, sd.qtyorderonhand, sd.preqtyonhand, sd.preqtyorderonhand, sd.c_uom_id, sd.m_product_uom_id, sd.m_attributesetinstance_id, sd.m_locator_id
+    <view name="M_PRODUCT_STOCK_V"><![CDATA[SELECT p.m_product_id || sd.m_storage_detail_id AS m_product_stock_v_id, l.ad_client_id, l.ad_org_id, l.isactive, sd.created, sd.createdby, sd.updated, sd.updatedby, sd.m_product_id, sd.qtyonhand, sd.qtyorderonhand, sd.preqtyonhand, sd.preqtyorderonhand, sd.c_uom_id, sd.m_product_uom_id, sd.m_attributesetinstance_id, sd.m_locator_id, 'Y' AS stocked
 FROM m_storage_detail sd
 JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
 JOIN m_product p ON sd.m_product_id = p.m_product_id AND p.isactive = 'Y'
@@ -10,6 +10,6 @@
 CASE p.attrsetvaluetype
 WHEN 'D' THEN p.m_attributesetinstance_id
 ELSE NULL
-END AS m_attributesetinstance_id, NULL AS m_locator_id
+END AS m_attributesetinstance_id, NULL AS m_locator_id, 'N' AS stocked
 FROM m_product p]]></view>
   </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -277768,7 +277768,7 @@
 <!--5882B93E0C44C2A0E040007F01012513-->  <HELP><![CDATA[The context in which a Process Request was scheduled or executed. The context contains information such as user, client, organization, language, date format etc.]]></HELP>
 <!--5882B93E0C44C2A0E040007F01012513-->  <COLUMNNAME><![CDATA[OB_Context]]></COLUMNNAME>
 <!--5882B93E0C44C2A0E040007F01012513-->  <AD_TABLE_ID><![CDATA[82D4EDCF39AE44FB9B24E95A1B18B21C]]></AD_TABLE_ID>
-<!--5882B93E0C44C2A0E040007F01012513-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--5882B93E0C44C2A0E040007F01012513-->  <AD_REFERENCE_ID><![CDATA[14]]></AD_REFERENCE_ID>
 <!--5882B93E0C44C2A0E040007F01012513-->  <FIELDLENGTH><![CDATA[4000]]></FIELDLENGTH>
 <!--5882B93E0C44C2A0E040007F01012513-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--5882B93E0C44C2A0E040007F01012513-->  <ISPARENT><![CDATA[N]]></ISPARENT>
@@ -312195,6 +312195,37 @@
 <!--9D18FD9BDA284EF190AAE3C3F73E3338-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--9D18FD9BDA284EF190AAE3C3F73E3338--></AD_COLUMN>
 
+<!--9D6E31238ECAD811E040007F01004363--><AD_COLUMN>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_COLUMN_ID><![CDATA[9D6E31238ECAD811E040007F01004363]]></AD_COLUMN_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9D6E31238ECAD811E040007F01004363-->  <NAME><![CDATA[Stocked]]></NAME>
+<!--9D6E31238ECAD811E040007F01004363-->  <COLUMNNAME><![CDATA[Stocked]]></COLUMNNAME>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_TABLE_ID><![CDATA[FF8080812E381D1E012E3898C5DD0010]]></AD_TABLE_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--9D6E31238ECAD811E040007F01004363-->  <SEQNO><![CDATA[180]]></SEQNO>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_ELEMENT_ID><![CDATA[9D7068CB699374C8E040007F01004A16]]></AD_ELEMENT_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--9D6E31238ECAD811E040007F01004363-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--9D6E31238ECAD811E040007F01004363-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9D6E31238ECAD811E040007F01004363-->  <POSITION><![CDATA[18]]></POSITION>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--9D6E31238ECAD811E040007F01004363-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--9D6E31238ECAD811E040007F01004363-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--9D6E31238ECAD811E040007F01004363--></AD_COLUMN>
+
 <!--9F3ADE0CE0734BE2BD059AAEFCF1D51C--><AD_COLUMN>
 <!--9F3ADE0CE0734BE2BD059AAEFCF1D51C-->  <AD_COLUMN_ID><![CDATA[9F3ADE0CE0734BE2BD059AAEFCF1D51C]]></AD_COLUMN_ID>
 <!--9F3ADE0CE0734BE2BD059AAEFCF1D51C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -27672,6 +27672,17 @@
 <!--9D376EF8B99B40C88E4D2D2A172DE6A8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--9D376EF8B99B40C88E4D2D2A172DE6A8--></AD_ELEMENT>
 
+<!--9D7068CB699374C8E040007F01004A16--><AD_ELEMENT>
+<!--9D7068CB699374C8E040007F01004A16-->  <AD_ELEMENT_ID><![CDATA[9D7068CB699374C8E040007F01004A16]]></AD_ELEMENT_ID>
+<!--9D7068CB699374C8E040007F01004A16-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9D7068CB699374C8E040007F01004A16-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9D7068CB699374C8E040007F01004A16-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9D7068CB699374C8E040007F01004A16-->  <COLUMNNAME><![CDATA[Stocked]]></COLUMNNAME>
+<!--9D7068CB699374C8E040007F01004A16-->  <NAME><![CDATA[Stocked]]></NAME>
+<!--9D7068CB699374C8E040007F01004A16-->  <PRINTNAME><![CDATA[Stocked]]></PRINTNAME>
+<!--9D7068CB699374C8E040007F01004A16-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9D7068CB699374C8E040007F01004A16--></AD_ELEMENT>
+
 <!--9F815073C39E4506A1C74BB3667C6B57--><AD_ELEMENT>
 <!--9F815073C39E4506A1C74BB3667C6B57-->  <AD_ELEMENT_ID><![CDATA[9F815073C39E4506A1C74BB3667C6B57]]></AD_ELEMENT_ID>
 <!--9F815073C39E4506A1C74BB3667C6B57-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODULE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_MODULE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -22,7 +22,7 @@
 <!--0-->  <ISTRANSLATIONMODULE><![CDATA[N]]></ISTRANSLATIONMODULE>
 <!--0-->  <HASREFERENCEDATA><![CDATA[Y]]></HASREFERENCEDATA>
 <!--0-->  <REFERENCEDATAINFO><![CDATA[Standard document types for orders, invoices, etc. and settings]]></REFERENCEDATAINFO>
-<!--0-->  <VERSION_LABEL><![CDATA[CI]]></VERSION_LABEL>
+<!--0-->  <VERSION_LABEL><![CDATA[dev]]></VERSION_LABEL>
 <!--0-->  <ISCOMMERCIAL><![CDATA[N]]></ISCOMMERCIAL>
 <!--0--></AD_MODULE>
 
--- a/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_PROCESS_PARA.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -5146,6 +5146,25 @@
 <!--3AC22B0F80264CF09D52044F198C75BD-->  <AD_ELEMENT_ID><![CDATA[193]]></AD_ELEMENT_ID>
 <!--3AC22B0F80264CF09D52044F198C75BD--></AD_PROCESS_PARA>
 
+<!--6E19A05CE9564C15BA5FAA118C005859--><AD_PROCESS_PARA>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_PROCESS_PARA_ID><![CDATA[6E19A05CE9564C15BA5FAA118C005859]]></AD_PROCESS_PARA_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <NAME><![CDATA[Language]]></NAME>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_PROCESS_ID><![CDATA[100]]></AD_PROCESS_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_VAL_RULE_ID><![CDATA[E2628841519247358C005033E0C9AF61]]></AD_VAL_RULE_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <COLUMNNAME><![CDATA[AD_LANGUAGE_ID]]></COLUMNNAME>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <ISRANGE><![CDATA[N]]></ISRANGE>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <DEFAULTVALUE><![CDATA[@SQL=SELECT AD_LANGUAGE_ID FROM AD_LANGUAGE WHERE AD_LANGUAGE = @#AD_LANGUAGE@]]></DEFAULTVALUE>
+<!--6E19A05CE9564C15BA5FAA118C005859-->  <AD_ELEMENT_ID><![CDATA[2159]]></AD_ELEMENT_ID>
+<!--6E19A05CE9564C15BA5FAA118C005859--></AD_PROCESS_PARA>
+
 <!--70B21DAE5E064CEF822273BDF43B64E4--><AD_PROCESS_PARA>
 <!--70B21DAE5E064CEF822273BDF43B64E4-->  <AD_PROCESS_PARA_ID><![CDATA[70B21DAE5E064CEF822273BDF43B64E4]]></AD_PROCESS_PARA_ID>
 <!--70B21DAE5E064CEF822273BDF43B64E4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -10067,7 +10067,7 @@
 <!--C293E5B8BA954575B979A1DA586B89D8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--C293E5B8BA954575B979A1DA586B89D8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--C293E5B8BA954575B979A1DA586B89D8-->  <VALUE><![CDATA[P]]></VALUE>
-<!--C293E5B8BA954575B979A1DA586B89D8-->  <NAME><![CDATA[Process Payment]]></NAME>
+<!--C293E5B8BA954575B979A1DA586B89D8-->  <NAME><![CDATA[Process]]></NAME>
 <!--C293E5B8BA954575B979A1DA586B89D8-->  <AD_REFERENCE_ID><![CDATA[36972531DA994BB38ECB91993058282F]]></AD_REFERENCE_ID>
 <!--C293E5B8BA954575B979A1DA586B89D8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--C293E5B8BA954575B979A1DA586B89D8--></AD_REF_LIST>
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -778,7 +778,7 @@
 <!--800580-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--800580-->  <TEXT><![CDATA[ADD AND KEEP GOING...]]></TEXT>
 <!--800580-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html]]></FILENAME>
-<!--800580-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--800580-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--800580-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800580--></AD_TEXTINTERFACES>
 
@@ -12232,7 +12232,7 @@
 <!--809993-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--809993-->  <TEXT><![CDATA[Journal entry ]]></TEXT>
 <!--809993-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--809993-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--809993-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--809993-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--809993--></AD_TEXTINTERFACES>
 
@@ -13016,7 +13016,7 @@
 <!--1000500011-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1000500011-->  <TEXT><![CDATA[Accounting schema]]></TEXT>
 <!--1000500011-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--1000500011-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000500011-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--1000500011-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1000500011--></AD_TEXTINTERFACES>
 
@@ -13027,7 +13027,7 @@
 <!--1000500013-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1000500013-->  <TEXT><![CDATA[Accounting schema ]]></TEXT>
 <!--1000500013-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--1000500013-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--1000500013-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--1000500013-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1000500013--></AD_TEXTINTERFACES>
 
@@ -16920,7 +16920,7 @@
 <!--56F37B0AC3EF8583E040007F010009C4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--56F37B0AC3EF8583E040007F010009C4-->  <TEXT><![CDATA[Show closing]]></TEXT>
 <!--56F37B0AC3EF8583E040007F010009C4-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--56F37B0AC3EF8583E040007F010009C4-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--56F37B0AC3EF8583E040007F010009C4-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--56F37B0AC3EF8583E040007F010009C4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--56F37B0AC3EF8583E040007F010009C4--></AD_TEXTINTERFACES>
 
@@ -16931,7 +16931,7 @@
 <!--56F37B0AC3F08583E040007F010009C4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--56F37B0AC3F08583E040007F010009C4-->  <TEXT><![CDATA[Show regularization]]></TEXT>
 <!--56F37B0AC3F08583E040007F010009C4-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--56F37B0AC3F08583E040007F010009C4-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--56F37B0AC3F08583E040007F010009C4-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--56F37B0AC3F08583E040007F010009C4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--56F37B0AC3F08583E040007F010009C4--></AD_TEXTINTERFACES>
 
@@ -16942,7 +16942,7 @@
 <!--56F37B0AC3F18583E040007F010009C4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--56F37B0AC3F18583E040007F010009C4-->  <TEXT><![CDATA[Show opening]]></TEXT>
 <!--56F37B0AC3F18583E040007F010009C4-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--56F37B0AC3F18583E040007F010009C4-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--56F37B0AC3F18583E040007F010009C4-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--56F37B0AC3F18583E040007F010009C4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--56F37B0AC3F18583E040007F010009C4--></AD_TEXTINTERFACES>
 
@@ -21670,7 +21670,7 @@
 <!--95B7CFA558F23C40E040007F01010F4F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--95B7CFA558F23C40E040007F01010F4F-->  <TEXT><![CDATA[continued...]]></TEXT>
 <!--95B7CFA558F23C40E040007F01010F4F-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
-<!--95B7CFA558F23C40E040007F01010F4F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--95B7CFA558F23C40E040007F01010F4F-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--95B7CFA558F23C40E040007F01010F4F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--95B7CFA558F23C40E040007F01010F4F--></AD_TEXTINTERFACES>
 
@@ -21681,7 +21681,7 @@
 <!--95B7CFA558F43C40E040007F01010F4F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--95B7CFA558F43C40E040007F01010F4F-->  <TEXT><![CDATA[please turn over]]></TEXT>
 <!--95B7CFA558F43C40E040007F01010F4F-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
-<!--95B7CFA558F43C40E040007F01010F4F-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--95B7CFA558F43C40E040007F01010F4F-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--95B7CFA558F43C40E040007F01010F4F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--95B7CFA558F43C40E040007F01010F4F--></AD_TEXTINTERFACES>
 
@@ -21703,7 +21703,7 @@
 <!--95CA79458E3EC420E040007F01015644-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--95CA79458E3EC420E040007F01015644-->  <TEXT><![CDATA[Initial page number]]></TEXT>
 <!--95CA79458E3EC420E040007F01015644-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
-<!--95CA79458E3EC420E040007F01015644-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--95CA79458E3EC420E040007F01015644-->  <ISUSED><![CDATA[N]]></ISUSED>
 <!--95CA79458E3EC420E040007F01015644-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--95CA79458E3EC420E040007F01015644--></AD_TEXTINTERFACES>
 
@@ -21762,6 +21762,193 @@
 <!--9C3EDA8B819431A5E040A8C021013F8D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--9C3EDA8B819431A5E040A8C021013F8D--></AD_TEXTINTERFACES>
 
+<!--9DA67547DD4F2BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD4F2BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <TEXT><![CDATA[Accounting Schema]]></TEXT>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD4F2BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD4F2BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD512BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD512BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD512BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD512BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD512BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD512BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD512BAAE040007F01002B99-->  <TEXT><![CDATA[Show Regular Entries]]></TEXT>
+<!--9DA67547DD512BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD512BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD512BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD512BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD532BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD532BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD532BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD532BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD532BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD532BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD532BAAE040007F01002B99-->  <TEXT><![CDATA[Show Regularization]]></TEXT>
+<!--9DA67547DD532BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD532BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD532BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD532BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD552BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD552BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD552BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD552BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD552BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD552BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD552BAAE040007F01002B99-->  <TEXT><![CDATA[Show Opening]]></TEXT>
+<!--9DA67547DD552BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD552BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD552BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD552BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD572BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD572BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD572BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD572BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD572BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD572BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD572BAAE040007F01002B99-->  <TEXT><![CDATA[Show Closing]]></TEXT>
+<!--9DA67547DD572BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD572BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD572BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD572BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD592BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD592BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD592BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD592BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD592BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD592BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD592BAAE040007F01002B99-->  <TEXT><![CDATA[Printing]]></TEXT>
+<!--9DA67547DD592BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD592BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD592BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD592BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD5B2BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD5B2BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <TEXT><![CDATA[Initial Page Number]]></TEXT>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD5B2BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD5B2BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD5D2BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD5D2BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <TEXT><![CDATA[Initial Entry Number]]></TEXT>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD5D2BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD5D2BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD5F2BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD5F2BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <TEXT><![CDATA[Initial Balance]]></TEXT>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD5F2BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD5F2BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD612BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD612BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD612BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD612BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD612BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD612BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD612BAAE040007F01002B99-->  <TEXT><![CDATA[Show Entry Description]]></TEXT>
+<!--9DA67547DD612BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD612BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD612BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD612BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD632BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD632BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD632BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD632BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD632BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD632BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD632BAAE040007F01002B99-->  <TEXT><![CDATA[Journal Entry ]]></TEXT>
+<!--9DA67547DD632BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD632BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD632BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD632BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD652BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD652BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD652BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD652BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD652BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD652BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD652BAAE040007F01002B99-->  <TEXT><![CDATA[Accounting Schema ]]></TEXT>
+<!--9DA67547DD652BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.html]]></FILENAME>
+<!--9DA67547DD652BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD652BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD652BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA67547DD672BAAE040007F01002B99--><AD_TEXTINTERFACES>
+<!--9DA67547DD672BAAE040007F01002B99-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA67547DD672BAAE040007F01002B99]]></AD_TEXTINTERFACES_ID>
+<!--9DA67547DD672BAAE040007F01002B99-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA67547DD672BAAE040007F01002B99-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA67547DD672BAAE040007F01002B99-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA67547DD672BAAE040007F01002B99-->  <TEXT><![CDATA[CARRY FORWARD...]]></TEXT>
+<!--9DA67547DD672BAAE040007F01002B99-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.html]]></FILENAME>
+<!--9DA67547DD672BAAE040007F01002B99-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA67547DD672BAAE040007F01002B99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA67547DD672BAAE040007F01002B99--></AD_TEXTINTERFACES>
+
+<!--9DA678E2E4F1F213E040007F01002C4C--><AD_TEXTINTERFACES>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA678E2E4F1F213E040007F01002C4C]]></AD_TEXTINTERFACES_ID>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <TEXT><![CDATA[... continued]]></TEXT>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA678E2E4F1F213E040007F01002C4C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA678E2E4F1F213E040007F01002C4C--></AD_TEXTINTERFACES>
+
+<!--9DA678E2E4F3F213E040007F01002C4C--><AD_TEXTINTERFACES>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA678E2E4F3F213E040007F01002C4C]]></AD_TEXTINTERFACES_ID>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <TEXT><![CDATA[Carry-Over:]]></TEXT>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA678E2E4F3F213E040007F01002C4C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA678E2E4F3F213E040007F01002C4C--></AD_TEXTINTERFACES>
+
+<!--9DA678E2E4F5F213E040007F01002C4C--><AD_TEXTINTERFACES>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA678E2E4F5F213E040007F01002C4C]]></AD_TEXTINTERFACES_ID>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <TEXT><![CDATA[Carry Forward:]]></TEXT>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA678E2E4F5F213E040007F01002C4C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA678E2E4F5F213E040007F01002C4C--></AD_TEXTINTERFACES>
+
+<!--9DA678E2E4F7F213E040007F01002C4C--><AD_TEXTINTERFACES>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <AD_TEXTINTERFACES_ID><![CDATA[9DA678E2E4F7F213E040007F01002C4C]]></AD_TEXTINTERFACES_ID>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <TEXT><![CDATA[continue ...]]></TEXT>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportGeneralLedgerJournal.jrxml]]></FILENAME>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--9DA678E2E4F7F213E040007F01002C4C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9DA678E2E4F7F213E040007F01002C4C--></AD_TEXTINTERFACES>
+
 <!--9F0C2175AC6145B49570E24110762368--><AD_TEXTINTERFACES>
 <!--9F0C2175AC6145B49570E24110762368-->  <AD_TEXTINTERFACES_ID><![CDATA[9F0C2175AC6145B49570E24110762368]]></AD_TEXTINTERFACES_ID>
 <!--9F0C2175AC6145B49570E24110762368-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_VAL_RULE.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/AD_VAL_RULE.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -1703,6 +1703,18 @@
 <!--DC79E946854746F1A7965DCADF1D76FE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--DC79E946854746F1A7965DCADF1D76FE--></AD_VAL_RULE>
 
+<!--E2628841519247358C005033E0C9AF61--><AD_VAL_RULE>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_VAL_RULE_ID><![CDATA[E2628841519247358C005033E0C9AF61]]></AD_VAL_RULE_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E2628841519247358C005033E0C9AF61-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E2628841519247358C005033E0C9AF61-->  <NAME><![CDATA[AD_Language_System]]></NAME>
+<!--E2628841519247358C005033E0C9AF61-->  <DESCRIPTION><![CDATA[List of the Openbravo ERP System Languages]]></DESCRIPTION>
+<!--E2628841519247358C005033E0C9AF61-->  <TYPE><![CDATA[S]]></TYPE>
+<!--E2628841519247358C005033E0C9AF61-->  <CODE><![CDATA[AD_LANGUAGE.ISSYSTEMLANGUAGE='Y']]></CODE>
+<!--E2628841519247358C005033E0C9AF61-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E2628841519247358C005033E0C9AF61--></AD_VAL_RULE>
+
 <!--FDA7BA9355A6468DAF67E1C5288990A6--><AD_VAL_RULE>
 <!--FDA7BA9355A6468DAF67E1C5288990A6-->  <AD_VAL_RULE_ID><![CDATA[FDA7BA9355A6468DAF67E1C5288990A6]]></AD_VAL_RULE_ID>
 <!--FDA7BA9355A6468DAF67E1C5288990A6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -412,7 +412,7 @@
 <!--8F21E735036A49D4BB1FEC42F872317E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--8F21E735036A49D4BB1FEC42F872317E-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
 <!--8F21E735036A49D4BB1FEC42F872317E-->  <AD_REFERENCE_ID><![CDATA[800011]]></AD_REFERENCE_ID>
-<!--8F21E735036A49D4BB1FEC42F872317E-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--8F21E735036A49D4BB1FEC42F872317E-->  <SHOWINPICKLIST><![CDATA[Y]]></SHOWINPICKLIST>
 <!--8F21E735036A49D4BB1FEC42F872317E--></OBUISEL_SELECTOR_FIELD>
 
 <!--94298E76C86A439A935D7D84E7DF1C3E--><OBUISEL_SELECTOR_FIELD>
@@ -651,7 +651,6 @@
 <!--D2331E1502BD481A920747C46865FFA8-->  <SORTNO><![CDATA[40]]></SORTNO>
 <!--D2331E1502BD481A920747C46865FFA8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--D2331E1502BD481A920747C46865FFA8-->  <ISOUTFIELD><![CDATA[Y]]></ISOUTFIELD>
-<!--D2331E1502BD481A920747C46865FFA8-->  <DEFAULT_EXPRESSION><![CDATA['0']]></DEFAULT_EXPRESSION>
 <!--D2331E1502BD481A920747C46865FFA8-->  <SUFFIX><![CDATA[_QTY]]></SUFFIX>
 <!--D2331E1502BD481A920747C46865FFA8-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--D2331E1502BD481A920747C46865FFA8--></OBUISEL_SELECTOR_FIELD>
@@ -799,7 +798,7 @@
 <!--E8297012B7D04DD5A97E1BC54DBBEB3E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--E8297012B7D04DD5A97E1BC54DBBEB3E-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
 <!--E8297012B7D04DD5A97E1BC54DBBEB3E-->  <AD_REFERENCE_ID><![CDATA[800011]]></AD_REFERENCE_ID>
-<!--E8297012B7D04DD5A97E1BC54DBBEB3E-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--E8297012B7D04DD5A97E1BC54DBBEB3E-->  <SHOWINPICKLIST><![CDATA[Y]]></SHOWINPICKLIST>
 <!--E8297012B7D04DD5A97E1BC54DBBEB3E--></OBUISEL_SELECTOR_FIELD>
 
 <!--EB0A95320BF845DD8146274BE02DABBC--><OBUISEL_SELECTOR_FIELD>
@@ -911,4 +910,25 @@
 <!--FF8080812DF02890012DF0CB9ECF0062-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--FF8080812DF02890012DF0CB9ECF0062--></OBUISEL_SELECTOR_FIELD>
 
+<!--FF8080812E77708D012E7796A94B0017--><OBUISEL_SELECTOR_FIELD>
+<!--FF8080812E77708D012E7796A94B0017-->  <OBUISEL_SELECTOR_FIELD_ID><![CDATA[FF8080812E77708D012E7796A94B0017]]></OBUISEL_SELECTOR_FIELD_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <OBUISEL_SELECTOR_ID><![CDATA[4C8BC3E8E56441F4B8C98C684A0C9212]]></OBUISEL_SELECTOR_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <AD_COLUMN_ID><![CDATA[9D6E31238ECAD811E040007F01004363]]></AD_COLUMN_ID>
+<!--FF8080812E77708D012E7796A94B0017-->  <NAME><![CDATA[Stocked]]></NAME>
+<!--FF8080812E77708D012E7796A94B0017-->  <PROPERTY><![CDATA[stocked]]></PROPERTY>
+<!--FF8080812E77708D012E7796A94B0017-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--FF8080812E77708D012E7796A94B0017-->  <SORT><![CDATA[Y]]></SORT>
+<!--FF8080812E77708D012E7796A94B0017-->  <FILTER><![CDATA[Y]]></FILTER>
+<!--FF8080812E77708D012E7796A94B0017-->  <SEARCHINSUGGESTIONBOX><![CDATA[N]]></SEARCHINSUGGESTIONBOX>
+<!--FF8080812E77708D012E7796A94B0017-->  <SHOWINGRID><![CDATA[Y]]></SHOWINGRID>
+<!--FF8080812E77708D012E7796A94B0017-->  <SORTNO><![CDATA[110]]></SORTNO>
+<!--FF8080812E77708D012E7796A94B0017-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF8080812E77708D012E7796A94B0017-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
+<!--FF8080812E77708D012E7796A94B0017-->  <DEFAULT_EXPRESSION><![CDATA[if (OB.isSalesTransaction() == true) { true } else { false }]]></DEFAULT_EXPRESSION>
+<!--FF8080812E77708D012E7796A94B0017-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
+<!--FF8080812E77708D012E7796A94B0017--></OBUISEL_SELECTOR_FIELD>
+
 </data>
--- a/src-test/org/openbravo/test/xml/EntityXMLImportTestSingle.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-test/org/openbravo/test/xml/EntityXMLImportTestSingle.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -57,18 +57,60 @@
    * insert.
    */
   public void testImportNoUpdate() {
-  return;
+    setTestAdminContext();
+
+    final String xml = exportTax();
+    final Client c = OBDal.getInstance().get(Client.class, TEST_CLIENT_ID);
+    final Organization o = OBDal.getInstance().get(Organization.class, TEST_ORG_ID);
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(c, o, xml);
+
+    log.debug("WARNING>>>>");
+    assertTrue(ir.getWarningMessages(), ir.getWarningMessages() == null);
+    assertEquals(0, ir.getUpdatedObjects().size());
+    assertEquals(0, ir.getInsertedObjects().size());
+    if (ir.hasErrorOccured()) {
+      fail(ir.getErrorMessages());
+    }
   }
 
   private String exportTax() {
-  return "";
+    final OBCriteria<?> obc = OBDal.getInstance().createCriteria(TaxRate.class);
+
+    final EntityXMLConverter exc = EntityXMLConverter.newInstance();
+    exc.setOptionIncludeChildren(true);
+    exc.setOptionIncludeReferenced(true);
+    exc.setAddSystemAttributes(false);
+
+    @SuppressWarnings("unchecked")
+    final List<BaseOBObject> list = (List<BaseOBObject>) obc.list();
+    final String xml = exc.toXML(list);
+    log.debug(xml);
+    return xml;
   }
 
   /**
    * Export {@link Greeting} from one org and import in the other
    */
   public void test1Greeting() {
-  return;
+    cleanRefDataLoaded();
+    setTestUserContext();
+    addReadWriteAccess(Greeting.class);
+
+    createTestData();
+
+    final int cnt = count(Greeting.class);
+    addReadWriteAccess(Greeting.class);
+    final String xml = getXML(Greeting.class);
+    // insert in org 1000001
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(
+        OBDal.getInstance().get(Client.class, QA_TEST_CLIENT_ID),
+        OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID), xml);
+    assertEquals(cnt, ir.getInsertedObjects().size());
+    assertEquals(0, ir.getUpdatedObjects().size());
+    if (ir.hasErrorOccured()) {
+      fail(ir.getErrorMessages());
+    }
   }
 
   /**
@@ -76,7 +118,20 @@
    * object.
    */
   public void test2Greeting() {
-  return;
+    setTestUserContext();
+    addReadWriteAccess(Greeting.class);
+
+    final String xml = getXML(Greeting.class);
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+    // insert in org 1000002
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(
+        OBDal.getInstance().get(Client.class, QA_TEST_CLIENT_ID),
+        OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID), xml);
+    assertEquals(0, ir.getInsertedObjects().size());
+    assertEquals(0, ir.getUpdatedObjects().size());
+    if (ir.hasErrorOccured()) {
+      fail(ir.getErrorMessages());
+    }
   }
 
   /**
@@ -84,36 +139,95 @@
    * imports again. The result should be twenty updates.
    */
   public void test3Greeting() {
-  return;
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+
+    createTestData();
+
+    String xml = getXML(Greeting.class);
+    xml = xml.replaceAll(">Greeting", ">Greetings");
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(
+        OBDal.getInstance().get(Client.class, QA_TEST_CLIENT_ID),
+        OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID), xml);
+    assertEquals(0, ir.getInsertedObjects().size());
+    assertEquals(DATA_SET_SIZE, ir.getUpdatedObjects().size());
+    if (ir.hasErrorOccured()) {
+      fail(ir.getErrorMessages());
+    }
   }
 
   /**
    * Remove the test data from QA_TEST_ORG_ID.
    */
   public void test4Greeting() {
-  return;
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+
+    createTestData();
+
+    final Organization org = OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID);
+    final OBCriteria<Greeting> obc = OBDal.getInstance().createCriteria(Greeting.class);
+    obc.setFilterOnReadableClients(false);
+    obc.setFilterOnReadableOrganization(false);
+    obc.add(Expression.eq(PROPERTY_ORGANIZATION, org));
+    // assertEquals(7, obc.list().size());
+    for (final Greeting g : obc.list()) {
+      OBDal.getInstance().remove(g);
+    }
   }
 
   /**
    * Checks that the testdata was indeed removed.
    */
   public void test5Greeting() {
-  return;
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+
+    createTestData();
+
+    final Organization org = OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID); // FIXME
+    final OBCriteria<Greeting> obc = OBDal.getInstance().createCriteria(Greeting.class);
+    obc.setFilterOnReadableClients(false);
+    obc.setFilterOnReadableOrganization(false);
+    obc.add(Expression.eq(PROPERTY_ORGANIZATION, org));
+    assertEquals(0, obc.list().size());
   }
 
   /**
    * Same test as before exporting and then importing in same organization.
    */
   public void test6Greeting() {
-  return;
+    doTestNoChange(Greeting.class);
   }
 
   // do it again, no change!
   private <T extends BaseOBObject> void doTestNoChange(Class<T> clz) {
-  return;
+    setTestUserContext();
+    addReadWriteAccess(Greeting.class);
+
+    createTestData();
+
+    final String xml = getXML(clz);
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(
+        OBContext.getOBContext().getCurrentClient(),
+        OBContext.getOBContext().getCurrentOrganization(), xml);
+    assertTrue(ir.getInsertedObjects().size() == 0);
+    assertTrue(ir.getUpdatedObjects().size() == 0);
   }
 
   private void createTestData() {
-  return;
+    final List<Greeting> greetings = OBDal.getInstance().createQuery(Greeting.class, "").list();
+    if (greetings.size() > 0) {
+      DATA_SET_SIZE = greetings.size();
+      return;
+    }
+
+    for (int i = 0; i < DATA_SET_SIZE; i++) {
+      final Greeting greeting = OBProvider.getInstance().get(Greeting.class);
+      greeting.setDefault(i == 0);
+      greeting.setName("Greeting " + i);
+      greeting.setOnlyPrintFirstName((i % 2) == 0);
+      greeting.setTitle("Greeting " + i);
+      OBDal.getInstance().save(greeting);
+    }
+    OBDal.getInstance().commitAndClose();
+
   }
-}
+}
\ No newline at end of file
--- a/src-test/org/openbravo/test/xml/EntityXMLImportTestWarning.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-test/org/openbravo/test/xml/EntityXMLImportTestWarning.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -46,7 +46,42 @@
    * because of access definitions for the user.
    */
   public void testNotWritableUpdate() {
-  return;
+    cleanRefDataLoaded();
+    setTestUserContext();
+    addReadWriteAccess(Region.class);
+
+    final List<Region> gs = getList(Region.class);
+    String xml = getXML(gs);
+
+    // change the xml to force an update
+    xml = xml.replaceAll("</name>", "t</name>");
+
+    final Client c = OBDal.getInstance().get(Client.class, TEST_CLIENT_ID);
+    final Organization o = OBDal.getInstance().get(Organization.class, TEST_ORG_ID);
+    setTestUserContext();
+    OBContext.getOBContext().setCurrentOrganization(o);
+    OBContext.getOBContext().setCurrentClient(c);
+
+    // remove the entity to force a not-write situation
+    final Entity entity = ModelProvider.getInstance().getEntity(Region.class);
+    OBContext.getOBContext().getEntityAccessChecker().getWritableEntities().remove(entity);
+    OBContext.getOBContext().getEntityAccessChecker().getReadableEntities().add(entity);
+
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(c, o, xml);
+    if (ir.getException() != null) {
+      ir.getException().printStackTrace(System.err);
+      fail(ir.getException().getMessage());
+    } else if (ir.getErrorMessages() != null) {
+      fail(ir.getErrorMessages());
+    } else {
+      // assertEquals(0, ir.getUpdatedObjects().size());
+      // assertEquals(0, ir.getUpdatedObjects().size());
+      assertTrue(ir.getWarningMessages() != null);
+      assertTrue(ir.getWarningMessages().indexOf("updating") != -1);
+      assertTrue(ir.getWarningMessages().indexOf(" because it is not writable") != -1);
+    }
+    // force a rollback, so that the db is not changed
+    rollback();
   }
 
   /**
@@ -54,7 +89,30 @@
    * it (because of access definitions).
    */
   public void testNotWritableInsertError() {
-    return;
+    cleanRefDataLoaded();
+    setTestUserContext();
+    addReadWriteAccess(Warehouse.class);
+
+    final List<Warehouse> ws = getList(Warehouse.class);
+    String xml = getXML(ws);
+
+    // change the xml to force an update
+    xml = xml.replaceAll("</name>", "t</name>");
+    xml = xml.replaceAll("</id>", "new</id>");
+    final Client c = OBDal.getInstance().get(Client.class, QA_TEST_CLIENT_ID);
+    final Organization o = OBDal.getInstance().get(Organization.class, QA_TEST_ORG_ID);
+    setUserContext(QA_TEST_ADMIN_USER_ID);
+
+    // remove the entity from the writable entities to force an access error
+    final Entity entity = ModelProvider.getInstance().getEntity(Warehouse.class);
+    OBContext.getOBContext().getEntityAccessChecker().getWritableEntities().remove(entity);
+
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(c, o, xml);
+    assertTrue("No error messages, error messages expected", ir.getErrorMessages() != null);
+    assertTrue("Incorrect error", ir.getErrorMessages().indexOf("Object Warehouse") != -1);
+    assertTrue("Incorrect error", ir.getErrorMessages().indexOf("is new but not writable") != -1);
+    // force a rollback, so that the db is not changed
+    rollback();
   }
 
   /**
@@ -63,7 +121,33 @@
    * * (0), while the update/import is in another organization.
    */
   public void testUpdatingOtherOrganizationWarning() {
-  return;
+    cleanRefDataLoaded();
+    setTestUserContext();
+    addReadWriteAccess(Warehouse.class);
+
+    final List<Warehouse> ws = getList(Warehouse.class);
+    String xml = getXML(ws);
+
+    // change the xml to force an update
+    xml = xml.replaceAll("</name>", "t</name>");
+    xml = xml.replaceAll("</id>", "new</id>");
+    setSystemAdministratorContext();
+    final ImportResult ir = DataImportService.getInstance().importDataFromXML(
+        OBDal.getInstance().get(Client.class, TEST_CLIENT_ID),
+        OBDal.getInstance().get(Organization.class, "B9C7088AB859483A9B1FB342AC2BE17A"), xml); // FIXME
+    if (ir.getException() != null) {
+      ir.getException().printStackTrace(System.err);
+      fail(ir.getException().getMessage());
+    } else if (ir.getErrorMessages() != null) {
+      fail(ir.getErrorMessages());
+    } else {
+      assertTrue(ir.getWarningMessages() != null);
+      assertTrue(ir.getWarningMessages().indexOf("Updating entity") != -1);
+      assertTrue(ir.getWarningMessages().indexOf(
+          "eventhough it does not belong to the target organization ") != -1);
+    }
+    // force a rollback, so that the db is not changed
+    rollback();
   }
 
   // // works also but disabled for now
@@ -131,4 +215,4 @@
   // rollback();
   // }
 
-}
+}
\ No newline at end of file
--- a/src-wad/src/org/openbravo/wad/Configuration_Relation.xmlxml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Configuration_Relation.xmlxml	Tue Mar 08 16:19:56 2011 +0100
@@ -51,6 +51,7 @@
 <PARAMETER_TMP id="sectionParent">
 <PARAMETER id="paramParentxx" name="parent" default=""/></PARAMETER_TMP>
 <PARAMETER_TMP id="relationControl"></PARAMETER_TMP>
+<PARAMETER id="related_info_cont" name="parentFieldName"/> 
 
 <DISCARD id="discard"/>
 </REPORT>
--- a/src-wad/src/org/openbravo/wad/Fields_data.xsql	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Fields_data.xsql	Tue Mar 08 16:19:56 2011 +0100
@@ -36,7 +36,7 @@
         isParent, '' as ACCESSLEVEL, ad_field.isreadonly, '' as issecondarykey, ad_field.showInRelation, ad_column.isEncrypted,
         ad_field.SORTNO, ad_column.istranslated, '' as id, '' as htmltext, '' as htmltexttrl, '' as xmltexttrl, '' as tablenametrl, 
         0 AS NOWRAP, ad_column.isEncrypted AS isColumnEncrypted, ad_column.isDesencryptable, ad_reference_value_id, ad_column.ad_val_rule_id, '' AS isjasper, ad_field.isactive, '' as AD_Tab_ID, '' as parent_tab_name, '' as orgcode,
-        '' as tableModule, '' as columnModule, '' as clientcode, '' as isautosave
+        '' as tableModule, '' as columnModule, '' as clientcode, '' as isautosave, '' as ad_field_id
       FROM ad_column left join ad_element on ad_column.ad_element_id = ad_element.ad_element_id,
            ad_field,  ad_table
       WHERE ad_field.ad_column_id = ad_column.ad_column_id 
@@ -102,7 +102,7 @@
   <SqlMethod name="parentsColumnNameSortTab" type="preparedStatement" return="multiple">
       <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
       <Sql><![CDATA[
-        SELECT ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
+        SELECT AD_FIELD.AD_FIELD_ID, ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
         (SELECT tableNAME FROM AD_TABLE, AD_TAB WHERE AD_TABLE.ad_table_id = AD_TAB.ad_table_id
         AND AD_TAB.ad_tab_id=?) AS tablename,
         (SELECT P.ad_module_id FROM AD_TABLE T, AD_PACKAGE P WHERE T.ad_table_id = AD_COLUMN.ad_table_id AND T.AD_PACKAGE_ID = P.AD_PACKAGE_ID) as tableModule,
@@ -118,7 +118,7 @@
   <SqlMethod name="parentsColumnName" type="preparedStatement" return="multiple">
       <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
       <Sql><![CDATA[
-        SELECT ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
+        SELECT AD_FIELD.AD_FIELD_ID, ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
         (SELECT tableNAME FROM AD_TABLE, AD_TAB WHERE AD_TABLE.ad_table_id = AD_TAB.ad_table_id
         AND AD_TAB.ad_tab_id=?) AS tablename, ? as AD_Tab_ID, (select name from ad_tab where ad_tab_id = ?) as parent_tab_name,
         (SELECT P.ad_module_id FROM AD_TABLE T, AD_PACKAGE P WHERE T.ad_table_id = AD_COLUMN.ad_table_id AND T.AD_PACKAGE_ID = P.AD_PACKAGE_ID) as tableModule,
@@ -139,7 +139,7 @@
   <SqlMethod name="parentsColumnReal" type="preparedStatement" return="multiple">
       <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
       <Sql>
-        SELECT ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
+        SELECT AD_FIELD.AD_FIELD_ID, ColumnName AS NAME, AD_REFERENCE_id AS reference, ad_reference_value_id AS referencevalue,
         (SELECT tableNAME FROM AD_TABLE, AD_TAB WHERE AD_TABLE.ad_table_id = AD_TAB.ad_table_id
         AND AD_TAB.ad_tab_id=?) AS tablename,
         (SELECT P.ad_module_id FROM AD_TABLE T, AD_PACKAGE P WHERE T.ad_table_id = AD_COLUMN.ad_table_id AND T.AD_PACKAGE_ID = P.AD_PACKAGE_ID) as tableModule,
@@ -163,54 +163,6 @@
       <Parameter name="parentTab"/>
       <Parameter name="parentTab"/>
   </SqlMethod>
-
-  <SqlMethod name="parentsColumnDisplayNameSortTab" type="preparedStatement" return="multiple">
-      <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
-      <Sql><![CDATA[
-        SELECT ad_field.name As Name, ad_field_trl.name as columnname 
-          FROM ad_field left join ad_field_trl on ad_field.ad_field_id = ad_field_trl.ad_field_id 
-                                              and ad_field_trl.ad_language = ?, 
-               ad_column 
-        WHERE ad_field.ad_column_id = ad_column.ad_column_id 
-        and ad_table_id = ? and isParent='Y' 
-      ]]></Sql>
-      <Parameter name="adLanguage"/>
-      <Parameter name="table"/>
-  </SqlMethod>
-  <SqlMethod name="parentsColumnDisplayName" type="preparedStatement" return="multiple">
-      <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
-      <Sql><![CDATA[
-        SELECT ad_field.name As Name, ad_field_trl.name as columnname 
-          FROM ad_field left join ad_field_trl on ad_field.ad_field_id = ad_field_trl.ad_field_id 
-                                              and ad_field_trl.ad_language = ?, 
-               ad_column 
-        WHERE ad_field.ad_column_id = ad_column.ad_column_id 
-        and ad_tab_id = ? and isParent='Y' 
-        and exists(select 1 from ad_column c, ad_field f where c.ad_column_id = f.ad_column_id and c.iskey='Y'
-        and ad_tab_id=? and UPPER(c.columnname) = UPPER(ad_column.columnname))
-      ]]></Sql>
-      <Parameter name="adLanguage"/>
-      <Parameter name="tab"/>
-      <Parameter name="parentTab"/>
-  </SqlMethod>
-  <SqlMethod name="parentsColumnDisplayNameReal" type="preparedStatement" return="multiple">
-      <SqlMethodComment>Name of the columns parent of the tab</SqlMethodComment>
-      <Sql>
-        SELECT ad_field.Name AS NAME, AD_FIELD_TRL.NAME AS COLUMNNAME
-        FROM AD_FIELD left join AD_FIELD_TRL on AD_FIELD.AD_FIELD_ID = AD_FIELD_TRL.AD_FIELD_ID
-                                            AND AD_FIELD_TRL.AD_LANGUAGE = ? , 
-             AD_COLUMN 
-        WHERE AD_FIELD.ad_column_id = AD_COLUMN.ad_column_id 
-        AND ad_tab_id = ?
-        AND UPPER(columnname) IN (SELECT UPPER(columnname) FROM AD_FIELD, AD_COLUMN 
-        WHERE AD_FIELD.ad_column_id = AD_COLUMN.ad_column_id 
-        AND AD_COLUMN.iskey='Y' 
-        AND AD_FIELD.ad_tab_id=?)
-      </Sql>
-      <Parameter name="adLanguage"/>
-      <Parameter name="tab"/>
-      <Parameter name="parentTab"/>
-  </SqlMethod>
  
   <SqlMethod name="tableName" type="preparedStatement" return="string">
       <SqlMethodComment>Name of the table of the tab</SqlMethodComment>
--- a/src-wad/src/org/openbravo/wad/Template_Relation.html	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Template_Relation.html	Tue Mar 08 16:19:56 2011 +0100
@@ -13,7 +13,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -288,7 +288,7 @@
                 <div class="RelationInfoContainer">
                   <table class="RelationInfo">
                     <tr>
-                      <td class="RelationInfoTitle" id="related_info_cont"><FIELD_TMP id="fieldParentKeyNameDescription">xx</FIELD_TMP>:</td>
+                      <td class="RelationInfoTitle"><span id="related_info_cont">xx</span>:</td>
                       <td class="RelationInfoContent" id="paramParentxx">Parent name</td>
                     </tr>
                   </table>
--- a/src-wad/src/org/openbravo/wad/Template_Relation.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Template_Relation.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2006 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -40,7 +40,6 @@
 <PARAMETER id="fieldhiddenKeyName" name="key" default=" " attribute="value"/>
 <PARAMETER id="keyParent" name="keyParent" attribute="name"/>
 <PARAMETER id="paramParentxx" name="parentKeyName" attribute="id" replace="xx" default=""/>
-<PARAMETER id="fieldParentKeyNameDescription" name="parentKeyNameDescription" default=""/>
 
 <DISCARD id="discard"/>
 </REPORT>
--- a/src-wad/src/org/openbravo/wad/Wad.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/Wad.java	Tue Mar 08 16:19:56 2011 +0100
@@ -837,27 +837,18 @@
       if (allTabs != null && allTabs.length > 0)
         parentTabIndex = parentTabId(allTabs, tabsData.tabid);
       FieldsData[] parentsFieldsData = null;
-      FieldsData[] parentsFieldsNameData = null;
+
       if (tabsData.issorttab.equals("Y")) {
         parentsFieldsData = FieldsData.parentsColumnNameSortTab(pool,
             (parentTabIndex != -1 ? allTabs[parentTabIndex].tabid : ""), tabsData.tableId);
-        parentsFieldsNameData = FieldsData.parentsColumnDisplayNameSortTab(pool, "",
-            tabsData.tableId);
       } else {
         parentsFieldsData = FieldsData.parentsColumnName(pool,
             (parentTabIndex != -1 ? allTabs[parentTabIndex].tabid : ""), tabsData.tabid);
-        parentsFieldsNameData = FieldsData.parentsColumnDisplayName(pool, "", tabsData.tabid,
-            (parentTabIndex != -1 ? allTabs[parentTabIndex].tabid : ""));
       }
-      String strParentNameDescription = (parentsFieldsNameData == null || parentsFieldsNameData.length == 0) ? ""
-          : parentsFieldsNameData[0].name;
+
       if (parentTabIndex != -1 && (parentsFieldsData == null || parentsFieldsData.length == 0)) {
         parentsFieldsData = FieldsData.parentsColumnReal(pool, allTabs[parentTabIndex].tabid,
             tabsData.tabid);
-        parentsFieldsNameData = FieldsData.parentsColumnDisplayNameReal(pool, "", tabsData.tabid,
-            allTabs[parentTabIndex].tabid);
-        strParentNameDescription = (parentsFieldsNameData == null || parentsFieldsNameData.length == 0) ? ""
-            : parentsFieldsNameData[0].name;
         sinParent = true;
         if (parentsFieldsData == null || parentsFieldsData.length == 0) {
           log4j.warn("No key found in parent tab: " + allTabs[parentTabIndex].tabname);
@@ -1043,7 +1034,7 @@
          *************************************************/
         processTabHtmlSortTab(parentsFieldsData, fileDir, tabsData.tabid, tabName,
             tabsData.realwindowname, keyColumnName, tabNamePresentation, allTabs, strProcess,
-            strDirectPrint, strParentNameDescription, windowName, "");
+            strDirectPrint, windowName, "");
       } else {
         /************************************************
          * JAVA
@@ -1082,8 +1073,8 @@
          * HTML in Relation view
          *************************************************/
         processTabHtmlRelation(parentsFieldsData, fileDir, tabsData.tabid, tabName, keyColumnName,
-            tabsData.uipattern.equals("RO"), strParentNameDescription, gridControl, false, "",
-            tabNamePresentation, tabsData.tableId, tabsData.accesslevel);
+            tabsData.uipattern.equals("RO"), gridControl, false, "", tabNamePresentation,
+            tabsData.tableId, tabsData.accesslevel);
 
         /************************************************
          * XML in Edition view
@@ -1744,6 +1735,7 @@
 
       xmlDocument.setParameter("parentTab", parentsFieldsData[0].adTabId);
       xmlDocument.setParameter("parentTabName", parentsFieldsData[0].parentTabName);
+      xmlDocument.setParameter("parentFieldID", parentsFieldsData[0].adFieldId);
     }
     xmlDocument.setParameter("keyData", Sqlc.TransformaNombreColumna(keyColumnName));
     xmlDocument.setParameter("table", tableName);
@@ -1764,19 +1756,32 @@
     // UI Patter for edition toolbar
     xmlDocument.setParameter("uiPattern", uiPattern);
 
-    String strHighVolume = "", strParamHighVolume = "", strHighVolumeComp = "";
+    String strParamHighVolume = "", strHighVolumeComp = "";
+
+    String internalFilter = "(tableSQL.hasInternalFilter()";
+    String filter1 = "";
+    String filter2 = "";
 
     if (selCol != null) {
       for (int i = 0; i < selCol.length; i++) {
-        strHighVolume += selCol[i].htmltext;
+        if (filter1.isEmpty()) {
+          internalFilter += " && ";
+        } else {
+          filter1 += " && ";
+        }
+        filter1 += "(\"\").equals(strParam" + selCol[i].columnname + ")";
+        filter2 += " || !((\"\").equals(strParam" + selCol[i].columnname
+            + ") || (\"%\").equals(strParam" + selCol[i].columnname + ")) ";
+
         strParamHighVolume += "String strParam" + selCol[i].columnname
-            + " = vars.getSessionValue(tabId + \"|param" + selCol[i].columnname + "\");\n";
+
+        + " = vars.getSessionValue(tabId + \"|param" + selCol[i].columnname + "\");\n";
         strHighVolumeComp += selCol[i].xmltext;
-        if (i < selCol.length - 1)
-          strHighVolume += " && ";
       }
     }
-    xmlDocument.setParameter("searchName", strHighVolume);
+
+    xmlDocument.setParameter("searchName", internalFilter + filter1 + ")" + filter2);
+    xmlDocument.setParameter("searchNameHighVolume", filter1);
     xmlDocument.setParameter("searchVariables", strParamHighVolume);
     xmlDocument.setParameter("searchComparations", strHighVolumeComp);
 
@@ -3344,9 +3349,8 @@
    */
   private void processTabHtmlSortTab(FieldsData[] parentsFieldsData, File fileDir, String strTab,
       String tabName, String windowName, String keyColumnName, String tabNamePresentation,
-      TabsData[] allTabs, String strProcess, String strDirectPrint,
-      String strParentNameDescription, String WindowPathName, String strLanguage)
-      throws ServletException, IOException {
+      TabsData[] allTabs, String strProcess, String strDirectPrint, String WindowPathName,
+      String strLanguage) throws ServletException, IOException {
     log4j.debug("Procesig relation sort tab html: " + strTab + ", " + tabName);
     XmlDocument xmlDocumentRHtml;
     final String[] discard = new String[3];
@@ -3432,8 +3436,6 @@
    *          Name of the tab's key column.
    * @param isreadonly
    *          Boolean that means if is a read only tab or not.
-   * @param strParentNameDescription
-   *          The human description of the parent tab.
    * @param control
    *          Object of type WADGrid control.
    * @param isTranslated
@@ -3448,9 +3450,9 @@
    * @throws IOException
    */
   private void processTabHtmlRelation(FieldsData[] parentsFieldsData, File fileDir, String strTab,
-      String tabName, String keyColumnName, boolean isreadonly, String strParentNameDescription,
-      WADControl control, boolean isTranslated, String adLanguage, String tabNamePresentation,
-      String strTable, String accessLevel) throws ServletException, IOException {
+      String tabName, String keyColumnName, boolean isreadonly, WADControl control,
+      boolean isTranslated, String adLanguage, String tabNamePresentation, String strTable,
+      String accessLevel) throws ServletException, IOException {
     log4j.debug("Procesig relation html" + (isTranslated ? " translated" : "") + ": " + strTab
         + ", " + tabName);
     final String[] discard = new String[1];
@@ -3473,7 +3475,6 @@
     if (parentsFieldsData.length > 0) {
       xmlDocument.setParameter("keyParent", "inp"
           + Sqlc.TransformaNombreColumna(parentsFieldsData[0].name));
-      xmlDocument.setParameter("parentKeyNameDescription", strParentNameDescription);
       xmlDocument.setParameter("parentKeyName", parentsFieldsData[0].name);
     }
     xmlDocument.setParameter("importCSS", getVectorElementsNotRepeated(control.getCSSImport(),
--- a/src-wad/src/org/openbravo/wad/controls/WADGrid.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/controls/WADGrid.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2008 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -98,11 +98,15 @@
     addJSCode("onGridLoadDo", text.toString());
 
     text = new StringBuffer();
-    text.append("function setGridFilters(newparams) {\n" + "  var params = [];\n"
-        + "  params[\"newFilter\"] = \"1\";\n" + "  if (newparams!=null && newparams.length>0) {\n"
+    text.append("function setGridFilters(newparams) {\n"
+        + "  var params = [], hasFilter = false;\n" + "  params[\"newFilter\"] = \"1\";\n"
+        + "  if (newparams!=null && newparams.length>0) {\n"
         + "    var total = newparams.length;\n" + "    for (var i=0;i<total;i++) {\n"
-        + "      params[newparams[i][0]] = newparams[i][1];\n" + "    }\n" + "  }\n");
+        + "      params[newparams[i][0]] = newparams[i][1];\n"
+        + "      hasFilter = hasFilter || (newparams[i][1] !== '' && newparams[i][1] !== '%');\n"
+        + "    }\n" + "  }\n");
     text.append("  dijit.byId('").append(getData("id")).append("').setRequestParams(params);\n");
+    text.append("  changeSearchIcon(hasFilter);\n");
     text.append("  return true;\n");
     text.append('}');
     addJSCode("setGridFilters", text.toString());
--- a/src-wad/src/org/openbravo/wad/javasource.javaxml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/javasource.javaxml	Tue Mar 08 16:19:56 2011 +0100
@@ -851,7 +851,7 @@
     <PARAMETER_TMP id="paramSearchVariables">xx</PARAMETER_TMP>
     boolean hasSearchCondition=false;
     vars.removeEditionData(tabId);
-    <FIELDS_TMP id="sectionIsHighVolume4">if (!(<PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>)) hasSearchCondition=true;</FIELDS_TMP>
+    <FIELDS_TMP id="sectionIsHighVolume4">hasSearchCondition = <PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>;</FIELDS_TMP>
     String strOffset = vars.getSessionValue(tabId + "|offset");
     String selectedRow = "0";
     if (!str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>.equals("")) {
@@ -871,7 +871,9 @@
     toolbar.prepareRelationTemplate<PARAMETER_TMP id="sameParent">NoSearch</PARAMETER_TMP>("<PARAMETER_TMP id="paramHasTree">hasTree</PARAMETER_TMP>".equals("Y"), hasSearchCondition, !vars.getSessionValue("#ShowTest", "N").equals("Y"), <PARAMETER_TMP id="paramIsReadOnly">readonly</PARAMETER_TMP>, Utility.getContext(this, vars, "ShowAudit", windowId).equals("Y"));
     xmlDocument.setParameter("toolbar", toolbar.toString());
 
-<PARAMETER_TMP id="parent">    xmlDocument.setParameter("keyParent", strP<PARENT_TMP id="keyParent">Almacen</PARENT_TMP>);</PARAMETER_TMP>
+<PARAMETER_TMP id="parent">    xmlDocument.setParameter("keyParent", strP<PARENT_TMP id="keyParent">Almacen</PARENT_TMP>);
+    xmlDocument.setParameter("parentFieldName", Utility.getFieldName("<PARENT_TMP id="parentFieldID">xx</PARENT_TMP>", vars.getLanguage()));
+</PARAMETER_TMP>
 
     StringBuffer orderByArray = new StringBuffer();
       vars.setSessionValue(tabId + "|newOrder", "1");
@@ -973,7 +975,7 @@
     vars.removeEditionData(tabId);
     <PARAMETER_TMP id="paramSearchVariables">xx</PARAMETER_TMP>
     boolean hasSearchCondition=false;
-    <FIELDS_TMP id="sectionIsHighVolume4">if (!(<PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>)) hasSearchCondition=true;</FIELDS_TMP>
+    <FIELDS_TMP id="sectionIsHighVolume4">hasSearchCondition = <PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP>;</FIELDS_TMP>
 
 <PARAMETER_TMP id="sectionIsHighVolume4">       String strParamSessionDate = vars.getGlobalVariable("inpParamSessionDate", Utility.getTransactionalDate(this, vars, windowId), "");</PARAMETER_TMP>
       String buscador = "";
@@ -984,7 +986,7 @@
       if (!boolNew) {
         discard[0] = new String("newDiscard");
         <PARAMETER_TMP id="sectionIsHighVolume"><FIELDS_TMP id="sectionIsHighVolume4">
-        if (<PARAMETER_TMP id="paramSearchName">xx</PARAMETER_TMP> &amp;&amp; str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>.equals("")) {
+        if (<PARAMETER_TMP id="paramSearchNameHighVolume">xx</PARAMETER_TMP> &amp;&amp; str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>.equals("")) {
           buscador = "openSearchWindow('../businessUtility/Buscador.html', 'BUSCADOR', " + tabId + ", '<PARAMETER_TMP id="windowName">Window</PARAMETER_TMP>/<PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>_Relation.html', " + windowId + ");";
         } else if (str<KEY_TMP id="key">PosicionAlmacen</KEY_TMP>.equals("")) {
           <PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>Data[] data1 = <PARAMETER_TMP id="class">Almacen</PARAMETER_TMP>Data.select(this, vars.getSessionValue("#AD_SqlDateTimeFormat"), vars.getLanguage()<PARAMETER_TMP id="whereClauseParams"></PARAMETER_TMP><FIELDS_TMP id="isTransactional">, strParamTransaccional</FIELDS_TMP><FIELDS_TMP id="sectionFilter">, strParamFilter</FIELDS_TMP><PARAMETER_TMP id="sectionIsHighVolume2Edit">, strParam<PARAMETER_TMP id="searchName2Edit">xx</PARAMETER_TMP></PARAMETER_TMP><PARAMETER_TMP id="sectionIsHighVolume4">, strParamSessionDate, vars.getUser()</PARAMETER_TMP><PARAMETER_TMP id="client">, Utility.getContext(this, vars, "#User_Client", windowId, accesslevel)</PARAMETER_TMP><PARAMETER_TMP id="org">, Utility.getContext(this, vars, "#AccessibleOrgTree", windowId, accesslevel)</PARAMETER_TMP><PARAMETER_TMP id="parent">, strP<PARENT_TMP id="keyParent">Almacen</PARENT_TMP></PARAMETER_TMP>, strOrderByFilter);
--- a/src-wad/src/org/openbravo/wad/javasource.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src-wad/src/org/openbravo/wad/javasource.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -12,7 +12,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -23,6 +23,7 @@
 <REPORT>
 <template file="javasource.javaxml" />
 <PARAMETER id="paramSearchName" name="searchName" default=""/>
+<PARAMETER id="paramSearchNameHighVolume" name="searchNameHighVolume" default=""/>
 <PARAMETER id="paramSearchVariables" name="searchVariables" default=""/>
 <PARAMETER id="paramSearchComparations" name="searchComparations" default=""/>
 <PARAMETER id="relationControl" name="relationControl" default=""/>
@@ -37,6 +38,7 @@
   <PARAMETER id="windowName" name = "windowName" default=" "/>
   <PARAMETER id="key" name = "key" default=" "/>
   <PARAMETER id="keyParent" name = "keyParent" default=" "/>
+  <PARAMETER id="parentFieldID" name = "parentFieldID" default=""/>
   <PARAMETER id="keyParentT" name = "keyParentT" default=" "/>
   <PARAMETER id="keyParentSimple" name = "keyParentSimple" default=" "/>
   <PARAMETER id="parentTab" name = "parentTab" default=" "/>
--- a/src/index.jsp	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/index.jsp	Tue Mar 08 16:19:56 2011 +0100
@@ -57,7 +57,7 @@
 <meta name="keywords" content="openbravo">
 <meta name="description" content="Openbravo S.L.U.">
 <link rel="shortcut icon" href="./web/images/favicon.ico" />
-<link rel="stylesheet" type="text/css" href="./org.openbravo.client.kernel/OBCLKER_Kernel/StyleSheetResources?_mode=3.00&&_skinVersion=3.00"/>
+<link rel="stylesheet" type="text/css" href="./org.openbravo.client.kernel/OBCLKER_Kernel/StyleSheetResources?_mode=3.00&_skinVersion=3.00"/>
 <title>Openbravo</title>
 <script type="text/javascript" src="./web/org.openbravo.client.kernel/js/LAB.min.js"></script>
 <!-- styles used during loading -->
--- a/src/org/openbravo/base/model/ModelProvider.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/base/model/ModelProvider.java	Tue Mar 08 16:19:56 2011 +0100
@@ -292,9 +292,7 @@
     ConnectionProviderImpl con = null;
     Connection connection = null;
     try {
-      con = new ConnectionProviderImpl(OBPropertiesProvider.getInstance().getOpenbravoProperties()
-          .getProperty("source.path")
-          + "/config/Openbravo.properties");
+      con = new ConnectionProviderImpl(OBPropertiesProvider.getInstance().getOpenbravoProperties());
       connection = con.getConnection();
       PreparedStatement ps = connection
           .prepareStatement("select distinct model_impl from ad_reference where model_impl is not null");
--- a/src/org/openbravo/base/session/OBOracle10gDialect.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/base/session/OBOracle10gDialect.java	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2008 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -24,6 +24,7 @@
 import org.apache.log4j.Logger;
 import org.hibernate.Hibernate;
 import org.hibernate.dialect.Oracle10gDialect;
+import org.hibernate.dialect.function.StandardSQLFunction;
 
 /**
  * Extends the Oracle10Dialect to replace some java-oracle type mappings to support the current rdb
@@ -43,8 +44,9 @@
     registerColumnType(Types.VARCHAR, 4000, "nvarchar2($l)");
     registerColumnType(Types.VARCHAR, 100, "varchar2($l)");
     registerColumnType(Types.VARCHAR, 5, "char($l)");
+    registerFunction("to_number", new StandardSQLFunction("to_number", Hibernate.BIG_DECIMAL));
 
     log.debug("Created Openbravo specific Oracle DIalect");
   }
 
-}
\ No newline at end of file
+}
--- a/src/org/openbravo/dal/security/EntityAccessChecker.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/dal/security/EntityAccessChecker.java	Tue Mar 08 16:19:56 2011 +0100
@@ -258,7 +258,8 @@
   private void addDerivedReadableIdentifierProperties(Entity entity) {
     for (final Property p : entity.getProperties()) {
       if (p.isIdentifier() && p.getTargetEntity() != null
-          && !readableEntities.contains(p.getTargetEntity())) {
+          && !readableEntities.contains(p.getTargetEntity())
+          && !derivedReadableEntities.contains(p.getTargetEntity())) {
         derivedReadableEntities.add(p.getTargetEntity());
         addDerivedReadableIdentifierProperties(p.getTargetEntity());
       }
--- a/src/org/openbravo/dal/service/OBDal.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/dal/service/OBDal.java	Tue Mar 08 16:19:56 2011 +0100
@@ -95,6 +95,10 @@
     SessionHandler.getInstance().getSession().disableFilter("activeFilter");
   }
 
+  public boolean isActiveFilterEnabled() {
+    return SessionHandler.getInstance().getSession().getEnabledFilter("activeFilter") != null;
+  }
+
   /**
    * Returns the connection used by the hibernate session.
    * 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/dal/service/OBDao.java	Tue Mar 08 16:19:56 2011 +0100
@@ -0,0 +1,108 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2011 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.dal.service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.commons.lang.StringUtils;
+import org.hibernate.criterion.Criterion;
+import org.openbravo.base.structure.BaseOBObject;
+
+/**
+ * Util class for DAL
+ * 
+ * @author gorkaion
+ * 
+ */
+public class OBDao {
+
+  /**
+   * Generic OBCriteria.
+   * 
+   * @param clazz
+   *          Class (entity).
+   * @param constraints
+   *          List of hibernate Criterion instances which are used as filters
+   * @return An OBCriteria object with the constraints.
+   */
+  public static <T extends BaseOBObject> OBCriteria<T> getFilteredCriteria(Class<T> clazz,
+      Criterion... constraints) {
+    OBCriteria<T> obc = OBDal.getInstance().createCriteria(clazz);
+    for (Criterion c : constraints) {
+      obc.add(c);
+    }
+    return obc;
+  }
+
+  /**
+   * Returns a List of BaseOBOBjects of the Property identified by the property from the
+   * BaseOBObject obj. This method enables the activeFilter so inactive BaseOBObjects are not
+   * included on the returned List.
+   * 
+   * @param obj
+   *          BaseOBObject from which the values are requested
+   * @param property
+   *          the name of the Property for which the value is requested
+   * @return
+   */
+  @SuppressWarnings("unchecked")
+  public static <T extends BaseOBObject> List<T> getActiveOBObjectList(BaseOBObject obj,
+      String property) {
+    boolean isActiveFilterEnabled = OBDal.getInstance().isActiveFilterEnabled();
+    if (!isActiveFilterEnabled) {
+      OBDal.getInstance().enableActiveFilter();
+    }
+    try {
+      return (List<T>) obj.get(property);
+    } finally {
+      if (!isActiveFilterEnabled) {
+        OBDal.getInstance().disableActiveFilter();
+      }
+    }
+  }
+
+  /**
+   * Parses the string of comma separated id's to return a List with the BaseOBObjects of the given
+   * class. If there is an invalid id a null value is added to the List.
+   * 
+   * @param t
+   *          class of the BaseOBObject the id's belong to
+   * @param _IDs
+   *          String containing the comma separated list of id's
+   * @return a List object containing the parsed OBObjects
+   */
+  public static <T extends BaseOBObject> List<T> getOBObjectListFromString(Class<T> t, String _IDs) {
+    String strBaseOBOBjectIDs = _IDs;
+    final List<T> baseOBObjectList = new ArrayList<T>();
+    if (strBaseOBOBjectIDs.startsWith("(")) {
+      strBaseOBOBjectIDs = strBaseOBOBjectIDs.substring(1, strBaseOBOBjectIDs.length() - 1);
+    }
+    if (!strBaseOBOBjectIDs.equals("")) {
+      strBaseOBOBjectIDs = StringUtils.remove(strBaseOBOBjectIDs, "'");
+      StringTokenizer st = new StringTokenizer(strBaseOBOBjectIDs, ",", false);
+      while (st.hasMoreTokens()) {
+        String strBaseOBObjectID = st.nextToken().trim();
+        baseOBObjectList.add((T) OBDal.getInstance().get(t, strBaseOBObjectID));
+      }
+    }
+    return baseOBObjectList;
+  }
+}
--- a/src/org/openbravo/erpCommon/ad_actionButton/ChangeProjectStatus.html	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ChangeProjectStatus.html	Tue Mar 08 16:19:56 2011 +0100
@@ -11,7 +11,7 @@
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
-* All portions are Copyright (C) 2001-2009 Openbravo SLU 
+* All portions are Copyright (C) 2001-2011 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
@@ -46,7 +46,7 @@
       }
 
       function closeThisPage() {
-        parent.window.close();
+        closePage();
         return true;
       }
 
@@ -54,7 +54,7 @@
       }
 
       function submitThisPage(strCommand) {
-        submitCommandForm(strCommand, false, null, null, '_top');
+        submitCommandForm(strCommand, false, null, null);
         return true;
       }
     </script>
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Tue Mar 08 16:19:56 2011 +0100
@@ -310,11 +310,8 @@
                 && account.getClearedPaymentAccountOUT() != null)
               confirmation = true;
           }
-          // For payments with Amount ZERO which consumes credit always create an entry for the
-          // consumption as no transaction will be created
-          if (payment.getGeneratedCredit().compareTo(ZERO) == 0
-              && payment.getUsedCredit().compareTo(ZERO) != 0
-              && payment.getAmount().compareTo(ZERO) == 0) {
+          // For payments with Amount ZERO always create an entry as no transaction will be created
+          if (payment.getAmount().compareTo(ZERO) == 0) {
             confirmation = true;
           }
         }
--- a/src/org/openbravo/erpCommon/ad_help/DisplayHelp.html	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_help/DisplayHelp.html	Tue Mar 08 16:19:56 2011 +0100
@@ -36,10 +36,16 @@
 </head>
   <script language="JavaScript" type="text/javascript">
     function onLoadDo() {
-      this.windowTables = new Array(
-        new windowTableId('clientIndex'),
-        new windowTableId('client')
-      );
+      if (document.getElementById('clientIndex').getElementsByTagName('a').length === 0) {
+        this.windowTables = new Array(
+          new windowTableId('client')
+        );
+      } else {
+        this.windowTables = new Array(
+          new windowTableId('clientIndex'),
+          new windowTableId('client')
+        );
+      }
       setWindowTableParentElement();
       enableShortcuts('popup');
       setBrowserAutoComplete(false);
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.java	Tue Mar 08 16:19:56 2011 +0100
@@ -63,6 +63,8 @@
           "GeneralAccountingReports|asDateTo", "");
       String strAsDateToRef = vars.getGlobalVariable("inpAsDateToRef",
           "GeneralAccountingReports|asDateToRef", "");
+      String strPageNo = vars.getGlobalVariable("inpPageNo",
+          "GeneralAccountingReports|PageNo", "1");
       String strElementValue = vars.getGlobalVariable("inpcElementvalueId",
           "GeneralAccountingReports|C_ElementValue_ID", "");
       String strConImporte = vars.getGlobalVariable("inpConImporte",
@@ -70,7 +72,7 @@
       String strConCodigo = vars.getGlobalVariable("inpConCodigo",
           "GeneralAccountingReports|conCodigo", "N");
       String strLevel = vars.getGlobalVariable("inpLevel", "GeneralAccountingReports|level", "");
-      printPageDataSheet(response, vars, "", "", strDateFrom, strDateTo, strDateFromRef,
+      printPageDataSheet(response, vars, "", "", strDateFrom, strDateTo, strPageNo, strDateFromRef,
           strDateToRef, strAsDateTo, strAsDateToRef, strElementValue, strConImporte, "", strLevel,
           strConCodigo, "");
     } else if (vars.commandIn("FIND")) {
@@ -86,6 +88,8 @@
           "GeneralAccountingReports|dateFromRef");
       String strDateToRef = vars.getRequestGlobalVariable("inpDateToRef",
           "GeneralAccountingReports|dateToRef");
+      String strPageNo = vars.getRequestGlobalVariable("inpPageNo",
+          "GeneralAccountingReports|PageNo");
       String strAsDateTo = vars.getRequestGlobalVariable("inpAsDateTo",
           "GeneralAccountingReports|asDateTo");
       String strAsDateToRef = vars.getRequestGlobalVariable("inpAsDateToRef",
@@ -99,7 +103,6 @@
       String strOrg = vars.getRequestGlobalVariable("inpOrganizacion",
           "GeneralAccountingReports|organizacion");
       String strLevel = vars.getRequestGlobalVariable("inpLevel", "GeneralAccountingReports|level");
-      String strPageNo = vars.getStringParameter("inpPageNo", "1");
       printPagePDF(request, response, vars, strAgno, strAgnoRef, strDateFrom, strDateTo,
           strDateFromRef, strDateToRef, strAsDateTo, strAsDateToRef, strElementValue,
           strConImporte, strOrg, strLevel, strConCodigo, strcAcctSchemaId, strPageNo);
@@ -360,7 +363,7 @@
   }
 
   private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars,
-      String strAgno, String strAgnoRef, String strDateFrom, String strDateTo,
+      String strAgno, String strAgnoRef, String strDateFrom, String strDateTo, String strPageNo,
       String strDateFromRef, String strDateToRef, String strAsDateTo, String strAsDateToRef,
       String strElementValue, String strConImporte, String strOrg, String strLevel,
       String strConCodigo, String strcAcctSchemaId) throws IOException, ServletException {
@@ -415,6 +418,7 @@
     xmlDocument.setParameter("dateFromRefdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("dateFromRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("dateToRef", strDateToRef);
+    xmlDocument.setParameter("PageNo", strPageNo);
     xmlDocument.setParameter("dateToRefdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("dateToRefsaveFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("asDateTo", strAsDateTo);
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReports.xml	Tue Mar 08 16:19:56 2011 +0100
@@ -62,7 +62,7 @@
   <PARAMETER id="paramArrayAccountingReports" name="accountingReports"/>
   <PARAMETER id="paramArrayOrg" name="orgs"/>
   <PARAMETER id="paramArrayYears" name="years"/>
-  <PARAMETER id="paramPageNo" name="inpPageNo" attribute="value" default="1"/>
+  <PARAMETER id="paramPageNo" name="PageNo" attribute="value"/>
 
   <SUBREPORT id="reportLevel" name="reportLevel" report="org/openbravo/erpCommon/reference/List">
     <ARGUMENT name="parameterListSelected" withId="paramLevel"/>
--- a/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.fo	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/GeneralAccountingReportsPDF.fo	Tue Mar 08 16:19:56 2011 +0100
@@ -17,7 +17,7 @@
  * Contributor(s):  ______________________________________.
  ************************************************************************
 -->
-<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root font-family="Helvetica" xmlns:fo="http://www.w3.org/1999/XSL/Format">
 	<fo:layout-master-set>
 		<fo:simple-page-master master-name="first" page-height="29.7cm" page-width="21cm" margin-top="0.5cm" margin-bottom="0.5cm" margin-left="2cm" margin-right="1cm">
 			<fo:region-before extent="2.5cm"/>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java	Tue Mar 08 16:18:20 2011 +0100
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportGeneralLedger.java	Tue Mar 08 16:19:56 2011 +0100
@@ -58,6 +58,7 @@
       String strDateFrom = vars
           .getGlobalVariable("inpDateFrom", "ReportGeneralLedger|DateFrom", "");
       String strDateTo = vars.getGlobalVariable("inpDateTo", "ReportGeneralLedger|DateTo", "");
+      String strPageNo = vars.getGlobalVariable("inpPageNo", "ReportGeneralLedger|PageNo", "1");
       String strAmtFrom = vars.getNumericGlobalVariable("inpAmtFrom",
           "ReportGeneralLedger|AmtFrom", "");
       String strAmtTo = vars.getNumericGlobalVariable("inpAmtTo", "ReportGeneralLedger|AmtTo", "");
@@ -88,7 +89,7 @@
       String strHide = vars.getGlobalVariable("inpHideMatched", "ReportGeneralLedger|HideMatched",
           "");
 
-      printPageDataSheet(response, vars, strDateFrom, strDateTo, strAmtFrom, strAmtTo,
+      printPageDataSheet(response, vars, strDateFrom, strDateTo, strPageNo, strAmtFrom, strAmtTo,
           strcelementvaluefrom, strcelementvalueto, strOrg, strcBpartnerId, strmProductId,
           strcProjectId, strGroupBy, strHide, strcAcctSchemaId, strcelementvaluefromdes,
           strcelementvaluetodes);
@@ -98,6 +99,7 @@
       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
           "ReportGeneralLedger|DateFrom");
       String strDateTo = vars.getRequestGlobalVariable("inpDateTo", "ReportGeneralLedger|DateTo");
+      String strPageNo = vars.getRequestGlobalVariable("inpPageNo", "ReportGeneralLedger|PageNo");
       String strAmtFrom = vars.getNumericParameter("inpAmtFrom");
       vars.setSessionValue("ReportGeneralLedger|AmtFrom", strAmtFrom);
       String strAmtTo = vars.getNumericParameter("inpAmtTo");
@@ -138,7 +140,7 @@
         log4j.debug("##################### DoPost - XLS - strcelementvalueto= "
             + strcelementvalueto);
       vars.setSessionValue("ReportGeneralLedger.initRecordNumber", "0");
-      printPageDataSheet(response, vars, strDateFrom, strDateTo, strAmtFrom, strAmtTo,
+      printPageDataSheet(response, vars, strDateFrom, strDateTo, strPageNo, strAmtFrom, strAmtTo,
           strcelementvaluefrom, strcelementvalueto, strOrg, strcBpartnerId, strmProductId,
           strcProjectId, strGroupBy, strHide, strcAcctSchemaId, strcelementvaluefromdes,
           strcelementvaluetodes);
@@ -204,7 +206,7 @@
   }
 
   private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars,
-      String strDateFrom, String strDateTo, String strAmtFrom, String strAmtTo,
+      String strDateFrom, String strDateTo, String strPageNo, String strAmtFrom, String strAmtTo,
       String strcelementvaluefrom, String strcelementvalueto, String strOrg, String strcBpartnerId,
       String strmProductId, String strcProjectId, String strGroupBy, String strHide,
       String strcAcctSchemaId, String strcelementvaluefromdes, String strcelementvaluetodes)
@@ -427,6 +429,7 @@
     xmlDocument.setParameter("dateFromdisplayFormat", vars.getSessionValue("#AD_SqlDateFormat"));
     xmlDocument.setParameter("dateFromsaveFormat", vars.getSessionValue(