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 Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
494ee7c68f
commit
855b8bc66e
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue