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

(-)a/C4/Circulation.pm (+157 lines)
Lines 22-27 use Modern::Perl; Link Here
22
use DateTime;
22
use DateTime;
23
use POSIX qw( floor );
23
use POSIX qw( floor );
24
use Encode;
24
use Encode;
25
use JSON;
25
26
26
use C4::Context;
27
use C4::Context;
27
use C4::Stats qw( UpdateStats );
28
use C4::Stats qw( UpdateStats );
Lines 319-324 A recall for this item was found, and the item needs to be transferred to the re Link Here
319
320
320
=cut
321
=cut
321
322
323
my $query = CGI->new;
324
325
my $stickyduedate      = $query->param('stickyduedate');
326
my $duedatespec        = $query->param('duedatespec');
327
my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec;
328
if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) {
329
    undef $restoreduedatespec;
330
}
331
my $issueconfirmed = $query->param('issueconfirmed');
332
my $cancelreserve  = $query->param('cancelreserve');
333
my $cancel_recall  = $query->param('cancel_recall');
334
my $recall_id      = $query->param('recall_id');
335
my $debt_confirmed = $query->param('debt_confirmed') || 0;     # Don't show the debt error dialog twice
336
my $charges        = $query->param('charges')        || q{};
337
322
sub transferbook {
338
sub transferbook {
323
    my $params   = shift;
339
    my $params   = shift;
324
    my $tbr      = $params->{to_branch};
340
    my $tbr      = $params->{to_branch};
Lines 816-824 sub CanBookBeIssued { Link Here
816
    my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) );
832
    my $circ_library = Koha::Libraries->find( _GetCircControlBranch( $item_object, $patron ) );
817
833
818
    my $now = dt_from_string();
834
    my $now = dt_from_string();
835
    my $message;
836
    my @message;
837
819
    $duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron );
838
    $duedate ||= CalcDateDue( $now, $effective_itemtype, $circ_library->branchcode, $patron );
839
820
    if ( DateTime->compare( $duedate, $now ) == -1 ) {    # duedate cannot be before now
840
    if ( DateTime->compare( $duedate, $now ) == -1 ) {    # duedate cannot be before now
821
        $needsconfirmation{INVALID_DATE} = $duedate;
841
        $needsconfirmation{INVALID_DATE} = $duedate;
842
        if ($issueconfirmed) {
843
            if ($message) {
844
                $message = "$message + sticky due date is invalid or due date in the past";
845
            } else {
846
                $message = "sticky due date is invalid or due date in the past";
847
            }
848
            push( @message, "sticky due date is invalid or due date in the past" );
849
        }
850
822
    }
851
    }
823
852
824
    my $fees = Koha::Charges::Fees->new(
853
    my $fees = Koha::Charges::Fees->new(
Lines 864-869 sub CanBookBeIssued { Link Here
864
    }
893
    }
865
    if ( $patron->is_debarred ) {
894
    if ( $patron->is_debarred ) {
866
        $issuingimpossible{DEBARRED} = 1;
895
        $issuingimpossible{DEBARRED} = 1;
896
        if ($issueconfirmed) {
897
            if ($message) {
898
                $message = "$message + borrower is restricted";
899
            } else {
900
                $message = "borrower is restricted";
901
            }
902
            push( @message, "borrower is restricted" );
903
        }
867
    }
904
    }
868
905
869
    if ( $patron->is_expired ) {
906
    if ( $patron->is_expired ) {
Lines 936-945 sub CanBookBeIssued { Link Here
936
    } else {
973
    } else {
937
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) {
974
        if ( $patron_borrowing_status->{noissuescharge}->{overlimit} && $allowfineoverride ) {
938
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
975
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
976
            if ($issueconfirmed) {
977
                if ($message) {
978
                    $message = "$message + borrower had amend";
979
                } else {
980
                    $message = "borrower had amend";
981
                }
982
                push( @message, "borrower had amend" );
983
            }
939
        } elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) {
984
        } elsif ( $patron_borrowing_status->{noissuescharge}->{overlimit} && !$allowfineoverride ) {
940
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
985
            $issuingimpossible{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
941
        } elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) {
986
        } elsif ( $patron_borrowing_status->{noissuescharge}->{charge} > 0 && $allfinesneedoverride ) {
942
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
987
            $needsconfirmation{DEBT} = $patron_borrowing_status->{noissuescharge}->{charge};
988
            if ($issueconfirmed) {
989
                if ($message) {
990
                    $message = "$message + borrower had amend";
991
                } else {
992
                    $message = "borrower had amend";
993
                }
994
                push( @message, "borrower had amend" );
995
            }
943
        }
996
        }
944
    }
997
    }
