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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 424-430 sub CloseBasketgroup { Link Here
424
    my $dbh        = C4::Context->dbh;
424
    my $dbh        = C4::Context->dbh;
425
    my $sth = $dbh->prepare("
425
    my $sth = $dbh->prepare("
426
        UPDATE aqbasketgroups
426
        UPDATE aqbasketgroups
427
        SET    closed=1
427
        SET    closed=1,
428
               closeddate=CAST(NOW() AS DATE)
428
        WHERE  id=?
429
        WHERE  id=?
429
    ");
430
    ");
430
    $sth->execute($basketgroupno);
431
    $sth->execute($basketgroupno);
Lines 445-451 sub ReOpenBasketgroup { Link Here
445
    my $dbh        = C4::Context->dbh;
446
    my $dbh        = C4::Context->dbh;
446
    my $sth = $dbh->prepare("
447
    my $sth = $dbh->prepare("
447
        UPDATE aqbasketgroups
448
        UPDATE aqbasketgroups
448
        SET    closed=0
449
        SET    closed=0, closeddate=NULL
449
        WHERE  id=?
450
        WHERE  id=?
450
    ");
451
    ");
451
    $sth->execute($basketgroupno);
452
    $sth->execute($basketgroupno);
Lines 877-886 sub NewBasketgroup { Link Here
877
            push(@params, $basketgroupinfo->{$field});
878
            push(@params, $basketgroupinfo->{$field});
878
        }
879
        }
879
    }
880
    }
881
882
    if ($basketgroupinfo->{closed}) {
883
        $query .= "closeddate, ";
884
    }
880
    $query .= "booksellerid) VALUES (";
885
    $query .= "booksellerid) VALUES (";
881
    foreach (@params) {
886
    foreach (@params) {
882
        $query .= "?, ";
887
        $query .= "?, ";
883
    }
888
    }
889
    if ($basketgroupinfo->{closed}) {
890
        $query .= "CAST(NOW() AS DATE), ";
891
    }
884
    $query .= "?)";
892
    $query .= "?)";
885
    push(@params, $basketgroupinfo->{'booksellerid'});
893
    push(@params, $basketgroupinfo->{'booksellerid'});
886
    my $dbh = C4::Context->dbh;
894
    my $dbh = C4::Context->dbh;
Lines 929-934 sub ModBasketgroup { Link Here
929
    my $dbh = C4::Context->dbh;
937
    my $dbh = C4::Context->dbh;
930
    my $query = "UPDATE aqbasketgroups SET ";
938
    my $query = "UPDATE aqbasketgroups SET ";
931
    my @params;
939
    my @params;
940
941
    if ($basketgroupinfo->{closed}) {
942
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
943
    } elsif (defined $basketgroupinfo->{closed}) {
944
        $query .= "closeddate = NULL, ";
945
    }
946
932
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
947
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
933
        if ( defined $basketgroupinfo->{$field} ) {
948
        if ( defined $basketgroupinfo->{$field} ) {
934
            $query .= "$field=?, ";
949
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2791-2796 CREATE TABLE `aqbasketgroups` ( Link Here
2791
  `id` int(11) NOT NULL auto_increment,
2791
  `id` int(11) NOT NULL auto_increment,
2792
  `name` varchar(50) default NULL,
2792
  `name` varchar(50) default NULL,
2793
  `closed` tinyint(1) default NULL,
2793
  `closed` tinyint(1) default NULL,
2794
  closeddate date default NULL, -- the date the basketgroup was closed
2794
  `booksellerid` int(11) NOT NULL,
2795
  `booksellerid` int(11) NOT NULL,
2795
  `deliveryplace` varchar(10) default NULL,
2796
  `deliveryplace` varchar(10) default NULL,
2796
  `freedeliveryplace` text default NULL,
2797
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 8560-8565 if ( CheckVersion($DBversion) ) { Link Here
8560
    SetVersion($DBversion);
8560
    SetVersion($DBversion);
8561
}
8561
}
8562
8562
8563
$DBversion = "XXX";
8564
if (CheckVersion($DBversion)) {
8565
    $dbh->do(q|
8566
        ALTER TABLE aqbasketgroups
8567
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
8568
    |);
8569
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
8570
    SetVersion($DBversion);
8571
}
8572
8563
=head1 FUNCTIONS
8573
=head1 FUNCTIONS
8564
8574
8565
=head2 TableExists($table)
8575
=head2 TableExists($table)
8566
- 

Return to bug 11708