View | Details | Raw Unified | Return to bug 7178
Collapse All | Expand All

(-)a/acqui/check_uniqueness.pl (+68 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2011 BibLibre SARL
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
# This script search in items table if a value for a given field exists.
21
# It is used in check_additem (additem.js)
22
# Parameters are a list of 'field', which must be field names in items table
23
# and a list of 'value', which are the corresponding value to check
24
# Eg. @field = ('barcode', 'barcode', 'stocknumber')
25
#     @value = ('1234', '1235', 'ABC')
26
#     The script will check if there is already an item with barcode '1234',
27
#     then an item with barcode '1235', and finally check if there is an item
28
#     with stocknumber 'ABC'
29
# It returns a JSON string which contains what have been found
30
# Eg. { barcode: ['1234', '1235'], stocknumber: ['ABC'] }
31
32
use Modern::Perl;
33
34
use CGI;
35
use JSON;
36
use C4::Context;
37
use C4::Output;
38
use C4::Auth;
39
40
my $input = new CGI;
41
my @field = $input->param('field');
42
my @value = $input->param('value');
43
44
my $dbh = C4::Context->dbh;
45
46
my $query = "SHOW COLUMNS FROM items";
47
my $sth = $dbh->prepare($query);
48
$sth->execute;
49
my $results = $sth->fetchall_hashref('Field');
50
my @columns = keys %$results;
51
52
my $r = {};
53
my $index = 0;
54
for my $f ( @field ) {
55
    if(0 < grep /^$f$/, @columns) {
56
        $query = "SELECT $f FROM items WHERE $f = ?";
57
        $sth = $dbh->prepare( $query );
58
        $sth->execute( $value[$index] );
59
        my @values = $sth->fetchrow_array;
60
61
        if ( @values ) {
62
            push @{ $r->{$f} }, $values[0];
63
        }
64
    }
65
    $index++;
66
}
67
68
output_with_http_headers $input, undef, to_json($r), 'json';
(-)a/acqui/neworderempty.pl (-9 / +7 lines)
Lines 303-319 if ($CGIsort2) { Link Here
303
}
303
}
304
304
305
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
305
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
306
    # prepare empty item form
306
    # Check if ACQ framework exists
307
    my $cell = PrepareItemrecordDisplay('','','','ACQ');
307
    my $marc = GetMarcStructure(1, 'ACQ');
308
#     warn "==> ".Data::Dumper::Dumper($cell);
308
    unless($marc) {
309
    unless ($cell) {
310
        $cell = PrepareItemrecordDisplay('','','','');
311
        $template->param('NoACQframework' => 1);
309
        $template->param('NoACQframework' => 1);
312
    }
310
    }
313
    my @itemloop;
311
    $template->param(
314
    push @itemloop,$cell;
312
        AcqCreateItemOrdering => 1,
315
    
313
        UniqueItemFields => C4::Context->preference('UniqueItemFields'),
316
    $template->param(items => \@itemloop);
314
    );
317
}
315
}
318
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
316
# Get the item types list, but only if item_level_itype is YES. Otherwise, it will be in the item, no need to display it in the biblio
319
my @itemtypes;
317
my @itemtypes;
(-)a/acqui/orderreceive.pl (-8 / +7 lines)
Lines 117-132 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
117
# prepare the form for receiving
117
# prepare the form for receiving
118
if ( $count == 1 ) {
118
if ( $count == 1 ) {
119
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
119
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
120
        # prepare empty item form
120
        # Check if ACQ framework exists
121
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
121
        my $marc = GetMarcStructure(1, 'ACQ');
122
        unless ($cell) {
122
        unless($marc) {
123
            $cell = PrepareItemrecordDisplay('','','','');
124
            $template->param('NoACQframework' => 1);
123
            $template->param('NoACQframework' => 1);
125
        }
124
        }
126
        my @itemloop;
125
        $template->param(
127
        push @itemloop,$cell;
126
            AcqCreateItemReceiving => 1,
128
        
127
            UniqueItemFields => C4::Context->preference('UniqueItemFields'),
129
        $template->param(items => \@itemloop);
128
        );
130
    }
129
    }
131
130
132
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
131
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 4712-4717 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4712
    SetVersion($DBversion);
4712
    SetVersion($DBversion);
4713
}
4713
}
4714
4714
4715
$DBversion = "XXX";
4716
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4717
    $dbh->do(qq{
4718
        INSERT INTO systempreferences(variable,value,explanation,options,type)
4719
        VALUES('UniqueItemFields', 'barcode', 'Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table', '', 'Free')
4720
    });
4721
    print "Upgrade to $DBversion done (Added system preference 'UniqueItemFields')\n";
4722
    SetVersion($DBversion);
