327be4a704
This patch modifies the maximum size of a patron's image, from 500KB to 2MB. Also, in Home/Patrons/anyPatron, when you try to add an image to a patron, you can now see the supported file types AND the maximum size. The following places are affected by this patch: - Home/Patrons/anyPatron - Home/Tools/Upload patron images - Home/Tools/Patron card creator/Images To test: 1)Search for any patron and go to his page. 2)Hover over the image area on the left and click on the "Add" button. 3)Notice that the message above the choose file button only specifies file types without the maximum size. 4)Add an image bigger than 500KB. 5)Nothing happens. (This is because the maximum size is 5KB) 6)Apply the patch. 7)Repeat steps from 1 to 3. 8)Notice that the message now includes the maximum size. 9)Add an image bigger than 500KB, but smaller than 2MB. 10)The image is succesfully uploaded. 11)Add an image bigger than 2MB. 12)Nothing happens. (The maximum size is now 2MB) 13)Repeat the steps 9 to 12 in "Home/Tools/Upload patron images" and "Home/Tools/Patron card creator/Images". 14)Notice that the maximum size is updated. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
199 lines
10 KiB
Text
199 lines
10 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Upload patron images › Tools › Koha</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="tools_picture-upload" class="tools">
|
|
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'patron-search.inc' %]
|
|
|
|
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
|
|
<ol>
|
|
<li>
|
|
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
|
|
</li>
|
|
[% IF ( TOTAL ) %]
|
|
<li>
|
|
<a href="/cgi-bin/koha/tools/picture-upload.pl">Upload patron images</a>
|
|
</li>
|
|
<li>
|
|
<a href="#" aria-current="page">
|
|
Results
|
|
</a>
|
|
</li>
|
|
[% ELSE %]
|
|
<li>
|
|
<a href="#" aria-current="page">
|
|
Upload patron images
|
|
</a>
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</nav>
|
|
|
|
[% INCLUDE 'blocking_errors.inc' %]
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% IF ( TOTAL ) %]
|
|
[% IF ( ERRORS ) %]
|
|
[% IF ( TCOUNTS ) %]
|
|
<div class="dialog alert">
|
|
<h3>Patron image(s) uploaded with some errors</h3>
|
|
</div>
|
|
[% ELSE %]
|
|
<div class="dialog alert">
|
|
<h3>Patron image failed to upload</h3>
|
|
</div>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<div class="dialog message">
|
|
<h3>Patron image(s) successfully uploaded</h3>
|
|
</div>
|
|
[% END %]
|
|
<ul class="data">
|
|
<li>Unpacking completed</li>
|
|
<li>[% TOTAL | html %] directories scanned.</li>
|
|
<li>[% HANDLED | html %] directories processed.</li>
|
|
</ul>
|
|
|
|
[% FOREACH COUNT IN COUNTS %]
|
|
<div class="container">
|
|
<table>
|
|
<caption>Results</caption>
|
|
<thead>
|
|
<tr><th>File name</th><th>Card number</th><th>Result</th></tr>
|
|
</thead>
|
|
<tbody>
|
|
[% IF ( COUNT.TCOUNTS ) %]<li>[% COUNT.TCOUNTS | html %] image(s) moved into the database:</li>[% END %]
|
|
[% FOREACH filename IN COUNT.filenames %]
|
|
<tr>
|
|
<td>[% filename.source | html %]</td>
|
|
<td><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% filename.cardnumber | url %]">[% filename.cardnumber | html %]</a></td>
|
|
<td>
|
|
[% IF ( filename.filerrors ) %]
|
|
[% FOREACH filerror IN filename.filerrors %]
|
|
[% IF ( filerror.DBERR ) %]<strong>ERROR:</strong> Image not imported because the database returned an error. Please refer to the error log for more details.
|
|
[% ELSIF ( filerror.IMGEXISTS ) %]<strong>ERROR:</strong> Image not imported because this patron does not exist in the database.
|
|
[% ELSIF ( filerror.MIMERR ) %]<strong>ERROR:</strong> Image not imported because the image format is unrecognized.
|
|
[% ELSIF ( filerror.CORERR ) %]<strong>ERROR:</strong> Image not imported because the image file is corrupted.
|
|
[% ELSIF ( filerror.OPNERR ) %]<strong>ERROR:</strong> Image not imported because Koha was unable to open the image for reading.
|
|
[% ELSIF ( filerror.OVRSIZ ) %]<strong>ERROR:</strong> Image not imported because the image file is too big (see online help for maximum size).
|
|
[% ELSIF ( filerror.CRDFIL ) %]<strong>ERROR:</strong> Image not imported ([% filerror.CRDFIL | html %] missing).
|
|
[% ELSIF ( filerror.CARDNUMBER_DOES_NOT_EXIST ) %]<strong>ERROR:</strong> Image not imported because this patron does not exist in the database.
|
|
[% ELSE %]<strong>ERROR:</strong> Image not imported because of an unknown error. Please refer to the error log for more details.
|
|
[% END %]
|
|
[% END %]
|
|
[% ELSE %] imported successfully.
|
|
[% END %]</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
[% END %]
|
|
<ul>
|
|
[% IF ( borrowernumber ) %]
|
|
<li><a id="member" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]">Return to patron detail</a></li>
|
|
[% ELSE %]
|
|
<li><a id="uploadmore" href="/cgi-bin/koha/tools/picture-upload.pl">Upload more images</a></li>
|
|
<li><a id="doneupload" href="/cgi-bin/koha/tools/tools-home.pl">Return to tools</a></li>
|
|
[% END %]</ul>
|
|
[% ELSE %]
|
|
<h1>Upload patron images</h1>
|
|
[% IF ( ERRORS ) %]
|
|
<div class="dialog alert">
|
|
[% FOREACH ERROR IN ERRORS %]
|
|
[% IF ( ERROR.NOTZIP ) %]<li><strong>The upload file does not appear to be a zip file. The extension is not '.zip'.</strong></li>
|
|
[% ELSIF ( ERROR.NOWRITETEMP ) %]<li><strong>This script is not able to create/write to the necessary temporary directory.</strong></li>
|
|
[% ELSIF ( ERROR.EMPTYUPLOAD ) %]<li><strong>The upload file appears to be empty.</strong></li>
|
|
[% ELSIF ( ERROR.OPNLINK ) %]<li><strong>Cannot open [% ERROR.OPNLINK | html %] to read.<br />Please verify that it exists.</strong></li>
|
|
[% ELSIF ( ERROR.OPNIMG ) %]<li><strong>Cannot open [% ERROR.OPNIMG | html %] to read.<br />Please verify that it exists.</strong></li>
|
|
[% ELSIF ( ERROR.DELERR ) %]<li><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></li>
|
|
[% ELSIF ( ERROR.UZIPFAIL ) %]<li><strong>[% ERROR.UZIPFAIL | html %] failed to unpack.<br />Please verify the integrity of the ZIP file and retry.</strong></li>
|
|
[% ELSE %]<li><strong>[% ERROR.CORERR | html %] An unknown error has occurred.<br />Please review the error log for more details.</strong></li>[% END %]
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
<form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data" id="upload_form">
|
|
<fieldset class="rows">
|
|
<p><strong>NOTE:</strong> Only PNG, GIF, JPEG, XPM formats are supported. Maximum image size is 2MB.</p>
|
|
<ol class="radio">
|
|
<li>
|
|
<label for="zipfile"><input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" /> Zip file</label></li>
|
|
<li>
|
|
<label for="image">
|
|
[% IF ( filetype == 'image' ) %]<input type="radio" id="image" name="filetype" value="image" checked="checked" />[% ELSE %]<input type="radio" id="image" name="filetype" value="image" />[% END %] Image file</label>
|
|
</li>
|
|
[% IF ( filetype == 'image' ) %]
|
|
<li id="cardnum">
|
|
[% ELSE %]
|
|
<li id="cardnum" style="display: none">
|
|
[% END %]
|
|
<label for="cardnumber">Enter patron card number: </label>
|
|
<input type="text" id="cardnumber" name="cardnumber" value="[% cardnumber | html %]" size="15" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li class="required">
|
|
<label for="uploadfile">Select the file to upload: </label>
|
|
<input type="file" id="uploadfile" name="uploadfile" class="required" required="required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action">
|
|
<input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
|
|
<input type="hidden" name="op" value="Upload" />
|
|
<input type="submit" value="Upload" class="submit" />
|
|
<a href="/cgi-bin/koha/tools/tools-home.pl" class="cancel">Cancel</a>
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% INCLUDE 'str/members-menu.inc' %]
|
|
[% Asset.js("js/members-menu.js") | $raw %]
|
|
<script>
|
|
$(document).ready(function() {
|
|
$("#zipfile").click(function(){
|
|
$("#cardnum").hide();
|
|
});
|
|
$("#image").click(function(){
|
|
$("#cardnum").show();
|
|
});
|
|
$( "#upload_form" ).validate({
|
|
rules: {
|
|
cardnumber: {
|
|
required: {
|
|
depends: function(element) {
|
|
return $("#image").is(":checked");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|