Link Here
|
50 |
use CGI; |
50 |
use CGI; |
51 |
use C4::Context; |
51 |
use C4::Context; |
52 |
use C4::Auth; |
52 |
use C4::Auth; |
|
|
53 |
use C4::Branch; |
53 |
use C4::Output; |
54 |
use C4::Output; |
54 |
use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/; |
55 |
use C4::Acquisition qw/GetBasket NewBasket GetContracts ModBasketHeader/; |
55 |
use C4::Bookseller qw/GetBookSellerFromId/; |
56 |
use C4::Bookseller qw/GetBookSellerFromId/; |
Link Here
|
68 |
); |
69 |
); |
69 |
|
70 |
|
70 |
#parameters: |
71 |
#parameters: |
71 |
my $booksellerid; |
72 |
my $booksellerid = $input->param('booksellerid'); |
72 |
$booksellerid = $input->param('booksellerid'); |
|
|
73 |
my $basketno = $input->param('basketno'); |
73 |
my $basketno = $input->param('basketno'); |
|
|
74 |
my $branches = GetBranches; |
74 |
my $basket; |
75 |
my $basket; |
75 |
my $op = $input ->param('op'); |
76 |
my $op = $input ->param('op'); |
76 |
my $is_an_edit= $input ->param('is_an_edit'); |
77 |
my $is_an_edit= $input ->param('is_an_edit'); |
Link Here
|
107 |
basketbooksellernote => $basket->{'booksellernote'}, |
108 |
basketbooksellernote => $basket->{'booksellernote'}, |
108 |
booksellername => $bookseller->{'name'}, |
109 |
booksellername => $bookseller->{'name'}, |
109 |
booksellerid => $booksellerid, |
110 |
booksellerid => $booksellerid, |
110 |
basketno => $basketno |
111 |
basketno => $basketno, |
111 |
); |
112 |
deliveryplace => $basket->{deliveryplace}, |
|
|
113 |
billingplace => $basket->{billingplace}, |
114 |
); |
115 |
|
116 |
my $billingplace = $basket->{'billingplace'} || C4::Context->userenv->{"branch"}; |
117 |
my $deliveryplace = $basket->{'deliveryplace'} || C4::Context->userenv->{"branch"}; |
118 |
|
119 |
# Build the combobox to select the billing place |
120 |
my @billingplaceloop; |
121 |
|
122 |
# In case there's no branch selected |
123 |
if ($billingplace eq "NO_LIBRARY_SET") { |
124 |
my %row = ( |
125 |
value => "", |
126 |
selected => 1, |
127 |
branchname => "--", |
128 |
); |
129 |
push @billingplaceloop, \%row; |
130 |
} |
131 |
|
132 |
for ( sort keys %$branches ) { |
133 |
my $selected = 1 if $_ eq $billingplace; |
134 |
my %row = ( |
135 |
value => $_, |
136 |
selected => $selected, |
137 |
branchname => $branches->{$_}->{branchname}, |
138 |
); |
139 |
push @billingplaceloop, \%row; |
140 |
} |
141 |
$template->param( billingplaceloop => \@billingplaceloop ); |
142 |
|
143 |
# Build the combobox to select the delivery place |
144 |
my @deliveryplaceloop; |
145 |
|
146 |
# In case there's no branch selected |
147 |
if ($deliveryplace eq "NO_LIBRARY_SET") { |
148 |
my %row = ( |
149 |
value => "", |
150 |
selected => 1, |
151 |
branchname => "--", |
152 |
); |
153 |
push @deliveryplaceloop, \%row; |
154 |
} |
155 |
|
156 |
for ( sort keys %$branches ) { |
157 |
my $selected = 1 if $_ eq $deliveryplace; |
158 |
my %row = ( |
159 |
value => $_, |
160 |
selected => $selected, |
161 |
branchname => $branches->{$_}->{branchname}, |
162 |
); |
163 |
push @deliveryplaceloop, \%row; |
164 |
} |
165 |
$template->param( deliveryplaceloop => \@deliveryplaceloop ); |
166 |
|
112 |
#End Edit |
167 |
#End Edit |
113 |
} elsif ( $op eq 'add_validate' ) { |
168 |
} elsif ( $op eq 'add_validate' ) { |
114 |
#we are confirming the changes, save the basket |
169 |
#we are confirming the changes, save the basket |
115 |
my $basketno; |
|
|
116 |
if ( $is_an_edit ) { |
170 |
if ( $is_an_edit ) { |
117 |
$basketno = $input->param('basketno'); |
171 |
ModBasketHeader( |
118 |
ModBasketHeader($input->param('basketno'),$input->param('basketname'),$input->param('basketnote'),$input->param('basketbooksellernote'),$input->param('basketcontractnumber')); |
172 |
$basketno, |
|
|
173 |
$input->param('basketname'), |
174 |
$input->param('basketnote'), |
175 |
$input->param('basketbooksellernote'), |
176 |
$input->param('basketcontractnumber'), |
177 |
$input->param('deliveryplace'), |
178 |
$input->param('billingplace'), |
179 |
); |
119 |
} else { #New basket |
180 |
} else { #New basket |
120 |
$basketno = NewBasket($booksellerid, $loggedinuser, $input->param('basketname'), $input->param('basketnote'), $input->param('basketbooksellernote'), $input->param('basketcontractnumber')); |
181 |
$basketno = NewBasket( |
|
|
182 |
$booksellerid, |
183 |
$loggedinuser, |
184 |
$input->param('basketname'), |
185 |
$input->param('basketnote'), |
186 |
$input->param('basketbooksellernote'), |
187 |
$input->param('basketcontractnumber'), |
188 |
$input->param('deliveryplace'), |
189 |
$input->param('billingplace'), |
190 |
); |
121 |
} |
191 |
} |
122 |
print $input->redirect('basket.pl?basketno='.$basketno); |
192 |
print $input->redirect('basket.pl?basketno='.$basketno); |
123 |
exit 0; |
193 |
exit 0; |