Bugzilla – Attachment 159019 Details for
Bug 35344
Patron image upload does not warn about missing cardnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35344: Warn on patron image upload if missing cardnumber
Bug-35344-Warn-on-patron-image-upload-if-missing-c.patch (text/plain), 4.12 KB, created by
David Cook
on 2023-11-16 05:13:33 UTC
(
hide
)
Description:
Bug 35344: Warn on patron image upload if missing cardnumber
Filename:
MIME Type:
Creator:
David Cook
Created:
2023-11-16 05:13:33 UTC
Size:
4.12 KB
patch
obsolete
>From b4630994a2db3a67c1857ef73248542239f025ff Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 16 Nov 2023 05:08:30 +0000 >Subject: [PATCH] Bug 35344: Warn on patron image upload if missing cardnumber > >This change displays a warning message instead of the patron image >upload feature in the patron record when the patron is missing the >cardnumber. > >Without this change, the staff user can try to upload a patron image >but it will silently fail. This change warns the staff user of the >cardnumber requirement for patron image upload. > >Test plan: >0. Apply the patch >1. Enable the "patronimages" system preference >2. Go to http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51 >3. Click "Add" over the patron image placeholder >4. Note the "Upload photo" button and the ability to take a patron photo if your >device has a camera >5. Remove "cardnumber" from BorrowerMandatoryField >6. Go to http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 >7. Edit the patron to remove the cardnumber >8. Click "Add" over the patron image placeholder >9. Note that no patron image upload features appear. Instead, only >a warning appears stating that the patron needs a cardnumber before >the patron image upload can be performed >--- > koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc | 6 ++++++ > koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 2 +- > koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js | 5 +++++ > 3 files changed, 12 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >index ead8c18fbe..6b1f791101 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >@@ -200,6 +200,7 @@ > <h4 class="modal-title" id="patronImageEditLabel">Patron photo</h4> > </div> > <div class="modal-body"> >+ [% IF ( patron.cardnumber ) %] > <div id="upload-patron-image" class="patroninfo-section"> > <h5>Upload patron photo</h5> > <form method="post" id="picture-upload" action="/cgi-bin/koha/tools/picture-upload.pl" >@@ -277,6 +278,11 @@ > <span id="camera-error-message"></span> > </div> > </div> >+ [% ELSE %] >+ <div id="missing-cardnumber-picture-upload"> >+ <p>The patron must have a cardnumber before a patron photo can be uploaded.</p> >+ </div> >+ [% END %] > </div> > <div class="modal-footer"> > <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >index a730bb4732..c3989d98aa 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js >@@ -87,7 +87,7 @@ $(document).ready(function(){ > $("#patronImageEdit").on("hidden.bs.modal", function(){ > /* Stop using the user's camera when modal is closed */ > let viewfinder = document.getElementById("viewfinder"); >- if( viewfinder.srcObject ){ >+ if( viewfinder && viewfinder.srcObject ){ > viewfinder.srcObject.getTracks().forEach( track => { > if( track.readyState == 'live' && track.kind === 'video'){ > track.stop(); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js b/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >index 3fd3e8732b..d75b1a720c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-webcam.js >@@ -43,6 +43,11 @@ function startup() { > camera = document.getElementById("camera"); > uploadfiletext = document.getElementById("uploadfiletext"); > >+ if ( ! video ){ >+ //If there is no video element, don't try to start up camera >+ return; >+ } >+ > try { > navigator.mediaDevices.getUserMedia({ > video: true, >-- >2.30.2
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 35344
:
159019
|
159247
|
159439