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

(-)a/C4/Biblio.pm (+28 lines)
Lines 3479-3484 sub get_biblio_authorised_values { Link Here
3479
    return $authorised_values;
3479
    return $authorised_values;
3480
}
3480
}
3481
3481
3482
=head3 GetMarcPrice
3483
3484
return the prices in accordance with the Marc format.
3485
=cut
3486
3487
sub GetMarcPrice {
3488
    my ( $record, $marcflavour ) = @_;
3489
    my @listtags;
3490
    my $subfield;
3491
    
3492
    if ( $marcflavour eq "MARC21" ) {
3493
        @listtags = ('345', '010');
3494
        $subfield="c";
3495
    } elsif ( $marcflavour eq "UNIMARC" ) {    # assume unimarc if not marc21
3496
        @listtags = ('345', '010');
3497
        $subfield="d";
3498
    } else {
3499
        return;
3500
    }
3501
    
3502
    for my $field ( $record->field(@listtags) ) {
3503
        for my $subfield_value  ($field->subfields($subfield)){
3504
            #check value
3505
            return $subfield_value if ($subfield_value);
3506
        }
3507
    }
3508
}
3509
3482
1;
3510
1;
3483
3511
3484
__END__
3512
__END__
(-)a/C4/Output.pm (+2 lines)
Lines 33-38 use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language Link Here
33
use C4::Dates qw(format_date);
33
use C4::Dates qw(format_date);
34
use C4::Budgets qw(GetCurrency);
34
use C4::Budgets qw(GetCurrency);
35
35
36
37
36
use HTML::Template::Pro;
38
use HTML::Template::Pro;
37
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
39
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
38
40
(-)a/acqui/addorderiso2709.pl (-7 / +92 lines)
Lines 25-30 Link Here
25
use strict;
25
use strict;
26
use warnings;
26
use warnings;
27
use CGI;
27
use CGI;
28
use Number::Format qw(:all);
29
28
use C4::Context;
30
use C4::Context;
29
use C4::Auth;
31
use C4::Auth;
30
use C4::Input;
32
use C4::Input;
Lines 36-45 use C4::Acquisition qw/NewOrder/; Link Here
36
use C4::Biblio;
38
use C4::Biblio;
37
use C4::Items;
39
use C4::Items;
38
use C4::Koha qw/GetItemTypes/;
40
use C4::Koha qw/GetItemTypes/;
39
use C4::Budgets qw/GetBudgets/;
40
use C4::Acquisition qw/NewOrderItem GetBasket/;
41
use C4::Acquisition qw/NewOrderItem GetBasket/;
42
use C4::Budgets qw/GetBudgets GetBudgetHierarchy/;
41
use C4::Bookseller qw/GetBookSellerFromId/;
43
use C4::Bookseller qw/GetBookSellerFromId/;
42
44
45
46
use C4::Dates;
47
use C4::Suggestions;    # GetSuggestion
48
use C4::Branch;         # GetBranches
49
use C4::Members;
50
#needed for z3950 import:
51
use C4::ImportBatch qw/GetImportRecordMarc SetImportRecordStatus/;
52
use C4::Acquisition;
53
use C4::Koha;
54
use C4::Budgets;
55
use C4::Acquisition;
56
use C4::Bookseller;
57
43
my $input = new CGI;
58
my $input = new CGI;
44
my ($template, $loggedinuser, $cookie) = get_template_and_user({
59
my ($template, $loggedinuser, $cookie) = get_template_and_user({
45
                                        template_name => "acqui/addorderiso2709.tmpl",
60
                                        template_name => "acqui/addorderiso2709.tmpl",
Lines 52-57 my ($template, $loggedinuser, $cookie) = get_template_and_user({ Link Here
52
my $cgiparams = $input->Vars;
67
my $cgiparams = $input->Vars;
53
my $op = $cgiparams->{'op'};
68
my $op = $cgiparams->{'op'};
54
my $booksellerid  = $input->param('booksellerid');
69
my $booksellerid  = $input->param('booksellerid');
70
my $close        = $input->param('close');
71
my $data;
55
my $bookseller = GetBookSellerFromId($booksellerid);
72
my $bookseller = GetBookSellerFromId($booksellerid);
56
73
57
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl",
74
$template->param(scriptname => "/cgi-bin/koha/acqui/addorderiso2709.pl",
Lines 80-85 if ($op eq ""){ Link Here
80
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
97
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
81
    
98
    
82
} elsif ($op eq 'import_records'){
99
} elsif ($op eq 'import_records'){
100
    my $num=FormatNumber();
83
#import selected lines
101
#import selected lines
84
    $template->param('basketno' => $cgiparams->{'basketno'});
102
    $template->param('basketno' => $cgiparams->{'basketno'});
85
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards
103
# Budget_id is mandatory for adding an order, we just add a default, the user needs to modify this aftewards
Lines 119-124 if ($op eq ""){ Link Here
119
                    }
137
                    }
120
                }
138
                }
121
139
140
                $price= GetMarcPrice($marcrecord);
141
                if ($price){
142
                    $price = $num->unformat_number($price);
143
                }
144
122
                ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
145
                ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $cgiparams->{'frameworkcode'} || '' );
123
            } else {
146
            } else {
124
                warn("Duplicate item found: ", $biblionumber, "; Duplicate: ", $duplicatetitle);
147
                warn("Duplicate item found: ", $biblionumber, "; Duplicate: ", $duplicatetitle);
Lines 171-176 if ($op eq ""){ Link Here
171
              }
194
              }
172
              $orderinfo{'rrp'} = $orderinfo{'listprice'};
195
              $orderinfo{'rrp'} = $orderinfo{'listprice'};
173
            }
196
            }
197
174
            # remove uncertainprice flag if we have found a price in the MARC record
198
            # remove uncertainprice flag if we have found a price in the MARC record
175
            $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
199
            $orderinfo{uncertainprice} = 0 if $orderinfo{listprice};
176
            my $basketno;
200
            my $basketno;
Lines 237-242 if ($op eq ""){ Link Here
237
    print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'});
261
    print $input->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=".$cgiparams->{'basketno'});
238
    exit;
262
    exit;
239
}
263
}
264
265
my $budgets = GetBudgets();
266
my $budget_id = @$budgets[0]->{'budget_id'};
267
# build bookfund list
268
my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
269
my ( $flags, $homebranch ) = ( $borrower->{'flags'}, $borrower->{'branchcode'} );
270
my $budget = GetBudget($budget_id);
271
272
# build budget list
273
my $budget_loop = [];
274
my $budgets = GetBudgetHierarchy( q{}, $borrower->{branchcode}, $borrower->{borrowernumber} );
275
foreach my $r ( @{$budgets} ) {
276
    if ( !defined $r->{budget_amount} || $r->{budget_amount} == 0 ) {
277
        next;
278
    }
279
    push @{$budget_loop},
280
      { b_id  => $r->{budget_id},
281
        b_txt => $r->{budget_name},
282
        b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
283
      };
284
}   
285
#warn Data::Dumper::Dumper($budget_loop);
286
$template->param( budget_loop    => $budget_loop,);   
287
288
my $CGIsort1;
289
if ($budget) {    # its a mod ..
290
    if ( defined $budget->{'sort1_authcat'} ) {    # with custom  Asort* planning values
291
        $CGIsort1 = GetAuthvalueDropbox( 'sort1', $budget->{'sort1_authcat'}, $data->{'sort1'} );
292
    }
293
} elsif ( scalar(@$budgets) ) {
294
    $CGIsort1 = GetAuthvalueDropbox( 'sort1', @$budgets[0]->{'sort1_authcat'}, '' );
295
} else {
296
    $CGIsort1 = GetAuthvalueDropbox( 'sort1', '', '' );
297
}
298
299
# if CGIsort is successfully fetched, the use it
300
# else - failback to plain input-field
301
if ($CGIsort1) {
302
    $template->param( CGIsort1 => $CGIsort1 );
303
} else {
304
    $template->param( sort1 => $data->{'sort1'} );
305
}
306
307
my $CGIsort2;
308
if ($budget) {
309
    if ( defined $budget->{'sort2_authcat'} ) {
310
        $CGIsort2 = GetAuthvalueDropbox( 'sort2', $budget->{'sort2_authcat'}, $data->{'sort2'} );
311
    }
312
} elsif ( scalar(@$budgets) ) {
313
    $CGIsort2 = GetAuthvalueDropbox( 'sort2', @$budgets[0]->{sort2_authcat}, '' );
314
} else {
315
    $CGIsort2 = GetAuthvalueDropbox( 'sort2', '', '' );
316
}
317
318
if ($CGIsort2) {
319
    $template->param( CGIsort2 => $CGIsort2 );
320
} else {
321
    $template->param( sort2 => $data->{'sort2'} );
322
}
323
240
output_html_with_http_headers $input, $cookie, $template->output;
324
output_html_with_http_headers $input, $cookie, $template->output;
241
325
242
326
Lines 268-279 sub import_biblios_list { Link Here
268
    my $batch = GetImportBatch($import_batch_id,'staged');
352
    my $batch = GetImportBatch($import_batch_id,'staged');
269
    my $biblios = GetImportBibliosRange($import_batch_id,'','','staged');
353
    my $biblios = GetImportBibliosRange($import_batch_id,'','','staged');
270
    my @list = ();
354
    my @list = ();
271
# # Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards
355
272
#     my $itemtypehash = GetItemTypes();
356
    # # Itemtype is mandatory for adding a biblioitem, we just add a default, the user needs to modify this aftewards
273
#     my @itemtypes;
357
    #     my $itemtypehash = GetItemTypes();
274
#     for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) {
358
    #     my @itemtypes;
275
#         push(@itemtypes, $itemtypehash->{$key});
359
    #     for my $key (sort { $itemtypehash->{$a}->{description} cmp $itemtypehash->{$b}->{description} } keys %$itemtypehash) {
276
#     }
360
    #         push(@itemtypes, $itemtypehash->{$key});
361
    #     }
277
    foreach my $biblio (@$biblios) {
362
    foreach my $biblio (@$biblios) {
278
        my $citation = $biblio->{'title'};
363
        my $citation = $biblio->{'title'};
279
        $citation .= " $biblio->{'author'}" if $biblio->{'author'};
364
        $citation .= " $biblio->{'author'}" if $biblio->{'author'};
(-)a/acqui/neworderempty.pl (+1 lines)
Lines 69-74 the item's id in the breeding reservoir Link Here
69
use warnings;
69
use warnings;
70
use strict;
70
use strict;
71
use CGI;
71
use CGI;
72
72
use C4::Context;
73
use C4::Context;
73
use C4::Input;
74
use C4::Input;
74
75
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/addorderiso2709.tmpl (-2 / +122 lines)
Lines 8-13 Link Here
8
</title>
8
</title>
9
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
9
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
10
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
10
<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
11
<script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script>
11
<script type="text/JavaScript">
12
<script type="text/JavaScript">
12
//<![CDATA[
13
//<![CDATA[
13
    $(document).ready(function() {
14
    $(document).ready(function() {
Lines 54-59 Link Here
54
                             </td>
55
                             </td>
55
                             <td><!-- TMPL_VAR name="overlay_status"--></td>
56
                             <td><!-- TMPL_VAR name="overlay_status"--></td>
56
                             <td><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!--TMPL_VAR name="booksellerid" -->&amp;basketno=<!-- TMPL_VAR name="basketno" -->&amp;booksellerid=<!-- TMPL_VAR name="booksellerid" -->&amp;breedingid=<!-- TMPL_VAR name="import_record_id" -->&amp;import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->">Add order</a></td>
57
                             <td><a href="/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!--TMPL_VAR name="booksellerid" -->&amp;basketno=<!-- TMPL_VAR name="basketno" -->&amp;booksellerid=<!-- TMPL_VAR name="booksellerid" -->&amp;breedingid=<!-- TMPL_VAR name="import_record_id" -->&amp;import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->">Add order</a></td>
58
                             <td><input type="text" name="price" value="<!-- TMPL_VAR NAME="price" -->" /><td />
57
                         </tr>
59
                         </tr>
58
                         <!-- TMPL_IF name="match_biblionumber" -->
60
                         <!-- TMPL_IF name="match_biblionumber" -->
59
                           <tr>
61
                           <tr>
Lines 63-69 Link Here
63
                         <!-- /TMPL_IF -->
65
                         <!-- /TMPL_IF -->
64
                       <!-- /TMPL_LOOP -->
66
                       <!-- /TMPL_LOOP -->
65
                     </table>
67
                     </table>
66
                     <input type="button" value="Save" onclick="this.form.submit()" />
68
                     <input type="button" value="Save" onclick="this.form.submit()" /><input type="button" value="Select all" onclick="javascript:document.location.href='/cgi-bin/koha/acqui/neworderempty.pl?booksellerid=<!--TMPL_VAR name="booksellerid" -->&amp;basketno=<!-- TMPL_VAR name="basketno" -->&amp;booksellerid=<!-- TMPL_VAR name="booksellerid" -->&amp;breedingid=<!-- TMPL_VAR name="import_record_id" -->&amp;import_batch_id=<!-- TMPL_VAR name="import_batch_id" -->'" />
69
                   
67
                   </form>
70
                   </form>
68
               </div>
71
               </div>
69
              <!-- TMPL_IF name="pages" -->
72
              <!-- TMPL_IF name="pages" -->
Lines 109-113 Link Here
109
       </div>
112
       </div>
110
   </div>
113
   </div>
111
</div>
114
</div>
115
116
<div class="yui-t2">
117
<h2>Import All</h2>
118
<form action="/cgi-bin/koha/acqui/addorder.pl" method="post" id="Aform">
119
120
<!-- TMPL_UNLESS name="existing" -->
121
        <input type="hidden" name="existing" value="no" />
122
        <!-- /TMPL_UNLESS -->
123
        <input type="hidden" name="ordernumber" value="<!-- TMPL_VAR NAME="ordernumber" -->" />
124
        <input type="hidden" name="basketno" value="<!-- TMPL_VAR NAME="basketno" -->" />
125
        <input type="hidden" name="booksellerid" value="<!-- TMPL_VAR NAME="booksellerid" -->" />
126
        <input type="hidden" name="biblionumber" value="<!-- TMPL_VAR NAME="biblionumber" -->" />
127
        <input type="hidden" name="biblioitemnumber" value="<!-- TMPL_VAR NAME="biblioitemnumber" -->" />
128
        <input type="hidden" name="discount" value="<!-- TMPL_VAR NAME="discount" -->" />
129
        <input type="hidden" name="listinc" value="<!-- TMPL_VAR NAME="listincgst" -->" />
130
        <input type="hidden" name="currency" value="<!-- TMPL_VAR NAME="currency" -->" />
131
        <input type="hidden" name="applygst" value="<!-- TMPL_VAR NAME="gstreg" -->" />
132
        <input type="hidden" name="invoiceincgst" value="<!-- TMPL_VAR NAME="invoiceincgst" -->" />
133
        <input type="hidden" name="gstrate" value="<!-- TMPL_VAR NAME="gstrate" -->" />
134
        <input type="hidden" name="suggestionid" value="<!-- TMPL_VAR NAME="suggestionid" -->" />
135
        <input type="hidden" name="import_batch_id" value="<!-- TMPL_VAR name="import_batch_id" -->" />
136
137
        <!-- TMPL_LOOP NAME="loop_currencies" -->
138
            <input type="hidden" name="<!-- TMPL_VAR NAME="currency" -->" value="<!-- TMPL_VAR NAME="rate" -->" />
139
        <!-- /TMPL_LOOP -->
140
141
    <!-- TMPL_IF name="items" -->
142
    <fieldset class="rows">
143
        <legend>Item</legend>
144
        <!-- TMPL_IF name="NoACQframework" -->
145
            <div class="dialog message">No ACQ framework, using default. You should create a framework with code ACQ, the items framework would be used</div>
146
        <!-- /TMPL_IF -->
147
148
        <!-- TMPL_LOOP NAME="items" -->
149
        <div id="outeritemblock">
150
        <div id="itemblock">
151
            <ol><!-- TMPL_LOOP NAME="iteminformation" --><li>
152
                <div class="subfield_line" style="<!-- TMPL_VAR NAME='hidden' -->;" id="subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->">
153
154
                    <label><!-- TMPL_VAR NAME="subfield" --> - <!-- TMPL_IF name="mandatory" --><b><!-- /TMPL_IF --><!-- TMPL_VAR NAME="marc_lib" --><!-- TMPL_IF name="mandatory" --> *</b><!-- /TMPL_IF --></label>
155
                    <!-- TMPL_VAR NAME="marc_value" -->
156
                    <input type="hidden" name="itemid" value="1" />
157
                    <input type="hidden" name="kohafield" value="<!-- TMPL_VAR NAME="kohafield" -->" />
158
                    <input type="hidden" name="tag" value="<!-- TMPL_VAR NAME="tag" -->" />
159
                    <input type="hidden" name="subfield" value="<!-- TMPL_VAR NAME="subfield" -->" />
160
                    <input type="hidden" name="mandatory" value="<!-- TMPL_VAR NAME="mandatory" -->" />
161
                    <!-- TMPL_IF NAME="ITEM_SUBFIELDS_ARE_NOT_REPEATABLE" -->
162
                        <span class="buttonPlus" onclick="CloneSubfield('subfield<!-- TMPL_VAR NAME='serialid' --><!-- TMPL_VAR NAME='countitems' --><!-- TMPL_VAR NAME='subfield' --><!-- TMPL_VAR name="random" -->')">+</span>
163
                    <!-- /TMPL_IF -->
164
165
                </div></li>
166
            <!-- /TMPL_LOOP-->
167
            </ol>
168
            <a style="cursor: pointer; color: grey; font-size: 180%;" onclick="cloneItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">+</a>
169
            <a style="display:none; cursor: pointer; color: grey; font-size: 180%;" onclick="deleteItemBlock('itemblock<!-- TMPL_VAR name="itemBlockIndex" -->')">-</a>
170
        </div><!-- /iteminformation -->
171
        </div>
172
173
        <!--/TMPL_LOOP--> <!-- /items -->
174
    </fieldset>
175
    <!-- /TMPL_IF --> <!-- items -->
176
    <fieldset class="rows">
177
        <legend>Accounting Details</legend>
178
        <ol>
179
            <li>
180
                <!-- origquantityrec only here for javascript compatibility (additem.js needs it, useless here, usefull when receiveing an order -->
181
                <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="1" />
182
            </li>
183
            <li>
184
                <!-- TMPL_IF name="close" -->
185
            <span class="label">Budget: </span>
186
                    <input type="hidden" size="20" name="budget_id" id="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" /><!-- TMPL_VAR NAME="Budget_name" -->
187
                <!-- TMPL_ELSE -->
188
                <label for="budget_id">Budget: </label>
189
                <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id">
190
                <!-- TMPL_LOOP NAME="budget_loop" -->
191
                    <!-- TMPL_IF NAME="b_sel" -->
192
                        <option value="<!-- TMPL_VAR NAME='b_id' -->" selected="selected"><!-- TMPL_VAR NAME="b_txt" --></option>
193
                    <!-- TMPL_ELSE -->
194
                        <option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
195
                    <!-- /TMPL_IF -->
196
                <!-- /TMPL_LOOP -->
197
                </select>
198
                <!--/TMPL_IF-->
199
            </li>
200
            <li>
201
                <label for="notes">Notes: </label>
202
                <textarea id="notes" cols="30" rows="3" name="notes"></textarea>
203
            </li>
204
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
205
                <label for="sort1">Planning value1: </label>
206
207
                <!-- TMPL_IF Name="CGIsort1" -->
208
                    <!-- TMPL_VAR Name="CGIsort1" -->
209
                <!-- TMPL_ELSE -->
210
211
                    <input type="text" id="sort1" size="20" name="sort1" value="<!-- TMPL_VAR NAME="sort1" -->" />
212
                <!--/TMPL_IF -->
213
            </li>
214
            <li>
215
                <label for="sort2">Planning value2: </label>
216
217
                <!-- TMPL_IF Name="CGIsort2" -->
218
                    <!-- TMPL_VAR Name="CGIsort2" -->
219
                <!-- TMPL_ELSE -->
220
                    <input type="text" id="sort2" size="20" name="sort2" value="<!-- TMPL_VAR NAME="sort2" -->" />
221
                <!--/TMPL_IF -->
222
            </li>
223
            <li>
224
                
225
            </li>
226
</ol>
227
    </fieldset>
228
    <fieldset class="action">
229
        <input type="submit" value="Save" /> <!-- TMPL_IF name="suggestionid" --><a class="cancel" href="/cgi-bin/koha/acqui/newordersuggestion.pl?booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->&amp;basketno=<!-- TMPL_VAR NAME="basketno" -->">Cancel</a><!-- TMPL_ELSE --><a class="cancel" href="/cgi-bin/koha/acqui/basket.pl?basketno=<!-- TMPL_VAR NAME="basketno" -->">Cancel</a><!-- /TMPL_IF -->
230
    </fieldset>
231
</form>
232
</div>
112
</body>
233
</body>
113
</html>
234
</html>
114
- 

Return to bug 5961