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

(-)a/C4/Circulation.pm (+157 lines)
Lines 23-28 use DateTime; Link Here
23
use POSIX qw( floor );
23
use POSIX qw( floor );
24
use Encode;
24
use Encode;
25
use Try::Tiny;
25
use Try::Tiny;
26
use JSON;
26
27
27
use C4::Context;
28
use C4::Context;
28
use C4::Stats qw( UpdateStats );
29
use C4::Stats qw( UpdateStats );
Lines 320-325 A recall for this item was found, and the item needs to be transferred to the re Link Here
320
321
321
=cut
322
=cut
322
323
324
my $query = CGI->new;
325
326
my $stickyduedate      = $query->param('stickyduedate');
327
my $duedatespec        = $query->param('duedatespec');
328
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec;
329
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) {
330
    undef $restoreduedatespec;
331
}
332
my $issueconfirmed = $query->param('issueconfirmed');
333
my $cancelreserve  = $query->param('cancelreserve');
334
my $cancel_recall  = $query->param('cancel_recall');
335
my $recall_id      = $query->param('recall_id');
336
my $debt_confirmed = $query->param('debt_confirmed') || 0;     # Don't show the debt error dialog twice
337
my $charges        = $query->param('charges')        || q{};
338
323
sub transferbook {
339
sub transferbook {
324
    my $params   = shift;
340
    my $params   = shift;
325
    my $tbr      = $params->{to_branch};
341
    my $tbr      = $params->{to_branch};
Lines 823-831 sub CanBookBeIssued { Link Here
823
    my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) );
839
    my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) );
824
840
825
    my $now = dt_from_string();
841
    my $now = dt_from_string();
842
    my $message;
843
    my @message;
844
826
    $duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron );
845
    $duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron );
846
827
    if ( DateTime->compare( $duedate, $now ) == -1 ) {    # duedate cannot be before now
847
    if ( DateTime->compare( $duedate, $now ) == -1 ) {    # duedate cannot be before now
828
        $needsconfirmation{INVALID_DATE} = $duedate;
848
        $needsconfirmation{INVALID_DATE} = $duedate;
849
        if ($issueconfirmed) {
850
            if ($message) {
851
                $message = "$message + sticky due date is invalid or due date in the past";
852
            } else {
853
                $message = "sticky due date is invalid or due date in the past";
854
            }
855
            push( @message, "sticky due date is invalid or due date in the past" );
856
        }
857
829
    }
858
    }
830
859
831
    my $fees = Koha::Charges::Fees->new(
860
    my $fees = Koha::Charges::Fees->new(
Lines 871-876 sub CanBookBeIssued { Link Here
871
    }
900
    }
872
    if ( $patron->is_debarred ) {
901
    if ( $patron->is_debarred ) {
873
        $issuingimpossible{DEBARRED} = 1;
902
        $issuingimpossible{DEBARRED} = 1;
903
        if ($issueconfirmed) {
904
            if ($message) {
905
                $message = "$message + borrower is restricted";
906
            } else {
907
                $message = "borrower is restricted";
908
            }
909
            push( @message, "borrower is restricted" );
910
        }
874
    }
911
    }
875
912
876
    if ( $patron->is_expired ) {
913
    if ( $patron->is_expired ) {
Lines 943-952 sub CanBookBeIssued { Link Here
943
    } else {
980
    } else {
944
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) {
981
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) {
945
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
982
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
983
            if ($issueconfirmed) {
984
                if ($message) {
985
                    $message = "$message + borrower had amend";
986
                } else {
987
                    $message = "borrower had amend";
988
                }
989
                push( @message, "borrower had amend" );
990
            }
946
        } elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) {
991
        } elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) {
947
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
992
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
948
        } elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) {
993
        } elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) {
949
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
994
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
995
            if ($issueconfirmed) {
996
                if ($message) {
997
                    $message = "$message + borrower had amend";
998
                } else {
999
                    $message = "borrower had amend";
1000
                }
1001
                push( @message, "borrower had amend" );
1002
            }
950
        }
1003
        }
951
    }
1004
    }
