From: Terran McCanna Date: Mon, 10 Dec 2018 19:17:42 +0000 (-0500) Subject: PINES Customization: Alert when no hold notification options X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=d53171a8ac4278ebe92927ac496b905c82183002;p=evergreen%2Fpines.git PINES Customization: Alert when no hold notification options Present an alert if no notification options are selected in both the OPAC and web staff client. Signed-off-by: Terran McCanna --- diff --git a/Open-ILS/web/js/ui/default/opac/holds-validation.js b/Open-ILS/web/js/ui/default/opac/holds-validation.js index 688d5dad93..17f349f238 100644 --- a/Open-ILS/web/js/ui/default/opac/holds-validation.js +++ b/Open-ILS/web/js/ui/default/opac/holds-validation.js @@ -22,10 +22,15 @@ function validateMethodSelections (alertMethodCboxes) { var inputNames = { e: "email_address", ph: "phone_notify", sms: "sms_notify", carrier: "sms_carrier"}; resetBackgrounds(inputNames); + //PINES variable: + var anyCheckbox = 0; + //Array.from(alertMethodCboxes).forEach(function(cbox){ for (var i = 0; i < alertMethodCboxes.length; i++){ var cbox = alertMethodCboxes[i]; if (cbox.checked && !cbox.disabled) { + //PINES check + anyCheckbox = anyCheckbox + 1; switch(cbox.id){ case "email_notify_checkbox": needsEmail = true; @@ -57,7 +62,9 @@ function validateMethodSelections (alertMethodCboxes) { } var isFormOK = emailOK && phoneOK && smsOK; - return { isValid: isFormOK, culpritNames : culprits }; + //PINES customization + //return { isValid: isFormOK, culpritNames : culprits }; + return { isValid: isFormOK, culpritNames : culprits, anyCheckbox : anyCheckbox }; } function confirmMultipleHolds() { @@ -81,6 +88,14 @@ function validateHoldForm() { submit_element.disabled = true; } return result; + //PINES custom check for notification options + if (res.anyCheckbox == 0) { + var anyCheckboxResponse = confirm(" No notification options are selected. \n Are you sure you want to continue?"); + if (anyCheckboxResponse == false) { + return false; + } + } + return confirmMultipleHolds(); } else { alert(eg_opac_i18n.EG_MISSING_REQUIRED_INPUT); res.culpritNames.forEach(function(n){