Browse Source

Code to display list of organisations/institutions if memberofinstitution is set to yes

3.0.x
rangi 18 years ago
parent
commit
30412ec5cf
  1. 27
      C4/Members.pm
  2. 26
      members/memberentry.pl

27
C4/Members.pm

@ -19,6 +19,8 @@ package C4::Members;
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
# $Id$
use strict;
require Exporter;
use C4::Context;
@ -56,7 +58,7 @@ C4::Members - Perl Module containing convenience functions for member handling
&getboracctrecord
&borrowercategories &getborrowercategory
&fixEthnicity
&ethnicitycategories
&ethnicitycategories get_institutions
);
@ -947,6 +949,27 @@ sub fixEthnicity($) {
my $data=$sth->fetchrow_hashref;
$sth->finish;
return $data->{'name'};
}
} # sub fixEthnicity
=head2 get_institutions
$insitutions = get_institutions();
Just returns a list of all the borrowers of type I, borrownumber and name
=cut
#'
sub get_institutions {
my $dbh = C4::Context->dbh();
my $sth = $dbh->prepare("SELECT borrowernumber,surname FROM borrowers WHERE categorycode=? ORDER BY surname");
$sth->execute('I');
my %orgs;
while (my $data = $sth->fetchrow_hashref()){
$orgs{$data->{'borrowernumber'}}=$data;
}
$sth->finish();
return(\%orgs);
} # sub get_institutions
1;

26
members/memberentry.pl

@ -59,6 +59,8 @@ my ($template, $loggedinuser, $cookie)
my $borrowerid=$input->param('borrowerid');
my $guarantorid=$input->param('guarantorid');
my $borrowernumber=$input->param('borrowernumber');
my $actionType=$input->param('actionType') || '';
my $modify=$input->param('modify');
my $delete=$input->param('delete');
my $op=$input->param('op');
@ -87,6 +89,7 @@ $template->param( "mandatory$_" => 1);
$template->param( "checked" => 1) if ($nodouble eq 1);
# if a add or modify is requested => check validity of data.
if ($op eq 'add' or $op eq 'modify') {
my @names=$input->param;
@ -228,6 +231,7 @@ SELECT upperagelimit,
if ($delete){
print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowerid");
print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$borrowernumber");
} else { # this else goes down the whole script
# retrieve previous values : either in DB or in CGI, in case of errors in values
my $data;
@ -384,6 +388,26 @@ if ($delete){
-override => 1,
-default => $default,
);
my $CGIorganisations;
my $member_of_institution;
if (C4::Context->preference("memberofinstitution")){
my $organisations=get_institutions();
my @orgs;
my %orgs;
foreach my $organisation (keys %$organisations) {
push @orgs,$organisation;
$orgs{$organisation}=$organisations->{$organisation}->{'surname'};
}
$member_of_institution=1;
$CGIorganisations = CGI::scrolling_list( -name=>'organisations',
-values=>\@orgs,
-size=>5,
-multiple=>'true'
-labels=>\%orgs,
);
}
# --------------------------------------------------------------------------------------------------------
@ -490,6 +514,8 @@ if ($delete){
# city_choice => $city_choice ,#check if the city was selected
nok => $nok,#flag to konw if an error
CGIbranch => $CGIbranch,
memberofinstution => $member_of_institution,
CGIorganisations => $CGIorganisations,
);
#$template->param(Institution => 1) if ($categorycode eq "I");
output_html_with_http_headers $input, $cookie, $template->output;

Loading…
Cancel
Save