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

(-)a/Koha/Illrequest.pm (+2 lines)
Lines 25-30 use File::Basename qw( basename ); Link Here
25
use Encode qw( encode );
25
use Encode qw( encode );
26
use Mail::Sendmail;
26
use Mail::Sendmail;
27
use Try::Tiny;
27
use Try::Tiny;
28
use DateTime;
28
29
29
use Koha::Database;
30
use Koha::Database;
30
use Koha::Email;
31
use Koha::Email;
Lines 659-664 Mark a request as completed (status = COMP). Link Here
659
sub mark_completed {
660
sub mark_completed {
660
    my ( $self ) = @_;
661
    my ( $self ) = @_;
661
    $self->status('COMP')->store;
662
    $self->status('COMP')->store;
663
    $self->completed(DateTime->now)->store;
662
    return {
664
    return {
663
        error   => 0,
665
        error   => 0,
664
        status  => '',
666
        status  => '',
(-)a/Koha/REST/V1/Illrequests.pm (-1 / +1 lines)
Lines 43-49 sub list { Link Here
43
43
44
    my $args = $c->req->params->to_hash // {};
44
    my $args = $c->req->params->to_hash // {};
45
    my $output = [];
45
    my $output = [];
46
    my @format_dates = ( 'placed', 'updated' );
46
    my @format_dates = ( 'placed', 'updated', 'completed' );
47
47
48
    # Create a hash where all keys are embedded values
48
    # Create a hash where all keys are embedded values
49
    # Enables easy checking
49
    # Enables easy checking
(-)a/admin/columns_settings.yml (-2 / +7 lines)
Lines 360-366 modules: Link Here
360
        -
360
        -
361
          columnname: metadata_title
361
          columnname: metadata_title
362
        -
362
        -
363
          columnname: metadata_item_part_title
363
          columnname: metadata_article_title
364
        -
364
        -
365
          columnname: metadata_issue
365
          columnname: metadata_issue
366
        -
366
        -
Lines 368-374 modules: Link Here
368
        -
368
        -
369
          columnname: metadata_year
369
          columnname: metadata_year
370
        -
370
        -
371
          columnname: metadata_item_part_pages
371
          columnname: metadata_pages
372
        -
372
        -
373
          columnname: metadata_type
373
          columnname: metadata_type
374
        -
374
        -
Lines 399-404 modules: Link Here
399
          columnname: replied
399
          columnname: replied
400
        -
400
        -
401
          columnname: completed
401
          columnname: completed
402
          cannot_be_toggled: 1
403
          cannot_be_modified: 1
404
          is_hidden: 1
405
        -
406
          columnname: completed_formatted
402
        -
407
        -
403
          columnname: accessurl
408
          columnname: accessurl
404
        -
409
        -
(-)a/api/v1/swagger/paths/illrequests.json (+6 lines)
Lines 51-56 Link Here
51
                "required": false,
51
                "required": false,
52
                "type": "string"
52
                "type": "string"
53
            }, {
53
            }, {
54
                "name": "completed_formatted",
55
                "in": "query",
56
                "description": "The date the request was considered complete formatted",
57
                "required": false,
58
                "type": "string"
59
            }, {
54
                "name": "status",
60
                "name": "status",
55
                "in": "query",
61
                "in": "query",
56
                "description": "A full status string e.g. REQREV",
62
                "description": "A full status string e.g. REQREV",
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-3 / +20 lines)
Lines 527-533 Link Here
527
                                    <th scope="col" class="updated">&nbsp;</th>
527
                                    <th scope="col" class="updated">&nbsp;</th>
528
                                    <th scope="col" class="updated_formatted">Updated on</th>
528
                                    <th scope="col" class="updated_formatted">Updated on</th>
529
                                    <th scope="col">Replied</th>
529
                                    <th scope="col">Replied</th>
530
                                    <th scope="col">Completed on</th>
530
                                    <th scope="col" class="completed">&nbsp;</th>
531
                                    <th scope="col" class="completed_formatted">Completed on</th>
531
                                    <th scope="col">Access URL</th>
532
                                    <th scope="col">Access URL</th>
532
                                    <th scope="col">Cost</th>
533
                                    <th scope="col">Cost</th>
533
                                    <th scope="col">Comments</th>
534
                                    <th scope="col">Comments</th>
Lines 749-754 Link Here
749
                    '</a>' : '';
750
                    '</a>' : '';
750
            };
751
            };
751
752
753
            // Our 'render' function for title
754
            var createTitle = function(data, type, row) {
755
                return (
756
                    row.hasOwnProperty('metadata_container_title') &&
757
                    row.metadata_container_title
758
                ) ? row.metadata_container_title : row.metadata_title;
759
            };
760
752
            // Render function for request ID
761
            // Render function for request ID
753
            var createRequestId = function(data, type, row) {
762
            var createRequestId = function(data, type, row) {
754
                return row.id_prefix + row.illrequest_id;
763
                return row.id_prefix + row.illrequest_id;
Lines 834-839 Link Here
834
                    func: createBiblioLink,
843
                    func: createBiblioLink,
835
                    skipSanitize: true
844
                    skipSanitize: true
836
                },
845
                },
846
                metadata_title: {
847
                    func: createTitle
848
                },
837
                metadata_Type: {
849
                metadata_Type: {
838
                    func: createType
850
                    func: createType
839
                },
851
                },
Lines 905-911 Link Here
905
            // Get our data from the API and process it prior to passing
917
            // Get our data from the API and process it prior to passing
906
            // it to datatables
918
            // it to datatables
907
            var ajax = $.ajax(
919
            var ajax = $.ajax(
908
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias'
920
                '/api/v1/illrequests?embed=metadata,patron,capabilities,library,status_alias,comments'
909
                ).done(function() {
921
                ).done(function() {
910
                    var data = JSON.parse(ajax.responseText);
922
                    var data = JSON.parse(ajax.responseText);
911
                    // Make a copy, we'll be removing columns next and need
923
                    // Make a copy, we'll be removing columns next and need
Lines 960-965 Link Here
960
                        });
972
                        });
961
                        colData.push(colObj);
973
                        colData.push(colObj);
962
                    });
974
                    });
975
                    console.log(colData);
963
976
964
                    // Initialise the datatable
977
                    // Initialise the datatable
965
                    table = KohaTable("ill-requests", {
978
                    table = KohaTable("ill-requests", {
Lines 978-983 Link Here
978
                              // unformatted column
991
                              // unformatted column
979
                              'aTargets': [ 'updated_formatted'],
992
                              'aTargets': [ 'updated_formatted'],
980
                              'iDataSort': 16
993
                              'iDataSort': 16
994
                            },
995
                            { // When sorting 'completed', we want to use the
996
                              // unformatted column
997
                              'aTargets': [ 'completed_formatted'],
998
                              'iDataSort': 19
981
                            }
999
                            }
982
                        ],
1000
                        ],
983
                        'aaSorting': [[ 16, 'desc' ]], // Default sort, updated descending
1001
                        'aaSorting': [[ 16, 'desc' ]], // Default sort, updated descending
984
- 

Return to bug 21063