4723
}
4724
4715
=head1 FUNCTIONS
4725
=head1 FUNCTIONS
4716
4726
4717
=head2 DropAllForeignKeys($table)
4727
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/additem.js.inc (+10 lines)
Line 0 Link Here
1
<script type="text/javascript">
2
//<![CDATA[
3
var MSG_ADDITEM_JS_EDIT = _("Edit");
4
var MSG_ADDITEM_JS_DELETE = _("Delete");
5
var MSG_ADDITEM_JS_CLEAR = _("Clear");
6
var MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS = _("You can't receive any more items");
7
var MSG_ADDITEM_JS_IS_DUPLICATE = _("is duplicated");
8
var MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB = _("already exists in database");
9
//]]>
10
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js (-104 / +233 lines)
Lines 1-110 Link Here
1
function deleteItemBlock(index) {
1
function addItem( node, unique_item_fields ) {
2
    var aDiv = document.getElementById(index);
2
    var index = $(node).parent().attr('id');
3
    aDiv.parentNode.removeChild(aDiv);
3
    var current_qty = parseInt($("#quantity").val());
4
    var quantity = document.getElementById('quantity');
4
    var max_qty;
5
    quantity.setAttribute('value',parseFloat(quantity.getAttribute('value'))-1);
5
    if($("#quantity_to_receive").length != 0){
6
        max_qty = parseInt($("#quantity_to_receive").val());
7
    } else  {
8
        max_qty = 99999;
9
    }
10
    if ( $("#items_list table").find('tr[idblock="' + index + '"]').length == 0 ) {
11
        if ( current_qty < max_qty ) {
12
            if ( current_qty < max_qty - 1 )
13
                cloneItemBlock(index, unique_item_fields);
14
            addItemInList(index, unique_item_fields);
15
            $("#" + index).find("a[name='buttonPlus']").text("Update");
16
            $("#quantity").val(current_qty + 1);
17
        } else if ( current_qty >= max_qty ) {
18
            alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS
19
                || "You can't receive any more items.");
20
        }
21
    } else {
22
        if ( current_qty < max_qty )
23
            cloneItemBlock(index, unique_item_fields);
24
        var tr = constructTrNode(index);
25
        $("#items_list table").find('tr[idblock="' + index + '"]:first').replaceWith(tr);
26
    }
27
    $("#" + index).hide();
28
}
29
30
function showItem(index) {
31
    $("#outeritemblock").children("div").each(function(){
32
        if ( $(this).attr('id') == index ) {
33
            $(this).show();
34
        } else {
35
            if ( $("#items_list table").find('tr[idblock="' + $(this).attr('id') + '"]').length == 0 ) {
36
                $(this).remove();
37
            } else {
38
                $(this).hide();
39
            }
40
        }
41
    });
42
}
43
44
function constructTrNode(index, unique_item_fields) {
45
    var fields = ['barcode', 'homebranch', 'holdingbranch', 'notforloan',
46
        'restricted', 'location', 'itemcallnumber', 'copynumber',
47
        'stocknumber', 'ccode', 'itype', 'materials', 'itemnotes'];
48
49
    var result = "<tr idblock='" + index + "'>";
50
    var edit_link = "<a href='#itemfieldset' style='text-decoration:none' onclick='showItem(\"" + index + "\");'>"
51
        + (window.MSG_ADDITEM_JS_EDIT || "Edit") + "</a>";
52
    var del_link = "<a style='cursor:pointer' "
53
        + "onclick='deleteItemBlock(this, \"" + index + "\", \"" + unique_item_fields + "\");'>"
54
        + (window.MSG_ADDITEM_JS_DELETE || "Delete") + "</a>";
55
    result += "<td>" + edit_link + "</td>";
56
    result += "<td>" + del_link + "</td>";
57
    for(i in fields) {
58
        var field = fields[i];
59
        var field_elt = $("#" + index)
60
            .find("[name='kohafield'][value='items."+field+"']")
61
            .prevAll("[name='field_value']")[0];
62
        var field_value;
63
        if($(field_elt).is('select')) {
64
            field_value = $(field_elt).find("option:selected").text();
65
        } else {
66
            field_value = $(field_elt).val();
67
        }
68
        result += "<td>" + field_value + "</td>";
69
    }
70
    result += "</tr>";
71
72
    return result;
73
}
74
75
function addItemInList(index, unique_item_fields) {
76
    $("#items_list").show();
77
    var tr = constructTrNode(index, unique_item_fields);
78
    $("#items_list table tbody").append(tr);
79
}
80
81
function deleteItemBlock(node_a, index, unique_item_fields) {
82
    $("#" + index).remove();
83
    var current_qty = parseInt($("#quantity").val());
84
    var max_qty;
85
    if($("#quantity_to_receive").length != 0) {
86
        max_qty = parseInt($("#quantity_to_receive").val());
87
    } else {
88
        max_qty = 99999;
89
    }
90
    $("#quantity").val(current_qty - 1);
91
    $(node_a).parents('tr').remove();
92
    if(current_qty - 1 == 0)
93
        $("#items_list").hide();
94
95
    if ( $("#quantity").val() <= max_qty - 1) {
96
        if ( $("#outeritemblock").children("div :visible").length == 0 ) {
97
            $("#outeritemblock").children("div:last").show();
98
        }
99
    }
100
    if ( $("#quantity").val() == 0 && $("#outeritemblock > div").length == 0) {
101
        cloneItemBlock(0, unique_item_fields);
102
    }
6
}
103
}
7
function cloneItemBlock(index) {    
104
8
    var original = document.getElementById(index); //original <div>
105
function cloneItemBlock(index, unique_item_fields) {
9
    var clone = clone_with_selected(original)
106
    var original;
107
    if(index) {
108
        original = $("#" + index); //original <div>
109
    }
110
    var dont_copy_fields = new Array();
111
    if(unique_item_fields) {
112
        var dont_copy_fields = unique_item_fields.split(' ');
113
        for(i in dont_copy_fields) {
114
            dont_copy_fields[i] = "items." + dont_copy_fields[i];
115
        }
116
    }
117
10
    var random = Math.floor(Math.random()*100000); // get a random itemid.
118
    var random = Math.floor(Math.random()*100000); // get a random itemid.
11
    // set the attribute for the new 'div' subfields
119
    var clone = $("<div id='itemblock"+random+"'></div>")
12
    clone.setAttribute('id',index + random);//set another id.
120
    $.ajax({
13
    var NumTabIndex;
121
        url: "/cgi-bin/koha/services/itemrecorddisplay.pl",
14
    NumTabIndex = parseInt(original.getAttribute('tabindex'));
122
        dataType: 'html',
15
    if(isNaN(NumTabIndex)) NumTabIndex = 0;
123
        data: {
16
    clone.setAttribute('tabindex',NumTabIndex+1);
124
            frameworkcode: 'ACQ'
17
    var CloneButtonPlus;
125
        },
18
    var CloneButtonMinus;
126
        success: function(data, textStatus, jqXHR) {
19
  //  try{
127
            /* Create the item block */
20
        var jclone = $(clone);
128
            $(clone).append(data);
21
        CloneButtonPlus = $("a.addItem", jclone).get(0);
129
            /* Change all itemid fields value */
22
        CloneButtonPlus.setAttribute('onclick',"cloneItemBlock('" + index + random + "')");
130
            $(clone).find("input[name='itemid']").each(function(){
23
    CloneButtonMinus = $("a.delItem", jclone).get(0);
131
                $(this).val(random);
24
    CloneButtonMinus.setAttribute('onclick',"deleteItemBlock('" + index + random + "')");
132
            });
25
    CloneButtonMinus.setAttribute('style',"display:inline");
133
            /* Add buttons + and Clear */
26
    // change itemids of the clone
134
            var buttonPlus = '<a name="buttonPlus" style="cursor:pointer; margin:0 1em;" onclick="addItem(this,\'' + unique_item_fields + '\')">Add</a>';
27
    var elems = clone.getElementsByTagName('input');
135
            var buttonClear = '<a name="buttonClear" style="cursor:pointer;" onclick="clearItemBlock(this)">' + (window.MSG_ADDITEM_JS_CLEAR || 'Clear') + '</a>';
28
    for( i = 0 ; elems[i] ; i++ )
136
            $(clone).append(buttonPlus).append(buttonClear);
29
    {
137
            /* Copy values from the original block (input) */
30
        if(elems[i].name.match(/^itemid/)) {
138
            $(original).find("input[name='field_value']").each(function(){
31
            elems[i].value = random;
139
                var kohafield = $(this).siblings("input[name='kohafield']").val();
140
                if($(this).val() && dont_copy_fields.indexOf(kohafield) == -1) {
141
                    $(this).parent("div").attr("id").match(/^(subfield.)/);
142
                    var id = RegExp.$1;
143
                    var value = $(this).val();
144
                    $(clone).find("div[id^='"+id+"'] input[name='field_value']").val(value);
145
                }
146
            });
147
            /* Copy values from the original block (select) */
148
            $(original).find("select[name='field_value']").each(function(){
149
                var kohafield = $(this).siblings("input[name='kohafield']").val();
150
                if($(this).val() && dont_copy_fields.indexOf(kohafield) == -1) {
151
                    $(this).parent("div").attr("id").match(/^(subfield.)/);
152
                    var id = RegExp.$1;
153
                    var value = $(this).val();
154
                    $(clone).find("div[id^='"+id+"'] select[name='field_value']").val(value);
155
                }
156
            });
157
158
            $("#outeritemblock").append(clone);
32
        }
159
        }
33
    }    
160
    });
34
   // }
35
    //catch(e){        // do nothig if ButtonPlus & CloneButtonPlus don't exist.
36
    //}
37
    // insert this line on the page    
38
    original.parentNode.insertBefore(clone,original.nextSibling);
39
    var quantity = document.getElementById('quantity');
40
    quantity.setAttribute('value',parseFloat(quantity.getAttribute('value'))+1);
41
}
161
}
42
function check_additem() {
162
43
	var	barcodes = document.getElementsByName('barcode');
163
function clearItemBlock(node) {
44
	var success = true;
164
    var index = $(node).parent().attr('id');
45
	for(i=0;i<barcodes.length;i++){
165
    var block = $("#"+index);
46
		for(j=0;j<barcodes.length;j++){
166
    $(block).find("input[type='text']").each(function(){
47
			if( (i > j) && (barcodes[i].value == barcodes[j].value) && barcodes[i].value !='') {
167
        $(this).val("");
48
				barcodes[i].className='error';
168
    });
49
				barcodes[j].className='error';
169
    $(block).find("select").each(function(){
50
				success = false;
170
        $(this).find("option:first").attr("selected", true);
51
			}
171
    });
52
		}
172
}
53
	}
173
54
	// TODO : Add AJAX function to test against barcodes already in the database, not just 
174
function check_additem(unique_item_fields) {
55
	// duplicates within the form.  
175
    var success = true;
56
	return success;
176
    var data = new Object();
177
    data['field'] = new Array();
178
    data['value'] = new Array();
179
    var array_fields = unique_item_fields.split(' ');
180
    $(".error").empty(); // Clear error div
181
182
    // Check if a value is duplicated in form
183
    for ( field in array_fields ) {
184
        var fieldname = array_fields[field];
185
        var values = new Array();
186
        $("[name='kohafield'][value=items."+array_fields[field]+"]").each(function(){
187
            var input = $(this).prevAll("input[name='field_value']")[0];
188
            if($(input).val()) {
189
                values.push($(input).val());
190
                data['field'].push(fieldname);
191
                data['value'].push($(input).val());
192
            }
193
        });
194
195
        var sorted_arr = values.sort();
196
        for (var i = 0; i < sorted_arr.length - 1; i += 1) {
197
            if (sorted_arr[i + 1] == sorted_arr[i]) {
198
                $(".error").append(
199
                    fieldname + " '" + sorted_arr[i] + "' "
200
                    + (window.MSG_ADDITEM_JS_IS_DUPLICATE || "is duplicated")
201
                    + "<br/>");
202
                success = false;
203
            }
204
        }
205
    }
206
207
    // If there is a duplication, we raise an error
208
    if ( success == false ) {
209
        $(".error").show();
210
        return false;
211
    }
212
213
    $.ajax({
214
        url: '/cgi-bin/koha/acqui/check_uniqueness.pl',
215
        async: false,
216
        dataType: 'json',
217
        data: data,
218
        success: function(data) {
219
            for (field in data) {
220
                success = false;
221
                for (var i=0; i < data[field].length; i++) {
222
                    var value = data[field][i];
223
                    $(".error").append(
224
                        field + " '" + value + "' "
225
                        + (window.MSG_ADDITEM_JS_ALREADY_EXISTS_IN_DB
226
                            || "already exists in database")
227
                        + "<br />"
228
                    );
229
                }
230
            }
231
        }
232
    });
233
234
    if ( success == false ) {
235
        $(".error").show();
236
    }
237
    return success;
57
}
238
}
58
239
59
function clone_with_selected (node) {
60
	   var origin = node.getElementsByTagName("select");
61
	   var tmp = node.cloneNode(true)
62
	   var selectelem = tmp.getElementsByTagName("select");
63
	   for (var i=0; i<origin.length; i++) {
64
	       selectelem[i].selectedIndex = origin[i].selectedIndex;
65
	   }
66
	   origin = null;
67
	   selectelem = null;
68
	   return tmp;
69
	}
