src-util/modulescript/src/org/openbravo/modulescript/PgJdbcDatesIssue_data.xsql
changeset 28273 f8de3bcd78f3
equal deleted inserted replaced
28272:c6ee63dab444 28273:f8de3bcd78f3
       
     1 <?xml version="1.0" encoding="UTF-8" ?>
       
     2 <!--
       
     3  *************************************************************************
       
     4  * The contents of this file are subject to the Openbravo  Public  License
       
     5  * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
       
     6  * Version 1.1  with a permitted attribution clause; you may not  use this
       
     7  * file except in compliance with the License. You  may  obtain  a copy of
       
     8  * the License at http://www.openbravo.com/legal/license.html
       
     9  * Software distributed under the License  is  distributed  on  an "AS IS"
       
    10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
       
    11  * License for the specific  language  governing  rights  and  limitations
       
    12  * under the License.
       
    13  * The Original Code is Openbravo ERP.
       
    14  * The Initial Developer of the Original Code is Openbravo SLU
       
    15  * All portions are Copyright (C) 2016 Openbravo SLU
       
    16  * All Rights Reserved.
       
    17  * Contributor(s):  ______________________________________.
       
    18  ************************************************************************
       
    19 -->
       
    20 <SqlClass name="PgJdbcDatesIssueData" package="org.openbravo.modulescript">
       
    21   <SqlMethod name="existsAlertRule" type="preparedStatement" return="boolean">
       
    22     <Sql><![CDATA[
       
    23        SELECT COUNT(*) AS EXISTING
       
    24        FROM AD_ALERTRULE
       
    25        WHERE NAME = ?
       
    26       ]]>
       
    27     </Sql>
       
    28     <Parameter name="alertRule"/>
       
    29   </SqlMethod>
       
    30   
       
    31   <SqlMethod name="existsAlert" type="preparedStatement" return="boolean">
       
    32     <Sql><![CDATA[
       
    33        SELECT COUNT(*) AS EXISTING
       
    34        FROM AD_ALERTRULE
       
    35        WHERE NAME = ?
       
    36       ]]>
       
    37     </Sql>
       
    38     <Parameter name="name"/>
       
    39   </SqlMethod>
       
    40   
       
    41   <SqlMethod name="getAlertRuleId" type="preparedStatement" return="string">
       
    42     <SqlMethodComment></SqlMethodComment>
       
    43     <Sql><![CDATA[
       
    44        SELECT MAX(ad_alertrule_id) AS id
       
    45        FROM AD_ALERTRULE
       
    46        WHERE NAME = ?
       
    47       ]]></Sql>
       
    48     <Parameter name="name"/>
       
    49   </SqlMethod>
       
    50   
       
    51   <SqlMethod name="insertAlertRule" type="preparedStatement" return="rowcount">
       
    52     <SqlMethodComment></SqlMethodComment>
       
    53     <Sql><![CDATA[
       
    54       INSERT INTO AD_ALERTRULE (
       
    55         AD_ALERTRULE_ID, AD_CLIENT_ID, AD_ORG_ID, ISACTIVE,
       
    56         CREATED, CREATEDBY,  UPDATED, UPDATEDBY,
       
    57         NAME, TYPE
       
    58       ) VALUES (
       
    59         get_uuid(), '0', '0', 'Y',
       
    60         now(), '0', now(), '0',
       
    61         ?, 'E'
       
    62       )
       
    63     ]]></Sql>
       
    64     <Parameter name="name"/>
       
    65   </SqlMethod>
       
    66   
       
    67   <SqlMethod name="insertAlert" type="preparedStatement" return="rowcount">
       
    68     <Sql><![CDATA[
       
    69       INSERT INTO AD_Alert (
       
    70         AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive,
       
    71         Created, CreatedBy, Updated, UpdatedBy,
       
    72         Description, AD_AlertRule_ID, Referencekey_ID
       
    73       ) VALUES (
       
    74         get_uuid(), '0', '0', 'Y',
       
    75         NOW(), '0', NOW(), '0',
       
    76         ?, ?, '0')
       
    77       ]]>
       
    78     </Sql>
       
    79     <Parameter name="description" />
       
    80     <Parameter name="adAlertRuleId" />
       
    81   </SqlMethod>
       
    82   
       
    83   <SqlMethod name="insertAlertRecipient" type="preparedStatement" return="rowcount">
       
    84     <Sql><![CDATA[
       
    85     INSERT INTO ad_alertrecipient(
       
    86             ad_client_id, ad_org_id, isactive, created, createdby, 
       
    87             updated, updatedby, ad_alertrecipient_id, ad_alertrule_id, ad_role_id, 
       
    88             sendemail)
       
    89     select ad_client_id, ad_org_id, 'Y', now(), '0',
       
    90            now(), '0', get_uuid(), ?, ad_role_id, 'N'
       
    91       from ad_role
       
    92      where isactive = 'Y'
       
    93       ]]>
       
    94     </Sql>
       
    95     <Parameter name="adAlertRuleId" />
       
    96   </SqlMethod>
       
    97 
       
    98 </SqlClass>