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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 422-428 sub CloseBasketgroup { Link Here
422
    my $dbh        = C4::Context->dbh;
422
    my $dbh        = C4::Context->dbh;
423
    my $sth = $dbh->prepare("
423
    my $sth = $dbh->prepare("
424
        UPDATE aqbasketgroups
424
        UPDATE aqbasketgroups
425
        SET    closed=1
425
        SET    closed=1,
426
               closeddate=CAST(NOW() AS DATE)
426
        WHERE  id=?
427
        WHERE  id=?
427
    ");
428
    ");
428
    $sth->execute($basketgroupno);
429
    $sth->execute($basketgroupno);
Lines 443-449 sub ReOpenBasketgroup { Link Here
443
    my $dbh        = C4::Context->dbh;
444
    my $dbh        = C4::Context->dbh;
444
    my $sth = $dbh->prepare("
445
    my $sth = $dbh->prepare("
445
        UPDATE aqbasketgroups
446
        UPDATE aqbasketgroups
446
        SET    closed=0
447
        SET    closed=0, closeddate=NULL
447
        WHERE  id=?
448
        WHERE  id=?
448
    ");
449
    ");
449
    $sth->execute($basketgroupno);
450
    $sth->execute($basketgroupno);
Lines 877-886 sub NewBasketgroup { Link Here
877
            push(@params, $basketgroupinfo->{$field});
878
            push(@params, $basketgroupinfo->{$field});
878
        }
879
        }
879
    }
880
    }
881
882
    if ($basketgroupinfo->{closed}) {
883
        $query .= "closeddate, ";
884
    }
880
    $query .= "booksellerid) VALUES (";
885
    $query .= "booksellerid) VALUES (";
881
    foreach (@params) {
886
    foreach (@params) {
882
        $query .= "?, ";
887
        $query .= "?, ";
883
    }
888
    }
889
    if ($basketgroupinfo->{closed}) {
890
        $query .= "CAST(NOW() AS DATE), ";
891
    }
884
    $query .= "?)";
892
    $query .= "?)";
885
    push(@params, $basketgroupinfo->{'booksellerid'});
893
    push(@params, $basketgroupinfo->{'booksellerid'});
886
    my $dbh = C4::Context->dbh;
894
    my $dbh = C4::Context->dbh;
Lines 929-934 sub ModBasketgroup { Link Here
929
    my $dbh = C4::Context->dbh;
937
    my $dbh = C4::Context->dbh;
930
    my $query = "UPDATE aqbasketgroups SET ";
938
    my $query = "UPDATE aqbasketgroups SET ";
931
    my @params;
939
    my @params;
940
941
    if ($basketgroupinfo->{closed}) {
942
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
943
    } elsif (defined $basketgroupinfo->{closed}) {
944
        $query .= "closeddate = NULL, ";
945
    }
946
932
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
947
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
933
        if ( defined $basketgroupinfo->{$field} ) {
948
        if ( defined $basketgroupinfo->{$field} ) {
934
            $query .= "$field=?, ";
949
            $query .= "$field=?, ";
(-)a/installer/data/mysql/atomicupdate/Bug-11708-add-column-aqbasketgroups-closeddate.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE aqbasketgroups ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 2813-2818 CREATE TABLE `aqbasketgroups` ( Link Here
2813
  `id` int(11) NOT NULL auto_increment,
2813
  `id` int(11) NOT NULL auto_increment,
2814
  `name` varchar(50) default NULL,
2814
  `name` varchar(50) default NULL,
2815
  `closed` tinyint(1) default NULL,
2815
  `closed` tinyint(1) default NULL,
2816
  closeddate date default NULL, -- the date the basketgroup was closed
2816
  `booksellerid` int(11) NOT NULL,
2817
  `booksellerid` int(11) NOT NULL,
2817
  `deliveryplace` varchar(10) default NULL,
2818
  `deliveryplace` varchar(10) default NULL,
2818
  `freedeliveryplace` text default NULL,
2819
  `freedeliveryplace` text default NULL,
2819
- 

Return to bug 11708