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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 476-482 sub CloseBasketgroup { Link Here
476
    my $dbh        = C4::Context->dbh;
476
    my $dbh        = C4::Context->dbh;
477
    my $sth = $dbh->prepare("
477
    my $sth = $dbh->prepare("
478
        UPDATE aqbasketgroups
478
        UPDATE aqbasketgroups
479
        SET    closed=1
479
        SET    closed=1,
480
               closeddate=CAST(NOW() AS DATE)
480
        WHERE  id=?
481
        WHERE  id=?
481
    ");
482
    ");
482
    $sth->execute($basketgroupno);
483
    $sth->execute($basketgroupno);
Lines 497-503 sub ReOpenBasketgroup { Link Here
497
    my $dbh        = C4::Context->dbh;
498
    my $dbh        = C4::Context->dbh;
498
    my $sth = $dbh->prepare("
499
    my $sth = $dbh->prepare("
499
        UPDATE aqbasketgroups
500
        UPDATE aqbasketgroups
500
        SET    closed=0
501
        SET    closed=0, closeddate=NULL
501
        WHERE  id=?
502
        WHERE  id=?
502
    ");
503
    ");
503
    $sth->execute($basketgroupno);
504
    $sth->execute($basketgroupno);
Lines 937-946 sub NewBasketgroup { Link Here
937
            push(@params, $basketgroupinfo->{$field});
938
            push(@params, $basketgroupinfo->{$field});
938
        }
939
        }
939
    }
940
    }
941
942
    if ($basketgroupinfo->{closed}) {
943
        $query .= "closeddate, ";
944
    }
940
    $query .= "booksellerid) VALUES (";
945
    $query .= "booksellerid) VALUES (";
941
    foreach (@params) {
946
    foreach (@params) {
942
        $query .= "?, ";
947
        $query .= "?, ";
943
    }
948
    }
949
    if ($basketgroupinfo->{closed}) {
950
        $query .= "CAST(NOW() AS DATE), ";
951
    }
944
    $query .= "?)";
952
    $query .= "?)";
945
    push(@params, $basketgroupinfo->{'booksellerid'});
953
    push(@params, $basketgroupinfo->{'booksellerid'});
946
    my $dbh = C4::Context->dbh;
954
    my $dbh = C4::Context->dbh;
Lines 989-994 sub ModBasketgroup { Link Here
989
    my $dbh = C4::Context->dbh;
997
    my $dbh = C4::Context->dbh;
990
    my $query = "UPDATE aqbasketgroups SET ";
998
    my $query = "UPDATE aqbasketgroups SET ";
991
    my @params;
999
    my @params;
1000
1001
    if ($basketgroupinfo->{closed}) {
1002
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
1003
    } elsif (defined $basketgroupinfo->{closed}) {
1004
        $query .= "closeddate = NULL, ";
1005
    }
1006
992
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
1007
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
993
        if ( defined $basketgroupinfo->{$field} ) {
1008
        if ( defined $basketgroupinfo->{$field} ) {
994
            $query .= "$field=?, ";
1009
            $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 2838-2843 CREATE TABLE `aqbasketgroups` ( Link Here
2838
  `id` int(11) NOT NULL auto_increment,
2838
  `id` int(11) NOT NULL auto_increment,
2839
  `name` varchar(50) default NULL,
2839
  `name` varchar(50) default NULL,
2840
  `closed` tinyint(1) default NULL,
2840
  `closed` tinyint(1) default NULL,
2841
  closeddate date default NULL, -- the date the basketgroup was closed
2841
  `booksellerid` int(11) NOT NULL,
2842
  `booksellerid` int(11) NOT NULL,
2842
  `deliveryplace` varchar(10) default NULL,
2843
  `deliveryplace` varchar(10) default NULL,
2843
  `freedeliveryplace` text default NULL,
2844
  `freedeliveryplace` text default NULL,
2844
- 

Return to bug 11708