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

(-)a/Koha/IllbatchStatus.pm (-2 / +2 lines)
Lines 124-131 sub delete_and_log { Link Here
124
    }
124
    }
125
125
126
    # Update all batches that use this status to have status UNKNOWN
126
    # Update all batches that use this status to have status UNKNOWN
127
    my $affected = Koha::Illbatches->search( { statuscode => $self->code } );
127
    my $affected = Koha::Illbatches->search( { status_code => $self->code } );
128
    $affected->update( { statuscode => 'UNKNOWN' } );
128
    $affected->update( { status_code => 'UNKNOWN' } );
129
129
130
    my $logger = Koha::Illrequest::Logger->new;
130
    my $logger = Koha::Illrequest::Logger->new;
131
131
(-)a/Koha/Illrequest.pm (-4 / +5 lines)
Lines 1909-1914 sub TO_JSON { Link Here
1909
sub to_api_mapping {
1909
sub to_api_mapping {
1910
    return {
1910
    return {
1911
        accessurl         => 'access_url',
1911
        accessurl         => 'access_url',
1912
        batch_id          => 'ill_batch_id',
1912
        backend           => 'ill_backend_id',
1913
        backend           => 'ill_backend_id',
1913
        borrowernumber    => 'patron_id',
1914
        borrowernumber    => 'patron_id',
1914
        branchcode        => 'library_id',
1915
        branchcode        => 'library_id',
Lines 1997-2008 sub strings_map { Link Here
1997
    my $batch = $self->batch;
1998
    my $batch = $self->batch;
1998
    if ($batch) {
1999
    if ($batch) {
1999
        $strings->{"batch"} = {
2000
        $strings->{"batch"} = {
2000
            id => $batch->id,
2001
            ill_batch_id => $batch->ill_batch_id,
2001
            name => $batch->name,
2002
            name => $batch->name,
2002
            backend => $batch->backend,
2003
            backend => $batch->backend,
2003
            borrowernumber => $batch->borrowernumber,
2004
            patron_id => $batch->patron_id,
2004
            branchcode => $batch->branchcode,
2005
            library_id => $batch->library_id,
2005
            statuscode => $batch->statuscode
2006
            status_code => $batch->status_code
2006
        };
2007
        };
2007
    }
2008
    }
2008
2009
(-)a/api/v1/swagger/definitions/ill_request.yaml (-1 / +1 lines)
Lines 9-15 properties: Link Here
9
      - integer
9
      - integer
10
      - "null"
10
      - "null"
11
    description: Internal bibliographic record identifier
11
    description: Internal bibliographic record identifier
12
  batch_id:
12
  ill_batch_id:
13
    type:
13
    type:
14
      - integer
14
      - integer
15
      - "null"
15
      - "null"
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-batch-modal.inc (-3 / +3 lines)
Lines 28-36 Link Here
28
                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
28
                                        [% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
29
                                    </select>
29
                                    </select>
30
                                </li>
30
                                </li>
31
                                <li id="batch_statuscode" style="display:none">
31
                                <li id="batch_status_code" style="display:none">
32
                                    <label class="required" for="statuscode">Status:</label>
32
                                    <label class="required" for="status_code">Status:</label>
33
                                    <select id="statuscode" name="statuscode"></select>
33
                                    <select id="status_code" name="status_code"></select>
34
                                </li>
34
                                </li>
35
                            </ol>
35
                            </ol>
36
                        </fieldset>
36
                        </fieldset>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt (-1 / +1 lines)
Lines 669-675 Link Here
669
                                [% IF request.batch > 0 %]
669
                                [% IF request.batch > 0 %]
670
                                <li class="batch">
670
                                <li class="batch">
671
                                    <span class="label batch">Batch:</span>
671
                                    <span class="label batch">Batch:</span>
672
                                    <a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=[% request.batch.id | uri %]">
672
                                    <a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=[% request.batch.ill_batch_id | uri %]">
673
                                    [% request.batch.name | html %]
673
                                    [% request.batch.name | html %]
674
                                    </a>
674
                                    </a>
675
                                </li>
675
                                </li>
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-batch-modal.js (-14 / +14 lines)
Lines 25-31 Link Here
25
    var createProgressBar = document.getElementById("processed_progress_bar");
25
    var createProgressBar = document.getElementById("processed_progress_bar");
26
    var identifierTable = document.getElementById('identifier-table');
26
    var identifierTable = document.getElementById('identifier-table');
27
    var createRequestsButton = document.getElementById('create-requests-button');
27
    var createRequestsButton = document.getElementById('create-requests-button');
28
    var statusesSelect = document.getElementById('statuscode');
28
    var statusesSelect = document.getElementById('status_code');
29
    var cancelButton = document.getElementById('lhs').querySelector('button');
29
    var cancelButton = document.getElementById('lhs').querySelector('button');
30
    var cancelButtonOriginalText = cancelButton.innerHTML;
30
    var cancelButtonOriginalText = cancelButton.innerHTML;
31
31
Lines 49-55 Link Here
49
        backend: null,
49
        backend: null,
50
        cardnumber: '',
50
        cardnumber: '',
51
        branchcode: '',
51
        branchcode: '',
52
        statuscode: 'NEW'
52
        status_code: 'NEW'
53
    };
53
    };
54
54
55
    // The object that holds the batch we're working with
55
    // The object that holds the batch we're working with
Lines 307-313 Link Here
307
        }
307
        }
308
308
309
        var payload = {
309
        var payload = {
310
            batch_id: batchId,
310
            ill_batch_id: batchId,
311
            ill_backend_id: batch.data.backend,
311
            ill_backend_id: batch.data.backend,
312
            patron_id: batch.data.patron.patron_id,
312
            patron_id: batch.data.patron.patron_id,
313
            library_id: batch.data.library_id,
313
            library_id: batch.data.library_id,
Lines 378-384 Link Here
378
            var option = document.createElement('option')
378
            var option = document.createElement('option')
379
            option.value = status.code;
379
            option.value = status.code;
380
            option.text = status.name;
380
            option.text = status.name;
381
            if (batch.data.batch_id && batch.data.statuscode === status.code) {
381
            if (batch.data.ill_batch_id && batch.data.status_code === status.code) {
382
                option.selected = true;
382
                option.selected = true;
383
            }
383
            }
384
            statusesSelect.add(option);
384
            statusesSelect.add(option);
Lines 479-485 Link Here
479
        updateBatch()
479
        updateBatch()
480
            .then(function () {
480
            .then(function () {
481
                $('#ill-batch-modal').modal({ show: false });
481
                $('#ill-batch-modal').modal({ show: false });
482
                location.href = '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + batch.data.batch_id;
482
                location.href = '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + batch.data.ill_batch_id;
483
            });
483
            });
484
    };
484
    };
485
485
Lines 509-520 Link Here
509
            })
509
            })
