From ac00c7a30d7a741184440938081902af170dca14 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 12 Jun 2018 23:10:24 +0000 Subject: [PATCH] Bug 17698: (follow-up) Fixing things in Comment 57 3. In the JS console: "ReferenceError: $ is not defined", I did not investigate it. Where do you see this in the console? I cannot recreate on opac-user.pl or on circ/checkout-notes.pl. 5. The alert id=error is displayed then hide in JS, but it's then displayed half a second. We should hide it by default (css) Fixed in this patch 6. I would move the "mark seen" and "mark not seen" buttons at the top of the table Fixed in this patch 8. Cursor on "Select all" and "Clear all" links must be adjusted Fixed in this patch 9. $(".btn-xs").click(function(event){ The selector should be $("button.seen, button.notseen"), you do not want to apply this function to all other btn-xs on the page (maybe there are only two for now, but who knows later?) Fixed in this patch 12. Important: When a note is updated, it's still marked as seen. Is it the expected behavior? I don't see this behaviour. When a note is updated it is marked as not seen. opav/svc/checkout_notes:79: $issue->set({ notedate => dt_from_string(), note => $clean_note, noteseen => 0 })->store; 13. What will happen when hundred of notes will be on this table? Not blocker but we will need a "hide seen" buttons to filters the already seen notes. Added in this patch Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- circ/circulation-home.pl | 3 -- .../prog/en/modules/circ/checkout-notes.tt | 33 +++++++++++++------ .../prog/en/modules/circ/circulation-home.tt | 2 +- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/circ/circulation-home.pl b/circ/circulation-home.pl index f101f6dd8c..1d08a03f84 100755 --- a/circ/circulation-home.pl +++ b/circ/circulation-home.pl @@ -40,7 +40,4 @@ $template->param( fast_cataloging => 1 ) if Koha::BiblioFrameworks->find( 'FA' ) $template->{'VARS'}->{'AllowOfflineCirculation'} = C4::Context->preference('AllowOfflineCirculation'); -my $pending_checkout_notes = Koha::Checkouts->search({ noteseen => 0 })->count; -$template->param( pending_checkout_notes => $pending_checkout_notes ); - output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt index cd02e65612..ae954ca131 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/checkout-notes.tt @@ -23,7 +23,7 @@

Checkout notes

-
+ [% IF ( selected_count ) %]
@@ -38,12 +38,20 @@ [% END %] [% IF ( notes.count ) %] -
- Select all | Clear all +
+ Select all + | Clear all + | Hide seen + | Show all
+
+ + +
+ @@ -64,7 +72,7 @@ -
[% note.note | html %] [% note.notedate | $KohaDates %] [% INCLUDE 'patron-title.inc' patron => note.patron hide_patron_infos_if_needed=1 %] + [% IF ( note.noteseen == 0 ) %] Not seen [% ELSIF ( note.noteseen == 1 ) %] @@ -83,11 +91,6 @@
-
- - -
-
[% ELSE %] @@ -131,6 +134,14 @@ $(".btn-sm").prop("disabled", true); }); + $(".HideSeen").on("click", function(){ + $(".seen1").parent().hide(); + }); + + $(".ShowAll").on("click", function(){ + $("tr").show(); + }); + $("#error").hide(); $("input[type='checkbox']").click(function(event){ @@ -141,7 +152,7 @@ } }); - $(".btn-xs").click(function(event){ + $("button.seen, button.notseen").click(function(event){ event.preventDefault(); // prevent form submission var $action = $(this).attr("name"); var $issue_id = $(this).data('issue_id'); @@ -161,10 +172,12 @@ if (data.status == 'success'){ if ( $action == 'notseen' ){ $("#status_" + $issue_id).text(_("Not seen")); + $(event.target).parent().siblings(".seen1").removeClass("seen1").addClass("seen0"); $(event.target).siblings(".seen").prop("disabled", false); $(event.target).prop("disabled", true); } else { $("#status_" + $issue_id).text(_("Seen")); + $(event.target).parent().siblings(".seen0").removeClass("seen0").addClass("seen1"); $(event.target).siblings(".notseen").prop("disabled", false); $(event.target).prop("disabled", true); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt index 56450bc97d..0ba1d43d74 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt @@ -41,7 +41,7 @@ [% END %] [% IF ( Koha.Preference('AllowCheckoutNotes') && CAN_user_circulate_manage_checkout_notes ) %]
  • - Checkout notes [% IF ( pending_checkout_notes ) %][% pending_checkout_notes %][% END %] + Checkout notes
  • [% END %] -- 2.39.5