Skip to content

Commit

Permalink
Don't assume userenv is set
Browse files Browse the repository at this point in the history
  • Loading branch information
kylemhall committed Sep 27, 2022
1 parent 553b93d commit 1264752
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Koha/Plugin/Com/ByWaterSolutions/BarcodePrefixer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ sub patron_barcode_transform {
if ( $$barcode ) {
$self->barcode_transform( 'patron', $barcode );
} elsif (C4::Context->preference("autoMemberNum")) { # fixup_cardnumber, Autogenerate next cardnumber from highest value found in database
my $branchcode = C4::Context->userenv->{branch};
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
return unless $branchcode;

my $yaml = $self->retrieve_data('yaml_config');
Expand Down Expand Up @@ -98,7 +98,7 @@ sub item_barcode_transform {
if ( $$barcode ) {
$self->barcode_transform( 'item', $barcode );
} else { # Auto-generate next item barcode from highest value found in database
my $branchcode = C4::Context->userenv->{branch};
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
return unless $branchcode;

my $yaml = $self->retrieve_data('yaml_config');
Expand Down Expand Up @@ -159,7 +159,7 @@ sub barcode_transform {

my $barcode = $$barcode_ref;

my $branchcode = C4::Context->userenv->{branch};
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
return unless $branchcode;

my $yaml = $self->retrieve_data('yaml_config');
Expand Down

0 comments on commit 1264752

Please sign in to comment.