Parameter: orderFormRestrictions

Where:

The parameter orderFormrestrictions can be found at:

  • Backoffice -> Settings -> Parameters -> Order Entry, table: orderFormrestrictions

Note:

The more rules you apply, specially rules concerning goodslinefields, causes the page to take more time to load. A faster way is to code the rules in the ordertemplate itself.

How to use:

  • The param is based on spaces (quoted strings can contain spaces) and newlines of the following format:
    field restriction [if clause,..] [ || 'Message to user' ]
  • Where field is the field name of the oe-form and restriction can be 'mandatory'.
  • The if-clause is of the format: field operator value [relation]
  • Where the optional relation can be 'and' or 'or' and the operator = or <> (unequality).
  • The value must be quoted by single quotes.
  • Goodsfields can be written as a macro: @weight, @quantity etc. to have them expand to weight1, quantity1, weight2, quantity2 etc. (currently set to 5 times repetition).
  • Use @@ to have the numeric replacement exactly at this position.
  • Other restrictions are: 'typeof', 'readonly', or 'notallowed' where typeof can specify 'number' or 'positive':
  • field restriction
    With 'notallowed' it is possible to have a '<' or '>' as the first character of the value indicating smaller then and larger then. You can have a _ as secondary character followed by a number to validate the length of the value.
    It is also possible to check for occurences of a character by starting the value wich is not allowed by a #.
    One character is special: use #amp for #&. Fieldnames can contain a wildcard (*).
  • It is also possible to have default values when user entered a value for a field:
    field set value = '12345' if clause [execute = JavaScript function call without space, ...]

    where the if clause can be just one if clause or nothing.
    A line can also be a relation between two lines when a line is exactly 'and' or 'or'.

Note:

  • This parameter will only be working in new orderentryform templates
  • On request, programmers are able to add this functionality to your template(s).
    If requested, use your Bugtracking system.
  • options notallowed and readonly cannot be combined with an if clause

Examples:

# which fields are mandatory when creating an order.
orderRef mandatory 
#orderReference can have values up to 4 positions
orderReference not allowed '>_4'
* notallowed '>_35'
#check for pipes
* notallowed '#|'
#check for ampersand
* notallowed '#amp'

#check for minus sign
* notallowed '#-'

# Time before 18:30 needs two rules
deliveryTime notallowed '>18:30'
deliveryTime2 notallowed '>18:30'

# conditional not allowed value, in this case customerID 90023 may not use deliveryType 'Af fabriek'

deliveryType notallowed 'Af fabriek' customerID='90023'
deliveryTel mandatory deliveryCountry<>'NL (Nederland)' and deliveryCountry<>'BE (België)'
deliveryTerms mandatory consignmentType='Parcels'
pickupContact mandatory consignmentType='Parcels' or consignmentType='documents'
or
pickupContact mandatory deliveryCountry<>'NL (Nederland)' and deliveryCountry<>'BE (België)'
# field quantity always mandatory in first goodsline, please note the absense of @
quantity1 mandatory
# number 
@weight typeof 'number'
# number and positive
@height typeof 'positive' 
@quantity notallowed '<5'
@weight mandatory @quantity<>''
@length mandatory @quantity<>''
@width mandatory @quantity<>''
@height mandatory @quantity<>''
#mark the absence of spaces in the execute part:
@length set value = '12345' @palletID='euro' execute = roundDecimal(this,0)
@loadmeters readonly
# readonly switch cannot be combined with condition

# restrict postcode to postcode format or empty string
deliveryPostcode regexp '[0-9]{4}[A-Z]{2}$'

# restrict postcode format per country
# pickup- and delivery fields must be tested seperately
# it is not possible to make combinations, i.e. "Belgium, Austria, Luxemburg and Hungary all have 4 digits"
# this many rules have a definite effect on the speed of the order entry form!!!
pickupPostcode regex '^[0-9]{4}[A-Z]{2}$' pickupCountry='Nederland'
pickupPostcode regex '^[0-9]{4}$' pickupCountry='Belgie'
pickupPostcode regex '^[0-9]{5}$' pickupCountry='Duitsland'
pickupPostcode regex '^[0-9]{5}$' pickupCountry='DE'
pickupPostcode regex '^[Gg][Ii][Rr] 0[Aa]{2}|(([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}$$' pickupCountry='Engeland'
pickupPostcode regex '^[0-9]{2}\-[0-9]{3}$' pickupCountry='Polen'
pickupPostcode regex '^[0-9]{4}\-[0-9]{3}$' pickupCountry='Portugal'
deliveryPostcode regex '^[0-9]{4}[A-Z]{2}$' deliveryCountry='Nederland'
deliveryPostcode regex '^[0-9]{4}$' deliveryCountry='Belgie'
deliveryPostcode regex '^[0-9]{5}$' deliveryCountry='Duitsland'
deliveryPostcode regex '^[0-9]{5}$' deliveryCountry='DE'
deliveryPostcode regex '^[Gg][Ii][Rr] 0[Aa]{2}|(([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2}$$' deliveryCountry='Engeland'
deliveryPostcode regex '^[0-9]{2}\-[0-9]{3}$' deliveryCountry='Polen'
deliveryPostcode regex '^[0-9]{4}\-[0-9]{3}$' deliveryCountry='Portugal'
Edit | Attach | Watch | Print version | History: r36 < r35 < r34 < r33 < r32 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r36 - 2021-04-15 - WiljoVanLenthe
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback