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 317-333 if ($CGIsort2) { Link Here
317
}
317
}
318
318
319
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
319
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
320
    # prepare empty item form
320
    # Check if ACQ framework exists
321
    my $cell = PrepareItemrecordDisplay('','','','ACQ');
321
    my $marc = GetMarcStructure(1, 'ACQ');
322
#     warn "==> ".Data::Dumper::Dumper($cell);
322
    unless($marc) {
323
    unless ($cell) {
324
        $cell = PrepareItemrecordDisplay('','','','');
325
        $template->param('NoACQframework' => 1);
323
        $template->param('NoACQframework' => 1);
326
    }
324
    }
327
    my @itemloop;
325
    $template->param(
328
    push @itemloop,$cell;
326
        AcqCreateItemOrdering => 1,
329
    
327
        UniqueItemFields => C4::Context->preference('UniqueItemFields'),
330
    $template->param(items => \@itemloop);
328
    );
331
}
329
}
332
# 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
330
# 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
333
my @itemtypes;
331
my @itemtypes;
(-)a/acqui/orderreceive.pl (-8 / +7 lines)
Lines 116-131 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
116
# prepare the form for receiving
116
# prepare the form for receiving
117
if ( $count == 1 ) {
117
if ( $count == 1 ) {
118
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
118
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
119
        # prepare empty item form
119
        # Check if ACQ framework exists
120
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
120
        my $marc = GetMarcStructure(1, 'ACQ');
121
        unless ($cell) {
121
        unless($marc) {
122
            $cell = PrepareItemrecordDisplay('','','','');
123
            $template->param('NoACQframework' => 1);
122
            $template->param('NoACQframework' => 1);
124
        }
123
        }
125
        my @itemloop;
124
        $template->param(
126
        push @itemloop,$cell;
125
            AcqCreateItemReceiving => 1,
127
        
126
            UniqueItemFields => C4::Context->preference('UniqueItemFields'),
128
        $template->param(items => \@itemloop);
127
        );
129
    }
128
    }
130
129
131
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
130
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
(-)a/installer/data/mysql/updatedatabase.pl (+11 lines)
Lines 4663-4668 ENDOFRENEWAL Link Here
4663
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4663
    print "Upgrade to $DBversion done (Added a system preference to allow renewal of Patron account either from todays date or from existing expiry date in the patrons account.)\n";
4664
    SetVersion($DBversion);
4664
    SetVersion($DBversion);
4665
}
4665
}
4666
4667
$DBversion = "XXX";
4668
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4669
    $dbh->do(qq{
4670
        INSERT INTO systempreferences(variable,value,explanation,options,type)
4671
        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')
4672
    });
4673
    print "Upgrade to $DBversion done (Added system preference 'UniqueItemFields')\n";
4674
    SetVersion($DBversion);
