|
Lines 476-483
sub CloseBasketgroup {
Link Here
|
| 476 |
my $dbh = C4::Context->dbh; |
476 |
my $dbh = C4::Context->dbh; |
| 477 |
my $sth = $dbh->prepare(" |
477 |
my $sth = $dbh->prepare(" |
| 478 |
UPDATE aqbasketgroups |
478 |
UPDATE aqbasketgroups |
| 479 |
SET closed=1, |
479 |
SET closeddate=CAST(NOW() AS DATE) |
| 480 |
closeddate=CAST(NOW() AS DATE) |
|
|
| 481 |
WHERE id=? |
480 |
WHERE id=? |
| 482 |
"); |
481 |
"); |
| 483 |
$sth->execute($basketgroupno); |
482 |
$sth->execute($basketgroupno); |
|
Lines 498-504
sub ReOpenBasketgroup {
Link Here
|
| 498 |
my $dbh = C4::Context->dbh; |
497 |
my $dbh = C4::Context->dbh; |
| 499 |
my $sth = $dbh->prepare(" |
498 |
my $sth = $dbh->prepare(" |
| 500 |
UPDATE aqbasketgroups |
499 |
UPDATE aqbasketgroups |
| 501 |
SET closed=0, closeddate=NULL |
500 |
SET closeddate=NULL |
| 502 |
WHERE id=? |
501 |
WHERE id=? |
| 503 |
"); |
502 |
"); |
| 504 |
$sth->execute($basketgroupno); |
503 |
$sth->execute($basketgroupno); |
|
Lines 925-931
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 925 |
|
924 |
|
| 926 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
925 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
| 927 |
|
926 |
|
| 928 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
927 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
| 929 |
|
928 |
|
| 930 |
=cut |
929 |
=cut |
| 931 |
|
930 |
|
|
Lines 934-940
sub NewBasketgroup {
Link Here
|
| 934 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
933 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
| 935 |
my $query = "INSERT INTO aqbasketgroups ("; |
934 |
my $query = "INSERT INTO aqbasketgroups ("; |
| 936 |
my @params; |
935 |
my @params; |
| 937 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
936 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 938 |
if ( defined $basketgroupinfo->{$field} ) { |
937 |
if ( defined $basketgroupinfo->{$field} ) { |
| 939 |
$query .= "$field, "; |
938 |
$query .= "$field, "; |
| 940 |
push(@params, $basketgroupinfo->{$field}); |
939 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 989-995
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 989 |
|
988 |
|
| 990 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
989 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
| 991 |
|
990 |
|
| 992 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
991 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
| 993 |
|
992 |
|
| 994 |
=cut |
993 |
=cut |
| 995 |
|
994 |
|
|
Lines 1001-1012
sub ModBasketgroup {
Link Here
|
| 1001 |
my @params; |
1000 |
my @params; |
| 1002 |
|
1001 |
|
| 1003 |
if ($basketgroupinfo->{closed}) { |
1002 |
if ($basketgroupinfo->{closed}) { |
| 1004 |
$query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), "; |
1003 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
| 1005 |
} elsif (defined $basketgroupinfo->{closed}) { |
1004 |
} elsif (defined $basketgroupinfo->{closed}) { |
| 1006 |
$query .= "closeddate = NULL, "; |
1005 |
$query .= "closeddate = NULL, "; |
| 1007 |
} |
1006 |
} |
| 1008 |
|
1007 |
|
| 1009 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
1008 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 1010 |
if ( defined $basketgroupinfo->{$field} ) { |
1009 |
if ( defined $basketgroupinfo->{$field} ) { |
| 1011 |
$query .= "$field=?, "; |
1010 |
$query .= "$field=?, "; |
| 1012 |
push(@params, $basketgroupinfo->{$field}); |
1011 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 1079-1085
sub GetBasketgroup {
Link Here
|
| 1079 |
{ Slice => {} }, |
1078 |
{ Slice => {} }, |
| 1080 |
$basketgroupid |
1079 |
$basketgroupid |
| 1081 |
); |
1080 |
); |
| 1082 |
return $result_set->[0]; # id is unique |
1081 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1082 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
| 1083 |
return $basketgroup; |
| 1083 |
} |
1084 |
} |
| 1084 |
|
1085 |
|
| 1085 |
#------------------------------------------------------------# |
1086 |
#------------------------------------------------------------# |
|
Lines 1099-1105
sub GetBasketgroups {
Link Here
|
| 1099 |
my $dbh = C4::Context->dbh; |
1100 |
my $dbh = C4::Context->dbh; |
| 1100 |
my $sth = $dbh->prepare($query); |
1101 |
my $sth = $dbh->prepare($query); |
| 1101 |
$sth->execute($booksellerid); |
1102 |
$sth->execute($booksellerid); |
| 1102 |
return $sth->fetchall_arrayref({}); |
1103 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1104 |
foreach my $bg (@$basketgroups) { |
| 1105 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
| 1106 |
} |
| 1107 |
return $basketgroups; |
| 1103 |
} |
1108 |
} |
| 1104 |
|
1109 |
|
| 1105 |
#------------------------------------------------------------# |
1110 |
#------------------------------------------------------------# |