|
Lines 422-429
sub CloseBasketgroup {
Link Here
|
| 422 |
my $dbh = C4::Context->dbh; |
422 |
my $dbh = C4::Context->dbh; |
| 423 |
my $sth = $dbh->prepare(" |
423 |
my $sth = $dbh->prepare(" |
| 424 |
UPDATE aqbasketgroups |
424 |
UPDATE aqbasketgroups |
| 425 |
SET closed=1, |
425 |
SET closeddate=CAST(NOW() AS DATE) |
| 426 |
closeddate=CAST(NOW() AS DATE) |
|
|
| 427 |
WHERE id=? |
426 |
WHERE id=? |
| 428 |
"); |
427 |
"); |
| 429 |
$sth->execute($basketgroupno); |
428 |
$sth->execute($basketgroupno); |
|
Lines 444-450
sub ReOpenBasketgroup {
Link Here
|
| 444 |
my $dbh = C4::Context->dbh; |
443 |
my $dbh = C4::Context->dbh; |
| 445 |
my $sth = $dbh->prepare(" |
444 |
my $sth = $dbh->prepare(" |
| 446 |
UPDATE aqbasketgroups |
445 |
UPDATE aqbasketgroups |
| 447 |
SET closed=0, closeddate=NULL |
446 |
SET closeddate=NULL |
| 448 |
WHERE id=? |
447 |
WHERE id=? |
| 449 |
"); |
448 |
"); |
| 450 |
$sth->execute($basketgroupno); |
449 |
$sth->execute($basketgroupno); |
|
Lines 863-869
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 863 |
|
862 |
|
| 864 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
863 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
| 865 |
|
864 |
|
| 866 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
865 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
| 867 |
|
866 |
|
| 868 |
=cut |
867 |
=cut |
| 869 |
|
868 |
|
|
Lines 872-878
sub NewBasketgroup {
Link Here
|
| 872 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
871 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
| 873 |
my $query = "INSERT INTO aqbasketgroups ("; |
872 |
my $query = "INSERT INTO aqbasketgroups ("; |
| 874 |
my @params; |
873 |
my @params; |
| 875 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
874 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 876 |
if ( defined $basketgroupinfo->{$field} ) { |
875 |
if ( defined $basketgroupinfo->{$field} ) { |
| 877 |
$query .= "$field, "; |
876 |
$query .= "$field, "; |
| 878 |
push(@params, $basketgroupinfo->{$field}); |
877 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 927-933
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 927 |
|
926 |
|
| 928 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
927 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
| 929 |
|
928 |
|
| 930 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
929 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
| 931 |
|
930 |
|
| 932 |
=cut |
931 |
=cut |
| 933 |
|
932 |
|
|
Lines 939-950
sub ModBasketgroup {
Link Here
|
| 939 |
my @params; |
938 |
my @params; |
| 940 |
|
939 |
|
| 941 |
if ($basketgroupinfo->{closed}) { |
940 |
if ($basketgroupinfo->{closed}) { |
| 942 |
$query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), "; |
941 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
| 943 |
} elsif (defined $basketgroupinfo->{closed}) { |
942 |
} elsif (defined $basketgroupinfo->{closed}) { |
| 944 |
$query .= "closeddate = NULL, "; |
943 |
$query .= "closeddate = NULL, "; |
| 945 |
} |
944 |
} |
| 946 |
|
945 |
|
| 947 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
946 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 948 |
if ( defined $basketgroupinfo->{$field} ) { |
947 |
if ( defined $basketgroupinfo->{$field} ) { |
| 949 |
$query .= "$field=?, "; |
948 |
$query .= "$field=?, "; |
| 950 |
push(@params, $basketgroupinfo->{$field}); |
949 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 1017-1023
sub GetBasketgroup {
Link Here
|
| 1017 |
{ Slice => {} }, |
1016 |
{ Slice => {} }, |
| 1018 |
$basketgroupid |
1017 |
$basketgroupid |
| 1019 |
); |
1018 |
); |
| 1020 |
return $result_set->[0]; # id is unique |
1019 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1020 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
| 1021 |
return $basketgroup; |
| 1021 |
} |
1022 |
} |
| 1022 |
|
1023 |
|
| 1023 |
#------------------------------------------------------------# |
1024 |
#------------------------------------------------------------# |
|
Lines 1037-1043
sub GetBasketgroups {
Link Here
|
| 1037 |
my $dbh = C4::Context->dbh; |
1038 |
my $dbh = C4::Context->dbh; |
| 1038 |
my $sth = $dbh->prepare($query); |
1039 |
my $sth = $dbh->prepare($query); |
| 1039 |
$sth->execute($booksellerid); |
1040 |
$sth->execute($booksellerid); |
| 1040 |
return $sth->fetchall_arrayref({}); |
1041 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1042 |
foreach my $bg (@$basketgroups) { |
| 1043 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
| 1044 |
} |
| 1045 |
return $basketgroups; |
| 1041 |
} |
1046 |
} |
| 1042 |
|
1047 |
|
| 1043 |
#------------------------------------------------------------# |
1048 |
#------------------------------------------------------------# |