952
1005
Lines 1027-1032 sub CanBookBeIssued { Link Here
1027
                $needsconfirmation{issued_surname}        = $patron->surname;
1080
                $needsconfirmation{issued_surname}        = $patron->surname;
1028
                $needsconfirmation{issued_cardnumber}     = $patron->cardnumber;
1081
                $needsconfirmation{issued_cardnumber}     = $patron->cardnumber;
1029
                $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
1082
                $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
1083
                if ($issueconfirmed) {
1084
                    if ($message) {
1085
                        $message = "$message + item is checked out for someone else ";
1086
                    } else {
1087
                        $message = "item is checked out for someone else";
1088
                    }
1089
                    push( @message, "item is checked out for someone else" );
1090
                }
1030
            }
1091
            }
1031
        }
1092
        }
1032
    }
1093
    }
Lines 1054-1059 sub CanBookBeIssued { Link Here
1054
            $needsconfirmation{current_loan_count}        = $toomany->{count};
1115
            $needsconfirmation{current_loan_count}        = $toomany->{count};
1055
            $needsconfirmation{max_loans_allowed}         = $toomany->{max_allowed};
1116
            $needsconfirmation{max_loans_allowed}         = $toomany->{max_allowed};
1056
            $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule};
1117
            $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule};
1118
            if ($issueconfirmed) {
1119
                if ($message) {
1120
                    $message = "$message + too many checkout";
1121
                } else {
1122
                    $message = "too many checkout";
1123
                }
1124
                push( @message, "too many checkout" );
1125
            }
1057
        } else {
1126
        } else {
1058
            $issuingimpossible{TOO_MANY}                  = $toomany->{reason};
1127
            $issuingimpossible{TOO_MANY}                  = $toomany->{reason};
1059
            $issuingimpossible{current_loan_count}        = $toomany->{count};
1128
            $issuingimpossible{current_loan_count}        = $toomany->{count};
Lines 1086-1091 sub CanBookBeIssued { Link Here
1086
        } else {
1155
        } else {
1087
            $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1;
1156
            $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1;
1088
            $needsconfirmation{item_notforloan}      = $item_object->notforloan;
1157
            $needsconfirmation{item_notforloan}      = $item_object->notforloan;
1158
            if ($issueconfirmed) {
1159
                if ($message) {
1160
                    $message = "$message + item not for loan";
1161
                } else {
1162
                    $message = "item not for loan";
1163
                }
1164
                push( @message, "item not for loan" );
1165
            }
1089
        }
1166
        }
1090
    } else {
1167
    } else {
1091
1168
Lines 1131-1136 sub CanBookBeIssued { Link Here
1131
        my $code = $av->count ? $av->next->lib : '';
1208
        my $code = $av->count ? $av->next->lib : '';
1132
        $needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' );
1209
        $needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' );
1133
        $alerts{ITEM_LOST}            = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
1210
        $alerts{ITEM_LOST}            = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
1211
        if ($issueconfirmed) {
1212
            if ($message) {
1213
                $message = "$message + item lost";
1214
            } else {
1215
                $message = "item lost";
1216
            }
1217
            push( @message, "item lost" );
1218
        }
1134
    }
1219
    }
