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

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 478-485 sub TooMany { Link Here
478
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
478
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
479
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
479
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
480
            } else {
480
            } else {
481
                my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
481
                $checkouts = $patron->checkouts->search(
482
                $checkouts = $patron->checkouts->search(
482
                    { 'item.homebranch' => $maxissueqty_rule->branchcode } );
483
                    { "item.$branch_type" => $maxissueqty_rule->branchcode } );
483
            }
484
            }
484
        } else {
485
        } else {
485
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
486
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
Lines 574-582 sub TooMany { Link Here
574
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
575
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
575
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
576
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
576
        } else {
577
        } else {
578
            my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
577
            $checkouts = $patron->checkouts->search(
579
            $checkouts = $patron->checkouts->search(
578
                { 'item.homebranch' => $branch},
580
                { "item.$branch_type" => $branch},
579
                { prefetch          => 'item' } );
581
                { prefetch            => 'item' } );
580
        }
582
        }
581
583
582
        my $checkout_count = $checkouts->count;
584
        my $checkout_count = $checkouts->count;
Lines 4315-4322 sub _CalculateAndUpdateFine { Link Here
4315
    # we only need to calculate and change the fines if we want to do that on return
4317
    # we only need to calculate and change the fines if we want to do that on return
4316
    # Should be on for hourly loans
4318
    # Should be on for hourly loans
4317
    my $control = C4::Context->preference('CircControl');
4319
    my $control = C4::Context->preference('CircControl');
4320
    my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
4318
    my $control_branchcode =
4321
    my $control_branchcode =
4319
        ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
4322
        ( $control eq 'ItemHomeLibrary' ) ? $item->{$branch_type}
4320
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4323
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4321
      :                                     $issue->branchcode;
4324
      :                                     $issue->branchcode;
4322
4325
(-)a/C4/Overdues.pm (-2 / +2 lines)
Lines 92-105 sub Getoverdues { Link Here
92
    my $statement;
92
    my $statement;
93
    if ( C4::Context->preference('item-level_itypes') ) {
93
    if ( C4::Context->preference('item-level_itypes') ) {
94
        $statement = "
94
        $statement = "
95
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice, items.biblionumber
95
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice, items.biblionumber, items.holdingbranch
96
     FROM issues 
96
     FROM issues 
97
LEFT JOIN items       USING (itemnumber)
97
LEFT JOIN items       USING (itemnumber)
98
    WHERE date_due < NOW()
98
    WHERE date_due < NOW()
99
";
99
";
100
    } else {
100
    } else {
101
        $statement = "
101
        $statement = "
102
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice, items.biblionumber
102
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice, items.biblionumber, items.holdingbranch
103
     FROM issues 
103
     FROM issues 
104
LEFT JOIN items       USING (itemnumber)
104
LEFT JOIN items       USING (itemnumber)
105
LEFT JOIN biblioitems USING (biblioitemnumber)
105
LEFT JOIN biblioitems USING (biblioitemnumber)
(-)a/misc/cronjobs/fines.pl (-1 / +2 lines)
Lines 100-105 my @item_fields = qw(itemnumber barcode date_due); Link Here
100
my @other_fields = qw(days_overdue fine);
100
my @other_fields = qw(days_overdue fine);
101
my $libname      = C4::Context->preference('LibraryName');
101
my $libname      = C4::Context->preference('LibraryName');
102
my $control      = C4::Context->preference('CircControl');
102
my $control      = C4::Context->preference('CircControl');
103
my $branch_type  = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
103
my $mode         = C4::Context->preference('finesMode');
104
my $mode         = C4::Context->preference('finesMode');
104
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
105
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
105
106
Lines 131-137 for my $overdue ( @{$overdues} ) { Link Here
131
    }
132
    }
132
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
133
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
133
    my $branchcode =
134
    my $branchcode =
134
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
135
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{$branch_type}
135
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
136
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
136
      :                                     $overdue->{branchcode};
137
      :                                     $overdue->{branchcode};
137
138
(-)a/misc/cronjobs/staticfines.pl (-3 / +3 lines)
Lines 95-101 foreach (@pcategories) { Link Here
95
}
95
}
96
96
97
use vars qw(@borrower_fields @item_fields @other_fields);
97
use vars qw(@borrower_fields @item_fields @other_fields);
98
use vars qw($fldir $libname $control $mode $delim $dbname $today $today_iso $today_days);
98
use vars qw($fldir $libname $control $branch_type $mode $delim $dbname $today $today_iso $today_days);
99
use vars qw($filename);
99
use vars qw($filename);
100
100
101
CHECK {
101
CHECK {
Lines 104-109 CHECK { Link Here
104
    @other_fields    = qw(type days_overdue fine);
104
    @other_fields    = qw(type days_overdue fine);
105
    $libname         = C4::Context->preference('LibraryName');
105
    $libname         = C4::Context->preference('LibraryName');
106
    $control         = C4::Context->preference('CircControl');
106
    $control         = C4::Context->preference('CircControl');
107
    $branch_type     = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
107
    $mode            = C4::Context->preference('finesMode');
108
    $mode            = C4::Context->preference('finesMode');
108
    $dbname          = C4::Context->config('database');
109
    $dbname          = C4::Context->config('database');
109
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
110
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
Lines 157-163 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
157
158
158
    my $branchcode =
159
    my $branchcode =
159
        ( $useborrowerlibrary )           ? $patron->branchcode
160
        ( $useborrowerlibrary )           ? $patron->branchcode
160
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{homebranch}
161
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{$branch_type}
161
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
162
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
162
      :                                     $data->[$i]->{branchcode};
163
      :                                     $data->[$i]->{branchcode};
163
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
164
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
164
- 

Return to bug 27259