src/org/openbravo/erpCommon/ad_forms/AlertManagement_data.xsql
author Iván Perdomo <ivan.perdomo@openbravo.com>
Thu, 24 Apr 2008 17:12:02 +0000
changeset 770 8850d5956eba
parent 526 d2502e274eb7
child 1605 8a0fe0193bef
permissions -rw-r--r--
Bug fix [0000111]. Modified mapping name used on manual code.
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
carlos@0
     3
 *************************************************************************
carlos@0
     4
 * The contents of this file are subject to the Openbravo  Public  License
carlos@0
     5
 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
carlos@0
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
carlos@0
     7
 * file except in compliance with the License. You  may  obtain  a copy of
carlos@0
     8
 * the License at http://www.openbravo.com/legal/license.html 
carlos@0
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
carlos@0
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
carlos@0
    11
 * License for the specific  language  governing  rights  and  limitations
carlos@0
    12
 * under the License. 
carlos@0
    13
 * The Original Code is Openbravo ERP. 
carlos@0
    14
 * The Initial Developer of the Original Code is Openbravo SL 
carlos@0
    15
 * All portions are Copyright (C) 2007 Openbravo SL 
carlos@0
    16
 * All Rights Reserved. 
carlos@0
    17
 * Contributor(s):  ______________________________________.
carlos@0
    18
 ************************************************************************
carlos@0
    19
-->
carlos@0
    20
carlos@0
    21
carlos@0
    22
carlos@0
    23
carlos@0
    24
carlos@0
    25
<SqlClass name="AlertManagementData" package="org.openbravo.erpCommon.ad_forms">
carlos@0
    26
  <SqlClassComment></SqlClassComment>
carlos@0
    27
  <SqlMethod name="select" type="preparedStatement" return="multiple">
carlos@0
    28
    <SqlMethodComment></SqlMethodComment>
carlos@0
    29
    <Sql>
carlos@0
    30
      <![CDATA[
ivan@526
    31
       SELECT DISTINCT R.AD_ALERTRULE_ID,
carlos@0
    32
              '' as RuleName,
carlos@0
    33
              A.Description as AlertDescription,
carlos@0
    34
              A.AD_ALERT_ID,
carlos@0
    35
              A.NOTE,
carlos@0
    36
              A.RECORD_ID,
carlos@0
    37
              A.ISACTIVE,
carlos@0
    38
              A.ISFIXED,
carlos@0
    39
              A.REFERENCEKEY_ID,
carlos@0
    40
              '' AS FILTERCLAUSE,
carlos@0
    41
              '' AS DISPLAY,
carlos@0
    42
              W.NAME as WINDOWNAME,
carlos@0
    43
              T.NAME AS TABNAME,
carlos@0
    44
              C.COLUMNNAME,
carlos@0
    45
              '' AS URL,
carlos@0
    46
              '' AS ID,
carlos@0
    47
              '' AS NAME
carlos@0
    48
         FROM AD_ALERT     A,
carlos@0
    49
              AD_ALERTRECIPIENT RE,
carlos@0
    50
              AD_ALERTRULE R LEFT JOIN AD_TAB T ON T.AD_TAB_ID = R.AD_TAB_ID
carlos@0
    51
                             LEFT JOIN AD_WINDOW W ON W.AD_WINDOW_ID = T.AD_WINDOW_ID
carlos@0
    52
                             LEFT JOIN AD_COLUMN C ON C.AD_TABLE_ID = T.AD_TABLE_ID
carlos@0
    53
                                                  AND C.ISKEY='Y'
carlos@0
    54
        WHERE R.ISACTIVE = 'Y'
carlos@0
    55
          AND A.ISACTIVE = ?
carlos@0
    56
          AND A.ISFIXED  = ?
carlos@0
    57
          AND A.AD_CLIENT_ID IN ('1') 
carlos@0
    58
          AND A.AD_ORG_ID IN ('1')
carlos@0
    59
          AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
carlos@0
    60
          AND RE.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
carlos@423
    61
          AND ((RE.AD_USER_ID IS NOT NULL AND RE.AD_USER_ID = TO_NUMBER(?)) 
carlos@0
    62
               OR 
carlos@423
    63
              (RE.AD_USER_ID IS NULL AND RE.AD_ROLE_ID = TO_NUMBER(?))) 
carlos@423
    64
          AND A.AD_ALERTRULE_ID = TO_NUMBER(?)
carlos@0
    65
          AND 1=1 AND 2=2
carlos@0
    66
          ORDER BY R.AD_ALERTRULE_ID, A.AD_ALERT_ID
carlos@0
    67
          
carlos@0
    68
     ]]>
carlos@0
    69
     </Sql>
carlos@0
    70
     <Field name="position" value="count"/>
carlos@0
    71
     <Parameter name="active"/>
