Bugzilla – Attachment 98909 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), 7.23 KB, created by
Andrew Isherwood
on 2020-02-14 08:58:58 UTC
(
hide
)
Description:
Bug 24608: Allow due date modification
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2020-02-14 08:58:58 UTC
Size:
7.23 KB
patch
obsolete
>From af17dbf654a6c3157835ce388b7b3ca6bbb7a581 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Thu, 13 Feb 2020 14:16:48 +0000 >Subject: [PATCH] Bug 24608: Allow due date modification > >This patch adds the ability to modify due dates from a patron's >checkouts list. >--- > Koha/Illbackends/BLDSS | 1 + > Koha/Illbackends/FreeForm | 1 + > .../intranet-tmpl/prog/en/includes/strings.inc | 1 + > .../prog/en/modules/circ/circulation.tt | 4 ++ > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 58 +++++++++++++++++++++- > svc/checkouts | 2 + > 6 files changed, 66 insertions(+), 1 deletion(-) > create mode 120000 Koha/Illbackends/BLDSS > create mode 120000 Koha/Illbackends/FreeForm > >diff --git a/Koha/Illbackends/BLDSS b/Koha/Illbackends/BLDSS >new file mode 120000 >index 0000000000..95e9e7ea7f >--- /dev/null >+++ b/Koha/Illbackends/BLDSS >@@ -0,0 +1 @@ >+/home/koha-koha/illbackends/BLDSS >\ No newline at end of file >diff --git a/Koha/Illbackends/FreeForm b/Koha/Illbackends/FreeForm >new file mode 120000 >index 0000000000..05911ec0ff >--- /dev/null >+++ b/Koha/Illbackends/FreeForm >@@ -0,0 +1 @@ >+/home/koha-koha/illbackends/FreeForm >\ No newline at end of file >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >index 5ef174db7c..3d4dcbd333 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc >@@ -42,6 +42,7 @@ > 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"); >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 1eeb19e3af..51ae68e75a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1050,6 +1050,10 @@ > var MSG_CONFIRM_DELETE_MESSAGE = _("Are you sure you want to delete this message? This cannot be undone."); > 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/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index c1ca172f33..d9295ed9e7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -268,7 +268,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>"; >@@ -1091,4 +1095,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 f8fd541f36..335c742776 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, >@@ -189,6 +190,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.11.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 24608
:
98902
|
98903
|
98908
|
98909
|
98914
|
98915
|
98931
|
98932
|
99240
|
99880
|
99979
|
99986
|
99987
|
99988
|
99989
|
99990
|
126195
|
126196
|
126197
|
126198
|
126201