4675
}
4676
4666
=head1 FUNCTIONS
4677
=head1 FUNCTIONS
4667
4678
4668
=head2 DropAllForeignKeys($table)
4679
=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 169-174 $(document).ready(function() Link Here
169
        [% IF ( suggestionid ) %](defined from suggestion #[% suggestionid %])[% END %]
159
        [% IF ( suggestionid ) %](defined from suggestion #[% suggestionid %])[% 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 310-350 $(document).ready(function() Link Here
310
            [% END %]
302
            [% END %]
311
        </ol>
303
        </ol>
312
    </fieldset>
304
    </fieldset>
313
    [% IF ( items ) %]
305
    [% IF (AcqCreateItemOrdering) %]
314
    <fieldset class="rows">
306
307
    <div id="items_list" style="display:none">
308
        <p><b>Items list</b></p>
309
        <div style="width:100%;overflow:auto;">
310
            <table>
311
                <thead>
312
                    <tr>
313
                        <th>&nbsp;</th>
314
                        <th>&nbsp;</th>
315
                        <th>Barcode</th>
316
                        <th>Home branch</th>
317
                        <th>Holding branch</th>
318
                        <th>Not for loan</th>
319
                        <th>Restricted</th>
320
                        <th>Location</th>
321
                        <th>Call number</th>
322
                        <th>Copy number</th>
323
                        <th>Stock number</th>
324
                        <th>Collection code</th>
325
                        <th>Item type</th>
326
                        <th>Materials</th>
327
                        <th>Notes</th>
328
                    </tr>
329
                </thead>
330
                <tbody>
331
                </tbody>
332
            </table>
333
        </div>
334
    </div>
335
336
    <fieldset class="rows" id="itemfieldset">
315
        <legend>Item</legend>
337
        <legend>Item</legend>
316
        [% IF ( NoACQframework ) %]
338
        [% IF ( NoACQframework ) %]
317
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
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>
318
        [% END %]
340
        [% END %]
319
341
320
        [% FOREACH item IN items %]
342
        <div id="outeritemblock"></div>
321
        <div id="outeritemblock">
322
        <div id="itemblock">
323
            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
324
                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
325
326
                    <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
327
                    [% iteminformatio.marc_value %]
328
                    <input type="hidden" name="itemid" value="1" />
329
                    <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
330
                    <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
331
                    <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
332
                    <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
333
                    [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
334
                        <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
335
                    [% END %]
336
337
                </div></li>
338
            [% END %]
339
            </ol>
340
            <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
341
            <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
342
        </div><!-- /iteminformation -->
343
        </div>
344
343
345
        [% END %] <!-- /items -->
346
    </fieldset>
344
    </fieldset>
347
    [% END %] <!-- items -->
345
    [% END %][%# IF (AcqCreateItemOrdering) %]
348
    <fieldset class="rows">
346
    <fieldset class="rows">
349
        <legend>Accounting Details</legend>
347
        <legend>Accounting Details</legend>
350
        <ol>
348
        <ol>
Lines 353-361 $(document).ready(function() Link Here
353
            <span class="label required">Quantity: </span>
351
            <span class="label required">Quantity: </span>
354
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
352
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
355
                [% ELSE %]
353
                [% ELSE %]
356
                <label class="required" for="quantity">Quantity: </label>
354
                    <label class="required" for="quantity">Quantity: </label>
357
                    [% IF ( items ) %]
355
                    [% IF (AcqCreateItemOrdering) %]
358
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" onchange="calcNeworderTotal();" />
356
                        <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="0" onchange="updateCosts();" />
359
                    [% ELSE %]
357
                    [% ELSE %]
360
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
358
                        <input type="text" size="20" id="quantity" name="quantity" value="[% quantityrec %]" onchange="calcNeworderTotal();" />
361
                    [% END %]
359
                    [% END %]
Lines 507-513 $(document).ready(function() Link Here
507
</ol>
505
</ol>
508
    </fieldset>
506
    </fieldset>
509
    <fieldset class="action">
507
    <fieldset class="action">
510
        <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 %]
508
        <input type="submit" value="Save" />
509
        [% IF (suggestionid) %]
510
            <a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=[% booksellerid %]&amp;basketno=[% basketno %]">Cancel</a>
511
        [% ELSE %]
512
            <a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=[% basketno %]">Cancel</a>
513
        [% END %]
511
    </fieldset>
514
    </fieldset>
512
</form>
515
</form>
513
</div>
516
</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 35-82 Link Here
35
        [% seriestitle %]</li>
73
        [% seriestitle %]</li>
36
    </ol>
74
    </ol>
37
	</fieldset>
75
	</fieldset>
38
    [% IF ( items ) %]
76
    [% IF (AcqCreateItemReceiving) %]
39
    <fieldset class="rows">
77
        <div id="items_list" style="display:none">
40
        <legend>Item</legend>
78
            <p><b>Items list</b></p>
41
        [% IF ( NoACQframework ) %]
79
            <div style="width:100%;overflow:auto;">
42
            <p class="required">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</p>
80
                <table>
43
        [% END %]
81
                    <thead>
82
                        <tr>
83
                            <th>&nbsp;</th>
84
                            <th>&nbsp;</th>
85
                            <th>Barcode</th>
86
                            <th>Home branch</th>
87
                            <th>Holding branch</th>
88
                            <th>Not for loan</th>
89
                            <th>Restricted</th>
90
                            <th>Location</th>
91
                            <th>Call number</th>
92
                            <th>Copy number</th>
93
                            <th>Stock number</th>
94
                            <th>Collection code</th>
95
                            <th>Item type</th>
96
                            <th>Materials</th>
97
                            <th>Notes</th>
98
                        </tr>
99
                    </thead>
100
                    <tbody>
101
                    </tbody>
102
                </table>
103
            </div>
104
        </div>
44
105
45
        [% FOREACH item IN items %]
106
        <fieldset class="rows" id="itemfieldset">
46
        <div id="outeritemblock">
107
            <legend>Item</legend>
47
        <div id="itemblock">
108
            [% IF ( NoACQframework ) %]
48
            <ol>[% FOREACH iteminformatio IN item.iteminformation %]<li style="[% iteminformatio.hidden %];">
109
                <p class="required">
49
                <div class="subfield_line" id="subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
110
                    No ACQ framework, using default. You should create a
50
                                
111
                    framework with code ACQ, the items framework would be
51
                    <label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
112
                    used
52
                    [% iteminformatio.marc_value %]
113
                </p>
53
                    <input type="hidden" name="itemid" value="1" />
54
                    <input type="hidden" name="kohafield" value="[% iteminformatio.kohafield %]" />
55
                    <input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
56
                    <input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
57
                    <input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
58
                    [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
59
                        <span class="buttonPlus" onclick="CloneSubfield('subfield[% iteminformatio.serialid %][% iteminformatio.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
60
                    [% END %]
61
            
62
                </div></li>
63
            [% END %]
114
            [% END %]
64
            </ol>
115
            <div id="outeritemblock"></div>
65
            <a class="addItem" onclick="cloneItemBlock('itemblock[% item.itemBlockIndex %]')">Add</a>
116
        </fieldset>
66
            <a class="delItem" style="display:none;" onclick="deleteItemBlock('itemblock[% item.itemBlockIndex %]')">Delete</a>
117
    [% END %][%# IF (AcqCreateItemReceiving) %]
67
        </div><!-- /iteminformation -->
68
        </div>
69
        
70
        <input type="hidden" name="moditem" value="" /> 
71
        <input type="hidden" name="tag" value="[% item.itemtagfield %]" />
72
        <input type="hidden" name="subfield" value="[% item.itemtagsubfield %]" />
73
        <input type="hidden" name="serial" value="[% item.serialid %]" />
74
        <input type="hidden" name="bibnum" value="[% item.biblionumber %]" />
75
        <input type="hidden" name="itemid" value="1" />
76
        <input type="hidden" name="field_value" value="[% item.itemnumber %]" />
77
        [% END %] <!-- /items -->
78
    </fieldset>
79
    [% END %] <!-- items -->
80
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
118
    <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
81
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
119
    <input type="hidden" name="ordernumber" value="[% ordernumber %]" />
82
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
120
    <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" />
Lines 94-105 Link Here
94
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
132
       <li><label for="creator">Created by: </label><span> [% IF ( memberfirstname and membersurname ) %][% IF ( memberfirstname ) %][% memberfirstname %][% END %] [% membersurname %][% ELSE %]No name[% END %]</span></li>
95
       <li><label for="quantityto">Quantity to receive: </label><span class="label">
133
       <li><label for="quantityto">Quantity to receive: </label><span class="label">
96
           [% IF ( edit ) %]
134
           [% IF ( edit ) %]
97
               <input type="text" name="quantity" value="[% quantity %]" />
135
               <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
98
           [% ELSE %]
136
           [% ELSE %]
99
               <input type="text" READONLY name="quantity" value="[% quantity %]" />
137
               <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity %]" />
100
           [% END %]
138
           [% END %]
101
           </span></li>
139
           </span></li>
102
        <li><label for="quantity">Quantity received: </label>
140
        <li><label for="quantity">Quantity received: </label>
141
          [% IF (AcqCreateItemReceiving) %]
142
            <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
143
          [% ELSE %]
103
            [% IF ( quantityreceived ) %]
144
            [% IF ( quantityreceived ) %]
104
                [% IF ( edit ) %]
145
                [% IF ( edit ) %]
105
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
146
                    <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived %]" />
Lines 120-125 Link Here
120
                [% END %]
161
                [% END %]
121
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
162
                <input id="origquantityrec" READONLY type="hidden" name="origquantityrec" value="0" />
122
            [% END %]
163
            [% END %]
164
          [% END %][%# IF (AcqCreateItemReceiving) %]
123
		</li>
165
		</li>
124
        <li><label for="rrp">Replacement cost: </label><input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /></li>
166
        <li><label for="rrp">Replacement cost: </label><input type="text" size="20" name="rrp" id="rrp" value="[% rrp %]" /></li>
125
        <li><label for="ecost">Budgeted cost: </label><input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" /></li>
167
        <li><label for="ecost">Budgeted cost: </label><input type="text" size="20" name="ecost" id="ecost" value="[% ecost %]" /></li>
Lines 135-141 Link Here
135
177
136
</div>
178
</div>
137
</div><div class="yui-g"><fieldset class="action">
179
</div><div class="yui-g"><fieldset class="action">
138
        <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?supplierid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
180
        <input type="submit"  value="Save" />
181
        <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?supplierid=[% supplierid %]&amp;invoice=[% invoice %]&amp;gst=[% gst %]&amp;freight=[% freight %]">Cancel</a>
139
</fieldset></div>    </form>
182
</fieldset></div>    </form>
140
[% ELSE %]
183
[% ELSE %]
141
<div id="acqui_acquire_orderlist">
184
<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 (+25 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>
25
(-)a/services/itemrecorddisplay.pl (-1 / +58 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::Biblio;
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;
58

Return to bug 7178