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

(-)a/Koha/ILL/Request.pm (-11 / +32 lines)
Lines 910-926 Mark a request as completed (status = COMP). Link Here
910
=cut
910
=cut
911
911
912
sub mark_completed {
912
sub mark_completed {
913
    my ($self) = @_;
913
    my ( $self, $params ) = @_;
914
    $self->status('COMP')->store;
914
915
    $self->completed( dt_from_string() )->store;
915
    my $stage = $params->{stage};
916
    return {
916
917
        error   => 0,
917
    my $status_aliases_exist = Koha::AuthorisedValues->search( { category => 'ILL_STATUS_ALIAS' } )->count;
918
        status  => '',
918
919
        message => '',
919
    if ( ( !$stage || $stage eq 'init' ) && $status_aliases_exist ) {
920
        method  => 'mark_completed',
920
        return {
921
        stage   => 'commit',
921
            method => 'mark_completed',
922
        next    => 'illview',
922
        };
923
    };
923
    } elsif ( !$stage || $stage eq 'complete' ) {
924
925
        $self->status('COMP');
926
        $self->status_alias( $params->{status_alias} ) if $params->{status_alias};
927
        $self->completed( dt_from_string() );
928
        $self->store;
929
        return {
930
            stage => 'commit',
931
            next  => 'illview',
932
        };
933
    } else {
934
935
        # Invalid stage, return error.
936
        return {
937
            error   => 1,
938
            status  => 'unknown_stage',
939
            message => '',
940
            method  => 'confirm',
941
            stage   => $params->{stage},
942
            value   => {},
943
        };
944
    }
924
}
945
}
925
946
926
=head2 backend_illview
947
=head2 backend_illview
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +25 lines)
Lines 45-50 Link Here
45
                <span>Manage request [% request.id_prefix _ request.illrequest_id | html %]</span>
45
                <span>Manage request [% request.id_prefix _ request.illrequest_id | html %]</span>
46
            [% ELSIF op == 'confirm' %]
46
            [% ELSIF op == 'confirm' %]
47
                <span>Confirm request [% request.id_prefix _ request.illrequest_id | html %]</span>
47
                <span>Confirm request [% request.id_prefix _ request.illrequest_id | html %]</span>
48
            [% ELSIF op == 'mark_completed' %]
49
                <span>Complete request request [% request.id_prefix _ request.illrequest_id | html %]</span>
48
            [% ELSIF op == 'delete_confirm' %]
50
            [% ELSIF op == 'delete_confirm' %]
49
                <span>Delete request [% request.id_prefix _ request.illrequest_id | html %]</span>
51
                <span>Delete request [% request.id_prefix _ request.illrequest_id | html %]</span>
50
            [% ELSIF op == 'generic_confirm' %]
52
            [% ELSIF op == 'generic_confirm' %]
Lines 115-120 Link Here
115
            [% ELSIF op == 'confirm' %]
117
            [% ELSIF op == 'confirm' %]
116
                <h1>Confirm ILL request</h1>
118
                <h1>Confirm ILL request</h1>
117
                [% PROCESS $whole.template %]
119
                [% PROCESS $whole.template %]
120
            [% ELSIF op == 'mark_completed' %]
121
                <h1>Complete ILL request</h1>
122
                <p>Proceeding with this action will set this request to 'Completed'.</p>
123
                <p>You can select a status alias from the available options:</p>
124
                <p>
125
                    [% base_url = "/cgi-bin/koha/ill/ill-requests.pl" %]
126
                    [% proceed_url = base_url _ "?method=mark_completed&stage=complete" _ "&illrequest_id=" _ request.illrequest_id %]
127
                    <form action="[% proceed_url | url %]" method="get">
128
                        <select name="status_alias">
129
                            <option value="" selected></option>
130
                            [% FOREACH alias IN AuthorisedValues.Get('ILL_STATUS_ALIAS') %]
131
                                <option value="[% alias.authorised_value | html %]" > [% alias.lib | html %] </option>
132
                            [% END %]
133
                        </select>
134
                        <input type="hidden" name="method" value="mark_completed">
135
                        <input type="hidden" name="stage" value="complete">
136
                        <input type="hidden" name="illrequest_id" value="[% request.illrequest_id %]">
137
                        <fieldset class="action">
138
                            <button type="submit" class="btn btn-sm btn-primary">Complete request</button>
139
                            <a class="btn btn-sm btn-default cancel" href="[% base_url | url %]">Cancel</a>
140
                        </fieldset>
141
                    </form>
142
                </p>
118
            [% ELSIF op == 'cud-cancel' and !whole.error %]
143
            [% ELSIF op == 'cud-cancel' and !whole.error %]
119
                <h1>Cancel a confirmed request</h1>
144
                <h1>Cancel a confirmed request</h1>
120
                [% PROCESS $whole.template %]
145
                [% PROCESS $whole.template %]
121
- 

Return to bug 39917