From a4f60a71c7f0460bb0fd76846ebbeceb0ad4c7bd Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Wed, 27 Jan 2021 10:22:27 +0100
Subject: [PATCH] Bug 27530: Set correct dateofbirth for 'C'

Categories B, J, K and YA have a upper age limit of 17 years.
We are setting the dateofbirth to today - 15 years to prevent juvenils
to be 70!

Note that DATE_SUB is a MySQLism, but there is no way to be portable
here.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
---
 installer/data/mysql/en/optional/sample_patrons.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/installer/data/mysql/en/optional/sample_patrons.yml b/installer/data/mysql/en/optional/sample_patrons.yml
index a7baf0d38a..c68b75e58f 100644
--- a/installer/data/mysql/en/optional/sample_patrons.yml
+++ b/installer/data/mysql/en/optional/sample_patrons.yml
@@ -2424,3 +2424,6 @@ tables:
           flags: ~
           sort1: 0.91641750830823
           sort2: 0.27291712562825
+
+sql_statements:
+  - "UPDATE borrowers SET dateofbirth=DATE_SUB(CAST(NOW() AS DATE), INTERVAL 15 YEAR) WHERE categorycode IN ('B', 'J', 'K', 'YA');"
-- 
2.11.0