One-Time Charge

Stephen Bechard steve at destek.net
Tue Jun 25 21:18:08 PDT 2002


I was checking out the new feature of One-Time Charge and
had a few problems. This is a great idea by the way!

Here is what I found...
At First I got the following error:

Errors Output
illegal pkgpart at quick-cust_pkg.cgi line 7. ,
/usr/local/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1545
Debug Output
illegal pkgpart at quick-cust_pkg.cgi line 7. ,
/usr/local/lib/perl5/site_perl/5.005/Apache/ASP.pm line 1545
ASP to Perl Script

  -: package
Apache::ASP::Compiles::_usr_local_etc_freeside_asp_global_global_asa; ;; sub
Apache::ASP::Compiles::_usr_local_etc_freeside_asp_global_global_asa::__ASP_
_usr_local_www_data_aspdocs_edit_process_quick_cust_pkg_cgixINL {  ;;
package
Apache::ASP::Compiles::_usr_local_etc_freeside_asp_global_global_asa; ;; no
strict;;use vars qw($Application $Session $Response $Server $Request);;use
lib qw(/usr/local/etc/freeside/asp-global/);;;
  -: #line 1 quick-cust_pkg.cgi
  1: ;
  2:
  3: #untaint custnum
  4: $cgi->param('custnum') =~ /^(\d+)$/
  5:   or die 'illegal custnum '. $cgi->param('custnum');
  6: my $custnum = $1;
  7: $cgi->param('pkgpart') =~ /^(\d+)$/
  8:   or die 'illegal pkgpart '. $cgi->param('pkgpart');
  9: my $pkgpart = $1;
 10:
 11: my @cust_pkg = ();
 12: my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [],
\@cust_pkg, );
 13:
 14: if ($error) {
 15: ; &ASP::WriteRef($main::Response, \('
 16: <!-- mason kludge -->
 17: '));
 18:   eidiot($error);
 19: } else {
 20:   print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?".
$cust_pkg[0]->pkgnum );
 21: }
 22:
 23: ; ;;no lib qw(/usr/local/etc/freeside/asp-global/); ;; }

I realized from the error above that the FORM was submitting to the
wrong cgi script and noticed that the FORM Tag wasn't closed from the
Order Packages that was just above it. So I added the closing FORM tags as
such:

--- freeside/httemplate/view/cust_main.cgi      Tue Jun 25 22:22:52 2002
+++ /home/freeside/website/aspdocs/view/cust_main.cgi   Tue Jun 25 23:46:48
2002
@@ -266,14 +266,14 @@
         $part_pkg->comment;
 }

-print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"><BR>';
+print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"></FORM><BR>';

 print '<BR>'.
   qq!<FORM ACTION="${p}edit/process/quick-charge.cgi" METHOD="POST">!.
   qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!.
   qq!Description:<INPUT TYPE="text" NAME="pkg">!.
   qq! Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>!.
-  qq!&nbsp;<INPUT TYPE="submit" VALUE="One-time charge"><BR>!;
+  qq!&nbsp;<INPUT TYPE="submit" VALUE="One-time charge"></FORM><BR>!;

Now the Form submitted as suspected and I got the Friendly Freeside Message:
    Error processing your request
    Your request could not be processed because of the following error:
    agent 1 can't purchase pkgpart 51

This would have been the next Package Number on my system.

I turned on the agent_defaultpkg under the configuration page and all was
happy!
It would be nice if the agent_defaultpkg could be based on selected agents
instead
of all or none.

Very Cool Feature!

Thanks,
Steve





More information about the freeside-users mailing list