Bug 30719: (QA follow-up) Updating remaining naming

Update statuscode -> status_code on the js files
Update remaining batch_id -> ill_batch_id
Update batch object in Illrequest.pm strings_map

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Pedro Amorim 2023-10-11 08:38:57 +00:00 committed by Tomas Cohen Arazi
parent a71140fe60
commit e21c19e170
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
9 changed files with 37 additions and 36 deletions

View file

@ -124,8 +124,8 @@ sub delete_and_log {
}
# Update all batches that use this status to have status UNKNOWN
my $affected = Koha::Illbatches->search( { statuscode => $self->code } );
$affected->update( { statuscode => 'UNKNOWN' } );
my $affected = Koha::Illbatches->search( { status_code => $self->code } );
$affected->update( { status_code => 'UNKNOWN' } );
my $logger = Koha::Illrequest::Logger->new;

View file

@ -1909,6 +1909,7 @@ sub TO_JSON {
sub to_api_mapping {
return {
accessurl => 'access_url',
batch_id => 'ill_batch_id',
backend => 'ill_backend_id',
borrowernumber => 'patron_id',
branchcode => 'library_id',
@ -1997,12 +1998,12 @@ sub strings_map {
my $batch = $self->batch;
if ($batch) {
$strings->{"batch"} = {
id => $batch->id,
ill_batch_id => $batch->ill_batch_id,
name => $batch->name,
backend => $batch->backend,
borrowernumber => $batch->borrowernumber,
branchcode => $batch->branchcode,
statuscode => $batch->statuscode
patron_id => $batch->patron_id,
library_id => $batch->library_id,
status_code => $batch->status_code
};
}

View file

@ -9,7 +9,7 @@ properties:
- integer
- "null"
description: Internal bibliographic record identifier
batch_id:
ill_batch_id:
type:
- integer
- "null"

View file

@ -28,9 +28,9 @@
[% PROCESS options_for_libraries libraries => Branches.all( selected => branchcode ) %]
</select>
</li>
<li id="batch_statuscode" style="display:none">
<label class="required" for="statuscode">Status:</label>
<select id="statuscode" name="statuscode"></select>
<li id="batch_status_code" style="display:none">
<label class="required" for="status_code">Status:</label>
<select id="status_code" name="status_code"></select>
</li>
</ol>
</fieldset>

View file

@ -669,7 +669,7 @@
[% IF request.batch > 0 %]
<li class="batch">
<span class="label batch">Batch:</span>
<a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=[% request.batch.id | uri %]">
<a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=[% request.batch.ill_batch_id | uri %]">
[% request.batch.name | html %]
</a>
</li>

View file

@ -25,7 +25,7 @@
var createProgressBar = document.getElementById("processed_progress_bar");
var identifierTable = document.getElementById('identifier-table');
var createRequestsButton = document.getElementById('create-requests-button');
var statusesSelect = document.getElementById('statuscode');
var statusesSelect = document.getElementById('status_code');
var cancelButton = document.getElementById('lhs').querySelector('button');
var cancelButtonOriginalText = cancelButton.innerHTML;
@ -49,7 +49,7 @@
backend: null,
cardnumber: '',
branchcode: '',
statuscode: 'NEW'
status_code: 'NEW'
};
// The object that holds the batch we're working with
@ -307,7 +307,7 @@
}
var payload = {
batch_id: batchId,
ill_batch_id: batchId,
ill_backend_id: batch.data.backend,
patron_id: batch.data.patron.patron_id,
library_id: batch.data.library_id,
@ -378,7 +378,7 @@
var option = document.createElement('option')
option.value = status.code;
option.text = status.name;
if (batch.data.batch_id && batch.data.statuscode === status.code) {
if (batch.data.ill_batch_id && batch.data.status_code === status.code) {
option.selected = true;
}
statusesSelect.add(option);
@ -479,7 +479,7 @@
updateBatch()
.then(function () {
$('#ill-batch-modal').modal({ show: false });
location.href = '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + batch.data.batch_id;
location.href = '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + batch.data.ill_batch_id;
});
};
@ -509,12 +509,12 @@
})
.then(function (jsoned) {
batch.data = {
batch_id: jsoned.batch_id,
ill_batch_id: jsoned.ill_batch_id,
name: jsoned.name,
backend: jsoned.backend,
cardnumber: jsoned.cardnumber,
library_id: jsoned.library_id,
statuscode: jsoned.statuscode
status_code: jsoned.status_code
}
return jsoned;
})
@ -540,7 +540,7 @@
backend: backend,
cardnumber: cardnumberInput.value,
library_id: selectedBranchcode,
statuscode: selectedStatuscode
status_code: selectedStatuscode
})
})
.then(function (response) {
@ -550,14 +550,14 @@
return Promise.reject(response);
})
.then(function (body) {
batchId = body.batch_id;
batchId = body.ill_batch_id;
batch.data = {
batch_id: body.batch_id,
ill_batch_id: body.ill_batch_id,
name: body.name,
backend: body.backend,
cardnumber: body.patron.cardnumber,
library_id: body.library_id,
statuscode: body.statuscode,
status_code: body.status_code,
patron: body.patron,
status: body.status
};
@ -578,7 +578,7 @@
var selectedBranchcode = branchcodeSelect.selectedOptions[0].value;
var selectedStatuscode = statusesSelect.selectedOptions[0].value;
return doBatchApiRequest('/' + batch.data.batch_id, {
return doBatchApiRequest('/' + batch.data.ill_batch_id, {
method: 'PUT',
headers: {
'Content-type': 'application/json'
@ -588,7 +588,7 @@
backend: batch.data.backend,
cardnumber: batch.data.patron.cardnumber,
library_id: selectedBranchcode,
statuscode: selectedStatuscode
status_code: selectedStatuscode
})
})
.catch(function () {
@ -1045,7 +1045,7 @@
}
function manageBatchItemsDisplay() {
batchItemsDisplay.style.display = batch.data.batch_id ? 'block' : 'none'
batchItemsDisplay.style.display = batch.data.ill_batch_id ? 'block' : 'none'
};
function updateBatchInputs() {

View file

@ -50,7 +50,7 @@
data: batchesProxy.data,
columns: [
{
data: 'batch_id',
data: 'ill_batch_id',
width: '10%'
},
{
@ -92,13 +92,13 @@
// A render function for branch name
var createBranch = function (x, y, data) {
return data._strings.branchname;
return data._strings.library_id.str;
};
// A render function for batch name
var createName = function (x, y, data) {
var a = document.createElement('a');
a.setAttribute('href', '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + data.batch_id);
a.setAttribute('href', '/cgi-bin/koha/ill/ill-requests.pl?batch_id=' + data.ill_batch_id);
a.setAttribute('title', data.name);
a.textContent = data.name;
return a.outerHTML;
@ -106,7 +106,7 @@
// A render function for batch status
var createStatus = function (x, y, data) {
return data._strings.status.name;
return data._strings.status_code.str;
};
// A render function for our patron link
@ -122,13 +122,13 @@
var editButton = document.createElement('button');
editButton.setAttribute('type', 'button');
editButton.setAttribute('class', 'editButton btn btn-xs btn-default');
editButton.setAttribute('data-batch-id', row.batch_id);
editButton.setAttribute('data-batch-id', row.ill_batch_id);
editButton.appendChild(document.createTextNode(ill_batch_edit));
var deleteButton = document.createElement('button');
deleteButton.setAttribute('type', 'button');
deleteButton.setAttribute('class', 'deleteButton btn btn-xs btn-danger');
deleteButton.setAttribute('data-batch-id', row.batch_id);
deleteButton.setAttribute('data-batch-id', row.ill_batch_id);
deleteButton.appendChild(document.createTextNode(ill_batch_delete));
div.appendChild(editButton);
@ -200,7 +200,7 @@
// Remove a batch from our proxy data
var removeBatch = function(id) {
batchesProxy.data = batchesProxy.data.filter(function (batch) {
return batch.batch_id != id;
return batch.ill_batch_id != id;
});
};

View file

@ -220,7 +220,7 @@ $(document).ready(function() {
"render": function(data, type, row, meta) {
return row.batch ?
'<a href="/cgi-bin/koha/ill/ill-requests.pl?batch_id=' +
row.batch_id +
row.ill_batch_id +
'">' +
row.batch.name +
'</a>'

View file

@ -197,7 +197,7 @@ my $batch = Koha::Illbatch->new(
patron_id => $patron->borrowernumber,
library_id => $library->branchcode,
backend => "TEST",
statuscode => $status5->code
status_code => $status5->code
}
);
$batch->create_and_log;
@ -205,7 +205,7 @@ $batch->create_and_log;
# Delete the batch status and ensure the batch's status has been changed
# to UNKNOWN
$status5->delete_and_log;
my $updated_code = Koha::Illbatches->find( { statuscode => "UNKNOWN" } );
is( $updated_code->statuscode, "UNKNOWN", "batches attached to deleted status have status changed to UNKNOWN" );
my $updated_code = Koha::Illbatches->find( { status_code => "UNKNOWN" } );
is( $updated_code->status_code, "UNKNOWN", "batches attached to deleted status have status changed to UNKNOWN" );
$schema->storage->txn_rollback;