Bug 41134: Add table settings to transfers

This patch updates the transfers page in order to add table settings to
the table of transfered items.

The patch also makes another minor correction: The transfer submit
button now has the standard class "btn-primary."

To test, apply the patch and restart services.

- Go to Circulation -> Transfer.
- Submit a barcode from a library other than your own so that the
  transfer will complete successfully.
  - Note that the "Transfer" button has the standard primary yellow
    color.
- In the table of transferred items you should see the columns setting
  menu, export option, etc. Confirm that these controls work correctly.
- Go to Administration -> Table settings -> Circulation -> Transfers
- Make some changes to the column visibility settings and return
  to the transfers page to confirm that your settings are now
  applied when you transfer more items.
  - Because of DataTables state saving feature you might have to clear
    your browser's local storage in order to see the new column
    configuration.

Sponsored-by: Athens County Public Libraries
Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2025-10-29 17:01:57 +00:00 committed by Lucas Gass
parent d7aae3632e
commit 0ddcaa5e8a
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 83 additions and 40 deletions

View File

@ -2033,6 +2033,32 @@ modules:
-
columnname: itemnote
transfers:
transferstable:
columns:
-
columnname: title
-
columnname: author
-
columnname: barcode
-
columnname: location
-
columnname: itemcallnumber
-
columnname: itype
-
columnname: ccode
-
columnname: transferfrom
-
columnname: transferto
-
columnname: action
cannot_be_toggled: 1
cannot_be_modified: 1
view_holdsqueue:
holds-table:
default_sort_order: 3

View File