1135
    if ( C4::Context->preference("IndependentBranches") ) {
1220
    if ( C4::Context->preference("IndependentBranches") ) {
1136
        my $userenv = C4::Context->userenv;
1221
        my $userenv = C4::Context->userenv;
Lines 1231-1236 sub CanBookBeIssued { Link Here
1231
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1316
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1232
                    $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1317
                    $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1233
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1318
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1319
1320
                    if ($issueconfirmed) {
1321
                        if ($message) {
1322
                            $message =
1323
                                "$message + item is on reserve and waiting, but has been reserved by some other patron.";
1324
                        } else {
1325
                            $message = "item is on reserve and waiting, but has been reserved by some other patron.";
1326
                        }
1327
                        push( @message, "item is on reserve and waiting, but has been reserved by some other patron" );
1328
                    }
1234
                } elsif ( $restype eq "Reserved" ) {
1329
                } elsif ( $restype eq "Reserved" ) {
1235
1330
1236
                    # The item is on reserve for someone else.
1331
                    # The item is on reserve for someone else.
Lines 1242-1247 sub CanBookBeIssued { Link Here
1242
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1337
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1243
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1338
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1244
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1339
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1340
1341
                    if ($issueconfirmed) {
1342
                        if ($message) {
1343
                            $message = "$message + item is on reserve for someone else";
1344
                        } else {
1345
                            $message = "item is on reserve for someone else";
1346
                        }
1347
                        push( @message, "item is on reserve for someone else" );
1348
                    }
1245
                } elsif ( $restype eq "Transferred" ) {
1349
                } elsif ( $restype eq "Transferred" ) {
1246
1350
1247
                    # The item is determined hold being transferred for someone else.
1351
                    # The item is determined hold being transferred for someone else.
Lines 1253-1258 sub CanBookBeIssued { Link Here
1253
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1357
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1254
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1358
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1255
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1359
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1360
1361
                    if ($issueconfirmed) {
1362
                        if ($message) {
1363
                            $message = "$message + item is determined hold being transferred for someone else";
1364
                        } else {
1365
                            $message = "item is determined hold being transferred for someone else";
1366
                        }
1367
                        push( @message, "item is determined hold being transferred for someone else" );
1368
                    }
1256
                } elsif ( $restype eq "Processing" ) {
1369
                } elsif ( $restype eq "Processing" ) {
1257
1370
1258
                    # The item is determined hold being processed for someone else.
1371
                    # The item is determined hold being processed for someone else.
Lines 1264-1269 sub CanBookBeIssued { Link Here
1264
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1377
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1265
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1378
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1266
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1379
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1380
1381
                    if ($issueconfirmed) {
1382
                        if ($message) {
1383
                            $message = "$message + item is determined hold being processed for someone else";
1384
                        } else {
1385
                            $message = "item is determined hold being processed for someone else";
1386
                        }
1387
                        push( @message, "item is determined hold being processed for someone else" );
1388
                    }
1267
                }
1389
                }
1268
            }
1390
            }
1269
        }
1391
        }
Lines 1307-1312 sub CanBookBeIssued { Link Here
1307
    if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) {
1429
    if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) {
1308
        if ( C4::Context->preference('AgeRestrictionOverride') ) {
1430
        if ( C4::Context->preference('AgeRestrictionOverride') ) {
1309
            $needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
1431
            $needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
1432
            if ($message) {
1433
                $message = "$message + age restriction";
1434
            } else {
1435
                $message = "age restriction";
1436
            }
1437
            push( @message, "age restriction" );
1310
        } else {
1438
        } else {
1311
            $issuingimpossible{AGE_RESTRICTION} = "$agerestriction";
1439
            $issuingimpossible{AGE_RESTRICTION} = "$agerestriction";
1312
        }
1440
        }
Lines 1365-1370 sub CanBookBeIssued { Link Here
1365
        }
1493
        }
1366
    }
1494
    }
1367
1495
1496
    my $borrower   = $patron;
1497
    my $user       = C4::Context->userenv->{number};
1498
    my $branchcode = C4::Context->userenv->{branch};
1499
    my $item       = Koha::Items->find( { barcode => $barcode } );
1500
    my $itemnumber = $item->itemnumber;
1501
1502
    # action, cardnumber, barcode, date, heure, user, branche
1503
    if ($issueconfirmed) {
1504
1505
        my $infos = (
1506
            {
1507
                message        => \@message,
1508
                borrowernumber => $borrower->borrowernumber,
1509
                barcode        => $barcode,
1510
                manager_id     => $user,
1511
                branchcode     => $branchcode,
1512
            }
1513
        );
1514
1515
        my $json_infos = JSON->new->utf8->pretty->encode($infos);
1516
        $json_infos =~ s/"/'/g;
1517
1518
        logaction(
1519
            "CIRCULATION", "ISSUE",
1520
            $borrower->{'borrowernumber'},
1521
            $json_infos,
1522
        ) if C4::Context->preference("IssueLog");
1523
    }
