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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 429-435 sub CloseBasketgroup { Link Here
429
    my $dbh        = C4::Context->dbh;
429
    my $dbh        = C4::Context->dbh;
430
    my $sth = $dbh->prepare("
430
    my $sth = $dbh->prepare("
431
        UPDATE aqbasketgroups
431
        UPDATE aqbasketgroups
432
        SET    closed=1
432
        SET    closed=1,
433
               closeddate=CAST(NOW() AS DATE)
433
        WHERE  id=?
434
        WHERE  id=?
434
    ");
435
    ");
435
    $sth->execute($basketgroupno);
436
    $sth->execute($basketgroupno);
Lines 450-456 sub ReOpenBasketgroup { Link Here
450
    my $dbh        = C4::Context->dbh;
451
    my $dbh        = C4::Context->dbh;
451
    my $sth = $dbh->prepare("
452
    my $sth = $dbh->prepare("
452
        UPDATE aqbasketgroups
453
        UPDATE aqbasketgroups
453
        SET    closed=0
454
        SET    closed=0, closeddate=NULL
454
        WHERE  id=?
455
        WHERE  id=?
455
    ");
456
    ");
456
    $sth->execute($basketgroupno);
457
    $sth->execute($basketgroupno);
Lines 882-891 sub NewBasketgroup { Link Here
882
            push(@params, $basketgroupinfo->{$field});
883
            push(@params, $basketgroupinfo->{$field});
883
        }
884
        }
884
    }
885
    }
886
887
    if ($basketgroupinfo->{closed}) {
888
        $query .= "closeddate, ";
889
    }
885
    $query .= "booksellerid) VALUES (";
890
    $query .= "booksellerid) VALUES (";
886
    foreach (@params) {
891
    foreach (@params) {
887
        $query .= "?, ";
892
        $query .= "?, ";
888
    }
893
    }
894
    if ($basketgroupinfo->{closed}) {
895
        $query .= "CAST(NOW() AS DATE), ";
896
    }
889
    $query .= "?)";
897
    $query .= "?)";
890
    push(@params, $basketgroupinfo->{'booksellerid'});
898
    push(@params, $basketgroupinfo->{'booksellerid'});
891
    my $dbh = C4::Context->dbh;
899
    my $dbh = C4::Context->dbh;
Lines 934-939 sub ModBasketgroup { Link Here
934
    my $dbh = C4::Context->dbh;
942
    my $dbh = C4::Context->dbh;
935
    my $query = "UPDATE aqbasketgroups SET ";
943
    my $query = "UPDATE aqbasketgroups SET ";
936
    my @params;
944
    my @params;
945
946
    if ($basketgroupinfo->{closed}) {
947
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
948
    } elsif (defined $basketgroupinfo->{closed}) {
949
        $query .= "closeddate = NULL, ";
950
    }
951
937
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
952
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
938
        if ( defined $basketgroupinfo->{$field} ) {
953
        if ( defined $basketgroupinfo->{$field} ) {
939
            $query .= "$field=?, ";
954
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2823-2828 CREATE TABLE `aqbasketgroups` ( Link Here
2823
  `id` int(11) NOT NULL auto_increment,
2823
  `id` int(11) NOT NULL auto_increment,
2824
  `name` varchar(50) default NULL,
2824
  `name` varchar(50) default NULL,
2825
  `closed` tinyint(1) default NULL,
2825
  `closed` tinyint(1) default NULL,
2826
  closeddate date default NULL, -- the date the basketgroup was closed
2826
  `booksellerid` int(11) NOT NULL,
2827
  `booksellerid` int(11) NOT NULL,
2827
  `deliveryplace` varchar(10) default NULL,
2828
  `deliveryplace` varchar(10) default NULL,
2828
  `freedeliveryplace` text default NULL,
2829
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 9656-9661 if(CheckVersion($DBversion)) { Link Here
9656
    SetVersion($DBversion);
9656
    SetVersion($DBversion);
9657
}
9657
}
9658
9658
9659
$DBversion = "XXX";
9660
if (CheckVersion($DBversion)) {
9661
    $dbh->do(q|
9662
        ALTER TABLE aqbasketgroups
9663
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
9664
    |);
9665
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
9666
    SetVersion($DBversion);
9667
}
9668
9659
=head1 FUNCTIONS
9669
=head1 FUNCTIONS
9660
9670
9661
=head2 TableExists($table)
9671
=head2 TableExists($table)
9662
- 

Return to bug 11708