src-db/database/model/triggers/MA_WRPHASE_TRG.xml
author Cristian Berner <cristian.berner@openbravo.com>
Mon, 31 Aug 2020 12:03:00 +0200
changeset 37516 743260848809
parent 25175 9e11efa4229f
permissions -rw-r--r--
Fixes ISSUE-44863: Remove never thrown ServletException in OBScheduler methods

OBScheduler has been modified previously when quartz has been updated,
but reschedule and unschedule method declarations have not been updated.
ServletException is not thrown anymore in those methods, so it has been
removed from there.

Catch blocks that were catching this non-thrown exception have also been
removed in CallAcctServer and UnscheduleProcess classes.
<?xml version="1.0"?>
  <database name="TRIGGER MA_WRPHASE_TRG">
    <trigger name="MA_WRPHASE_TRG" table="MA_WRPHASE" fires="after" insert="true" update="true" delete="true" foreach="row">
      <body><![CDATA[
/*************************************************************************
* 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-2014 Openbravo SLU
* All Rights Reserved.
* Contributor(s):  ______________________________________.
************************************************************************/

    
BEGIN
    
    IF AD_isTriggerEnabled()='N' THEN RETURN;
    END IF;

IF (INSERTING) THEN
	UPDATE MA_WORKREQUIREMENT SET 
  ENDDATE = ADD_HMS(STARTDATE, ESTIMATEDTIME + :NEW.ESTIMATEDTIME, 0, 0),
  ESTIMATEDTIME = ESTIMATEDTIME + :NEW.ESTIMATEDTIME, 
  RUNTIME = RUNTIME + :NEW.RUNTIME
	WHERE MA_WORKREQUIREMENT_ID = :NEW.MA_WORKREQUIREMENT_ID;
END IF;

IF (UPDATING) THEN
	UPDATE MA_WORKREQUIREMENT SET 
  ENDDATE = ADD_HMS(STARTDATE, ESTIMATEDTIME + :NEW.ESTIMATEDTIME - :OLD.ESTIMATEDTIME, 0, 0),
  ESTIMATEDTIME = ESTIMATEDTIME + :NEW.ESTIMATEDTIME - :OLD.ESTIMATEDTIME, RUNTIME = RUNTIME + :NEW.RUNTIME - :OLD.RUNTIME
	WHERE MA_WORKREQUIREMENT_ID = :NEW.MA_WORKREQUIREMENT_ID;
END IF;

IF (DELETING) THEN
	UPDATE MA_WORKREQUIREMENT SET 
  ENDDATE = ADD_HMS(STARTDATE, ESTIMATEDTIME - :OLD.ESTIMATEDTIME, 0, 0),
  ESTIMATEDTIME = ESTIMATEDTIME - :OLD.ESTIMATEDTIME, RUNTIME = RUNTIME - :OLD.RUNTIME
	WHERE MA_WORKREQUIREMENT_ID = :OLD.MA_WORKREQUIREMENT_ID;
END IF;


END MA_WRPHASE_TRG
]]></body>
    </trigger>
  </database>