70
71
$(document).ready(function(){
72
	$(".cloneItemBlock").click(function(){
73
		var clonedRow = $(this).parent().parent().clone(true);
74
		clonedRow.insertAfter($(this).parent().parent()).find("a.deleteItemBlock").show();
75
		// find ID of cloned row so we can increment it for the clone
76
		var count = $("input[id^=volinf]",clonedRow).attr("id");
77
		var current = Number(count.replace("volinf",""));
78
		var increment = current + 1;
79
		// loop over inputs
80
		var inputs = ["volinf","barcode"];
81
		jQuery.each(inputs,function() {
82
			// increment IDs of labels and inputs in the clone
83
			$("label[for="+this+current+"]",clonedRow).attr("for",this+increment);
84
			$("input[name="+this+"]",clonedRow).attr("id",this+increment);
85
		});
86
		// loop over selects
87
		var selects = ["homebranch","location","itemtype","ccode"];
88
		jQuery.each(selects,function() {
89
			// increment IDs of labels and selects in the clone
90
			$("label[for="+this+current+"]",clonedRow).attr("for",this+increment);
91
			$("input[name="+this+"]",clonedRow).attr("id",this+increment);
92
			$("select[name="+this+"]",clonedRow).attr("id",this+increment);
93
			// find the selected option and select it in the clone
94
			var selectedVal = $("select#"+this+current).find("option:selected").attr("value");
95
			$("select[name="+this+"] option[value="+selectedVal+"]",clonedRow).attr("selected","selected");
96
		});
97
		
98
		var quantityrec = parseFloat($("#quantityrec").attr("value"));
99
		quantityrec++;
100
		$("#quantityrec").attr("value",quantityrec);
101
		return false;
102
	});
103
	$(".deleteItemBlock").click(function(){
104
		$(this).parent().parent().remove();
105
		var quantityrec = parseFloat($("#quantityrec").attr("value"));
106
		quantityrec--;
107
		$("#quantityrec").attr("value",quantityrec);
108
		return false;
109
	});
110
});
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-77 / +80 lines)
Lines 3-14 Link Here
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
4
5
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
5
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
6
[% INCLUDE 'additem.js.inc' %]
6
<script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
7
<script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
7
<script type="text/javascript">
8
<script type="text/javascript">
8
//<![CDATA[
9
//<![CDATA[
9
actTotal = "";
10
actTotal = "";
10
11
11
function Check(ff) {
12
function Check(ff) {
13
    [% IF (AcqCreateItemOrdering) %]
14
        // Remove last itemblock if it is not in items_list
15
        var lastitemblock = $("#outeritemblock > div:last");
16
        var tobedeleted = true;
17
        var listitems = $("#items_list tr");
18
        $(listitems).each(function(){
19
            if($(this).attr('idblock') == $(lastitemblock).attr('id')){
20
                tobedeleted = false;
21
            }
22
        });
23
        if(tobedeleted){
24
            $(lastitemblock).remove();
25
        }
26
    [% END %]
27
12
    var ok=0;
28
    var ok=0;
13
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
29
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
14
30
Lines 24-30 function Check(ff) { Link Here
24
					_alertString += "\n- "+ _("You must select a budget");
40
					_alertString += "\n- "+ _("You must select a budget");
25
    }
41
    }
26
42
27
    if (!(isNum(ff.quantity,0))){
43
    if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
28
        ok=1;
44
        ok=1;
29
                    _alertString += "\n- " + _("Quantity must be greater than '0'");
45
                    _alertString += "\n- " + _("Quantity must be greater than '0'");
30
    }
46
    }