945
998
Lines 1020-1025 sub CanBookBeIssued { Link Here
1020
                $needsconfirmation{issued_surname}        = $patron->surname;
1073
                $needsconfirmation{issued_surname}        = $patron->surname;
1021
                $needsconfirmation{issued_cardnumber}     = $patron->cardnumber;
1074
                $needsconfirmation{issued_cardnumber}     = $patron->cardnumber;
1022
                $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
1075
                $needsconfirmation{issued_borrowernumber} = $patron->borrowernumber;
1076
                if ($issueconfirmed) {
1077
                    if ($message) {
1078
                        $message = "$message + item is checked out for someone else ";
1079
                    } else {
1080
                        $message = "item is checked out for someone else";
1081
                    }
1082
                    push( @message, "item is checked out for someone else" );
1083
                }
1023
            }
1084
            }
1024
        }
1085
        }
1025
    }
1086
    }
Lines 1047-1052 sub CanBookBeIssued { Link Here
1047
            $needsconfirmation{current_loan_count}        = $toomany->{count};
1108
            $needsconfirmation{current_loan_count}        = $toomany->{count};
1048
            $needsconfirmation{max_loans_allowed}         = $toomany->{max_allowed};
1109
            $needsconfirmation{max_loans_allowed}         = $toomany->{max_allowed};
1049
            $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule};
1110
            $needsconfirmation{circulation_rule_TOO_MANY} = $toomany->{circulation_rule};
1111
            if ($issueconfirmed) {
1112
                if ($message) {
1113
                    $message = "$message + too many checkout";
1114
                } else {
1115
                    $message = "too many checkout";
1116
                }
1117
                push( @message, "too many checkout" );
1118
            }
1050
        } else {
1119
        } else {
1051
            $issuingimpossible{TOO_MANY}                  = $toomany->{reason};
1120
            $issuingimpossible{TOO_MANY}                  = $toomany->{reason};
1052
            $issuingimpossible{current_loan_count}        = $toomany->{count};
1121
            $issuingimpossible{current_loan_count}        = $toomany->{count};
Lines 1074-1079 sub CanBookBeIssued { Link Here
1074
        } else {
1143
        } else {
1075
            $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1;
1144
            $needsconfirmation{NOT_FOR_LOAN_FORCING} = 1;
1076
            $needsconfirmation{item_notforloan}      = $item_object->notforloan;
1145
            $needsconfirmation{item_notforloan}      = $item_object->notforloan;
1146
            if ($issueconfirmed) {
1147
                if ($message) {
1148
                    $message = "$message + item not for loan";
1149
                } else {
1150
                    $message = "item not for loan";
1151
                }
1152
                push( @message, "item not for loan" );
1153
            }
1077
        }
1154
        }
1078
    } else {
1155
    } else {
1079
1156
Lines 1119-1124 sub CanBookBeIssued { Link Here
1119
        my $code = $av->count ? $av->next->lib : '';
1196
        my $code = $av->count ? $av->next->lib : '';
1120
        $needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' );
1197
        $needsconfirmation{ITEM_LOST} = $code if ( C4::Context->preference("IssueLostItem") eq 'confirm' );
1121
        $alerts{ITEM_LOST}            = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
1198
        $alerts{ITEM_LOST}            = $code if ( C4::Context->preference("IssueLostItem") eq 'alert' );
1199
        if ($issueconfirmed) {
1200
            if ($message) {
1201
                $message = "$message + item lost";
1202
            } else {
1203
                $message = "item lost";
1204
            }
1205
            push( @message, "item lost" );
1206
        }
1122
    }
1207
    }
