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 2797-2802 CREATE TABLE `aqbasketgroups` ( Link Here
2797
  `id` int(11) NOT NULL auto_increment,
2797
  `id` int(11) NOT NULL auto_increment,
2798
  `name` varchar(50) default NULL,
2798
  `name` varchar(50) default NULL,
2799
  `closed` tinyint(1) default NULL,
2799
  `closed` tinyint(1) default NULL,
2800
  closeddate date default NULL, -- the date the basketgroup was closed
2800
  `booksellerid` int(11) NOT NULL,
2801
  `booksellerid` int(11) NOT NULL,
2801
  `deliveryplace` varchar(10) default NULL,
2802
  `deliveryplace` varchar(10) default NULL,
2802
  `freedeliveryplace` text default NULL,
2803
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 8891-8896 if ( CheckVersion($DBversion) ) { Link Here
8891
    SetVersion($DBversion);
8891
    SetVersion($DBversion);
8892
}
8892
}
8893
8893
8894
$DBversion = "XXX";
8895
if (CheckVersion($DBversion)) {
8896
    $dbh->do(q|
8897
        ALTER TABLE aqbasketgroups
8898
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
8899
    |);
8900
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
8901
    SetVersion($DBversion);
8902
}
8903
8894
=head1 FUNCTIONS
8904
=head1 FUNCTIONS
8895
8905
8896
=head2 TableExists($table)
8906
=head2 TableExists($table)
8897
- 

Return to bug 11708