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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 428-434 sub CloseBasketgroup { Link Here
428
    my $dbh        = C4::Context->dbh;
428
    my $dbh        = C4::Context->dbh;
429
    my $sth = $dbh->prepare("
429
    my $sth = $dbh->prepare("
430
        UPDATE aqbasketgroups
430
        UPDATE aqbasketgroups
431
        SET    closed=1
431
        SET    closed=1,
432
               closeddate=CAST(NOW() AS DATE)
432
        WHERE  id=?
433
        WHERE  id=?
433
    ");
434
    ");
434
    $sth->execute($basketgroupno);
435
    $sth->execute($basketgroupno);
Lines 449-455 sub ReOpenBasketgroup { Link Here
449
    my $dbh        = C4::Context->dbh;
450
    my $dbh        = C4::Context->dbh;
450
    my $sth = $dbh->prepare("
451
    my $sth = $dbh->prepare("
451
        UPDATE aqbasketgroups
452
        UPDATE aqbasketgroups
452
        SET    closed=0
453
        SET    closed=0, closeddate=NULL
453
        WHERE  id=?
454
        WHERE  id=?
454
    ");
455
    ");
455
    $sth->execute($basketgroupno);
456
    $sth->execute($basketgroupno);
Lines 881-890 sub NewBasketgroup { Link Here
881
            push(@params, $basketgroupinfo->{$field});
882
            push(@params, $basketgroupinfo->{$field});
882
        }
883
        }
883
    }
884
    }
885
886
    if ($basketgroupinfo->{closed}) {
887
        $query .= "closeddate, ";
888
    }
884
    $query .= "booksellerid) VALUES (";
889
    $query .= "booksellerid) VALUES (";
885
    foreach (@params) {
890
    foreach (@params) {
886
        $query .= "?, ";
891
        $query .= "?, ";
887
    }
892
    }
893
    if ($basketgroupinfo->{closed}) {
894
        $query .= "CAST(NOW() AS DATE), ";
895
    }
888
    $query .= "?)";
896
    $query .= "?)";
889
    push(@params, $basketgroupinfo->{'booksellerid'});
897
    push(@params, $basketgroupinfo->{'booksellerid'});
890
    my $dbh = C4::Context->dbh;
898
    my $dbh = C4::Context->dbh;
Lines 933-938 sub ModBasketgroup { Link Here
933
    my $dbh = C4::Context->dbh;
941
    my $dbh = C4::Context->dbh;
934
    my $query = "UPDATE aqbasketgroups SET ";
942
    my $query = "UPDATE aqbasketgroups SET ";
935
    my @params;
943
    my @params;
944
945
    if ($basketgroupinfo->{closed}) {
946
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
947
    } elsif (defined $basketgroupinfo->{closed}) {
948
        $query .= "closeddate = NULL, ";
949
    }
950
936
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
951
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
937
        if ( defined $basketgroupinfo->{$field} ) {
952
        if ( defined $basketgroupinfo->{$field} ) {
938
            $query .= "$field=?, ";
953
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2799-2804 CREATE TABLE `aqbasketgroups` ( Link Here
2799
  `id` int(11) NOT NULL auto_increment,
2799
  `id` int(11) NOT NULL auto_increment,
2800
  `name` varchar(50) default NULL,
2800
  `name` varchar(50) default NULL,
2801
  `closed` tinyint(1) default NULL,
2801
  `closed` tinyint(1) default NULL,
2802
  closeddate date default NULL, -- the date the basketgroup was closed
2802
  `booksellerid` int(11) NOT NULL,
2803
  `booksellerid` int(11) NOT NULL,
2803
  `deliveryplace` varchar(10) default NULL,
2804
  `deliveryplace` varchar(10) default NULL,
2804
  `freedeliveryplace` text default NULL,
2805
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 9005-9010 if ( CheckVersion($DBversion) ) { Link Here
9005
    SetVersion($DBversion);
9005
    SetVersion($DBversion);
9006
}
9006
}
9007
9007
9008
$DBversion = "XXX";
9009
if (CheckVersion($DBversion)) {
9010
    $dbh->do(q|
9011
        ALTER TABLE aqbasketgroups
9012
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
9013
    |);
9014
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
9015
    SetVersion($DBversion);
9016
}
9017
9008
=head1 FUNCTIONS
9018
=head1 FUNCTIONS
9009
9019
9010
=head2 TableExists($table)
9020
=head2 TableExists($table)
9011
- 

Return to bug 11708