Lines 46-61 function Check(ff) { Link Here
46
    }
62
    }
47
63
48
    if ( ff.field_value ) {
64
    if ( ff.field_value ) {
49
        var barcodes = [];
50
        var empty_item_mandatory = 0;
65
        var empty_item_mandatory = 0;
51
        for (i = 0; i < ff.field_value.length; i++) {
66
        for (i = 0; i < ff.field_value.length; i++) {
52
            //alert("i = " + i + " => " + ff.kohafield[i] );
67
            //alert("i = " + i + " => " + ff.kohafield[i] );
53
            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
68
            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
54
                empty_item_mandatory++;
69
                empty_item_mandatory++;
55
            }
70
            }
56
            if(ff.subfield[i].value === '[% barcode_subfield %]' && ff.field_value[i].value.length != 0) {
57
                barcodes.push(ff.field_value[i].value);
58
            }
59
        }
71
        }
60
        if (empty_item_mandatory > 0) {
72
        if (empty_item_mandatory > 0) {
61
            ok = 1;
73
            ok = 1;
Lines 63-118 function Check(ff) { Link Here
63
                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
75
                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
64
        }
76
        }
65
77
66
        if(barcodes.length > 0) {
67
            // Check for duplicate barcodes in the form
68
            barcodes = barcodes.sort();
69
            for(var i=0; i<barcodes.length-1; i++) {
70
                if(barcodes[i] == barcodes[i+1]) {
71
                    ok = 1;
72
                    _alertString += "\n- " + _("The barcode ") + barcodes[i] + _(" is used more than once in the form. Every barcode must be unique");
73
                }
74
            }
75
76
            // Check for duplicate barcodes in the database via an ajax call
77
            $.ajax({
78
                url: "/cgi-bin/koha/acqui/check_duplicate_barcode_ajax.pl",
79
                async:false,
80
                method: "post",
81
                data: {barcodes : barcodes},
82
                dataType: 'json',
83
84
                error: function(xhr) {
85
                    alert("Error: \n" + xhr.responseText);
86
                },
87
                success: function(json) {
88
                    switch(json.status) {
89
                        case 'UNAUTHORIZED':
90
                            ok = 1;
91
                            _alertString += "\n- " + _("Error: Duplicate barcode verification failed. Insufficient user permissions.");
92
                            break;
93
                        case 'DUPLICATES':
94
                            ok = 1;
95
                            $.each(json.barcodes, function(index, barcode) {
96
                                _alertString += "\n- " + _("The barcode ") + barcode + _(" already exists in the database");
97
                            });
98
                            break;
99
                    }
100
                },
101
            });
102
        }
103
    }
