Bugzilla – Attachment 165669 Details for
Bug 35657
Add ability to assign tickets to librarians for catalog concerns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35657: Add option to set assignee during update
Bug-35657-Add-option-to-set-assignee-during-update.patch (text/plain), 10.70 KB, created by
Martin Renvoize (ashimema)
on 2024-04-26 16:09:17 UTC
(
hide
)
Description:
Bug 35657: Add option to set assignee during update
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-26 16:09:17 UTC
Size:
10.70 KB
patch
obsolete
>From 1ee7afda2634611c0f81f622cbf4d70a5f5839fd Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 29 Dec 2023 11:53:25 +0000 >Subject: [PATCH] Bug 35657: Add option to set assignee during update > >This patch exposes the UI to allow setting assignee from the ticket >update modal. > >Test plan >1) Apply the patches and run the database updates >2) Enable catalog concerns - `CatalogConcerns` or `OPACCatalogConcerns` >3) Submit a catalog concern via the OPAC or Staff client biblio page >4) Navigate to the concerns management page 'Cataloging > Catalog > concerns' >5) Note there is no assignee displayed in the status field for your new > concern. >6) Click the concern to view it's details >7) Note that in the modal there is now a new 'Change assignee' option >8) Use this new option to search for and assign a librarian to the > concern. >9) Submit the update >10) Your assignee should now appear in the 'status' data field in the > table >11) Clicking through to details again, you should see when the assignee > was set and should also be able to re-assign it >--- > .../en/includes/modals/display_ticket.inc | 2 + > .../prog/en/modules/cataloguing/concerns.tt | 9 +- > .../prog/js/modals/display_ticket.js | 102 +++++++++++++++++- > 3 files changed, 109 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc >index 5a3479a0de5..8b4768c5258 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/modals/display_ticket.inc >@@ -20,6 +20,8 @@ > <li class="rows"> > <label for="public">Notify: </label> > <input type="checkbox" name="public" id="public"> >+ <label for="assignee_id">Change assignee: </label> >+ <select name="assignee_id" id="assignee_id"></select> > </li> > </ol> > </fieldset> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >index 556f827ec06..d0086c8f4ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >@@ -182,6 +182,12 @@ > } else { > result += _("Open"); > } >+ if (row.assignee) { >+ result += '<span class="clearfix">' + _("Assigned to: ") + $patron_to_html(row.assignee, { >+ display_cardnumber: false, >+ url: true >+ }) + '</span>'; >+ } > } > return result; > }, >@@ -191,7 +197,7 @@ > { > "data": function(row, type, val, meta) { > let resolved = ( row.resolved_date ) ? true : false; >- let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>'; >+ let result = '<a class="btn btn-default btn-xs" role="button" href="#" data-toggle="modal" data-target="#ticketDetailsModal" data-concern="' + encodeURIComponent(row.ticket_id) + '" data-resolved="'+resolved+'" data-assignee="'+$patron_to_html(row.assignee, { display_cardnumber: false, url: false })+'"><i class="fa-solid fa-eye" aria-hidden="true"></i> ' + _("Details") + '</a>'; > return result; > }, > "searchable": false, >@@ -245,6 +251,7 @@ > [% END %] > }); > </script> >+ [% INCLUDE 'select2.inc' %] > [% Asset.js("js/modals/display_ticket.js") | $raw %] > [% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >index 61fecbea3ab..d8fc79f9904 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/modals/display_ticket.js >@@ -4,6 +4,7 @@ $(document).ready(function() { > let button = $(event.relatedTarget); > let ticket_id = button.data('concern'); > let resolved = button.data('resolved'); >+ let assignee = button.data('assignee'); > modal.find('.modal-footer input').val(ticket_id); > > if ( resolved ) { >@@ -17,6 +18,9 @@ $(document).ready(function() { > // Display ticket details > let display = '<div class="list-group">'; > display += '<div class="list-group-item">'; >+ if (assignee) { >+ display += '<span class="pull-right"><span class="label">' + __("Assignee") + '</span>: ' + assignee + '</span>'; >+ } > display += '<span class="wrapfix">' + detail + '</span>'; > display += '</div>'; > display += '<div id="concern-updates" class="list-group-item">'; >@@ -32,7 +36,7 @@ $(document).ready(function() { > url: "/api/v1/tickets/" + ticket_id + "/updates", > method: "GET", > headers: { >- "x-koha-embed": [ "user", "+strings" ] >+ "x-koha-embed": [ "user", "assignee", "+strings" ] > }, > }).success(function(data) { > let updates_display = $('#concern-updates'); >@@ -52,10 +56,18 @@ $(document).ready(function() { > url: true > }) + ' (' + $datetime(item.date) + ')'; > if ( item.status ) { >- updates += '<span class="wrapfix pull-right">'; >+ updates += '<span class="clearfix pull-right">'; > updates += item._strings.status ? escape_str(item._strings.status.str) : ""; > updates += '</span>' > } >+ if ( item.assignee ) { >+ updates += '<span class="clearfix pull-right">'; >+ updates += $patron_to_html(item.assignee, { >+ display_cardnumber: false, >+ url: true >+ }); >+ updates += '</span>' >+ } > updates += '</span>'; > updates += '</div>'; > }); >@@ -67,16 +79,100 @@ $(document).ready(function() { > // Clear any previously entered update message > $('#update_message').val(''); > $('#public').prop( "checked", false ); >+ >+ // Patron select2 >+ $("#assignee_id").kohaSelect({ >+ dropdownParent: $(".modal-content", "#ticketDetailsModal"), >+ width: '50%', >+ dropdownAutoWidth: true, >+ allowClear: true, >+ minimumInputLength: 3, >+ ajax: { >+ url: '/api/v1/patrons', >+ delay: 250, >+ dataType: 'json', >+ headers: { >+ "x-koha-embed": "library" >+ }, >+ data: function(params) { >+ let q = buildPatronSearchQuery(params.term); >+ let query = { >+ 'q': JSON.stringify(q), >+ '_page': params.page, >+ '_order_by': '+me.surname,+me.firstname', >+ }; >+ return query; >+ }, >+ processResults: function(data, params) { >+ let results = []; >+ data.results.forEach(function(patron) { >+ patron.id = patron.patron_id; >+ results.push(patron); >+ }); >+ return { >+ "results": results, "pagination": { "more": data.pagination.more } >+ }; >+ }, >+ }, >+ templateResult: function (patron) { >+ if (patron.library_id == loggedInLibrary) { >+ loggedInClass = "ac-currentlibrary"; >+ } else { >+ loggedInClass = ""; >+ } >+ >+ let $patron = $("<span></span>") >+ .append( >+ "" + >+ (patron.surname >+ ? escape_str(patron.surname) + ", " >+ : "") + >+ (patron.firstname >+ ? escape_str(patron.firstname) + " " >+ : "") + >+ (patron.cardnumber >+ ? " (" + escape_str(patron.cardnumber) + ")" >+ : "") + >+ "<small>" + >+ (patron.date_of_birth >+ ? ' <span class="age_years">' + >+ $get_age(patron.date_of_birth) + >+ " " + >+ __("years") + >+ "</span>" >+ : "") + >+ (patron.library ? >+ " <span class=\"ac-library\">" + >+ escape_str(patron.library.name) + >+ "</span>" >+ : "") + >+ "</small>" >+ ) >+ .addClass(loggedInClass); >+ return $patron; >+ }, >+ templateSelection: function (patron) { >+ if (!patron.surname) { >+ return patron.text; >+ } >+ return ( >+ escape_str(patron.surname) + ", " + escape_str(patron.firstname) >+ ); >+ }, >+ placeholder: "Search for a patron" >+ }); > }); > > $('#ticketDetailsModal').on('click', '.updateSubmit', function(e) { > let clicked = $(this); > let ticket_id = $('#ticket_id').val(); >+ let assignee_id = $('#assignee_id').val(); > let params = { > 'public': $('#public').is(":checked"), > 'message': $('#update_message').val(), > 'user_id': logged_in_user_borrowernumber, >- 'status': clicked.data('status') >+ 'status': clicked.data('status'), >+ 'assignee_id': assignee_id > }; > > $('#comment-spinner').show(); >-- >2.44.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35657
:
160365
|
160366
|
160367
|
160368
|
160369
|
160372
|
160373
|
160374
|
160375
|
160376
|
160377
|
164923
|
164924
|
164925
|
164926
|
164927
|
164928
|
164932
|
164933
|
164934
|
164935
|
164974
|
164975
|
164976
|
164977
|
165666
|
165667
|
165668
|
165669
|
165670
|
165671
|
165672
|
165673
|
165674
|
165675
|
165676
|
165677
|
165678
|
165679
|
165786
|
165787
|
165788
|
165789
|
165790
|
165791
|
165792
|
165878
|
165879
|
165880
|
165881
|
165882
|
165883
|
165884
|
165885
|
165886
|
166067