510
            .then(function (jsoned) {
510
            .then(function (jsoned) {
511
                batch.data = {
511
                batch.data = {
512
                    batch_id: jsoned.batch_id,
512
                    ill_batch_id: jsoned.ill_batch_id,
513
                    name: jsoned.name,
513
                    name: jsoned.name,
514
                    backend: jsoned.backend,
514
                    backend: jsoned.backend,
515
                    cardnumber: jsoned.cardnumber,
515
                    cardnumber: jsoned.cardnumber,
516
                    library_id: jsoned.library_id,
516
                    library_id: jsoned.library_id,
517
                    statuscode: jsoned.statuscode
517
                    status_code: jsoned.status_code
518
                }
518
                }
519
                return jsoned;
519
                return jsoned;
520
            })
520
            })
Lines 540-546 Link Here
540
                backend: backend,
540
                backend: backend,
541
                cardnumber: cardnumberInput.value,
541
                cardnumber: cardnumberInput.value,
542
                library_id: selectedBranchcode,
542
                library_id: selectedBranchcode,
543
                statuscode: selectedStatuscode
543
                status_code: selectedStatuscode
544
            })
544
            })
545
        })
545
        })
546
            .then(function (response) {
546
            .then(function (response) {
Lines 550-563 Link Here
550
                return Promise.reject(response);
550
                return Promise.reject(response);
551
            })
551
            })
