View | Details | Raw Unified | Return to bug 7243
Collapse All | Expand All

(-)a/C4/Circulation.pm (-15 / +15 lines)
Lines 772-801 sub CanBookBeIssued { Link Here
772
    #
772
    #
773
773
774
    # DEBTS
774
    # DEBTS
775
    my ($ballance, $non_issue_ballance, $other_charges) =
775
    my ($balance, $non_issue_charges, $other_charges) =
776
      C4::Members::GetMemberAccountBallance( $borrower->{'borrowernumber'} );
776
      C4::Members::GetMemberAccountBalance( $borrower->{'borrowernumber'} );
777
    my $amountlimit = C4::Context->preference("noissuescharge");
777
    my $amountlimit = C4::Context->preference("noissuescharge");
778
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
778
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
779
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
779
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
780
    if ( C4::Context->preference("IssuingInProcess") ) {
780
    if ( C4::Context->preference("IssuingInProcess") ) {
781
        if ( $non_issue_ballance > $amountlimit && !$inprocess && !$allowfineoverride) {
781
        if ( $non_issue_charges > $amountlimit && !$inprocess && !$allowfineoverride) {
782
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_ballance );
782
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
783
        } elsif ( $non_issue_ballance > $amountlimit && !$inprocess && $allowfineoverride) {
783
        } elsif ( $non_issue_charges > $amountlimit && !$inprocess && $allowfineoverride) {
784
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
784
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
785
        } elsif ( $allfinesneedoverride && $non_issue_ballance > 0 && $non_issue_ballance <= $amountlimit && !$inprocess ) {
785
        } elsif ( $allfinesneedoverride && $non_issue_charges > 0 && $non_issue_charges <= $amountlimit && !$inprocess ) {
786
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
786
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
787
        }
787
        }
788
    }
788
    }
789
    else {
789
    else {
790
        if ( $non_issue_ballance > $amountlimit && $allowfineoverride ) {
790
        if ( $non_issue_charges > $amountlimit && $allowfineoverride ) {
791
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
791
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
792
        } elsif ( $non_issue_ballance > $amountlimit && !$allowfineoverride) {
792
        } elsif ( $non_issue_charges > $amountlimit && !$allowfineoverride) {
793
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_ballance );
793
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
794
        } elsif ( $non_issue_ballance > 0 && $allfinesneedoverride ) {
794
        } elsif ( $non_issue_charges > 0 && $allfinesneedoverride ) {
795
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
795
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
796
        }
796
        }
797
    }
797
    }
798
    if ($ballance > 0 && $other_charges > 0) {
798
    if ($balance > 0 && $other_charges > 0) {
799
        $alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges );
799
        $alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges );
800
    }
800
    }
801
801
(-)a/C4/Members.pm (-11 / +11 lines)
Lines 432-438 sub patronflags { Link Here
432
    my %flags;
432
    my %flags;
433
    my ( $patroninformation) = @_;
433
    my ( $patroninformation) = @_;
434
    my $dbh=C4::Context->dbh;
434
    my $dbh=C4::Context->dbh;
435
    my ($ballance, $owing) = GetMemberAccountBallance( $patroninformation->{'borrowernumber'});
435
    my ($balance, $owing) = GetMemberAccountBalance( $patroninformation->{'borrowernumber'});
436
    if ( $owing > 0 ) {
436
    if ( $owing > 0 ) {
437
        my %flaginfo;
437
        my %flaginfo;
438
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
438
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
Lines 443-452 sub patronflags { Link Here
443
        }
443
        }
444
        $flags{'CHARGES'} = \%flaginfo;
444
        $flags{'CHARGES'} = \%flaginfo;
445
    }
445
    }
446
    elsif ( $ballance < 0 ) {
446
    elsif ( $balance < 0 ) {
447
        my %flaginfo;
447
        my %flaginfo;
448
        $flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$ballance;
448
        $flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$balance;
449
        $flaginfo{'amount'}  = sprintf "%.02f", $ballance;
449
        $flaginfo{'amount'}  = sprintf "%.02f", $balance;
450
        $flags{'CREDITS'} = \%flaginfo;
450
        $flags{'CREDITS'} = \%flaginfo;
451
    }
451
    }
