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

(-)a/C4/Reserves.pm (-4 / +5 lines)
Lines 983-988 sub ModReserve { Link Here
983
    my $suspend_until = $params->{'suspend_until'};
983
    my $suspend_until = $params->{'suspend_until'};
984
    my $borrowernumber = $params->{'borrowernumber'};
984
    my $borrowernumber = $params->{'borrowernumber'};
985
    my $biblionumber = $params->{'biblionumber'};
985
    my $biblionumber = $params->{'biblionumber'};
986
    my $cancellation_reason = $params->{'cancellation_reason'};
986
987
987
    return if $rank eq "W";
988
    return if $rank eq "W";
988
    return if $rank eq "n";
989
    return if $rank eq "n";
Lines 1000-1006 sub ModReserve { Link Here
1000
    $hold ||= Koha::Holds->find($reserve_id);
1001
    $hold ||= Koha::Holds->find($reserve_id);
1001
1002
1002
    if ( $rank eq "del" ) {
1003
    if ( $rank eq "del" ) {
1003
        $hold->cancel;
1004
        $hold->cancel({ cancellation_reason => $cancellation_reason });
1004
    }
1005
    }
1005
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1006
    elsif ($rank =~ /^\d+/ and $rank > 0) {
1006
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
1007
        logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, Dumper($hold->unblessed) )
Lines 1185-1191 sub ModReserveAffect { Link Here
1185
1186
1186
=head2 ModReserveCancelAll
1187
=head2 ModReserveCancelAll
1187
1188
1188
  ($messages,$nextreservinfo) = &ModReserveCancelAll($itemnumber,$borrowernumber);
1189
  ($messages,$nextreservinfo) = &ModReserveCancelAll($itemnumber,$borrowernumber,$reason);
1189
1190
1190
function to cancel reserv,check other reserves, and transfer document if it's necessary
1191
function to cancel reserv,check other reserves, and transfer document if it's necessary
1191
1192
Lines 1194-1205 function to cancel reserv,check other reserves, and transfer document if it's ne Link Here
1194
sub ModReserveCancelAll {
1195
sub ModReserveCancelAll {
1195
    my $messages;
1196
    my $messages;
1196
    my $nextreservinfo;
1197
    my $nextreservinfo;
1197
    my ( $itemnumber, $borrowernumber ) = @_;
1198
    my ( $itemnumber, $borrowernumber, $cancellation_reason ) = @_;
1198
1199
1199
    #step 1 : cancel the reservation
1200
    #step 1 : cancel the reservation
1200
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1201
    my $holds = Koha::Holds->search({ itemnumber => $itemnumber, borrowernumber => $borrowernumber });
1201
    return unless $holds->count;
1202
    return unless $holds->count;
1202
    $holds->next->cancel;
1203
    $holds->next->cancel({ cancellation_reason => $cancellation_reason });
1203
1204
1204
    #step 2 launch the subroutine of the others reserves
1205
    #step 2 launch the subroutine of the others reserves
1205
    ( $messages, $nextreservinfo ) = GetOtherReserves($itemnumber);
1206
    ( $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 365-370 sub cancel { Link Here
365
        sub {
367
        sub {
366
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
368
            $self->cancellationdate( dt_from_string->strftime( '%Y-%m-%d %H:%M:%S' ) );
367
            $self->priority(0);
369
            $self->priority(0);
370
            $self->cancellation_reason( $params->{cancellation_reason} );
371
            $self->store();
372
373
            if ( $params->{cancellation_reason} ) {
374
                my $letter = C4::Letters::GetPreparedLetter(
375
                    module                 => 'reserves',
376
                    letter_code            => 'HOLD_CANCELLATION',
377
                    message_transport_type => 'email',
378
                    branchcode             => $self->borrower->branchcode,
379
                    lang                   => $self->borrower->lang,
380
                    tables => {
381
                        branches    => $self->borrower->branchcode,
382
                        borrowers   => $self->borrowernumber,
383
                        items       => $self->itemnumber,
384
                        biblio      => $self->biblionumber,
385
                        biblioitems => $self->biblionumber,
386
                        reserves    => $self->unblessed,
387
                    }
388
                );
389
390
                if ($letter) {
391
                    C4::Letters::EnqueueLetter(
392
                        {
393
                            letter                   => $letter,
394
                            borrowernumber         => $self->borrowernumber,
395
                            message_transport_type => 'email',
396
                        }
397
                    );
398
                }
399
            }
400
368
            $self->_move_to_old;
401
            $self->_move_to_old;
369
            $self->SUPER::delete(); # Do not add a DELETE log
402
            $self->SUPER::delete(); # Do not add a DELETE log
370
403
(-)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 945-950 Link Here
945
945
946
                                    <fieldset class="action">
946
                                    <fieldset class="action">
947
                                        <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
947
                                        <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
948
949
                                        [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
950
                                        [% IF hold_cancellation %]
951
                                            <select name="cancellation-reason">
952
                                                <option value="">No reason given</option>
953
                                                [% FOREACH reason IN hold_cancellation %]
954
                                                    <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
955
                                                [% END %]
956
                                            </select>
957
                                        [% END %]
948
                                    </fieldset>
958
                                    </fieldset>
949
                                </form>
959
                                </form>
950
960
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (+10 lines)
Lines 846-851 Link Here
846
846
847
                                        <fieldset class="action">
847
                                        <fieldset class="action">
848
                                            <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
848
                                            <input type="submit" class="cancel" name="submit" value="Cancel marked holds" />
849
850
                                            [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
851
                                            [% IF hold_cancellation %]
852
                                                <select name="cancellation-reason">
853
                                                    <option value="">No reason given</option>
854
                                                    [% FOREACH reason IN hold_cancellation %]
855
                                                        <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
856
                                                    [% END %]
857
                                                </select>
858
                                            [% END %]
849
                                        </fieldset>
859
                                        </fieldset>
850
                                    </form>
860
                                    </form>
851
861
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt (+17 lines)
Lines 909-914 Link Here
909
909
910
                            [% END # /IF biblioloo.reserveloop %]
910
                            [% END # /IF biblioloo.reserveloop %]
911
                        [% END # FOREACH biblioloo %]
911
                        [% END # FOREACH biblioloo %]
912
                            <fieldset class="action">
913
                                [% SET hold_cancellation = AuthorisedValues.GetAuthValueDropbox('HOLD_CANCELLATION') %]
914
                                [% IF hold_cancellation %]
915
                                    <label for="cancellation-reason">Cancellation reason: </label>
916
                                    <select class="cancellation-reason" name="cancellation-reason" id="cancellation-reason">
917
                                        <option value="">No reason given</option>
918
                                        [% FOREACH reason IN hold_cancellation %]
919
                                            <option value="[% reason.authorised_value | html %]">[% reason.lib | html %]</option>
920
                                        [% END %]
921
                                    </select>
922
                                [% END %]
923
                            </fieldset>
924
925
                            <fieldset class="action">
926
                                <input type="submit" name="submit" value="Update hold(s)" />
927
                            </fieldset>
928
                        </fieldset> <!-- /.rows -->
912
                    </form> <!-- /name=TTime -->
929
                    </form> <!-- /name=TTime -->
913
                [% END # IF reserveloop %]
930
                [% END # IF reserveloop %]
914
            [% END # UNLESS patron %]
931
            [% END # UNLESS patron %]
(-)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