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

(-)a/acqui/orderreceive.pl (-34 / +26 lines)
Lines 61-67 The biblionumber of this order. Link Here
61
=cut
61
=cut
62
62
63
use strict;
63
use strict;
64
#use warnings; FIXME - Bug 2505
64
use warnings;
65
65
use CGI;
66
use CGI;
66
use C4::Context;
67
use C4::Context;
67
use C4::Koha;   # GetKohaAuthorisedValues GetItemTypes
68
use C4::Koha;   # GetKohaAuthorisedValues GetItemTypes
Lines 81-87 my $input = new CGI; Link Here
81
82
82
my $dbh          = C4::Context->dbh;
83
my $dbh          = C4::Context->dbh;
83
my $supplierid   = $input->param('supplierid');
84
my $supplierid   = $input->param('supplierid');
84
my $ordernumber       = $input->param('ordernumber');
85
my $ordernumber  = $input->param('ordernumber');
85
my $search       = $input->param('receive');
86
my $search       = $input->param('receive');
86
my $invoice      = $input->param('invoice');
87
my $invoice      = $input->param('invoice');
87
my $freight      = $input->param('freight');
88
my $freight      = $input->param('freight');
Lines 95-107 my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); Link Here
95
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
96
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
96
my $results = SearchOrder($ordernumber,$search);
97
my $results = SearchOrder($ordernumber,$search);
97
98
98
99
my $count   = scalar @$results;
100
my $order 	= GetOrder($ordernumber);
101
102
103
my $date = @$results[0]->{'entrydate'};
104
105
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
99
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
106
    {
100
    {
107
        template_name   => "acqui/orderreceive.tmpl",
101
        template_name   => "acqui/orderreceive.tmpl",
Lines 113-120 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
113
    }
107
    }
114
);
108
);
115
109
110
my $count = scalar @$results;
116
# prepare the form for receiving
111
# prepare the form for receiving
117
if ( $count == 1 ) {
112
if ( $count == 1 ) {
113
    my $order = $results->[0];
118
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
114
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
119
        # prepare empty item form
115
        # prepare empty item form
120
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
116
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
Lines 128-167 if ( $count == 1 ) { Link Here
128
        $template->param(items => \@itemloop);
124
        $template->param(items => \@itemloop);
129
    }
125
    }
130
126
131
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
127
    if ( $order->{'unitprice'} == 0 ) {
132
        @$results[0]->{'quantityreceived'} = '';
128
        $order->{'unitprice'} = '';
133
    }
134
    if ( @$results[0]->{'unitprice'} == 0 ) {
135
        @$results[0]->{'unitprice'} = '';
136
    }
129
    }
137
130
138
    my $authorisedby = @$results[0]->{'authorisedby'};
131
    my $authorisedby = $order->{'authorisedby'};
139
    my $member = GetMember( borrowernumber => $authorisedby );
132
    my $member = GetMember( borrowernumber => $authorisedby );
140
133
141
    my $budget = GetBudget( @$results[0]->{'budget_id'} );
134
    my $budget = GetBudget( $order->{'budget_id'} );
142
135
143
    $template->param(
136
    $template->param(
144
        count                 => 1,
137
        count                 => 1,
145
        biblionumber          => @$results[0]->{'biblionumber'},
138
        biblionumber          => $order->{'biblionumber'},
146
        ordernumber           => @$results[0]->{'ordernumber'},
139
        ordernumber           => $order->{'ordernumber'},
147
        biblioitemnumber      => @$results[0]->{'biblioitemnumber'},
140
        biblioitemnumber      => $order->{'biblioitemnumber'},
148
        supplierid            => @$results[0]->{'booksellerid'},
141
        supplierid            => $order->{'booksellerid'},
149
        freight               => $freight,
142
        freight               => $freight,
150
        gst                   => $gst,
143
        gst                   => $gst,
151
        name                  => $bookseller->{'name'},
144
        name                  => $bookseller->{'name'},
152
        date                  => format_date($date),
145
        date                  => format_date($order->{entrydate}),
153
        title                 => @$results[0]->{'title'},
146
        title                 => $order->{'title'},
154
        author                => @$results[0]->{'author'},
147
        author                => $order->{'author'},
155
        copyrightdate         => @$results[0]->{'copyrightdate'},
148
        copyrightdate         => $order->{'copyrightdate'},
156
        isbn                  => @$results[0]->{'isbn'},
149
        isbn                  => $order->{'isbn'},
157
        seriestitle           => @$results[0]->{'seriestitle'},
150
        seriestitle           => $order->{'seriestitle'},
158
        bookfund              => $budget->{budget_name},
151
        bookfund              => $budget->{budget_name},
159
        quantity              => @$results[0]->{'quantity'},
152
        quantity              => $order->{'quantity'},
160
        quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1,
153
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
161
        quantityreceived      => @$results[0]->{'quantityreceived'},
154
        quantityreceived      => $order->{'quantityreceived'},
162
        rrp                   => @$results[0]->{'rrp'},
155
        rrp                   => $order->{'rrp'},
163
        ecost                 => @$results[0]->{'ecost'},
156
        ecost                 => $order->{'ecost'},
164
        unitprice             => @$results[0]->{'unitprice'},
157
        unitprice             => $order->{'unitprice'},
165
        memberfirstname       => $member->{firstname} || "",
158
        memberfirstname       => $member->{firstname} || "",
166
        membersurname         => $member->{surname} || "",
159
        membersurname         => $member->{surname} || "",
167
        invoice               => $invoice,
160
        invoice               => $invoice,
Lines 191-197 else { Link Here
191
    );
184
    );
192
}
185
}
193
my $op = $input->param('op');
186
my $op = $input->param('op');
194
if ($op eq 'edit'){
187
if ($op and $op eq 'edit'){
195
    $template->param(edit   =>   1);
188
    $template->param(edit   =>   1);
196
}
189
}
197
output_html_with_http_headers $input, $cookie, $template->output;
190
output_html_with_http_headers $input, $cookie, $template->output;
198
- 

Return to bug 7175