if ( $src eq 'circ' ) {
# if we were called from circulation, use the circulation menu and get data to populate it -fbcit
- use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
my $borrowernumber = $object;
my $patron = Koha::Patrons->find( $borrowernumber );
- $template->param( picture => 1 ) if $patron->image;
- my $data = $patron->unblessed;
-
+ unless ( $patron ) {
+ print $input->redirect("/cgi-bin/koha/circ/circulation.pl?borrowernumber=$borrowernumber");
+ exit;
+ }
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
- my $attributes = GetBorrowerAttributes( $data->{'borrowernumber'} );
+ my $attributes = GetBorrowerAttributes( $borrowernumber );
$template->param(
ExtendedPatronAttributes => 1,
extendedattributes => $attributes
);
}
- $template->param(%$data);
-
$template->param(
- menu => 1,
- borrowernumber => $borrowernumber,
- categoryname => $patron->category->description,
- RoutingSerials => C4::Context->preference('RoutingSerials'),
+ patron => $patron,
+ circulation => 1,
);
}
$result->{'biblionumber'} = q{};
$result->{'biblioitemnumber'} = q{};
$result->{'barcode'} = q{};
- $result->{'userfirstname'} = q{};
- $result->{'usersurname'} = q{};
- $result->{'borrowerfirstname'} = q{};
- $result->{'borrowersurname'} = q{};
if ( substr( $result->{'info'}, 0, 4 ) eq 'item' || $result->{module} eq "CIRCULATION" ) {
if ( $result->{'user'} ) {
my $patron = Koha::Patrons->find( $result->{'user'} );
if ($patron) {
- $result->{'userfirstname'} = $patron->firstname;
- $result->{'usersurname'} = $patron->surname;
+ $result->{librarian} = $patron;
}
}
if ( $result->{'object'} ) {
my $patron = Koha::Patrons->find( $result->{'object'} );
if ($patron) {
- $result->{'borrowerfirstname'} = $patron->firstname;
- $result->{'borrowersurname'} = $patron->surname;
+ $result->{patron} = $patron;
}
}
}