소스 검색

Add conditional fields to default AV and M&B templates; add test validation

Alan Lam 8 달 전
부모
커밋
b0fd19cd34

+ 2 - 2
engine/test.php

@@ -505,10 +505,10 @@ class Test extends Model {
 	}
 
 	/**
-	 * @return Project
+	 * @return Project|null
 	 * @throws Exception
 	 */
-	public function getProject(): Project {
+	public function getProject(): ?Project {
 		return Project::get($this->project_id);
 	}
 

+ 253 - 50
json/age_verification.json

@@ -1,9 +1,15 @@
 {
 	"customerInvoiceFields": [
-		{"name": "play_spent", "label": "Money Spent by Testers"}
+		{
+			"name": "play_spent",
+			"label": "Money Spent by Testers"
+		}
 	],
 	"testerInvoiceFields": [
-		{"name": "play_spent", "label": "Play Costs"}
+		{
+			"name": "play_spent",
+			"label": "Play Costs"
+		}
 	],
 	"beforeTest": [
 		{
@@ -48,7 +54,6 @@
 		}
 	],
 	"duringTest": [
-
 		{
 			"type": "header",
 			"content": "Venue"
@@ -57,19 +62,32 @@
 			"type": "inline-radio",
 			"name": "door_sensor_alert",
 			"label": "Door Sensor Alert",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Did not notice", "No", "Yes"],
+			"values": [
+				"",
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"Did not notice",
+				"No",
+				"Yes"
+			],
 			"helpText": "Was there a sound or visual alert when you entered the venue?",
 			"customerExport": false,
 			"defaultValue": "1"
 		},
-
 		{
 			"type": "inline-radio",
 			"name": "social_distancing_signage",
 			"label": "Signage for Social Distancing",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
@@ -77,8 +95,14 @@
 			"type": "inline-radio",
 			"name": "entrance_hand_sanitiser",
 			"label": "Hand Sanitisers at Entrance",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
@@ -86,17 +110,21 @@
 			"type": "inline-radio",
 			"name": "social_distancing_measures",
 			"label": "Social Distancing Measures",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"helpText": "Were there social distancing measures in place?",
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Challenge Details"
@@ -105,8 +133,22 @@
 			"type": "dropdown",
 			"name": "challenge_stage",
 			"label": "Stage",
-			"values": ["", 1, 2, 3, 4, 5],
-			"displayStrings": ["Select stage", "Challenge on entry", "Challenge during browsing", "Challenge during play", "Challenge on exit", "No challenge"],
+			"values": [
+				"",
+				1,
+				2,
+				3,
+				4,
+				5
+			],
+			"displayStrings": [
+				"Select stage",
+				"Challenge on entry",
+				"Challenge during browsing",
+				"Challenge during play",
+				"Challenge on exit",
+				"No challenge"
+			],
 			"required": true
 		},
 		{
@@ -116,11 +158,9 @@
 			"maxLength": 400,
 			"helpText": "Describe how the challenge took place. For example: \"While entering I was approached politely and asked for ID.\""
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Staff Description"
@@ -144,56 +184,178 @@
 			"type": "inline-radio",
 			"name": "challenger_gender",
 			"label": "Gender",
-			"values": ["", "M", "F"],
-			"displayStrings": ["No challenge", "Male", "Female"],
+			"values": [
+				"",
+				"M",
+				"F"
+			],
+			"displayStrings": [
+				"No challenge",
+				"Male",
+				"Female"
+			],
 			"customerExport": false
 		},
 		{
 			"type": "inline-radio",
 			"name": "challenger_eye_contact",
 			"label": "Eye Contact",
-			"values": ["", "0", "1"],
-			"displayStrings": ["No challenge", "No", "Yes"],
+			"values": [
+				"",
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No challenge",
+				"No",
+				"Yes"
+			],
 			"customerExport": false
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
-			"content": "Play Details"
+			"content": "Play Details",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "text",
 			"name": "play_machine",
 			"label": "Machine Played",
 			"maxLength": 20,
-			"customerExport": false
+			"customerExport": false,
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			],
+			"requiredIfValid": true
 		},
 		{
 			"type": "radio",
 			"name": "play_jackpot",
 			"label": "Jackpot Value",
-			"values": ["", 5, 10, 15, 20, 25, 35, 50, 100, 500],
-			"displayStrings": ["Did not play", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
-			"customerExport": false
+			"values": [
+				"",
+				5,
+				10,
+				15,
+				20,
+				25,
+				35,
+				50,
+				100,
+				500
+			],
+			"displayStrings": [
+				"Did not play",
+				"£5",
+				"£10",
+				"£15",
+				"£20",
+				"£25",
+				"£35",
+				"£50",
+				"£100",
+				"£500"
+			],
+			"customerExport": false,
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			],
+			"requiredIfValid": true
 		},
 		{
 			"type": "radio",
 			"name": "play_machine_stake",
 			"label": "Stake Played",
-			"values": ["", 0.1, 0.2, 0.25, 0.3, 0.5, 1, 2],
-			"displayStrings": ["Did not play", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
-			"helpText": "This is how much the machine charges you per spin."
+			"values": [
+				"",
+				0.1,
+				0.2,
+				0.25,
+				0.3,
+				0.5,
+				1,
+				2
+			],
+			"displayStrings": [
+				"Did not play",
+				"10p",
+				"20p",
+				"25p",
+				"30p",
+				"50p",
+				"£1",
+				"£2"
+			],
+			"helpText": "This is how much the machine charges you per spin.",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			],
+			"requiredIfValid": true
 		},
 		{
 			"type": "radio",
 			"name": "play_minutes",
 			"label": "Time Played (Minutes)",
-			"values": ["", "1", "2", "3", "4", "5"],
-			"displayStrings": ["Did not play", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
+			"values": [
+				"",
+				"1",
+				"2",
+				"3",
+				"4",
+				"5"
+			],
+			"displayStrings": [
+				"Did not play",
+				"1 minute",
+				"2 minutes",
+				"3 minutes",
+				"4 minutes",
+				"5 minutes or more"
+			],
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			],
+			"requiredIfValid": true
 		},
 		{
 			"type": "number",
@@ -204,13 +366,32 @@
 			"max": 20,
 			"step": 0.01,
 			"prependText": "£",
-			"helpText": "For example: Enter 1.50 if you have spent £1.50."
-		},
-
-		{
-			"type": "hr"
+			"helpText": "For example: Enter 1.50 if you have spent £1.50.",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			],
+			"requiredIfValid": true
+		},
+		{
+			"type": "hr",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
-
 		{
 			"type": "header",
 			"content": "Signage Details"
@@ -219,31 +400,55 @@
 			"type": "inline-radio",
 			"name": "citizen_card_brochure_displayed",
 			"label": "Citizen Card Brochure Displayed",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_25",
 			"label": "Think 21 or Think 25",
-			"values": ["Think 21", "Think 25"],
-			"displayStrings": ["Think 21", "Think 25"]
+			"values": [
+				"Think 21",
+				"Think 25"
+			],
+			"displayStrings": [
+				"Think 21",
+				"Think 25"
+			]
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_badge",
 			"label": "Think 21/25 Badge Worn by Staff",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_poster",
 			"label": "Think 21/25 Poster Displayed",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
@@ -253,11 +458,9 @@
 			"maxLength": 200,
 			"helpText": "Describe the location of the poster that was displayed."
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Notes"

+ 296 - 58
json/age_verification_mitchells_and_butlers.json

@@ -1,10 +1,19 @@
 {
 	"customerInvoiceFields": [
-		{"name": "bar_expenditure", "label": "Drink Money"}
+		{
+			"name": "bar_expenditure",
+			"label": "Drink Money"
+		}
 	],
 	"testerInvoiceFields": [
-		{"name": "play_spent", "label": "Play Costs"},
-		{"name": "bar_expenditure", "label": "Bar Expenditure"}
+		{
+			"name": "play_spent",
+			"label": "Play Costs"
+		},
+		{
+			"name": "bar_expenditure",
+			"label": "Bar Expenditure"
+		}
 	],
 	"beforeTest": [
 		{
@@ -57,19 +66,32 @@
 			"type": "inline-radio",
 			"name": "door_sensor_alert",
 			"label": "Door Sensor Alert",
-			"values": ["", "0", "1"],
-			"displayStrings": ["Did not notice", "No", "Yes"],
+			"values": [
+				"",
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"Did not notice",
+				"No",
+				"Yes"
+			],
 			"helpText": "Was there a sound or visual alert when you entered the venue?",
 			"customerExport": false,
 			"defaultValue": "1"
 		},
-
 		{
 			"type": "inline-radio",
 			"name": "social_distancing_signage",
 			"label": "Signage for Social Distancing",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
@@ -77,8 +99,14 @@
 			"type": "inline-radio",
 			"name": "entrance_hand_sanitiser",
 			"label": "Hand Sanitisers at Entrance",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
@@ -86,17 +114,21 @@
 			"type": "inline-radio",
 			"name": "social_distancing_measures",
 			"label": "Social Distancing Measures",
-			"values": [0, 1],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				0,
+				1
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"helpText": "Were there social distancing measures in place?",
 			"required": true,
 			"requiredKey": "COVID-19"
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Challenge Details"
@@ -105,8 +137,22 @@
 			"type": "dropdown",
 			"name": "challenge_stage",
 			"label": "Stage",
-			"values": ["", 1, 2, 3, 4, 5],
-			"displayStrings": ["Select stage", "Challenge on bar or entry", "Challenge during browsing", "Challenge during play", "Challenge on exit", "No challenge"],
+			"values": [
+				"",
+				1,
+				2,
+				3,
+				4,
+				5
+			],
+			"displayStrings": [
+				"Select stage",
+				"Challenge on bar or entry",
+				"Challenge during browsing",
+				"Challenge during play",
+				"Challenge on exit",
+				"No challenge"
+			],
 			"required": true
 		},
 		{
@@ -116,11 +162,9 @@
 			"maxLength": 400,
 			"helpText": "Describe how the challenge took place. For example: \"While entering I was approached politely and asked for ID.\""
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Staff Description"
@@ -144,24 +188,38 @@
 			"type": "inline-radio",
 			"name": "challenger_gender",
 			"label": "Gender",
-			"values": ["", "M", "F"],
-			"displayStrings": ["No challenge", "Male", "Female"],
+			"values": [
+				"",
+				"M",
+				"F"
+			],
+			"displayStrings": [
+				"No challenge",
+				"Male",
+				"Female"
+			],
 			"customerExport": false
 		},
 		{
 			"type": "inline-radio",
 			"name": "challenger_eye_contact",
 			"label": "Eye Contact",
-			"values": ["", "0", "1"],
-			"displayStrings": ["No challenge", "No", "Yes"],
+			"values": [
+				"",
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No challenge",
+				"No",
+				"Yes"
+			],
 			"customerExport": false
 		},
-
 		{
 			"type": "hr",
 			"hidden": true
 		},
-
 		{
 			"type": "header",
 			"content": "Bar Details",
@@ -171,8 +229,14 @@
 			"type": "inline-radio",
 			"name": "bar_purchase",
 			"label": "Bar Purchase",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"helpText": "Did you buy anything at the bar?",
 			"hidden": true
 		},
@@ -192,8 +256,14 @@
 			"type": "inline-radio",
 			"name": "alcohol_purchased",
 			"label": "Alcohol Purchased",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"hidden": true
 		},
 		{
@@ -203,21 +273,39 @@
 			"maxLength": 20,
 			"hidden": true
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
-			"content": "Play Details"
+			"content": "Play Details",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "text",
 			"name": "play_machine",
 			"label": "Machine Played",
 			"maxLength": 20,
-			"customerExport": false
+			"customerExport": false,
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "text",
@@ -225,38 +313,148 @@
 			"label": "Machine Position",
 			"maxLength": 100,
 			"customerExport": false,
-			"helpText": "Where the machine was located in the venue? (e.g. Opposite the bar.)"
+			"helpText": "Where the machine was located in the venue? (e.g. Opposite the bar.)",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "inline-radio",
 			"name": "play_machine_line_of_sight",
 			"label": "Machine Line of Sight of Bar",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
-			"helpText": "Was the machine in line of sight of the bar?"
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
+			"helpText": "Was the machine in line of sight of the bar?",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "radio",
 			"name": "play_jackpot",
 			"label": "Jackpot Value",
-			"values": ["", 5, 10, 15, 20, 25, 35, 50, 100, 500],
-			"displayStrings": ["Did not play", "£5", "£10", "£15", "£20", "£25", "£35", "£50", "£100", "£500"],
-			"customerExport": false
+			"values": [
+				"",
+				5,
+				10,
+				15,
+				20,
+				25,
+				35,
+				50,
+				100,
+				500
+			],
+			"displayStrings": [
+				"Did not play",
+				"£5",
+				"£10",
+				"£15",
+				"£20",
+				"£25",
+				"£35",
+				"£50",
+				"£100",
+				"£500"
+			],
+			"customerExport": false,
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "radio",
 			"name": "play_machine_stake",
 			"label": "Stake Played",
-			"values": ["", 0.1, 0.2, 0.25, 0.3, 0.5, 1, 2],
-			"displayStrings": ["Did not play", "10p", "20p", "25p", "30p", "50p", "£1", "£2"],
-			"helpText": "This is how much the machine charges you per spin."
+			"values": [
+				"",
+				0.1,
+				0.2,
+				0.25,
+				0.3,
+				0.5,
+				1,
+				2
+			],
+			"displayStrings": [
+				"Did not play",
+				"10p",
+				"20p",
+				"25p",
+				"30p",
+				"50p",
+				"£1",
+				"£2"
+			],
+			"helpText": "This is how much the machine charges you per spin.",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "radio",
 			"name": "play_minutes",
 			"label": "Time Played (Minutes)",
-			"values": ["", "1", "2", "3", "4", "5"],
-			"displayStrings": ["Did not play", "1 minute", "2 minutes", "3 minutes", "4 minutes", "5 minutes or more"]
+			"values": [
+				"",
+				"1",
+				"2",
+				"3",
+				"4",
+				"5"
+			],
+			"displayStrings": [
+				"Did not play",
+				"1 minute",
+				"2 minutes",
+				"3 minutes",
+				"4 minutes",
+				"5 minutes or more"
+			],
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
 		{
 			"type": "number",
@@ -267,13 +465,31 @@
 			"max": 2,
 			"step": 0.01,
 			"prependText": "£",
-			"helpText": "For example: Enter 1.50 if you have spent £1.50."
+			"helpText": "For example: Enter 1.50 if you have spent £1.50.",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
-
 		{
-			"type": "hr"
+			"type": "hr",
+			"requirements": [
+				{
+					"fieldName": "challenge_stage",
+					"validValues": [
+						"3",
+						"4",
+						"5"
+					]
+				}
+			]
 		},
-
 		{
 			"type": "header",
 			"content": "Signage Details"
@@ -282,31 +498,55 @@
 			"type": "inline-radio",
 			"name": "citizen_card_brochure_displayed",
 			"label": "Citizen Card Brochure Displayed",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_25",
 			"label": "Think 21 or Think 25",
-			"values": ["Think 21", "Think 25"],
-			"displayStrings": ["Think 21", "Think 25"]
+			"values": [
+				"Think 21",
+				"Think 25"
+			],
+			"displayStrings": [
+				"Think 21",
+				"Think 25"
+			]
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_badge",
 			"label": "Think 21/25 Badge Worn by Staff",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
 			"type": "inline-radio",
 			"name": "think_21_poster",
 			"label": "Think 21/25 Poster Displayed",
-			"values": ["0", "1"],
-			"displayStrings": ["No", "Yes"],
+			"values": [
+				"0",
+				"1"
+			],
+			"displayStrings": [
+				"No",
+				"Yes"
+			],
 			"defaultValue": "1"
 		},
 		{
@@ -316,11 +556,9 @@
 			"maxLength": 200,
 			"helpText": "Describe the location of the poster that was displayed."
 		},
-
 		{
 			"type": "hr"
 		},
-
 		{
 			"type": "header",
 			"content": "Notes"

+ 38 - 0
template_processing/age_verification/test_validate.php

@@ -0,0 +1,38 @@
+<?php /** @noinspection PhpUnhandledExceptionInspection */
+
+/**
+ * @var Test $test
+ * @var FormException $form_exception
+ */
+
+$project = $test->getProject();
+
+if($test->dts_start && $test->dts_end && $project && $project->browse_time && $project->play_time) {
+	$dt_start = $test->getDateTimeStart()->setTimezone(TIMEZONE);
+	$dt_end = $test->getDateTimeEnd()->setTimezone(TIMEZONE);
+
+	$duration = $dt_end->diffInMinutes($dt_start);
+
+	/** @var string[] $values */
+	$values = $test->getValues(true);
+
+	$play_minutes = (int) ($values["play_minutes"] ?? 0);
+	$challenge_stage = (int) $test->challenge_stage;
+
+	// Calculate minimum duration
+	$min_duration = $project->browse_time;
+
+	if($test->challenge_stage >= 2) {
+		$min_duration += $project->play_time;
+	}
+
+	$min_duration += $play_minutes;
+
+	if($play_minutes < $project->play_time && in_array($challenge_stage, [4, 5])) {
+		$form_exception->addError("Please confirm that you played for at least {$project->play_time} minutes because you have selected After Play / No Challenge.");
+	}
+
+	if($duration < $min_duration) {
+		$form_exception->addError("Please check the entry and exit times. Based on the information you have given, you should have been at the venue for $min_duration minutes or more.");
+	}
+}

+ 3 - 0
template_processing/age_verification_mitchells_butlers/test_validate.php

@@ -0,0 +1,3 @@
+<?php
+
+require __DIR__ . "/../age_verification/test_validate.php";