78
    }
104
79
105
    if (ok) {
80
    if (ok) {
106
        alert(_alertString);
81
        alert(_alertString);
82
        [% IF (AcqCreateItemOrdering) %]
83
            if(tobedeleted) {
84
                $(lastitemblock).appendTo('#outeritemblock');
85
            }
86
        [% END %]
107
        return false;
87
        return false;
108
    }
88
    }
109
89
110
    ff.submit();
90
    [% IF (AcqCreateItemOrdering) %]
111
91
        if(check_additem('[% UniqueItemFields %]') == false) {
92
            alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
93
            if(tobedeleted) {
94
                $(lastitemblock).appendTo('#outeritemblock');
95
            }
96
            return false;
97
        }
98
    [% END %]
112
}
99
}
113
100
114
$(document).ready(function() 
101
$(document).ready(function() 
115
    {
102
    {
103
        [% IF (AcqCreateItemOrdering) %]
104
            cloneItemBlock(0, '[% UniqueItemFields %]');
105
        [% END %]
116
        //We apply the fonction only for modify option
106
        //We apply the fonction only for modify option
117
        [% IF ( quantityrec ) %]
107
        [% IF ( quantityrec ) %]
118
        $('#quantity').blur(function() 
108
        $('#quantity').blur(function() 
Lines 168-173 $(document).ready(function() Link Here
168
    [% END %]
158
    [% END %]
169
</h2>
159
</h2>
170
160
161
<div class="error" style="display:none"></div>
162
171
[% IF ( basketno ) %]
163
[% IF ( basketno ) %]
172
    <div id="acqui_basket_summary"  class="yui-g">
164
    <div id="acqui_basket_summary"  class="yui-g">
173
	<fieldset class="rows">
165
	<fieldset class="rows">
Lines 207-213 $(document).ready(function() Link Here
207
    </div>
199
    </div>
208
[% END %]
200
[% END %]
209
201
210
<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
202
<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform" onsubmit="return Check(this);">
211
203
212
<fieldset class="rows">
204
<fieldset class="rows">
213
        <legend>
205
        <legend>
Lines 332-372 $(document).ready(function() Link Here
332
        </fieldset>
324
        </fieldset>
333
    [% END %]
325
    [% END %]
334
326
335
    [% IF ( items ) %]
327
    [% IF (AcqCreateItemOrdering) %]
336
    <fieldset class="rows">
328
329
    <div id="items_list" style="display:none">
330
        <p><b>Items list</b></p>
331
        <div style="width:100%;overflow:auto;">
332
            <table>
333
                <thead>
334
                    <tr>
335
                        <th>&nbsp;</th>
336
                        <th>&nbsp;</th>
337
                        <th>Barcode</th>
338
                        <th>Home branch</th>
339
                        <th>Holding branch</th>
340
                        <th>Not for loan</th>
341
                        <th>Restricted</th>
342
                        <th>Location</th>
343
                        <th>Call number</th>
344
                        <th>Copy number</th>
345
                        <th>Stock number</th>
346
                        <th>Collection code</th>
347
                        <th>Item type</th>
348
                        <th>Materials</th>
349
                        <th>Notes</th>
350
                    </tr>
351
                </thead>
352
                <tbody>
353
                </tbody>
354
            </table>
355
        </div>
356
    </div>
357
358
    <fieldset class="rows" id="itemfieldset">
337
        <legend>Item</legend>
359
        <legend>Item</legend>
338
        [% IF ( NoACQframework ) %]
360
        [% IF ( NoACQframework ) %]
339
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
361
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
340
        [% END %]
362
        [% END %]
341
363
342
        [% FOREACH item IN items %]
364
        <div id="outeritemblock"></div>
343
        <div id="outeritemblock">
344
        <div id="itemblock">
345
            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
346
                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
347
348
                    <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
349
                    [% iteminformatio.marc_value %]
350
                    <input type="hidden" name="itemid" value="1" />
351
                    <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
352
                    <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
353
                    <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
354
                    <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
355
                    [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
356
                        <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
357
                    [% END %]
358
359
                </div></li>
360
            [% END %]
361
            </ol>
362
            <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
363
            <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
364
        </div><!-- /iteminformation -->
365
        </div>
366
365
367
        [% END %] <!-- /items -->
368
    </fieldset>
366
    </fieldset>
369
    [% END %] <!-- items -->
367
    [% END %][%# IF (AcqCreateItemOrdering) %]
370
    <fieldset class="rows">
368
    <fieldset class="rows">
371
        <legend>Accounting Details</legend>
369
        <legend>Accounting Details</legend>
372
        <ol>
370
        <ol>
Lines 375-383 $(document).ready(function() Link Here
375
            <span class="label required">Quantity: </span>
373
            <span class="label required">Quantity: </span>
376
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
374
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
377
                [% ELSE %]
375
                [% ELSE %]
378
                <label class="required" for="quantity">Quantity: </label>
376
                    <label class="required" for="quantity">Quantity: </label>
379
                    [% IF ( items ) %]
377
                    [% IF (AcqCreateItemOrdering) %]
380
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
378
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" onchange="updateCosts();" />
381
                    [% ELSE %]
379
                    [% ELSE %]
382
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
380
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
383
                    [% END %]
381
                    [% END %]
Lines 529-535 $(document).ready(function() Link Here
529
</ol>
527
</ol>
530
    </fieldset>
528
    </fieldset>
531
    <fieldset class="action">
529
    <fieldset class="action">
532
        <input type="button" value="Save" onclick="Check(this.form)" /> [% IF ( suggestionid ) %]<a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>[% ELSE %]<a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>[% END %]
530
        <input type="submit" value="Save" />
531
        [% IF (suggestionid) %]
532
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
533
        [% ELSE %]
534
            <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
535
        [% END %]
533
    </fieldset>
536
    </fieldset>
534
</form>
537
</form>
535
</div>
538
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt (-45 / +88 lines)
Lines 1-7 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %]</title>
2
<title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name %] [% IF ( invoice ) %]invoice, [% invoice %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'additem.js.inc' %]
4
<script type="text/javascript" src="[% themelang %]/js/additem.js"> </script>
5
<script type="text/javascript" src="[% themelang %]/js/additem.js"> </script>
6
<script type="text/javascript">
7
//<![CDATA[
8
    function Check(form) {
9
        [% IF (AcqCreateItemReceiving) %]
10
            // Remove last itemblock if it is not in items_list
11
            var lastitemblock = $("#outeritemblock > div:last");
12
            var tobedeleted = true;
13
            var listitems = $("#items_list tr");
14
            $(listitems).each(function(){
15
                if($(this).attr('idblock') == $(lastitemblock).attr('id')){
16
                    tobedeleted = false;
17
                }
18
            });
19
            if(tobedeleted){
20
                $(lastitemblock).remove();
21
            }
22
23
            if(check_additem('[% UniqueItemFields %]') == false){
24
                alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
25
                if(tobedeleted) {
26
                    $(lastitemblock).appendTo("#outeritemblock");
27
                }
28
                return false;
29
            };
30
        [% END %]
31
32
        return true;
33
    }
34
35
    $(document).ready(function() {
36
        [% IF (AcqCreateItemReceiving) %]
37
            cloneItemBlock(0, '[% UniqueItemFields %]');
38
        [% END %]
39
    });
40
//]]>
41
</script>
5
</head>
42
</head>
6
<body>
43
<body>
7
[% INCLUDE 'header.inc' %]
44
[% INCLUDE 'header.inc' %]
Lines 18-27 Link Here
18
<h1>Receive items from : [% name %] [% IF ( invoice ) %][[% invoice %]] [% END %] (order #[% ordernumber %])</h1>
55
<h1>Receive items from : [% name %] [% IF ( invoice ) %][[% invoice %]] [% END %] (order #[% ordernumber %])</h1>
19
56
20
[% IF ( count ) %]
57
[% IF ( count ) %]
21
    <form action="/cgi-bin/koha/acqui/finishreceive.pl" method="post">
58
    <form action="/cgi-bin/koha/acqui/finishreceive.pl" method="post" onsubmit="return Check(this);">
22
<div class="yui-g">
59
<div class="yui-g">
23
<div class="yui-u first">
60
<div class="yui-u first">
24
    
61
    <div class="error" style="display:none"></div>
62
25
    <fieldset class="rows">
63
    <fieldset class="rows">
26
    <legend>Catalog Details</legend>
64
    <legend>Catalog Details</legend>
27
    <ol><li><span class="label">Title: </span><span class="title">[% title |html %]</span></li>
65
    <ol><li><span class="label">Title: </span><span class="title">[% title |html %]</span></li>
Lines 48-95 Link Here
48
        </fieldset>
86
        </fieldset>
49
    [% END %]
87
    [% END %]
50
88
51
    [% IF ( items ) %]
89
    [% IF (AcqCreateItemReceiving) %]
52
    <fieldset class="rows">
90
        <div id="items_list" style="display:none">
53
        <legend>Item</legend>
91
            <p><b>Items list</b></p>
54
        [% IF ( NoACQframework ) %]
92
            <div style="width:100%;overflow:auto;">
55
            <p class="required">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</p>
93
                <table>
56
        [% END %]
94
                    <thead>
95
                        <tr>
96
                            <th>&nbsp;</th>
97
                            <th>&nbsp;</th>
98
                            <th>Barcode</th>
99
                            <th>Home branch</th>
100
                            <th>Holding branch</th>
101
                            <th>Not for loan</th>
102
                            <th>Restricted</th>
103
                            <th>Location</th>
104
                            <th>Call number</th>
105
                            <th>Copy number</th>
106
                            <th>Stock number</th>
107
                            <th>Collection code</th>
108
                            <th>Item type</th>
109
                            <th>Materials</th>
110
                            <th>Notes</th>
111
                        </tr>
112
                    </thead>
113
                    <tbody>
114
                    </tbody>
115
                </table>
116
            </div>
117
        </div>
57
118
58
        [% FOREACH item IN items %]
119
        <fieldset class="rows" id="itemfieldset">
59
        <div id="outeritemblock">
120
            <legend>Item</legend>
60
        <div id="itemblock">
121
            [% IF ( NoACQframework ) %]
61
            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
122
                <p class="required">
62
                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
123
                    No ACQ framework, using default. You should create a
63
                                
124
                    framework with code ACQ, the items framework would be
64
                    <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
125
                    used
65
                    [% iteminformatio.marc_value %]
126
                </p>
66
                    <input type="hidden" name="itemid" value="1" />
67
                    <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
68
                    <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
69
                    <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
70
                    <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
71
                    [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
72
                        <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
73
                    [% END %]
74
            
75
                </div></li>
76
            [% END %]
127
            [% END %]
77
            </ol>
128
            <div id="outeritemblock"></div>
78
            <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
129
        </fieldset>
79
            <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
130
    [% END %][%# IF (AcqCreateItemReceiving) %]
80
        </div><!-- /iteminformation -->
81
        </div>
82
        
83
        <input type="hidden" name="moditem" value="" /> 
84
        <input type="hidden" name="tag" value="[% item.itemtagfield %]" />
85
        <input type="hidden" name="subfield" value="[% item.itemtagsubfield %]" />
86
        <input type="hidden" name="serial" value="[% item.serialid %]" />
87
        <input type="hidden" name="bibnum" value="[% item.biblionumber %]" />
88
        <input type="hidden" name="itemid" value="1" />
89
        <input type="hidden" name="field_value" value="[% item.itemnumber %]" />
90
        [% END %] <!-- /items -->
91
    </fieldset>
92
    [% END %] <!-- items -->
93
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
131
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
94
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
132
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
95
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
133
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
Lines 107-118 Link Here
107
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
145
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
108
       <li><label for="quantityto">Quantity to receive: </label><span class="label">
146
       <li><label for="quantityto">Quantity to receive: </label><span class="label">
109
           [% IF ( edit ) %]
147
           [% IF ( edit ) %]
110
               <input type="text" name="quantity" value="[% quantity %]" />
148
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
111
           [% ELSE %]
149
           [% ELSE %]
112
               <input type="text" READONLY name="quantity" value="[% quantity %]" />
150
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
113
           [% END %]
151
           [% END %]
114
           </span></li>
152
           </span></li>
115
        <li><label for="quantity">Quantity received: </label>
153
        <li><label for="quantity">Quantity received: </label>
154
          [% IF (AcqCreateItemReceiving) %]
155
            <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
156
          [% ELSE %]
116
            [% IF ( quantityreceived ) %]
157
            [% IF ( quantityreceived ) %]
117
                [% IF ( edit ) %]
158
                [% IF ( edit ) %]
118
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
159
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
Lines 133-138 Link Here
133
                [% END %]
174
                [% END %]
134
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
175
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
135
            [% END %]
176
            [% END %]
177
          [% END %][%# IF (AcqCreateItemReceiving) %]
136
		</li>
178
		</li>
137
        <li><label for="rrp">Replacement cost: </label><input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /></li>
179
        <li><label for="rrp">Replacement cost: </label><input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /></li>
138
        <li><label for="ecost">Budgeted cost: </label><input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" /></li>
180
        <li><label for="ecost">Budgeted cost: </label><input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" /></li>
Lines 148-154 Link Here
148
190
149
</div>
191
</div>
150
</div><div class="yui-g"><fieldset class="action">
192
</div><div class="yui-g"><fieldset class="action">
151
        <input type="button"  value="Save" onclick="javascript:if(check_additem()) { this.form.submit(); } else { alert( _('Duplicate barcodes detected.  Please correct the errors and resubmit.') ); return false };" /> <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% booksellerid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
193
        <input type="submit"  value="Save" />
194
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
152
</fieldset></div>    </form>
195
</fieldset></div>    </form>
153
[% ELSE %]
196
[% ELSE %]
154
<div id="acqui_acquire_orderlist">
197
<div id="acqui_acquire_orderlist">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (+3 lines)
Lines 9-14 Acquisitions: Link Here
9
              receiving: receiving an order.
9
              receiving: receiving an order.
10
              cataloguing: cataloging the record.
10
              cataloguing: cataloging the record.
11
    -
11
    -
12
        - pref: UniqueItemFields
13
        - (space-separated list of fields that should be unique for items, must be valid SQL fields of items table)
14
    -
12
        - When closing or reopening a basket,
15
        - When closing or reopening a basket,
13
        - pref: BasketConfirmations
16
        - pref: BasketConfirmations
14
          default: 1
17
          default: 1
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/services/itemrecorddisplay.tt (+24 lines)
Line 0 Link Here
1
<ol>
2
  [% FOREACH iteminfo IN iteminformation %]
3
    <li>
4
      <div class="subfield_line" style="[% iteminfo.hidden %];" id="subfield[% iteminfo.serialid %][% iteminfo.countitems %][% iteminfo.subfield %][% iteminfo.random %]">
5
        <label>
6
            [% iteminfo.subfield %] -
7
            [% IF ( iteminfo.mandatory ) %]
8
                <b>
9
            [% END %]
10
            [% iteminfo.marc_lib %]
11
            [% IF ( iteminfo.mandatory ) %]
12
                *</b>
13
            [% END %]
14
        </label>
15
        [% iteminfo.marc_value %]
16
        <input type="hidden" name="itemid" value="1" />
17
        <input type="hidden" name="kohafield" value="[% iteminfo.kohafield %]" />
18
        <input type="hidden" name="tag" value="[% iteminfo.tag %]" />
19
        <input type="hidden" name="subfield" value="[% iteminfo.subfield %]" />
20
        <input type="hidden" name="mandatory" value="[% iteminfo.mandatory %]" />
21
      </div>
22
    </li>
23
  [% END %]
24
</ol>
(-)a/services/itemrecorddisplay.pl (-1 / +57 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2011 BibLibre SARL
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it under the
7
# terms of the GNU General Public License as published by the Free Software
8
# Foundation; either version 2 of the License, or (at your option) any later
9
# version.
10
#
11
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
13
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License along
16
# with Koha; if not, write to the Free Software Foundation, Inc.,
17
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
=head1 NAME
20
21
itemrecorddisplay.pl
22
23
=head1 DESCRIPTION
24
25
Return a HTML form for Item record modification or creation.
26
It uses PrepareItemrecordDisplay
27
28
=cut
29
30
use strict;
31
use warnings;
32
33
use CGI;
34
use C4::Auth;
35
use C4::Output;
36
use C4::Items;
37
38
my $input = new CGI;
39
my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( {
40
    template_name   => 'services/itemrecorddisplay.tmpl',
41
    query           => $input,
42
    type            => 'intranet',
43
    authnotrequired => 1,
44
} );
45
46
my $biblionumber = $input->param('biblionumber') || '';
47
my $itemnumber = $input->param('itemnumber') || '';
48
my $frameworkcode = $input->param('frameworkcode') || '';
49
50
my $result = PrepareItemrecordDisplay($biblionumber, $itemnumber, undef, $frameworkcode);
51
unless($result) {
52
    $result = PrepareItemrecordDisplay($biblionumber, $itemnumber, undef, '');
53
}
54
55
$template->param(%$result);
56
57
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 7178