From: Nick Duncan Date: Mon, 28 Sep 2015 22:55:23 +0000 (-0400) Subject: KMAIN-1850 Date of Birth Is Mandatory X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8184a3018a60562a99a3c35b91d6221d6fb80124;p=working%2FEvergreen.git KMAIN-1850 Date of Birth Is Mandatory User Is Now Unable To Bypass The Required Date Of Birth Field During Patron Registration Signed-off-by: Nick Duncan Signed-off-by: Bill Erickson berick: repaired merge conflict; minor formatting repairs Conflicts: Open-ILS/web/js/ui/default/actor/user/register.js --- diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index c45516899f..4f523875f8 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -1465,6 +1465,9 @@ function attachWidgetEvents(fmcls, fmfield, widget) { if(this.attr('disabled') || this.attr('readOnly')) { return true; } + if(!this.attr('value')) { + return false; + } if(orgSettings['ui.patron.edit.ac.barcode.regex']) { // This serves as a master "on" for these checks // No spaces if(this.attr("value").match(/\s/)) { @@ -1596,8 +1599,22 @@ function attachWidgetEvents(fmcls, fmfield, widget) { case 'dob': widget.widget.isValid = function() { - if(!this.attr('value')) return false; - if(this.attr('value').getFullYear().toString().length < 4) return false; + // KCLS requires DoB. + // We're not just using ui.patron.edit.au.dob.require, + // because when the DoB is unset, we also want to + // clear the juvenile flag. + if(!this.attr('value')) { + findWidget('au', 'juvenile').widget.attr('value', false); + return false; + } + + // DoB year <= 999 suggests human error; reject it. + if(this.attr('value').getFullYear().toString().length < 4) { + findWidget('au', 'juvenile').widget.attr('value', false); + return false; + } + + // DoB cannot be in the future return this.attr("value") < new Date(); }; dojo.connect(widget.widget, 'onChange',