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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 411-417 sub CloseBasketgroup { Link Here
411
    my $dbh        = C4::Context->dbh;
411
    my $dbh        = C4::Context->dbh;
412
    my $sth = $dbh->prepare("
412
    my $sth = $dbh->prepare("
413
        UPDATE aqbasketgroups
413
        UPDATE aqbasketgroups
414
        SET    closed=1
414
        SET    closed=1,
415
               closeddate=CAST(NOW() AS DATE)
415
        WHERE  id=?
416
        WHERE  id=?
416
    ");
417
    ");
417
    $sth->execute($basketgroupno);
418
    $sth->execute($basketgroupno);
Lines 432-438 sub ReOpenBasketgroup { Link Here
432
    my $dbh        = C4::Context->dbh;
433
    my $dbh        = C4::Context->dbh;
433
    my $sth = $dbh->prepare("
434
    my $sth = $dbh->prepare("
434
        UPDATE aqbasketgroups
435
        UPDATE aqbasketgroups
435
        SET    closed=0
436
        SET    closed=0, closeddate=NULL
436
        WHERE  id=?
437
        WHERE  id=?
437
    ");
438
    ");
438
    $sth->execute($basketgroupno);
439
    $sth->execute($basketgroupno);
Lines 866-875 sub NewBasketgroup { Link Here
866
            push(@params, $basketgroupinfo->{$field});
867
            push(@params, $basketgroupinfo->{$field});
867
        }
868
        }
868
    }
869
    }
870
871
    if ($basketgroupinfo->{closed}) {
872
        $query .= "closeddate, ";
873
    }
869
    $query .= "booksellerid) VALUES (";
874
    $query .= "booksellerid) VALUES (";
870
    foreach (@params) {
875
    foreach (@params) {
871
        $query .= "?, ";
876
        $query .= "?, ";
872
    }
877
    }
878
    if ($basketgroupinfo->{closed}) {
879
        $query .= "CAST(NOW() AS DATE), ";
880
    }
873
    $query .= "?)";
881
    $query .= "?)";
874
    push(@params, $basketgroupinfo->{'booksellerid'});
882
    push(@params, $basketgroupinfo->{'booksellerid'});
875
    my $dbh = C4::Context->dbh;
883
    my $dbh = C4::Context->dbh;
Lines 918-923 sub ModBasketgroup { Link Here
918
    my $dbh = C4::Context->dbh;
926
    my $dbh = C4::Context->dbh;
919
    my $query = "UPDATE aqbasketgroups SET ";
927
    my $query = "UPDATE aqbasketgroups SET ";
920
    my @params;
928
    my @params;
929
930
    if ($basketgroupinfo->{closed}) {
931
        $query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), ";
932
    } elsif (defined $basketgroupinfo->{closed}) {
933
        $query .= "closeddate = NULL, ";
934
    }
935
921
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
936
    foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) {
922
        if ( defined $basketgroupinfo->{$field} ) {
937
        if ( defined $basketgroupinfo->{$field} ) {
923
            $query .= "$field=?, ";
938
            $query .= "$field=?, ";
(-)a/installer/data/mysql/atomicupdate/Bug-11708-add-column-aqbasketgroups-closeddate.sql (+1 lines)
Line 0 Link Here
1
ALTER TABLE aqbasketgroups ADD COLUMN closeddate DATE DEFAULT NULL AFTER closed;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +1 lines)
Lines 2774-2779 CREATE TABLE `aqbasketgroups` ( Link Here
2774
  `id` int(11) NOT NULL auto_increment,
2774
  `id` int(11) NOT NULL auto_increment,
2775
  `name` varchar(50) default NULL,
2775
  `name` varchar(50) default NULL,
2776
  `closed` tinyint(1) default NULL,
2776
  `closed` tinyint(1) default NULL,
2777
  closeddate date default NULL, -- the date the basketgroup was closed
2777
  `booksellerid` int(11) NOT NULL,
2778
  `booksellerid` int(11) NOT NULL,
2778
  `deliveryplace` varchar(10) default NULL,
2779
  `deliveryplace` varchar(10) default NULL,
2779
  `freedeliveryplace` text default NULL,
2780
  `freedeliveryplace` text default NULL,
2780
- 

Return to bug 11708