LP#1068287 UI tweak and renewal behavior
authorJason Etheridge <jason@equinoxinitiative.org>
Fri, 6 Sep 2019 03:51:46 +0000 (23:51 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 6 Sep 2019 22:07:15 +0000 (18:07 -0400)
Skips the CREATE_PRECAT permission check when renewing pre-cataloged items.

Also disables all the elements except the Cancel button in the Pre-Cat dialog
when the user lacks the CREATE_PRECAT permission, and repositions the explanatory
text.

Also includes release notes.

Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
Open-ILS/src/templates/staff/circ/share/t_precat_dialog.tt2
docs/RELEASE_NOTES_NEXT/Circulation/create-precat-permission.adoc [new file with mode: 0644]

index edf0586..5c810d6 100644 (file)
@@ -2427,7 +2427,7 @@ sub make_precat_copy {
     my $self = shift;
     my $copy = $self->copy;
     return $self->bail_on_events(OpenILS::Event->new('PERM_FAILURE'))
-       unless $self->editor->allowed('CREATE_PRECAT');
+       unless $self->editor->allowed('CREATE_PRECAT') || $self->is_renewal;
 
    if($copy) {
         $logger->debug("circulator: Pre-cat copy already exists in checkout: ID=" . $copy->id);
index d28023a..e24db42 100644 (file)
@@ -8,27 +8,34 @@
         <h4 class="modal-title">
           [% l('Barcode "{{precatArgs.copy_barcode}}" was mis-scanned or is a non-cataloged item.') %]
         </h4>
+        <div ng-show="!can_create_precats" class="alert alert-warning">
+            [% l('You do not have permission to create a pre-cataloged item with this barcode.') %]
+        </div>
       </div>
       <div class="modal-body">
         <div class="form-group">
           <label for="precat-title">[% l('Title') %]</label>
           <input type="text" class="form-control" focus-me='focusMe' required
+            ng-disabled="!can_create_precats"
             id="precat-title" ng-model="precatArgs.dummy_title" placeholder="[% l('Title...') %]"/>
         </div>
         <div class="form-group">
           <label for="precat-author">[% l('Author') %]</label>
           <input type="text" class="form-control" id="precat-author"
+            ng-disabled="!can_create_precats"
             ng-model="precatArgs.dummy_author" placeholder="[% l('Author...') %]"/>
         </div>
         <div class="form-group">
           <label for="precat-isbn">[% l('ISBN') %]</label>
           <input type="text" class="form-control" id="precat-isbn"
+            ng-disabled="!can_create_precats"
             ng-keydown="preventSubmit($event)"
             ng-model="precatArgs.dummy_isbn" placeholder="[% l('ISBN...') %]"/>
         </div>
         <div class="form-group">
           <label for="precat-circmod">[% l('Circulation Modifier') %]</label>
           <select class="form-control" id="precat-circmod" 
+            ng-disabled="!can_create_precats"
             ng-model="precatArgs.circ_modifier">
             <option value=""></option>
             <option ng-repeat="mod in circModifiers | orderBy:'name()'"
         </div>
       </div>
       <div class="modal-footer">
-        <div ng-show="!can_create_precats" class="alert alert-warning">
-            [% l('You do not have permission to complete this action.') %]
-        </div>
-        <input type="submit" class="btn btn-primary" value="[% l('Precat Checkout') %]"/>
+        <input type="submit" class="btn btn-primary" value="[% l('Precat Checkout') %]"
+            ng-disabled="!can_create_precats"
+        />
         <button class="btn btn-warning" ng-click="cancel()"
             ng-class="{disabled : actionPending}">[% l('Cancel') %]</button>
       </div>
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/create-precat-permission.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/create-precat-permission.adoc
new file mode 100644 (file)
index 0000000..cf04e15
--- /dev/null
@@ -0,0 +1,13 @@
+New Permission: CREATE_PRECAT
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+This permission is required to create (or re-create) a pre-cataloged item
+through the "Barcode ??? was mis-scanned or is a non-cataloged item."
+dialog.  All form elements in the pre-cat dialog other than the Cancel
+button will be disabled if the current user lacks the CREATE_PRECAT
+permission when an uncataloged (or already pre-cataloged item) is scanned.
+This permission is not needed to renew pre-cataloged items.
+
+The upgrade script for this feature will insert the permission into every
+permission group that has the STAFF_LOGIN permission, so out-of-the-box no
+behavior will change.