Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.8 KiB

  1. #!/usr/bin/perl
  2. use DBI;
  3. use C4::Database;
  4. use C4::Circulation::Issues;
  5. use C4::Circulation::Main;
  6. use C4::InterfaceCDK;
  7. use C4::Circulation::Borrower;
  8. # my @args=('issuewrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}");
  9. my %env = (
  10. branchcode => $ARGV[0], usercode => $ARGV[1], proccode => "lgon", borrowernumber => "",
  11. logintime => "", lasttime => "", tempuser => "", debug => "9",
  12. telnet => $ARGV[2], queue => $ARGV[3], printtype => $ARGV[4], brdata => $ARGV[5],
  13. bcard=>$ARGV[6]
  14. );
  15. my ($env) = \%env;
  16. startint();
  17. helptext('');
  18. my $done;
  19. my ($items,$items2,$amountdue);
  20. my $itemsdet;
  21. $env->{'sysarea'} = "Issues";
  22. $done = "Issues";
  23. my $i=0;
  24. my $dbh=&C4Connect;
  25. my ($bornum,$issuesallowed,$borrower,$reason,$amountdue) = C4::Circulation::Borrower::findborrower($env,$dbh);
  26. $env->{'loanlength'}="";
  27. if ($reason ne "") {
  28. $done = $reason;
  29. } elsif ($env->{'IssuesAllowed'} eq '0') {
  30. error_msg($env,"No Issues Allowed =$env->{'IssuesAllowed'}");
  31. } else {
  32. $env->{'bornum'} = $bornum;
  33. $env->{'bcard'} = $borrower->{'cardnumber'};
  34. ($items,$items2)=C4::Circulation::Main::pastitems($env,$bornum,$dbh); #from Circulation.pm
  35. $done = "No";
  36. my $it2p=0;
  37. while ($done eq 'No'){
  38. ($done,$items2,$it2p,$amountdue,$itemsdet) = C4::Circulation::Issues::processitems($env,$bornum,$borrower,$items,$items2,$it2p,$amountdue,$itemsdet);
  39. }
  40. }
  41. if ($done ne 'Issues'){
  42. $dbh->disconnect;
  43. die "test";
  44. }
  45. $dbh->disconnect;