Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug #340 and templated member-flags.tmpl

  • Loading branch information...
commit 76df76e7a41756114778227bad86bd8240327000 1 parent 574e8e7
wolfpac444 authored
Showing with 54 additions and 21 deletions.
  1. +28 −0 koha-tmpl/intranet-tmpl/default/en/member-flags.tmpl
  2. +26 −21 member-flags.pl
View
28 koha-tmpl/intranet-tmpl/default/en/member-flags.tmpl
@@ -0,0 +1,28 @@
+<TMPL_INCLUDE NAME="members-top.inc">
+
+<h2><TMPL_VAR NAME=surname>, <TMPL_VAR NAME=firstname></h2>
+<form method=post>
+ <input type=hidden name=member value=<TMPL_VAR NAME=member>>
+ <input type=hidden name=newflags value=1>
+ <table border=1>
+ <tr><th background=/koha/images/background-mem.gif colspan=3>FLAGS</th></tr>
+ <TMPL_LOOP NAME=loop>
+ <tr>
+ <td>
+ <input type=checkbox name=flag-<TMPL_VAR NAME=bit> <TMPL_VAR NAME=checked>>
+ </td>
+ <td>
+ <TMPL_VAR NAME=flag>
+ </td>
+ <td>
+ <TMPL_VAR NAME=flagdesc>
+ </td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+
+ <p>
+ <input type=submit value="Set Flags">
+</form>
+
+<TMPL_INCLUDE NAME="members-bottom.inc">
View
47 member-flags.pl
@@ -13,13 +13,25 @@
use C4::Context;
use C4::Circulation::Circ2;
#use C4::Acquisitions;
+use HTML::Template;
+use C4::Interface::CGI::Output;
my $input = new CGI;
my $flagsrequired;
$flagsrequired->{borrowers}=1;
$flagsrequired->{permissions}=1;
-my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
+
+my ($template, $loggedinuser, $cookie)
+ = get_template_and_user({template_name => "member-flags.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ debug => 1,
+ });
+
+
+
my $member=$input->param('member');
my %env;
@@ -31,6 +43,7 @@
foreach (sort keys %$issues) {
$i++;
}
+
if ($input->param('newflags')) {
my $dbh=C4::Context->dbh();
my $flags=0;
@@ -49,32 +62,24 @@
my $dbh=C4::Context->dbh();
my $sth=$dbh->prepare("select bit,flag,flagdesc from userflags order by bit");
$sth->execute;
- my $flagtext='';
+ my @loop;
while (my ($bit, $flag, $flagdesc) = $sth->fetchrow) {
my $checked='';
if ($accessflags->{$flag}) {
$checked='checked';
}
- $flagtext.="<tr><td><input type=checkbox name=flag-$bit $checked></td><td>$flag</td><td>$flagdesc</td></tr>\n";
+ my %row = ( bit => $bit,
+ flag => $flag,
+ checked => $checked,
+ flagdesc => $flagdesc );
+ push @loop, \%row;
}
- print $input->header(-cookie => $cookie);
- print startpage();
- print startmenu('member');
- print qq|
- <h2>$bor->{'surname'}, $bor->{'firstname'}</h2>
- <form method=post>
- <input type=hidden name=member value=$member>
- <input type=hidden name=newflags value=1>
- <table border=1>
- <tr><th background=/koha/images/background-mem.gif colspan=3>FLAGS</th></tr>
- $flagtext
- </table>
- <p>
- <input type=submit value="Set Flags">
- </form>
- |;
+ $template->param(member => $member,
+ surname => $bor->{'surname'},
+ firstname => $bor->{'firstname'},
+ loop => \@loop);
+
+ output_html_with_http_headers $input, $cookie, $template->output;
- print endmenu('member');
- print endpage();
}
Please sign in to comment.
Something went wrong with that request. Please try again.