Koha/members/purchase-suggestions.pl
Marc Véron 117ee49514 Bug 4041: Third step - Display address on patron's pages using the system preference
This patch displays the address information in the left column of the patron's pages using the new system preference.
The address is formatted in member-display-address-style-us.inc and member-display-address-style-de.inc

To test:
- Apply patch on top of 1st and 2nd patch
- Select 'German style' in system preference 'addressformat' in I18N/L10N
- Verify that the address information displays properly in the left column of all patron's pages.
- Verify that the address displays properly in the main area of moremember.pl as well (Note: In right column, Alternate address /contact are not yet touched))
- Switch system preference to US style, repeat checks

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
AMending without changes to put this patch at the end of the patch list / Marc

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-04-29 11:25:11 -03:00

76 lines
2.3 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Copyright 2012 ByWater Solutions
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Branch;
use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Suggestions;
my $input = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{ template_name => "members/purchase-suggestions.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { borrowers => 1 },
debug => 1,
}
);
my $borrowernumber = $input->param('borrowernumber');
# Set informations for the patron
my $borrower = GetMemberDetails( $borrowernumber, 0 );
foreach my $key ( keys %$borrower ) {
$template->param( $key => $borrower->{$key} );
}
$template->param(
suggestionsview => 1,
categoryname => $borrower->{'description'},
branchname => GetBranchName( $borrower->{'branchcode'} ),
RoutingSerials => C4::Context->preference('RoutingSerials'),
);
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
$template->param(
ExtendedPatronAttributes => 1,
extendedattributes => $attributes
);
}
# Computes full borrower address
my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $borrower->{streettype} );
$template->param( roadtype => $roadtype );
my ($picture, $dberror) = GetPatronImage($borrowernumber);
$template->param( picture => 1 ) if $picture;
my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
$template->param( suggestions => $suggestions );
output_html_with_http_headers $input, $cookie, $template->output;