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 308-324 if ($CGIsort2) { Link Here
308
}
308
}
309
309
310
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
310
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
311
    # prepare empty item form
311
    # Check if ACQ framework exists
312
    my $cell = PrepareItemrecordDisplay('','','','ACQ');
312
    my $marc = GetMarcStructure(1, 'ACQ');
313
#     warn "==> ".Data::Dumper::Dumper($cell);
313
    unless($marc) {
314
    unless ($cell) {
315
        $cell = PrepareItemrecordDisplay('','','','');
316
        $template->param('NoACQframework' => 1);
314
        $template->param('NoACQframework' => 1);
317
    }
315
    }
318
    my @itemloop;
316
    $template->param(
319
    push @itemloop,$cell;
317
        AcqCreateItemOrdering => 1,
320
    
318
        UniqueItemFields => C4::Context->preference('UniqueItemFields'),
321
    $template->param(items => \@itemloop);
319
    );
322
}
320
}
323
# 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
321
# 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
324
my @itemtypes;
322
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 (+9 lines)
Lines 5033-5038 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5033
       ALTER TABLE `z3950servers` ADD `timeout` INT( 11 ) NOT NULL DEFAULT '0' AFTER `syntax`;
5033
       ALTER TABLE `z3950servers` ADD `timeout` INT( 11 ) NOT NULL DEFAULT '0' AFTER `syntax`;
5034
    });
5034
    });
5035
    print "Upgrade to $DBversion done (New timeout field in z3950servers)\n";
5035
    print "Upgrade to $DBversion done (New timeout field in z3950servers)\n";
5036
}
5037
5038
$DBversion = "XXX";
5039
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5040
    $dbh->do(qq{
5041
        INSERT INTO systempreferences(variable,value,explanation,options,type)
5042
        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')
5043
    });
5044
    print "Upgrade to $DBversion done (Added system preference 'UniqueItemFields')\n";
5036
    SetVersion($DBversion);
5045
    SetVersion($DBversion);
5037
}
5046
}
5038
5047
(-)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 4-15 Link Here
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
5
6
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
6
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
7
[% INCLUDE 'additem.js.inc' %]
7
<script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
8
<script type="text/javascript" src="[% themelang %]/js/additem.js"></script>
8
<script type="text/javascript">
9
<script type="text/javascript">
9
//<![CDATA[
10
//<![CDATA[
10
actTotal = "";
11
actTotal = "";
11
12
12
function Check(ff) {
13
function Check(ff) {
14
    [% IF (AcqCreateItemOrdering) %]
15
        // Remove last itemblock if it is not in items_list
16
        var lastitemblock = $("#outeritemblock > div:last");
17
        var tobedeleted = true;
18
        var listitems = $("#items_list tr");
19
        $(listitems).each(function(){
20
            if($(this).attr('idblock') == $(lastitemblock).attr('id')){
21
                tobedeleted = false;
22
            }
23
        });
24
        if(tobedeleted){
25
            $(lastitemblock).remove();
26
        }
27
    [% END %]
28
13
    var ok=0;
29
    var ok=0;
14
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
30
    var _alertString= _("Form not submitted because of the following problem(s)")+"\n";
15
31
Lines 25-31 function Check(ff) { Link Here
25
					_alertString += "\n- "+ _("You must select a budget");
41
					_alertString += "\n- "+ _("You must select a budget");
26
    }
42
    }
27
43
28
    if (!(isNum(ff.quantity,0))){
44
    if (!(isNum(ff.quantity,0)) || ff.quantity.value == 0){
29
        ok=1;
45
        ok=1;
30
                    _alertString += "\n- " + _("Quantity must be greater than '0'");
46
                    _alertString += "\n- " + _("Quantity must be greater than '0'");
31
    }
47
    }
Lines 47-62 function Check(ff) { Link Here
47
    }
63
    }
