Bugzilla – Attachment 93001 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.19 KB, created by
Kyle M Hall (khall)
on 2019-09-20 15:09:07 UTC
(
hide
)
Description:
Bug 23623: Use the new API for changing privacy settings (guarantors)
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-09-20 15:09:07 UTC
Size:
5.19 KB
patch
obsolete
>From 861944278a2bbe688cc95c3881abc1c050a66f61 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 > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../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.20.1 (Apple Git-117)
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