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

(-)a/acqui/addorder.pl (-1 / +10 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");
159
161
160
# create, modify or delete biblio
162
# create, modify or delete biblio
161
# create if $quantity>=0 and $existing='no'
163
# create if $quantity>=0 and $existing='no'
Lines 205-211 if ( $orderinfo->{quantity} ne '0' ) { Link Here
205
        ModOrder( $orderinfo);
207
        ModOrder( $orderinfo);
206
    }
208
    }
207
    else { # else, it's a new line
209
    else { # else, it's a new line
208
        @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo);
210
        my $i = 0;
211
        foreach my $budget_id (@budget_id) {        
212
            $$orderinfo{budget_id} = $budget_id;         
213
            my $quantity = @quantity[$i];
214
            $$orderinfo{quantity} = $quantity;
215
            @$orderinfo{qw(basketno ordernumber )} = NewOrder($orderinfo);
216
            $i++;
217
        }
209
    }
218
    }
210
219
211
    # now, add items if applicable
220
    # now, add items if applicable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (-30 / +87 lines)
Lines 149-154 $(document).ready(function() Link Here
149
    });
149
    });
150
//]]>
150
//]]>
151
</script>
151
</script>
152
<script language="javascript">
153
    function addRow(tableID) {
154
        var table = document.getElementById(tableID); 
155
        var rowCount = table.rows.length;
156
        var row = table.insertRow(rowCount);
157
        var cell1 = row.insertCell(0);
158
        var element1 = document.createElement("input");
159
        element1.type = "checkbox";
160
        element1.name="chkbox[]";
161
        cell1.appendChild(element1);
162
 
163
        var cell2 = row.insertCell(1);
164
        var createSelect  = "<select name='budget_id' id='budget_id'>";
165
        var createOption = "";
166
        var object1 = document.getElementById('budget_id');
167
168
        for (i = 1; i < object1.options.length; i++) {
169
             createOption =  createOption + "<option value ='" + object1.options[i].value+"'>"+object1.options[i].text + "</option>";
170
  
171
        }
172
173
        createSelect   = createSelect + createOption + "</select>";
174
        cell2.innerHTML = createSelect;
175
        var cell3 = row.insertCell(2);
176
        var element2 = document.createElement("input");
177
        element2.type = "text";
178
        element2.name = "quantity";
179
        element2.id="quantity";
180
        element2.value = 1;
181
        cell3.appendChild(element2); 
182
        }
183
 
184
        function deleteRow(tableID) {
185
            try {
186
                    var table = document.getElementById(tableID);
187
                    var rowCount = table.rows.length;
188
                    if (rowCount == 2) {
189
                        alert ("Can not delete , all the funds and quantity, at least one should be there");
190
                        return;
191
                    }
192
 
193
        for(var i=0; i<rowCount; i++) {
194
            var row = table.rows[i];
195
            var chkbox = row.cells[0].childNodes[0];
196
            if(null != chkbox && true == chkbox.checked) {
197
                    table.deleteRow(i);
198
                    rowCount--;
199
                    i--;
200
            } 
201
         }
202
         }  catch(e) {
203
            alert(e);
204
            }
205
        } 
206
</script>
152
</head>
207
</head>
153
<body id="acq_neworderempty" class="acq">
208
<body id="acq_neworderempty" class="acq">
154
209
Lines 391-403 $(document).ready(function() Link Here
391
    [% END %][%# IF (AcqCreateItemOrdering) %]
446
    [% END %][%# IF (AcqCreateItemOrdering) %]
392
    <fieldset class="rows">
447
    <fieldset class="rows">
393
        <legend>Accounting Details</legend>
448
        <legend>Accounting Details</legend>
394
        <ol>
449
        <ol>[% IF ( biblionumber ) %] [% ELSE %]             
395
            <li>
450
        <input type="button" value="Add fund and quantity" onclick="addRow('dataTable')" />
396
                [% IF ( close ) %]
451
        <input type="button" value="Delete fund and quantity" onclick="deleteRow('dataTable')" />
397
            <span class="label required">Quantity: </span>
452
        [% END %]                
453
        <table id="dataTable" width="350px" border="1">
454
        <tr>
455
        <td></td>
456
        <td><label class="required" for="budget_id">Fund: </label></td>
457
        <td><label class="required" for="quantity">Quantity: </label></td>
458
        </tr>
459
        <tr>
460
            <td><input type="checkbox" name="chk"/></td>
461
            <td> [% IF ( close ) %]            
462
                    <input type="hidden" size="20" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %]
463
                [% ELSE %]                
464
                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
465
                    <option value="">Select a budget</option>
466
                [% FOREACH budget_loo IN budget_loop %]
467
                    [% IF ( budget_loo.b_sel ) %]
468
                        <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option>
469
                    [% ELSE %]
470
                        [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option>
471
                        [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %]</option>
472
                        [% END %]
473
                    [% END %]
474
                [% END %]
475
                </select> [% END %]</td>
476
            <td> [% IF ( close ) %]            
398
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
477
                    <input type="hidden" size="20" name="quantity" value="[% quantity %]" />[% quantity %]
399
                [% ELSE %]
478
                [% ELSE %]                    
400
                    <label class="required" for="quantity">Quantity: </label>
401
                    [% IF (AcqCreateItemOrdering) %]
479
                    [% IF (AcqCreateItemOrdering) %]
402
                        [% IF subscriptionid %]
480
                        [% IF subscriptionid %]
403
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
481
                            <input type="text" readonly="readonly" size="20" id="quantity" name="quantity" value="1" />
Lines 413-441 $(document).ready(function() Link Here
413
                    [% END %]
491
                    [% END %]
414
                [% END %]
492
                [% END %]
415
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
493
                <!-- 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" />
494
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" /></td>
417
            </li>
495
        </tr>
418
            <li>
496
        </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>
497
            </li>
440
		<li>
498
		<li>
441
                [% IF ( close ) %]
499
                [% IF ( close ) %]
442
- 

Return to bug 10209