1524
1368
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, );
1525
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, );
1369
}
1526
}
1370
1527
(-)a/circ/circulation.pl (-1 / +35 lines)
Lines 39-44 use C4::Members; Link Here
39
use C4::Biblio   qw( TransformMarcToKoha );
39
use C4::Biblio   qw( TransformMarcToKoha );
40
use C4::Search   qw( new_record_from_zebra );
40
use C4::Search   qw( new_record_from_zebra );
41
use C4::Reserves qw( ModReserveAffect );
41
use C4::Reserves qw( ModReserveAffect );
42
use C4::Log      qw( logaction );
42
use Koha::Holds;
43
use Koha::Holds;
43
use C4::Context;
44
use C4::Context;
44
use CGI::Session;
45
use CGI::Session;
Lines 239-245 if ( @$barcodes == 0 && $charges eq 'yes' ) { Link Here
239
# STEP 2 : FIND BORROWER
240
# STEP 2 : FIND BORROWER
240
# if there is a list of find borrowers....
241
# if there is a list of find borrowers....
241
#
242
#
242
my $message;
243
243
if ($findborrower) {
244
if ($findborrower) {
244
    Koha::Plugins->call( 'patron_barcode_transform', \$findborrower );
245
    Koha::Plugins->call( 'patron_barcode_transform', \$findborrower );
245
    my $patron = Koha::Patrons->find( { cardnumber => $findborrower } );
246
    my $patron = Koha::Patrons->find( { cardnumber => $findborrower } );
Lines 325-330 if ($patron) { Link Here
325
# STEP 3 : ISSUING
326
# STEP 3 : ISSUING
326
#
327
#
327
#
328
#
329
my $message;
330
my @message;
331
328
if ( @$barcodes && $op eq 'cud-checkout' ) {
332
if ( @$barcodes && $op eq 'cud-checkout' ) {
329
    my $checkout_infos;
333
    my $checkout_infos;
330
    for my $barcode (@$barcodes) {
334
    for my $barcode (@$barcodes) {
Lines 370-375 if ( @$barcodes && $op eq 'cud-checkout' ) { Link Here
370
        }
374
        }
371
375
372
        if ( $issuingimpossible->{'STATS'} ) {
376
        if ( $issuingimpossible->{'STATS'} ) {
377
373
            my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) =
378
            my ( $stats_return, $stats_messages, $stats_iteminformation, $stats_borrower ) =
374
                AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 );
379
                AddReturn( $item->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 );
375
380
Lines 534-539 if ( @$barcodes && $op eq 'cud-checkout' ) { Link Here
534
                        }
539
                        }
535
                    );
540
                    );
536
                    $recall_id = ( $recall and $recall->id ) ? $recall->id : undef;
541
                    $recall_id = ( $recall and $recall->id ) ? $recall->id : undef;
542
537
                }
543
                }
538
544
539
                # If booked (alerts or confirmation) update datedue to end of booking
545
                # If booked (alerts or confirmation) update datedue to end of booking
Lines 551-556 if ( @$barcodes && $op eq 'cud-checkout' ) { Link Here
551
                    }
557
                    }
552
                );
558
                );
553
                $template_params->{issue} = $issue;
559
                $template_params->{issue} = $issue;
560
561
                my $borrower       = $patron;
562
                my $borrowernumber = $patron->borrowernumber;
563
                my $user           = C4::Context->userenv->{number};
564
                my $branchcode     = C4::Context->userenv->{branch};
565
                $message = "Restriction overridden temporarily";
566
                @message = ("Restriction overridden temporarily");
567
568
                if ($issueconfirmed) {
569
                    my $infos = (
570
                        {
571
                            message        => \@message,
572
                            borrowernumber => $borrowernumber,
573
                            barcode        => $barcode,
574
                            manager_id     => $user,
575
                            branchcode     => $branchcode,
576
                        }
577
                    );
578
579
                    my $json_infos = JSON->new->utf8->pretty->encode($infos);
580
                    $json_infos =~ s/"/'/g;
581
582
                    logaction(
583
                        "CIRCULATION", "ISSUE",
584
                        $borrower->{'borrowernumber'},
585
                        $json_infos,
586
                    ) if C4::Context->preference("IssueLog");
587
                }
