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 );
191
      $basketnote, $basketbooksellernote, $basketcontractnumber, $deliveryplace, $billingplace, $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 ) = @_;
210
        $billingplace, $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 );
222
        $basketcontractnumber, $booksellerid, $deliveryplace, $billingplace, $create_items );
223
    return $basket;
223
    return $basket;
224
}
224
}
225
225
Lines 532-552 Modifies a basket's header. Link Here
532
532
533
=item C<$billingplace> is the "billingplace" field in the aqbasket table.
533
=item C<$billingplace> is the "billingplace" field in the aqbasket table.
534
534
535
=item C<$create_items> should be set to 'ordering', 'receiving' or 'cataloguing' (or undef, in which
536
case the AcqCreateItem syspref takes precedence).
537
535
=back
538
=back
536
539
537
=cut
540
=cut
538
541
539
sub ModBasketHeader {
542
sub ModBasketHeader {
540
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace) = @_;
543
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $create_items) = @_;
541
    my $query = qq{
544
    my $query = qq{
542
        UPDATE aqbasket
545
        UPDATE aqbasket
543
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?
546
        SET basketname=?, note=?, booksellernote=?, booksellerid=?, deliveryplace=?, billingplace=?, create_items=?
544
        WHERE basketno=?
547
        WHERE basketno=?
545
    };
548
    };
546
549
547
    my $dbh = C4::Context->dbh;
550
    my $dbh = C4::Context->dbh;
548
    my $sth = $dbh->prepare($query);
551
    my $sth = $dbh->prepare($query);
549
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $basketno);
552
    $sth->execute($basketname, $note, $booksellernote, $booksellerid, $deliveryplace, $billingplace, $create_items || undef, $basketno);
