| Lines 1-45
          
      
      
        Link Here | 
        
          | 1 | /* global __ */ | 1 | /* global __ */ | 
        
          | 2 |  | 2 |  | 
          
            
              | 3 | jQuery.validator.addMethod( "letters_numbers", function(value,element){ | 3 | jQuery.validator.addMethod( | 
            
              | 4 |     var patt = /^[a-zA-Z0-9\-_]+$/g; | 4 |     "letters_numbers", | 
            
              | 5 |     if (patt.test(element.value)) { | 5 |     function (value, element) { | 
            
              | 6 |         return true; | 6 |         var patt = /^[a-zA-Z0-9\-_]+$/g; | 
            
              | 7 |     } else { | 7 |         if (patt.test(element.value)) { | 
            
              | 8 |         return false; | 8 |             return true; | 
            
              | 9 |     } | 9 |         } else { | 
            
              | 10 |     }, __("Category code can only contain the following characters: letters, numbers, - and _.") | 10 |             return false; | 
            
              |  |  | 11 |         } | 
            
              | 12 |     }, | 
            
              | 13 |     __( | 
            
              | 14 |         "Category code can only contain the following characters: letters, numbers, - and _." | 
            
              | 15 |     ) | 
        
          | 11 | ); | 16 | ); | 
        
          | 12 |  | 17 |  | 
          
            
              | 13 | jQuery.validator.addMethod( "enrollment_period", function(){ | 18 | jQuery.validator.addMethod( | 
            
              |  |  | 19 |     "enrollment_period", | 
            
              | 20 |     function () { | 
        
          | 14 |         enrolmentperiod = $("#enrolmentperiod").val(); | 21 |         enrolmentperiod = $("#enrolmentperiod").val(); | 
        
          | 15 |         enrolmentperioddate = $("#enrolmentperioddate").val(); | 22 |         enrolmentperioddate = $("#enrolmentperioddate").val(); | 
          
            
              | 16 |         if ( $("#enrolmentperiod").val() !== "" && $("#enrolmentperioddate").val() !== "" ) { | 23 |         if ( | 
            
              |  |  | 24 |             $("#enrolmentperiod").val() !== "" && | 
            
              | 25 |             $("#enrolmentperioddate").val() !== "" | 
            
              | 26 |         ) { | 
        
          | 17 |             return false; | 27 |             return false; | 
        
          | 18 |         } else { | 28 |         } else { | 
        
          | 19 |             return true; | 29 |             return true; | 
        
          | 20 |         } | 30 |         } | 
          
            
              | 21 |     }, __("Please choose an enrollment period in months OR by date.") | 31 |     }, | 
            
              |  |  | 32 |     __("Please choose an enrollment period in months OR by date.") | 
        
          | 22 | ); | 33 | ); | 
        
          | 23 |  | 34 |  | 
          
            
              | 24 | $(document).ready(function() { | 35 | $(document).ready(function () { | 
            
              | 25 |     KohaTable("patron_categories", { | 36 |     KohaTable( | 
            
              | 26 |         "columnDefs":  [{ | 37 |         "patron_categories", | 
            
              | 27 |             "targets":  [-1], | 38 |         { | 
            
              | 28 |             "orderable":  false, | 39 |             columnDefs: [ | 
            
              | 29 |             "searchable":  false | 40 |                 { | 
            
              | 30 |         }, { | 41 |                     targets: [-1], | 
            
              | 31 |             "targets":  [3, 4, 5], | 42 |                     orderable: false, | 
            
              | 32 |             "type":  "natural" | 43 |                     searchable: false, | 
            
              | 33 |         }, ], | 44 |                 }, | 
            
              | 34 |         "pagingType":  "full", | 45 |                 { | 
            
              | 35 |         "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12], | 46 |                     targets: [3, 4, 5], | 
            
              | 36 |     }, table_settings); | 47 |                     type: "natural", | 
            
              |  |  | 48 |                 }, | 
            
              | 49 |             ], | 
            
              | 50 |             pagingType: "full", | 
            
              | 51 |             exportColumns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], | 
            
              | 52 |         }, | 
            
              | 53 |         table_settings | 
            
              | 54 |     ); | 
        
          | 37 |  | 55 |  | 
        
          | 38 |     if ($("#branches option:selected").length < 1) { | 56 |     if ($("#branches option:selected").length < 1) { | 
        
          | 39 |         $("#branches option:first").attr("selected", "selected"); | 57 |         $("#branches option:first").attr("selected", "selected"); | 
        
          | 40 |     } | 58 |     } | 
        
          | 41 |  | 59 |  | 
          
            
              | 42 |     $("#categorycode").on("blur",function(){ | 60 |     $("#categorycode").on("blur", function () { | 
        
          | 43 |         toUC(this); | 61 |         toUC(this); | 
        
          | 44 |     }); | 62 |     }); | 
        
          | 45 |  | 63 |  | 
  
    | Lines 47-99
          $(document).ready(function() {
      
      
        Link Here | 
        
          | 47 |         rules: { | 65 |         rules: { | 
        
          | 48 |             categorycode: { | 66 |             categorycode: { | 
        
          | 49 |                 required: true, | 67 |                 required: true, | 
          
            
              | 50 |                 letters_numbers: true | 68 |                 letters_numbers: true, | 
        
          | 51 |             }, | 69 |             }, | 
        
          | 52 |             description: "required", | 70 |             description: "required", | 
        
          | 53 |             enrolmentperiod: { | 71 |             enrolmentperiod: { | 
          
            
              | 54 |                 required: function(element){ | 72 |                 required: function (element) { | 
        
          | 55 |                     return $("#enrolmentperioddate").val() === ""; | 73 |                     return $("#enrolmentperioddate").val() === ""; | 
        
          | 56 |                 }, | 74 |                 }, | 
        
          | 57 |                 digits: true, | 75 |                 digits: true, | 
        
          | 58 |                 enrollment_period: true, | 76 |                 enrollment_period: true, | 
          
            
              | 59 |                 min: 1 | 77 |                 min: 1, | 
        
          | 60 |             }, | 78 |             }, | 
        
          | 61 |             enrolmentperioddate: { | 79 |             enrolmentperioddate: { | 
          
            
              | 62 |                 required: function(element){ | 80 |                 required: function (element) { | 
        
          | 63 |                     return $("#enrolmentperiod").val() === ""; | 81 |                     return $("#enrolmentperiod").val() === ""; | 
        
          | 64 |                 }, | 82 |                 }, | 
          
            
              | 65 |                 enrollment_period: true | 83 |                 enrollment_period: true, | 
        
          | 66 |             }, | 84 |             }, | 
        
          | 67 |             password_expiry_days: { | 85 |             password_expiry_days: { | 
          
            
              | 68 |                 digits: true | 86 |                 digits: true, | 
        
          | 69 |             }, | 87 |             }, | 
        
          | 70 |             dateofbirthrequired: { | 88 |             dateofbirthrequired: { | 
          
            
              | 71 |                 digits: true | 89 |                 digits: true, | 
        
          | 72 |             }, | 90 |             }, | 
        
          | 73 |             upperagelimit: { | 91 |             upperagelimit: { | 
          
            
              | 74 |                 digits: true | 92 |                 digits: true, | 
        
          | 75 |             }, | 93 |             }, | 
        
          | 76 |             enrolmentfee: { | 94 |             enrolmentfee: { | 
          
            
              | 77 |                 number: true | 95 |                 number: true, | 
        
          | 78 |             }, | 96 |             }, | 
        
          | 79 |             reservefee: { | 97 |             reservefee: { | 
          
            
              | 80 |                 number: true | 98 |                 number: true, | 
        
          | 81 |             }, | 99 |             }, | 
        
          | 82 |             category_type: { | 100 |             category_type: { | 
          
            
              | 83 |                 required: true | 101 |                 required: true, | 
        
          | 84 |             }, | 102 |             }, | 
        
          | 85 |             min_password_length: { | 103 |             min_password_length: { | 
          
            
              | 86 |                 digits: true | 104 |                 digits: true, | 
            
              | 87 |             } | 105 |             }, | 
        
          | 88 |         }, | 106 |         }, | 
        
          | 89 |         messages: { | 107 |         messages: { | 
        
          | 90 |             enrolmentperiod: { | 108 |             enrolmentperiod: { | 
          
            
              | 91 |                 required: __("Please choose an enrollment period in months OR by date.") | 109 |                 required: __( | 
            
              |  |  | 110 |                     "Please choose an enrollment period in months OR by date." | 
            
              | 111 |                 ), | 
        
          | 92 |             }, | 112 |             }, | 
        
          | 93 |             enrolmentperioddate: { | 113 |             enrolmentperioddate: { | 
          
            
              | 94 |                 required: __("Please choose an enrollment period in months OR by date.") | 114 |                 required: __( | 
            
              | 95 |             } | 115 |                     "Please choose an enrollment period in months OR by date." | 
            
              | 96 |         } | 116 |                 ), | 
            
              |  |  | 117 |             }, | 
            
              | 118 |         }, | 
            
              | 119 |     }); | 
        
          | 97 |  | 120 |  | 
            
              |  |  | 121 |     let blocked_actions_select = $("select#block_expired[multiple='multiple']"); | 
            
              | 122 |     blocked_actions_select.multipleSelect({ | 
            
              | 123 |         placeholder: _("Please select ..."), | 
            
              | 124 |         selectAll: false, | 
            
              | 125 |         hideOptgroupCheckboxes: true, | 
            
              | 126 |         allSelected: _("All selected"), | 
            
              | 127 |         countSelected: _("# of % selected"), | 
            
              | 128 |         noMatchesFound: _("No matches found"), | 
            
              | 129 |         onClick: function (view) { | 
            
              | 130 |             if ( | 
            
              | 131 |                 view.value == "follow_syspref_BlockExpiredPatronOpacActions" && | 
            
              | 132 |                 view.selected | 
            
              | 133 |             ) { | 
            
              | 134 |                 blocked_actions_select.multipleSelect("uncheck", "hold"); | 
            
              | 135 |                 blocked_actions_select.multipleSelect("uncheck", "renew"); | 
            
              | 136 |             } else if ( | 
            
              | 137 |                 view.value != "follow_syspref_BlockExpiredPatronOpacActions" && | 
            
              | 138 |                 view.selected | 
            
              | 139 |             ) { | 
            
              | 140 |                 blocked_actions_select.multipleSelect( | 
            
              | 141 |                     "uncheck", | 
            
              | 142 |                     "follow_syspref_BlockExpiredPatronOpacActions" | 
            
              | 143 |                 ); | 
            
              | 144 |             } | 
            
              | 145 |         }, | 
        
          | 98 |     }); | 146 |     }); | 
        
          | 99 | }); | 147 | }); | 
            
              | 100 | -  |  |  |