554
                $session->clear('auto_renew');
588
                $session->clear('auto_renew');
555
                $inprocess = 1;
589
                $inprocess = 1;
556
            }
590
            }
(-)a/circ/renew.pl (+50 lines)
Lines 24-29 use C4::Context; Link Here
24
use C4::Auth        qw( get_template_and_user );
24
use C4::Auth        qw( get_template_and_user );
25
use C4::Output      qw( output_html_with_http_headers );
25
use C4::Output      qw( output_html_with_http_headers );
26
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal );
26
use C4::Circulation qw( barcodedecode CanBookBeRenewed GetLatestAutoRenewDate AddRenewal );
27
use C4::Log         qw( logaction );
27
use Koha::DateUtils qw( dt_from_string );
28
use Koha::DateUtils qw( dt_from_string );
28
use Koha::Database;
29
use Koha::Database;
29
use Koha::BiblioFrameworks;
30
use Koha::BiblioFrameworks;
Lines 64-69 if ( $op eq 'cud-renew' && $barcode ) { Link Here
64
        if ($checkout) {
65
        if ($checkout) {
65
66
66
            $patron = $checkout->patron;
67
            $patron = $checkout->patron;
68
            my $borrowernumber = $patron->borrowernumber;
69
            my $user           = C4::Context->userenv->{number};
70
            my $branchcode     = C4::Context->userenv->{branch};
71
            my $message;
72
            my @message;
67
73
68
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
74
            if ( ( $patron->is_debarred || q{} ) lt dt_from_string()->ymd() ) {
69
                my $can_renew;
75
                my $can_renew;
Lines 74-79 if ( $op eq 'cud-renew' && $barcode ) { Link Here
74
                    if ($override_holds) {
80
                    if ($override_holds) {
75
                        $can_renew = 1;
81
                        $can_renew = 1;
76
                        $error     = undef;
82
                        $error     = undef;
83
84
                        $message = "Override Renew hold for another";
85
                        @message = ("Override Renew hold for another");
86
87
                        my $infos = (
88
                            {
89
                                message        => \@message,
90
                                borrowernumber => $borrowernumber,
91
                                barcode        => $barcode,
92
                                manager_id     => $user,
93
                                branchcode     => $branchcode,
94
                            }
95
                        );
96
97
                        my $json_infos = JSON->new->utf8->pretty->encode($infos);
98
                        $json_infos =~ s/"/'/g;
99
100
                        logaction(
101
                            "CIRCULATION", "RENEWAL",
102
                            $patron->borrowernumber,
103
                            $json_infos,
104
                        ) if C4::Context->preference("RenewalLog");
77
                    } else {
105
                    } else {
78
                        $can_renew = 0;
106
                        $can_renew = 0;
79
                    }
107
                    }
Lines 104-109 if ( $op eq 'cud-renew' && $barcode ) { Link Here
104
                        }
132
                        }
105
                    );
133
                    );
106
                    $template->param( date_due => $date_due );
134
                    $template->param( date_due => $date_due );
135
136
                    $message = "Override limit Renew";
137
                    @message = ("Override limit Renew");
138
139
                    my $infos = (
140
                        {
141
                            message        => \@message,
142
                            borrowernumber => $borrowernumber,
143
                            barcode        => $barcode,
144
                            manager_id     => $user,
145
                            branchcode     => $branchcode,
146
                        }
147
                    );
148
149
                    my $json_infos = JSON->new->utf8->pretty->encode($infos);
150
                    $json_infos =~ s/"/'/g;
151
152
                    logaction(
153
                        "CIRCULATION", "RENEWAL",
154
                        $patron->borrowernumber,
155
                        $json_infos,
156
                    ) if C4::Context->preference("RenewalLog");
107
                }
157
                }
