In the 5 places in the label editor, the user's current branch is determined by taking
the LoginBranchname and doing a reverse look up for the branchcode. This is an unnecessary
query, since C4::Context->userenv has the immediate access to the branchcode; this is how
it's summoned in all other points in the Koha code.
This addresses bug 6673 because, since the move to T:T, the call in tools/manage-marc-import.pl
has used in correct syntax: $template->param('LoginBranchname') instead of $template->{VARS}->param('LoginBranchname')
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
my @item_numbers = $cgi->param('item_number') if $cgi->param('item_number');
my $barcode = $cgi->param('barcode') if $cgi->param('barcode');
-my $branch_code = get_branch_code_from_name($template->{VARS}->{'LoginBranchname'});
+my $branch_code = C4::Context->userenv->{'branch'};
if ($op eq 'remove') {
$batch = C4::Labels::Batch->retrieve(batch_id => $batch_id);
my $element_id = $cgi->param('element_id') || undef;
my $error = $cgi->param('error') || 0;
-my $branch_code = ($label_element eq 'batch' ? get_branch_code_from_name($template->{VARS}->{'LoginBranchname'}) : '');
+my $branch_code = ($label_element eq 'batch' ? C4::Context->userenv->{'branch'} : '');
if ($op eq 'delete') {
if ($label_element eq 'layout') {$error = C4::Labels::Layout::delete(layout_id => $element_id);}
my @borrower_numbers = $cgi->param('borrower_number') if $cgi->param('borrower_number');
my $errstr = $cgi->param('error') || '';
-my $branch_code = get_branch_code_from_name($template->{VARS}->{'LoginBranchname'});
+my $branch_code = C4::Context->userenv->{'branch'};
if ($op eq 'remove') {
$batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id);
};
my $errstr = ($cgi->param('error') ? $cgi->param('error') : '');
-my $branch_code = ($card_element eq 'batch' ? get_branch_code_from_name($template->{VARS}->{'LoginBranchname'}) : '');
+my $branch_code = ($card_element eq 'batch' ? C4::Context->userenv->{'branch'} : '');
if ($op eq 'delete') {
my $err = 0;
sub create_labelbatch_from_importbatch {
my ($batch_id) = @_;
my $err = undef;
- my $branch_code = get_branch_code_from_name($template->param('LoginBranchname'));
+ my $branch_code = C4::Context->userenv->{'branch'};
my $batch = C4::Labels::Batch->new(branch_code => $branch_code);
my @items = GetItemNumbersFromImportBatch($batch_id);
if (grep{$_ == 0} @items) {