@ -3,6 +3,7 @@
[% USE Branches %]
[% USE ItemTypes %]
[% USE AuthorisedValues %]
[% USE TablesSettings %]
[% PROCESS 'i18n.inc' %]
[% SET footerjs = 1 %]
[% PROCESS 'member-display-address-style.inc' %]
@ -236,7 +237,7 @@
<div class="form-control-group">
<label class="hint" for="barcode">Enter item barcode: </label>
<input name="barcode" id="barcode" size="15" class="barcode focus" placeholder="Enter item barcode" type="text" />
<input class="btn btn-default" type="submit" value="Transfer" />
<input class="btn btn-primary" type="submit" value="Transfer" />
</div>
</fieldset>
[% FOREACH trsfitemloo IN trsfitemloop %]
@ -251,42 +252,46 @@
[% IF ( trsfitemloop ) %]
<div class="page-section">
<table>
<table id="transferstable">
<caption>Transferred items</caption>
<tr>
<th class="tf-title">Title</th>
<th class="tf-author">Author</th>
<th class="tf-barcode">Barcode</th>
<th class="tf-location">Shelving location</th>
<th class="tf-itemcallnumber">Call number</th>
<th class="tf-itemtype">Item type</th>
<th class="tf-ccode">Collection</th>
<th class="tf-origin">Origin</th>
<th class="tf-destination">Destination</th>
<th class="tf-printslip">Actions</th>
</tr>
[% FOREACH trsfitemloo IN trsfitemloop %]
<thead>
<tr>
<td class="tf-title"> [% INCLUDE 'biblio-title.inc' biblio=trsfitemloo.item.biblio link=1 %] </td>
<td class="tf-author">[% trsfitemloo.item.biblio.author | html %]</td>
<td class="tf-barcode"
><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.item.biblionumber | uri %]&amp;itemnumber=[% trsfitemloo.item.itemnumber | uri %]#item[% trsfitemloo.item.itemnumber | uri %]"
>[% trsfitemloo.item.barcode | html %]</a
></td
>
<td class="tf-location"><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => trsfitemloo.item.location ) | html %]</span></td>
<td class="tf-itemcallnumber">[% trsfitemloo.item.itemcallnumber | html %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.item.effective_itemtype ) | html %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => trsfitemloo.item.ccode ) | html %]</td>
<td class="tf-origin">[% Branches.GetName( trsfitemloo.frombrcd ) | html %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
<td class="tf-printslip">
<button type="button" class="btn btn-default btn-sm printtransferslip" data-itemnumber="[% trsfitemloo.item.itemnumber | html %]" data-tobranch="[% trsfitemloo.tobrcd | html %]"
><i class="fa fa-print"></i> Print slip</button
>
</td>
<th class="tf-title">Title</th>
<th class="tf-author">Author</th>
<th class="tf-barcode">Barcode</th>
<th class="tf-location">Shelving location</th>
<th class="tf-itemcallnumber">Call number</th>
<th class="tf-itemtype">Item type</th>
<th class="tf-ccode">Collection</th>
<th class="tf-origin">Origin</th>
<th class="tf-destination">Destination</th>
<th class="tf-printslip">Actions</th>
</tr>
[% END # /FOREACH trsfitemloo %]
</thead>
<tbody>
[% FOREACH trsfitemloo IN trsfitemloop %]
<tr>
<td class="tf-title"> [% INCLUDE 'biblio-title.inc' biblio=trsfitemloo.item.biblio link=1 %] </td>
<td class="tf-author">[% trsfitemloo.item.biblio.author | html %]</td>
<td class="tf-barcode"
><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.item.biblionumber | uri %]&amp;itemnumber=[% trsfitemloo.item.itemnumber | uri %]#item[% trsfitemloo.item.itemnumber | uri %]"
>[% trsfitemloo.item.barcode | html %]</a
></td
>
<td class="tf-location"><span class="shelvingloc">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => trsfitemloo.item.location ) | html %]</span></td>
<td class="tf-itemcallnumber">[% trsfitemloo.item.itemcallnumber | html %]</td>
<td class="tf-itemtype">[% ItemTypes.GetDescription( trsfitemloo.item.effective_itemtype ) | html %]</td>
<td class="tf-ccode">[% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => trsfitemloo.item.ccode ) | html %]</td>
<td class="tf-origin">[% Branches.GetName( trsfitemloo.frombrcd ) | html %]</td>
<td class="tf-destination">[% Branches.GetName( trsfitemloo.tobrcd ) | html %]</td>
<td class="tf-printslip">
<button type="button" class="btn btn-default btn-sm printtransferslip" data-itemnumber="[% trsfitemloo.item.itemnumber | html %]" data-tobranch="[% trsfitemloo.tobrcd | html %]"
><i class="fa fa-print"></i> Print slip</button
>
</td>
</tr>
[% END # /FOREACH trsfitemloo %]
</tbody>
</table>
</div>
<!-- /.page-section -->
@ -294,18 +299,30 @@
[% END # /IF found %]
[% END %]
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
[% INCLUDE 'select2.inc' %]
<script>
$(".printtransferslip").on("click", function(e){
e.preventDefault();
var itemnumber = $(this).attr('data-itemnumber');
var to_branch = $(this).attr('data-tobranch');
window.open("/cgi-bin/koha/circ/transfer-slip.pl?transferitem=" + itemnumber + "&branchcode=" + to_branch);
});
var table_settings = [% TablesSettings.GetTableSettings( 'circ', 'transfers', 'transferstable', 'json' ) | $raw %]
$(document).ready( function() {
$(".printtransferslip").on("click", function(e){
e.preventDefault();
var itemnumber = $(this).attr('data-itemnumber');
var to_branch = $(this).attr('data-tobranch');
window.open("/cgi-bin/koha/circ/transfer-slip.pl?transferitem=" + itemnumber + "&branchcode=" + to_branch);
});
[% IF ( found ) %]
$("#transfer_confirm").modal('show');
[% END %]
var transfers_table = $("#transferstable").kohaTable(
{
searching: false,
paging: false,
info: false,
ordering: false,
dom: '<"table_controls"B>rt',
},
table_settings
);
});
</script>
[% END %]