Lines 411-418
sub CloseBasketgroup {
Link Here
|
411 |
my $dbh = C4::Context->dbh; |
411 |
my $dbh = C4::Context->dbh; |
412 |
my $sth = $dbh->prepare(" |
412 |
my $sth = $dbh->prepare(" |
413 |
UPDATE aqbasketgroups |
413 |
UPDATE aqbasketgroups |
414 |
SET closed=1, |
414 |
SET closeddate=CAST(NOW() AS DATE) |
415 |
closeddate=CAST(NOW() AS DATE) |
|
|
416 |
WHERE id=? |
415 |
WHERE id=? |
417 |
"); |
416 |
"); |
418 |
$sth->execute($basketgroupno); |
417 |
$sth->execute($basketgroupno); |
Lines 433-439
sub ReOpenBasketgroup {
Link Here
|
433 |
my $dbh = C4::Context->dbh; |
432 |
my $dbh = C4::Context->dbh; |
434 |
my $sth = $dbh->prepare(" |
433 |
my $sth = $dbh->prepare(" |
435 |
UPDATE aqbasketgroups |
434 |
UPDATE aqbasketgroups |
436 |
SET closed=0, closeddate=NULL |
435 |
SET closeddate=NULL |
437 |
WHERE id=? |
436 |
WHERE id=? |
438 |
"); |
437 |
"); |
439 |
$sth->execute($basketgroupno); |
438 |
$sth->execute($basketgroupno); |
Lines 852-858
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
852 |
|
851 |
|
853 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
852 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
854 |
|
853 |
|
855 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
854 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
856 |
|
855 |
|
857 |
=cut |
856 |
=cut |
858 |
|
857 |
|
Lines 861-867
sub NewBasketgroup {
Link Here
|
861 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
860 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
862 |
my $query = "INSERT INTO aqbasketgroups ("; |
861 |
my $query = "INSERT INTO aqbasketgroups ("; |
863 |
my @params; |
862 |
my @params; |
864 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
863 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
865 |
if ( defined $basketgroupinfo->{$field} ) { |
864 |
if ( defined $basketgroupinfo->{$field} ) { |
866 |
$query .= "$field, "; |
865 |
$query .= "$field, "; |
867 |
push(@params, $basketgroupinfo->{$field}); |
866 |
push(@params, $basketgroupinfo->{$field}); |
Lines 916-922
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
916 |
|
915 |
|
917 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
916 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
918 |
|
917 |
|
919 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
918 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
920 |
|
919 |
|
921 |
=cut |
920 |
=cut |
922 |
|
921 |
|
Lines 928-939
sub ModBasketgroup {
Link Here
|
928 |
my @params; |
927 |
my @params; |
929 |
|
928 |
|
930 |
if ($basketgroupinfo->{closed}) { |
929 |
if ($basketgroupinfo->{closed}) { |
931 |
$query .= "closeddate = IF(closed = 0, CAST(NOW() AS DATE), closeddate), "; |
930 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
932 |
} elsif (defined $basketgroupinfo->{closed}) { |
931 |
} elsif (defined $basketgroupinfo->{closed}) { |
933 |
$query .= "closeddate = NULL, "; |
932 |
$query .= "closeddate = NULL, "; |
934 |
} |
933 |
} |
935 |
|
934 |
|
936 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
935 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
937 |
if ( defined $basketgroupinfo->{$field} ) { |
936 |
if ( defined $basketgroupinfo->{$field} ) { |
938 |
$query .= "$field=?, "; |
937 |
$query .= "$field=?, "; |
939 |
push(@params, $basketgroupinfo->{$field}); |
938 |
push(@params, $basketgroupinfo->{$field}); |
Lines 1006-1012
sub GetBasketgroup {
Link Here
|
1006 |
{ Slice => {} }, |
1005 |
{ Slice => {} }, |
1007 |
$basketgroupid |
1006 |
$basketgroupid |
1008 |
); |
1007 |
); |
1009 |
return $result_set->[0]; # id is unique |
1008 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1009 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
1010 |
return $basketgroup; |
1010 |
} |
1011 |
} |
1011 |
|
1012 |
|
1012 |
#------------------------------------------------------------# |
1013 |
#------------------------------------------------------------# |
Lines 1026-1032
sub GetBasketgroups {
Link Here
|
1026 |
my $dbh = C4::Context->dbh; |
1027 |
my $dbh = C4::Context->dbh; |
1027 |
my $sth = $dbh->prepare($query); |
1028 |
my $sth = $dbh->prepare($query); |
1028 |
$sth->execute($booksellerid); |
1029 |
$sth->execute($booksellerid); |
1029 |
return $sth->fetchall_arrayref({}); |
1030 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1031 |
foreach my $bg (@$basketgroups) { |
1032 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
1033 |
} |
1034 |
return $basketgroups; |
1030 |
} |
1035 |
} |
1031 |
|
1036 |
|
1032 |
#------------------------------------------------------------# |
1037 |
#------------------------------------------------------------# |