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 4328-4335 sub _CalculateAndUpdateFine { Link Here
4328
    # we only need to calculate and change the fines if we want to do that on return
4330
    # we only need to calculate and change the fines if we want to do that on return
4329
    # Should be on for hourly loans
4331
    # Should be on for hourly loans
4330
    my $control = C4::Context->preference('CircControl');
4332
    my $control = C4::Context->preference('CircControl');
4333
    my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
4331
    my $control_branchcode =
4334
    my $control_branchcode =
4332
        ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
4335
        ( $control eq 'ItemHomeLibrary' ) ? $item->{$branch_type}
4333
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4336
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4334
      :                                     $issue->branchcode;
4337
      :                                     $issue->branchcode;
4335
4338
(-)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