Child pages
  • Rules

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
package org.districtName.Requisition
dialect "mvel"

import function org.ssdt_ohio.modules.rules.RulesHelper.*
import org.ssdt_ohio.model.events.*
import org.ssdt_ohio.model.ModelInformation
import org.ssdt_ohio.model.ModelState
import org.ssdt_ohio.usas.model.requisition.*


rule "Requisition Items Must Have A Description"

	when
		$event : RepositoryModificationEvent(isCreate() || isUpdate())
		ModelInformation(state != ModelState.IMPORTING, primary)
		$requisition : Requisition() from $event.target
		$item : RequisitionItem(description == null || description.trim().length() == 0) from $requisition.getItems()

	then
		error(kcontext, "Requitistion item number: " + $item.lineNumber + ", units: " + $item.units +
		", quantity: " + $item.quantity + ", unit price: " + $item.unitPrice +
		" has no description from requisition: " + $requisition.description)

end


Require an amount on a Receipt item

Name: org.districtname.ReceiptItemsWithoutAmount

Description: Prevent receipt from being saved or updated when a receipt item amount is empty

Code Block
package org.ssdt_ohio.usas.model.receipt;
dialect  "mvel"
//ssdt: mandatory=false, enabled=true, description=Error: receipt item amount must be specified

import function org.ssdt_ohio.modules.rules.RulesHelper.*
import org.ssdt_ohio.model.ModelInformation
import org.ssdt_ohio.model.ModelState
import org.ssdt_ohio.model.events.*
import org.ssdt_ohio.usas.model.account.RevenueAccount
import org.ssdt_ohio.usas.model.account.RevenueCode

rule "ReceiptItemAmounts"
    when
        ModelInformation(state != ModelState.IMPORTING, primary)
        CreateObjectEvent() or UpdateObjectEvent()
        $receipt : Receipt()
        $item : ReceiptItem(amount == null || amount == 0) from $receipt.items

    then
        error(kcontext, "Item amount required for item: " + $item.lineNumber)
end



More Information