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

(-)a/C4/Acquisition.pm (-2 / +17 lines)
Lines 413-419 sub CloseBasketgroup { Link Here
413
    my $dbh        = C4::Context->dbh;
413
    my $dbh        = C4::Context->dbh;
414
    my $sth = $dbh->prepare("
414
    my $sth = $dbh->prepare("
415
        UPDATE aqbasketgroups
415
        UPDATE aqbasketgroups
416
        SET    closed=1
416
        SET    closed=1,
417
               closeddate=CAST(NOW() AS DATE)
417
        WHERE  id=?
418
        WHERE  id=?
418
    ");
419
    ");
419
    $sth->execute($basketgroupno);
420
    $sth->execute($basketgroupno);
Lines 434-440 sub ReOpenBasketgroup { Link Here
434
    my $dbh        = C4::Context->dbh;
435
    my $dbh        = C4::Context->dbh;
435
    my $sth = $dbh->prepare("
436
    my $sth = $dbh->prepare("
436
        UPDATE aqbasketgroups
437
        UPDATE aqbasketgroups
437
        SET    closed=0
438
        SET    closed=0, closeddate=NULL
438
        WHERE  id=?
439
        WHERE  id=?
439
    ");
440
    ");
440
    $sth->execute($basketgroupno);
441
    $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 2852-2857 CREATE TABLE `aqbasketgroups` ( Link Here
2852
  `id` int(11) NOT NULL auto_increment,
2852
  `id` int(11) NOT NULL auto_increment,
2853
  `name` varchar(50) default NULL,
2853
  `name` varchar(50) default NULL,
2854
  `closed` tinyint(1) default NULL,
2854
  `closed` tinyint(1) default NULL,
2855
  closeddate date default NULL, -- the date the basketgroup was closed
2855
  `booksellerid` int(11) NOT NULL,
2856
  `booksellerid` int(11) NOT NULL,
2856
  `deliveryplace` varchar(10) default NULL,
2857
  `deliveryplace` varchar(10) default NULL,
2857
  `freedeliveryplace` text default NULL,
2858
  `freedeliveryplace` text default NULL,
2858
- 

Return to bug 11708