}
if ( ff.field_value ) {
+ var barcodes = [];
var empty_item_mandatory = 0;
for (i = 0; i < ff.field_value.length; i++) {
//alert("i = " + i + " => " + ff.kohafield[i] );
if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
empty_item_mandatory++;
}
+ if(ff.subfield[i].value === '[% barcode_subfield %]' && ff.field_value[i].value.length != 0) {
+ barcodes.push(ff.field_value[i].value);
+ }
}
if (empty_item_mandatory > 0) {
ok = 1;
_alertString +=
"\n- " + empty_item_mandatory + _(" item mandatory fields empty");
}
+
+ if(barcodes.length > 0) {
+ // Check for duplicate barcodes in the form
+ barcodes = barcodes.sort();
+ for(var i=0; i<barcodes.length-1; i++) {
+ if(barcodes[i] == barcodes[i+1]) {
+ ok = 1;
+ _alertString += "\n- " + _("The barcode ") + barcodes[i] + _(" is used more than once in the form. Every barcode must be unique");
+ }
+ }
+
+ // Check for duplicate barcodes in the database via an ajax call
+ $.ajax({
+ url: "/cgi-bin/koha/acqui/check_duplicate_barcode_ajax.pl",
+ async:false,
+ method: "post",
+ data: {barcodes : barcodes},
+ dataType: 'json',
+
+ error: function(xhr) {
+ alert("Error: \n" + xhr.responseText);
+ },
+ success: function(json) {
+ switch(json.status) {
+ case 'UNAUTHORIZED':
+ ok = 1;
+ _alertString += "\n- " + _("Error: Duplicate barcode verification failed. Insufficient user permissions.");
+ break;
+ case 'DUPLICATES':
+ ok = 1;
+ $.each(json.barcodes, function(index, barcode) {
+ _alertString += "\n- " + _("The barcode ") + barcode + _(" already exists in the database");
+ });
+ break;
+ }
+ },
+ });
+ }
}
-if (ok) {
+ if (ok) {
alert(_alertString);
- return false;
+ return false;
}
-ff.submit();
+ ff.submit();
}
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?supplierid=[% booksellerid %]">[% name %]</a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a> › <a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Basket [% basketno %]</a> › [% IF ( ordernumber ) %]Modify order details (line #[% ordernumber %])[% ELSE %]New order[% END %]</div>
<div id="doc3" class="yui-t2">
[% ELSE %]
New order
[% END %]
- [% IF ( suggestionid ) %](defined from suggestion #[% suggestionid %])[% END %]
</h2>
[% IF ( basketno ) %]
<input type="text" size="50" name="publishercode" id="publishercode" value="[% publishercode %]" />
[% END %]
</li>
+ <li>
+ [% IF ( biblionumber ) %]
+ <span class="label">Edition: </span>
+ <input type="hidden" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement %]" />[% editionstatement %]
+
+ [% ELSE %]
+ <label for="editionstatement">Edition: </label>
+ <input type="text" size="20" name="editionstatement" id="editionstatement" value="[% editionstatement %]" />
+ [% END %]
+ </li>
<li>
[% IF ( biblionumber ) %]
<span class="label">Publication year: </span>
[% END %]
</ol>
</fieldset>
+
+ [% IF ( suggestionid ) %]
+ <fieldset class="rows">
+ <legend>Suggestion</legend>
+ <ol>
+ <li>
+ <span class="label">Suggested by: </span>
+ [% surnamesuggestedby %][% IF ( firstnamesuggestedby ) %], [% firstnamesuggestedby %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestionid %]">suggestion #[% suggestionid %]</a>)
+ </li>
+ </ol>
+ </fieldset>
+ [% END %]
+
[% IF ( items ) %]
<fieldset class="rows">
<legend>Item</legend>
</div></li>
[% END %]
</ol>
- <a style="cursor: pointer; color: grey; font-size: 180%;" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">+</a>
- <a style="display:none; cursor: pointer; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">-</a>
+ <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
+ <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
</div><!-- /iteminformation -->
</div>
</li>
<li>
[% IF ( close ) %]
- <span class="label">Fund: </span>
+ <span class="label required">Fund: </span>
<input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
[% ELSE %]
- <label for="budget_id">Fund: </label>
+ <label class="required" for="budget_id">Fund: </label>
<select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
+ <option value="">Select a budget</option>
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_sel ) %]
<option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
<li>
[% IF ( close ) %]
<label for="cost">Actual cost: </label>
- <input type="text" id="cost" size="20" name="cost" value="[% ecost %]" readonly="readonly" />
+ <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" readonly="readonly" />
[% ELSE %]
<label for="cost">Actual cost: </label>
- <input type="text" id="cost" size="20" name="cost" value="[% ecost %]" />
+ <input type="text" id="unitprice" size="20" name="unitprice" value="[% unitprice %]" />
[% END %]
</li>
<li>
<select id="sort1" size="1" name="sort1">
[% FOREACH sort_opt IN CGIsort1 %]
[% IF sort_opt.default %]
- <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
[% ELSE %]
- <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
[% END %]
[% END %]
</select>
<label for="sort2">Statistic 2: </label>
[% IF CGIsort2 %]
- <select id="sort2" size="1" name="sort1">
+ <select id="sort2" size="1" name="sort2">
[% FOREACH sort_opt IN CGIsort2 %]
[% IF sort_opt.default %]
- <option value="[% sort_opt.id %]" selected="selected">[% sort_opt.label %]</option>
+ <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option>
[% ELSE %]
- <option value="[% sort_opt.id %]">[% sort_opt.label %]</option>
+ <option value="[% sort_opt.value %]">[% sort_opt.label %]</option>
[% END %]
[% END %]
</select>