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

(-)a/acqui/orderreceive.pl (-36 / +28 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-88 use C4::Suggestions; Link Here
81
my $input      = new CGI;
82
my $input      = new CGI;
82
83
83
my $dbh          = C4::Context->dbh;
84
my $dbh          = C4::Context->dbh;
84
my $booksellerid   = $input->param('booksellerid');
85
my $booksellerid = $input->param('booksellerid');
85
my $ordernumber       = $input->param('ordernumber');
86
my $ordernumber  = $input->param('ordernumber');
86
my $search       = $input->param('receive');
87
my $search       = $input->param('receive');
87
my $invoice      = $input->param('invoice');
88
my $invoice      = $input->param('invoice');
88
my $freight      = $input->param('freight');
89
my $freight      = $input->param('freight');
Lines 96-108 my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); Link Here
96
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
97
my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0;
97
my $results = SearchOrder($ordernumber,$search);
98
my $results = SearchOrder($ordernumber,$search);
98
99
99
100
my $count   = scalar @$results;
101
my $order 	= GetOrder($ordernumber);
102
103
104
my $date = @$results[0]->{'entrydate'};
105
106
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
100
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
107
    {
101
    {
108
        template_name   => "acqui/orderreceive.tmpl",
102
        template_name   => "acqui/orderreceive.tmpl",
Lines 114-121 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
114
    }
108
    }
115
);
109
);
116
110
111
my $count = scalar @$results;
117
# prepare the form for receiving
112
# prepare the form for receiving
118
if ( $count == 1 ) {
113
if ( $count == 1 ) {
114
    my $order = $results->[0];
119
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
115
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
120
        # prepare empty item form
116
        # prepare empty item form
121
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
117
        my $cell = PrepareItemrecordDisplay('','','','ACQ');
Lines 129-170 if ( $count == 1 ) { Link Here
129
        $template->param(items => \@itemloop);
125
        $template->param(items => \@itemloop);
130
    }
126
    }
131
127
132
    if ( @$results[0]->{'quantityreceived'} == 0 ) {
128
    if ( $order->{'unitprice'} == 0 ) {
133
        @$results[0]->{'quantityreceived'} = '';
129
        $order->{'unitprice'} = '';
134
    }
135
    if ( @$results[0]->{'unitprice'} == 0 ) {
136
        @$results[0]->{'unitprice'} = '';
137
    }
130
    }
138
131
139
    my $suggestion   = GetSuggestionInfoFromBiblionumber(@$results[0]->{'biblionumber'});
132
    my $suggestion   = GetSuggestionInfoFromBiblionumber($order->{'biblionumber'});
140
133
141
    my $authorisedby = @$results[0]->{'authorisedby'};
134
    my $authorisedby = $order->{'authorisedby'};
142
    my $member = GetMember( borrowernumber => $authorisedby );
135
    my $member = GetMember( borrowernumber => $authorisedby );
143
136
144
    my $budget = GetBudget( @$results[0]->{'budget_id'} );
137
    my $budget = GetBudget( $order->{'budget_id'} );
145
138
146
    $template->param(
139
    $template->param(
147
        count                 => 1,
140
        count                 => 1,
148
        biblionumber          => @$results[0]->{'biblionumber'},
141
        biblionumber          => $order->{'biblionumber'},
149
        ordernumber           => @$results[0]->{'ordernumber'},
142
        ordernumber           => $order->{'ordernumber'},
150
        biblioitemnumber      => @$results[0]->{'biblioitemnumber'},
143
        biblioitemnumber      => $order->{'biblioitemnumber'},
151
        booksellerid            => @$results[0]->{'booksellerid'},
144
        booksellerid          => $order->{'booksellerid'},
152
        freight               => $freight,
145
        freight               => $freight,
153
        gst                   => $gst,
146
        gst                   => $gst,
154
        name                  => $bookseller->{'name'},
147
        name                  => $bookseller->{'name'},
155
        date                  => format_date($date),
148
        date                  => format_date($order->{entrydate}),
156
        title                 => @$results[0]->{'title'},
149
        title                 => $order->{'title'},
157
        author                => @$results[0]->{'author'},
150
        author                => $order->{'author'},
158
        copyrightdate         => @$results[0]->{'copyrightdate'},
151
        copyrightdate         => $order->{'copyrightdate'},
159
        isbn                  => @$results[0]->{'isbn'},
152
        isbn                  => $order->{'isbn'},
160
        seriestitle           => @$results[0]->{'seriestitle'},
153
        seriestitle           => $order->{'seriestitle'},
161
        bookfund              => $budget->{budget_name},
154
        bookfund              => $budget->{budget_name},
162
        quantity              => @$results[0]->{'quantity'},
155
        quantity              => $order->{'quantity'},
163
        quantityreceivedplus1 => @$results[0]->{'quantityreceived'} + 1,
156
        quantityreceivedplus1 => $order->{'quantityreceived'} + 1,
164
        quantityreceived      => @$results[0]->{'quantityreceived'},
157
        quantityreceived      => $order->{'quantityreceived'},
165
        rrp                   => @$results[0]->{'rrp'},
158
        rrp                   => $order->{'rrp'},
166
        ecost                 => @$results[0]->{'ecost'},
159
        ecost                 => $order->{'ecost'},
167
        unitprice             => @$results[0]->{'unitprice'},
160
        unitprice             => $order->{'unitprice'},
168
        memberfirstname       => $member->{firstname} || "",
161
        memberfirstname       => $member->{firstname} || "",
169
        membersurname         => $member->{surname} || "",
162
        membersurname         => $member->{surname} || "",
170
        invoice               => $invoice,
163
        invoice               => $invoice,
Lines 197-203 else { Link Here
197
    );
190
    );
198
}
191
}
199
my $op = $input->param('op');
192
my $op = $input->param('op');
200
if ($op eq 'edit'){
193
if ($op and $op eq 'edit'){
201
    $template->param(edit   =>   1);
194
    $template->param(edit   =>   1);
202
}
195
}
203
output_html_with_http_headers $input, $cookie, $template->output;
196
output_html_with_http_headers $input, $cookie, $template->output;
204
- 

Return to bug 7175