452
    if (   $patroninformation->{'gonenoaddress'}
452
    if (   $patroninformation->{'gonenoaddress'}
Lines 1156-1186 sub GetMemberAccountRecords { Link Here
1156
    return ( $total, \@acctlines,$numlines);
1156
    return ( $total, \@acctlines,$numlines);
1157
}
1157
}
1158
1158
1159
=head2 GetMemberAccountBallance
1159
=head2 GetMemberAccountBalance
1160
1160
1161
  ($total_ballance, $non_issue_ballance, $other_charges) = &GetMemberAccountBallance($borrowernumber);
1161
  ($total_balance, $non_issue_balance, $other_charges) = &GetMemberAccountBalance($borrowernumber);
1162
1162
1163
Calculates amount immediately owing by the patron - non-issue charges.
1163
Calculates amount immediately owing by the patron - non-issue charges.
1164
Based on GetMemberAccountRecords.
1164
Based on GetMemberAccountRecords.
1165
Charges exempt from non-issue are:
1165
Charges exempt from non-issue are:
1166
* Res (reserves)
1166
* Res (reserves)
1167
* Rent (rental) if RentalsInNoissueCharges syspref is set to false
1167
* Rent (rental) if RentalsInNoissuesCharge syspref is set to false
1168
* Manual invoices if ManInvInNoissueCharges syspref is set to false
1168
* Manual invoices if ManInvInNoissuesCharge syspref is set to false
1169
1169
1170
=cut
1170
=cut
1171
1171
1172
my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
1172
my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
1173
1173
1174
my @not_fines = ('Res');
1174
my @not_fines = ('Res');
1175
push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissueCharges');
1175
push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissuesCharge');
1176
unless ( C4::Context->preference('ManInvInNoissueCharges') ) {
1176
unless ( C4::Context->preference('ManInvInNoissuesCharge') ) {
1177
    my $dbh = C4::Context->dbh;
1177
    my $dbh = C4::Context->dbh;
1178
    my $man_inv_types = $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'});
1178
    my $man_inv_types = $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'});
1179
    push @not_fines, map substr($_, 0, $ACCOUNT_TYPE_LENGTH), @$man_inv_types;
1179
    push @not_fines, map substr($_, 0, $ACCOUNT_TYPE_LENGTH), @$man_inv_types;
1180
}
1180
}
1181
my %not_fine = map {$_ => 1} @not_fines;
1181
my %not_fine = map {$_ => 1} @not_fines;
1182
1182
1183
sub GetMemberAccountBallance {
1183
sub GetMemberAccountBalance {
1184
    my ($borrowernumber) = @_;
1184
    my ($borrowernumber) = @_;
1185
1185
1186
    my ($total, $acctlines) = GetMemberAccountRecords($borrowernumber);
1186
    my ($total, $acctlines) = GetMemberAccountRecords($borrowernumber);
(-)a/installer/data/mysql/sysprefs.sql (-2 / +2 lines)
Lines 327-334 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
327
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');
327
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');
328
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');
328
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');
329
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');
329
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');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissueCharges', '1', 'Include rental charges when summing up charges for NoissueCharge.',NULL,'YesNo');
330
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissuesCharge', '1', 'Rental charges block checkouts (added to noissuescharge).',NULL,'YesNo');
331
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissueCharges', '1', 'Include MAN_INV charges when summing up charges for NoissueCharge.',NULL,'YesNo');
331
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissuesCharge', '1', 'MAN_INV charges block checkouts (added to noissuescharge).',NULL,'YesNo');
332
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free');
332
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NoticeCSS','','Notices CSS url.',NULL,'free');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free');
333
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('SlipCSS','','Slips CSS url.',NULL,'free');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo');
334
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('TransferWhenCancelAllWaitingHolds','0','Transfer items when cancelling all waiting holds',NULL,'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (-3 / +3 lines)
Lines 6341-6349 if ( CheckVersion($DBversion) ) { Link Here
6341
6341
6342
$DBversion = "3.11.00.XXX";
6342
$DBversion = "3.11.00.XXX";
6343
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6343
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6344
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissueCharges', '1', 'Include rental charges when summing up charges for NoissueCharge.',NULL,'YesNo');");
6344
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissuesCharge', '1', 'Rental charges block checkouts (added to noissuescharge).',NULL,'YesNo');");
6345
    $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');");
6345
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissuesCharge', '1', 'MAN_INV charges block checkouts (added to noissuescharge).',NULL,'YesNo');");
6346
    print "Upgrade to $DBversion done (Add sysprefs RentalsInNoissueCharges and ManInvInNoissueCharges.)\n";
6346
    print "Upgrade to $DBversion done (Add sysprefs RentalsInNoissuesCharge and ManInvInNoissuesCharge.)\n";
6347
    SetVersion($DBversion);
6347
    SetVersion($DBversion);
6348
}
6348
}
6349
6349
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-4 / +4 lines)
Lines 265-281 Circulation: Link Here
265
              class: integer
265
              class: integer
266
            - '[% local_currency %] in fines.'
266
            - '[% local_currency %] in fines.'
267
        -
267
        -
268
            - pref: RentalsInNoissueCharges
268
            - pref: RentalsInNoissuesCharge
269
              choices:
269
              choices:
270
                  yes: Include
270
                  yes: Include
271
                  no: "Don't include"
271
                  no: "Don't include"
272
            - rental charges when summing up charges for NoissueCharge.
272
            - rental charges when summing up charges for noissuescharge.
273
        -
273
        -
274
            - pref: ManInvInNoissueCharges
274
            - pref: ManInvInNoissuesCharge
275
              choices:
275
              choices:
276
                  yes: Include
276
                  yes: Include
277
                  no: "Don't include"
277
                  no: "Don't include"
278
            - MAN_INV charges when summing up charges for NoissueCharge.
278
            - MAN_INV charges when summing up charges for noissuescharge.
279
        -
279
        -
280
            - pref: ReturnBeforeExpiry
280
            - pref: ReturnBeforeExpiry
281
              choices:
281
              choices:
(-)a/t/db_dependent/lib/KohaTest/Members.pm (-2 / +1 lines)
Lines 27-33 sub methods : Test( 1 ) { Link Here
27
                      GetPendingIssues 
27
                      GetPendingIssues 
28
                      GetAllIssues 
28
                      GetAllIssues 
29
                      GetMemberAccountRecords 
29
                      GetMemberAccountRecords 
30
                      GetMemberAccountBallance
30
                      GetMemberAccountBalance
31
                      GetBorNotifyAcctRecord 
31
                      GetBorNotifyAcctRecord 
32
                      checkuniquemember 
32
                      checkuniquemember 
33
                      checkcardnumber 
33
                      checkcardnumber 
34
- 

Return to bug 7243