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

(-)a/acqui/addorder.pl (-1 / +17 lines)
Lines 156-161 $orderinfo->{'uncertainprice'} ||= 0; Link Here
156
$orderinfo->{subscriptionid} ||= undef;
156
$orderinfo->{subscriptionid} ||= undef;
157
157
158
my $user = $input->remote_user;
158
my $user = $input->remote_user;
159
my $budget_id = $input->param('budget_id');
160
my $quantity = $input->param('quantity');
161
my $max_budget = $input->param('max_budget');
159
162
160
# create, modify or delete biblio
163
# create, modify or delete biblio
161
# create if $quantity>=0 and $existing='no'
164
# create if $quantity>=0 and $existing='no'
Lines 204-211 if ( $orderinfo->{quantity} ne '0' ) { Link Here
204
    if ($$orderinfo{ordernumber}) {
207
    if ($$orderinfo{ordernumber}) {
205
        ModOrder( $orderinfo);
208
        ModOrder( $orderinfo);
206
    }
209
    }
207
    else { # else, it's a new line
210
    else { # else, it's a new line        
211
        $orderinfo->{budget_id} = $budget_id;             
212
        $orderinfo->{quantity} = $quantity;
208
        @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo);
213
        @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo);
214
        
215
        for (my $j = 2; $j <= $max_budget; $j++) {                   
216
            my $b = $input->param("b"."$j");           
217
            my $q = $input->param("q"."$j");           
218
            if (defined $b) {
219
                $orderinfo->{budget_id} = $b;         
220
                $orderinfo->{quantity} = $q;
221
                @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo);         
222
           }
223
        }
224
        
209
    }
225
    }
210
226
211
    # now, add items if applicable
227
    # now, add items if applicable
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js (+1 lines)
Lines 14-19 function addItem( node, unique_item_fields ) { Link Here
14
            addItemInList(index, unique_item_fields);
14
            addItemInList(index, unique_item_fields);
15
            $("#" + index).find("a[name='buttonPlus']").text("Update");
15
            $("#" + index).find("a[name='buttonPlus']").text("Update");
16
            $("#quantity").val(current_qty + 1).change();
16
            $("#quantity").val(current_qty + 1).change();
17
	    document.getElementById("quantity").readOnly = false;
17
        } else if ( current_qty >= max_qty ) {
18
        } else if ( current_qty >= max_qty ) {
18
            alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS
19
            alert(window.MSG_ADDITEM_JS_CANT_RECEIVE_MORE_ITEMS
19
                || "You can't receive any more items.");
20
                || "You can't receive any more items.");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-30 / +97 lines)
Lines 149-154 $(document).ready(function() Link Here
149
    });
149
    });
150
//]]>
150
//]]>
151
</script>
151
</script>
152
<script language="javascript">
153
    var maximum_budget = 1;
154
    
155
    function addRow(tableID) {
156
        maximum_budget++;        
157
        document.getElementById('max_budget').value = maximum_budget;                
158
        var table = document.getElementById(tableID); 
159
        var rowCount = table.rows.length;
160
        var row = table.insertRow(rowCount);
161
        var cell1 = row.insertCell(0);
162
        var element1 = document.createElement("input");
163
        element1.type = "checkbox";
164
        element1.name="chkbox[]";
165
        cell1.appendChild(element1);
166
 
167
        var cell2 = row.insertCell(1);
168
        var b_id = 'b' + maximum_budget;
169
        var createSelect  = "<select name='" + b_id +"'"+ "id='" + b_id +"'>";
170
        var createOption = "";
171
        var object1 = document.getElementById('budget_id');               
172
        for (i = 1; i < object1.options.length; i++) {
173
            createOption =  createOption + "<option value ='" + object1.options[i].value+"'>"+object1.options[i].text + "</option>";
174
  
175
        }
176
        
177
        createSelect   = createSelect + createOption + "</select>";
178
        cell2.innerHTML = createSelect;
179
        var cell3 = row.insertCell(2);
180
        var element2 = document.createElement("input");        
181
        var q_id = 'q' + maximum_budget;
182
        element2.type = "text";
183
        element2.name = q_id;
184
        element2.id= q_id;
185
        element2.value = 1;
186
        cell3.appendChild(element2);         
187
        }
188
 
