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

(-)a/C4/Circulation.pm (-15 / +15 lines)
Lines 771-800 sub CanBookBeIssued { Link Here
771
    #
771
    #
772
772
773
    # DEBTS
773
    # DEBTS
774
    my ($ballance, $non_issue_ballance, $other_charges) =
774
    my ($balance, $non_issue_charges, $other_charges) =
775
      C4::Members::GetMemberAccountBallance( $borrower->{'borrowernumber'} );
775
      C4::Members::GetMemberAccountBalance( $borrower->{'borrowernumber'} );
776
    my $amountlimit = C4::Context->preference("noissuescharge");
776
    my $amountlimit = C4::Context->preference("noissuescharge");
777
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
777
    my $allowfineoverride = C4::Context->preference("AllowFineOverride");
778
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
778
    my $allfinesneedoverride = C4::Context->preference("AllFinesNeedOverride");
779
    if ( C4::Context->preference("IssuingInProcess") ) {
779
    if ( C4::Context->preference("IssuingInProcess") ) {
780
        if ( $non_issue_ballance > $amountlimit && !$inprocess && !$allowfineoverride) {
780
        if ( $non_issue_charges > $amountlimit && !$inprocess && !$allowfineoverride) {
781
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_ballance );
781
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
782
        } elsif ( $non_issue_ballance > $amountlimit && !$inprocess && $allowfineoverride) {
782
        } elsif ( $non_issue_charges > $amountlimit && !$inprocess && $allowfineoverride) {
783
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
783
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
784
        } elsif ( $allfinesneedoverride && $non_issue_ballance > 0 && $non_issue_ballance <= $amountlimit && !$inprocess ) {
784
        } elsif ( $allfinesneedoverride && $non_issue_charges > 0 && $non_issue_charges <= $amountlimit && !$inprocess ) {
785
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
785
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
786
        }
786
        }
787
    }
787
    }
788
    else {
788
    else {
789
        if ( $non_issue_ballance > $amountlimit && $allowfineoverride ) {
789
        if ( $non_issue_charges > $amountlimit && $allowfineoverride ) {
790
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
790
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
791
        } elsif ( $non_issue_ballance > $amountlimit && !$allowfineoverride) {
791
        } elsif ( $non_issue_charges > $amountlimit && !$allowfineoverride) {
792
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_ballance );
792
            $issuingimpossible{DEBT} = sprintf( "%.2f", $non_issue_charges );
793
        } elsif ( $non_issue_ballance > 0 && $allfinesneedoverride ) {
793
        } elsif ( $non_issue_charges > 0 && $allfinesneedoverride ) {
794
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_ballance );
794
            $needsconfirmation{DEBT} = sprintf( "%.2f", $non_issue_charges );
795
        }
795
        }
796
    }
796
    }
797
    if ($ballance > 0 && $other_charges > 0) {
797
    if ($balance > 0 && $other_charges > 0) {
798
        $alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges );
798
        $alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges );
799
    }
799
    }
800
800
(-)a/C4/Members.pm (-11 / +11 lines)
Lines 430-436 sub patronflags { Link Here
430
    my %flags;
430
    my %flags;
431
    my ( $patroninformation) = @_;
431
    my ( $patroninformation) = @_;
432
    my $dbh=C4::Context->dbh;
432
    my $dbh=C4::Context->dbh;
433
    my ($ballance, $owing) = GetMemberAccountBallance( $patroninformation->{'borrowernumber'});
433
    my ($balance, $owing) = GetMemberAccountBalance( $patroninformation->{'borrowernumber'});
434
    if ( $owing > 0 ) {
434
    if ( $owing > 0 ) {
435
        my %flaginfo;
435
        my %flaginfo;
436
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
436
        my $noissuescharge = C4::Context->preference("noissuescharge") || 5;
Lines 441-450 sub patronflags { Link Here
441
        }
441
        }
442
        $flags{'CHARGES'} = \%flaginfo;
442
        $flags{'CHARGES'} = \%flaginfo;
443
    }
443
    }
444
    elsif ( $ballance < 0 ) {
444
    elsif ( $balance < 0 ) {
445
        my %flaginfo;
445
        my %flaginfo;
446
        $flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$ballance;
446
        $flaginfo{'message'} = sprintf "Patron has credit of \$%.02f", -$balance;
447
        $flaginfo{'amount'}  = sprintf "%.02f", $ballance;
447
        $flaginfo{'amount'}  = sprintf "%.02f", $balance;
448
        $flags{'CREDITS'} = \%flaginfo;
448
        $flags{'CREDITS'} = \%flaginfo;
449
    }
449
    }
