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

(-)a/C4/Letters.pm (-1 / +1 lines)
Lines 1519-1525 sub _get_tt_params { Link Here
1519
            module   => 'Koha::Holds',
1519
            module   => 'Koha::Holds',
1520
            singular => 'hold',
1520
            singular => 'hold',
1521
            plural   => 'holds',
1521
            plural   => 'holds',
1522
            fk       => [ 'borrowernumber', 'biblionumber' ],
1522
            pk       => 'reserve_id',
1523
        },
1523
        },
1524
        serial => {
1524
        serial => {
1525
            module   => 'Koha::Serials',
1525
            module   => 'Koha::Serials',
(-)a/C4/Reserves.pm (-4 / +5 lines)
Lines 970-975 sub ModReserve { Link Here
970
    my $suspend_until = $params->{'suspend_until'};
970
    my $suspend_until = $params->{'suspend_until'};
971
    my $borrowernumber = $params->{'borrowernumber'};
971
    my $borrowernumber = $params->{'borrowernumber'};
972
    my $biblionumber = $params->{'biblionumber'};
972
    my $biblionumber = $params->{'biblionumber'};
973
    my $cancellation_reason = $params->{'cancellation_reason'};
973
974
974
    return if $rank eq "W";
975
    return if $rank eq "W";
975
    return if $rank eq "n";
976
    return if $rank eq "n";
Lines 987-993 sub ModReserve { Link Here
987
    $hold ||= Koha::Holds->find($reserve_id);
988
    $hold ||= Koha::Holds->find($reserve_id);
988
989
989
    if ( $rank eq "del" ) {
990
    if ( $rank eq "del" ) {
990
        $hold->cancel;
991
        $hold->cancel({ cancellation_reason => $cancellation_reason });
991
    }
992
    }
992
    elsif ($rank =~ /^\d+/ and $rank > 0) {
993
    elsif ($rank =~ /^\d+/ and $rank > 0) {
993
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
994
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
Lines 1172-1178 sub ModReserveAffect { Link Here
1172
1173
1173
=head2 ModReserveCancelAll
1174
=head2 ModReserveCancelAll
1174
1175
1175
  ($messages,$nextreservinfo) = &ModReserveCancelAll($itemnumber,$borrowernumber);
1176
  ($messages,$nextreservinfo) = &ModReserveCancelAll($itemnumber,$borrowernumber,$reason);
1176
1177
1177
function to cancel reserv,check other reserves, and transfer document if it's necessary
1178
function to cancel reserv,check other reserves, and transfer document if it's necessary
1178
1179
Lines 1181-1192 function to cancel reserv,check other reserves, and transfer document if it's ne Link Here
1181
sub ModReserveCancelAll {
1182
sub ModReserveCancelAll {
1182
    my $messages;
1183
    my $messages;
1183
    my $nextreservinfo;
1184
    my $nextreservinfo;
1184
    my ( $itemnumber, $borrowernumber ) = @_;
1185
    my ( $itemnumber, $borrowernumber, $cancellation_reason ) = @_;
1185
1186
1186
    #step 1 : cancel the reservation
1187
    #step 1 : cancel the reservation
1187
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1188
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1188
    return unless $holds->count;
1189
    return unless $holds->count;
1189
    $holds->next->cancel;
1190
    $holds->next->cancel({ cancellation_reason => $cancellation_reason });
1190
1191
1191
    #step 2 launch the subroutine of the others reserves
1192
    #step 2 launch the subroutine of the others reserves
1192
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
1193
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
(-)a/Koha/Hold.pm (+33 lines)
Lines 24-31 use Carp; Link Here
24
use Data::Dumper qw(Dumper);
24
use Data::Dumper qw(Dumper);
25
25
26
use C4::Context qw(preference);
26
use C4::Context qw(preference);
27
use C4::Letters;
27
use C4::Log;
28
use C4::Log;
28
29
30
use Koha::AuthorisedValues;
29
use Koha::DateUtils qw(dt_from_string output_pref);
31
use Koha::DateUtils qw(dt_from_string output_pref);
30
use Koha::Patrons;
32
use Koha::Patrons;
31
use Koha::Biblios;
33
use Koha::Biblios;
Lines 356-361 sub cancel { Link Here
356
        sub {
358
        sub {
357
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
359
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
358
            $self->priority(0);
360
            $self->priority(0);
361
            $self->cancellation_reason( $params->{cancellation_reason} );
362
            $self->store();
363
364
            if ( $params->{cancellation_reason} ) {
365
                my $letter = C4::Letters::GetPreparedLetter(
366
                    module                 => 'reserves',
367
                    letter_code            => 'HOLD_CANCELLATION',
368
                    message_transport_type => 'email',
369
                    branchcode             => $self->borrower->branchcode,
370
                    lang                   => $self->borrower->lang,
371
                    tables => {
372
                        branches    => $self->borrower->branchcode,
373
                        borrowers   => $self->borrowernumber,
374
                        items       => $self->itemnumber,
375
                        biblio      => $self->biblionumber,
376
                        biblioitems => $self->biblionumber,
377
                        reserves    => $self->unblessed,
378
                    }
379
                );
380
381
                if ($letter) {
382
                    C4::Letters::EnqueueLetter(
383
                        {
384
                            letter                   => $letter,
385
                            borrowernumber         => $self->borrowernumber,
386
                            message_transport_type => 'email',
387
                        }
388
                    );
389
                }
390
            }
391
359
            $self->_move_to_old;
392
            $self->_move_to_old;
360
            $self->SUPER::delete(); # Do not add a DELETE log
393
            $self->SUPER::delete(); # Do not add a DELETE log
361
394
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/holds_table.inc (-3 / +5 lines)
Lines 1-4 Link Here
1
[% USE Koha %]
1
[% USE Koha %]
2
[% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
3
[% USE AuthorisedValues %]
2
<table>
4
<table>
3
    <tr>
5
    <tr>
4
        [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
6
        [% IF ( CAN_user_reserveforothers_modify_holds_priority ) %]
Lines 31-40 Link Here
31
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
33
                <input type="hidden" name="borrowernumber" value="[% hold.borrowernumber | html %]" />
32
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
34
                <input type="hidden" name="biblionumber" value="[% hold.biblionumber | html %]" />
33
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
35
                [% IF Koha.Preference('HoldsSplitQueue') == "nothing" && !hold.found %]
34
                    <select name="rank-request">
36
                    <select name="rank-request" class="rank-request" data-hold-id="[% hold.reserve_id %]">
35
                [% ELSE %]
37
                [% ELSE %]
36
                    <input type="hidden" name="rank-request" value="[% hold.priority | html %]">
38
                    <input type="hidden" name="rank-request" class="rank-request" value="[% hold.priority | html %]" data-hold-id="[% hold.reserve_id %]">
37
                    <select name="rank-request" disabled="disabled">
39
                    <select name="rank-request" class="rank-request" disabled="disabled" data-hold-id="[% hold.reserve_id %]">
38
                [% END %]
40
                [% END %]
39
                    [% IF ( hold.found ) %]
41
                    [% IF ( hold.found ) %]
40
                        [% IF ( hold.intransit ) %]
42
                        [% IF ( hold.intransit ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (+10 lines)
Lines 939-944 Link Here
939
939
940
                                    <fieldset class="action">
940
                                    <fieldset class="action">
941
                                        <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
941
                                        <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
942
943
                                        [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
944
                                        [% IF hold_cancellation %]
945
                                            <select name="cancellation-reason">
946
                                                <option value="">No reason given</option>
947
                                                [% FOREACH reason IN hold_cancellation %]
948
                                                    <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
949
                                                [% END %]
950
                                            </select>
951
                                        [% END %]
942
                                    </fieldset>
952
                                    </fieldset>
943
                                </form>
953
                                </form>
944
954
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+10 lines)
Lines 819-824 Link Here
819
819
820
                                        <fieldset class="action">
820
                                        <fieldset class="action">
821
                                            <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
821
                                            <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
822
823
                                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
824
                                            [% IF hold_cancellation %]
825
                                                <select name="cancellation-reason">
826
                                                    <option value="">No reason given</option>
827
                                                    [% FOREACH reason IN hold_cancellation %]
828
                                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
829
                                                    [% END %]
830
                                                </select>
831
                                            [% END %]
822
                                        </fieldset>
832
                                        </fieldset>
823
                                    </form>
833
                                    </form>
824
834
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+13 lines)
Lines 906-911 Link Here
906
                                [% END # /IF biblioloo.reserveloop %]
906
                                [% END # /IF biblioloo.reserveloop %]
907
                            [% END # FOREACH biblioloo %]
907
                            [% END # FOREACH biblioloo %]
908
908
909
                            <fieldset class="action">
910
                                [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
911
                                [% IF hold_cancellation %]
912
                                    <label for="cancellation-reason">Cancellation reason: </label>
913
                                    <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
914
                                        <option value="">No reason given</option>
915
                                        [% FOREACH reason IN hold_cancellation %]
916
                                            <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
917
                                        [% END %]
918
                                    </select>
919
                                [% END %]
920
                            </fieldset>
921
909
                            <fieldset class="action">
922
                            <fieldset class="action">
910
                                <input type="submit" name="submit" value="Update hold(s)" />
923
                                <input type="submit" name="submit" value="Update hold(s)" />
911
                            </fieldset>
924
                            </fieldset>
(-)a/reserve/modrequest.pl (-1 / +2 lines)
Lines 71-76 else { Link Here
71
    for (my $i=0;$i<$count;$i++){
71
    for (my $i=0;$i<$count;$i++){
72
        undef $itemnumber[$i] if !$itemnumber[$i];
72
        undef $itemnumber[$i] if !$itemnumber[$i];
73
        my $suspend_until = $query->param( "suspend_until_" . $reserve_id[$i] );
73
        my $suspend_until = $query->param( "suspend_until_" . $reserve_id[$i] );
74
        my $cancellation_reason = $query->param("cancellation-reason");
74
        my $params = {
75
        my $params = {
75
            rank => $rank[$i],
76
            rank => $rank[$i],
76
            reserve_id => $reserve_id[$i],
77
            reserve_id => $reserve_id[$i],
Lines 78-83 else { Link Here
78
            branchcode => $branch[$i],
79
            branchcode => $branch[$i],
79
            itemnumber => $itemnumber[$i],
80
            itemnumber => $itemnumber[$i],
80
            defined $suspend_until ? ( suspend_until => $suspend_until ) : (),
81
            defined $suspend_until ? ( suspend_until => $suspend_until ) : (),
82
            cancellation_reason => $cancellation_reason,
81
        };
83
        };
82
        if (C4::Context->preference('AllowHoldDateInFuture')) {
84
        if (C4::Context->preference('AllowHoldDateInFuture')) {
83
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
85
            $params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
84
- 

Return to bug 25534