Lines 188-194
sub GetBasket {
Link Here
|
188 |
=head3 NewBasket |
188 |
=head3 NewBasket |
189 |
|
189 |
|
190 |
$basket = &NewBasket( $booksellerid, $authorizedby, $basketname, |
190 |
$basket = &NewBasket( $booksellerid, $authorizedby, $basketname, |
191 |
$basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing ); |
191 |
$basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing, $create_items ); |
192 |
|
192 |
|
193 |
Create a new basket in aqbasket table |
193 |
Create a new basket in aqbasket table |
194 |
|
194 |
|
Lines 207-213
The other parameters are optional, see ModBasketHeader for more info on them.
Link Here
|
207 |
sub NewBasket { |
207 |
sub NewBasket { |
208 |
my ( $booksellerid, $authorisedby, $basketname, $basketnote, |
208 |
my ( $booksellerid, $authorisedby, $basketname, $basketnote, |
209 |
$basketbooksellernote, $basketcontractnumber, $deliveryplace, |
209 |
$basketbooksellernote, $basketcontractnumber, $deliveryplace, |
210 |
$billingplace, $is_standing ) = @_; |
210 |
$billingplace, $is_standing, $create_items ) = @_; |
211 |
my $dbh = C4::Context->dbh; |
211 |
my $dbh = C4::Context->dbh; |
212 |
my $query = |
212 |
my $query = |
213 |
'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) ' |
213 |
'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) ' |
Lines 219-225
sub NewBasket {
Link Here
|
219 |
$basketnote ||= q{}; |
219 |
$basketnote ||= q{}; |
220 |
$basketbooksellernote ||= q{}; |
220 |
$basketbooksellernote ||= q{}; |
221 |
ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote, |
221 |
ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote, |
222 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing ); |
222 |
$basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items ); |
223 |
return $basket; |
223 |
return $basket; |
224 |
} |
224 |
} |
225 |
|
225 |
|
Lines 599-619
Modifies a basket's header.
Link Here
|
599 |
|
599 |
|
600 |
=item C<$is_standing> is the "is_standing" field in the aqbasket table. |
600 |
=item C<$is_standing> is the "is_standing" field in the aqbasket table. |
601 |
|
601 |
|
|
|
602 |
=item C<$create_items> should be set to 'ordering', 'receiving' or 'cataloguing' (or undef, in which |
603 |
case the AcqCreateItem syspref takes precedence). |
604 |
|
602 |
=back |
605 |
=back |
603 |
|
606 |
|
604 |
=cut |
607 |
=cut |
605 |
|
608 |
|
606 |
sub ModBasketHeader { |
609 |
sub ModBasketHeader { |
607 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing) = @_; |
610 |
my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_; |
608 |
my $query = qq{ |
611 |
my $query = qq{ |
609 |
UPDATE aqbasket |
612 |
UPDATE aqbasket |
610 |
SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=? |
613 |
SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=?, create_items=? |
611 |
WHERE basketno=? |
614 |
WHERE basketno=? |
612 |
}; |
615 |
}; |
613 |
|
616 |
|
614 |
my $dbh = C4::Context->dbh; |
617 |
my $dbh = C4::Context->dbh; |
615 |
my $sth = $dbh->prepare($query); |
618 |
my $sth = $dbh->prepare($query); |
616 |
$sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $basketno); |
619 |
$sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items || undef, $basketno); |
617 |
|
620 |
|
618 |
if ( $contractnumber ) { |
621 |
if ( $contractnumber ) { |
619 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |
622 |
my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?"; |
Lines 1585-1590
sub CancelReceipt {
Link Here
|
1585 |
my $parent_ordernumber = $order->{'parent_ordernumber'}; |
1588 |
my $parent_ordernumber = $order->{'parent_ordernumber'}; |
1586 |
|
1589 |
|
1587 |
my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); |
1590 |
my @itemnumbers = GetItemnumbersFromOrder( $ordernumber ); |
|
|
1591 |
my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket; |
1588 |
|
1592 |
|
1589 |
if($parent_ordernumber == $ordernumber || not $parent_ordernumber) { |
1593 |
if($parent_ordernumber == $ordernumber || not $parent_ordernumber) { |
1590 |
# The order line has no parent, just mark it as not received |
1594 |
# The order line has no parent, just mark it as not received |
Lines 1645-1651
sub CancelReceipt {
Link Here
|
1645 |
WHERE ordernumber = ? |
1649 |
WHERE ordernumber = ? |
1646 |
|, undef, $parent_ordernumber); |
1650 |
|, undef, $parent_ordernumber); |
1647 |
|
1651 |
|
1648 |
_cancel_items_receipt( $ordernumber, $parent_ordernumber ); |
1652 |
_cancel_items_receipt( $basket->effective_create_items, $ordernumber, $parent_ordernumber ); |
1649 |
# Delete order line |
1653 |
# Delete order line |
1650 |
$query = qq{ |
1654 |
$query = qq{ |
1651 |
DELETE FROM aqorders |
1655 |
DELETE FROM aqorders |
Lines 1656-1662
sub CancelReceipt {
Link Here
|
1656 |
|
1660 |
|
1657 |
} |
1661 |
} |
1658 |
|
1662 |
|
1659 |
if(C4::Context->preference('AcqCreateItem') eq 'ordering') { |
1663 |
if( $basket->effective_create_items eq 'ordering' ) { |
1660 |
my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled"); |
1664 |
my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled"); |
1661 |
if ( @affects ) { |
1665 |
if ( @affects ) { |
1662 |
for my $in ( @itemnumbers ) { |
1666 |
for my $in ( @itemnumbers ) { |
Lines 1679-1689
sub CancelReceipt {
Link Here
|
1679 |
} |
1683 |
} |
1680 |
|
1684 |
|
1681 |
sub _cancel_items_receipt { |
1685 |
sub _cancel_items_receipt { |
1682 |
my ( $ordernumber, $parent_ordernumber ) = @_; |
1686 |
my ( $effective_create_items, $ordernumber, $parent_ordernumber ) = @_; |
1683 |
$parent_ordernumber ||= $ordernumber; |
1687 |
$parent_ordernumber ||= $ordernumber; |
1684 |
|
1688 |
|
1685 |
my @itemnumbers = GetItemnumbersFromOrder($ordernumber); |
1689 |
my @itemnumbers = GetItemnumbersFromOrder($ordernumber); |
1686 |
if(C4::Context->preference('AcqCreateItem') eq 'receiving') { |
1690 |
if ( $effective_create_items eq 'receiving' ) { |
1687 |
# Remove items that were created at receipt |
1691 |
# Remove items that were created at receipt |
1688 |
my $query = qq{ |
1692 |
my $query = qq{ |
1689 |
DELETE FROM items, aqorders_items |
1693 |
DELETE FROM items, aqorders_items |