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

(-)a/C4/Circulation.pm (-5 / +8 lines)
Lines 457-465 sub TooMany { Link Here
457
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
457
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
458
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
458
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
459
            } else {
459
            } else {
460
                my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
460
                $checkouts = $patron->checkouts->search(
461
                $checkouts = $patron->checkouts->search(
461
                    { 'item.homebranch' => $maxissueqty_rule->branchcode },
462
                    { "item.$branch_type"   => $maxissueqty_rule->branchcode },
462
                    { prefetch          => 'item' } );
463
                    { prefetch              => 'item' } );
463
            }
464
            }
464
        } else {
465
        } else {
465
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
466
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
Lines 545-553 sub TooMany { Link Here
545
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
546
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
546
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
547
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
547
        } else {
548
        } else {
549
            my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
548
            $checkouts = $patron->checkouts->search(
550
            $checkouts = $patron->checkouts->search(
549
                { 'item.homebranch' => $branch},
551
                { "item.$branch_type" => $branch},
550
                { prefetch          => 'item' } );
552
                { prefetch            => 'item' } );
551
        }
553
        }
552
554
553
        my $checkout_count = $checkouts->count;
555
        my $checkout_count = $checkouts->count;
Lines 4341-4348 sub _CalculateAndUpdateFine { Link Here
4341
    # we only need to calculate and change the fines if we want to do that on return
4343
    # we only need to calculate and change the fines if we want to do that on return
4342
    # Should be on for hourly loans
4344
    # Should be on for hourly loans
4343
    my $control = C4::Context->preference('CircControl');
4345
    my $control = C4::Context->preference('CircControl');
4346
    my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
4344
    my $control_branchcode =
4347
    my $control_branchcode =
4345
        ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
4348
        ( $control eq 'ItemHomeLibrary' ) ? $item->{$branch_type}
4346
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4349
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4347
      :                                     $issue->branchcode;
4350
      :                                     $issue->branchcode;
4348
4351
(-)a/C4/Overdues.pm (-2 / +2 lines)
Lines 96-109 sub Getoverdues { Link Here
96
    my $statement;
96
    my $statement;
97
    if ( C4::Context->preference('item-level_itypes') ) {
97
    if ( C4::Context->preference('item-level_itypes') ) {
98
        $statement = "
98
        $statement = "
99
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice
99
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice, items.holdingbranch
100
     FROM issues 
100
     FROM issues 
101
LEFT JOIN items       USING (itemnumber)
101
LEFT JOIN items       USING (itemnumber)
102
    WHERE date_due < NOW()
102
    WHERE date_due < NOW()
103
";
103
";
104
    } else {
104
    } else {
105
        $statement = "
105
        $statement = "
106
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice
106
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice, items.holdingbranch
107
     FROM issues 
107
     FROM issues 
108
LEFT JOIN items       USING (itemnumber)
108
LEFT JOIN items       USING (itemnumber)
109
LEFT JOIN biblioitems USING (biblioitemnumber)
109
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('delimiter') || "\t";
103
my $delim = "\t";    # ?  C4::Context->preference('delimiter') || "\t";
103
104
Lines 128-134 for my $overdue ( @{$overdues} ) { Link Here
128
    }
129
    }
129
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
130
    my $patron = Koha::Patrons->find( $overdue->{borrowernumber} );
130
    my $branchcode =
131
    my $branchcode =
131
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{homebranch}
132
        ( $control eq 'ItemHomeLibrary' ) ? $overdue->{$branch_type}
132
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
133
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
133
      :                                     $overdue->{branchcode};
134
      :                                     $overdue->{branchcode};
134
135
(-)a/misc/cronjobs/staticfines.pl (-3 / +3 lines)
Lines 104-110 foreach (@pcategories) { Link Here
104
}
104
}
105
105
106
use vars qw(@borrower_fields @item_fields @other_fields);
106
use vars qw(@borrower_fields @item_fields @other_fields);
107
use vars qw($fldir $libname $control $mode $delim $dbname $today $today_iso $today_days);
107
use vars qw($fldir $libname $control $branch_type $mode $delim $dbname $today $today_iso $today_days);
108
use vars qw($filename);
108
use vars qw($filename);
109
109
110
CHECK {
110
CHECK {
Lines 113-118 CHECK { Link Here
113
    @other_fields    = qw(type days_overdue fine);
113
    @other_fields    = qw(type days_overdue fine);
114
    $libname         = C4::Context->preference('LibraryName');
114
    $libname         = C4::Context->preference('LibraryName');
115
    $control         = C4::Context->preference('CircControl');
115
    $control         = C4::Context->preference('CircControl');
116
    $branch_type     = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
116
    $mode            = C4::Context->preference('finesMode');
117
    $mode            = C4::Context->preference('finesMode');
117
    $dbname          = C4::Context->config('database');
118
    $dbname          = C4::Context->config('database');
118
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
119
    $delim           = "\t";                                                                          # ?  C4::Context->preference('delimiter') || "\t";
Lines 166-172 for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { Link Here
166
167
167
    my $branchcode =
168
    my $branchcode =
168
        ( $useborrowerlibrary )           ? $patron->branchcode
169
        ( $useborrowerlibrary )           ? $patron->branchcode
169
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{homebranch}
170
      : ( $control eq 'ItemHomeLibrary' ) ? $data->[$i]->{$branch_type}
170
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
171
      : ( $control eq 'PatronLibrary' )   ? $patron->branchcode
171
      :                                     $data->[$i]->{branchcode};
172
      :                                     $data->[$i]->{branchcode};
172
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
173
    # In final case, CircControl must be PickupLibrary. (branchcode comes from issues table here).
173
- 

Return to bug 27259