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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 427-433 sub CloseBasketgroup { Link Here
427
    my $dbh        = C4::Context->dbh;
427
    my $dbh        = C4::Context->dbh;
428
    my $sth = $dbh->prepare("
428
    my $sth = $dbh->prepare("
429
        UPDATE aqbasketgroups
429
        UPDATE aqbasketgroups
430
        SET    closed=1
430
        SET    closed=1,
431
               closeddate=CAST(NOW() AS DATE)
431
        WHERE  id=?
432
        WHERE  id=?
432
    ");
433
    ");
433
    $sth->execute($basketgroupno);
434
    $sth->execute($basketgroupno);
Lines 448-454 sub ReOpenBasketgroup { Link Here
448
    my $dbh        = C4::Context->dbh;
449
    my $dbh        = C4::Context->dbh;
449
    my $sth = $dbh->prepare("
450
    my $sth = $dbh->prepare("
450
        UPDATE aqbasketgroups
451
        UPDATE aqbasketgroups
451
        SET    closed=0
452
        SET    closed=0, closeddate=NULL
452
        WHERE  id=?
453
        WHERE  id=?
453
    ");
454
    ");
454
    $sth->execute($basketgroupno);
455
    $sth->execute($basketgroupno);
Lines 880-889 sub NewBasketgroup { Link Here
880
            push(@params, $basketgroupinfo->{$field});
881
            push(@params, $basketgroupinfo->{$field});
881
        }
882
        }
882
    }
883
    }
884
885
    if ($basketgroupinfo->{closed}) {
886
        $query .= "closeddate, ";
887
    }
883
    $query .= "booksellerid) VALUES (";
888
    $query .= "booksellerid) VALUES (";
884
    foreach (@params) {
889
    foreach (@params) {
885
        $query .= "?, ";
890
        $query .= "?, ";
886
    }
891
    }
892
    if ($basketgroupinfo->{closed}) {
893
        $query .= "CAST(NOW() AS DATE), ";
894
    }
887
    $query .= "?)";
895
    $query .= "?)";
888
    push(@params, $basketgroupinfo->{'booksellerid'});
896
    push(@params, $basketgroupinfo->{'booksellerid'});
889
    my $dbh = C4::Context->dbh;
897
    my $dbh = C4::Context->dbh;
Lines 932-937 sub ModBasketgroup { Link Here
932
    my $dbh = C4::Context->dbh;
940
    my $dbh = C4::Context->dbh;
933
    my $query = "UPDATE aqbasketgroups SET ";
941
    my $query = "UPDATE aqbasketgroups SET ";
934
    my @params;
942
    my @params;
943
944
    if ($basketgroupinfo->{closed}) {
945
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
946
    } elsif (defined $basketgroupinfo->{closed}) {
947
        $query .= "closeddate = NULL, ";
948
    }
949
935
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
950
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
936
        if ( defined $basketgroupinfo->{$field} ) {
951
        if ( defined $basketgroupinfo->{$field} ) {
937
            $query .= "$field=?, ";
952
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2794-2799 CREATE TABLE `aqbasketgroups` ( Link Here
2794
  `id` int(11) NOT NULL auto_increment,
2794
  `id` int(11) NOT NULL auto_increment,
2795
  `name` varchar(50) default NULL,
2795
  `name` varchar(50) default NULL,
2796
  `closed` tinyint(1) default NULL,
2796
  `closed` tinyint(1) default NULL,
2797
  closeddate date default NULL, -- the date the basketgroup was closed
2797
  `booksellerid` int(11) NOT NULL,
2798
  `booksellerid` int(11) NOT NULL,
2798
  `deliveryplace` varchar(10) default NULL,
2799
  `deliveryplace` varchar(10) default NULL,
2799
  `freedeliveryplace` text default NULL,
2800
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 8776-8781 if ( CheckVersion($DBversion) ) { Link Here
8776
    SetVersion($DBversion);
8776
    SetVersion($DBversion);
8777
}
8777
}
8778
8778
8779
$DBversion = "XXX";
8780
if (CheckVersion($DBversion)) {
8781
    $dbh->do(q|
8782
        ALTER TABLE aqbasketgroups
8783
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
8784
    |);
8785
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
8786
    SetVersion($DBversion);
8787
}
8788
8779
=head1 FUNCTIONS
8789
=head1 FUNCTIONS
8780
8790
8781
=head2 TableExists($table)
8791
=head2 TableExists($table)
8782
- 

Return to bug 11708