|
Lines 476-482
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 |
WHERE id=? |
480 |
WHERE id=? |
| 481 |
"); |
481 |
"); |
| 482 |
$sth->execute($basketgroupno); |
482 |
$sth->execute($basketgroupno); |
|
Lines 497-503
sub ReOpenBasketgroup {
Link Here
|
| 497 |
my $dbh = C4::Context->dbh; |
497 |
my $dbh = C4::Context->dbh; |
| 498 |
my $sth = $dbh->prepare(" |
498 |
my $sth = $dbh->prepare(" |
| 499 |
UPDATE aqbasketgroups |
499 |
UPDATE aqbasketgroups |
| 500 |
SET closed=0 |
500 |
SET closeddate=NULL |
| 501 |
WHERE id=? |
501 |
WHERE id=? |
| 502 |
"); |
502 |
"); |
| 503 |
$sth->execute($basketgroupno); |
503 |
$sth->execute($basketgroupno); |
|
Lines 926-932
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 926 |
|
926 |
|
| 927 |
$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, |
| 928 |
|
928 |
|
| 929 |
$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. |
| 930 |
|
930 |
|
| 931 |
=cut |
931 |
=cut |
| 932 |
|
932 |
|
|
Lines 935-950
sub NewBasketgroup {
Link Here
|
| 935 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
935 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
| 936 |
my $query = "INSERT INTO aqbasketgroups ("; |
936 |
my $query = "INSERT INTO aqbasketgroups ("; |
| 937 |
my @params; |
937 |
my @params; |
| 938 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
938 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 939 |
if ( defined $basketgroupinfo->{$field} ) { |
939 |
if ( defined $basketgroupinfo->{$field} ) { |
| 940 |
$query .= "$field, "; |
940 |
$query .= "$field, "; |
| 941 |
push(@params, $basketgroupinfo->{$field}); |
941 |
push(@params, $basketgroupinfo->{$field}); |
| 942 |
} |
942 |
} |
| 943 |
} |
943 |
} |
|
|
944 |
|
| 945 |
if ($basketgroupinfo->{closed}) { |
| 946 |
$query .= "closeddate, "; |
| 947 |
} |
| 944 |
$query .= "booksellerid) VALUES ("; |
948 |
$query .= "booksellerid) VALUES ("; |
| 945 |
foreach (@params) { |
949 |
foreach (@params) { |
| 946 |
$query .= "?, "; |
950 |
$query .= "?, "; |
| 947 |
} |
951 |
} |
|
|
952 |
if ($basketgroupinfo->{closed}) { |
| 953 |
$query .= "CAST(NOW() AS DATE), "; |
| 954 |
} |
| 948 |
$query .= "?)"; |
955 |
$query .= "?)"; |
| 949 |
push(@params, $basketgroupinfo->{'booksellerid'}); |
956 |
push(@params, $basketgroupinfo->{'booksellerid'}); |
| 950 |
my $dbh = C4::Context->dbh; |
957 |
my $dbh = C4::Context->dbh; |
|
Lines 983-989
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 983 |
|
990 |
|
| 984 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
991 |
$hashref->{'deliverycomment'} is the 'deliverycomment' field of the basketgroup in the aqbasketgroups table, |
| 985 |
|
992 |
|
| 986 |
$hashref->{'closed'} is the 'closed' field of the aqbasketgroups table, it is false if 0, true otherwise. |
993 |
$hashref->{'closed'} set 'closeddate' if true, or reset 'closeddate' if defined but false. |
| 987 |
|
994 |
|
| 988 |
=cut |
995 |
=cut |
| 989 |
|
996 |
|
|
Lines 993-999
sub ModBasketgroup {
Link Here
|
| 993 |
my $dbh = C4::Context->dbh; |
1000 |
my $dbh = C4::Context->dbh; |
| 994 |
my $query = "UPDATE aqbasketgroups SET "; |
1001 |
my $query = "UPDATE aqbasketgroups SET "; |
| 995 |
my @params; |
1002 |
my @params; |
| 996 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
1003 |
|
|
|
1004 |
if ($basketgroupinfo->{closed}) { |
| 1005 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
| 1006 |
} elsif (defined $basketgroupinfo->{closed}) { |
| 1007 |
$query .= "closeddate = NULL, "; |
| 1008 |
} |
| 1009 |
|
| 1010 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 997 |
if ( defined $basketgroupinfo->{$field} ) { |
1011 |
if ( defined $basketgroupinfo->{$field} ) { |
| 998 |
$query .= "$field=?, "; |
1012 |
$query .= "$field=?, "; |
| 999 |
push(@params, $basketgroupinfo->{$field}); |
1013 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 1066-1072
sub GetBasketgroup {
Link Here
|
| 1066 |
{ Slice => {} }, |
1080 |
{ Slice => {} }, |
| 1067 |
$basketgroupid |
1081 |
$basketgroupid |
| 1068 |
); |
1082 |
); |
| 1069 |
return $result_set->[0]; # id is unique |
1083 |
my $basketgroup = $result_set->[0]; # id is unique |
|
|
1084 |
$basketgroup->{closed} = defined($basketgroup->{closeddate}) ? 1 : 0; |
| 1085 |
return $basketgroup; |
| 1070 |
} |
1086 |
} |
| 1071 |
|
1087 |
|
| 1072 |
#------------------------------------------------------------# |
1088 |
#------------------------------------------------------------# |
|
Lines 1086-1092
sub GetBasketgroups {
Link Here
|
| 1086 |
my $dbh = C4::Context->dbh; |
1102 |
my $dbh = C4::Context->dbh; |
| 1087 |
my $sth = $dbh->prepare($query); |
1103 |
my $sth = $dbh->prepare($query); |
| 1088 |
$sth->execute($booksellerid); |
1104 |
$sth->execute($booksellerid); |
| 1089 |
return $sth->fetchall_arrayref({}); |
1105 |
my $basketgroups = $sth->fetchall_arrayref({}); |
|
|
1106 |
foreach my $bg (@$basketgroups) { |
| 1107 |
$bg->{closed} = defined($bg->{closeddate}) ? 1 : 0; |
| 1108 |
} |
| 1109 |
return $basketgroups; |
| 1090 |
} |
1110 |
} |
| 1091 |
|
1111 |
|
| 1092 |
#------------------------------------------------------------# |
1112 |
#------------------------------------------------------------# |