From 4e30fba82864746521df170fb8e8ab600490481b Mon Sep 17 00:00:00 2001 From: olwen Date: Wed, 19 Jan 2000 03:16:20 +0000 Subject: [PATCH] Calculate fees for reserves --- C4/Circulation/Issues.pm | 14 +++++++++----- C4/InterfaceCDK.pm | 33 ++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/C4/Circulation/Issues.pm b/C4/Circulation/Issues.pm index eae17be..80cbcca 100755 --- a/C4/Circulation/Issues.pm +++ b/C4/Circulation/Issues.pm @@ -77,7 +77,6 @@ sub Issue { $env->{'loanlength'}=""; if ($reason ne "") { $done = $reason; - #} elsif ($issuesallowed eq "0") { } elsif ($env->{'IssuesAllowed'} eq '0') { error_msg($env,"No Issues Allowed =$env->{'IssuesAllowed'}"); } else { @@ -209,6 +208,11 @@ sub issueitem{ } elsif ($issuestat eq "R") { $canissue = -1; $datedue = $newdate; + $charge = calc_charges($env,$dbh,$item->{'itemnumber'},$bornum); + if ($charge > 0) { + createcharge($env,$dbh,$item->{'itemnumber'},$bornum,$charge); + } + &UpdateStats($env,$env->{'branchcode'},'renew',$charge); } } if ($canissue == 1) { @@ -231,15 +235,15 @@ sub issueitem{ my $btsh = $dbh->prepare($bquery); $btsh->execute; my $resborrower = $btsh->fetchrow_hashref; - my $msgtxt = "Res for $resborrower->{'cardnumber'},"; + my $msgtxt = chr(7)."Res for $resborrower->{'cardnumber'},"; $msgtxt = $msgtxt." $resborrower->{'initials'} $resborrower->{'surname'}"; - my $ans = msg_yn($env,$msgtxt,"Allow issue?"); + my $ans = msg_ny($env,$msgtxt,"Allow issue?"); if ($ans eq "N") { # print a docket; printreserve($env,$resrec,$resborrower,$item); $canissue = 0; } else { - my $ans = msg_yn($env,"Cancel reserve?"); + my $ans = msg_ny($env,"Cancel reserve?"); if ($ans eq "Y") { my $rquery = "update reserves set found = 'F' @@ -268,7 +272,7 @@ sub issueitem{ createcharge($env,$dbh,$item->{'itemnumber'},$bornum,$charge); } } elsif ($canissue == 0) { - debug_msg($env,"can't issue"); + info_msg($env,"Can't issue $item->{'cardnumber'}"); } } else { my $valid = checkdigit($env,$itemnum); diff --git a/C4/InterfaceCDK.pm b/C4/InterfaceCDK.pm index d1b4f49..bd2a04a 100755 --- a/C4/InterfaceCDK.pm +++ b/C4/InterfaceCDK.pm @@ -20,8 +20,8 @@ $VERSION = 0.01; @ISA = qw(Exporter); @EXPORT = qw(&dialog &startint &endint &output &clearscreen &pause &helptext -&textbox &menu &issuewindow &msg_yn &borrower_dialog &debug_msg &error_msg -&selborrower &returnwindow &logondialog &borrowerwindow &titlepanel +&textbox &menu &issuewindow &msg_yn &msg_ny &borrower_dialog &debug_msg &error_msg +&info_msg &selborrower &returnwindow &logondialog &borrowerwindow &titlepanel &borrbind &borrfill &preeborr &borrowerbox &brmenu &prmenu); %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], @@ -141,7 +141,6 @@ sub titlepanel{ sub msg_yn { my ($env,$text1,$text2)=@_; - # Cdk::init(); # Create the dialog buttons. my @buttons = ("Yes", "No"); my @mesg = ("$text1", "$text2"); @@ -155,6 +154,22 @@ sub msg_yn { undef $dialog; return $response; } +sub msg_ny { + my ($env,$text1,$text2)=@_; + # Cdk::init(); + # Create the dialog buttons. + my @buttons = ("No", "Yes"); + my @mesg = ("$text1", "$text2"); + # Create the dialog object. + my $dialog = new Cdk::Dialog ('Message' => \@mesg, 'Buttons' => \@buttons); + my $resp = $dialog->activate(); + my $response = "N"; + if ($resp == 1) { + $response = "Y"; + } + undef $dialog; + return $response; +} sub debug_msg { my ($env,$text)=@_; @@ -172,6 +187,12 @@ sub error_msg { return(); } +sub info_msg { + my ($env,$text)=@_; + popupLabel ([$text]); + return(); +} + sub endint { Cdk::end(); } @@ -360,7 +381,6 @@ sub actfmenu { #debug_msg($env,""); C4::Circulation::Renewals::bulkrenew($env,$dbh, $borrower->{'borrowernumber'},$amountowing,$borrower,$odues); - Cdk::refreshCdkScreen(); } elsif ($funct == 2 ) { $entryBox->erase(); $scroll1->erase(); @@ -369,7 +389,6 @@ sub actfmenu { $funcmenu->erase(); C4::Accounts::reconcileaccount($env,$dbh,$borrower->{'borrowernumber'}, $amountowing,$borrower,$odues); - Cdk::refreshCdkScreen(); } elsif ($funct == 3 ) { C4::Circulation::Borrissues::printallissues ($env,$borrower); } elsif ($funct == 4 ) { @@ -377,6 +396,10 @@ sub actfmenu { } elsif ($funct == 5 ) { actscroll2 ($env,$entryBox,$loanlength,$scroll1,$scroll2); } + Cdk::refreshCdkScreen(); + $entryBox->unregister(); + $entryBox->register(); + return } sub actscroll1 { my ($env,$entryBox,$loanlength,$scroll1,$scroll2) = @_;