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

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 479-486 sub TooMany { Link Here
479
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
479
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
480
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
480
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
481
            } else {
481
            } else {
482
                my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
482
                $checkouts = $patron->checkouts->search(
483
                $checkouts = $patron->checkouts->search(
483
                    { 'item.homebranch' => $maxissueqty_rule->branchcode } );
484
                    { "item.$branch_type" => $maxissueqty_rule->branchcode } );
484
            }
485
            }
485
        } else {
486
        } else {
486
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
487
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
Lines 575-583 sub TooMany { Link Here
575
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
576
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
576
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
577
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
577
        } else {
578
        } else {
579
            my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
578
            $checkouts = $patron->checkouts->search(
580
            $checkouts = $patron->checkouts->search(
579
                { 'item.homebranch' => $branch},
581
                { "item.$branch_type" => $branch},
580
                { prefetch          => 'item' } );
582
                { prefetch            => 'item' } );
581
        }
583
        }
582
584
583
        my $checkout_count = $checkouts->count;
585
        my $checkout_count = $checkouts->count;
Lines 4344-4351 sub _CalculateAndUpdateFine { Link Here
4344
    # we only need to calculate and change the fines if we want to do that on return
4346
    # we only need to calculate and change the fines if we want to do that on return
4345
    # Should be on for hourly loans
4347
    # Should be on for hourly loans
4346
    my $control = C4::Context->preference('CircControl');
4348
    my $control = C4::Context->preference('CircControl');
4349
    my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
4347
    my $control_branchcode =
4350
    my $control_branchcode =
4348
        ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
4351
        ( $control eq 'ItemHomeLibrary' ) ? $item->{$branch_type}
4349
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4352
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4350
      :                                     $issue->branchcode;
4353
      :                                     $issue->branchcode;
4351
4354
(-)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 98-103 my @item_fields = qw(itemnumber barcode date_due); Link Here
98
my @other_fields = qw(days_overdue fine);
98
my @other_fields = qw(days_overdue fine);
99
my $libname      = C4::Context->preference('LibraryName');
99
my $libname      = C4::Context->preference('LibraryName');
100
my $control      = C4::Context->preference('CircControl');
100
my $control      = C4::Context->preference('CircControl');
101
my $branch_type  = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
101
my $mode         = C4::Context->preference('finesMode');
102
my $mode         = C4::Context->preference('finesMode');
102
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
103
my $delim = "\t";    # ?  C4::Context->preference('CSVDelimiter') || "\t";
103
104
Lines 129-135 for my $overdue ( @{$overdues} ) { Link Here
129
    }
130
    }
130
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
131
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
131
    my $branchcode =
132
    my $branchcode =
132
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
133
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{$branch_type}
133
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
134
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
134
      :                                     $overdue->{branchcode};
135
      :                                     $overdue->{branchcode};
135
136
(-)a/misc/cronjobs/staticfines.pl (-3 / +3 lines)
Lines 93-99 foreach (@pcategories) { Link Here
93
}
93
}
94
94
95
use vars qw(@borrower_fields @item_fields @other_fields);
95
use vars qw(@borrower_fields @item_fields @other_fields);
96
use vars qw($fldir $libname $control $mode $delim $dbname $today $today_iso $today_days);
96
use vars qw($fldir $libname $control $branch_type $mode $delim $dbname $today $today_iso $today_days);
97
use vars qw($filename);
97
use vars qw($filename);
98
98
99
CHECK {
99
CHECK {
Lines 102-107 CHECK { Link Here
102
    @other_fields    = qw(type days_overdue fine);
102
    @other_fields    = qw(type days_overdue fine);
103
    $libname         = C4::Context->preference('LibraryName');
103
    $libname         = C4::Context->preference('LibraryName');
104
    $control         = C4::Context->preference('CircControl');
104
    $control         = C4::Context->preference('CircControl');
105
    $branch_type     = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
105
    $mode            = C4::Context->preference('finesMode');
106
    $mode            = C4::Context->preference('finesMode');
106
    $dbname          = C4::Context->config('database');
107
    $dbname          = C4::Context->config('database');
107
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
108
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
Lines 155-161 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
155
156
156
    my $branchcode =
157
    my $branchcode =
157
        ( $useborrowerlibrary )           ? $patron->branchcode
158
        ( $useborrowerlibrary )           ? $patron->branchcode
158
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{homebranch}
159
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{$branch_type}
159
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
160
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
160
      :                                     $data->[$i]->{branchcode};
161
      :                                     $data->[$i]->{branchcode};
161
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
162
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
162
- 

Return to bug 27259