1123
    if ( C4::Context->preference("IndependentBranches") ) {
1208
    if ( C4::Context->preference("IndependentBranches") ) {
1124
        my $userenv = C4::Context->userenv;
1209
        my $userenv = C4::Context->userenv;
Lines 1219-1224 sub CanBookBeIssued { Link Here
1219
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1304
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1220
                    $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1305
                    $needsconfirmation{'reswaitingdate'}    = $res->{'waitingdate'};
1221
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1306
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1307
1308
                    if ($issueconfirmed) {
1309
                        if ($message) {
1310
                            $message =
1311
                                "$message + item is on reserve and waiting, but has been reserved by some other patron.";
1312
                        } else {
1313
                            $message = "item is on reserve and waiting, but has been reserved by some other patron.";
1314
                        }
1315
                        push( @message, "item is on reserve and waiting, but has been reserved by some other patron" );
1316
                    }
1222
                } elsif ( $restype eq "Reserved" ) {
1317
                } elsif ( $restype eq "Reserved" ) {
1223
1318
1224
                    # The item is on reserve for someone else.
1319
                    # The item is on reserve for someone else.
Lines 1230-1235 sub CanBookBeIssued { Link Here
1230
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1325
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1231
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1326
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1232
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1327
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1328
1329
                    if ($issueconfirmed) {
1330
                        if ($message) {
1331
                            $message = "$message + item is on reserve for someone else";
1332
                        } else {
1333
                            $message = "item is on reserve for someone else";
1334
                        }
1335
                        push( @message, "item is on reserve for someone else" );
1336
                    }
1233
                } elsif ( $restype eq "Transferred" ) {
1337
                } elsif ( $restype eq "Transferred" ) {
1234
1338
1235
                    # The item is determined hold being transferred for someone else.
1339
                    # The item is determined hold being transferred for someone else.
Lines 1241-1246 sub CanBookBeIssued { Link Here
1241
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1345
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1242
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1346
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1243
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1347
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1348
1349
                    if ($issueconfirmed) {
1350
                        if ($message) {
1351
                            $message = "$message + item is determined hold being transferred for someone else";
1352
                        } else {
1353
                            $message = "item is determined hold being transferred for someone else";
1354
                        }
1355
                        push( @message, "item is determined hold being transferred for someone else" );
1356
                    }
1244
                } elsif ( $restype eq "Processing" ) {
1357
                } elsif ( $restype eq "Processing" ) {
1245
1358
1246
                    # The item is determined hold being processed for someone else.
1359
                    # The item is determined hold being processed for someone else.
Lines 1252-1257 sub CanBookBeIssued { Link Here
1252
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1365
                    $needsconfirmation{'resbranchcode'}     = $res->{branchcode};
1253
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1366
                    $needsconfirmation{'resreservedate'}    = $res->{reservedate};
1254
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1367
                    $needsconfirmation{'reserve_id'}        = $res->{reserve_id};
1368
1369
                    if ($issueconfirmed) {
1370
                        if ($message) {
1371
                            $message = "$message + item is determined hold being processed for someone else";
1372
                        } else {
1373
                            $message = "item is determined hold being processed for someone else";
1374
                        }
1375
                        push( @message, "item is determined hold being processed for someone else" );
1376
                    }
1255
                }
1377
                }
1256
            }
1378
            }
1257
        }
1379
        }
Lines 1295-1300 sub CanBookBeIssued { Link Here
1295
    if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) {
1417
    if ( $restriction_age && $patron->dateofbirth && $restriction_age > $patron->get_age() ) {
1296
        if ( C4::Context->preference('AgeRestrictionOverride') ) {
1418
        if ( C4::Context->preference('AgeRestrictionOverride') ) {
1297
            $needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
1419
            $needsconfirmation{AGE_RESTRICTION} = "$agerestriction";
1420
            if ($message) {
1421
                $message = "$message + age restriction";
1422
            } else {
1423
                $message = "age restriction";
1424
            }
1425
            push( @message, "age restriction" );
1298
        } else {
1426
        } else {
1299
            $issuingimpossible{AGE_RESTRICTION} = "$agerestriction";
1427
            $issuingimpossible{AGE_RESTRICTION} = "$agerestriction";
1300
        }
1428
        }
Lines 1353-1358 sub CanBookBeIssued { Link Here
1353
        }
1481
        }
1354
    }
1482
    }
1355
1483
1484
    my $borrower   = $patron;
1485
    my $user       = C4::Context->userenv->{number};
1486
    my $branchcode = C4::Context->userenv->{branch};
1487
    my $item       = Koha::Items->find( { barcode => $barcode } );
1488
    my $itemnumber = $item->itemnumber;
