Lines 435-442
sub CloseBasketgroup {
Link Here
|
435 |
my $dbh = C4::Context->dbh; |
435 |
my $dbh = C4::Context->dbh; |
436 |
my $sth = $dbh->prepare(" |
436 |
my $sth = $dbh->prepare(" |
437 |
UPDATE aqbasketgroups |
437 |
UPDATE aqbasketgroups |
438 |
SET closed=1, |
438 |
SET closeddate=CAST(NOW() AS DATE) |
439 |
closeddate=CAST(NOW() AS DATE) |
|
|
440 |
WHERE id=? |
439 |
WHERE id=? |
441 |
"); |
440 |
"); |
442 |
$sth->execute($basketgroupno); |
441 |
$sth->execute($basketgroupno); |
Lines 457-463
sub ReOpenBasketgroup {
Link Here
|
457 |
my $dbh = C4::Context->dbh; |
456 |
my $dbh = C4::Context->dbh; |
458 |
my $sth = $dbh->prepare(" |
457 |
my $sth = $dbh->prepare(" |
459 |
UPDATE aqbasketgroups |
458 |
UPDATE aqbasketgroups |
460 |
SET closed=0, closeddate=NULL |
459 |
SET closeddate=NULL |
461 |
WHERE id=? |
460 |
WHERE id=? |
462 |
"); |
461 |
"); |
463 |
$sth->execute($basketgroupno); |
462 |
$sth->execute($basketgroupno); |
Lines 874-880
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
874 |
|
873 |
|
875 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
874 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
876 |
|
875 |
|
877 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
876 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
878 |
|
877 |
|
879 |
=cut |
878 |
=cut |
880 |
|
879 |
|
Lines 883-889
sub NewBasketgroup {
Link Here
|
883 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
882 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
884 |
my $query = "INSERT INTO aqbasketgroups ("; |
883 |
my $query = "INSERT INTO aqbasketgroups ("; |
885 |
my @params; |
884 |
my @params; |
886 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
885 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
887 |
if ( defined $basketgroupinfo->{$field} ) { |
886 |
if ( defined $basketgroupinfo->{$field} ) { |
888 |
$query .= "$field, "; |
887 |
$query .= "$field, "; |
889 |
push(@params, $basketgroupinfo->{$field}); |
888 |
push(@params, $basketgroupinfo->{$field}); |
Lines 938-944
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
938 |
|
937 |
|
939 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
938 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
940 |
|
939 |
|
941 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
940 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
942 |
|
941 |
|
943 |
=cut |
942 |
=cut |
944 |
|
943 |
|
Lines 950-961
sub ModBasketgroup {
Link Here
|
950 |
my @params; |
949 |
my @params; |
951 |
|
950 |
|
952 |
if ($basketgroupinfo->{closed}) { |
951 |
if ($basketgroupinfo->{closed}) { |
953 |
$query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), "; |
952 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
954 |
} elsif (defined $basketgroupinfo->{closed}) { |
953 |
} elsif (defined $basketgroupinfo->{closed}) { |
955 |
$query .= "closeddate = NULL, "; |
954 |
$query .= "closeddate = NULL, "; |
956 |
} |
955 |
} |
957 |
|
956 |
|
958 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
957 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
959 |
if ( defined $basketgroupinfo->{$field} ) { |
958 |
if ( defined $basketgroupinfo->{$field} ) { |
960 |
$query .= "$field=?, "; |
959 |
$query .= "$field=?, "; |
961 |
push(@params, $basketgroupinfo->{$field}); |
960 |
push(@params, $basketgroupinfo->{$field}); |
Lines 1028-1034
sub GetBasketgroup {
Link Here
|
1028 |
{ Slice => {} }, |
1027 |
{ Slice => {} }, |
1029 |
$basketgroupid |
1028 |
$basketgroupid |
1030 |
); |
1029 |
); |
1031 |
return $result_set->[0]; # id is unique |
1030 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1031 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
1032 |
return $basketgroup; |
1032 |
} |
1033 |
} |
1033 |
|
1034 |
|
1034 |
#------------------------------------------------------------# |
1035 |
#------------------------------------------------------------# |
Lines 1048-1054
sub GetBasketgroups {
Link Here
|
1048 |
my $dbh = C4::Context->dbh; |
1049 |
my $dbh = C4::Context->dbh; |
1049 |
my $sth = $dbh->prepare($query); |
1050 |
my $sth = $dbh->prepare($query); |
1050 |
$sth->execute($booksellerid); |
1051 |
$sth->execute($booksellerid); |
1051 |
return $sth->fetchall_arrayref({}); |
1052 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1053 |
foreach my $bg (@$basketgroups) { |
1054 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
1055 |
} |
1056 |
return $basketgroups; |
1052 |
} |
1057 |
} |
1053 |
|
1058 |
|
1054 |
#------------------------------------------------------------# |
1059 |
#------------------------------------------------------------# |