108
            } else {
158
            } else {
109
                $error = "patron_restricted";
159
                $error = "patron_restricted";
(-)a/circ/returns.pl (+28 lines)
Lines 42-47 use C4::Members; Link Here
42
use C4::Output   qw( output_html_with_http_headers );
42
use C4::Output   qw( output_html_with_http_headers );
43
use C4::Reserves qw( ModReserve ModReserveAffect CheckReserves );
43
use C4::Reserves qw( ModReserve ModReserveAffect CheckReserves );
44
use C4::RotatingCollections;
44
use C4::RotatingCollections;
45
use C4::Log qw( logaction );
45
use Koha::AuthorisedValues;
46
use Koha::AuthorisedValues;
46
use Koha::BiblioFrameworks;
47
use Koha::BiblioFrameworks;
47
use Koha::Calendar;
48
use Koha::Calendar;
Lines 158-163 if ( $query->param('reserve_id') && $op eq 'cud-affect_reserve' ) { Link Here
158
            $transfer->transit;
159
            $transfer->transit;
159
        }
160
        }
160
    }
161
    }
162
} else {
163
    my $message    = "return an element that is reserved";
164
    my @message    = ("return an element that is reserved");
165
    my $user       = C4::Context->userenv->{number};
166
    my $branchcode = C4::Context->userenv->{branch};
167
    my $barcode    = $query->param('barcode');
168
169
    my $infos = (
170
        {
171
            message => \@message,
172
173
            #'card number' => $cardnumber,
174
            barcode    => $barcode,
175
            manager_id => $user,
176
            branchcode => $branchcode,
177
        }
178
    );
179
180
    my $json_infos = JSON->new->utf8->pretty->encode($infos);
181
    $json_infos =~ s/"/'/g;
182
183
    logaction(
184
        "CIRCULATION", "RETURN",
185
        $session,
186
        $json_infos,
187
    ) if C4::Context->preference("ReturnLog");
161
}
188
}
162
189
163
if ( $query->param('recall_id') && $op eq 'cud-affect_recall' ) {
190
if ( $query->param('recall_id') && $op eq 'cud-affect_recall' ) {
Lines 220-225 if ($return_date_override) { Link Here
220
247
221
# If 'needstransfer' was set and the librarian has chosen to initiate the transfer
248
# If 'needstransfer' was set and the librarian has chosen to initiate the transfer
222
if ( $op eq 'cud-dotransfer' ) {
249
if ( $op eq 'cud-dotransfer' ) {
250
223
    my $transferitem = $query->param('transferitem');
251
    my $transferitem = $query->param('transferitem');
224
    my $item         = Koha::Items->find($transferitem);
252
    my $item         = Koha::Items->find($transferitem);
225
    my $tobranchcode = $query->param('tobranch');
253
    my $tobranchcode = $query->param('tobranch');
(-)a/reserve/request.pl (+28 lines)
Lines 40-45 use C4::Serials qw( CountSubscriptionFromBiblionumber ); Link Here
40
use C4::Circulation qw( _GetCircControlBranch GetBranchItemRule );
40
use C4::Circulation qw( _GetCircControlBranch GetBranchItemRule );
41
use Koha::DateUtils qw( dt_from_string );
41
use Koha::DateUtils qw( dt_from_string );
42
use C4::Search      qw( enabled_staff_search_views );
42
use C4::Search      qw( enabled_staff_search_views );
43
use C4::Log         qw( logaction );
43
44
44
use Koha::Biblios;
45
use Koha::Biblios;
45
use Koha::Checkouts;
46
use Koha::Checkouts;
Lines 568-573 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
568
                            $num_alreadyheld++;
569
                            $num_alreadyheld++;
569
                        }
570
                        }
570
571
572
                        my $borrower       = $patron;
573
                        my $borrowernumber = $patron->borrowernumber;
574
                        my $user           = C4::Context->userenv->{number};
575
                        my $branchcode     = C4::Context->userenv->{branch};
576
                        my $message        = "Override limitation of hold";
577
                        my @message        = ("Override limitation of hold");
578
                        my $barcode        = $item->{barcode};
579
580
                        my $infos = (
581
                            {
582
                                message        => \@message,
583
                                borrowernumber => $borrowernumber,
584
                                barcode        => $barcode,
585
                                manager_id     => $user,
586
                                branchcode     => $branchcode,
587
                            }
588
                        );
589
590
                        my $json_infos = JSON->new->utf8->pretty->encode($infos);
591
                        $json_infos =~ s/"/'/g;
592
593
                        logaction(
594
                            "HOLD", "ISSUE",
595
                            $borrower->{'borrowernumber'},
596
                            $json_infos,
597
                        ) if C4::Context->preference("IssueLog");
598
571
                        push( @available_itemtypes, $item->{itype} );
599
                        push( @available_itemtypes, $item->{itype} );
572
                    } else {
600
                    } else {
573
601
(-)a/svc/renew (-1 / +54 lines)
Lines 26-31 use Try::Tiny; Link Here
26
use C4::Circulation qw( AddRenewal CanBookBeRenewed );
26
use C4::Circulation qw( AddRenewal CanBookBeRenewed );
27
use C4::Context;
27
use C4::Context;
28
use C4::Auth qw(check_cookie_auth);
28
use C4::Auth qw(check_cookie_auth);
29
use C4::Log  qw( logaction );
29
30
30
use Koha::DateUtils qw(output_pref dt_from_string);
31
use Koha::DateUtils qw(output_pref dt_from_string);
31
32
Lines 53-58 my $date_due; Link Here
53
if ( $input->param('date_due') ) {
54
if ( $input->param('date_due') ) {
54
    $date_due = dt_from_string( scalar $input->param('date_due') );
55
    $date_due = dt_from_string( scalar $input->param('date_due') );
55
}
56
}
57
my $borrower = Koha::Patrons->find($borrowernumber);
58
my $user     = C4::Context->userenv->{'number'};
59
my $message;
60
my @message;
56
61
57
my $data;
62
my $data;
58
$data->{itemnumber}     = $itemnumber;
63
$data->{itemnumber}     = $itemnumber;
Lines 69-74 my $item = Koha::Items->find($itemnumber); Link Here
69
if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride') ) {
74
if ( $data->{error} && $data->{error} eq 'on_reserve' && C4::Context->preference('AllowRenewalOnHoldOverride') ) {
70
    $data->{renew_okay} = 1;
75
    $data->{renew_okay} = 1;
71
    $data->{error}      = undef;
76
    $data->{error}      = undef;
77
78
    $message = "Override Renew hold for another";
79
    @message = ("Override Renew hold for another");
80
81
    my $infos = (
82
        {
83
            message        => \@message,
84
            borrowernumber => $borrowernumber,
85
            barcode        => $item->barcode,
86
            manager_id     => $user,
87
            branchcode     => $branchcode,
88
        }
89
    );
90
91
    my $json_infos = JSON->new->utf8->pretty->encode($infos);
92
    $json_infos =~ s/"/'/g;
93
94
    logaction(
95
        "CIRCULATION", "RENEWAL",
96
        $borrower->{'borrowernumber'},
97
        $json_infos,
98
    ) if C4::Context->preference("IssueLog");
99
}
100
101
if ( $data->{error} && $data->{error} eq 'too_many' && C4::Context->preference('AllowRenewalLimitOverride') ) {
102
    $data->{renew_okay} = 1;
103
    $data->{error}      = undef;
104
105
    $message = "Override limit Renew";
106
    @message = ("Override limit Renew");
107
108
    my $infos = (
109
        {
110
            message        => \@message,
111
            borrowernumber => $borrowernumber,
112
            barcode        => $item->barcode,
113
            manager_id     => $user,
114
            branchcode     => $branchcode,
115
        }
116
    );
117
118
    my $json_infos = JSON->new->utf8->pretty->encode($infos);
119
    $json_infos =~ s/"/'/g;
120
121
    logaction(
122
        "CIRCULATION", "RENEWAL",
123
        $borrower->{'borrowernumber'},
124
        $json_infos,
125
    ) if C4::Context->preference("IssueLog");
72
}
126
}
73
127
74
if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen' ) ) {
128
if ( $data->{renew_okay} || ( $seen && $data->{error} eq 'too_unseen' ) ) {
75
- 

Return to bug 9762