Test plan, k-t-d: Preparation: Create additional fields for table 'aqbasket': 2 text fields, one repeatable, one not-repeatable 2 AV fields, one repeatable, one not-repeatable 1) Add a new basket, visit: /cgi-bin/koha/acqui/basketheader.pl?booksellerid=1&op=add_form 2) Fill in name and all additional fields, click the '+New' and 'Clear' links, hit 'Save' 3) Notice the basket screen shows repeated fields separated by comma. 4) Notice that only non-null additional fields labels are shown. 5) Edit the basket. Notice all fields are shown as expected. Additional testing: Having a repeatable field with multiple instances, go back to the additional fields configuration and make the additional field non-repeatable again. Edit the basket again. Notice the multiple text instances are still shown, but the '+New' link no longer shows. You're able to remove existing multiple instances, but unable to add new ones, this is because the field is no longer repeatable. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
218 lines
9.3 KiB
Text
218 lines
9.3 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Branches %]
|
|
[% USE Koha %]
|
|
[% SET footerjs = 1 %]
|
|
[% PROCESS 'i18n.inc' %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>[% FILTER collapse %]
|
|
[% IF ( add_form ) %]
|
|
[% IF ( basketno ) %]
|
|
[% tx("Edit basket '{basketname}'", { basketname = basketname }) | html %]
|
|
[% ELSE %]
|
|
[% tx("Add basket to {vendor}", { vendor = booksellername }) | html %]
|
|
[% END %]
|
|
[% END %] ›
|
|
[% t("Acquisitions") | html %] ›
|
|
[% t("Koha") | html %]
|
|
[% END %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="acq_basketheader" class="acq">
|
|
[% WRAPPER 'header.inc' %]
|
|
[% INCLUDE 'acquisitions-search.inc' %]
|
|
[% END %]
|
|
|
|
[% WRAPPER 'sub-header.inc' %]
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
|
|
[% END %]
|
|
[% WRAPPER breadcrumb_item %]
|
|
<a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% booksellername | html %]</a>
|
|
[% END %]
|
|
[% IF ( add_form ) %]
|
|
[% IF ( basketno ) %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1%]
|
|
<span>Edit basket '[% basketname | html %]'</span>
|
|
[% END %]
|
|
[% ELSE %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1%]
|
|
<span>Add a basket to [% booksellername | html %]</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
[% END #/ WRAPPER sub-header.inc %]
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
|
|
[% INCLUDE 'messages.inc' %]
|
|
|
|
[% IF ( add_form ) %]
|
|
[% IF ( basketno ) %]
|
|
<h1>Edit basket [% basketname | html %]</h1>
|
|
[% ELSE %]<h1>Add a basket to [% booksellername | html %]</h1>
|
|
[% END %]
|
|
<form name="Aform" action="[% script_name | html %]" method="post" class="validated">
|
|
[% INCLUDE 'csrf-token.inc' %]
|
|
<input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
|
|
<fieldset class="rows">
|
|
<ol>
|
|
[% IF ( basketno ) %]
|
|
<li>
|
|
<input type="hidden" name="basketno" value="[% basketno | html %]" />
|
|
<input type="hidden" name="is_an_edit" value="1" />
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="basketname" class="required">Basket name: </label>
|
|
<input type="text" name="basketname" id="basketname" size="40" maxlength="80" value="[% basketname | html %]" required="required" class="focus required" />
|
|
<span class="required">Required</span>
|
|
</li>
|
|
<li>
|
|
<label for="billingplace">Billing place: </label>
|
|
<select name="billingplace" id="billingplace">
|
|
<option value="">--</option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all( selected => billingplace ) %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="deliveryplace">Delivery place: </label>
|
|
<select name="deliveryplace" id="deliveryplace">
|
|
<option value="">--</option>
|
|
[% PROCESS options_for_libraries libraries => Branches.all( selected => deliveryplace ) %]
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="basketbooksellerid">Vendor: </label>
|
|
<select name="basketbooksellerid" id="basketbooksellerid">
|
|
<option value="[% booksellerid | html %]" selected="selected">Current vendor ([% booksellername | html %])</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="basketnote">Internal note: </label>
|
|
<textarea name="basketnote" id="basketnote" rows="5" cols="40">[% basketnote |html %]</textarea>
|
|
</li>
|
|
<li>
|
|
<label for="basketbooksellernote">Vendor note: </label>
|
|
<textarea name="basketbooksellernote" id="basketbooksellernote" rows="5" cols="40">[% basketbooksellernote |html %]</textarea>
|
|
</li>
|
|
[% IF ( contractloop ) %]
|
|
<li><label for="basketcontractnumber">Contract: </label>
|
|
<select id="basketcontractnumber" name="basketcontractnumber">
|
|
<option value=""></option>
|
|
[% FOREACH contractloo IN contractloop %]
|
|
[% IF ( contractloo.selected ) %]
|
|
<option value="[% contractloo.contractnumber | html %]" selected="selected">[% contractloo.contractname | html %]</option>
|
|
[% ELSE %]
|
|
<option value="[% contractloo.contractnumber | html %]">[% contractloo.contractname | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="is_standing">Orders are standing:</label>
|
|
[% IF is_standing %]
|
|
<input type="checkbox" id="is_standing" name="is_standing" checked="checked" />
|
|
[% ELSE %]
|
|
<input type="checkbox" id="is_standing" name="is_standing"/>
|
|
[% END %]
|
|
<div class="hint">Standing orders do not close when received.</div>
|
|
</li>
|
|
[% IF basketno %]
|
|
<input type="hidden" name="create_items" value="[% create_items | html %]" />
|
|
[% ELSE %]
|
|
<li>
|
|
<label for="create_items">Create items when:</label>
|
|
<select name="create_items" id="create_items">
|
|
[% SWITCH Koha.Preference('AcqCreateItem') %]
|
|
[% CASE 'receiving' %]<option value="">use default (receiving an order)</option>
|
|
[% CASE 'cataloguing' %]<option value="">use default (cataloging the record)</option>
|
|
[% CASE %]<option value="">use default (placing an order)</option>
|
|
[% END %]
|
|
<option value="ordering">placing an order</option>
|
|
<option value="receiving">receiving an order</option>
|
|
<option value="cataloguing">cataloging the record</option>
|
|
</select>
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
|
|
[% IF available_additional_fields.count %]
|
|
[% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
|
|
[% END %]
|
|
|
|
<fieldset class="action">
|
|
<input type="hidden" name="op" value="cud-add_validate" />
|
|
<input type="submit" class="btn btn-primary" value="Save" />
|
|
[% IF ( basketno ) %]
|
|
<a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno | html %]">Cancel</a>
|
|
[% ELSE %]
|
|
<a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">Cancel</a>
|
|
[% END %]
|
|
</fieldset>
|
|
</form>
|
|
[% END %]
|
|
</div> <!-- /.col-md-10 offset-md-1 col-lg-8 offset-lg-2 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/acquisitions-menu.js") | $raw %]
|
|
[% Asset.js("js/acq.js") | $raw %]
|
|
[% Asset.js("js/additional-fields-entry.js") | $raw %]
|
|
[% INCLUDE 'select2.inc' %]
|
|
<script>
|
|
|
|
$(document).ready(function() {
|
|
|
|
function display_vendor(vendor) {
|
|
var $text;
|
|
$text = $('<span>'+vendor.text+'</span>');
|
|
|
|
return $text;
|
|
};
|
|
|
|
$("#basketbooksellerid").kohaSelect({
|
|
width: '50%',
|
|
allowClear: false,
|
|
ajax: {
|
|
url: '/api/v1/acquisitions/vendors',
|
|
delay: 300, // wait 300 milliseconds before triggering the request
|
|
cache: true,
|
|
dataType: 'json',
|
|
data: function (params) {
|
|
var search_term = (params.term === undefined) ? '' : params.term;
|
|
var query = {
|
|
"q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}),
|
|
"_order_by": "name",
|
|
"_page": params.page
|
|
};
|
|
|
|
return query;
|
|
},
|
|
processResults: function (data) {
|
|
var results = [];
|
|
data.results.forEach( function ( vendor ) {
|
|
results.push(
|
|
{
|
|
"id": vendor.id,
|
|
"text": vendor.name.escapeHtml()
|
|
}
|
|
);
|
|
});
|
|
return { "results": results, "pagination": { "more": data.pagination.more } };
|
|
}
|
|
},
|
|
templateResult: display_vendor,
|
|
templateSelection: display_vendor
|
|
});
|
|
});
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|