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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 425-431 sub CloseBasketgroup { Link Here
425
    my $dbh        = C4::Context->dbh;
425
    my $dbh        = C4::Context->dbh;
426
    my $sth = $dbh->prepare("
426
    my $sth = $dbh->prepare("
427
        UPDATE aqbasketgroups
427
        UPDATE aqbasketgroups
428
        SET    closed=1
428
        SET    closed=1,
429
               closeddate=CAST(NOW() AS DATE)
429
        WHERE  id=?
430
        WHERE  id=?
430
    ");
431
    ");
431
    $sth->execute($basketgroupno);
432
    $sth->execute($basketgroupno);
Lines 446-452 sub ReOpenBasketgroup { Link Here
446
    my $dbh        = C4::Context->dbh;
447
    my $dbh        = C4::Context->dbh;
447
    my $sth = $dbh->prepare("
448
    my $sth = $dbh->prepare("
448
        UPDATE aqbasketgroups
449
        UPDATE aqbasketgroups
449
        SET    closed=0
450
        SET    closed=0, closeddate=NULL
450
        WHERE  id=?
451
        WHERE  id=?
451
    ");
452
    ");
452
    $sth->execute($basketgroupno);
453
    $sth->execute($basketgroupno);
Lines 878-887 sub NewBasketgroup { Link Here
878
            push(@params, $basketgroupinfo->{$field});
879
            push(@params, $basketgroupinfo->{$field});
879
        }
880
        }
880
    }
881
    }
882
883
    if ($basketgroupinfo->{closed}) {
884
        $query .= "closeddate, ";
885
    }
881
    $query .= "booksellerid) VALUES (";
886
    $query .= "booksellerid) VALUES (";
882
    foreach (@params) {
887
    foreach (@params) {
883
        $query .= "?, ";
888
        $query .= "?, ";
884
    }
889
    }
890
    if ($basketgroupinfo->{closed}) {
891
        $query .= "CAST(NOW() AS DATE), ";
892
    }
885
    $query .= "?)";
893
    $query .= "?)";
886
    push(@params, $basketgroupinfo->{'booksellerid'});
894
    push(@params, $basketgroupinfo->{'booksellerid'});
887
    my $dbh = C4::Context->dbh;
895
    my $dbh = C4::Context->dbh;
Lines 930-935 sub ModBasketgroup { Link Here
930
    my $dbh = C4::Context->dbh;
938
    my $dbh = C4::Context->dbh;
931
    my $query = "UPDATE aqbasketgroups SET ";
939
    my $query = "UPDATE aqbasketgroups SET ";
932
    my @params;
940
    my @params;
941
942
    if ($basketgroupinfo->{closed}) {
943
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
944
    } elsif (defined $basketgroupinfo->{closed}) {
945
        $query .= "closeddate = NULL, ";
946
    }
947
933
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
948
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
934
        if ( defined $basketgroupinfo->{$field} ) {
949
        if ( defined $basketgroupinfo->{$field} ) {
935
            $query .= "$field=?, ";
950
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2824-2829 CREATE TABLE `aqbasketgroups` ( Link Here
2824
  `id` int(11) NOT NULL auto_increment,
2824
  `id` int(11) NOT NULL auto_increment,
2825
  `name` varchar(50) default NULL,
2825
  `name` varchar(50) default NULL,
2826
  `closed` tinyint(1) default NULL,
2826
  `closed` tinyint(1) default NULL,
2827
  closeddate date default NULL, -- the date the basketgroup was closed
2827
  `booksellerid` int(11) NOT NULL,
2828
  `booksellerid` int(11) NOT NULL,
2828
  `deliveryplace` varchar(10) default NULL,
2829
  `deliveryplace` varchar(10) default NULL,
2829
  `freedeliveryplace` text default NULL,
2830
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 9773-9778 if ( CheckVersion($DBversion) ) { Link Here
9773
    SetVersion ($DBversion);
9773
    SetVersion ($DBversion);
9774
}
9774
}
9775
9775
9776
$DBversion = "3.19.00.012";
9777
if (CheckVersion($DBversion)) {
9778
    $dbh->do(q|
9779
        ALTER TABLE aqbasketgroups
9780
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
9781
    |);
9782
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
9783
    SetVersion($DBversion);
9784
}
9785
9776
=head1 FUNCTIONS
9786
=head1 FUNCTIONS
9777
9787
9778
=head2 TableExists($table)
9788
=head2 TableExists($table)
9779
- 

Return to bug 11708