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 864-873 sub NewBasketgroup { Link Here
864
            push(@params, $basketgroupinfo->{$field});
865
            push(@params, $basketgroupinfo->{$field});
865
        }
866
        }
866
    }
867
    }
868
869
    if ($basketgroupinfo->{closed}) {
870
        $query .= "closeddate, ";
871
    }
867
    $query .= "booksellerid) VALUES (";
872
    $query .= "booksellerid) VALUES (";
868
    foreach (@params) {
873
    foreach (@params) {
869
        $query .= "?, ";
874
        $query .= "?, ";
870
    }
875
    }
876
    if ($basketgroupinfo->{closed}) {
877
        $query .= "CAST(NOW() AS DATE), ";
878
    }
871
    $query .= "?)";
879
    $query .= "?)";
872
    push(@params, $basketgroupinfo->{'booksellerid'});
880
    push(@params, $basketgroupinfo->{'booksellerid'});
873
    my $dbh = C4::Context->dbh;
881
    my $dbh = C4::Context->dbh;
Lines 916-921 sub ModBasketgroup { Link Here
916
    my $dbh = C4::Context->dbh;
924
    my $dbh = C4::Context->dbh;
917
    my $query = "UPDATE aqbasketgroups SET ";
925
    my $query = "UPDATE aqbasketgroups SET ";
918
    my @params;
926
    my @params;
927
928
    if ($basketgroupinfo->{closed}) {
929
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
930
    } elsif (defined $basketgroupinfo->{closed}) {
931
        $query .= "closeddate = NULL, ";
932
    }
933
919
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
934
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
920
        if ( defined $basketgroupinfo->{$field} ) {
935
        if ( defined $basketgroupinfo->{$field} ) {
921
            $query .= "$field=?, ";
936
            $query .= "$field=?, ";
(-)a/installer/data/mysql/kohastructure.sql (+1 lines)
Lines 2768-2773 CREATE TABLE `aqbasketgroups` ( Link Here
2768
  `id` int(11) NOT NULL auto_increment,
2768
  `id` int(11) NOT NULL auto_increment,
2769
  `name` varchar(50) default NULL,
2769
  `name` varchar(50) default NULL,
2770
  `closed` tinyint(1) default NULL,
2770
  `closed` tinyint(1) default NULL,
2771
  closeddate date default NULL, -- the date the basketgroup was closed
2771
  `booksellerid` int(11) NOT NULL,
2772
  `booksellerid` int(11) NOT NULL,
2772
  `deliveryplace` varchar(10) default NULL,
2773
  `deliveryplace` varchar(10) default NULL,
2773
  `freedeliveryplace` text default NULL,
2774
  `freedeliveryplace` text default NULL,
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +10 lines)
Lines 7953-7958 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
7953
    SetVersion($DBversion);
7953
    SetVersion($DBversion);
7954
}
7954
}
7955
7955
7956
$DBversion = "XXX";
7957
if (CheckVersion($DBversion)) {
7958
    $dbh->do(q|
7959
        ALTER TABLE aqbasketgroups
7960
        ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed
7961
    |);
7962
    print "Upgrade to $DBversion done (Bug XXXXX: Add aqbasketgroups.closeddate)\n";
7963
    SetVersion($DBversion);
7964
}
7965
7956
=head1 FUNCTIONS
7966
=head1 FUNCTIONS
7957
7967
7958
=head2 TableExists($table)
7968
=head2 TableExists($table)
7959
- 

Return to bug 11708