Lines 429-436
sub CloseBasketgroup {
Link Here
|
429 |
my $dbh = C4::Context->dbh; |
429 |
my $dbh = C4::Context->dbh; |
430 |
my $sth = $dbh->prepare(" |
430 |
my $sth = $dbh->prepare(" |
431 |
UPDATE aqbasketgroups |
431 |
UPDATE aqbasketgroups |
432 |
SET closed=1, |
432 |
SET closeddate=CAST(NOW() AS DATE) |
433 |
closeddate=CAST(NOW() AS DATE) |
|
|
434 |
WHERE id=? |
433 |
WHERE id=? |
435 |
"); |
434 |
"); |
436 |
$sth->execute($basketgroupno); |
435 |
$sth->execute($basketgroupno); |
Lines 451-457
sub ReOpenBasketgroup {
Link Here
|
451 |
my $dbh = C4::Context->dbh; |
450 |
my $dbh = C4::Context->dbh; |
452 |
my $sth = $dbh->prepare(" |
451 |
my $sth = $dbh->prepare(" |
453 |
UPDATE aqbasketgroups |
452 |
UPDATE aqbasketgroups |
454 |
SET closed=0, closeddate=NULL |
453 |
SET closeddate=NULL |
455 |
WHERE id=? |
454 |
WHERE id=? |
456 |
"); |
455 |
"); |
457 |
$sth->execute($basketgroupno); |
456 |
$sth->execute($basketgroupno); |
Lines 868-874
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
868 |
|
867 |
|
869 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
868 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
870 |
|
869 |
|
871 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
870 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
872 |
|
871 |
|
873 |
=cut |
872 |
=cut |
874 |
|
873 |
|
Lines 877-883
sub NewBasketgroup {
Link Here
|
877 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
876 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
878 |
my $query = "INSERT INTO aqbasketgroups ("; |
877 |
my $query = "INSERT INTO aqbasketgroups ("; |
879 |
my @params; |
878 |
my @params; |
880 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
879 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
881 |
if ( defined $basketgroupinfo->{$field} ) { |
880 |
if ( defined $basketgroupinfo->{$field} ) { |
882 |
$query .= "$field, "; |
881 |
$query .= "$field, "; |
883 |
push(@params, $basketgroupinfo->{$field}); |
882 |
push(@params, $basketgroupinfo->{$field}); |
Lines 932-938
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
932 |
|
931 |
|
933 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
932 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
934 |
|
933 |
|
935 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
934 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
936 |
|
935 |
|
937 |
=cut |
936 |
=cut |
938 |
|
937 |
|
Lines 944-955
sub ModBasketgroup {
Link Here
|
944 |
my @params; |
943 |
my @params; |
945 |
|
944 |
|
946 |
if ($basketgroupinfo->{closed}) { |
945 |
if ($basketgroupinfo->{closed}) { |
947 |
$query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), "; |
946 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
948 |
} elsif (defined $basketgroupinfo->{closed}) { |
947 |
} elsif (defined $basketgroupinfo->{closed}) { |
949 |
$query .= "closeddate = NULL, "; |
948 |
$query .= "closeddate = NULL, "; |
950 |
} |
949 |
} |
951 |
|
950 |
|
952 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
951 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
953 |
if ( defined $basketgroupinfo->{$field} ) { |
952 |
if ( defined $basketgroupinfo->{$field} ) { |
954 |
$query .= "$field=?, "; |
953 |
$query .= "$field=?, "; |
955 |
push(@params, $basketgroupinfo->{$field}); |
954 |
push(@params, $basketgroupinfo->{$field}); |
Lines 1022-1028
sub GetBasketgroup {
Link Here
|
1022 |
{ Slice => {} }, |
1021 |
{ Slice => {} }, |
1023 |
$basketgroupid |
1022 |
$basketgroupid |
1024 |
); |
1023 |
); |
1025 |
return $result_set->[0]; # id is unique |
1024 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1025 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
1026 |
return $basketgroup; |
1026 |
} |
1027 |
} |
1027 |
|
1028 |
|
1028 |
#------------------------------------------------------------# |
1029 |
#------------------------------------------------------------# |
Lines 1042-1048
sub GetBasketgroups {
Link Here
|
1042 |
my $dbh = C4::Context->dbh; |
1043 |
my $dbh = C4::Context->dbh; |
1043 |
my $sth = $dbh->prepare($query); |
1044 |
my $sth = $dbh->prepare($query); |
1044 |
$sth->execute($booksellerid); |
1045 |
$sth->execute($booksellerid); |
1045 |
return $sth->fetchall_arrayref({}); |
1046 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1047 |
foreach my $bg (@$basketgroups) { |
1048 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
1049 |
} |
1050 |
return $basketgroups; |
1046 |
} |
1051 |
} |
1047 |
|
1052 |
|
1048 |
#------------------------------------------------------------# |
1053 |
#------------------------------------------------------------# |