3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
22 script to update a child member to (usually) an adult member category
24 - if called with op=multi, will return all available non child categories, for selection.
25 - if called with op=update, script will update member record via ModMember().
38 my $dbh = C4
::Context
->dbh;
41 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
43 template_name
=> "members/update-child.tmpl",
47 flagsrequired
=> { borrowers
=> 1 },
52 my $borrowernumber = $input->param('borrowernumber');
53 my $catcode = $input->param('catcode');
54 my $cattype = $input->param('cattype');
55 my $op = $input->param('op');
57 if ( $op eq 'multi' ) {
58 my ( $catcodes, $labels ) =
59 GetborCatFromCatType
( 'C', 'WHERE category_type <> ?' );
61 foreach my $k ( keys %$labels ) {
64 $row->{catdesc
} = $labels->{$k};
65 my $borcat = GetBorrowercategory
( $row->{catcode
} );
66 $row->{cattype
} = $borcat->{'category_type'};
71 borrowernumber
=> $borrowernumber,
74 output_html_with_http_headers
$input, $cookie, $template->output;
77 elsif ( $op eq 'update' ) {
78 my $member = GetMember
($borrowernumber);
79 $member->{'guarantorid'} = '0';
80 $member->{'categorycode'} = $catcode;
81 my $borcat = GetBorrowercategory
($catcode);
82 $member->{'category_type'} = $borcat->{'category_type'};
83 $member->{'description'} = $borcat->{'description'};
87 borrowernumber
=> $borrowernumber,
89 output_html_with_http_headers
$input, $cookie, $template->output;