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

(-)a/C4/Acquisition.pm (-10 / +14 lines)
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
(-)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 (-2 / +4 lines)
Lines 45-50 use C4::Members; Link Here
45
use Koha::Number::Price;
45
use Koha::Number::Price;
46
use Koha::Libraries;
46
use Koha::Libraries;
47
use Koha::Acquisition::Currencies;
47
use Koha::Acquisition::Currencies;
48
use Koha::Acquisition::Baskets;
48
use Koha::Acquisition::Order;
49
use Koha::Acquisition::Order;
49
use Koha::Acquisition::Booksellers;
50
use Koha::Acquisition::Booksellers;
50
51
Lines 77-82 if ($cgiparams->{'import_batch_id'} && $op eq ""){ Link Here
77
if (! $cgiparams->{'basketno'}){
78
if (! $cgiparams->{'basketno'}){
78
    die "Basketnumber required to order from iso2709 file import";
79
    die "Basketnumber required to order from iso2709 file import";
79
}
80
}
81
my $basket = Koha::Acquisition::Baskets->find( $cgiparams->{basketno} );
80
82
81
#
83
#
82
# 1st step = choose the file to import into acquisition
84
# 1st step = choose the file to import into acquisition
Lines 101-107 if ($op eq ""){ Link Here
101
                     );
103
                     );
102
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
104
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
103
    my $basket = GetBasket($cgiparams->{basketno});
105
    my $basket = GetBasket($cgiparams->{basketno});
