diff --git a/circ/circulation.pl b/circ/circulation.pl
index d7f2e144c2..96ec103da2 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -31,26 +31,28 @@ use C4::Print;
use DBI;
use C4::Auth;
use C4::Interface::CGI::Output;
+use C4::Koha;
+use HTML::Template;
my $query=new CGI;
-my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
- ($query, 0, { circulate => 1 });
+#my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
+# ($query, 0, { circulate => 1 });
-#my ($template, $loggedinuser, $sessioncookie) = get_template_and_user
-# ({
-# template_name => 'circ/circulation.tmpl',
-# query => $query,
-# type => "intranet",
-# authnotrequired => 0,
-# flagsrequired => { circulate => 1 },
-# });
+my ($template, $loggedinuser, $cookie) = get_template_and_user
+ ({
+ template_name => 'circ/circulation.tmpl',
+ query => $query,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { circulate => 1 },
+ });
my %env;
-my $headerbackgroundcolor='#99cc33';
+#my $headerbackgroundcolor='#99cc33';
my $linecolor1='#ffffcc';
my $linecolor2='white';
-my $backgroundimage="/images/background-mem.gif";
+#my $backgroundimage="/images/background-mem.gif";
my $branches = getbranches();
my $printers = getprinters(\%env);
@@ -60,12 +62,11 @@ my $printer = getprinter($query, $printers);
#set up cookie.....
-my $info = '';
my $branchcookie;
my $printercookie;
if ($query->param('setcookies')) {
- $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
- $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
+ $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y');
+ $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y');
}
$env{'branchcode'}=$branch;
@@ -83,17 +84,17 @@ my $borrowerslist;
# if there is a list of find borrowers....
my $findborrower = $query->param('findborrower');
if ($findborrower) {
- my ($borrowers, $flags) = findborrower(\%env, $findborrower);
- my @borrowers=@$borrowers;
- if ($#borrowers == -1) {
- $query->param('findborrower', '');
- $message = "No borrower matched '$findborrower'";
- } elsif ($#borrowers == 0) {
- $query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
- $query->param('barcode','');
- } else {
- $borrowerslist = \@borrowers;
- }
+ my ($borrowers, $flags) = findborrower(\%env, $findborrower);
+ my @borrowers=@$borrowers;
+ if ($#borrowers == -1) {
+ $query->param('findborrower', '');
+ $message = "No borrower matched '$findborrower'";
+ } elsif ($#borrowers == 0) {
+ $query->param('borrnumber', $borrowers[0]->{'borrowernumber'});
+ $query->param('barcode','');
+ } else {
+ $borrowerslist = \@borrowers;
+ }
}
my $borrowernumber = $query->param('borrnumber');
@@ -102,16 +103,14 @@ my $bornum = $query->param('borrnumber');
my $print=$query->param('print');
my $barcode = $query->param('barcode');
if ($barcode eq '' && $print eq 'maybe'){
- $print = 'yes';
+ $print = 'yes';
}
if ($print eq 'yes' && $borrowernumber ne ''){
- printslip(\%env,$borrowernumber);
- $query->param('borrnumber','');
- $borrowernumber='';
+ printslip(\%env,$borrowernumber);
+ $query->param('borrnumber','');
+ $borrowernumber='';
}
-
-
# get the borrower information.....
my $borrower;
my $flags;
@@ -122,16 +121,14 @@ if ($borrowernumber) {
# get the responses to any questions.....
my %responses;
foreach (sort $query->param) {
- if ($_ =~ /response-(\d*)/) {
- $responses{$1} = $query->param($_);
- }
+ if ($_ =~ /response-(\d*)/) {
+ $responses{$1} = $query->param($_);
+ }
}
if (my $qnumber = $query->param('questionnumber')) {
- $responses{$qnumber} = $query->param('answer');
+ $responses{$qnumber} = $query->param('answer');
}
-
-
my ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer);
my $year=$query->param('year');
@@ -140,171 +137,34 @@ my $day=$query->param('day');
# if the barcode is set
if ($barcode) {
- $barcode = cuecatbarcodedecode($barcode);
- my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
+ $barcode = cuecatbarcodedecode($barcode);
+ my ($datedue, $invalidduedate) = fixdate($year, $month, $day);
- unless ($invalidduedate) {
- $env{'datedue'}=$datedue;
- my @time=localtime(time);
- my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
- ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message)
- = issuebook(\%env, $borrower, $barcode, \%responses, $date);
- }
+ unless ($invalidduedate) {
+ $env{'datedue'}=$datedue;
+ my @time=localtime(time);
+ my $date= (1900+$time[5])."-".($time[4]+1)."-".$time[3];
+ ($iteminformation, $duedate, $rejected, $question, $questionnumber, $defaultanswer, $message)
+ = issuebook(\%env, $borrower, $barcode, \%responses, $date);
+ }
}
# reload the borrower info for the sake of reseting the flags.....
if ($borrowernumber) {
- ($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
+ ($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
}
-
##################################################################################
# HTML code....
-
-my $rejectedtext;
-if ($rejected) {
- if ($rejected == -1) {
- } else {
- $rejectedtext = << "EOF";
-
-| Error Issuing Book |
-| $rejected |
-
-
-EOF
- }
-}
-
-my $selectborrower;
-if ($borrowerslist) {
- $selectborrower = <<"EOF";
-
-EOF
-
my $responsesform = '';
foreach (keys %responses) {
$responsesform.="\n";
}
my $questionform;
+my $stickyduedate;
if ($question) {
- my $stickyduedate=$query->param('stickyduedate');
- $questionform = <<"EOF";
-
-|
-Issuing Question |
-|
-Attempting to issue $iteminformation->{'title'}
-by $iteminformation->{'author'} to $borrower->{'firstname'} $borrower->{'surname'}.
-
-$question
- |
|
-|
-
- |
-
-
-
-EOF
+ $stickyduedate=$query->param('stickyduedate');
}
@@ -339,61 +199,6 @@ my $selected='';
($query->param('stickyduedate')) && ($selected='checked');
-my $barcodeentrytext = <<"EOF";
-
-EOF
-
-
-# collect the messages and put into message table....
-my $messagetable;
-if ($message) {
- $messagetable = << "EOF";
-
-EOF
-}
-
-
-
# make the issued books table.....
my $todaysissues='';
my $previssues='';
@@ -460,96 +265,76 @@ EOF
}
}
-my $issuedbookstable;
-if ($todaysissues) {
- $issuedbookstable .= <<"EOF";
-
-|
-Todays Issues |
-| Due Date | Bar Code | Title | Author | Class |
-$todaysissues
-
-EOF
-}
-if ($previssues) {
- $issuedbookstable .= <<"EOF";
-
-|
-Previous Issues |
-| Due Date | Bar Code | Title | Author | Class |
-$previssues
-
-EOF
-}
-
-
-
-
-
# actually print the page!
+#if ($branchcookie && $printercookie) {
+# print $query->header(-type=>'text/html',-expires=>'now', -cookie=>[$branchcookie,$printercookie,$sessioncookie]);
+#} else {
+# print $query->header(-cookie=>[$sessioncookie]);
+#}
+#if ($query->param('barcode') eq '' && $query->param('charges') eq 'yes'){
+# my $count=@inp;
+# for (my $i=0;$i<$count;$i++){
+# $inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\",700,600\)\;window1.focus\(\)/;
+# }
+#}
-if ($branchcookie && $printercookie) {
- print $query->header(-type=>'text/html',-expires=>'now', -cookie=>[$branchcookie,$printercookie,$sessioncookie]);
-} else {
- print $query->header(-cookie=>[$sessioncookie]);
+my @values;
+my %labels;
+my $CGIselectborrower;
+if ($borrowerslist) {
+ foreach (sort {$a->{'surname'}.$a->{'firstname'} cmp $b->{'surname'}.$b->{'firstname'}} @$borrowerslist){
+ push @values,$_->{'borrowernumber'};
+ $labels{$_->{'borrowernumber'}} ="$_->{'surname'}, $_->{'firstname'} ($_->{'cardnumber'})";
+ }
+ $CGIselectborrower=CGI::scrolling_list( -name => 'borrnumber',
+ -values => \@values,
+ -labels => \%labels,
+ -size => 7,
+ -multiple => 0 );
}
+#title
-print startpage();
-my @inp=startmenu('circulation');
-if ($query->param('barcode') eq '' && $query->param('charges') eq 'yes'){
- my $count=@inp;
- for (my $i=0;$i<$count;$i++){
- $inp[$i]=~ s/onLoad=focusinput\(\)/onLoad=focusinput\(\)\;messenger\(\"\/cgi-bin\/koha\/pay.pl?bornum=$bornum\",700,600\)\;window1.focus\(\)/;
- }
-}
+my ($patrontable, $flaginfotable) = patrontable($borrower);
+my $amountold=$flags->{'CHARGES'}->{'message'};
+my @temp=split(/\$/,$amountold);
+$amountold=$temp[1];
+$template->param(
+ findborrower => $findborrower,
+ borrower => $borrower,
+ borrowernumber => $borrowernumber,
+ branch => $branch,
+ printer => $printer,
+ branchname => $branches->{$branch}->{'branchname'},
+ printername => $printers->{$printer}->{'printername'},
-print @inp;
+ #question form
+ question => $question,
+ title => $iteminformation->{'title'},
+ author => $iteminformation->{'author'},
+ firstname => $borrower->{'firstname'},
+ surname => $borrower->{'surname'},
+ question => $question,
+ barcode => $barcode,
+ questionnumber => $questionnumber,
+ dayoptions => $dayoptions,
+ monthoptions => $monthoptions,
+ yearoptions => $yearoptions,
+ stickyduedate => $stickyduedate,
+ responseform => $responsesform,
+ rejected => $rejected,
+ message => $message,
+ CGIseleborrower => $CGIselectborrower,
+ patrontable => $patrontable,
+ flaginfotable => $flaginfotable,
+ CHARGES => $flags->{'CHARGES'},
+ amountold => $amountold,
+ todayissues => $todaysissues,
+ previssues => $previssues,
+ );
-#print startmenu('circulation');
-if ($borrower) {
- print $title;
-} else {
- print $titlenoborrower;
-}
-
-
-print $info;
-
-if ($question) {
- print $questionform;
-}
-
-print $rejectedtext;
-print $messagetable;
-
-
-unless ($borrower) {
- if ($borrowerslist) {
- print $selectborrower;
- } else {
- print $cardnumberinput;
- }
-}
-
-
-
-if ($borrower) {
- my ($patrontable, $flaginfotable) = patrontable($borrower);
- print $patrontable;
- print $flaginfotable;
- print $barcodeentrytext;
- print "
";
- print $issuedbookstable;
-}
-
-
-
-
-print endmenu('circulation');
-print endpage();
-
+output_html_with_http_headers $query, $cookie, $template->output;
####################################################################
# Extra subroutines,,,
@@ -641,12 +426,12 @@ sub patrontable {
}
}
}
- ($flaginfotext) && ($flaginfotext="
| Flags |
$flaginfotext\n");
+ ($flaginfotext) && ($flaginfotext="| Flags |
$flaginfotext\n");
$flaginfotext.="";
my $patrontable= << "EOF";
- | Patron Information |
+ | Patron Information |
{'borrowernumber'} onClick="openWindow(this,'Member', 480, 640)">$borrower->{'cardnumber'} $borrower->{'surname'}, $borrower->{'title'} $borrower->{'firstname'} $borrower->{'streetaddress'} $borrower->{'city'} Cat: $borrower->{'categorycode'} |
EOF
diff --git a/koha-tmpl/intranet-tmpl/default/en/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/default/en/circ/circulation.tmpl
new file mode 100644
index 0000000000..2657e3d98b
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/default/en/circ/circulation.tmpl
@@ -0,0 +1,243 @@
+
+
+
+
+ Circulation: Issues
+ Branch:
+ Printer:
+ Change Settings
+ >
+ >
+
+
+
+ Circulation: Issues
+ Branch:
+ Printer:
+ Change Settings
+ >
+ >
+
+
+
+
+
+
+ | /images/background-mem.gif">
+ Issuing Question
+ |
+
+
+
+
+
+ |
+ Attempting to issue
+ by to .
+
+ |
+
+
+ |
+
+
+ |
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+ | /images/background-mem.gif">Messages |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | /images/background-mem.gif">
+
+ Todays Issues
+ |
+
+
+ | Due Date | Bar Code | Title | Author | Class |
+
+
+
+
+
+
+
+
+ | /images/background-mem.gif">
+
+ Previous Issues
+ |
+
+
+ | Due Date | Bar Code | Title | Author | Class |
+
+
+
+
+