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 939-948 sub NewBasketgroup { Link Here
939
            push(@params, $basketgroupinfo->{$field});
940
            push(@params, $basketgroupinfo->{$field});
940
        }
941
        }
941
    }
942
    }
943
944
    if ($basketgroupinfo->{closed}) {
945
        $query .= "closeddate, ";
946
    }
942
    $query .= "booksellerid) VALUES (";
947
    $query .= "booksellerid) VALUES (";
943
    foreach (@params) {
948
    foreach (@params) {
944
        $query .= "?, ";
949
        $query .= "?, ";
945
    }
950
    }
951
    if ($basketgroupinfo->{closed}) {
952
        $query .= "CAST(NOW() AS DATE), ";
953
    }
946
    $query .= "?)";
954
    $query .= "?)";
947
    push(@params, $basketgroupinfo->{'booksellerid'});
955
    push(@params, $basketgroupinfo->{'booksellerid'});
948
    my $dbh = C4::Context->dbh;
956
    my $dbh = C4::Context->dbh;
Lines 991-996 sub ModBasketgroup { Link Here
991
    my $dbh = C4::Context->dbh;
999
    my $dbh = C4::Context->dbh;
992
    my $query = "UPDATE aqbasketgroups SET ";
1000
    my $query = "UPDATE aqbasketgroups SET ";
993
    my @params;
1001
    my @params;
1002
1003
    if ($basketgroupinfo->{closed}) {
1004
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
1005
    } elsif (defined $basketgroupinfo->{closed}) {
1006
        $query .= "closeddate = NULL, ";
1007
    }
1008
994
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
1009
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
995
        if ( defined $basketgroupinfo->{$field} ) {
1010
        if ( defined $basketgroupinfo->{$field} ) {
996
            $query .= "$field=?, ";
1011
            $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 2814-2819 CREATE TABLE `aqbasketgroups` ( Link Here
2814
  `id` int(11) NOT NULL auto_increment,
2814
  `id` int(11) NOT NULL auto_increment,
2815
  `name` varchar(50) default NULL,
2815
  `name` varchar(50) default NULL,
2816
  `closed` tinyint(1) default NULL,
2816
  `closed` tinyint(1) default NULL,
2817
  closeddate date default NULL, -- the date the basketgroup was closed
2817
  `booksellerid` int(11) NOT NULL,
2818
  `booksellerid` int(11) NOT NULL,
2818
  `deliveryplace` varchar(10) default NULL,
2819
  `deliveryplace` varchar(10) default NULL,
2819
  `freedeliveryplace` MEDIUMTEXT default NULL,
2820
  `freedeliveryplace` MEDIUMTEXT default NULL,
2820
- 

Return to bug 11708