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

(-)a/C4/Acquisition.pm (-10 / +4 lines)
Lines 224-230 close a basket (becomes unmodifiable, except for receives) Link Here
224
=cut
224
=cut
225
225
226
sub CloseBasket {
226
sub CloseBasket {
227
    my ($basketno, $user, $edi_approval) = @_;
227
    my ($basketno, $edi_approval) = @_;
228
    my $dbh        = C4::Context->dbh;
228
    my $dbh        = C4::Context->dbh;
229
    $dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno );
229
    $dbh->do('UPDATE aqbasket SET closedate=now() WHERE basketno=?', {}, $basketno );
230
230
Lines 236-247 q{UPDATE aqorders SET orderstatus = 'ordered' WHERE basketno = ? AND orderstatus Link Here
236
    # Log the closure
236
    # Log the closure
237
    if (C4::Context->preference("AcqLog")) {
237
    if (C4::Context->preference("AcqLog")) {
238
        my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET';
238
        my $action = $edi_approval ? 'APPROVE_BASKET' : 'CLOSE_BASKET';
239
        my $infos = $user ? sprintf("%010d", $user) : undef;
240
        logaction(
239
        logaction(
241
            'ACQUISITIONS',
240
            'ACQUISITIONS',
242
            $action,
241
            $action,
243
            $basketno,
242
            $basketno
244
            $infos
245
        );
243
        );
246
    }
244
    }
247
245
Lines 570-583 sub ModBasket { Link Here
570
568
571
    # Log the basket update
569
    # Log the basket update
572
    if (C4::Context->preference("AcqLog")) {
570
    if (C4::Context->preference("AcqLog")) {
573
        my $infos = $basketinfo->{borrowernumber} ?
574
            sprintf("%010d", $basketinfo->{borrowernumber}) :
575
            undef;
576
        logaction(
571
        logaction(
577
            'ACQUISITIONS',
572
            'ACQUISITIONS',
578
            'MODIFY_BASKET',
573
            'MODIFY_BASKET',
579
            $basketinfo->{'basketno'},
574
            $basketinfo->{'basketno'}
580
            $infos
581
        );
575
        );
582
    }
576
    }
583
577
Lines 620-626 case the AcqCreateItem syspref takes precedence). Link Here
620
=cut
614
=cut
621
615
622
sub ModBasketHeader {
616
sub ModBasketHeader {
623
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items, $borrowernumber) = @_;
617
    my ($basketno, $basketname, $note, $booksellernote, $contractnumber, $booksellerid, $deliveryplace, $billingplace, $is_standing, $create_items) = @_;
624
618
625
    $is_standing ||= 0;
619
    $is_standing ||= 0;
626
    my $query = qq{
620
    my $query = qq{
(-)a/Koha/EDI.pm (-1 / +1 lines)
Lines 594-600 sub process_quote { Link Here
594
            );
594
            );
595
            # Close the basket, passing a flag indicating that this action
595
            # Close the basket, passing a flag indicating that this action
596
            # originated from an approval
596
            # originated from an approval
597
            CloseBasket($b, undef, 1);
597
            CloseBasket($b, 1);
598
        }
598
        }
599
    }
599
    }
600
600
(-)a/acqui/addorder.pl (-2 / +1 lines)
Lines 365-372 if (C4::Context->preference("AcqLog") && $basketno) { Link Here
365
    logaction(
365
    logaction(
366
        'ACQUISITIONS',
366
        'ACQUISITIONS',
367
        'MODIFY_BASKET',
367
        'MODIFY_BASKET',
368
        $basketno,
368
        $basketno
369
        sprintf("%010d", $loggedinuser)
370
    );
369
    );
371
}
370
}
372
371
(-)a/acqui/basket.pl (-8 / +5 lines)
Lines 200-206 if ( $op eq 'delete_confirm' ) { Link Here
200
    if ($confirm) {
200
    if ($confirm) {
201
        my $basketno = $query->param('basketno');
201
        my $basketno = $query->param('basketno');
202
        my $booksellerid = $query->param('booksellerid');
202
        my $booksellerid = $query->param('booksellerid');
203
        $basketno =~ /^\d+$/ and CloseBasket($basketno, $loggedinuser);
203
        $basketno =~ /^\d+$/ and CloseBasket($basketno);
204
        # if requested, create basket group, close it and attach the basket
204
        # if requested, create basket group, close it and attach the basket
205
        if ($query->param('createbasketgroup')) {
205
        if ($query->param('createbasketgroup')) {
206
            my $branchcode;
206
            my $branchcode;
Lines 214-221 if ( $op eq 'delete_confirm' ) { Link Here
214
                            closed => 1,
214
                            closed => 1,
215
                            });
215
                            });
216
            ModBasket( { basketno => $basketno,
216
            ModBasket( { basketno => $basketno,
217
                         basketgroupid => $basketgroupid,
217
                         basketgroupid => $basketgroupid } );
218
                         borrowernumber => $loggedinuser } );
219
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
218
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
220
        } else {
219
        } else {
221
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
220
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
Lines 248-255 elsif ( $op eq 'ediorder' ) { Link Here
248
    $branch = undef if(defined $branch and $branch eq '');
247
    $branch = undef if(defined $branch and $branch eq '');
249
    ModBasket({
248
    ModBasket({
250
        basketno => $basket->{basketno},
249
        basketno => $basket->{basketno},
251
        branch   => $branch,
250
        branch   => $branch
252
        borrowernumber => $loggedinuser
253
    });
251
    });
254
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
252
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
255
    exit;
253
    exit;
Lines 543-549 sub edi_close_and_order { Link Here
543
            if ( create_edi_order($edi_params) ) {
541
            if ( create_edi_order($edi_params) ) {
544
                #$template->param( edifile => 1 );
542
                #$template->param( edifile => 1 );
545
            }
543
            }
546
        CloseBasket($basketno, $loggedinuser);
544
        CloseBasket($basketno);
547
545
548
        # if requested, create basket group, close it and attach the basket
546
        # if requested, create basket group, close it and attach the basket
549
        if ( $query->param('createbasketgroup') ) {
547
        if ( $query->param('createbasketgroup') ) {
Lines 565-572 sub edi_close_and_order { Link Here
565
            ModBasket(
563
            ModBasket(
566
                {
564
                {
567
                    basketno       => $basketno,
565
                    basketno       => $basketno,
568
                    basketgroupid  => $basketgroupid,
566
                    basketgroupid  => $basketgroupid
569
                    borrowernumber => $loggedinuser
570
                }
567
                }
571
            );
568
            );
572
            print $query->redirect(
569
            print $query->redirect(
(-)a/acqui/basketheader.pl (-3 / +1 lines)
Lines 153-160 if ( $op eq 'add_form' ) { Link Here
153
            scalar $input->param('deliveryplace'),
153
            scalar $input->param('deliveryplace'),
154
            scalar $input->param('billingplace'),
154
            scalar $input->param('billingplace'),
155
            scalar $input->param('is_standing') ? 1 : undef,
155
            scalar $input->param('is_standing') ? 1 : undef,
156
            scalar $input->param('create_items'),
156
            scalar $input->param('create_items')
157
            $loggedinuser
158
        );
157
        );
159
    } else { #New basket
158
    } else { #New basket
160
        $basketno = NewBasket(
159
        $basketno = NewBasket(
161
- 

Return to bug 23971