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

(-)a/C4/Circulation.pm (-25 / +67 lines)
Lines 938-943 sub CanBookBeIssued { Link Here
938
        }
938
        }
939
    }
939
    }
940
940
941
    my $no_issues_charge_linked = $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{limit};
942
    if ( defined $no_issues_charge_linked ) {
943
        if (   $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{overlimit}
944
            && !$inprocess
945
            && !$allowfineoverride )
946
        {
947
            $issuingimpossible{DEBT_LINKED_ACCOUNTS} =
948
                $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{charge};
949
        } elsif ( $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{overlimit}
950
            && !$inprocess
951
            && $allowfineoverride )
952
        {
953
            $needsconfirmation{DEBT_LINKED_ACCOUNTS} =
954
                $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{charge};
955
        } elsif ( $allfinesneedoverride
956
            && $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{charge} > 0
957
            && !$inprocess )
958
        {
959
            $needsconfirmation{DEBT_LINKED_ACCOUNTS} =
960
                $patron_borrowing_status->{NoIssuesChargeLinkedAccounts}->{charge};
961
        }
962
    }
963
941
    if ( C4::Context->preference("IssuingInProcess") ) {
964
    if ( C4::Context->preference("IssuingInProcess") ) {
942
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$inprocess && !$allowfineoverride ) {
965
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$inprocess && !$allowfineoverride ) {
943
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
966
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
Lines 1224-1250 sub CanBookBeIssued { Link Here
1224
        if ($restype) {
1247
        if ($restype) {
1225
            my $resbor = $res->{'borrowernumber'};
1248
            my $resbor = $res->{'borrowernumber'};
1226
            if ( $resbor ne $patron->borrowernumber ) {
1249
            if ( $resbor ne $patron->borrowernumber ) {
1227
                my $patron = Koha::Patrons->find($resbor);
1250
                my $hold_patron = Koha::Patrons->find($resbor);
1228
                if ( $restype eq "Waiting" ) {
1251
                if ( $restype eq "Waiting" ) {
1229
1252
1230
                    # The item is on reserve and waiting, but has been
1253
                    # Check if hold is for a linked account
1231
                    # reserved by some other patron.
1254
                    my $is_linked_account = 0;
1232
                    $needsconfirmation{RESERVE_WAITING}     = 1;
1255
                    if (   C4::Context->preference('EnablePatronAccountLinking')
1233
                    $needsconfirmation{'resfirstname'}      = $patron->firstname;
1256
                        && C4::Context->preference('AllowLinkedAccountHoldPickup') )
1234
                    $needsconfirmation{'ressurname'}        = $patron->surname;
1257
                    {
1235
                    $needsconfirmation{'rescardnumber'}     = $patron->cardnumber;
1258
                        my $linked_ids = $patron->all_linked_borrowernumbers;
1236
                    $needsconfirmation{'resborrowernumber'} = $patron->borrowernumber;
1259
                        $is_linked_account = grep { $_ == $resbor } @$linked_ids;
1237
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1260
                    }
1238
                    $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1261
1239
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1262
                    if ($is_linked_account) {
1263
1264
                        # Hold is for a linked account - allow pickup with redirect
1265
                        $alerts{LINKED_ACCOUNT_HOLD_PICKUP} = {
1266
                            reserve_id     => $res->{reserve_id},
1267
                            hold_patron_id => $resbor,
1268
                            hold_patron    => $hold_patron,
1269
                        };
1270
                    } else {
1271
1272
                        # The item is on reserve and waiting, but has been
1273
                        # reserved by some other patron.
1274
                        $needsconfirmation{RESERVE_WAITING}     = 1;
1275
                        $needsconfirmation{'resfirstname'}      = $hold_patron->firstname;
1276
                        $needsconfirmation{'ressurname'}        = $hold_patron->surname;
1277
                        $needsconfirmation{'rescardnumber'}     = $hold_patron->cardnumber;
1278
                        $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber;
1279
                        $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1280
                        $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1281
                        $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1282
                    }
1240
                } elsif ( $restype eq "Reserved" ) {
1283
                } elsif ( $restype eq "Reserved" ) {
1241
1284
1242
                    # The item is on reserve for someone else.
1285
                    # The item is on reserve for someone else.
1243
                    $needsconfirmation{RESERVED}            = 1;
1286
                    $needsconfirmation{RESERVED}            = 1;
1244
                    $needsconfirmation{'resfirstname'}      = $patron->firstname;
1287
                    $needsconfirmation{'resfirstname'}      = $hold_patron->firstname;
1245
                    $needsconfirmation{'ressurname'}        = $patron->surname;
1288
                    $needsconfirmation{'ressurname'}        = $hold_patron->surname;
1246
                    $needsconfirmation{'rescardnumber'}     = $patron->cardnumber;
1289
                    $needsconfirmation{'rescardnumber'}     = $hold_patron->cardnumber;
1247
                    $needsconfirmation{'resborrowernumber'} = $patron->borrowernumber;
1290
                    $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber;
1248
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1291
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1249
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1292
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1250
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1293
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
Lines 1252-1261 sub CanBookBeIssued { Link Here
1252
1295
1253
                    # The item is determined hold being transferred for someone else.
1296
                    # The item is determined hold being transferred for someone else.
1254
                    $needsconfirmation{TRANSFERRED}         = 1;
1297
                    $needsconfirmation{TRANSFERRED}         = 1;
1255
                    $needsconfirmation{'resfirstname'}      = $patron->firstname;
1298
                    $needsconfirmation{'resfirstname'}      = $hold_patron->firstname;
1256
                    $needsconfirmation{'ressurname'}        = $patron->surname;
1299
                    $needsconfirmation{'ressurname'}        = $hold_patron->surname;
1257
                    $needsconfirmation{'rescardnumber'}     = $patron->cardnumber;
1300
                    $needsconfirmation{'rescardnumber'}     = $hold_patron->cardnumber;
1258
                    $needsconfirmation{'resborrowernumber'} = $patron->borrowernumber;
1301
                    $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber;
1259
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1302
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1260
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1303
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1261
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1304
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
Lines 1263-1272 sub CanBookBeIssued { Link Here
1263
1306
1264
                    # The item is determined hold being processed for someone else.
1307
                    # The item is determined hold being processed for someone else.
1265
                    $needsconfirmation{PROCESSING}          = 1;
1308
                    $needsconfirmation{PROCESSING}          = 1;
1266
                    $needsconfirmation{'resfirstname'}      = $patron->firstname;
1309
                    $needsconfirmation{'resfirstname'}      = $hold_patron->firstname;
1267
                    $needsconfirmation{'ressurname'}        = $patron->surname;
1310
                    $needsconfirmation{'ressurname'}        = $hold_patron->surname;
1268
                    $needsconfirmation{'rescardnumber'}     = $patron->cardnumber;
1311
                    $needsconfirmation{'rescardnumber'}     = $hold_patron->cardnumber;
1269
                    $needsconfirmation{'resborrowernumber'} = $patron->borrowernumber;
1312
                    $needsconfirmation{'resborrowernumber'} = $hold_patron->borrowernumber;
1270
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1313
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1271
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1314
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1272
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1315
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
Lines 3338-3344 sub CanBookBeRenewed { Link Here
3338
                        unless CanItemBeReserved(
3381
                        unless CanItemBeReserved(
3339
                        $patron_with_reserve, $other_item, undef,
3382
                        $patron_with_reserve, $other_item, undef,
3340
                        { ignore_hold_counts => 1 }
3383
                        { ignore_hold_counts => 1 }
3341
                        )->{status} eq 'OK';
3384
                    )->{status} eq 'OK';
3342
3385
3343
                    # NOTE: At checkin we call 'CheckReserves' which checks hold 'policy'
3386
                    # NOTE: At checkin we call 'CheckReserves' which checks hold 'policy'
3344
                    # CanItemBeReserved checks 'rules' and 'policies' which means
3387
                    # CanItemBeReserved checks 'rules' and 'policies' which means
3345
- 

Return to bug 39658