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 858-867 sub NewBasketgroup { Link Here
858
            push(@params, $basketgroupinfo->{$field});
859
            push(@params, $basketgroupinfo->{$field});
859
        }
860
        }
860
    }
861
    }
862
863
    if ($basketgroupinfo->{closed}) {
864
        $query .= "closeddate, ";
865
    }
861
    $query .= "booksellerid) VALUES (";
866
    $query .= "booksellerid) VALUES (";
862
    foreach (@params) {
867
    foreach (@params) {
863
        $query .= "?, ";
868
        $query .= "?, ";
864
    }
869
    }
870
    if ($basketgroupinfo->{closed}) {
871
        $query .= "CAST(NOW() AS DATE), ";
872
    }
865
    $query .= "?)";
873
    $query .= "?)";
866
    push(@params, $basketgroupinfo->{'booksellerid'});
874
    push(@params, $basketgroupinfo->{'booksellerid'});
867
    my $dbh = C4::Context->dbh;
875
    my $dbh = C4::Context->dbh;
Lines 910-915 sub ModBasketgroup { Link Here
910
    my $dbh = C4::Context->dbh;
918
    my $dbh = C4::Context->dbh;
911
    my $query = "UPDATE aqbasketgroups SET ";
919
    my $query = "UPDATE aqbasketgroups SET ";
912
    my @params;
920
    my @params;
921
922
    if ($basketgroupinfo->{closed}) {
923
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
924
    } elsif (defined $basketgroupinfo->{closed}) {
925
        $query .= "closeddate = NULL, ";
926
    }
927
913
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
928
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
914
        if ( defined $basketgroupinfo->{$field} ) {
929
        if ( defined $basketgroupinfo->{$field} ) {
915
            $query .= "$field=?, ";
930
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2757-2762 CREATE TABLE `aqbasketgroups` ( Link Here
2757
  `id` int(11) NOT NULL auto_increment,
2757
  `id` int(11) NOT NULL auto_increment,
2758
  `name` varchar(50) default NULL,
2758
  `name` varchar(50) default NULL,
2759
  `closed` tinyint(1) default NULL,
2759
  `closed` tinyint(1) default NULL,
2760
  closeddate date default NULL, -- the date the basketgroup was closed
2760
  `booksellerid` int(11) NOT NULL,
2761
  `booksellerid` int(11) NOT NULL,
2761
  `deliveryplace` varchar(10) default NULL,
2762
  `deliveryplace` varchar(10) default NULL,
2762
  `freedeliveryplace` text default NULL,
2763
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 8012-8017 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
8012
    SetVersion($DBversion);
8012
    SetVersion($DBversion);
8013
}
8013
}
8014
8014
8015
$DBversion = "XXX";
8016
if (CheckVersion($DBversion)) {
8017
    $dbh->do(q|
8018
        ALTER TABLE aqbasketgroups
8019
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
8020
    |);
8021
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
8022
    SetVersion($DBversion);
8023
}
8024
8015
=head1 FUNCTIONS
8025
=head1 FUNCTIONS
8016
8026
8017
=head2 TableExists($table)
8027
=head2 TableExists($table)
8018
- 

Return to bug 11708