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