48
64
49
    if ( ff.field_value ) {
65
    if ( ff.field_value ) {
50
        var barcodes = [];
51
        var empty_item_mandatory = 0;
66
        var empty_item_mandatory = 0;
52
        for (i = 0; i < ff.field_value.length; i++) {
67
        for (i = 0; i < ff.field_value.length; i++) {
53
            //alert("i = " + i + " => " + ff.kohafield[i] );
68
            //alert("i = " + i + " => " + ff.kohafield[i] );
54
            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
69
            if (ff.field_value[i].value.length == 0 && ff.mandatory[i].value == 1) {
55
                empty_item_mandatory++;
70
                empty_item_mandatory++;
56
            }
71
            }
57
            if(ff.subfield[i].value === '[% barcode_subfield %]' && ff.field_value[i].value.length != 0) {
58
                barcodes.push(ff.field_value[i].value);
59
            }
60
        }
72
        }
61
        if (empty_item_mandatory > 0) {
73
        if (empty_item_mandatory > 0) {
62
            ok = 1;
74
            ok = 1;
Lines 64-119 function Check(ff) { Link Here
64
                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
76
                "\n- " + empty_item_mandatory + _(" item mandatory fields empty");
65
        }
77
        }
66
78
67
        if(barcodes.length > 0) {
68
            // Check for duplicate barcodes in the form
69
            barcodes = barcodes.sort();
70
            for(var i=0; i<barcodes.length-1; i++) {
71
                if(barcodes[i] == barcodes[i+1]) {
72
                    ok = 1;
73
                    _alertString += "\n- " + _("The barcode ") + barcodes[i] + _(" is used more than once in the form. Every barcode must be unique");
74
                }
75
            }
76
77
            // Check for duplicate barcodes in the database via an ajax call
78
            $.ajax({
79
                url: "/cgi-bin/koha/acqui/check_duplicate_barcode_ajax.pl",
80
                async:false,
81
                method: "post",
82
                data: {barcodes : barcodes},
83
                dataType: 'json',
84
85
                error: function(xhr) {
86
                    alert("Error: \n" + xhr.responseText);
87
                },
88
                success: function(json) {
89
                    switch(json.status) {
90
                        case 'UNAUTHORIZED':
91
                            ok = 1;
92
                            _alertString += "\n- " + _("Error: Duplicate barcode verification failed. Insufficient user permissions.");
93
                            break;
94
                        case 'DUPLICATES':
95
                            ok = 1;
96
                            $.each(json.barcodes, function(index, barcode) {
97
                                _alertString += "\n- " + _("The barcode ") + barcode + _(" already exists in the database");
98
                            });
99
                            break;
100
                    }
101
                },
102
            });
103
        }
104
    }
79
    }
105
80
106
    if (ok) {
81
    if (ok) {
107
        alert(_alertString);
82
        alert(_alertString);
83
        [% IF (AcqCreateItemOrdering) %]
84
            if(tobedeleted) {
85
                $(lastitemblock).appendTo('#outeritemblock');
86
            }
87
        [% END %]
108
        return false;
88
        return false;
109
    }
89
    }
110
90
111
    ff.submit();
91
    [% IF (AcqCreateItemOrdering) %]
112
92
        if(check_additem('[% UniqueItemFields %]') == false) {
93
            alert(_('Duplicate values detected. Please correct the errors and resubmit.') );
94
            if(tobedeleted) {
95
                $(lastitemblock).appendTo('#outeritemblock');
96
            }
97
            return false;
98
        }
99
    [% END %]