189
        function deleteRow(tableID) {
190
            try {
191
                    var table = document.getElementById(tableID);
192
                    var rowCount = table.rows.length;
193
                    var checkedRowCount = 1;
194
                    for(var i=0; i<rowCount; i++) {
195
                        var row = table.rows[i];
196
                        var chkbox = row.cells[0].childNodes[0];
197
                        if(null != chkbox && true == chkbox.checked) {
198
                            checkedRowCount ++;
199
                        }
200
                    }                   
201
       
202
        for(var i=0; i<rowCount; i++) {
203
            var row = table.rows[i];
204
            var chkbox = row.cells[0].childNodes[0];
205
            if(null != chkbox && true == chkbox.checked) {
206
                    table.deleteRow(i);
207
                    rowCount--;
208
                    i--;
209
            } 
210
        }
211
        } catch(e) {
212
            alert(e);
213
          }
214
        } 
215
</script>
152
</head>
216
</head>
153
<body id="acq_neworderempty" class="acq">
217
<body id="acq_neworderempty" class="acq">
154
218
Lines 391-403 $(document).ready(function() Link Here
391
    [% END %][%# IF (AcqCreateItemOrdering) %]
455
    [% END %][%# IF (AcqCreateItemOrdering) %]
392
    <fieldset class="rows">
456
    <fieldset class="rows">
393
        <legend>Accounting Details</legend>
457
        <legend>Accounting Details</legend>
394
        <ol>
458
        <ol>[% IF ( biblionumber ) %] [% ELSE %]             
395
            <li>
459
        <input type="button" value="Add fund and quantity" onclick="addRow('dataTable')" />
396
                [% IF ( close ) %]
460
        <input type="button" value="Delete fund and quantity" onclick="deleteRow('dataTable')" />
397
            <span class="label required">Quantity: </span>
461
        <input type="hidden" size="20" name="max_budget" id ="max_budget" value= 1 />
462
        [% END %]                
463
        <table id="dataTable" width="350px" border="1">
464
        <tr>
465
        <td></td>
466
        <td><label class="required" for="budget_id">Fund: </label></td>
467
        <td><label class="required" for="quantity">Quantity: </label></td>
468
        </tr>
469
        <tr>
470
            <td>&nbsp;&nbsp;&nbsp;</td>           
471
            <td> [% IF ( close ) %]            
472
                    <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
473
                [% ELSE %]                
474
                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
475
                    <option value="">Select a budget</option>
476
                [% FOREACH budget_loo IN budget_loop %]
477
                    [% IF ( budget_loo.b_sel ) %]
478
                        <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
479
                    [% ELSE %]
480
                        [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
481
                        [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option>
482
                        [% END %]
483
                    [% END %]
484
                [% END %]
485
                </select> [% END %]</td>
486
            <td> [% IF ( close ) %]            
398
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
487
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
399
                [% ELSE %]
488
                [% ELSE %]                    
400
                    <label class="required" for="quantity">Quantity: </label>
401
                    [% IF (AcqCreateItemOrdering) %]
489
                    [% IF (AcqCreateItemOrdering) %]
402
                        [% IF subscriptionid %]
490
                        [% IF subscriptionid %]
403
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
491
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
Lines 413-441 $(document).ready(function() Link Here
413
                    [% END %]
501
                    [% END %]
414
                [% END %]
502
                [% END %]
415
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
503
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
416
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
504
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" /></td>
417
            </li>
505
        </tr>
418
            <li>
506
        </table>
419
                [% IF ( close ) %]
420
            <span class="label required">Fund: </span>
421
                    <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
422
                [% ELSE %]
423
                <label class="required" for="budget_id">Fund: </label>
424
                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
425
                        <option value="">Select a budget</option>
426
                [% FOREACH budget_loo IN budget_loop %]
427
                    [% IF ( budget_loo.b_sel ) %]
428
                        <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
429
                    [% ELSE %]
430
                        [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
431
                        [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option>
432
                        [% END %]
433
                    [% END %]
434
                [% END %]
435
                </select>
436
                <label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
437
                <input type="checkbox" id="showallbudgets" />
438
                [% END %]
439
            </li>
507
            </li>
440
		<li>
508
		<li>
441
                [% IF ( close ) %]
509
                [% IF ( close ) %]
442
- 

Return to bug 10209