Marcel de Rooy
f77fd6c993
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> No more warns from qa tools. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
288 lines
16 KiB
Text
288 lines
16 KiB
Text
[% USE Koha %]
|
|
[% USE Branches %]
|
|
[% USE ItemTypes %]
|
|
[% USE KohaNews %]
|
|
[% USE raw %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
|
|
<title>Request article › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% BLOCK cssinclude %][% END %]
|
|
</head>
|
|
|
|
[% INCLUDE 'bodytag.inc' bodyid='opac-request-article' %]
|
|
[% INCLUDE 'masthead.inc' %]
|
|
|
|
[% SET disclaimer = KohaNews.get( location => "ArticleRequestsDisclaimerText", lang => lang, library => Branches.GetLoggedInBranchcode ) %]
|
|
|
|
<div class="main">
|
|
<nav aria-label="breadcrumb">
|
|
<ul class="breadcrumb">
|
|
<li class="breadcrumb-item">
|
|
<a href="/cgi-bin/koha/opac-main.pl">Home</a>
|
|
</li>
|
|
<li class="breadcrumb-item">
|
|
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblio.biblionumber | uri %]">Details for: [% biblio.title | html %]</a>
|
|
</li>
|
|
<li class="breadcrumb-item active" aria-current="page">
|
|
<a href="#">Request article</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<div class="container-fluid maincontent">
|
|
<div class="row">
|
|
<div class="col">
|
|
[% IF biblio.can_article_request( patron ) %]
|
|
<h1>Place article request for [% biblio.title | html %]</h1>
|
|
[% IF ( disclaimer && !action) %]
|
|
<div class="alert alert-warning">
|
|
[% PROCESS koha_news_block news => disclaimer %]
|
|
<a href="/cgi-bin/koha/opac-request-article.pl?biblionumber=[% biblio.biblionumber | uri %]&action=accept"
|
|
class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Accept</a>
|
|
</div>
|
|
[% ELSE %]
|
|
[% SET article_request_type = biblio.article_request_type( patron ) %]
|
|
|
|
[% IF article_request_type == 'yes' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFields') %] [% END %]
|
|
[% IF article_request_type == 'bib_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsRecordOnly') %] [% END %]
|
|
[% IF article_request_type == 'item_only' %] [% SET mandatory_fields = Koha.Preference('ArticleRequestsMandatoryFieldsItemOnly') %] [% END %]
|
|
|
|
|
|
<form id="place-article-request" method="post" action="/cgi-bin/koha/opac-request-article.pl">
|
|
<legend class="sr-only">Place article request</legend>
|
|
<input type="hidden" name="action" value="create" />
|
|
<input type="hidden" name="biblionumber" id="biblionumber" value="[% biblio.biblionumber | html %]" />
|
|
|
|
<fieldset class="rows">
|
|
<ul>
|
|
<li>
|
|
[% IF mandatory_fields.search('title') %]
|
|
<label for="title" class="required">Title:</label>
|
|
<input type="text" required="required" name="title" id="title" size="50" value="[% title | html %]"/>
|
|
[% ELSE %]
|
|
<label for="title">Title:</label>
|
|
<input type="text" name="title" id="title" size="50" value="[% title | html %]"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('author') %]
|
|
<label for="author" class="required">Author:</label>
|
|
<input type="text" required="required" name="author" id="author" size="50" value="[% author | html %]"/>
|
|
[% ELSE %]
|
|
<label for="author">Author:</label>
|
|
<input type="text" name="author" id="author" size="50" value="[% author | html %]"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('volume') %]
|
|
<label for="volume" class="required">Volume:</label>
|
|
<input type="text" required="required" name="volume" id="volume" size="50"/>
|
|
[% ELSE %]
|
|
<label for="volume">Volume:</label>
|
|
<input type="text" name="volume" id="volume" size="50"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('issue') %]
|
|
<label for="issue" class="required">Issue:</label>
|
|
<input type="text" required="required" name="issue" id="issue" size="50"/>
|
|
[% ELSE %]
|
|
<label for="issue">Issue:</label>
|
|
<input type="text" name="issue" id="issue" size="50"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('date') %]
|
|
<label for="date" class="required">Date:</label>
|
|
<input type="text" required="required" name="date" id="date" size="50"/>
|
|
[% ELSE %]
|
|
<label for="date">Date:</label>
|
|
<input type="text" name="date" id="date" size="50"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('pages') %]
|
|
<label for="pages" class="required">Pages:</label>
|
|
<input type="text" required="required" name="pages" id="pages" size="50" value="[% pageinfo | html %]"/>
|
|
[% ELSE %]
|
|
<label for="pages">Pages:</label>
|
|
<input type="text" name="pages" id="pages" size="50" value="[% pageinfo | html %]"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
[% IF mandatory_fields.search('chapters') %]
|
|
<label for="chapters" class="required">Chapters:</label>
|
|
<input type="text" required="required" name="chapters" id="chapters" size="50"/>
|
|
[% ELSE %]
|
|
<label for="chapters">Chapters:</label>
|
|
<input type="text" name="chapters" id="chapters" size="50"/>
|
|
[% END %]
|
|
</li>
|
|
|
|
<li>
|
|
<label for="patron_notes">Notes:</label>
|
|
<input type="text" name="patron_notes" id="patron_notes" size="50"/>
|
|
</li>
|
|
|
|
<li>
|
|
<label for="format">Format:</label>
|
|
<select name="format" id="format">
|
|
<option value="PHOTOCOPY">Photocopy</option>
|
|
<option value="SCAN">Digital scan</option>
|
|
</select>
|
|
</li>
|
|
|
|
<li>
|
|
<label for="branchcode">Pickup library:</label>
|
|
<select name="branchcode" id="branchcode" required="required">
|
|
[% FOREACH b IN Branches.all %]
|
|
[% IF b.branchcode == Branches.GetLoggedInBranchcode %]
|
|
<option value="[% b.branchcode | html %]" selected="selected">[% b.branchname | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% b.branchcode | html %]">[% b.branchname | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ul>
|
|
</fieldset>
|
|
|
|
[% IF article_request_type != 'bib_only' %]
|
|
<table class="copiesrow table table-bordered table-striped">
|
|
<caption>Select a specific item:</caption>
|
|
<thead>
|
|
<tr>
|
|
<th> </th>
|
|
<th>Item type</th>
|
|
<th>Barcode</th>
|
|
<th>Home library</th>
|
|
<th>Call number</th>
|
|
<th>Enumeration</th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody>
|
|
[% FOREACH item IN biblio.items %]
|
|
[% IF item.can_article_request( patron ) %]
|
|
<tr>
|
|
<td>
|
|
[% IF article_request_type == 'item_only' && !checked %]
|
|
[% SET checked = 1 %]
|
|
<input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="radio" name="itemnumber" value="[% item.itemnumber | html %]" />
|
|
[% END %]
|
|
</td>
|
|
<td>
|
|
[% ItemTypes.GetDescription( item.itype ) | html %]
|
|
</td>
|
|
<td>
|
|
[% item.barcode | html %]
|
|
</td>
|
|
<td>
|
|
[% Branches.GetName( item.homebranch ) | html %]
|
|
</td>
|
|
<td>
|
|
[% item.itemcallnumber | html %]
|
|
</td>
|
|
<td>
|
|
[% item.enumchron | html %]
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
[% IF article_request_type != 'item_only' %]
|
|
<tr>
|
|
<td>
|
|
<input type="radio" name="itemnumber" value="" checked="checked"/>
|
|
</td>
|
|
<td colspan="6">
|
|
Any item
|
|
</td>
|
|
</tr>
|
|
[% END %]
|
|
</tbody>
|
|
</table>
|
|
[% END %]
|
|
|
|
<input type="submit" class="btn btn-primary" value="Place request" />
|
|
</form>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<h1 class="title">[% biblio.title | html %]</h1>
|
|
<div class="alert alert-info">
|
|
No article requests can be made for this record.
|
|
</div>
|
|
[% END %]
|
|
</div> <!-- /.col -->
|
|
</div> <!-- /.row -->
|
|
</div> <!-- / .container-fluid -->
|
|
</div> <!-- / .main -->
|
|
|
|
[% INCLUDE 'opac-bottom.inc' %]
|
|
|
|
[% BLOCK jsinclude %]
|
|
<script>
|
|
$(document).ready( function() {
|
|
allow_submit = false;
|
|
$('#place-article-request').on('submit', function( event ){
|
|
if ( ! allow_submit ) {
|
|
event.preventDefault();
|
|
|
|
[% IF article_request_type == 'item_only' %]
|
|
if ( ! $("input:radio[name='itemnumber']").is(":checked") ) {
|
|
alert( _("Please select a specific item for this article request.") );
|
|
return 0;
|
|
}
|
|
[% END %]
|
|
|
|
var mandatory_fields = "[% mandatory_fields | html %]";
|
|
var m = new Array();
|
|
if ( mandatory_fields ) m = mandatory_fields.split(",");
|
|
var f = new Array();
|
|
|
|
for (i = 0; i < m.length; i++) {
|
|
if ( ! $("#" + m[i]).val() ) {
|
|
f.push( m[i] );
|
|
}
|
|
}
|
|
|
|
if ( f.length ) {
|
|
alert( _("The following fields are required and not filled in: ") + f.join(", ") );
|
|
return 0;
|
|
}
|
|
|
|
// Check if all fields are blank
|
|
if( m.length == 0 && $('#title').val()=='' && $('#author').val()=='' && $('#volume').val()=='' && $('#issue').val()=='' && $('#date').val()=='' && $('#pages').val()=='' && $('#chapters').val()=='' && $('#patron_notes').val()=='' ) {
|
|
alert( _("Please fill in at least one field.") );
|
|
return 0;
|
|
}
|
|
|
|
allow_submit = true;
|
|
$('#place-article-request').submit();
|
|
}
|
|
});
|
|
|
|
// Initialize format(s)
|
|
var supported_formats = "[% Koha.Preference('ArticleRequestsSupportedFormats') | $raw %]";
|
|
if( !supported_formats.match(/PHOTOCOPY/) )
|
|
$('#format option[value="PHOTOCOPY"]').remove();
|
|
if( !supported_formats.match(/SCAN/) )
|
|
$('#format option[value="SCAN"]').remove();
|
|
|
|
if( $('#format option').length > 1 ) {
|
|
// Select first listed format
|
|
var first_format = supported_formats.split('|')[0].replace(/^\s*|\s*$/g, '');
|
|
$('#format option[value="'+first_format+'"]').attr('selected', true);
|
|
}
|
|
});
|
|
</script>
|
|
[% END %]
|