details:   /erp/devel/pi/rev/17ef7c38bc55
changeset: 11403:17ef7c38bc55
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Mar 30 13:47:06 2011 +0200
summary:   Added status column to insert into ad_alert clause.

details:   /erp/devel/pi/rev/55d46906856d
changeset: 11404:55d46906856d
user:      Gorka Ion Damián <gorkaion.damian <at> openbravo.com>
date:      Wed Mar 30 17:39:02 2011 +0200
summary:   Set ad_alert.status column as nullable. null status is considered as 
'NEW'

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java
              |  8 ++++----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js
 |  2 +-
 src-db/database/model/tables/AD_ALERT.xml                                      
                                    |  4 ++--
 src/org/openbravo/erpCommon/utility/Alert_data.xsql                            
                                    |  7 ++++---
 4 files changed, 11 insertions(+), 10 deletions(-)

diffs (68 lines):

diff -r 0fa6302b8838 -r 55d46906856d 
modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java
     Wed Mar 30 17:35:21 2011 +0200
+++ 
b/modules/org.openbravo.client.application/src/org/openbravo/client/application/AlertActionHandler.java
     Wed Mar 30 17:39:02 2011 +0200
@@ -98,10 +98,10 @@
         final AlertRule alertRule = (AlertRule) o;
         final String whereClause = new UsedByLink().getWhereClause(vars, "", 
alertRule
             .getFilterClause() == null ? "" : alertRule.getFilterClause());
-        final String sql = "select * from AD_ALERT where STATUS='NEW'" + " AND 
AD_CLIENT_ID "
-            + OBDal.getInstance().getReadableClientsInClause() + " AND 
AD_ORG_ID "
-            + OBDal.getInstance().getReadableOrganizationsInClause() + " AND 
AD_ALERTRULE_ID = ? "
-            + (whereClause == null ? "" : whereClause);
+        final String sql = "select * from AD_ALERT where 
COALESCE(to_char(STATUS), 'NEW')='NEW'"
+            + " AND AD_CLIENT_ID " + 
OBDal.getInstance().getReadableClientsInClause()
+            + " AND AD_ORG_ID " + 
OBDal.getInstance().getReadableOrganizationsInClause()
+            + " AND AD_ALERTRULE_ID = ? " + (whereClause == null ? "" : 
whereClause);
         final SQLQuery sqlQuery = 
OBDal.getInstance().getSession().createSQLQuery(sql).addEntity(
             Alert.ENTITY_NAME);
         sqlQuery.setParameter(0, alertRule.getId());
diff -r 0fa6302b8838 -r 55d46906856d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js
        Wed Mar 30 17:35:21 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/alert-management/ob-alert-grid.js
        Wed Mar 30 17:39:02 2011 +0200
@@ -163,7 +163,7 @@
     var i, filterClause = '',
         alertRuleIds = '',
         arlength = OB.AlertManagement.alertRules.length,
-        whereClause = 'status = upper(\'' + this.alertStatus + '\')';
+        whereClause = 'coalesce(to_char(status), \'NEW\') = upper(\'' + 
this.alertStatus + '\')';
 
     for (i = 0; i < arlength; i++) {
       if (alertRuleIds !== '') {
diff -r 0fa6302b8838 -r 55d46906856d src-db/database/model/tables/AD_ALERT.xml
--- a/src-db/database/model/tables/AD_ALERT.xml Wed Mar 30 17:35:21 2011 +0200
+++ b/src-db/database/model/tables/AD_ALERT.xml Wed Mar 30 17:39:02 2011 +0200
@@ -69,8 +69,8 @@
         <default/>
         <onCreateDefault/>
       </column>
-      <column name="STATUS" primaryKey="false" required="true" type="VARCHAR" 
size="60" autoIncrement="false">
-        <default/>
+      <column name="STATUS" primaryKey="false" required="false" type="VARCHAR" 
size="60" autoIncrement="false">
+        <default></default>
         <onCreateDefault/>
       </column>
       <foreign-key foreignTable="AD_ALERTRULE" name="AD_ALERT_AD_ALERTRULE">
diff -r 0fa6302b8838 -r 55d46906856d 
src/org/openbravo/erpCommon/utility/Alert_data.xsql
--- a/src/org/openbravo/erpCommon/utility/Alert_data.xsql       Wed Mar 30 
17:35:21 2011 +0200
+++ b/src/org/openbravo/erpCommon/utility/Alert_data.xsql       Wed Mar 30 
17:39:02 2011 +0200
@@ -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) 2008 Openbravo SLU 
+ * All portions are Copyright (C) 2008-2011 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -66,8 +66,9 @@
        <Sql>
                <![CDATA[
        INSERT INTO AD_Alert (AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive, 
-                      Created, CreatedBy, Updated, UpdatedBy, Description, 
AD_AlertRule_ID, Record_Id, Referencekey_ID)
-               VALUES (get_uuid(), 0, 0, 'Y', NOW(), 0, NOW(), 0, ?, ?, ?, ?)
+                      Created, CreatedBy, Updated, UpdatedBy, Description, 
AD_AlertRule_ID, Record_Id, Referencekey_ID,
+                      status)
+               VALUES (get_uuid(), 0, 0, 'Y', NOW(), 0, NOW(), 0, ?, ?, ?, 
?,'NEW')
       ]]>
        </Sql>
        <Parameter name="description" />

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to