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

(-)a/acqui/parcels.pl (-7 / +23 lines)
Lines 98-111 our ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
98
    }
98
    }
99
);
99
);
100
100
101
my $invoicenumber = $input->param('invoice');
102
my $shipmentdate = $input->param('shipmentdate');
103
my $shipmentcost = $input->param('shipmentcost');
104
my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
105
if($shipmentdate) {
106
    $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
107
}
108
101
if($op and $op eq 'new') {
109
if($op and $op eq 'new') {
102
    my $invoicenumber = $input->param('invoice');
110
    my @invoices = GetInvoices(
103
    my $shipmentdate = $input->param('shipmentdate');
111
        supplierid => $booksellerid,
104
    my $shipmentcost = $input->param('shipmentcost');
112
        invoicenumber => $invoicenumber,
105
    my $shipmentcost_budgetid = $input->param('shipmentcost_budgetid');
113
    );
106
    if($shipmentdate) {
114
    if ($#invoices > 0 && C4::Context->preference('AcqWarnOnDuplicateInvoice')) {
107
        $shipmentdate = C4::Dates->new($shipmentdate)->output('iso');
115
        $template->{'VARS'}->{'duplicate_invoices'} = \@invoices;
116
        $template->{'VARS'}->{'invoicenumber'} = $invoicenumber;
117
        $template->{'VARS'}->{'shipmentdate'} = $shipmentdate;
118
        $template->{'VARS'}->{'shipmentcost'} = $shipmentcost;
119
        $template->{'VARS'}->{'shipmentcost_budgetid'} = $shipmentcost_budgetid;
120
    } else {
121
        $op = 'confirm';
108
    }
122
    }
123
}
124
if ($op and $op eq 'confirm') {
109
    my $invoiceid = AddInvoice(
125
    my $invoiceid = AddInvoice(
110
        invoicenumber => $invoicenumber,
126
        invoicenumber => $invoicenumber,
111
        booksellerid => $booksellerid,
127
        booksellerid => $booksellerid,
Lines 114-120 if($op and $op eq 'new') { Link Here
114
        shipmentcost_budgetid => $shipmentcost_budgetid,
130
        shipmentcost_budgetid => $shipmentcost_budgetid,
115
    );
131
    );
116
    if(defined $invoiceid) {
132
    if(defined $invoiceid) {
117
        # Successful 'Add'
133
# Successful 'Add'
118
        print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid");
134
        print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid");
119
        exit 0;
135
        exit 0;
120
    } else {
136
    } else {
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 427-429 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
427
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo');
428
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowHoldNotes',0,'Show hold notes on OPAC','','YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
429
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo');
430
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+13 lines)
Lines 6984-6989 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( Link Here
6984
}
6984
}
6985
6985
6986
6986
6987
$DBversion = "3.13.00.XXX";
6988
if ( CheckVersion($DBversion) ) {
6989
    $dbh->do(
6990
        q{
6991
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo');
6992
}
6993
    );
6994
    print
6995
"Upgrade to $DBversion done (Bug 10366 - Add system preference to enabling warning librarian when invoice is duplicated)\n";
6996
    SetVersion($DBversion);
6997
}
6998
6999
6987
=head1 FUNCTIONS
7000
=head1 FUNCTIONS
6988
7001
6989
=head2 TableExists($table)
7002
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt (-1 / +30 lines)
Lines 1-3 Link Here
1
[% USE KohaDates %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Acquisitions &rsaquo; Receive shipment from vendor [% name %]</title>
3
<title>Koha &rsaquo; Acquisitions &rsaquo; Receive shipment from vendor [% name %]</title>
3
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
4
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
Lines 38-43 Link Here
38
[% END %]
39
[% END %]
39
<h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1>
40
<h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1>
40
41
42
    [% IF duplicate_invoices %]
43
    <div id="parcels_duplicate_invoice" class="dialog alert">
44
        <p>This invoice number has already been used. Would you like to receive on an existing invoice?</p>
45
        <table>
46
            <thead><tr><th>Invoice no.</th><th>Shipment date</th><th></th></tr></thead>
47
            <tbody>
48
                [% FOREACH invoice IN duplicate_invoices %]
49
                    <tr>
50
                        <td>[% invoice.invoicenumber %]</td>
51
                        <td>[% invoice.shipmentdate | $KohaDates %]</td>
52
                        <td><a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoice.invoiceid %]">Receive</a></td>
53
                    </tr>
54
                [% END %]
55
            </tbody>
56
        </table>
57
        <form method="get" action="parcels.pl">
58
            <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
59
            <input type="hidden" name="op" value="confirm" />
60
            <input type="hidden" name="invoice" value="[% invoicenumber %]" />
61
            <input type="hidden" name="shipmentdate" value="[% shipmentdate %]" />
62
            <input type="hidden" name="shipmentcost" value="[% shipmentcost %]" />
63
            <input type="hidden" name="shipmentcost_budgetid" value="[% shipmentcost_budgetid %]" />
64
            <input type="submit" class="button" value="Create new invoice anyway" />
65
        </form>
66
    </div>
67
    [% END %]
68
69
41
[% IF ( count ) %]
70
[% IF ( count ) %]
42
<p> [% count %] shipments</p>
71
<p> [% count %] shipments</p>
43
<div id="resultlist">
72
<div id="resultlist">
Lines 107-113 Link Here
107
</div>
136
</div>
108
</div>
137
</div>
109
[% END %]
138
[% END %]
110
139
    
111
    <div id="parcels_new_parcel">
140
    <div id="parcels_new_parcel">
112
        <form method="get" action="parcels.pl">
141
        <form method="get" action="parcels.pl">
113
    <fieldset class="rows">
142
    <fieldset class="rows">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (-1 / +6 lines)
Lines 35-40 Acquisitions: Link Here
35
            - Default tax rates are
35
            - Default tax rates are
36
            - pref: gist
36
            - pref: gist
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
37
            - (enter in numeric form, 0.12 for 12%. First is the default. If you want more than 1 value, please separate with |)
38
        -
39
            - pref: AcqWarnOnDuplicateInvoice
40
              choices:
41
                  yes: Warn
42
                  no: "Do not warn"
43
            - when the librarian tries to create an invoice with a duplicate number.
38
44
39
    Printing:
45
    Printing:
40
        -
46
        -
41
- 

Return to bug 10366