carlos@0
    72
     <Parameter name="fixed"/>
carlos@0
    73
     <Parameter name="userclient" optional="true" type="replace" after="AND A.AD_CLIENT_ID IN (" text="'1'"/>
carlos@0
    74
     <Parameter name="userorg" optional="true" type="replace" after="AND A.AD_ORG_ID IN (" text="'1'"/>
carlos@0
    75
     <Parameter name="user"/>
carlos@0
    76
     <Parameter name="role"/>
carlos@0
    77
     <Parameter name="alertRule"/>
carlos@0
    78
     <Parameter name="whereClause" type="replace" optional="true" after="AND 1=1 " text="AND 2=2"/>
carlos@0
    79
   </SqlMethod>
carlos@0
    80
   
carlos@0
    81
    <SqlMethod name="selectAlertRules" type="preparedStatement" return="multiple">
carlos@0
    82
    <SqlMethodComment></SqlMethodComment>
carlos@0
    83
    <Sql>
carlos@0
    84
      <![CDATA[
ivan@526
    85
       SELECT DISTINCT a.AD_ALERTRULE_ID,
carlos@0
    86
              a.FILTERCLAUSE,
carlos@0
    87
              AD_COLUMN_IDENTIFIER('AD_AlertRule',to_char(a.AD_ALERTRULE_ID),to_char(?)) as rulename      
carlos@0
    88
         FROM AD_ALERTRULE A,
carlos@0
    89
              AD_ALERTRECIPIENT R 
carlos@0
    90
        WHERE A.ISACTIVE='Y'
carlos@0
    91
          AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
carlos@423
    92
          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = TO_NUMBER(?)) 
carlos@0
    93
               OR 
carlos@423
    94
              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = TO_NUMBER(?))) 
carlos@0
    95
          AND 1=1
carlos@0
    96
      ]]>
carlos@0
    97
    </Sql>
carlos@0
    98
    <Parameter name="lang"/>
carlos@0
    99
    <Parameter name="user"/>
carlos@0
   100
    <Parameter name="role"/>
carlos@423
   101
    <Parameter name="alertRule" optional="true" after="AND 1=1"><![CDATA[ AND A.AD_ALERTRULE_ID = TO_NUMBER(?)]]></Parameter>
carlos@0
   102
  </SqlMethod>
carlos@0
   103
   
carlos@0
   104
  <SqlMethod name="selectComboAlertRules" type="preparedStatement" return="multiple">
carlos@0
   105
    <SqlMethodComment></SqlMethodComment>
carlos@0
   106
    <Sql>
carlos@0
   107
      <![CDATA[
carlos@0
   108
       SELECT a.AD_ALERTRULE_ID as ID,
carlos@0
   109
              AD_COLUMN_IDENTIFIER('AD_AlertRule',to_char(a.AD_ALERTRULE_ID),to_char(?)) as name
carlos@0
   110
         FROM AD_ALERTRULE A,
carlos@0
   111
              AD_ALERTRECIPIENT R 
carlos@0
   112
        WHERE A.ISACTIVE='Y'
carlos@0
   113
          AND R.AD_ALERTRULE_ID = A.AD_ALERTRULE_ID
carlos@423
   114
          AND ((R.AD_USER_ID IS NOT NULL AND R.AD_USER_ID = TO_NUMBER(?)) 
carlos@0
   115
               OR 
carlos@423
   116
              (R.AD_USER_ID IS NULL AND R.AD_ROLE_ID = TO_NUMBER(?))) 
carlos@0
   117
      ]]>
carlos@0
   118
    </Sql>
carlos@0
   119
    <Parameter name="lang"/>
carlos@0
   120
    <Parameter name="user"/>
carlos@0
   121
    <Parameter name="role"/>
carlos@0
   122
  </SqlMethod>
carlos@0
   123
  
carlos@0
   124
   <SqlMethod name="update" type="preparedStatement" return="rowcount">
carlos@0
   125
    <SqlMethodComment></SqlMethodComment>
carlos@0
   126
    <Sql>
carlos@0
   127
      <![CDATA[
carlos@0
   128
       UPDATE AD_ALERT
carlos@0
   129
          SET NOTE = ?,
carlos@0
   130
              ISFIXED = ?,
carlos@0
   131
              ISACTIVE = ?
carlos@423
   132
        WHERE AD_ALERT_ID = TO_NUMBER(?)              
carlos@0
   133
     ]]>
carlos@0
   134
     </Sql>
carlos@0
   135
     <Parameter name="note"/>     
carlos@0
   136
     <Parameter name="fixed"/>
carlos@0
   137
     <Parameter name="active"/>
carlos@0
   138
     
carlos@0
   139
     <Parameter name="alert"/>
carlos@0
   140
   </SqlMethod>
carlos@0
   141
  
carlos@0
   142
</SqlClass>