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