Bugzilla – Attachment 7127 Details for
Bug 7243
Do not take rentals as fines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
0001-bug_7243-Be-selective-when-summing-up-charges-for-bl.patch (text/plain), 9.41 KB, created by
Srdjan Jankovic
on 2012-01-13 07:13:03 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2012-01-13 07:13:03 UTC
Size:
9.41 KB
patch
obsolete
>From 78de2544f8823e6d3a24e7caf98c2ac1ce22f642 Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Fri, 13 Jan 2012 19:49:33 +1300 >Subject: [PATCH] bug_7243: Be selective when summing up charges for blocking issues > >Added RentalsInNoissueCharges and ManInvlsInNoissueCharges sys prefs > >C4::Members::GetMemberAccountRecords() changes: >* Input params: $borrowernumber, $fines_only >* If $fines_only is true, discard assount records of type: > 'Res' > 'Rent' if RentalsInNoissueCharges is Mo > authorised_values MANUAL_INV if ManInvlsInNoissueCharges is No >* Dropped input param $date, it is not used > >Set $fines_only to true when calling GetMemberAccountRecords() from >C4::Circulation::CanBookBeIssued() and C4::Members::patronflags(). That >way only fines decide whether an item can be issued, and not other >non-fine charges >--- > C4/Circulation.pm | 2 +- > C4/Members.pm | 21 ++++++++++++------- > circ/circulation.pl | 13 +++++------ > installer/data/mysql/sysprefs.sql | 2 + > installer/data/mysql/updatedatabase.pl | 8 +++++++ > .../en/modules/admin/preferences/circulation.pref | 12 +++++++++++ > opac/opac-user.pl | 1 - > 7 files changed, 42 insertions(+), 17 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 9a6f4f2..5181326 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -729,7 +729,7 @@ sub CanBookBeIssued { > > # DEBTS > my ($amount) = >- C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, '' && $duedate->output('iso') ); >+ C4::Members::GetMemberAccountRecords( $borrower->{'borrowernumber'}, 'FINES ONLY' ); > my $amountlimit = C4::Context->preference("noissuescharge"); > my $allowfineoverride = C4::Context->preference("AllowFineOverride"); > my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride"); >diff --git a/C4/Members.pm b/C4/Members.pm >index 1d7bc42..cfa393a 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -420,7 +420,7 @@ sub patronflags { > my %flags; > my ( $patroninformation) = @_; > my $dbh=C4::Context->dbh; >- my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'}); >+ my ($amount) = GetMemberAccountRecords( $patroninformation->{'borrowernumber'}, 'FINES ONLY'); > if ( $amount > 0 ) { > my %flaginfo; > my $noissuescharge = C4::Context->preference("noissuescharge") || 5; >@@ -1094,7 +1094,7 @@ sub GetAllIssues { > > =head2 GetMemberAccountRecords > >- ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber); >+ ($total, $acctlines, $count) = &GetMemberAccountRecords($borrowernumber, $fines_only); > > Looks up accounting data for the patron with the given borrowernumber. > >@@ -1104,11 +1104,13 @@ keys are the fields of the C<accountlines> table in the Koha database. > C<$count> is the number of elements in C<$acctlines>. C<$total> is the > total amount outstanding for all of the account lines. > >+If C<$fines_only> flag is set to true, only fines are taken in account >+ > =cut > > #' > sub GetMemberAccountRecords { >- my ($borrowernumber,$date) = @_; >+ my ($borrowernumber, $fines_only) = @_; > my $dbh = C4::Context->dbh; > my @acctlines; > my $numlines = 0; >@@ -1116,14 +1118,17 @@ sub GetMemberAccountRecords { > SELECT * > FROM accountlines > WHERE borrowernumber=?); >- my @bind = ($borrowernumber); >- if ($date && $date ne ''){ >- $strsth.=" AND date < ? "; >- push(@bind,$date); >+ if ($fines_only) { >+ my @not_fines = (qq{'Res'}); >+ push @not_fines, qq{'Rent'} >+ unless C4::Context->preference('RentalsInNoissueCharges'); >+ push @not_fines, qq{(SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV')} >+ unless C4::Context->preference('ManInvInNoissueCharges'); >+ $strsth .= " AND accounttype NOT IN (".join( ',', @not_fines ).")"; > } > $strsth.=" ORDER BY date desc,timestamp DESC"; > my $sth= $dbh->prepare( $strsth ); >- $sth->execute( @bind ); >+ $sth->execute( $borrowernumber ); > my $total = 0; > while ( my $data = $sth->fetchrow_hashref ) { > if ( $data->{itemnumber} ) { >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 1b6c619..866d7c3 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -188,8 +188,7 @@ if ( $print eq 'yes' && $borrowernumber ne '' ) { > my $borrowerslist; > my $message; > if ($findborrower) { >- my $borrowers = Search($findborrower, 'cardnumber'); >- my @borrowers = @$borrowers; >+ my $borrowers = Search($findborrower, 'cardnumber') || []; > if (C4::Context->preference("AddPatronLists")) { > $template->param( > "AddPatronLists_".C4::Context->preference("AddPatronLists")=> "1", >@@ -200,17 +199,17 @@ if ($findborrower) { > $template->param(categories=>$categories); > } > } >- if ( $#borrowers == -1 ) { >+ if ( @$borrowers == 0 ) { > $query->param( 'findborrower', '' ); > $message = "'$findborrower'"; > } >- elsif ( $#borrowers == 0 ) { >- $query->param( 'borrowernumber', $borrowers[0]->{'borrowernumber'} ); >+ elsif ( @$borrowers == 1 ) { >+ $borrowernumber = $borrowers->[0]->{'borrowernumber'}; >+ $query->param( 'borrowernumber', $borrowernumber ); > $query->param( 'barcode', '' ); >- $borrowernumber = $borrowers[0]->{'borrowernumber'}; > } > else { >- $borrowerslist = \@borrowers; >+ $borrowerslist = $borrowers; > } > } > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 918df5c..5257070 100755 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -330,3 +330,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CircAutoPrintQuickSlip', '1', 'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window or Clear the screen.',NULL,'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissueCharges', '1', 'Include rental charges when summing up charges for NoissueCharge.',NULL,'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissueCharges', '1', 'Include MAN_INV charges when summing up charges for NoissueCharge.',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index a4ad03f..c490b9e 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -4605,6 +4605,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion ($DBversion); > } > >+$DBversion = "3.07.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissueCharges', '1', 'Include rental charges when summing up charges for NoissueCharge.',NULL,'YesNo');"); >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissueCharges', '1', 'Include MAN_INV charges when summing up charges for NoissueCharge.',NULL,'YesNo');"); >+ print "Upgrade to $DBversion done (Add sysprefs RentalsInNoissueCharges and ManInvInNoissueCharges.)\n"; >+ SetVersion($DBversion); >+} >+ > > =head1 FUNCTIONS > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 817ce57..5778504 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -202,6 +202,18 @@ Circulation: > class: integer > - '[% local_currency %] in fines.' > - >+ - pref: RentalsInNoissueCharges >+ choices: >+ yes: Include >+ no: "Don't include" >+ - rental charges when summing up charges for NoissueCharge. >+ - >+ - pref: ManInvInNoissueCharges >+ choices: >+ yes: Include >+ no: "Don't include" >+ - MAN_INV charges when summing up charges for NoissueCharge. >+ - > - pref: ReturnBeforeExpiry > choices: > yes: Require >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index f6ed484..3717e3c 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -138,7 +138,6 @@ $template->param( BORROWER_INFO => \@bordat, > OPACMySummaryHTML => (C4::Context->preference("OPACMySummaryHTML")) ? 1 : 0, > surname => $borr->{surname}, > showname => $borr->{showname}, >- > ); > > #get issued items .... >-- >1.6.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7243
:
6335
|
6709
|
7127
|
11943
|
12452
|
12454
|
12781
|
13261
|
13664
|
13666
|
13693
|
13917
|
14741
|
14742