1489
1490
    # action, cardnumber, barcode, date, heure, user, branche
1491
    if ($issueconfirmed) {
1492
1493
        my $infos = (
1494
            {
1495
                message        => \@message,
1496
                borrowernumber => $borrower->borrowernumber,
1497
                barcode        => $barcode,
1498
                manager_id     => $user,
1499
                branchcode     => $branchcode,
1500
            }
1501
        );
1502
1503
        my $json_infos = JSON->new->utf8->pretty->encode($infos);
1504
        $json_infos =~ s/"/'/g;
1505
1506
        logaction(
1507
            "CIRCULATION", "ISSUE",
1508
            $borrower->{'borrowernumber'},
1509
            $json_infos,
1510
        ) if C4::Context->preference("IssueLog");
1511
    }
1512
1356
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, );
1513
    return ( \%issuingimpossible, \%needsconfirmation, \%alerts, \%messages, );
1357
}
1514
}
1358
1515
(-)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 531-536 if ( @$barcodes && $op eq 'cud-checkout' ) { Link Here
531
                        }
536
                        }
532
                    );
537
                    );
533
                    $recall_id = ( $recall and $recall->id ) ? $recall->id : undef;
538
                    $recall_id = ( $recall and $recall->id ) ? $recall->id : undef;
539
534
                }
540
                }
535
541
536
                # If booked (alerts or confirmation) update datedue to end of booking
542
                # If booked (alerts or confirmation) update datedue to end of booking
Lines 548-553 if ( @$barcodes && $op eq 'cud-checkout' ) { Link Here
548
                    }
554
                    }
549
                );
555
                );
550
                $template_params->{issue} = $issue;
556
                $template_params->{issue} = $issue;
557
558
                my $borrower       = $patron;
559
                my $borrowernumber = $patron->borrowernumber;
560
                my $user           = C4::Context->userenv->{number};
561
                my $branchcode     = C4::Context->userenv->{branch};
562
                $message = "Restriction overridden temporarily";
563
                @message = ("Restriction overridden temporarily");
564
565
                if ($issueconfirmed) {
566
                    my $infos = (
567
                        {
568
                            message        => \@message,
569
                            borrowernumber => $borrowernumber,
570
                            barcode        => $barcode,
571
                            manager_id     => $user,
572
                            branchcode     => $branchcode,
573
                        }
574
                    );
575
576
                    my $json_infos = JSON->new->utf8->pretty->encode($infos);
577
                    $json_infos =~ s/"/'/g;
578
579
                    logaction(
580
                        "CIRCULATION", "ISSUE",
581
                        $borrower->{'borrowernumber'},
582
                        $json_infos,
583
                    ) if C4::Context->preference("IssueLog");
584
                }
551
                $session->clear('auto_renew');
585
                $session->clear('auto_renew');
552
                $inprocess = 1;
586
                $inprocess = 1;
553
            }
587
            }
(-)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 561-566 if ( ( $findborrower && $borrowernumber_hold || $findclub && $club_hold ) Link Here
561
                            $num_alreadyheld++;
562
                            $num_alreadyheld++;
562
                        }
563
                        }
563
564
565
                        my $borrower       = $patron;
566
                        my $borrowernumber = $patron->borrowernumber;
567
                        my $user           = C4::Context->userenv->{number};
568
                        my $branchcode     = C4::Context->userenv->{branch};
569
                        my $message        = "Override limitation of hold";
570
                        my @message        = ("Override limitation of hold");
571
                        my $barcode        = $item->{barcode};
572
573
                        my $infos = (
574
                            {
575
                                message        => \@message,
576
                                borrowernumber => $borrowernumber,
577
                                barcode        => $barcode,
578
                                manager_id     => $user,
579
                                branchcode     => $branchcode,
580
                            }
581
                        );
582
583
                        my $json_infos = JSON->new->utf8->pretty->encode($infos);
584
                        $json_infos =~ s/"/'/g;
585
586
                        logaction(
587
                            "HOLD", "ISSUE",
588
                            $borrower->{'borrowernumber'},
589
                            $json_infos,
590
                        ) if C4::Context->preference("IssueLog");
591
564
                        push( @available_itemtypes, $item->{itype} );
592
                        push( @available_itemtypes, $item->{itype} );
565
                    } else {
593
                    } else {
566
594
(-)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