550
553
551
    if ( $contractnumber ) {
554
    if ( $contractnumber ) {
552
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
555
        my $query2 ="UPDATE aqbasket SET contractnumber=? WHERE basketno=?";
Lines 1499-1504 sub CancelReceipt { Link Here
1499
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1502
    my $parent_ordernumber = $order->{'parent_ordernumber'};
1500
1503
1501
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1504
    my @itemnumbers = GetItemnumbersFromOrder( $ordernumber );
1505
    my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
1502
1506
1503
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1507
    if($parent_ordernumber == $ordernumber || not $parent_ordernumber) {
1504
        # The order line has no parent, just mark it as not received
1508
        # The order line has no parent, just mark it as not received
Lines 1549-1555 sub CancelReceipt { Link Here
1549
                " receipt";
1553
                " receipt";
1550
            return;
1554
            return;
1551
        }
1555
        }
1552
        _cancel_items_receipt( $ordernumber, $parent_ordernumber );
1556
        _cancel_items_receipt( $basket->effective_create_items, $ordernumber, $parent_ordernumber );
1553
        # Delete order line
1557
        # Delete order line
1554
        $query = qq{
1558
        $query = qq{
1555
            DELETE FROM aqorders
1559
            DELETE FROM aqorders
Lines 1560-1566 sub CancelReceipt { Link Here
1560
1564
1561
    }
1565
    }
1562
1566
1563
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
1567
    if( $basket->effective_create_items eq 'ordering' ) {
1564
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1568
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceiptIsCancelled");
1565
        if ( @affects ) {
1569
        if ( @affects ) {
1566
            for my $in ( @itemnumbers ) {
1570
            for my $in ( @itemnumbers ) {
Lines 1583-1593 sub CancelReceipt { Link Here
1583
}
1587
}
1584
1588
1585
sub _cancel_items_receipt {
1589
sub _cancel_items_receipt {
1586
    my ( $ordernumber, $parent_ordernumber ) = @_;
1590
    my ( $effective_create_items, $ordernumber, $parent_ordernumber ) = @_;
1587
    $parent_ordernumber ||= $ordernumber;
1591
    $parent_ordernumber ||= $ordernumber;
1588
1592
1589
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1593
    my @itemnumbers = GetItemnumbersFromOrder($ordernumber);
1590
    if(C4::Context->preference('AcqCreateItem') eq 'receiving') {
1594
    if ( $effective_create_items eq 'receiving' ) {
1591
        # Remove items that were created at receipt
1595
        # Remove items that were created at receipt
1592
        my $query = qq{
1596
        my $query = qq{
1593
            DELETE FROM items, aqorders_items
1597
            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 65-70 sub add_item { Link Here
65
    $rs->create({ ordernumber => $self->{ordernumber}, itemnumber => $itemnumber });
66
    $rs->create({ ordernumber => $self->{ordernumber}, itemnumber => $itemnumber });
66
}
67
}
67
68
69
sub basket {
70
    my ( $self )  = @_;
71
    return Koha::Acquisition::Baskets->find( $self->{basketno} );
72
}
73
68
# TODO Move code from ModItemOrder
74
# TODO Move code from ModItemOrder
69
sub update_item {
75
sub update_item {
70
    die "not implemented yet";
76
    die "not implemented yet";
(-)a/acqui/addorder.pl (-2 / +3 lines)
Lines 228-233 $orderinfo->{'uncertainprice'} ||= 0; Link Here
228
$orderinfo->{subscriptionid} ||= undef;
228
$orderinfo->{subscriptionid} ||= undef;
229
229
230
my $user = $input->remote_user;
230
my $user = $input->remote_user;
231
my $basketno=$$orderinfo{basketno};
232
my $basket = Koha::Acquisition::Baskets->find( $basketno );
231
233
232
# create, modify or delete biblio
234
# create, modify or delete biblio
233
# create if $quantity>0 and $existing='no'
235
# create if $quantity>0 and $existing='no'
Lines 277-283 if ( $orderinfo->{quantity} ne '0' ) { Link Here
277
    }
279
    }
278
280
279
    # now, add items if applicable
281
    # now, add items if applicable
280
    if (C4::Context->preference('AcqCreateItem') eq 'ordering') {
282
    if ($basket->effective_create_items eq 'ordering') {
281
283
282
        my @tags         = $input->param('tag');
284
        my @tags         = $input->param('tag');
283
        my @subfields    = $input->param('subfield');
285
        my @subfields    = $input->param('subfield');
Lines 318-324 if ( $orderinfo->{quantity} ne '0' ) { Link Here
318
320
319
}
321
}
320
322
321
my $basketno=$$orderinfo{basketno};
322
my $booksellerid=$$orderinfo{booksellerid};
323
my $booksellerid=$$orderinfo{booksellerid};
323
if (my $import_batch_id=$$orderinfo{import_batch_id}) {
324
if (my $import_batch_id=$$orderinfo{import_batch_id}) {
324
    print $input->redirect("/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=$import_batch_id&basketno=$basketno&booksellerid=$booksellerid");
325
    print $input->redirect("/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=$import_batch_id&basketno=$basketno&booksellerid=$booksellerid");
(-)a/acqui/addorderiso2709.pl (-2 / +4 lines)
Lines 43-48 use C4::Branch; # GetBranches Link Here
43
use C4::Members;
43
use C4::Members;
44
44
45
use Koha::Number::Price;
45
use Koha::Number::Price;
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 76-81 if ($cgiparams->{'import_batch_id'} && $op eq ""){ Link Here
76
if (! $cgiparams->{'basketno'}){
77
if (! $cgiparams->{'basketno'}){
77
    die "Basketnumber required to order from iso2709 file import";
78
    die "Basketnumber required to order from iso2709 file import";
78
}
79
}
80
my $basket = Koha::Acquisition::Baskets->find( $cgiparams->{basketno} );
79
81
80
#
82
#
81
# 1st step = choose the file to import into acquisition
83
# 1st step = choose the file to import into acquisition
Lines 126-132 if ($op eq ""){ Link Here
126
                     "allmatch" => $allmatch,
128
                     "allmatch" => $allmatch,
127
                     );
129
                     );
128
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
130
    import_biblios_list($template, $cgiparams->{'import_batch_id'});
129
    if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
131
    if ( $basket->effective_create_items eq 'ordering' ) {
130
        # prepare empty item form
132
        # prepare empty item form
131
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
133
        my $cell = PrepareItemrecordDisplay( '', '', '', 'ACQ' );
132
134
Lines 266-272 if ($op eq ""){ Link Here
266
        # 4th, add items if applicable
268
        # 4th, add items if applicable
267
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
269
        # parse the item sent by the form, and create an item just for the import_record_id we are dealing with
268
        # this is not optimised, but it's working !
270
        # this is not optimised, but it's working !
269
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
271
        if ( $basket->effective_create_items eq 'ordering' ) {
270
            my @tags         = $input->param('tag');
272
            my @tags         = $input->param('tag');
271
            my @subfields    = $input->param('subfield');
273
            my @subfields    = $input->param('subfield');
272
            my @field_values = $input->param('field_value');
274
            my @field_values = $input->param('field_value');
(-)a/acqui/basket.pl (+1 lines)
Lines 357-362 if ( $op eq 'delete_confirm' ) { Link Here
357
    }
357
    }
358
358
359
    $template->param(
359
    $template->param(
360
        basket               => $basket,
360
        basketno             => $basketno,
361
        basketno             => $basketno,
361
        basketname           => $basket->{'basketname'},
362
        basketname           => $basket->{'basketname'},
362
        basketbranchname     => C4::Branch::GetBranchName($basket->{branch}),
363
        basketbranchname     => C4::Branch::GetBranchName($basket->{branch}),
(-)a/acqui/basketheader.pl (+2 lines)
Lines 148-153 if ( $op eq 'add_form' ) { Link Here
148
            $input->param('basketbooksellerid'),
148
            $input->param('basketbooksellerid'),
149
            $input->param('deliveryplace'),
149
            $input->param('deliveryplace'),
150
            $input->param('billingplace'),
150
            $input->param('billingplace'),
151
            $input->param('create_items'),
151
        );
152
        );
152
    } else { #New basket
153
    } else { #New basket
153
        $basketno = NewBasket(
154
        $basketno = NewBasket(
Lines 159-164 if ( $op eq 'add_form' ) { Link Here
159
            $input->param('basketcontractnumber') || undef,
160
            $input->param('basketcontractnumber') || undef,
160
            $input->param('deliveryplace'),
161
            $input->param('deliveryplace'),
161
            $input->param('billingplace'),
162
            $input->param('billingplace'),
163
            $input->param('create_items'),
162
        );
164
        );
163
    }
165
    }
164
    print $input->redirect('basket.pl?basketno='.$basketno);
166
    print $input->redirect('basket.pl?basketno='.$basketno);
(-)a/acqui/finishreceive.pl (-2 / +5 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 61-70 my $bookfund = $input->param("bookfund"); Link Here
61
my $order            = GetOrder($ordernumber);
62
my $order            = GetOrder($ordernumber);
62
my $new_ordernumber  = $ordernumber;
63
my $new_ordernumber  = $ordernumber;
63
64
65
my $basket = Koha::Acquisition::Order->find($ordernumber)->basket;
66
64
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
67
#need old recievedate if we update the order, parcel.pl only shows the right parcel this way FIXME
65
if ($quantityrec > $origquantityrec ) {
68
if ($quantityrec > $origquantityrec ) {
66
    my @received_items = ();
69
    my @received_items = ();
67
    if(C4::Context->preference('AcqCreateItem') eq 'ordering') {
70
    if ($basket->effective_create_items eq 'ordering') {
68
        @received_items = $input->param('items_to_receive');
71
        @received_items = $input->param('items_to_receive');
69
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
72
        my @affects = split q{\|}, C4::Context->preference("AcqItemSetSubfieldsWhenReceived");
70
        if ( @affects ) {
73
        if ( @affects ) {
Lines 120-126 if ($quantityrec > $origquantityrec ) { Link Here
120
    }
123
    }
121
124
122
    # now, add items if applicable
125
    # now, add items if applicable
123
    if (C4::Context->preference('AcqCreateItem') eq 'receiving') {
126
    if ($basket->effective_create_items eq 'receiving') {
124
127
125
        my @tags         = $input->param('tag');
128
        my @tags         = $input->param('tag');
126
        my @subfields    = $input->param('subfield');
129
        my @subfields    = $input->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 291-297 if ($close) { Link Here
291
$template->param( sort1 => $data->{'sort1'} );
292
$template->param( sort1 => $data->{'sort1'} );
292
$template->param( sort2 => $data->{'sort2'} );
293
$template->param( sort2 => $data->{'sort2'} );
293
294
294
if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) {
295
if ($basketobj->effective_create_items eq 'ordering' && !$ordernumber) {
295
    # Check if ACQ framework exists
296
    # Check if ACQ framework exists
296
    my $marc = GetMarcStructure(1, 'ACQ');
297
    my $marc = GetMarcStructure(1, 'ACQ');
297
    unless($marc) {
298
    unless($marc) {
Lines 403-409 $template->param( Link Here
403
    barcode_subfield => $barcode_subfield,
404
    barcode_subfield => $barcode_subfield,
404
    import_batch_id  => $import_batch_id,
405
    import_batch_id  => $import_batch_id,
405
    subscriptionid   => $subscriptionid,
406
    subscriptionid   => $subscriptionid,
406
    acqcreate        => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
407
    acqcreate        => $basketobj->effective_create_items eq "ordering" ? 1 : "",
407
    users_ids        => join(':', @order_user_ids),
408
    users_ids        => join(':', @order_user_ids),
408
    users            => \@order_users,
409
    users            => \@order_users,
409
    (uc(C4::Context->preference("marcflavour"))) => 1
410
    (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->find($ordernumber)->basket;
113
114
114
# Check if ACQ framework exists
115
# Check if ACQ framework exists
115
my $acq_fw = GetMarcStructure(1, 'ACQ');
116
my $acq_fw = GetMarcStructure(1, 'ACQ');
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 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 265-270 unless( defined $invoice->{closedate} ) { Link Here
265
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
266
        $line{left_holds_on_order}  = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds );
266
        $line{holds}                = $holds;
267
        $line{holds}                = $holds;
267
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
268
        $line{holds_on_order}       = $itemholds?$itemholds:$holds if $line{left_holds_on_order};
269
        $line{basket}               = Koha::Acquisition::Baskets->find( $line{basketno} );
268
270
269
        my $budget_name = GetBudgetName( $line{budget_id} );
271
        my $budget_name = GetBudgetName( $line{budget_id} );
270
        $line{budget_name} = $budget_name;
272
        $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 2859-2864 CREATE TABLE `aqbasket` ( -- stores data about baskets in acquisitions Link Here
2859
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2859
  `basketgroupid` int(11), -- links this basket to its group (aqbasketgroups.id)
2860
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2860
  `deliveryplace` varchar(10) default NULL, -- basket delivery place
2861
  `billingplace` varchar(10) default NULL, -- basket billing place
2861
  `billingplace` varchar(10) default NULL, -- basket billing place
2862
  create_items ENUM('ordering', 'receiving', 'cataloguing') default NULL; -- when items should be created for orders in this basket
2862
  branch varchar(10) default NULL, -- basket branch
2863
  branch varchar(10) default NULL, -- basket branch
2863
  PRIMARY KEY  (`basketno`),
2864
  PRIMARY KEY  (`basketno`),
2864
  KEY `booksellerid` (`booksellerid`),
2865
  KEY `booksellerid` (`booksellerid`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt (+10 lines)
Lines 306-311 Link Here
306
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
306
                [% IF ( creationdate ) %]<li><span class="label">Opened on:</span>  [% creationdate | $KohaDates %]</li>[% END %]
307
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
307
                [% IF ( closedate ) %]<li><span class="label">Closed on:</span> [% closedate | $KohaDates %]</li>[% END %]
308
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
308
                [% IF ( estimateddeliverydate ) %]<li><span class="label">Estimated delivery date:</span> [% estimateddeliverydate | $KohaDates  %]</li>[% END %]
309
                [% IF basket.create_items %]
310
                    <li>
311
                        <span class="label">Create items when:</span>
312
                        [% SWITCH basket.create_items %]
313
                            [% CASE 'receiving' %]Receiving items
314
                            [% CASE 'cataloguing' %]Cataloguing items
315
                            [% CASE %]Placing orders
316
                        [% END %]
317
                    </li>
318
                [% END %]
309
319
310
                </ol>
320
                </ol>
311
                </div>
321
                </div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basketheader.tt (-1 / +16 lines)
Lines 41-47 Link Here
41
                [% IF ( basketno ) %]
41
                [% IF ( basketno ) %]
42
                    <li>
42
                    <li>
43
                        <input type="hidden" name="basketno" value="[% basketno %]" />
43
                        <input type="hidden" name="basketno" value="[% basketno %]" />
44
                        <input type="hidden" name="is_an_edit" value="1" />
44
                        <input type="hidden" name="rs_an_edit" value="1" />
45
                    </li>
45
                    </li>
46
                [% END %]
46
                [% END %]
47
                <li>
47
                <li>
Lines 113-118 Link Here
113
                        </select>
113
                        </select>
114
                    </li>
114
                    </li>
115
                [% END %]
115
                [% END %]
116
                [% UNLESS basketno %]
117
                 <li>
118
                    <label for="create_items">Create items when:</label>
119
                    <select name="create_items" id="create_items">
120
                        [% SWITCH Koha.Preference('AcqCreateItem') %]
121
                            [% CASE 'receiving' %]<option value="">use default (receiving an order).</option>
122
                            [% CASE 'cataloguing' %]<option value="">use default (cataloging the record).</option>
123
                            [% CASE %]<option value="">use default (placing an order).</option>
124
                        [% END %]
125
                        <option value="ordering">placing an order.</option>
126
                        <option value="receiving">receiving an order.</option>
127
                        <option value="cataloguing">cataloging the record.</option>
128
                    </select>
129
                </li>
130
                [% END %]
116
            </ol>
131
            </ol>
117
        </fieldset>
132
        </fieldset>
118
        <fieldset class="action">
133
        <fieldset class="action">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt (-1 / +1 lines)
Lines 418-424 Link Here
418
                <td>[% order.unitprice | $Price %]</td>
418
                <td>[% order.unitprice | $Price %]</td>
419
                <td>[% order.total | $Price %]</td>
419
                <td>[% order.total | $Price %]</td>
420
                <td>
420
                <td>
421
                    [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
421
                    [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
422
                      [% IF loop_receive.cannot_cancel %]
422
                      [% IF loop_receive.cannot_cancel %]
423
                        [% span_title = BLOCK %]
423
                        [% span_title = BLOCK %]
424
                            Cannot cancel receipt of this order line because it
424
                            Cannot cancel receipt of this order line because it
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/uncertainprice.tt (-1 / +1 lines)
Lines 127-133 function check(form) { Link Here
127
	    </td>
127
	    </td>
128
	    <td>
128
	    <td>
129
	        
129
	        
130
        [% IF Koha.Preference('AcqCreateItem') == 'ordering' %]
130
        [% IF basket.effective_create_items == 'ordering' %]
131
            [% uncertainpriceorder.quantity %]
131
            [% uncertainpriceorder.quantity %]
132
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
132
            <input type="hidden" name="qty[% uncertainpriceorder.ordernumber %]" value="[% uncertainpriceorder.quantity %]" />
133
        [% ELSE %]
133
        [% 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 651-657 Link Here
651
                            <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>
651
                            <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>
652
                        [% ELSIF ( itemloop.size ) %]
652
                        [% ELSIF ( itemloop.size ) %]
653
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
653
                            [% INCLUDE items_table items=itemloop tab="holdings" %]
654
                            [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
654
                            [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
655
                              [% IF acquisition_details.total_quantity == 1 %]
655
                              [% IF acquisition_details.total_quantity == 1 %]
656
                                1 item is on order.
656
                                1 item is on order.
657
                              [% ELSE %]
657
                              [% ELSE %]
Lines 678-684 Link Here
678
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
678
                                    <div id="alternateholdings"><span class="holdings_label">Holdings:</span> [% ALTERNATEHOLDING.holding %]</div>
679
                                [% END %]
679
                                [% END %]
680
                            [% ELSE %]
680
                            [% ELSE %]
681
                                [% IF Koha.Preference('OPACAcquisitionDetails') and Koha.Preference('AcqCreateItem') != 'ordering' and acquisition_details.total_quantity > 0 %]
681
                                [% IF Koha.Preference('OPACAcquisitionDetails') and acquisition_details.total_quantity > 0 %]
682
                                  [% IF acquisition_details.total_quantity == 1 %]
682
                                  [% IF acquisition_details.total_quantity == 1 %]
683
                                    1 item is on order.
683
                                    1 item is on order.
684
                                  [% ELSE %]
684
                                  [% ELSE %]
(-)a/opac/opac-detail.pl (-5 / +4 lines)
Lines 52-57 use Koha::DateUtils; Link Here
52
use C4::HTML5Media;
52
use C4::HTML5Media;
53
use C4::CourseReserves qw(GetItemCourseReservesInfo);
53
use C4::CourseReserves qw(GetItemCourseReservesInfo);
54
54
55
use Koha::Acquisition::Order;
55
use Koha::Virtualshelves;
56
use Koha::Virtualshelves;
56
57
57
BEGIN {
58
BEGIN {
Lines 604-610 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) { Link Here
604
    });
605
    });
605
    my $total_quantity = 0;
606
    my $total_quantity = 0;
606
    for my $order ( @$orders ) {
607
    for my $order ( @$orders ) {
607
        if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
608
        my $basket = Koha::Acquisition::Order->find( $order->{ordernumber} )->basket;
609
        if ( $basket->effective_create_items eq 'ordering' ) {
608
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
610
            for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
609
                push @itemnumbers_on_order, $itemnumber;
611
                push @itemnumbers_on_order, $itemnumber;
610
            }
612
            }
Lines 674-682 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
674
        $itm->{transfertto}   = $branches->{$transfertto}{branchname};
676
        $itm->{transfertto}   = $branches->{$transfertto}{branchname};
675
     }
677
     }
676
    
678
    
677
    if (    C4::Context->preference('OPACAcquisitionDetails')
679
    if ( C4::Context->preference('OPACAcquisitionDetails') ) {
678
        and C4::Context->preference('AcqCreateItem') eq 'ordering' )
679
    {
680
        $itm->{on_order} = 1
680
        $itm->{on_order} = 1
681
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
681
          if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
682
    }
682
    }
683
- 

Return to bug 15685