Bugzilla – Attachment 126196 Details for
Bug 24608
Allow modification of checkout due date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24608: Allow due date modification
Bug-24608-Allow-due-date-modification.patch (text/plain), 10.29 KB, created by
Martin Renvoize (ashimema)
on 2021-10-13 13:30:35 UTC
(
hide
)
Description:
Bug 24608: Allow due date modification
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-10-13 13:30:35 UTC
Size:
10.29 KB
patch
obsolete
>From b5c0ac4f5d4ef133dc41af8783f88c15e7900f5e Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 14 Feb 2020 09:08:02 +0000 >Subject: [PATCH] Bug 24608: Allow due date modification > >This patch adds the ability to modify due dates from a patron's >checkouts list. > >Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> >--- > .../prog/en/includes/strings.inc | 60 +++++++++++++++++++ > .../prog/en/modules/circ/circulation.tt | 4 ++ > .../prog/en/modules/members/moremember.tt | 4 ++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 58 +++++++++++++++++- > svc/checkouts | 2 + > 5 files changed, 127 insertions(+), 1 deletion(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >new file mode 100644 >index 0000000000..3d4dcbd333 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >@@ -0,0 +1,60 @@ >+<script> >+ var CIRCULATION_RETURNED = _("Checked in"); >+ var CIRCULATION_NOT_RETURNED = _("Unable to check in"); >+ var NOT_RENEWABLE_OVERDUE = _("Not allowed: overdue"); >+ var NOT_RENEWABLE_RESTRICTION = _("Not allowed: patron restricted"); >+ var CIRCULATION_RENEWED_DUE = _("Renewed, due:"); >+ var CIRCULATION_RENEW_FAILED = _("Renew failed:"); >+ var RETURN_CLAIMED = _("Return claimed"); >+ var RETURN_CLAIMED_FAILURE = _("Unable to claim as returned"); >+ var RETURN_CLAIMED_MAKE = _("Claim returned"); >+ var RETURN_CLAIMED_NOTES = _("Notes about return claim"); >+ var NOT_CHECKED_OUT = _("not checked out"); >+ var TOO_MANY_RENEWALS = _("too many renewals"); >+ var ON_RESERVE = _("on hold"); >+ var REASON_UNKNOWN = _("reason unknown"); >+ var TODAYS_CHECKOUTS = _("Today's checkouts"); >+ var PREVIOUS_CHECKOUTS = _("Previous checkouts"); >+ var BY = _("by _AUTHOR_"); >+ var ON_HOLD = _("On hold"); >+ var PLACE_HOLD = _("Place hold"); >+ var NOT_RENEWABLE = _("Not renewable"); >+ var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s"); >+ var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal"); >+ var NOT_RENEWABLE_AUTO_TOO_LATE = _("Can no longer be auto-renewed - number of checkout days exceeded"); >+ var NOT_RENEWABLE_AUTO_TOO_MUCH_OWEING = _("Automatic renewal failed, patron has unpaid fines"); >+ var NOT_RENEWABLE_AUTO_ACCOUNT_EXPIRED = _("Automatic renewal failed, account expired"); >+ var NOT_RENEWABLE_AUTO_RENEW = _("Scheduled for automatic renewal"); >+ var NOT_RENEWABLE_DENIED = _("Renewal denied by syspref"); >+ var RENEWALS_REMAINING = _("%s of %s renewals remaining"); >+ var HOLD_IS_SUSPENDED = _("Hold is <strong>suspended</strong>"); >+ var UNTIL = _("until %s"); >+ var NEXT_AVAILABLE_ITYPE = _("Next available %s item"); >+ var ITEM_IS_WAITING = _("Item is <strong>waiting</strong>"); >+ var ITEM_IS_WAITING_HERE = _("Item is <strong>waiting here</strong>"); >+ var AT = _("at %s"); >+ var ITEM_IS_IN_TRANSIT = _("Item is <strong>in transit</strong> from %s since %s"); >+ var FROM = _("from"); >+ var NOT_TRANSFERRED_YET = _("Item hasn't been transferred yet from %s"); >+ var NO = _("No"); >+ var YES = _("Yes"); >+ var INHOUSE_USE = _("On-site checkout"); >+ var CANCEL = _("Cancel"); >+ var RESUME = _("Resume"); >+ var SUSPEND = _("Suspend"); >+ var SAVE = _("Save"); >+ var SUSPEND_UNTIL = _("Suspend until:"); >+ var SUSPEND_HOLD_ON = _("Suspend hold on"); >+ var CLEAR_DATE_TO_SUSPEND_INDEFINITELY = _("Clear date to suspend indefinitely"); >+ var SUSPEND_HOLD_ERROR_DATE = _("Unable to suspend hold, invalid date"); >+ var SUSPEND_HOLD_ERROR_NOT_FOUND = _("Unable to suspend hold, hold not found"); >+ var RESUME_HOLD_ERROR_NOT_FOUND = _("Unable to resume, hold not found"); >+ var CURRENT = _(" (current) "); >+ var MSG_NO_ITEMTYPE = _("No itemtype"); >+ var MSG_CHECKOUTS_BY_ITEMTYPE = _("Number of checkouts by item type"); >+ var PATRON_NOTE = _("Patron note"); >+ var CONFIRM_DELETE_RETURN_CLAIM = _("Are you sure you want to delete this return claim?"); >+ var BROWSER_RETURN_TO_SEARCH = _("Results"); >+ var BROWSER_PREVIOUS = _("Previous"); >+ var BROWSER_NEXT = _("Next"); >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index d5e83f673a..4a89747a61 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -992,6 +992,10 @@ > [% END %] > var SuspendHoldsIntranet = [% ( Koha.Preference('SuspendHoldsIntranet') ) ? 1 : 0 | html %]; > </script> >+ <script> >+ /* Set values neededd in checkouts.js */ >+ var canEditDueDates = [% Koha.Preference('EditDueDates') | html %]; >+ </script> > [% Asset.js("js/pages/circulation.js") | $raw %] > [% Asset.js("js/checkouts.js") | $raw %] > [% Asset.js("js/holds.js") | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 55c4d8e740..2d95e8b303 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -889,6 +889,10 @@ > [% INCLUDE 'str/members-menu.inc' %] > [% Asset.js("js/members-menu.js") | $raw %] > [% Asset.js("js/messaging-preference-form.js") | $raw %] >+ <script> >+ /* Set values neededd in checkouts.js */ >+ var canEditDueDates = [% Koha.Preference('EditDueDates') | html %]; >+ </script> > <script> > > columns_settings_issues_table = [% TablesSettings.GetColumns( 'members', 'moremember', 'issues-table', 'json' ) | $raw %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 1ecd66002f..3f72360b5e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -306,7 +306,11 @@ $(document).ready(function() { > due = "<span class='overdue'>" + due + "</span>"; > } > >- due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; >+ due = "<div data-issue_id='"+ oObj.issue_id + "' style='white-space:nowrap'><span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; >+ >+ if (canEditDueDates) { >+ due += " <a href='#' class='edit_due_date_btn btn btn-default btn-xs'><i class='fa fa-pencil'></i> Edit</a></div>"; >+ } > > if ( oObj.lost && oObj.claims_returned ) { > due += "<span class='lost claims_returned'>" + oObj.lost.escapeHtml() + "</span>"; >@@ -1182,4 +1186,56 @@ $(document).ready(function() { > > }); > >+ // Allow due date editing if appropriate >+ if (canEditDueDates) { >+ $(document).on('click', '.edit_due_date_btn', function(e) { >+ e.preventDefault(); >+ var date_display = $(this).siblings('.date_due'); >+ $('#issues-table .edit_due_date_btn').attr('disabled', '1'); >+ var current = date_display.text(); >+ date_display.hide(); >+ $(this).closest('div').append('<input style="max-width:10em" type="text" id="due_date_select" value="' + current + '"></input>' + >+ '<a style="margin-left:1.5em" href="#" class="save_due_date_btn btn btn-default btn-xs"><i class="fa fa-save"></i> ' + SAVE + '</a>'); >+ $(this).hide(); >+ $("#due_date_select").datetimepicker({ >+ onClose: function(dateText, inst) { >+ validate_date(dateText, inst); >+ }, >+ minDate: Date_from_syspref(date_display.text()), >+ hour: 23, >+ minute: 59 >+ }).on("change", function(e) { >+ if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} >+ }); >+ }); >+ $(document).on('click', '.save_due_date_btn', function(e) { >+ e.preventDefault(); >+ var saveBtn = $(this); >+ var p = saveBtn.closest('div'); >+ var checkoutId = p.data('issue_id'); >+ var due_date = saveBtn.siblings('#due_date_select')[0].value; >+ p.append("<img style='margin-left:1.5em' id='due_date_spinner' src='" + interface + "/" + theme + "/img/spinner-small.gif' />"); >+ saveBtn.hide(); >+ if (due_date && due_date.length > 0) { >+ var dt = DateTime_from_syspref(due_date); >+ $.ajax({ >+ url: `/api/v1/checkouts/${checkoutId}`, >+ type: 'PUT', >+ data: JSON.stringify({ date_due: dt.toISOString() }), >+ success: function( data ) { >+ var dateFormatted = ISO_to_syspref(data.due_date); >+ saveBtn.siblings('.date_due').text(dateFormatted).show(); >+ $('#issues-table .edit_due_date_btn').removeAttr('disabled'); >+ p.find('#due_date_select').remove() >+ p.find('.ui-datepicker-trigger').remove() >+ p.find('#due_date_spinner').remove(); >+ p.find('.edit_due_date_btn').show(); >+ saveBtn.remove(); >+ }, >+ contentType: "json" >+ }); >+ } >+ }); >+ } >+ > }); >diff --git a/svc/checkouts b/svc/checkouts >index b8b5bdf109..4da4e9bfb6 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -64,6 +64,7 @@ print $input->header( -type => 'text/plain', -charset => 'UTF-8' ); > my @parameters; > my $sql = ' > SELECT >+ issue_id, > issues.issuedate, > issues.date_due, > issues.date_due < now() as date_due_overdue, >@@ -212,6 +213,7 @@ while ( my $c = $sth->fetchrow_hashref() ) { > my @subtitles = split(/ \| /, $c->{'subtitle'} // '' ); > my $checkout = { > DT_RowId => $c->{itemnumber} . '-' . $c->{borrowernumber}, >+ issue_id => $c->{issue_id}, > title => $c->{title}, > subtitle => \@subtitles, > medium => $c->{medium} // '', >-- >2.20.1
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 24608
:
98902
|
98903
|
98908
|
98909
|
98914
|
98915
|
98931
|
98932
|
99240
|
99880
|
99979
|
99986
|
99987
|
99988
|
99989
|
99990
|
126195
| 126196 |
126197
|
126198
|
126201