113
}
100
}
114
101
115
$(document).ready(function() 
102
$(document).ready(function() 
116
    {
103
    {
104
        [% IF (AcqCreateItemOrdering) %]
105
            cloneItemBlock(0, '[% UniqueItemFields %]');
106
        [% END %]
117
        //We apply the fonction only for modify option
107
        //We apply the fonction only for modify option
118
        [% IF ( quantityrec ) %]
108
        [% IF ( quantityrec ) %]
119
        $('#quantity').blur(function() 
109
        $('#quantity').blur(function() 
Lines 169-174 $(document).ready(function() Link Here
169
    [% END %]
159
    [% END %]
170
</h2>
160
</h2>
171
161
162
<div class="error" style="display:none"></div>
163
172
[% IF ( basketno ) %]
164
[% IF ( basketno ) %]
173
    <div id="acqui_basket_summary"  class="yui-g">
165
    <div id="acqui_basket_summary"  class="yui-g">
174
    <fieldset class="rows">
166
    <fieldset class="rows">
Lines 208-214 $(document).ready(function() Link Here
208
    </div>
200
    </div>
209
[% END %]
201
[% END %]
210
202
211
<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
203
<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform" onsubmit="return Check(this);">
212
204
213
<fieldset class="rows">
205
<fieldset class="rows">
214
        <legend>
206
        <legend>
Lines 333-373 $(document).ready(function() Link Here
333
        </fieldset>
325
        </fieldset>
334
    [% END %]
326
    [% END %]
335
327
336
    [% IF ( items ) %]
328
    [% IF (AcqCreateItemOrdering) %]
337
    <fieldset class="rows">
329
330
    <div id="items_list" style="display:none">
331
        <p><b>Items list</b></p>
332
        <div style="width:100%;overflow:auto;">
333
            <table>
334
                <thead>
335
                    <tr>
336
                        <th>&nbsp;</th>
337
                        <th>&nbsp;</th>
338
                        <th>Barcode</th>
339
                        <th>Home branch</th>
340
                        <th>Holding branch</th>
341
                        <th>Not for loan</th>
342
                        <th>Restricted</th>
343
                        <th>Location</th>
344
                        <th>Call number</th>
345
                        <th>Copy number</th>
346
                        <th>Stock number</th>
347
                        <th>Collection code</th>
348
                        <th>Item type</th>
349
                        <th>Materials</th>
350
                        <th>Notes</th>
351
                    </tr>
352
                </thead>
353
                <tbody>
354
                </tbody>
355
            </table>
356
        </div>
357
    </div>
358
359
    <fieldset class="rows" id="itemfieldset">
338
        <legend>Item</legend>
360
        <legend>Item</legend>
339
        [% IF ( NoACQframework ) %]
361
        [% IF ( NoACQframework ) %]
340
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
362
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
341
        [% END %]
363
        [% END %]
342
364
343
        [% FOREACH item IN items %]
365
        <div id="outeritemblock"></div>
344
        <div id="outeritemblock">
345
        <div id="itemblock">
346
            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
347
                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
348
349
                    <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
350
                    [% iteminformatio.marc_value %]
351
                    <input type="hidden" name="itemid" value="1" />
352
                    <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
353
                    <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
354
                    <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
355
                    <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
356
                    [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
357
                        <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
358
                    [% END %]
359
360
                </div></li>
361
            [% END %]
362
            </ol>
363
            <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
364
            <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
365
        </div><!-- /iteminformation -->
366
        </div>
367
366
368
        [% END %] <!-- /items -->
369
    </fieldset>
367
    </fieldset>
370
    [% END %] <!-- items -->
368
    [% END %][%# IF (AcqCreateItemOrdering) %]
371
    <fieldset class="rows">
369
    <fieldset class="rows">
372
        <legend>Accounting Details</legend>
370
        <legend>Accounting Details</legend>
373
        <ol>
371
        <ol>
Lines 376-384 $(document).ready(function() Link Here
376
            <span class="label required">Quantity: </span>
374
            <span class="label required">Quantity: </span>
377
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
375
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
378
                [% ELSE %]
376
                [% ELSE %]
379
                <label class="required" for="quantity">Quantity: </label>
377
                    <label class="required" for="quantity">Quantity: </label>
380
                    [% IF ( items ) %]
378
                    [% IF (AcqCreateItemOrdering) %]
381
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
379
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" onchange="updateCosts();" />
382
                    [% ELSE %]
380
                    [% ELSE %]
383
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
381
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
384
                    [% END %]
382
                    [% END %]
Lines 530-536 $(document).ready(function() Link Here
530
</ol>
528
</ol>
531
    </fieldset>
529
    </fieldset>
532
    <fieldset class="action">
530
    <fieldset class="action">
533
        <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 %]
531
        <input type="submit" value="Save" />
532
        [% IF (suggestionid) %]
533
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
534
        [% ELSE %]
535
            <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
536
        [% END %]
534
    </fieldset>
537
    </fieldset>
535
</form>
538
</form>
536
</div>
539
</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 id="acq_orderreceive" class="acq">
43
<body id="acq_orderreceive" class="acq">
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