-my %cookie = $query->cookie('userenv');
-($branch) || ( $branch = $cookie{'branch'} );
-($printer) || ( $printer = $cookie{'printer'} );
-
-( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] );
-( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] );
-
-# is you force a selection....
-my $oldbranch = $branch;
-my $oldprinter = $printer;
-
-$env{'branchcode'} = $branch;
-$env{'printer'} = $printer;
-$env{'queue'} = $printer;
-
-# set up select options....
-my $branchcount = 0;
-my $printercount = 0;
-my @branchloop;
-foreach my $br ( keys %$branches ) {
- next unless $br =~ /\S/; # next unless $br is not blank.
-
- $branchcount++;
- my %branch;
- $branch{selected} = ( $br eq $oldbranch );
- $branch{name} = $branches->{$br}->{'branchname'};
- $branch{value} = $br;
- push( @branchloop, \%branch );
+# FIXME: branchprinter is not retained by session. This feature was not adequately
+# ported from Koha 2.2.3 where it had been a separate cookie.
+# So this needs to be fixed for Koha 3 or removed outright.
+# --atz (w/ info from chris cormack)
+
+if ($printer) {
+ if (! $userenv_printer or $userenv_printer ne $printer ) {
+ $session->param('branchprinter', $printer); # update sesssion in DB
+ $template->param('new_printer', $printer); # update template
+ push @updated, {
+ updated_printer => 1,
+ old_printer => $userenv_printer,
+ };
+ } # else printer is the same, no update
+} else {
+ $printer = $userenv_printer; # fallback value