Bug 18752 - Automatic item modifications by age should allow 'blank' values
authorOwen Leonard <oleonard@myacpl.org>
Thu, 8 Jun 2017 15:19:22 +0000 (15:19 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 13 Jun 2017 19:21:37 +0000 (16:21 -0300)
This patch modifies the automatic item modification by age template to
correct errors in form validation:

- Age in days should not be required
- A value should not be required in substitutions.

To test, apply the patch and clear your browser cache if necessary.

- Go to Tools -> Automatic item modification by age.
- Confirm that when editing or creating a rule the only required field
  is the substitutions field name.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt
koha-tmpl/intranet-tmpl/prog/js/automatic_item_modification_by_age.js

index 946ad3a..44aa3ff 100644 (file)
@@ -85,8 +85,7 @@
                     <input type="hidden" name="unique_id" value="[% loop.count %]" /> <!-- FIXME on update, the unique_id should be filled -->
                     <div class="age">
                       <h5>Age in days</h5>
-                      <input class="age" required="required" type="number" value="[% rule.age %]" name="age_[% id %]" />
-                      <span class="required">Required</span>
+                      <input class="age" type="number" value="[% rule.age %]" name="age_[% id %]" />
                     </div>
                     <div class="blocks">
                       <h5>Conditions</h5>
                             [% END %]
                           </select>
                           =
-                          <input class="required" required="required" type="text" value="[% substitution.value %]" name="substitution_value_[% id %]" />
+                          <input type="text" value="[% substitution.value %]" name="substitution_value_[% id %]" />
                           <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
                           <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
-                          <span class="required">Required</span>
+                          <span class="required">A field name is required</span>
                         </div>
                       [% END %]
                     </div>
             <div class="age">
               <h5>Age in days</h5>
               <input class="age" type="number" value="" name="age" />
-              <span class="required">Required</span>
             </div>
             <div class="blocks">
               <h5>Conditions</h5>
                   [% END %]
                 </select>
                 =
-                <input class="required" required="required" type="text" value="" name="substitution_value" />
+                <input type="text" value="" name="substitution_value" />
                 <a class="add_block" href="#"><i class="fa fa-plus"></i> Add a substitution</a>
                 <a class="remove_block" href="#"><i class="fa fa-trash"></i> Remove substitution</a>
-                <span class="required">Required</span>
+                <span class="required">A field name is required</span>
               </div>
             </div>
           </fieldset>
index d14b55a..6c37d9b 100644 (file)
@@ -117,7 +117,6 @@ $(document).ready(function() {
     });
 
     jQuery.validator.addClassRules("age", {
-        required: true,
         digits: true
     });