|
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 924-930
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 924 |
|
924 |
|
| 925 |
$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, |
| 926 |
|
926 |
|
| 927 |
$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. |
| 928 |
|
928 |
|
| 929 |
=cut |
929 |
=cut |
| 930 |
|
930 |
|
|
Lines 933-948
sub NewBasketgroup {
Link Here
|
| 933 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
933 |
die "booksellerid is required to create a basketgroup" unless $basketgroupinfo->{'booksellerid'}; |
| 934 |
my $query = "INSERT INTO aqbasketgroups ("; |
934 |
my $query = "INSERT INTO aqbasketgroups ("; |
| 935 |
my @params; |
935 |
my @params; |
| 936 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
936 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 937 |
if ( defined $basketgroupinfo->{$field} ) { |
937 |
if ( defined $basketgroupinfo->{$field} ) { |
| 938 |
$query .= "$field, "; |
938 |
$query .= "$field, "; |
| 939 |
push(@params, $basketgroupinfo->{$field}); |
939 |
push(@params, $basketgroupinfo->{$field}); |
| 940 |
} |
940 |
} |
| 941 |
} |
941 |
} |
|
|
942 |
|
| 943 |
if ($basketgroupinfo->{closed}) { |
| 944 |
$query .= "closeddate, "; |
| 945 |
} |
| 942 |
$query .= "booksellerid) VALUES ("; |
946 |
$query .= "booksellerid) VALUES ("; |
| 943 |
foreach (@params) { |
947 |
foreach (@params) { |
| 944 |
$query .= "?, "; |
948 |
$query .= "?, "; |
| 945 |
} |
949 |
} |
|
|
950 |
if ($basketgroupinfo->{closed}) { |
| 951 |
$query .= "CAST(NOW() AS DATE), "; |
| 952 |
} |
| 946 |
$query .= "?)"; |
953 |
$query .= "?)"; |
| 947 |
push(@params, $basketgroupinfo->{'booksellerid'}); |
954 |
push(@params, $basketgroupinfo->{'booksellerid'}); |
| 948 |
my $dbh = C4::Context->dbh; |
955 |
my $dbh = C4::Context->dbh; |
|
Lines 981-987
$hashref->{'freedeliveryplace'} is the 'freedeliveryplace' field of the basketgr
Link Here
|
| 981 |
|
988 |
|
| 982 |
$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, |
| 983 |
|
990 |
|
| 984 |
$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. |
| 985 |
|
992 |
|
| 986 |
=cut |
993 |
=cut |
| 987 |
|
994 |
|
|
Lines 991-997
sub ModBasketgroup {
Link Here
|
| 991 |
my $dbh = C4::Context->dbh; |
998 |
my $dbh = C4::Context->dbh; |
| 992 |
my $query = "UPDATE aqbasketgroups SET "; |
999 |
my $query = "UPDATE aqbasketgroups SET "; |
| 993 |
my @params; |
1000 |
my @params; |
| 994 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment closed)) { |
1001 |
|
|
|
1002 |
if ($basketgroupinfo->{closed}) { |
| 1003 |
$query .= "closeddate = IF(closeddate IS NULL, CAST(NOW() AS DATE), closeddate), "; |
| 1004 |
} elsif (defined $basketgroupinfo->{closed}) { |
| 1005 |
$query .= "closeddate = NULL, "; |
| 1006 |
} |
| 1007 |
|
| 1008 |
foreach my $field (qw(name billingplace deliveryplace freedeliveryplace deliverycomment)) { |
| 995 |
if ( defined $basketgroupinfo->{$field} ) { |
1009 |
if ( defined $basketgroupinfo->{$field} ) { |
| 996 |
$query .= "$field=?, "; |
1010 |
$query .= "$field=?, "; |
| 997 |
push(@params, $basketgroupinfo->{$field}); |
1011 |
push(@params, $basketgroupinfo->{$field}); |
|
Lines 1064-1070
sub GetBasketgroup {
Link Here
|
| 1064 |
{ Slice => {} }, |
1078 |
{ Slice => {} }, |
| 1065 |
$basketgroupid |
1079 |
$basketgroupid |
| 1066 |
); |
1080 |
); |
| 1067 |
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; |
| 1068 |
} |
1084 |
} |
| 1069 |
|
1085 |
|
| 1070 |
#------------------------------------------------------------# |
1086 |
#------------------------------------------------------------# |
|
Lines 1084-1090
sub GetBasketgroups {
Link Here
|
| 1084 |
my $dbh = C4::Context->dbh; |
1100 |
my $dbh = C4::Context->dbh; |
| 1085 |
my $sth = $dbh->prepare($query); |
1101 |
my $sth = $dbh->prepare($query); |
| 1086 |
$sth->execute($booksellerid); |
1102 |
$sth->execute($booksellerid); |
| 1087 |
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; |
| 1088 |
} |
1108 |
} |
| 1089 |
|
1109 |
|
| 1090 |
#------------------------------------------------------------# |
1110 |
#------------------------------------------------------------# |