Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 87 lines (71 sloc) 1.938 kB
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
1 #!/usr/bin/perl
2
3 # script to edit a member's flags
4 # Written by Steve Tonnesen
5 # July 26, 2002 (my birthday!)
6
7 use strict;
8
9 use C4::Search;
10 use CGI;
11 use C4::Output;
12 use C4::Auth;
ee506f7 Converted C4Connect to C4::Context->dbh
acli authored
13 use C4::Context;
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
14 use C4::Circulation::Circ2;
15 #use C4::Acquisitions;
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
16 use HTML::Template;
17 use C4::Interface::CGI::Output;
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
18
19 my $input = new CGI;
20
21 my $flagsrequired;
22 $flagsrequired->{borrowers}=1;
23 $flagsrequired->{permissions}=1;
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
24
25 my ($template, $loggedinuser, $cookie)
72c367a fix for 415
tipaul authored
26 = get_template_and_user({template_name => "member-flags.tmpl",
27 query => $input,
28 type => "intranet",
29 authnotrequired => 0,
30 flagsrequired => {borrowers => 1},
31 debug => 1,
32 });
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
33
34
35
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
36
37 my $member=$input->param('member');
38 my %env;
39 $env{'nottodayissues'}=1;
40 my %member2;
41 $member2{'borrowernumber'}=$member;
42 my $issues=currentissues(\%env,\%member2);
43 my $i=0;
44 foreach (sort keys %$issues) {
45 $i++;
46 }
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
47
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
48 if ($input->param('newflags')) {
ee506f7 Converted C4Connect to C4::Context->dbh
acli authored
49 my $dbh=C4::Context->dbh();
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
50 my $flags=0;
51 foreach ($input->param) {
52 if (/flag-(\d+)/) {
53 my $flag=$1;
54 $flags=$flags+2**$flag;
55 }
56 }
57 my $sth=$dbh->prepare("update borrowers set flags=? where borrowernumber=?");
58 $sth->execute($flags, $member);
59 print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$member");
60 } else {
61 my ($bor,$flags,$accessflags)=getpatroninformation(\%env, $member,'');
62
ee506f7 Converted C4Connect to C4::Context->dbh
acli authored
63 my $dbh=C4::Context->dbh();
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
64 my $sth=$dbh->prepare("select bit,flag,flagdesc from userflags order by bit");
65 $sth->execute;
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
66 my @loop;
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
67 while (my ($bit, $flag, $flagdesc) = $sth->fetchrow) {
68 my $checked='';
69 if ($accessflags->{$flag}) {
70 $checked='checked';
71 }
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
72 my %row = ( bit => $bit,
73 flag => $flag,
74 checked => $checked,
75 flagdesc => $flagdesc );
76 push @loop, \%row;
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
77 }
78
76df76e Fixed bug #340 and templated member-flags.tmpl
wolfpac444 authored
79 $template->param(member => $member,
80 surname => $bor->{'surname'},
81 firstname => $bor->{'firstname'},
82 loop => \@loop);
83
84 output_html_with_http_headers $input, $cookie, $template->output;
f43a56d Merging from rel-1-2 to trunk
tonnesen authored
85
86 }
Something went wrong with that request. Please try again.