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

(-)a/C4/Circulation.pm (-4 / +7 lines)
Lines 474-481 sub TooMany { Link Here
474
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
474
            } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
475
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
475
                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
476
            } else {
476
            } else {
477
                my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
477
                $checkouts = $patron->checkouts->search(
478
                $checkouts = $patron->checkouts->search(
478
                    { 'item.homebranch' => $maxissueqty_rule->branchcode } );
479
                    { "item.$branch_type" => $maxissueqty_rule->branchcode } );
479
            }
480
            }
480
        } else {
481
        } else {
481
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
482
            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
Lines 570-578 sub TooMany { Link Here
570
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
571
        } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') {
571
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
572
            $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
572
        } else {
573
        } else {
574
            my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
573
            $checkouts = $patron->checkouts->search(
575
            $checkouts = $patron->checkouts->search(
574
                { 'item.homebranch' => $branch},
576
                { "item.$branch_type" => $branch},
575
                { prefetch          => 'item' } );
577
                { prefetch            => 'item' } );
576
        }
578
        }
577
579
578
        my $checkout_count = $checkouts->count;
580
        my $checkout_count = $checkouts->count;
Lines 4362-4369 sub _CalculateAndUpdateFine { Link Here
4362
    # we only need to calculate and change the fines if we want to do that on return
4364
    # we only need to calculate and change the fines if we want to do that on return
4363
    # Should be on for hourly loans
4365
    # Should be on for hourly loans
4364
    my $control = C4::Context->preference('CircControl');
4366
    my $control = C4::Context->preference('CircControl');
4367
    my $branch_type = C4::Context->preference('HomeOrHoldingBranch') || 'homebranch';
4365
    my $control_branchcode =
4368
    my $control_branchcode =
4366
        ( $control eq 'ItemHomeLibrary' ) ? $item->{homebranch}
4369
        ( $control eq 'ItemHomeLibrary' ) ? $item->{$branch_type}
4367
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4370
      : ( $control eq 'PatronLibrary' )   ? $borrower->{branchcode}
4368
      :                                     $issue->branchcode;
4371
      :                                     $issue->branchcode;
4369
4372
(-)a/C4/Overdues.pm (-2 / +2 lines)
Lines 90-103 sub Getoverdues { Link Here
90
    my $statement;
90
    my $statement;
91
    if ( C4::Context->preference('item-level_itypes') ) {
91
    if ( C4::Context->preference('item-level_itypes') ) {
92
        $statement = "
92
        $statement = "
93
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice, items.biblionumber
93
   SELECT issues.*, items.itype as itemtype, items.homebranch, items.barcode, items.itemlost, items.replacementprice, items.biblionumber, items.holdingbranch
94
     FROM issues 
94
     FROM issues 
95
LEFT JOIN items       USING (itemnumber)
95
LEFT JOIN items       USING (itemnumber)
96
    WHERE date_due < NOW()
96
    WHERE date_due < NOW()
97
";
97
";
98
    } else {
98
    } else {
99
        $statement = "
99
        $statement = "
100
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice, items.biblionumber
100
   SELECT issues.*, biblioitems.itemtype, items.itype, items.homebranch, items.barcode, items.itemlost, replacementprice, items.biblionumber, items.holdingbranch
101
     FROM issues 
101
     FROM issues 
102
LEFT JOIN items       USING (itemnumber)
102
LEFT JOIN items       USING (itemnumber)
103
LEFT JOIN biblioitems USING (biblioitemnumber)
103
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