Bugzilla – Attachment 92842 Details for
Bug 23623
Use the new API and remove /svc scripts for privacy settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23623: Use the new API for changing privacy settings (guarantors)
Bug-23623-Use-the-new-API-for-changing-privacy-set.patch (text/plain), 5.07 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-09-16 19:04:57 UTC
(
hide
)
Description:
Bug 23623: Use the new API for changing privacy settings (guarantors)
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-09-16 19:04:57 UTC
Size:
5.07 KB
patch
obsolete
>From c1b56308dfc28e8856f04be125d1f612c9265597 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 16 Sep 2019 15:57:12 -0300 >Subject: [PATCH] Bug 23623: Use the new API for changing privacy settings > (guarantors) > >This patchset makes opac-memberentry.pl use the API instead of the old >svc scripts for ajax calls, for setting privacy configuration in the >OPAC. > >To test: >1) Disable OPACPrivacy >2) Enable AllowPatronToSetCheckoutsVisibilityForGuarantor >3) Enable AllowPatronToSetFinesVisibilityForGuarantor >4) Have a known patron be the guarantee of someone (so things display) >5) Log into the OPAC, go to the 'your personal details' tab >6) Change 'Allow your guarantor to view your current checkouts?' and >click the 'Update' button. >=> SUCCESS: Operation succeeds >7) Reload the tab >=> SUCCESS: The page reflects the expected changes (i.e. the API did it > right) >8) Repeat 6 and 7 with the 'Allow your guarantor to view your current >fines?' option >=> SUCCESS: It works as well >- Sign off :-D >--- > .../bootstrap/en/modules/opac-memberentry.tt | 40 ++++++++++--------- > 1 file changed, 22 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 9d23d27498..19f74a8bbe 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >@@ -1051,32 +1051,36 @@ > > [% IF Koha.Preference('AllowPatronToSetCheckoutsVisibilityForGuarantor') %] > $('#update_privacy_guarantor_checkouts').click( function() { >- $.post( "/cgi-bin/koha/svc/patron/show_checkouts_to_relatives", { privacy_guarantor_checkouts: $('#privacy_guarantor_checkouts').val() }, null, 'json') >- .done(function( data ) { >- var message; >- if ( data.success ) { >- message = _("Your setting has been updated!"); >- } else { >- message = _("Unable to update your setting!"); >+ var can_see_checkouts = $('#privacy_guarantor_checkouts').val() == 1; >+ $.ajax({ >+ url: "/api/v1/public/patrons/[% logged_in_user.borrowernumber %]/guarantors/can_see_checkouts" >+ type: "PUT", >+ data: JSON.stringify({ allowed: can_see_checkouts }), >+ contentType: "application/json", >+ success: function() { >+ $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( _("Your setting has been updated!") ).delay( 5000 ).fadeOut("slow"); >+ }, >+ error: function() { >+ $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( _("Unable to update your setting!") ).delay( 5000 ).fadeOut("slow"); > } >- >- $('#update_privacy_guarantor_checkouts_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow"); > }); > }); > [% END %] > > [% IF Koha.Preference('AllowPatronToSetFinesVisibilityForGuarantor') %] > $('#update_privacy_guarantor_fines').click( function() { >- $.post( "/cgi-bin/koha/svc/patron/show_fines_to_relatives", { privacy_guarantor_fines: $('#privacy_guarantor_fines').val() }, null, 'json') >- .done(function( data ) { >- var message; >- if ( data.success ) { >- message = _("Your setting has been updated!"); >- } else { >- message = _("Unable to update your setting!"); >+ var can_see_charges = $('#privacy_guarantor_fines').val() == 1; >+ $.ajax({ >+ url: "/api/v1/public/patrons/[% logged_in_user.borrowernumber %]/guarantors/can_see_charges", >+ type: 'PUT', >+ data: JSON.stringify({ allowed: can_see_charges }), >+ contentType: 'application/json', >+ success: function() { >+ $('#update_privacy_guarantor_fines_message').fadeIn("slow").text( _("Your setting has been updated!") ).delay( 5000 ).fadeOut("slow"); >+ }, >+ error: function() { >+ $('#update_privacy_guarantor_fines_message').fadeIn("slow").text( _("Unable to update your setting!") ).delay( 5000 ).fadeOut("slow"); > } >- >- $('#update_privacy_guarantor_fines_message').fadeIn("slow").text( message ).delay( 5000 ).fadeOut("slow"); > }); > }); > [% END %] >-- >2.23.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 23623
:
92842
|
92843
|
92914
|
92915
|
92916
|
92917
|
93001
|
93002
|
93003
|
93004