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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 435-441 sub CloseBasketgroup { Link Here
435
    my $dbh        = C4::Context->dbh;
435
    my $dbh        = C4::Context->dbh;
436
    my $sth = $dbh->prepare("
436
    my $sth = $dbh->prepare("
437
        UPDATE aqbasketgroups
437
        UPDATE aqbasketgroups
438
        SET    closed=1
438
        SET    closed=1,
439
               closeddate=CAST(NOW() AS DATE)
439
        WHERE  id=?
440
        WHERE  id=?
440
    ");
441
    ");
441
    $sth->execute($basketgroupno);
442
    $sth->execute($basketgroupno);
Lines 456-462 sub ReOpenBasketgroup { Link Here
456
    my $dbh        = C4::Context->dbh;
457
    my $dbh        = C4::Context->dbh;
457
    my $sth = $dbh->prepare("
458
    my $sth = $dbh->prepare("
458
        UPDATE aqbasketgroups
459
        UPDATE aqbasketgroups
459
        SET    closed=0
460
        SET    closed=0, closeddate=NULL
460
        WHERE  id=?
461
        WHERE  id=?
461
    ");
462
    ");
462
    $sth->execute($basketgroupno);
463
    $sth->execute($basketgroupno);
Lines 888-897 sub NewBasketgroup { Link Here
888
            push(@params, $basketgroupinfo->{$field});
889
            push(@params, $basketgroupinfo->{$field});
889
        }
890
        }
890
    }
891
    }
892
893
    if ($basketgroupinfo->{closed}) {
894
        $query .= "closeddate, ";
895
    }
891
    $query .= "booksellerid) VALUES (";
896
    $query .= "booksellerid) VALUES (";
892
    foreach (@params) {
897
    foreach (@params) {
893
        $query .= "?, ";
898
        $query .= "?, ";
894
    }
899
    }
900
    if ($basketgroupinfo->{closed}) {
901
        $query .= "CAST(NOW() AS DATE), ";
902
    }
895
    $query .= "?)";
903
    $query .= "?)";
896
    push(@params, $basketgroupinfo->{'booksellerid'});
904
    push(@params, $basketgroupinfo->{'booksellerid'});
897
    my $dbh = C4::Context->dbh;
905
    my $dbh = C4::Context->dbh;
Lines 940-945 sub ModBasketgroup { Link Here
940
    my $dbh = C4::Context->dbh;
948
    my $dbh = C4::Context->dbh;
941
    my $query = "UPDATE aqbasketgroups SET ";
949
    my $query = "UPDATE aqbasketgroups SET ";
942
    my @params;
950
    my @params;
951
952
    if ($basketgroupinfo->{closed}) {
953
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
954
    } elsif (defined $basketgroupinfo->{closed}) {
955
        $query .= "closeddate = NULL, ";
956
    }
957
943
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
958
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
944
        if ( defined $basketgroupinfo->{$field} ) {
959
        if ( defined $basketgroupinfo->{$field} ) {
945
            $query .= "$field=?, ";
960
            $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 2820-2825 CREATE TABLE `aqbasketgroups` ( Link Here
2820
  `id` int(11) NOT NULL auto_increment,
2820
  `id` int(11) NOT NULL auto_increment,
2821
  `name` varchar(50) default NULL,
2821
  `name` varchar(50) default NULL,
2822
  `closed` tinyint(1) default NULL,
2822
  `closed` tinyint(1) default NULL,
2823
  closeddate date default NULL, -- the date the basketgroup was closed
2823
  `booksellerid` int(11) NOT NULL,
2824
  `booksellerid` int(11) NOT NULL,
2824
  `deliveryplace` varchar(10) default NULL,
2825
  `deliveryplace` varchar(10) default NULL,
2825
  `freedeliveryplace` text default NULL,
2826
  `freedeliveryplace` text default NULL,
2826
- 

Return to bug 11708