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

(-)a/C4/Acquisition.pm (-1 / +1 lines)
Lines 1210-1216 sub ModOrder { Link Here
1210
        #See report 10110 and guided_reports.pl
1210
        #See report 10110 and guided_reports.pl
1211
    my $query = "UPDATE aqorders SET ";
1211
    my $query = "UPDATE aqorders SET ";
1212
1212
1213
    foreach my $orderinfokey (grep(!/ordernumber/, keys %$orderinfo)){
1213
    foreach my $orderinfokey (keys %$orderinfo){
1214
        # ... and skip hash entries that are not in the aqorders table
1214
        # ... and skip hash entries that are not in the aqorders table
1215
        # FIXME : probably not the best way to do it (would be better to have a correct hash)
1215
        # FIXME : probably not the best way to do it (would be better to have a correct hash)
1216
        next unless grep(/^$orderinfokey$/, @$colnames);
1216
        next unless grep(/^$orderinfokey$/, @$colnames);
(-)a/acqui/neworderempty.pl (+4 lines)
Lines 357-367 my @gst_values = map { Link Here
357
    option => $_
357
    option => $_
358
}, split( '\|', C4::Context->preference("gist") );
358
}, split( '\|', C4::Context->preference("gist") );
359
359
360
360
$template->param(
361
$template->param(
361
    existing         => $biblionumber,
362
    existing         => $biblionumber,
362
    ordernumber           => $ordernumber,
363
    ordernumber           => $ordernumber,
363
    # basket informations
364
    # basket informations
364
    basketno             => $basketno,
365
    basketno             => $basketno,
366
    purchaseordernumber => $data->{purchaseordernumber},
367
    prefix           => GetAuthorisedValues('PONUMPREFIX'),
368
    enableponumber => C4::Context->preference('EnablePONumber'),
365
    basketname           => $basket->{'basketname'},
369
    basketname           => $basket->{'basketname'},
366
    basketnote           => $basket->{'note'},
370
    basketnote           => $basket->{'note'},
367
    booksellerid         => $basket->{'booksellerid'},
371
    booksellerid         => $basket->{'booksellerid'},
(-)a/acqui/poseqnextvalue.pl (+45 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) Amit Gupta (amitddng135@gmail.com)
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use strict;
21
use warnings;
22
use CGI;
23
use C4::Auth;
24
use C4::Output;
25
use JSON;
26
27
my $input = new CGI;
28
29
my $generateno = sprintf( "%0*d", "7", getnext() );
30
31
print $input->header('application/json');
32
my $json = { generateno => $generateno, };
33
my $json_text = to_json( $json, { utf8 => 1 } );
34
print $json_text;
35
36
sub getnext {
37
    my $dbh = C4::Context->dbh;
38
    # next two lines should be wrapped in a transaction
39
    $dbh->do(
40
q{UPDATE po_sequence set seq_value = seq_value + 1 where seqid = 'POSEQ'}
41
    );
42
    my @row = $dbh->selectrow_array(
43
        q{SELECT seq_value from po_sequence where seqid = 'POSEQ'});
44
    return $row[0];
45
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt (+44 lines)
Lines 144-149 $(document).ready(function() Link Here
144
    });
144
    });
145
//]]>
145
//]]>
146
</script>
146
</script>
147
<script language="Javascript" type="text/javascript">
148
    $(document).ready(function(){
149
    $('#ponumber').change(function() {
150
    $.ajax({url:"/cgi-bin/koha/acqui/poseqnextvalue.pl",
151
        type: "get",
152
        async: false,
153
        dataType: 'json',
154
        success:function(generateno) {
155
            var len =  document.getElementsByName("purchaseordernumber").length - 1;
156
            var t1 = document.getElementById('ponumber').value;
157
            var t2 = generateno.generateno;
158
            if (t1.length > 0 && t2.length > 0) {
159
                document.getElementsByName("purchaseordernumber")[len].value = t1+t2;
160
            }
161
        }});
162
    });
163
});
164
</script>
147
</head>
165
</head>
148
<body id="acq_neworderempty" class="acq">
166
<body id="acq_neworderempty" class="acq">
149
167
Lines 538-543 $(document).ready(function() Link Here
538
                <label for="notes">Notes: </label>
556
                <label for="notes">Notes: </label>
539
                <textarea id="notes" cols="30" rows="3" name="notes" >[% IF ( notes ) %][% notes %][% END %]</textarea>
557
                <textarea id="notes" cols="30" rows="3" name="notes" >[% IF ( notes ) %][% notes %][% END %]</textarea>
540
            </li>
558
            </li>
559
            [% IF enableponumber %]
560
            [% IF ( ordernumber ) %]
561
            <li>
562
                <label for="purchaseordernumber">Purchase order: </label>
563
                <input type="text" id="purchaseordernumber" size="20" name="purchaseordernumber" value="[% purchaseordernumber %]"/>
564
            </li>
565
            [% ELSE %]
566
            <li><p>Select ordernumber prefix for auto-generated purchase order number.</p></li>
567
            <li>
568
                <label for="prefix">Prefix:</label>
569
                [% IF prefix %]
570
                    <select id="ponumber" onchange="Calculatepurorderno(this.value)">
571
                    <option value="">Select</option>
572
                    [% FOREACH d IN prefix %]
573
                        <option value="[% d.authorised_value %]">[% d.lib %]</option>
574
                    [% END %]
575
                    </select>
576
                    [% ELSE %]
577
                        <span id="pordernumber">No prefix authorized values found! Please create one or more authorized values with the category PONUMPREFIX.</span>
578
                [% END %]
579
            </li>
580
                <label for="purchaseordernumber">Purchase order: </label>
581
                <input type="text" id="purchaseordernumber" size="20" name="purchaseordernumber" value="[% purchaseordernumber %]"/>
582
            </li>
583
            [% END %]
584
            [% END %]
541
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
585
            <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div>
542
                <label for="sort1">Statistic 1: </label>
586
                <label for="sort1">Statistic 1: </label>
543
                <span id="sort1_zone">
587
                <span id="sort1_zone">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +6 lines)
Lines 42-47 Acquisitions: Link Here
42
                  yes: Warn
42
                  yes: Warn
43
                  no: "Do not warn"
43
                  no: "Do not warn"
44
            - when the librarian tries to create an invoice with a duplicate number.
44
            - when the librarian tries to create an invoice with a duplicate number.
45
        -
46
            - pref: EnablePONumber
47
              choices:
48
                  yes: Enable
49
                  no: Disable
50
            - Enable purchase order number.
45
51
46
    Printing:
52
    Printing:
47
        -
53
        -
48
- 

Return to bug 4456