Fixes issue 0016534: the invoice date, when the invoice is voided, should be updatable
authorAdrián Romero <adrianromero@openbravo.com>
Thu, 12 May 2011 16:44:43 +0200
changeset 12134 3299a3e1ad8f
parent 12133 184bd464aefe
child 12135 ccdcc3aca320
Fixes issue 0016534: the invoice date, when the invoice is voided, should be updatable
It has been modified also the condition needed in the trigger to finish fixing this issue
src-db/database/model/triggers/C_INVOICE_TRG.xml
--- a/src-db/database/model/triggers/C_INVOICE_TRG.xml	Thu May 12 15:46:50 2011 +0200
+++ b/src-db/database/model/triggers/C_INVOICE_TRG.xml	Thu May 12 16:44:43 2011 +0200
@@ -48,7 +48,7 @@
     OR(COALESCE(:OLD.C_DOCTYPE_ID, '0') <> COALESCE(:NEW.C_DOCTYPE_ID, '0'))
     OR(COALESCE(:OLD.C_DOCTYPETARGET_ID, '0') <> COALESCE(:NEW.C_DOCTYPETARGET_ID, '0'))
     OR(COALESCE(:OLD.DATEINVOICED, TO_DATE('31-12-9999', 'DD-MM-YYYY')) <> COALESCE(:NEW.DATEINVOICED, TO_DATE('31-12-9999', 'DD-MM-YYYY'))
-       AND (:NEW.DOCSTATUS<>'VO' OR (:NEW.DOCSTATUS='VO' AND  V_COUNT = 0)))
+       AND (:NEW.DOCSTATUS<>'VO'))
     OR(COALESCE(:OLD.C_BPARTNER_LOCATION_ID, '0') <> COALESCE(:NEW.C_BPARTNER_LOCATION_ID, '0'))
     OR(COALESCE(:OLD.PAYMENTRULE, '.') <> COALESCE(:NEW.PAYMENTRULE, '.'))
     OR(COALESCE(:OLD.C_PAYMENTTERM_ID, '0') <> COALESCE(:NEW.C_PAYMENTTERM_ID, '0'))
@@ -61,7 +61,7 @@
     OR(COALESCE(:OLD.USER2_ID, '0') <> COALESCE(:NEW.USER2_ID, '0'))
     OR(COALESCE(:old.AD_ORG_ID, '0') <> COALESCE(:new.AD_ORG_ID, '0'))
     OR(COALESCE(:old.AD_CLIENT_ID, '0') <> COALESCE(:new.AD_CLIENT_ID, '0'))))
-    THEN  RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted') ;
+    THEN  RAISE_APPLICATION_ERROR(-20501, 'Document processed/posted');
     END IF;
     IF(COALESCE(:old.AD_ORG_ID, '0') <> COALESCE(:new.AD_ORG_ID, '0')) THEN 
         SELECT COUNT(*) INTO V_COUNT FROM C_INVOICELINE WHERE C_INVOICE_ID = :NEW.C_INVOICE_ID;