2 # code modified by Trendsetters (from original circulation.pl)
3 # Please use 8-character tabs for this file (indents are every 4 characters)
5 # rychi edit: we're just trying to issue some books. 'Trendsetters' code mostly deleted.
6 # Note: This is incomplete; implemented for a library that trusts its users and has no fines;
7 # as such, there are some circ functions that are missing and tests that are skipped.
9 # The issuer is a special user
10 # with borrowerflag 'selfcheck' set. The borrower has been authenticated.
11 # We're going to post a barcode with a form, and check that barcode for issuability.
12 # If it's issuable, we issue it. If there's an error, we call a popup.
16 # # This file is part of Koha.
18 # Koha is free software; you can redistribute it and/or modify it under the
19 # terms of the GNU General Public License as published by the Free Software
20 # Foundation; either version 2 of the License, or (at your option) any later
23 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
24 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
25 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
27 # You should have received a copy of the GNU General Public License along with
28 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
29 # Suite 330, Boston, MA 02111-1307 USA
39 use HTML::Template::Pro;
44 #my ($loggedinuser, $sessioncookie, $sessionID) = checkauth
45 # ($query, 0, { circulate => 1 });
46 # loggedinuser is the 'selfchaeckout user'.
47 my ($template, $loggedinuser, $cookie) = get_template_and_user({
48 template_name => 'sco/sco-circ.tmpl',
52 flagsrequired => { circulate => "circulate_remaining_permissions" },
55 my $issuerid = $loggedinuser;
56 my ( $userid, $op, $barcode, $confirmed )= $query->param("userid", "op", "barcode", "confirmed" );
58 my %confirmation_strings = ( RENEW_ISSUE => "This item is already checked out to you. Renew it?", );
61 my ($issuer, $flags) = getpatroninformation(undef,undef, $issuerid);
62 my $item = getiteminformation(undef,undef,$barcode);
64 if ($op eq "finish") {
65 $query->param( userid => undef );
68 my $env = {branchcode => $issuer->{'branchcode'} };
69 warn "here's the branchcode: ".$issuer->{branchcode};
70 my ($borrower, $flags) = getpatroninformation(undef,undef, $userid);
71 my $bornum = $borrower->{borrowernumber};
73 my $borrowerissues = [];
74 my $issues = currentissues( $env, $borrower);
77 $borrowerissues->[$cnt]->{issued} = $_ ;
81 $template->param( OVERDUES => $borrower->{ODUES} ,
82 ISSUES => $borrowerissues,
85 if ($op eq "checkout" ) {
86 my ($impossible,$needconfirm) = canbookbeissued(undef,$borrower,$barcode);
88 my ($issue_error) = keys %$impossible ;
89 $template->param( impossible => $issue_error );
90 } elsif ($needconfirm->{RENEW_ISSUE} ) {
92 renewbook($env,$bornum,$item->{itemnumber},"");
94 $template->param( confirm => $confirmation_strings{RENEW_ISSUE} );
96 } elsif ($needconfirm && !$confirmed ) {
97 my ($confirmation) = keys %$needconfirm ;
98 $template->param( impossible => $confirmation );
100 issuebook($env,$bornum,$barcode,"");
103 #getiteminformation(undef,undef,$item);
109 # reload the borrower info for the sake of reseting the flags.....
110 # if ($borrowernumber) {
111 # ($borrower, $flags) = getpatroninformation(\%env,$borrowernumber,0);
114 $template->param( noauth => 1, );
117 output_html_with_http_headers $query, $cookie, $template->output;
121 # my ($borrower) = @_;
122 # my $flags = $borrower->{'flags'};
123 # my $flaginfotable='';
125 # #my $flaginfotext='';
128 # foreach $flag (sort keys %$flags) {
130 ## my @itemswaiting='';
131 # ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
132 # $flags->{$flag}->{'message'}=~s/\n/<br>/g;
133 # if ($flags->{$flag}->{'noissues'}) {
135 # noissues => 'true',
138 # if ($flag eq 'GNA'){
143 # if ($flag eq 'LOST'){
148 # if ($flag eq 'DBARRED'){
153 # if ($flag eq 'CHARGES') {
156 # chargesmsg => $flags->{'CHARGES'}->{'message'}
160 # if ($flag eq 'CHARGES') {
163 # chargesmsg => $flags->{'CHARGES'}->{'message'}
166 # if ($flag eq 'WAITING') {
167 # my $items=$flags->{$flag}->{'itemlist'};
169 # foreach my $item (@$items) {
170 # my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
171 # $iteminformation->{'branchname'} = $branches->{$iteminformation->{'holdingbranch'}}->{'branchname'};
172 # push @itemswaiting, $iteminformation;
176 # waitingmsg => $flags->{'WAITING'}->{'message'},
177 # itemswaiting => \@itemswaiting,
180 # if ($flag eq 'ODUES') {
183 # oduesmsg => $flags->{'ODUES'}->{'message'}
186 # my $items=$flags->{$flag}->{'itemlist'};
187 # my $currentcolor=$color;
189 # my $color=$currentcolor;
191 # foreach my $item (@$items) {
192 # ($color eq $linecolor1) ? ($color=$linecolor2) : ($color=$linecolor1);
193 # my ($iteminformation) = getiteminformation(\%env, $item->{'itemnumber'}, 0);
194 # push @itemswaiting, $iteminformation;
197 # if ($query->param('module') ne 'returns'){
198 # $template->param( nonreturns => 'true' );
201 # if ($flag eq 'NOTES') {
204 # notesmsg => $flags->{'NOTES'}->{'message'}
209 # return($patrontable, $flaginfotext);