552
            .then(function (body) {
552
            .then(function (body) {
553
                batchId = body.batch_id;
553
                batchId = body.ill_batch_id;
554
                batch.data = {
554
                batch.data = {
555
                    batch_id: body.batch_id,
555
                    ill_batch_id: body.ill_batch_id,
556
                    name: body.name,
556
                    name: body.name,
557
                    backend: body.backend,
557
                    backend: body.backend,
558
                    cardnumber: body.patron.cardnumber,
558
                    cardnumber: body.patron.cardnumber,
559
                    library_id: body.library_id,
559
                    library_id: body.library_id,
560
                    statuscode: body.statuscode,
560
                    status_code: body.status_code,
561
                    patron: body.patron,
561
                    patron: body.patron,
562
                    status: body.status
562
                    status: body.status
563
                };
563
                };
Lines 578-584 Link Here
578
        var selectedBranchcode = branchcodeSelect.selectedOptions[0].value;
578
        var selectedBranchcode = branchcodeSelect.selectedOptions[0].value;
579
        var selectedStatuscode = statusesSelect.selectedOptions[0].value;
579
        var selectedStatuscode = statusesSelect.selectedOptions[0].value;
580
580
581
        return doBatchApiRequest('/' + batch.data.batch_id, {
581
        return doBatchApiRequest('/' + batch.data.ill_batch_id, {
582
            method: 'PUT',
582
            method: 'PUT',
583
            headers: {
583
            headers: {
584
                'Content-type': 'application/json'
584
                'Content-type': 'application/json'
Lines 588-594 Link Here
588
                backend: batch.data.backend,
588
                backend: batch.data.backend,
589
                cardnumber: batch.data.patron.cardnumber,
589
                cardnumber: batch.data.patron.cardnumber,
590
                library_id: selectedBranchcode,
590
                library_id: selectedBranchcode,
591
                statuscode: selectedStatuscode
591
                status_code: selectedStatuscode
592
            })
592
            })
593
        })
593
        })
594
            .catch(function () {
594
            .catch(function () {
Lines 1045-1051 Link Here
1045
    }
1045
    }
1046
1046
1047
    function manageBatchItemsDisplay() {
1047
    function manageBatchItemsDisplay() {
1048
        batchItemsDisplay.style.display = batch.data.batch_id ? 'block' : 'none'
1048
        batchItemsDisplay.style.display = batch.data.ill_batch_id ? 'block' : 'none'
1049
    };
1049
    };
1050
1050
1051
    function updateBatchInputs() {
1051
    function updateBatchInputs() {
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-batch-table.js (-7 / +7 lines)
Lines 50-56 Link Here
50
            data: batchesProxy.data,
50
            data: batchesProxy.data,
51
            columns: [
51
            columns: [
52
                {
52
                {
53
                    data: 'batch_id',
53
                    data: 'ill_batch_id',
54
                    width: '10%'
54
                    width: '10%'
55
                },
55
                },
56
                {
56
                {
Lines 92-104 Link Here
92
92
93
    // A render function for branch name
93
    // A render function for branch name
94
    var createBranch = function (x, y, data) {
94
    var createBranch = function (x, y, data) {
95
        return data._strings.branchname;
95
        return data._strings.library_id.str;
96
    };
96
    };
97
97
98
    // A render function for batch name
98
    // A render function for batch name
99
    var createName = function (x, y, data) {
99
    var createName = function (x, y, data) {
100
        var a = document.createElement('a');
100
        var a = document.createElement('a');
101
        a.setAttribute('href', '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + data.batch_id);
101
        a.setAttribute('href', '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + data.ill_batch_id);
102
        a.setAttribute('title', data.name);
102
        a.setAttribute('title', data.name);
103
        a.textContent = data.name;
103
        a.textContent = data.name;
104
        return a.outerHTML;
104
        return a.outerHTML;
Lines 106-112 Link Here
106
106
107
    // A render function for batch status
107
    // A render function for batch status
108
    var createStatus = function (x, y, data) {
108
    var createStatus = function (x, y, data) {
109
        return data._strings.status.name;
109
        return data._strings.status_code.str;
110
    };
110
    };
111
111
112
    // A render function for our patron link
112
    // A render function for our patron link
Lines 122-134 Link Here
122
        var editButton = document.createElement('button');
122
        var editButton = document.createElement('button');
123
        editButton.setAttribute('type', 'button');
123
        editButton.setAttribute('type', 'button');
124
        editButton.setAttribute('class', 'editButton btn btn-xs btn-default');
124
        editButton.setAttribute('class', 'editButton btn btn-xs btn-default');
125
        editButton.setAttribute('data-batch-id', row.batch_id);
125
        editButton.setAttribute('data-batch-id', row.ill_batch_id);
126
        editButton.appendChild(document.createTextNode(ill_batch_edit));
126
        editButton.appendChild(document.createTextNode(ill_batch_edit));
127
127
128
        var deleteButton = document.createElement('button');
128
        var deleteButton = document.createElement('button');
129
        deleteButton.setAttribute('type', 'button');
129
        deleteButton.setAttribute('type', 'button');
130
        deleteButton.setAttribute('class', 'deleteButton btn btn-xs btn-danger');
130
        deleteButton.setAttribute('class', 'deleteButton btn btn-xs btn-danger');
131
        deleteButton.setAttribute('data-batch-id', row.batch_id);
131
        deleteButton.setAttribute('data-batch-id', row.ill_batch_id);
132
        deleteButton.appendChild(document.createTextNode(ill_batch_delete));
132
        deleteButton.appendChild(document.createTextNode(ill_batch_delete));
133
133
134
        div.appendChild(editButton);
134
        div.appendChild(editButton);
Lines 200-206 Link Here
200
    // Remove a batch from our proxy data
200
    // Remove a batch from our proxy data
201
    var removeBatch = function(id) {
201
    var removeBatch = function(id) {
202
        batchesProxy.data = batchesProxy.data.filter(function (batch) {
202
        batchesProxy.data = batchesProxy.data.filter(function (batch) {
203
            return batch.batch_id != id;
203
            return batch.ill_batch_id != id;
204
        });
204
        });
205
    };
205
    };
206
206
(-)a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js (-1 / +1 lines)
Lines 220-226 $(document).ready(function() { Link Here
220
                "render": function(data, type, row, meta) {
220
                "render": function(data, type, row, meta) {
221
                    return row.batch ?
221
                    return row.batch ?
222
                        '<a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=' +
222
                        '<a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=' +
223
                        row.batch_id +
223
                        row.ill_batch_id +
224
                        '">' +
224
                        '">' +
225
                        row.batch.name +
225
                        row.batch.name +
226
                        '</a>'
226
                        '</a>'
(-)a/t/db_dependent/IllbatchStatuses.t (-4 / +3 lines)
Lines 197-203 my $batch = Koha::Illbatch->new( Link Here
197
        patron_id  => $patron->borrowernumber,
197
        patron_id  => $patron->borrowernumber,
198
        library_id => $library->branchcode,
198
        library_id => $library->branchcode,
199
        backend    => "TEST",
199
        backend    => "TEST",
200
        statuscode => $status5->code
200
        status_code => $status5->code
201
    }
201
    }
202
);
202
);
203
$batch->create_and_log;
203
$batch->create_and_log;
Lines 205-211 $batch->create_and_log; Link Here
205
# Delete the batch status and ensure the batch's status has been changed
205
# Delete the batch status and ensure the batch's status has been changed
206
# to UNKNOWN
206
# to UNKNOWN
207
$status5->delete_and_log;
207
$status5->delete_and_log;
208
my $updated_code = Koha::Illbatches->find( { statuscode => "UNKNOWN" } );
208
my $updated_code = Koha::Illbatches->find( { status_code => "UNKNOWN" } );
209
is( $updated_code->statuscode, "UNKNOWN", "batches attached to deleted status have status changed to UNKNOWN" );
209
is( $updated_code->status_code, "UNKNOWN", "batches attached to deleted status have status changed to UNKNOWN" );
210
210
211
$schema->storage->txn_rollback;
211
$schema->storage->txn_rollback;
212
- 

Return to bug 30719