450
    if (   $patroninformation->{'gonenoaddress'}
450
    if (   $patroninformation->{'gonenoaddress'}
Lines 1140-1170 sub GetMemberAccountRecords { Link Here
1140
    return ( $total, \@acctlines,$numlines);
1140
    return ( $total, \@acctlines,$numlines);
1141
}
1141
}
1142
1142
1143
=head2 GetMemberAccountBallance
1143
=head2 GetMemberAccountBalance
1144
1144
1145
  ($total_ballance, $non_issue_ballance, $other_charges) = &GetMemberAccountBallance($borrowernumber);
1145
  ($total_balance, $non_issue_balance, $other_charges) = &GetMemberAccountBalance($borrowernumber);
1146
1146
1147
Calculates amount immediately owing by the patron - non-issue charges.
1147
Calculates amount immediately owing by the patron - non-issue charges.
1148
Based on GetMemberAccountRecords.
1148
Based on GetMemberAccountRecords.
1149
Charges exempt from non-issue are:
1149
Charges exempt from non-issue are:
1150
* Res (reserves)
1150
* Res (reserves)
1151
* Rent (rental) if RentalsInNoissueCharges syspref is set to false
1151
* Rent (rental) if RentalsInNoissuesCharge syspref is set to false
1152
* Manual invoices if ManInvInNoissueCharges syspref is set to false
1152
* Manual invoices if ManInvInNoissuesCharge syspref is set to false
1153
1153
1154
=cut
1154
=cut
1155
1155
1156
my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
1156
my $ACCOUNT_TYPE_LENGTH = 5; # this is plain ridiculous...
1157
1157
1158
my @not_fines = ('Res');
1158
my @not_fines = ('Res');
1159
push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissueCharges');
1159
push @not_fines, 'Rent' unless C4::Context->preference('RentalsInNoissuesCharge');
1160
unless ( C4::Context->preference('ManInvInNoissueCharges') ) {
1160
unless ( C4::Context->preference('ManInvInNoissuesCharge') ) {
1161
    my $dbh = C4::Context->dbh;
1161
    my $dbh = C4::Context->dbh;
1162
    my $man_inv_types = $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'});
1162
    my $man_inv_types = $dbh->selectcol_arrayref(qq{SELECT authorised_value FROM authorised_values WHERE category = 'MANUAL_INV'});
1163
    push @not_fines, map substr($_, 0, $ACCOUNT_TYPE_LENGTH), @$man_inv_types;
1163
    push @not_fines, map substr($_, 0, $ACCOUNT_TYPE_LENGTH), @$man_inv_types;
1164
}
1164
}
1165
my %not_fine = map {$_ => 1} @not_fines;
1165
my %not_fine = map {$_ => 1} @not_fines;
1166
1166
1167
sub GetMemberAccountBallance {
1167
sub GetMemberAccountBalance {
1168
    my ($borrowernumber) = @_;
1168
    my ($borrowernumber) = @_;
1169
1169
1170
    my ($total, $acctlines) = GetMemberAccountRecords($borrowernumber);
1170
    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 6024-6032 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6024
6024
6025
$DBversion = "3.09.00.XXX";
6025
$DBversion = "3.09.00.XXX";
6026
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6026
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
6027
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissueCharges', '1', 'Include rental charges when summing up charges for NoissueCharge.',NULL,'YesNo');");
6027
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('RentalsInNoissuesCharge', '1', 'Rental charges block checkouts (added to noissuescharge).',NULL,'YesNo');");
6028
    $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');");
6028
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ManInvInNoissuesCharge', '1', 'MAN_INV charges block checkouts (added to noissuescharge).',NULL,'YesNo');");
6029
    print "Upgrade to $DBversion done (Add sysprefs RentalsInNoissueCharges and ManInvInNoissueCharges.)\n";
6029
    print "Upgrade to $DBversion done (Add sysprefs RentalsInNoissuesCharge and ManInvInNoissuesCharge.)\n";
6030
    SetVersion($DBversion);
6030
    SetVersion($DBversion);
6031
}
6031
}
6032
6032
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-4 / +4 lines)
Lines 259-275 Circulation: Link Here
259
              class: integer
259
              class: integer
260
            - '[% local_currency %] in fines.'
260
            - '[% local_currency %] in fines.'
261
        -
261
        -
262
            - pref: RentalsInNoissueCharges
262
            - pref: RentalsInNoissuesCharge
263
              choices:
263
              choices:
264
                  yes: Include
264
                  yes: Include
265
                  no: "Don't include"
265
                  no: "Don't include"
266
            - rental charges when summing up charges for NoissueCharge.
266
            - rental charges when summing up charges for noissuescharge.
267
        -
267
        -
268
            - pref: ManInvInNoissueCharges
268
            - pref: ManInvInNoissuesCharge
269
              choices:
269
              choices:
270
                  yes: Include
270
                  yes: Include
271
                  no: "Don't include"
271
                  no: "Don't include"
272
            - MAN_INV charges when summing up charges for NoissueCharge.
272
            - MAN_INV charges when summing up charges for noissuescharge.
273
        -
273
        -
274
            - pref: ReturnBeforeExpiry
274
            - pref: ReturnBeforeExpiry
275
              choices:
275
              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