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

(-)a/C4/Acquisition.pm (-10 / +14 lines)
Lines 190-196 sub GetBasket { Link Here
190
=head3 NewBasket
190
=head3 NewBasket
191
191
192
  $basket = &NewBasket( $booksellerid, $authorizedby, $basketname,
192
  $basket = &NewBasket( $booksellerid, $authorizedby, $basketname,
193
      $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing );
193
      $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing, $create_items );
194
194
195
Create a new basket in aqbasket table
195
Create a new basket in aqbasket table
196
196
Lines 209-215 The other parameters are optional, see ModBasketHeader for more info on them. Link Here
209
sub NewBasket {
209
sub NewBasket {
210
    my ( $booksellerid, $authorisedby, $basketname, $basketnote,
210
    my ( $booksellerid, $authorisedby, $basketname, $basketnote,
211
        $basketbooksellernote, $basketcontractnumber, $deliveryplace,
211
        $basketbooksellernote, $basketcontractnumber, $deliveryplace,
212
        $billingplace, $is_standing ) = @_;
212
        $billingplace, $is_standing, $create_items ) = @_;
213
    my $dbh = C4::Context->dbh;
213
    my $dbh = C4::Context->dbh;
214
    my $query =
214
    my $query =
215
        'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) '
215
        'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) '
Lines 221-227 sub NewBasket { Link Here
221
    $basketnote           ||= q{};
221
    $basketnote           ||= q{};
222
    $basketbooksellernote ||= q{};
222
    $basketbooksellernote ||= q{};
223
    ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote,
223
    ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote,
224
        $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing );
224
        $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items );
225
    return $basket;
225
    return $basket;
226
}
226
}
227
227
Lines 598-618 Modifies a basket's header. Link Here
598
598
599
=item C<$is_standing> is the "is_standing" field in the aqbasket table.
599
=item C<$is_standing> is the "is_standing" field in the aqbasket table.
600
600
601
=item C<$create_items> should be set to 'ordering', 'receiving' or 'cataloguing' (or undef, in which
602
case the AcqCreateItem syspref takes precedence).
603
601
=back
604
=back
602
605
603
=cut
606
=cut
604
607
605
sub ModBasketHeader {
608
sub ModBasketHeader {
606
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing) = @_;
609
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_;
607
    my $query = qq{
610
    my $query = qq{
608
        UPDATE aqbasket
611
        UPDATE aqbasket
609
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=?
612
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=?, create_items=?
610
        WHERE basketno=?
613
        WHERE basketno=?
611
    };
614
    };
612
615
613
    my $dbh = C4::Context->dbh;
616
    my $dbh = C4::Context->dbh;
614
    my $sth = $dbh->prepare($query);
617
    my $sth = $dbh->prepare($query);
615
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $basketno);
618
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items || undef, $basketno);
616
619
617
    if ( $contractnumber ) {
620
    if ( $contractnumber ) {
618
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
621
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
Lines 1587-1592 sub CancelReceipt { Link Here
1587
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1590
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1588
1591
1589
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1592
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1593
    my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
1590
1594
1591
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1595
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1592
        # The order line has no parent, just mark it as not received
1596
        # The order line has no parent, just mark it as not received
Lines 1647-1653 sub CancelReceipt { Link Here
1647
            WHERE ordernumber = ?
1651
            WHERE ordernumber = ?
1648
        |, undef, $parent_ordernumber);
1652
        |, undef, $parent_ordernumber);
1649
1653
1650
        _cancel_items_receipt( $ordernumber, $parent_ordernumber );
1654
        _cancel_items_receipt( $basket->effective_create_items, $ordernumber, $parent_ordernumber );
1651
        # Delete order line
1655
        # Delete order line
1652
        $query = qq{
1656
        $query = qq{
1653
            DELETE FROM aqorders
1657
            DELETE FROM aqorders
Lines 1658-1664 sub CancelReceipt { Link Here
1658
1662
1659
    }
1663
    }
1660
1664
1661
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
1665
    if( $basket->effective_create_items eq 'ordering' ) {
1662
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1666
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1663
        if ( @affects ) {
1667
        if ( @affects ) {
1664
            for my $in ( @itemnumbers ) {
1668
            for my $in ( @itemnumbers ) {
Lines 1681-1691 sub CancelReceipt { Link Here
1681
}
1685
}
1682
1686
1683
sub _cancel_items_receipt {
1687
sub _cancel_items_receipt {
1684
    my ( $ordernumber, $parent_ordernumber ) = @_;
1688
    my ( $effective_create_items, $ordernumber, $parent_ordernumber ) = @_;
1685
    $parent_ordernumber ||= $ordernumber;
1689
    $parent_ordernumber ||= $ordernumber;
1686
1690
1687
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1691
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1688
    if(C4::Context->preference('AcqCreateItem') eq 'receiving') {
1692
    if ( $effective_create_items eq 'receiving' ) {
1689
        # Remove items that were created at receipt
1693
        # Remove items that were created at receipt
1690
        my $query = qq{
1694
        my $query = qq{
1691
            DELETE FROM items, aqorders_items
1695
            DELETE FROM items, aqorders_items
(-)a/Koha/Acquisition/Basket.pm (+13 lines)
Lines 45-50 sub bookseller { Link Here
45
    return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs );
45
    return Koha::Acquisition::Bookseller->_new_from_dbic( $bookseller_rs );
46
}
46
}
47
47
48
49
=head3 effective_create_items
50
51
Returns C<create_items> for this basket, falling back to C<AcqCreateItem> if unset.
52
53
=cut
54
55
sub effective_create_items {
56
    my ( $self ) = @_;
57
58
    return $self->create_items || C4::Context->preference('AcqCreateItem');
59
}
60
48
=head3 type
61
=head3 type
49
62
50
=cut
63
=cut
(-)a/Koha/Acquisition/Order.pm (-1 / +7 lines)
Lines 19-24 use Modern::Perl; Link Here
19
19
20
use Carp qw( croak );
20
use Carp qw( croak );
21
21
22
use Koha::Acquisition::Baskets;
22
use Koha::Database;
23
use Koha::Database;
23
use Koha::DateUtils qw( dt_from_string output_pref );
24
use Koha::DateUtils qw( dt_from_string output_pref );
24
25
Lines 98-106 sub add_item { Link Here
98
    $rs->create({ ordernumber => $self->ordernumber, itemnumber => $itemnumber });
99
    $rs->create({ ordernumber => $self->ordernumber, itemnumber => $itemnumber });
99
}
100
}
100
101
102
sub basket {
103
    my ( $self )  = @_;
104
    return Koha::Acquisition::Baskets->find( $self->{basketno} );
105
}
106
101
=head2 Internal methods
107
=head2 Internal methods
102
108
103
=head3 _type (internal)
109
=head3 _type
104
110
105
=cut
111
=cut
106
112
(-)a/acqui/addorder.pl (-1 / +3 lines)
Lines 234-239 my $basketno=$$orderinfo{basketno}; Link Here
234
my $basket = GetBasket($basketno);
234
my $basket = GetBasket($basketno);
235
235
236
my $user = $input->remote_user;
236
my $user = $input->remote_user;
237
my $basketno=$$orderinfo{basketno};
238
my $basket = Koha::Acquisition::Baskets->find( $basketno );
237
239
238
# create, modify or delete biblio
240
# create, modify or delete biblio
239
# create if $quantity>0 and $existing='no'
241
# create if $quantity>0 and $existing='no'
Lines 291-297 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
291
    }
293
    }
292
294
293
    # now, add items if applicable
295
    # now, add items if applicable
294
    if (C4::Context->preference('AcqCreateItem') eq 'ordering') {
296
    if ($basket->effective_create_items eq 'ordering') {
295
297
296
        my @tags         = $input->multi_param('tag');
298
        my @tags         = $input->multi_param('tag');
297
        my @subfields    = $input->multi_param('subfield');
299
        my @subfields    = $input->multi_param('subfield');
(-)a/acqui/addorderiso2709.pl (-2 / +4 lines)
Lines 44-49 use C4::Members; Link Here
44
44
45
use Koha::Number::Price;
45
use Koha::Number::Price;
46
use Koha::Libraries;
46
use Koha::Libraries;
47
use Koha::Acquisition::Baskets;
47
use Koha::Acquisition::Currencies;
48
use Koha::Acquisition::Currencies;
48
use Koha::Acquisition::Orders;
49
use Koha::Acquisition::Orders;
49
use Koha::Acquisition::Booksellers;
50
use Koha::Acquisition::Booksellers;
Lines 78-83 if ($cgiparams->{'import_batch_id'} && $op eq ""){ Link Here
78
if (! $cgiparams->{'basketno'}){
79
if (! $cgiparams->{'basketno'}){
79
    die "Basketnumber required to order from iso2709 file import";
80
    die "Basketnumber required to order from iso2709 file import";
80
}
81
}
82
my $basket = Koha::Acquisition::Baskets->find( $cgiparams->{basketno} );
81
83
82
#
84
#
83
# 1st step = choose the file to import into acquisition
85
# 1st step = choose the file to import into acquisition
Lines 102-108 if ($op eq ""){ Link Here
102
                     );
104
                     );
103
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
105
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
104
    my $basket = GetBasket($cgiparams->{basketno});
106
    my $basket = GetBasket($cgiparams->{basketno});
105
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
107
    if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) {
106
        # prepare empty item form
108
        # prepare empty item form
107
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
109
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
108
110
Lines 381-387 if ($op eq ""){ Link Here
381
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
383
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
382
        # this is not optimised, but it's working !
384
        # this is not optimised, but it's working !
383
        my $basket = GetBasket($cgiparams->{basketno});
385
        my $basket = GetBasket($cgiparams->{basketno});
384
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
386
        if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) {
385
            my @tags         = $input->multi_param('tag');
387
            my @tags         = $input->multi_param('tag');
386
            my @subfields    = $input->multi_param('subfield');
388
            my @subfields    = $input->multi_param('subfield');
387
            my @field_values = $input->multi_param('field_value');
389
            my @field_values = $input->multi_param('field_value');
(-)a/acqui/basket.pl (+1 lines)
Lines 390-395 if ( $op eq 'list' ) { Link Here
390
    }
390
    }
391
391
392
    $template->param(
392
    $template->param(
393
        basket               => $basket,
393
        basketno             => $basketno,
394
        basketno             => $basketno,
394
        basket               => $basket,
395
        basket               => $basket,
395
        basketname           => $basket->{'basketname'},
396
        basketname           => $basket->{'basketname'},
(-)a/acqui/basketheader.pl (+2 lines)
Lines 145-150 if ( $op eq 'add_form' ) { Link Here
145
            scalar $input->param('deliveryplace'),
145
            scalar $input->param('deliveryplace'),
146
            scalar $input->param('billingplace'),
146
            scalar $input->param('billingplace'),
147
            scalar $input->param('is_standing') ? 1 : undef,
147
            scalar $input->param('is_standing') ? 1 : undef,
148
            scalar $input->param('create_items')
148
        );
149
        );
149
    } else { #New basket
150
    } else { #New basket
150
        $basketno = NewBasket(
151
        $basketno = NewBasket(
Lines 157-162 if ( $op eq 'add_form' ) { Link Here
157
            scalar $input->param('deliveryplace'),
158
            scalar $input->param('deliveryplace'),
158
            scalar $input->param('billingplace'),
159
            scalar $input->param('billingplace'),
159
            scalar $input->param('is_standing') ? 1 : undef,
160
            scalar $input->param('is_standing') ? 1 : undef,
161
            scalar $input->param('create_items')
160
        );
162
        );
161
    }
163
    }
162
    print $input->redirect('basket.pl?basketno='.$basketno);
164
    print $input->redirect('basket.pl?basketno='.$basketno);
(-)a/acqui/finishreceive.pl (-4 / +5 lines)
Lines 60-71 my $order = GetOrder($ordernumber); Link Here
60
my $new_ordernumber  = $ordernumber;
60
my $new_ordernumber  = $ordernumber;
61
61
62
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
62
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
63
my $basket = Koha::Acquisition::Orders->find( $ordernumber )->basket;
63
64
64
#need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME
65
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
65
if ($quantityrec > $origquantityrec ) {
66
if ($quantityrec > $origquantityrec ) {
66
    my @received_items = ();
67
    my @received_items = ();
67
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
68
    if ($basket->effective_create_items eq 'ordering') {
68
        @received_items = $input->multi_param('items_to_receive');
69
        @received_items = $input->param('items_to_receive');
69
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
70
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
70
        if ( @affects ) {
71
        if ( @affects ) {
71
            my $frameworkcode = GetFrameworkCode($biblionumber);
72
            my $frameworkcode = GetFrameworkCode($biblionumber);
Lines 111-117 if ($quantityrec > $origquantityrec ) { Link Here
111
    }
112
    }
112
113
113
    # now, add items if applicable
114
    # now, add items if applicable
114
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
115
    if ($basket->effective_create_items eq 'receiving') {
115
116
116
        my @tags         = $input->multi_param('tag');
117
        my @tags         = $input->multi_param('tag');
117
        my @subfields    = $input->multi_param('subfield');
118
        my @subfields    = $input->multi_param('subfield');
(-)a/acqui/neworderempty.pl (-2 / +3 lines)
Lines 130-135 if(!$basketno) { Link Here
130
}
130
}
131
131
132
our $basket = GetBasket($basketno);
132
our $basket = GetBasket($basketno);
133
my $basketobj = Koha::Acquisition::Baskets->find( $basketno );
133
$booksellerid = $basket->{booksellerid} unless $booksellerid;
134
$booksellerid = $basket->{booksellerid} unless $booksellerid;
134
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
135
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
135
136
Lines 243-249 if ($close) { Link Here
243
$template->param( sort1 => $data->{'sort1'} );
244
$template->param( sort1 => $data->{'sort1'} );
244
$template->param( sort2 => $data->{'sort2'} );
245
$template->param( sort2 => $data->{'sort2'} );
245
246
246
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
247
if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) {
247
    # Check if ACQ framework exists
248
    # Check if ACQ framework exists
248
    my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
249
    my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
249
    unless($marc) {
250
    unless($marc) {
Lines 358-364 $template->param( Link Here
358
    barcode_subfield => $barcode_subfield,
359
    barcode_subfield => $barcode_subfield,
359
    import_batch_id  => $import_batch_id,
360
    import_batch_id  => $import_batch_id,
360
    subscriptionid   => $subscriptionid,
361
    subscriptionid   => $subscriptionid,
361
    acqcreate        => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
362
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
362
    users_ids        => join(':', @order_user_ids),
363
    users_ids        => join(':', @order_user_ids),
363
    users            => \@order_users,
364
    users            => \@order_users,
364
    (uc(C4::Context->preference("marcflavour"))) => 1
365
    (uc(C4::Context->preference("marcflavour"))) => 1
(-)a/acqui/orderreceive.pl (-1 / +2 lines)
Lines 111-116 unless ( $results and @$results) { Link Here
111
111
112
# prepare the form for receiving
112
# prepare the form for receiving
113
my $order = $results->[0];
113
my $order = $results->[0];
114
my $basket = Koha::Acquisition::Order->fetch({ordernumber => $ordernumber})->basket;
114
115
115
# Check if ACQ framework exists
116
# Check if ACQ framework exists
116
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
117
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
Lines 118-124 unless($acq_fw) { Link Here
118
    $template->param('NoACQframework' => 1);
119
    $template->param('NoACQframework' => 1);
119
}
120
}
120
121
121
my $AcqCreateItem = C4::Context->preference('AcqCreateItem');
122
my $AcqCreateItem = $basket->effective_create_items;
122
if ($AcqCreateItem eq 'receiving') {
123
if ($AcqCreateItem eq 'receiving') {
123
    $template->param(
124
    $template->param(
124
        AcqCreateItemReceiving => 1,
125
        AcqCreateItemReceiving => 1,
(-)a/acqui/parcel.pl (+2 lines)
Lines 66-71 use CGI qw ( -utf8 ); Link Here
66
use C4::Output;
66
use C4::Output;
67
use C4::Suggestions;
67
use C4::Suggestions;
68
68
69
use Koha::Acquisition::Baskets;
69
use Koha::Acquisition::Bookseller;
70
use Koha::Acquisition::Bookseller;
70
use Koha::Biblios;
71
use Koha::Biblios;
71
use Koha::DateUtils;
72
use Koha::DateUtils;
Lines 264-269 unless( defined $invoice->{closedate} ) { Link Here
264
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
265
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
265
        $line{holds}                = $holds_count;
266
        $line{holds}                = $holds_count;
266
        $line{holds_on_order}       = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order};
267
        $line{holds_on_order}       = $itemholds?$itemholds:$holds_count if $line{left_holds_on_order};
268
        $line{basket}               = Koha::Acquisition::Baskets->find( $line{basketno} );
267
269
268
        my $budget_name = GetBudgetName( $line{budget_id} );
270
        my $budget_name = GetBudgetName( $line{budget_id} );
269
        $line{budget_name} = $budget_name;
271
        $line{budget_name} = $budget_name;
(-)a/acqui/uncertainprice.pl (+3 lines)
Lines 54-59 use C4::Acquisition qw/SearchOrders GetOrder ModOrder/; Link Here
54
use C4::Biblio qw/GetBiblioData/;
54
use C4::Biblio qw/GetBiblioData/;
55
55
56
use Koha::Acquisition::Booksellers;
56
use Koha::Acquisition::Booksellers;
57
use Koha::Acquisition::Baskets;
57
58
58
my $input=new CGI;
59
my $input=new CGI;
59
60
Lines 72-77 my $op = $input->param('op'); Link Here
72
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
73
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
73
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
74
my $bookseller = Koha::Acquisition::Booksellers->find( $booksellerid );
74
75
76
$template->param( basket => Koha::Acquisition::Baskets->find($basketno) );
77
75
#show all orders that have uncertain price for the bookseller
78
#show all orders that have uncertain price for the bookseller
76
my $pendingorders = SearchOrders({
79
my $pendingorders = SearchOrders({
77
    booksellerid => $booksellerid,
80
    booksellerid => $booksellerid,
(-)a/installer/data/mysql/atomicupdate/bug_15685-add_create_items_to_aqbasket.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE aqbasket ADD COLUMN create_items ENUM('ordering', 'receiving', 'cataloguing') DEFAULT NULL;
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2992-2997 CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions Link Here
2992
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2992
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2993
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2993
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2994
  `billingplace` varchar(10) default NULL, -- basket billing place
2994
  `billingplace` varchar(10) default NULL, -- basket billing place
2995
  create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket
2995
  branch varchar(10) default NULL, -- basket branch
2996
  branch varchar(10) default NULL, -- basket branch
2996
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2997
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2997
  PRIMARY KEY  (`basketno`),
2998
  PRIMARY KEY  (`basketno`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +10 lines)
Lines 423-431 Link Here
423
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
423
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
424
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
424
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
425
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
425
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
426
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
427
                <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
426
                <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
428
427
428
                [% IF basket.create_items %]
429
                    <li>
430
                        <span class="label">Create items when:</span>
431
                        [% SWITCH basket.create_items %]
432
                            [% CASE 'receiving' %]Receiving items
433
                            [% CASE 'cataloguing' %]Cataloguing items
434
                            [% CASE %]Placing orders
435
                        [% END %]
436
                    </li>
437
                [% END %]
429
438
430
                </ol>
439
                </ol>
431
                </div>
440
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-1 / +17 lines)
Lines 1-4 Link Here
1
[% USE Branches %]
1
[% USE Branches %]
2
[% USE Koha %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Acquisitions &rsaquo;
4
<title>Koha &rsaquo; Acquisitions &rsaquo;
4
[% IF ( add_form ) %]
5
[% IF ( add_form ) %]
Lines 42-48 Link Here
42
                [% IF ( basketno ) %]
43
                [% IF ( basketno ) %]
43
                    <li>
44
                    <li>
44
                        <input type="hidden" name="basketno" value="[% basketno %]" />
45
                        <input type="hidden" name="basketno" value="[% basketno %]" />
45
                        <input type="hidden" name="is_an_edit" value="1" />
46
                        <input type="hidden" name="rs_an_edit" value="1" />
46
                    </li>
47
                    </li>
47
                [% END %]
48
                [% END %]
48
                <li>
49
                <li>
Lines 107-112 Link Here
107
                    [% END %]
108
                    [% END %]
108
                    <div class="hint">Standing orders do not close when received.</div>
109
                    <div class="hint">Standing orders do not close when received.</div>
109
                </li>
110
                </li>
111
                [% UNLESS basketno %]
112
                 <li>
113
                    <label for="create_items">Create items when:</label>
114
                    <select name="create_items" id="create_items">
115
                        [% SWITCH Koha.Preference('AcqCreateItem') %]
116
                            [% CASE 'receiving' %]<option value="">use default (receiving an order).</option>
117
                            [% CASE 'cataloguing' %]<option value="">use default (cataloging the record).</option>
118
                            [% CASE %]<option value="">use default (placing an order).</option>
119
                        [% END %]
120
                        <option value="ordering">placing an order.</option>
121
                        <option value="receiving">receiving an order.</option>
122
                        <option value="cataloguing">cataloging the record.</option>
123
                    </select>
124
                </li>
125
                [% END %]
110
            </ol>
126
            </ol>
111
        </fieldset>
127
        </fieldset>
112
        <fieldset class="action">
128
        <fieldset class="action">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-1 / +1 lines)
Lines 441-447 Link Here
441
                <td>[% order.unitprice | $Price %]</td>
441
                <td>[% order.unitprice | $Price %]</td>
442
                <td>[% order.total | $Price %]</td>
442
                <td>[% order.total | $Price %]</td>
443
                <td>
443
                <td>
444
                    [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
444
                    [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
445
                      [% IF loop_receive.cannot_cancel %]
445
                      [% IF loop_receive.cannot_cancel %]
446
                        [% span_title = BLOCK %]
446
                        [% span_title = BLOCK %]
447
                            Cannot cancel receipt of this order line because it
447
                            Cannot cancel receipt of this order line because it
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt (-1 / +1 lines)
Lines 133-139 var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the p Link Here
133
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
133
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
134
	    </td>
134
	    </td>
135
	    <td>
135
	    <td>
136
        [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
136
        [% IF basket.effective_create_items == 'ordering' %]
137
            [% uncertainpriceorder.quantity %]
137
            [% uncertainpriceorder.quantity %]
138
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
138
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
139
        [% ELSE %]
139
        [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/acquisitions.pref (+1 lines)
Lines 8-13 Acquisitions: Link Here
8
                  ordering: placing an order.
8
                  ordering: placing an order.
9
                  receiving: receiving an order.
9
                  receiving: receiving an order.
10
                  cataloguing: cataloging the record.
10
                  cataloguing: cataloging the record.
11
            - This is only the default behavior, and can be changed per-basket.
11
        -
12
        -
12
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/items.html' target='blank'>database columns</a> should be unique in an item:"
13
            - "The following <a href='http://schema.koha-community.org/__VERSION__/tables/items.html' target='blank'>database columns</a> should be unique in an item:"
13
            - pref: UniqueItemFields
14
            - pref: UniqueItemFields
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-2 / +2 lines)
Lines 654-660 Link Here
654
                            <p>This record has many physical items ([% items_count %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]&amp;viewallitems=1">Click here to view them all.</a></p>
654
                            <p>This record has many physical items ([% items_count %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber | html %]&amp;viewallitems=1">Click here to view them all.</a></p>
655
                        [% ELSIF ( itemloop.size ) %]
655
                        [% ELSIF ( itemloop.size ) %]
656
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
656
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
657
                            [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
657
                            [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
658
                              [% IF acquisition_details.total_quantity == 1 %]
658
                              [% IF acquisition_details.total_quantity == 1 %]
659
                                <span>1 item is on order.</span>
659
                                <span>1 item is on order.</span>
660
                              [% ELSE %]
660
                              [% ELSE %]
Lines 681-687 Link Here
681
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
681
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
682
                                [% END %]
682
                                [% END %]
683
                            [% ELSE %]
683
                            [% ELSE %]
684
                                [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
684
                                [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
685
                                  [% IF acquisition_details.total_quantity == 1 %]
685
                                  [% IF acquisition_details.total_quantity == 1 %]
686
                                    <span>1 item is on order.</span>
686
                                    <span>1 item is on order.</span>
687
                                  [% ELSE %]
687
                                  [% ELSE %]
(-)a/opac/opac-detail.pl (-5 / +4 lines)
Lines 54-59 use Koha::RecordProcessor; Link Here
54
use Koha::AuthorisedValues;
54
use Koha::AuthorisedValues;
55
use Koha::Biblios;
55
use Koha::Biblios;
56
use Koha::ItemTypes;
56
use Koha::ItemTypes;
57
use Koha::Acquisition::Order;
57
use Koha::Virtualshelves;
58
use Koha::Virtualshelves;
58
use Koha::Patrons;
59
use Koha::Patrons;
59
use Koha::Ratings;
60
use Koha::Ratings;
Lines 639-645 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
639
    });
640
    });
640
    my $total_quantity = 0;
641
    my $total_quantity = 0;
641
    for my $order ( @$orders ) {
642
    for my $order ( @$orders ) {
642
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
643
        my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
644
        if ( $basket->effective_create_items eq 'ordering' ) {
643
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
645
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
644
                push @itemnumbers_on_order, $itemnumber;
646
                push @itemnumbers_on_order, $itemnumber;
645
            }
647
            }
Lines 700-708 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
700
        $itm->{transfertto}   = $transfertto;
702
        $itm->{transfertto}   = $transfertto;
701
     }
703
     }
702
    
704
    
703
    if (    C4::Context->preference('OPACAcquisitionDetails')
705
    if ( C4::Context->preference('OPACAcquisitionDetails') ) {
704
        and C4::Context->preference('AcqCreateItem') eq 'ordering' )
705
    {
706
        $itm->{on_order} = 1
706
        $itm->{on_order} = 1
707
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
707
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
708
    }
708
    }
709
- 

Return to bug 15685