104
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
106
    if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) {
105
        # prepare empty item form
107
        # prepare empty item form
106
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
108
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
107
109
Lines 380-386 if ($op eq ""){ Link Here
380
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
382
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
381
        # this is not optimised, but it's working !
383
        # this is not optimised, but it's working !
382
        my $basket = GetBasket($cgiparams->{basketno});
384
        my $basket = GetBasket($cgiparams->{basketno});
383
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' && !$basket->{is_standing} ) {
385
        if ( $basket->effective_create_items eq 'ordering' && !$basket->{is_standing} ) {
384
            my @tags         = $input->multi_param('tag');
386
            my @tags         = $input->multi_param('tag');
385
            my @subfields    = $input->multi_param('subfield');
387
            my @subfields    = $input->multi_param('subfield');
386
            my @field_values = $input->multi_param('field_value');
388
            my @field_values = $input->multi_param('field_value');
(-)a/acqui/basket.pl (+1 lines)
Lines 389-394 if ( $op eq 'list' ) { Link Here
389
    }
389
    }
390
390
391
    $template->param(
391
    $template->param(
392
        basket               => $basket,
392
        basketno             => $basketno,
393
        basketno             => $basketno,
393
        basket               => $basket,
394
        basket               => $basket,
394
        basketname           => $basket->{'basketname'},
395
        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 / +10 lines)
Lines 33-38 use C4::Search; Link Here
33
33
34
use Koha::Number::Price;
34
use Koha::Number::Price;
35
use Koha::Acquisition::Booksellers;
35
use Koha::Acquisition::Booksellers;
36
use Koha::Acquisition::Order;
36
37
37
use List::MoreUtils qw/any/;
38
use List::MoreUtils qw/any/;
38
39
Lines 58-70 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
<<<<<<< HEAD
61
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
63
$unitprice = Koha::Number::Price->new( $unitprice )->unformat();
62
64
63
#need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME
65
#need old receivedate if we update the order, parcel.pl only shows the right parcel this way FIXME
66
=======
67
my $basket = Koha::Acquisition::Order->fetch({ordernumber => $ordernumber})->basket;
68
69
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
70
>>>>>>> Bug 15685: Allow creation of items (AcqCreateItem) to be customizable per-basket
64
if ($quantityrec > $origquantityrec ) {
71
if ($quantityrec > $origquantityrec ) {
65
    my @received_items = ();
72
    my @received_items = ();
66
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
73
    if ($basket->effective_create_items eq 'ordering') {
67
        @received_items = $input->multi_param('items_to_receive');
74
        @received_items = $input->param('items_to_receive');
68
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
75
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
69
        if ( @affects ) {
76
        if ( @affects ) {
70
            my $frameworkcode = GetFrameworkCode($biblionumber);
77
            my $frameworkcode = GetFrameworkCode($biblionumber);
Lines 110-116 if ($quantityrec > $origquantityrec ) { Link Here
110
    }
117
    }
111
118
112
    # now, add items if applicable
119
    # now, add items if applicable
113
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
120
    if ($basket->effective_create_items eq 'receiving') {
114
121
115
        my @tags         = $input->multi_param('tag');
122
        my @tags         = $input->multi_param('tag');
116
        my @subfields    = $input->multi_param('subfield');
123
        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::Booksellers->find( $booksellerid );
134
my $bookseller = Koha::Acquisition::Booksellers->find( $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 110-115 unless ( $results and @$results) { Link Here
110
110
111
# prepare the form for receiving
111
# prepare the form for receiving
112
my $order = $results->[0];
112
my $order = $results->[0];
113
my $basket = Koha::Acquisition::Order->fetch({ordernumber => $ordernumber})->basket;
113
114
114
# Check if ACQ framework exists
115
# Check if ACQ framework exists
115
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
116
my $acq_fw = GetMarcStructure( 1, 'ACQ', { unsafe => 1 } );
Lines 117-123 unless($acq_fw) { Link Here
117
    $template->param('NoACQframework' => 1);
118
    $template->param('NoACQframework' => 1);
118
}
119
}
119
120
120
my $AcqCreateItem = C4::Context->preference('AcqCreateItem');
121
my $AcqCreateItem = $basket->effective_create_items;
121
if ($AcqCreateItem eq 'receiving') {
122
if ($AcqCreateItem eq 'receiving') {
122
    $template->param(
123
    $template->param(
123
        AcqCreateItemReceiving => 1,
124
        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 2987-2992 CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions Link Here
2987
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2987
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2988
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2988
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2989
  `billingplace` varchar(10) default NULL, -- basket billing place
2989
  `billingplace` varchar(10) default NULL, -- basket billing place
2990
  create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket
2990
  branch varchar(10) default NULL, -- basket branch
2991
  branch varchar(10) default NULL, -- basket branch
2991
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2992
  is_standing TINYINT(1) NOT NULL DEFAULT 0, -- orders in this basket are standing
2992
  PRIMARY KEY  (`basketno`),
2993
  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 132-138 var MSG_INVALIDPRICE = _("ERROR: Price is not a valid number, please check the p Link Here
132
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
132
            <input class="check_uncertain" data-ordernumber="[% uncertainpriceorder.ordernumber %]" type="text" size="10" name="price[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.listprice %]" />
133
	    </td>
133
	    </td>
134
	    <td>
134
	    <td>
135
        [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
135
        [% IF basket.effective_create_items == 'ordering' %]
136
            [% uncertainpriceorder.quantity %]
136
            [% uncertainpriceorder.quantity %]
137
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
137
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
138
        [% ELSE %]
138
        [% 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 %]&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 %]&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
                                1 item is on order.
659
                                1 item is on order.
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
                                    1 item is on order.
686
                                    1 item is on order.
687
                                  [% ELSE %]
687
                                  [% ELSE %]
(-)a/opac/opac-detail.pl (-5 / +4 lines)
Lines 52-57 use Koha::RecordProcessor; Link Here
52
use Koha::AuthorisedValues;
52
use Koha::AuthorisedValues;
53
use Koha::Biblios;
53
use Koha::Biblios;
54
use Koha::ItemTypes;
54
use Koha::ItemTypes;
55
use Koha::Acquisition::Order;
55
use Koha::Virtualshelves;
56
use Koha::Virtualshelves;
56
use Koha::Ratings;
57
use Koha::Ratings;
57
use Koha::Reviews;
58
use Koha::Reviews;
Lines 636-642 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
636
    });
637
    });
637
    my $total_quantity = 0;
638
    my $total_quantity = 0;
638
    for my $order ( @$orders ) {
639
    for my $order ( @$orders ) {
639
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
640
        my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
641
        if ( $basket->effective_create_items eq 'ordering' ) {
640
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
642
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
641
                push @itemnumbers_on_order, $itemnumber;
643
                push @itemnumbers_on_order, $itemnumber;
642
            }
644
            }
Lines 697-705 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
697
        $itm->{transfertto}   = $transfertto;
699
        $itm->{transfertto}   = $transfertto;
698
     }
700
     }
699
    
701
    
700
    if (    C4::Context->preference('OPACAcquisitionDetails')
702
    if ( C4::Context->preference('OPACAcquisitionDetails') ) {
701
        and C4::Context->preference('AcqCreateItem') eq 'ordering' )
702
    {
703
        $itm->{on_order} = 1
703
        $itm->{on_order} = 1
704
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
704
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
705
    }
705
    }
706
- 

Return to bug 15685