[Koha-devel] Basket Creation in neworderempty.pl
Arun kumar
arun25jun at gmail.com
Mon Aug 4 09:30:35 CEST 2014
Hello Guys,
We are developing some Customization programming for KOHA 3.12 to meet our
requirements, I have trouble in creation of basket in neworderempty.pl i
have added the form in template of neworderempty.tmpl
my $op = $input ->param('op');
my $booksellerid = $input->param('booksellerid');
my $branches = GetBranches;
if ( $op eq 'add_form' ) {
my @contractloop;
my $basket;
my $bookseller = GetBookSellerFromId($booksellerid);
my $count = scalar @contractloop;
if ( $count > 0) {
$template->param(contractloop => \@contractloop,
basketcontractnumber =>
$basket->{'contractnumber'});
}
my @booksellers = C4::Bookseller::GetBookSeller();
$template->param( add_form => 1,
basketname => $basket->{'basketname'},
basketnote => $basket->{'note'},
basketbooksellernote => $basket->{'booksellernote'},
booksellername => $bookseller->{'name'},
booksellerid => $booksellerid,
basketno => $basketno,
booksellers => \@booksellers,
deliveryplace => $basket->{deliveryplace},
billingplace => $basket->{billingplace},
);
my $billingplace = $basket->{'billingplace'} ||
C4::Context->userenv->{"branch"};
my $deliveryplace = $basket->{'deliveryplace'} ||
C4::Context->userenv->{"branch"};
# Build the combobox to select the billing place
my @billingplaceloop;
my $branches = C4::Branch::GetBranchesLoop( $billingplace );
$template->param( billingplaceloop => $branches );
$branches = C4::Branch::GetBranchesLoop( $deliveryplace );
$template->param( deliveryplaceloop => $branches );
#End Edit
} elsif ( $op eq 'add_validate' ) {
#New basket
# creation of basket per day basis for every vendor and all the orders
for that day
# will be added to the same basket of creation
my $today = C4::Dates->today;
print $today;
my $dt = DateTime->now; # Stores current date and time as
datetime object
my $todaysdate = $dt->ymd;
my $dbh = C4::Context->dbh;
my $sql = q{ SELECT basketno, booksellerid, creationdate FROM
aqbasket WHERE creationdate = ? AND booksellerid=?};
my $sth = $dbh->prepare($sql);
$sth->execute($todaysdate, $booksellerid);
if (my @basketdetails = $sth->fetchrow_array ){
my @data = @basketdetails;
$basketno = splice(@data,0,1);
$template->param(basketno => $basketno);
}else{
$basketno = NewBasket(
$booksellerid,
$loggedinuser,
$input->param('basketname'),
$input->param('basketnote'),
$input->param('basketbooksellernote'),
$input->param('basketcontractnumber') || undef,
$input->param('deliveryplace'),
$input->param('billingplace'),
);
$template->param(basketno => $basketno);
}
at the template end i have set it with
<input type="hidden" name="op" value="add_validate" />
to activate the new basket function when i save but doesn't seem inserting
values for basket details in aqbasket table
can any one help me please, thanks in advance
Regards
Arunkumar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20140804/7f40ea49/attachment.html>
More information about the Koha-devel
mailing list