LP#1849370 Mark items as damaged - changing fee usability issues user/dbriem/lp1849370_mark_damaged_usability_issues
authorDan Briem <dbriem@wlsmail.org>
Fri, 1 Nov 2019 00:21:17 +0000 (20:21 -0400)
committerDan Briem <dbriem@wlsmail.org>
Fri, 1 Nov 2019 00:21:17 +0000 (20:21 -0400)
On the mark copy damaged modal the null condition of the fee is used to toggle
the fee interface. But, an empty number input with ng-model binds as null, so
if it's cleared it removes itself from the DOM.

Also, open-ils.circ.mark_item_damaged charges full copy price if the fee param
is falsy and the submit button is only disabled if the fee is null (allows $0).

This branch removes the billing interface only if the previous circ info is
present (no reason to bill) and won't submit the fee if falsy.

To test:
1. Set the org unit setting "charge item price when damaged" to true
2. Checkout an item to a patron
3. Go the item status screen and scan the item
4. Select the item and, under actions, select mark damaged
5. Click confirm, clear the fee input, & note the billing interface disappears
6. Apply patch
7. Repeat steps, note clearing the fee doesn't hide the billing interface

Signed-off-by: Dan Briem <dbriem@wlsmail.org>
Open-ILS/src/templates/staff/circ/share/t_mark_damaged.tt2

index 467fa13..4623daa 100644 (file)
@@ -9,14 +9,14 @@
   <div class="pad-vert row">
     <div class="col-md-12">
       [% l("Item [_1] will be marked damaged. ", "{{barcode}}") %]
-      <span ng-if="circ && billArgs.charge != null">[% l("Was returned ") %]
+      <span ng-if="circ">[% l("Was returned ") %]
         <span ng-if="circ_checkin_time">[% l("on [_1] ","{{circ_checkin_time | date:'MM/dd/yy H:mm a'}}") %]</span>
       [% l("for [_1] : [_2]. ",
       "{{circ_patron_name}}", "{{circ.usr().usrname()}}") %]
       [% l("Confirmation required to charge this patron [_1] for the damage.", "{{billArgs.charge | currency}}") %]</span>
     </div>
   </div>
-  <div class="pad-vert row" ng-if="circ && billArgs.charge != null">
+  <div class="pad-vert row" ng-if="circ">
     <div class="col-md-3">
       <label>[% l("Fee") %]
       <input type="number" min="0" step="any" class="form-control" ng-disabled="applyFine == 'noapply'"
@@ -33,7 +33,7 @@
       </label>
     </div>
   </div>
-  <div class="pad-vert row" ng-if="circ && billArgs.charge != null">
+  <div class="pad-vert row" ng-if="circ">
     <div class="col-md-6">
       <label>[% l("Note") %]
       <textarea rows="3" class="form-control" placeholder="[% l('Note...') %]"  ng-disabled="applyFine == 'noapply'"
   </div>
 </div>
 <div class="modal-footer">
-  <div class="btn-group pull-left" ng-if="circ && billArgs.charge != null">
+  <div class="btn-group pull-left" ng-if="circ">
     <label class="btn btn-primary" ng-model="mode" btn-radio="'charge'"
       ng-class="{active: mode == 'charge'}" ng-click="btnChargeFees()">[% l('Charge Fees') %]</label>
     <label class="btn btn-primary" ng-model="mode" btn-radio="'waive'"
       ng-class="{active: mode == 'waive'}" ng-click="btnWaiveFees()">[% l('No Charge') %]</label>
   </div>
-  <button class="btn btn-primary" ng-disabled="applyFine == 'apply' && circ && (billArgs.charge == null || !billArgs.type)" ng-click="ok()">[% l('Submit') %]</button>
+  <button class="btn btn-primary" ng-disabled="applyFine == 'apply' && circ && (!billArgs.charge || !billArgs.type)" ng-click="ok()">[% l('Submit') %]</button>
   <button class="btn btn-warning" ng-if="!billArgs.charge && applyFine != 'noapply'" ng-click="cancel()">[% l('Cancel') %]</button>
 </div>