Lines 165-171
sub GetBasket {
Link Here
|
165 |
=head3 NewBasket |
165 |
=head3 NewBasket |
166 |
|
166 |
|
167 |
$basket = &NewBasket( $booksellerid, $authorizedby, $basketname, |
167 |
$basket = &NewBasket( $booksellerid, $authorizedby, $basketname, |
168 |
$basketnote, $basketbooksellernote, $basketcontractnumber ); |
168 |
$basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace ); |
169 |
|
169 |
|
170 |
Create a new basket in aqbasket table |
170 |
Create a new basket in aqbasket table |
171 |
|
171 |
|
Lines 181-190
The other parameters are optional, see ModBasketHeader for more info on them.
Link Here
|
181 |
|
181 |
|
182 |
=cut |
182 |
=cut |
183 |
|
183 |
|
184 |
# FIXME : this function seems to be unused. |
|
|
185 |
|
186 |
sub NewBasket { |
184 |
sub NewBasket { |
187 |
my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber ) = @_; |
185 |
my ( $booksellerid, $authorisedby, $basketname, $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace ) = @_; |
188 |
my $dbh = C4::Context->dbh; |
186 |
my $dbh = C4::Context->dbh; |
189 |
my $query = " |
187 |
my $query = " |
190 |
INSERT INTO aqbasket |
188 |
INSERT INTO aqbasket |
Lines 195-201
sub NewBasket {
Link Here
|
195 |
$dbh->do($query); |
193 |
$dbh->do($query); |
196 |
#find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-( |
194 |
#find & return basketno MYSQL dependant, but $dbh->last_insert_id always returns null :-( |
197 |
my $basket = $dbh->{'mysql_insertid'}; |
195 |
my $basket = $dbh->{'mysql_insertid'}; |
198 |
ModBasketHeader($basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef, $booksellerid); |
196 |
ModBasketHeader($basket, $basketname || '', $basketnote || '', $basketbooksellernote || '', $basketcontractnumber || undef, $booksellerid, $deliveryplace || undef, $billingplace || undef ); |
199 |
return $basket; |
197 |
return $basket; |
200 |
} |
198 |
} |
201 |
|
199 |
|
Lines 257-264
sub GetBasketAsCSV {
Link Here
|
257 |
notes => $order->{'notes'}, |
255 |
notes => $order->{'notes'}, |
258 |
quantity => $order->{'quantity'}, |
256 |
quantity => $order->{'quantity'}, |
259 |
rrp => $order->{'rrp'}, |
257 |
rrp => $order->{'rrp'}, |
260 |
deliveryplace => $basket->{'deliveryplace'}, |
258 |
deliveryplace => C4::Branch::GetBranchName( $basket->{'deliveryplace'} ), |
261 |
billingplace => $basket->{'billingplace'} |
259 |
billingplace => C4::Branch::GetBranchName( $basket->{'billingplace'} ), |
262 |
}; |
260 |
}; |
263 |
foreach(qw( |
261 |
foreach(qw( |
264 |
contractname author title publishercode collectiontitle notes |
262 |
contractname author title publishercode collectiontitle notes |
Lines 307-312
sub GetBasketGroupAsCSV {
Link Here
|
307 |
my @orders = GetOrders( $$basket{basketno} ); |
305 |
my @orders = GetOrders( $$basket{basketno} ); |
308 |
my $contract = GetContract( $$basket{contractnumber} ); |
306 |
my $contract = GetContract( $$basket{contractnumber} ); |
309 |
my $bookseller = GetBookSellerFromId( $$basket{booksellerid} ); |
307 |
my $bookseller = GetBookSellerFromId( $$basket{booksellerid} ); |
|
|
308 |
my $basketgroup = GetBasketgroup( $$basket{basketgroupid} ); |
310 |
|
309 |
|
311 |
foreach my $order (@orders) { |
310 |
foreach my $order (@orders) { |
312 |
my $bd = GetBiblioData( $order->{'biblionumber'} ); |
311 |
my $bd = GetBiblioData( $order->{'biblionumber'} ); |
Lines 331-336
sub GetBasketGroupAsCSV {
Link Here
|
331 |
booksellerpostal => $bookseller->{postal}, |
330 |
booksellerpostal => $bookseller->{postal}, |
332 |
contractnumber => $contract->{contractnumber}, |
331 |
contractnumber => $contract->{contractnumber}, |
333 |
contractname => $contract->{contractname}, |
332 |
contractname => $contract->{contractname}, |
|
|
333 |
basketgroupdeliveryplace => C4::Branch::GetBranchName( $basketgroup->{deliveryplace} ) || C4::Branch::GetBranchName( $basketgroup->{freedeliveryplace} ), |
334 |
basketgroupbillingplace => C4::Branch::GetBranchName( $basketgroup->{billingplace} ), |
335 |
basketdeliveryplace => C4::Branch::GetBranchName( $basket->{deliveryplace} ), |
336 |
basketbillingplace => C4::Branch::GetBranchName( $basket->{billingplace} ), |
334 |
}; |
337 |
}; |
335 |
foreach(qw( |
338 |
foreach(qw( |
336 |
basketname author title publishercode collectiontitle notes |
339 |
basketname author title publishercode collectiontitle notes |
Lines 478-494
Modifies a basket's header.
Link Here
|
478 |
|
481 |
|
479 |
=item C<$booksellerid> is the id (foreign) key in the "aqbooksellers" table for the vendor. |
482 |
=item C<$booksellerid> is the id (foreign) key in the "aqbooksellers" table for the vendor. |
480 |
|
483 |
|
|
|
484 |
=item C<$deliveryplace> is the "deliveryplace" field in the aqbasket table. |
485 |
|
486 |
=item C<$billingplace> is the "billingplace" field in the aqbasket table. |
487 |
|
481 |
=back |
488 |
=back |
482 |
|
489 |
|
483 |
=cut |
490 |
=cut |
484 |
|
491 |
|
485 |
sub ModBasketHeader { |
492 |
sub ModBasketHeader { |
486 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid) = @_; |
493 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace) = @_; |
|
|
494 |
my $query = qq{ |
495 |
UPDATE aqbasket |
496 |
SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=? |
497 |
WHERE basketno=? |
498 |
}; |
487 |
|
499 |
|
488 |
my $query = "UPDATE aqbasket SET basketname=?, note=?, booksellernote=?, booksellerid=? WHERE basketno=?"; |
|
|
489 |
my $dbh = C4::Context->dbh; |
500 |
my $dbh = C4::Context->dbh; |
490 |
my $sth = $dbh->prepare($query); |
501 |
my $sth = $dbh->prepare($query); |
491 |
$sth->execute($basketname,$note,$booksellernote,$booksellerid,$basketno); |
502 |
$sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $basketno); |
492 |
|
503 |
|
493 |
if ( $contractnumber ) { |
504 |
if ( $contractnumber ) { |
494 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |
505 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |