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

(-)a/C4/Acquisition.pm (-10 / +14 lines)
Lines 186-192 sub GetBasket { Link Here
186
=head3 NewBasket
186
=head3 NewBasket
187
187
188
  $basket = &NewBasket( $booksellerid, $authorizedby, $basketname,
188
  $basket = &NewBasket( $booksellerid, $authorizedby, $basketname,
189
      $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing );
189
      $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $is_standing, $create_items );
190
190
191
Create a new basket in aqbasket table
191
Create a new basket in aqbasket table
192
192
Lines 205-211 The other parameters are optional, see ModBasketHeader for more info on them. Link Here
205
sub NewBasket {
205
sub NewBasket {
206
    my ( $booksellerid, $authorisedby, $basketname, $basketnote,
206
    my ( $booksellerid, $authorisedby, $basketname, $basketnote,
207
        $basketbooksellernote, $basketcontractnumber, $deliveryplace,
207
        $basketbooksellernote, $basketcontractnumber, $deliveryplace,
208
        $billingplace, $is_standing ) = @_;
208
        $billingplace, $is_standing, $create_items ) = @_;
209
    my $dbh = C4::Context->dbh;
209
    my $dbh = C4::Context->dbh;
210
    my $query =
210
    my $query =
211
        'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) '
211
        'INSERT INTO aqbasket (creationdate,booksellerid,authorisedby) '
Lines 217-223 sub NewBasket { Link Here
217
    $basketnote           ||= q{};
217
    $basketnote           ||= q{};
218
    $basketbooksellernote ||= q{};
218
    $basketbooksellernote ||= q{};
219
    ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote,
219
    ModBasketHeader( $basket, $basketname, $basketnote, $basketbooksellernote,
220
        $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing );
220
        $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items );
221
    return $basket;
221
    return $basket;
222
}
222
}
223
223
Lines 544-564 Modifies a basket's header. Link Here
544
544
545
=item C<$is_standing> is the "is_standing" field in the aqbasket table.
545
=item C<$is_standing> is the "is_standing" field in the aqbasket table.
546
546
547
=item C<$create_items> should be set to 'ordering', 'receiving' or 'cataloguing' (or undef, in which
548
case the AcqCreateItem syspref takes precedence).
549
547
=back
550
=back
548
551
549
=cut
552
=cut
550
553
551
sub ModBasketHeader {
554
sub ModBasketHeader {
552
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing) = @_;
555
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_;
553
    my $query = qq{
556
    my $query = qq{
554
        UPDATE aqbasket
557
        UPDATE aqbasket
555
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=?
558
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, is_standing=?, create_items=?
556
        WHERE basketno=?
559
        WHERE basketno=?
557
    };
560
    };
558
561
559
    my $dbh = C4::Context->dbh;
562
    my $dbh = C4::Context->dbh;
560
    my $sth = $dbh->prepare($query);
563
    my $sth = $dbh->prepare($query);
561
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $basketno);
564
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items || undef, $basketno);
562
565
563
    if ( $contractnumber ) {
566
    if ( $contractnumber ) {
564
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
567
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
Lines 1526-1531 sub CancelReceipt { Link Here
1526
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1529
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1527
1530
1528
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1531
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1532
    my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
1529
1533
1530
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1534
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1531
        # The order line has no parent, just mark it as not received
1535
        # The order line has no parent, just mark it as not received
Lines 1586-1592 sub CancelReceipt { Link Here
1586
            WHERE ordernumber = ?
1590
            WHERE ordernumber = ?
1587
        |, undef, $parent_ordernumber);
1591
        |, undef, $parent_ordernumber);
1588
1592
1589
        _cancel_items_receipt( $ordernumber, $parent_ordernumber );
1593
        _cancel_items_receipt( $basket->effective_create_items, $ordernumber, $parent_ordernumber );
1590
        # Delete order line
1594
        # Delete order line
1591
        $query = qq{
1595
        $query = qq{
1592
            DELETE FROM aqorders
1596
            DELETE FROM aqorders
Lines 1597-1603 sub CancelReceipt { Link Here
1597
1601
1598
    }
1602
    }
1599
1603
1600
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
1604
    if( $basket->effective_create_items eq 'ordering' ) {
1601
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1605
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1602
        if ( @affects ) {
1606
        if ( @affects ) {
1603
            for my $in ( @itemnumbers ) {
1607
            for my $in ( @itemnumbers ) {
Lines 1620-1630 sub CancelReceipt { Link Here
1620
}
1624
}
1621
1625
1622
sub _cancel_items_receipt {
1626
sub _cancel_items_receipt {
1623
    my ( $ordernumber, $parent_ordernumber ) = @_;
1627
    my ( $effective_create_items, $ordernumber, $parent_ordernumber ) = @_;
1624
    $parent_ordernumber ||= $ordernumber;
1628
    $parent_ordernumber ||= $ordernumber;
1625
1629
1626
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1630
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1627
    if(C4::Context->preference('AcqCreateItem') eq 'receiving') {
1631
    if ( $effective_create_items eq 'receiving' ) {
1628
        # Remove items that were created at receipt
1632
        # Remove items that were created at receipt
1629
        my $query = qq{
1633
        my $query = qq{
1630
            DELETE FROM items, aqorders_items
1634
            DELETE FROM items, aqorders_items
(-)a/Koha/Acquisition/Basket.pm (+54 lines)
Line 0 Link Here
1
package Koha::Acquisition::Basket;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use Koha::Database;
23
24
use base qw(Koha::Object);
25
26
=head1 NAME
27
28
Koha::Acquisition::Basket - Koha Basket Object class
29
30
=head1 API
31
32
=head2 Class Methods
33
34
=head3 effective_create_items
35
36
Returns C<create_items> for this basket, falling back to C<AcqCreateItem> if unset.
37
38
=cut
39
40
sub effective_create_items {
41
    my ( $self ) = @_;
42
43
    return $self->create_items || C4::Context->preference('AcqCreateItem');
44
}
45
46
=head3 type
47
48
=cut
49
50
sub _type {
51
    return 'Aqbasket';
52
}
53
54
1;
(-)a/Koha/Acquisition/Baskets.pm (+51 lines)
Line 0 Link Here
1
package Koha::Acquisition::Baskets;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use Modern::Perl;
19
20
use Carp;
21
22
use C4::Context;
23
use Koha::Database;
24
25
use Koha::Acquisition::Basket;
26
27
use base qw(Koha::Objects);
28
29
=head1 NAME
30
31
Koha::Acquisition::Baskets - Koha Basket Object set class
32
33
=head1 API
34
35
=head2 Class Methods
36
37
=cut
38
39
=head3 type
40
41
=cut
42
43
sub _type {
44
    return 'Aqbasket';
45
}
46
47
sub object_class {
48
    return 'Koha::Acquisition::Basket';
49
}
50
51
1;
(-)a/Koha/Acquisition/Order.pm (+6 lines)
Lines 2-7 package Koha::Acquisition::Order; Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Koha::Acquisition::Baskets;
5
use Koha::Database;
6
use Koha::Database;
6
use Koha::DateUtils qw( dt_from_string output_pref );
7
use Koha::DateUtils qw( dt_from_string output_pref );
7
8
Lines 68-73 sub add_item { Link Here
68
    $rs->create({ ordernumber => $self->{ordernumber}, itemnumber => $itemnumber });
69
    $rs->create({ ordernumber => $self->{ordernumber}, itemnumber => $itemnumber });
69
}
70
}
70
71
72
sub basket {
73
    my ( $self )  = @_;
74
    return Koha::Acquisition::Baskets->find( $self->{basketno} );
75
}
76
71
# TODO Move code from ModItemOrder
77
# TODO Move code from ModItemOrder
72
sub update_item {
78
sub update_item {
73
    die "not implemented yet";
79
    die "not implemented yet";
(-)a/acqui/addorder.pl (-1 / +3 lines)
Lines 233-238 my $basketno=$$orderinfo{basketno}; Link Here
233
my $basket = GetBasket($basketno);
233
my $basket = GetBasket($basketno);
234
234
235
my $user = $input->remote_user;
235
my $user = $input->remote_user;
236
my $basketno=$$orderinfo{basketno};
237
my $basket = Koha::Acquisition::Baskets->find( $basketno );
236
238
237
# create, modify or delete biblio
239
# create, modify or delete biblio
238
# create if $quantity>0 and $existing='no'
240
# create if $quantity>0 and $existing='no'
Lines 290-296 if ( $basket->{is_standing} || $orderinfo->{quantity} ne '0' ) { Link Here
290
    }
292
    }
291
293
292
    # now, add items if applicable
294
    # now, add items if applicable
293
    if (C4::Context->preference('AcqCreateItem') eq 'ordering') {
295
    if ($basket->effective_create_items eq 'ordering') {
294
296
295
        my @tags         = $input->multi_param('tag');
297
        my @tags         = $input->multi_param('tag');
296
        my @subfields    = $input->multi_param('subfield');
298
        my @subfields    = $input->multi_param('subfield');
(-)a/acqui/addorderiso2709.pl (-1 / +13 lines)
Lines 43-48 use C4::Members; Link Here
43
43
44
use Koha::Number::Price;
44
use Koha::Number::Price;
45
use Koha::Acquisition::Currencies;
45
use Koha::Acquisition::Currencies;
46
use Koha::Acquisition::Baskets;
46
use Koha::Acquisition::Order;
47
use Koha::Acquisition::Order;
47
use Koha::Acquisition::Bookseller;
48
use Koha::Acquisition::Bookseller;
48
49
Lines 75-80 if ($cgiparams->{'import_batch_id'} && $op eq ""){ Link Here
75
if (! $cgiparams->{'basketno'}){
76
if (! $cgiparams->{'basketno'}){
76
    die "Basketnumber required to order from iso2709 file import";
77
    die "Basketnumber required to order from iso2709 file import";
77
}
78
}
79
my $basket = Koha::Acquisition::Baskets->find( $cgiparams->{basketno} );
78
80
79
#
81
#
80
# 1st step = choose the file to import into acquisition
82
# 1st step = choose the file to import into acquisition
Lines 99-105 if ($op eq ""){ Link Here
99
                     );
101
                     );
100
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
102
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
101
    my $basket = GetBasket($cgiparams->{basketno});
103
    my $basket = GetBasket($cgiparams->{basketno});
102
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
104
    if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) {
103
        # prepare empty item form
105
        # prepare empty item form
104
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
106
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
105
107
Lines 263-268 if ($op eq ""){ Link Here
263
        # 4th, add items if applicable
265
        # 4th, add items if applicable
264
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
266
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
265
        # this is not optimised, but it's working !
267
        # this is not optimised, but it's working !
268
<<<<<<< HEAD
266
        my $basket = GetBasket($cgiparams->{basketno});
269
        my $basket = GetBasket($cgiparams->{basketno});
267
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
270
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
268
            my @tags         = $input->multi_param('tag');
271
            my @tags         = $input->multi_param('tag');
Lines 271-276 if ($op eq ""){ Link Here
271
            my @serials      = $input->multi_param('serial');
274
            my @serials      = $input->multi_param('serial');
272
            my @ind_tag   = $input->multi_param('ind_tag');
275
            my @ind_tag   = $input->multi_param('ind_tag');
273
            my @indicator = $input->multi_param('indicator');
276
            my @indicator = $input->multi_param('indicator');
277
=======
278
        if ( $basket->effective_create_items eq 'ordering' ) {
279
            my @tags         = $input->param('tag');
280
            my @subfields    = $input->param('subfield');
281
            my @field_values = $input->param('field_value');
282
            my @serials      = $input->param('serial');
283
            my @ind_tag   = $input->param('ind_tag');
284
            my @indicator = $input->param('indicator');
285
>>>>>>> Bug 15685: Allow creation of items (AcqCreateItem) to be customizable per-basket
274
            my $item;
286
            my $item;
275
            push @{ $item->{tags} },         $tags[0];
287
            push @{ $item->{tags} },         $tags[0];
276
            push @{ $item->{subfields} },    $subfields[0];
288
            push @{ $item->{subfields} },    $subfields[0];
(-)a/acqui/basket.pl (+1 lines)
Lines 376-381 if ( $op eq 'list' ) { Link Here
376
    }
376
    }
377
377
378
    $template->param(
378
    $template->param(
379
        basket               => $basket,
379
        basketno             => $basketno,
380
        basketno             => $basketno,
380
        basket               => $basket,
381
        basket               => $basket,
381
        basketname           => $basket->{'basketname'},
382
        basketname           => $basket->{'basketname'},
(-)a/acqui/basketheader.pl (+2 lines)
Lines 142-147 if ( $op eq 'add_form' ) { Link Here
142
            $input->param('deliveryplace'),
142
            $input->param('deliveryplace'),
143
            $input->param('billingplace'),
143
            $input->param('billingplace'),
144
            $input->param('is_standing') ? 1 : undef,
144
            $input->param('is_standing') ? 1 : undef,
145
            $input->param('create_items'),
145
        );
146
        );
146
    } else { #New basket
147
    } else { #New basket
147
        $basketno = NewBasket(
148
        $basketno = NewBasket(
Lines 154-159 if ( $op eq 'add_form' ) { Link Here
154
            $input->param('deliveryplace'),
155
            $input->param('deliveryplace'),
155
            $input->param('billingplace'),
156
            $input->param('billingplace'),
156
            $input->param('is_standing') ? 1 : undef,
157
            $input->param('is_standing') ? 1 : undef,
158
            $input->param('create_items'),
157
        );
159
        );
158
    }
160
    }
159
    print $input->redirect('basket.pl?basketno='.$basketno);
161
    print $input->redirect('basket.pl?basketno='.$basketno);
(-)a/acqui/finishreceive.pl (-3 / +6 lines)
Lines 33-38 use C4::Items; Link Here
33
use C4::Search;
33
use C4::Search;
34
34
35
use Koha::Acquisition::Bookseller;
35
use Koha::Acquisition::Bookseller;
36
use Koha::Acquisition::Order;
36
37
37
use List::MoreUtils qw/any/;
38
use List::MoreUtils qw/any/;
38
39
Lines 58-68 my $bookfund = $input->param("bookfund"); Link Here
58
my $order            = GetOrder($ordernumber);
59
my $order            = GetOrder($ordernumber);
59
my $new_ordernumber  = $ordernumber;
60
my $new_ordernumber  = $ordernumber;
60
61
62
my $basket = Koha::Acquisition::Order->find($ordernumber)->basket;
63
61
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
64
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
62
if ($quantityrec > $origquantityrec ) {
65
if ($quantityrec > $origquantityrec ) {
63
    my @received_items = ();
66
    my @received_items = ();
64
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
67
    if ($basket->effective_create_items eq 'ordering') {
65
        @received_items = $input->multi_param('items_to_receive');
68
        @received_items = $input->param('items_to_receive');
66
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
69
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
67
        if ( @affects ) {
70
        if ( @affects ) {
68
            my $frameworkcode = GetFrameworkCode($biblionumber);
71
            my $frameworkcode = GetFrameworkCode($biblionumber);
Lines 110-116 if ($quantityrec > $origquantityrec ) { Link Here
110
    }
113
    }
111
114
112
    # now, add items if applicable
115
    # now, add items if applicable
113
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
116
    if ($basket->effective_create_items eq 'receiving') {
114
117
115
        my @tags         = $input->multi_param('tag');
118
        my @tags         = $input->multi_param('tag');
116
        my @subfields    = $input->multi_param('subfield');
119
        my @subfields    = $input->multi_param('subfield');
(-)a/acqui/neworderempty.pl (-2 / +3 lines)
Lines 129-134 if(!$basketno) { Link Here
129
}
129
}
130
130
131
our $basket = GetBasket($basketno);
131
our $basket = GetBasket($basketno);
132
my $basketobj = Koha::Acquisition::Baskets->find( $basketno );
132
$booksellerid = $basket->{booksellerid} unless $booksellerid;
133
$booksellerid = $basket->{booksellerid} unless $booksellerid;
133
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
134
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
134
135
Lines 242-248 if ($close) { Link Here
242
$template->param( sort1 => $data->{'sort1'} );
243
$template->param( sort1 => $data->{'sort1'} );
243
$template->param( sort2 => $data->{'sort2'} );
244
$template->param( sort2 => $data->{'sort2'} );
244
245
245
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
246
if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) {
246
    # Check if ACQ framework exists
247
    # Check if ACQ framework exists
247
    my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
248
    my $marc = GetMarcStructure(1, 'ACQ', { unsafe => 1 } );
248
    unless($marc) {
249
    unless($marc) {
Lines 357-363 $template->param( Link Here
357
    barcode_subfield => $barcode_subfield,
358
    barcode_subfield => $barcode_subfield,
358
    import_batch_id  => $import_batch_id,
359
    import_batch_id  => $import_batch_id,
359
    subscriptionid   => $subscriptionid,
360
    subscriptionid   => $subscriptionid,
360
    acqcreate        => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
361
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
361
    users_ids        => join(':', @order_user_ids),
362
    users_ids        => join(':', @order_user_ids),
362
    users            => \@order_users,
363
    users            => \@order_users,
363
    (uc(C4::Context->preference("marcflavour"))) => 1
364
    (uc(C4::Context->preference("marcflavour"))) => 1
(-)a/acqui/orderreceive.pl (-1 / +2 lines)
Lines 109-114 unless ( $results and @$results) { Link Here
109
109
110
# prepare the form for receiving
110
# prepare the form for receiving
111
my $order = $results->[0];
111
my $order = $results->[0];
112
my $basket = Koha::Acquisition::Order->find($ordernumber)->basket;
112
113
113
# Check if ACQ framework exists
114
# Check if ACQ framework exists
114
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
115
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
Lines 116-122 unless($acq_fw) { Link Here
116
    $template->param('NoACQframework' => 1);
117
    $template->param('NoACQframework' => 1);
117
}
118
}
118
119
119
my $AcqCreateItem = C4::Context->preference('AcqCreateItem');
120
my $AcqCreateItem = $basket->effective_create_items;
120
if ($AcqCreateItem eq 'receiving') {
121
if ($AcqCreateItem eq 'receiving') {
121
    $template->param(
122
    $template->param(
122
        AcqCreateItemReceiving => 1,
123
        AcqCreateItemReceiving => 1,
(-)a/acqui/parcel.pl (+2 lines)
Lines 67-72 use C4::Output; Link Here
67
use C4::Suggestions;
67
use C4::Suggestions;
68
use C4::Reserves qw/GetReservesFromBiblionumber/;
68
use C4::Reserves qw/GetReservesFromBiblionumber/;
69
69
70
use Koha::Acquisition::Baskets;
70
use Koha::Acquisition::Bookseller;
71
use Koha::Acquisition::Bookseller;
71
use Koha::DateUtils;
72
use Koha::DateUtils;
72
73
Lines 270-275 unless( defined $invoice->{closedate} ) { Link Here
270
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
271
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
271
        $line{holds}                = $holds;
272
        $line{holds}                = $holds;
272
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
273
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
274
        $line{basket}               = Koha::Acquisition::Baskets->find( $line{basketno} );
273
275
274
        my $budget_name = GetBudgetName( $line{budget_id} );
276
        my $budget_name = GetBudgetName( $line{budget_id} );
275
        $line{budget_name} = $budget_name;
277
        $line{budget_name} = $budget_name;
(-)a/acqui/uncertainprice.pl (+3 lines)
Lines 54-59 use C4::Bookseller::Contact; Link Here
54
use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
54
use C4::Acquisition qw/SearchOrders GetOrder ModOrder/;
55
use C4::Biblio qw/GetBiblioData/;
55
use C4::Biblio qw/GetBiblioData/;
56
56
57
use Koha::Acquisition::Baskets;
57
use Koha::Acquisition::Bookseller;
58
use Koha::Acquisition::Bookseller;
58
59
59
my $input=new CGI;
60
my $input=new CGI;
Lines 73-78 my $op = $input->param('op'); Link Here
73
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
74
my $owner = $input->param('owner') || 0 ; # flag to see only "my" orders, or everyone orders
74
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
75
my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
75
76
77
$template->param( basket => Koha::Acquisition::Baskets->find($basketno) );
78
76
#show all orders that have uncertain price for the bookseller
79
#show all orders that have uncertain price for the bookseller
77
my $pendingorders = SearchOrders({
80
my $pendingorders = SearchOrders({
78
    booksellerid => $booksellerid,
81
    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 2964-2969 CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions Link Here
2964
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2964
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2965
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2965
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2966
  `billingplace` varchar(10) default NULL, -- basket billing place
2966
  `billingplace` varchar(10) default NULL, -- basket billing place
2967
  create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket
2967
  branch varchar(10) default NULL, -- basket branch
2968
  branch varchar(10) default NULL, -- basket branch
2968
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2969
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2969
  PRIMARY KEY  (`basketno`),
2970
  PRIMARY KEY  (`basketno`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (-1 / +10 lines)
Lines 379-387 Link Here
379
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
379
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
380
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
380
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
381
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
381
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
382
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
383
                <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
382
                <li><span class="label">Orders are standing:</span> [% IF is_standing %]Yes[% ELSE %]No[% END %]</li>
384
383
384
                [% IF basket.create_items %]
385
                    <li>
386
                        <span class="label">Create items when:</span>
387
                        [% SWITCH basket.create_items %]
388
                            [% CASE 'receiving' %]Receiving items
389
                            [% CASE 'cataloguing' %]Cataloguing items
390
                            [% CASE %]Placing orders
391
                        [% END %]
392
                    </li>
393
                [% END %]
385
394
386
                </ol>
395
                </ol>
387
                </div>
396
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-1 / +16 lines)
Lines 42-48 Link Here
42
                [% IF ( basketno ) %]
42
                [% IF ( basketno ) %]
43
                    <li>
43
                    <li>
44
                        <input type="hidden" name="basketno" value="[% basketno %]" />
44
                        <input type="hidden" name="basketno" value="[% basketno %]" />
45
                        <input type="hidden" name="is_an_edit" value="1" />
45
                        <input type="hidden" name="rs_an_edit" value="1" />
46
                    </li>
46
                    </li>
47
                [% END %]
47
                [% END %]
48
                <li>
48
                <li>
Lines 107-112 Link Here
107
                    [% END %]
107
                    [% END %]
108
                    <div class="hint">Standing orders do not close when received.</div>
108
                    <div class="hint">Standing orders do not close when received.</div>
109
                </li>
109
                </li>
110
                [% UNLESS basketno %]
111
                 <li>
112
                    <label for="create_items">Create items when:</label>
113
                    <select name="create_items" id="create_items">
114
                        [% SWITCH Koha.Preference('AcqCreateItem') %]
115
                            [% CASE 'receiving' %]<option value="">use default (receiving an order).</option>
116
                            [% CASE 'cataloguing' %]<option value="">use default (cataloging the record).</option>
117
                            [% CASE %]<option value="">use default (placing an order).</option>
118
                        [% END %]
119
                        <option value="ordering">placing an order.</option>
120
                        <option value="receiving">receiving an order.</option>
121
                        <option value="cataloguing">cataloging the record.</option>
122
                    </select>
123
                </li>
124
                [% END %]
110
            </ol>
125
            </ol>
111
        </fieldset>
126
        </fieldset>
112
        <fieldset class="action">
127
        <fieldset class="action">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-1 / +1 lines)
Lines 431-437 Link Here
431
                <td>[% order.unitprice | $Price %]</td>
431
                <td>[% order.unitprice | $Price %]</td>
432
                <td>[% order.total | $Price %]</td>
432
                <td>[% order.total | $Price %]</td>
433
                <td>
433
                <td>
434
                    [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
434
                    [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
435
                      [% IF loop_receive.cannot_cancel %]
435
                      [% IF loop_receive.cannot_cancel %]
436
                        [% span_title = BLOCK %]
436
                        [% span_title = BLOCK %]
437
                            Cannot cancel receipt of this order line because it
437
                            Cannot cancel receipt of this order line because it
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt (-1 / +1 lines)
Lines 123-129 var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the p Link Here
123
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
123
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
124
	    </td>
124
	    </td>
125
	    <td>
125
	    <td>
126
        [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
126
        [% IF basket.effective_create_items == 'ordering' %]
127
            [% uncertainpriceorder.quantity %]
127
            [% uncertainpriceorder.quantity %]
128
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
128
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
129
        [% ELSE %]
129
        [% 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/tables/items.html' target='blank'>database columns</a> should be unique in an item:"
13
            - "The following <a href='http://schema.koha-community.org/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 642-648 Link Here
642
                            <p>This record has many physical items ([% items_count %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]&amp;viewallitems=1">Click here to view them all.</a></p>
642
                            <p>This record has many physical items ([% items_count %]). <a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% biblionumber %]&amp;viewallitems=1">Click here to view them all.</a></p>
643
                        [% ELSIF ( itemloop.size ) %]
643
                        [% ELSIF ( itemloop.size ) %]
644
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
644
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
645
                            [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
645
                            [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
646
                              [% IF acquisition_details.total_quantity == 1 %]
646
                              [% IF acquisition_details.total_quantity == 1 %]
647
                                1 item is on order.
647
                                1 item is on order.
648
                              [% ELSE %]
648
                              [% ELSE %]
Lines 669-675 Link Here
669
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
669
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
670
                                [% END %]
670
                                [% END %]
671
                            [% ELSE %]
671
                            [% ELSE %]
672
                                [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
672
                                [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
673
                                  [% IF acquisition_details.total_quantity == 1 %]
673
                                  [% IF acquisition_details.total_quantity == 1 %]
674
                                    1 item is on order.
674
                                    1 item is on order.
675
                                  [% ELSE %]
675
                                  [% ELSE %]
(-)a/opac/opac-detail.pl (-5 / +5 lines)
Lines 49-54 use C4::HTML5Media; Link Here
49
use C4::CourseReserves qw(GetItemCourseReservesInfo);
49
use C4::CourseReserves qw(GetItemCourseReservesInfo);
50
use Koha::RecordProcessor;
50
use Koha::RecordProcessor;
51
use Koha::AuthorisedValues;
51
use Koha::AuthorisedValues;
52
53
use Koha::Acquisition::Order;
52
use Koha::Virtualshelves;
54
use Koha::Virtualshelves;
53
use Koha::Ratings;
55
use Koha::Ratings;
54
use Koha::Reviews;
56
use Koha::Reviews;
Lines 625-631 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
625
    });
627
    });
626
    my $total_quantity = 0;
628
    my $total_quantity = 0;
627
    for my $order ( @$orders ) {
629
    for my $order ( @$orders ) {
628
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
630
        my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
631
        if ( $basket->effective_create_items eq 'ordering' ) {
629
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
632
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
630
                push @itemnumbers_on_order, $itemnumber;
633
                push @itemnumbers_on_order, $itemnumber;
631
            }
634
            }
Lines 686-694 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
686
        $itm->{transfertto}   = $transfertto;
689
        $itm->{transfertto}   = $transfertto;
687
     }
690
     }
688
    
691
    
689
    if (    C4::Context->preference('OPACAcquisitionDetails')
692
    if ( C4::Context->preference('OPACAcquisitionDetails') ) {
690
        and C4::Context->preference('AcqCreateItem') eq 'ordering' )
691
    {
692
        $itm->{on_order} = 1
693
        $itm->{on_order} = 1
693
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
694
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
694
    }
695
    }
695
- 

Return to bug 15685