[Koha-devel] Basket Creation in neworderempty.pl

Katrin Fischer Katrin.Fischer.83 at web.de
Mon Aug 4 22:00:32 CEST 2014


Hi Arunkumar,

I was wondering why you are basing your customizations on 3.12 that is
quite old by now. Also, the acquisitions related code is changing quite
a lot between versions since a lot of enhancements and new features are
added. I am worried you are in for a lot of headache in the future with
customizations like that - making an update very hard. Have you thought
about generalizing your features so they could be submitted and be
included in Koha?

Katrin

Am 04.08.2014 um 09:30 schrieb Arun kumar:
> 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 <http://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
> 
> 
> 
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
> 



More information about the Koha-devel mailing list