LP#1068287 - new precat permission - make_precat_copy perm check user/cesardv/lp1068287_new_precat_perm
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 22 Feb 2019 15:41:46 +0000 (10:41 -0500)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Mon, 4 Mar 2019 17:04:50 +0000 (12:04 -0500)
Misc refactoring.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index 872d8b0..756c66f 100644 (file)
@@ -1623,8 +1623,6 @@ sub do_checkout {
     }
 
     if( $self->is_precat ) {
-        return $self->bail_on_events(OpenILS::Event->new('PERM_FAILURE'))
-            unless $self->editor->allowed('CREATE_PRECAT');
         $self->make_precat_copy;
         return if $self->bail_out;
 
@@ -2428,6 +2426,8 @@ sub create_due_date {
 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');
 
    if($copy) {
         $logger->debug("circulator: Pre-cat copy already exists in checkout: ID=" . $copy->id);