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 576-582 sub process_quote { Link Here
576
            );
576
            );
577
            # Close the basket, passing a flag indicating that this action
577
            # Close the basket, passing a flag indicating that this action
578
            # originated from an approval
578
            # originated from an approval
579
            CloseBasket($b, undef, 1);
579
            CloseBasket($b, 1);
580
        }
580
        }
581
    }
581
    }
582
582
(-)a/acqui/addorder.pl (-2 / +1 lines)
Lines 367-374 if (C4::Context->preference("AcqLog") && $basketno) { Link Here
367
    logaction(
367
    logaction(
368
        'ACQUISITIONS',
368
        'ACQUISITIONS',
369
        'MODIFY_BASKET',
369
        'MODIFY_BASKET',
370
        $basketno,
370
        $basketno
371
        sprintf("%010d", $loggedinuser)
372
    );
371
    );
373
}
372
}
374
373
(-)a/acqui/basket.pl (-8 / +5 lines)
Lines 195-201 if ( $op eq 'delete_confirm' ) { Link Here
195
    if ($confirm) {
195
    if ($confirm) {
196
        my $basketno = $query->param('basketno');
196
        my $basketno = $query->param('basketno');
197
        my $booksellerid = $query->param('booksellerid');
197
        my $booksellerid = $query->param('booksellerid');
198
        $basketno =~ /^\d+$/ and CloseBasket($basketno, $loggedinuser);
198
        $basketno =~ /^\d+$/ and CloseBasket($basketno);
199
        # if requested, create basket group, close it and attach the basket
199
        # if requested, create basket group, close it and attach the basket
200
        if ($query->param('createbasketgroup')) {
200
        if ($query->param('createbasketgroup')) {
201
            my $branchcode;
201
            my $branchcode;
Lines 209-216 if ( $op eq 'delete_confirm' ) { Link Here
209
                            closed => 1,
209
                            closed => 1,
210
                            });
210
                            });
211
            ModBasket( { basketno => $basketno,
211
            ModBasket( { basketno => $basketno,
212
                         basketgroupid => $basketgroupid,
212
                         basketgroupid => $basketgroupid } );
213
                         borrowernumber => $loggedinuser } );
214
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
213
            print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
215
        } else {
214
        } else {
216
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
215
            print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?booksellerid=' . $booksellerid);
Lines 243-250 elsif ( $op eq 'ediorder' ) { Link Here
243
    $branch = undef if(defined $branch and $branch eq '');
242
    $branch = undef if(defined $branch and $branch eq '');
244
    ModBasket({
243
    ModBasket({
245
        basketno => $basket->{basketno},
244
        basketno => $basket->{basketno},
246
        branch   => $branch,
245
        branch   => $branch
247
        borrowernumber => $loggedinuser
248
    });
246
    });
249
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
247
    print $query->redirect("/cgi-bin/koha/acqui/basket.pl?basketno=$basketno");
250
    exit;
248
    exit;
Lines 538-544 sub edi_close_and_order { Link Here
538
            if ( create_edi_order($edi_params) ) {
536
            if ( create_edi_order($edi_params) ) {
539
                #$template->param( edifile => 1 );
537
                #$template->param( edifile => 1 );
540
            }
538
            }
541
        CloseBasket($basketno, $loggedinuser);
539
        CloseBasket($basketno);
542
540
543
        # if requested, create basket group, close it and attach the basket
541
        # if requested, create basket group, close it and attach the basket
544
        if ( $query->param('createbasketgroup') ) {
542
        if ( $query->param('createbasketgroup') ) {
Lines 560-567 sub edi_close_and_order { Link Here
560
            ModBasket(
558
            ModBasket(
561
                {
559
                {
562
                    basketno       => $basketno,
560
                    basketno       => $basketno,
563
                    basketgroupid  => $basketgroupid,
561
                    basketgroupid  => $basketgroupid
564
                    borrowernumber => $loggedinuser
565
                }
562
                }
566
            );
563
            );
567
            print $query->redirect(
564
            print $query->redirect(
(-)a/acqui/basketheader.pl (-3 / +1 lines)
Lines 154-161 if ( $op eq 'add_form' ) { Link Here
154
            scalar $input->param('deliveryplace'),
154
            scalar $input->param('deliveryplace'),
155
            scalar $input->param('billingplace'),
155
            scalar $input->param('billingplace'),
156
            scalar $input->param('is_standing') ? 1 : undef,
156
            scalar $input->param('is_standing') ? 1 : undef,
157
            scalar $input->param('create_items'),
157
            scalar $input->param('create_items')
158
            $loggedinuser
159
        );
158
        );
160
    } else { #New basket
159
    } else { #New basket
161
        $basketno = NewBasket(
160
        $basketno = NewBasket(
162
- 

Return to bug 23971