From 8965012fa53fd05d851d2f5abed4e056ab758797 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 21 Sep 2002 11:17:39 +0000 Subject: all taxes now have names. closes: Bug#15 --- httemplate/browse/cust_main_county.cgi | 11 ++++++++++- httemplate/docs/schema.dia | Bin 14438 -> 14438 bytes httemplate/docs/schema.html | 2 ++ httemplate/edit/cust_main_county.cgi | 5 ++++- httemplate/edit/process/cust_main_county.cgi | 17 +++++++++-------- 5 files changed, 25 insertions(+), 10 deletions(-) (limited to 'httemplate') diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index 991606087..c2473c4c8 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -21,7 +21,8 @@ print '

'. &table(). <Country State County - Taxclass + Taxclass
(per-package classification) + Tax name
(printed on invoices) Tax Exempt
per
month @@ -111,6 +112,14 @@ END } print ""; + print "{taxname} ) { + print ' BGCOLOR="#ffffff">'. $hashref->{taxname}; + } else { + print ' BGCOLOR="#cccccc">Tax'; + } + print ""; + print "$hashref->{tax}%". '$'. sprintf("%.2f", $hashref->{exempt_amount} || 0). ''. diff --git a/httemplate/docs/schema.dia b/httemplate/docs/schema.dia index c0842a602..746561550 100644 Binary files a/httemplate/docs/schema.dia and b/httemplate/docs/schema.dia differ diff --git a/httemplate/docs/schema.html b/httemplate/docs/schema.html index 54adec3a7..c518d4a4d 100644 --- a/httemplate/docs/schema.html +++ b/httemplate/docs/schema.html @@ -57,6 +57,7 @@
  • recur - recurring fee
  • sdate - starting date
  • edate - ending date +
  • itemdesc - Line item description (currently used only when pkgnum is 0)
  • cust_credit - Credits. The equivalent of a negative cust_bill record.
      @@ -133,6 +134,7 @@
    • tax - % rate
    • taxclass
    • exempt_amount +
    • taxname - if defined, printed on invoices instead of "Tax"
  • cust_tax_exempt - Tax exemption record
      diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi index 7ef37a48d..f3d28825a 100755 --- a/httemplate/edit/cust_main_county.cgi +++ b/httemplate/edit/cust_main_county.cgi @@ -15,7 +15,8 @@ print qq!
      (ALL)' , ""; + print qq!!; print qq!%!; print qq!\$$taxnum}) + my $taxnum = $1; + my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum }) or die "Couldn't find taxnum $taxnum!"; - my $exempt_amount = $cgi->param("exempt_amount$taxnum"); - next unless $old->tax ne $cgi->param("tax$taxnum") - || $old->exempt_amount ne $exempt_amount; + next unless $old->tax != $cgi->param("tax$taxnum") + || $old->exempt_amount != $cgi->param("exempt_amount$taxnum") + || $old->taxname ne $cgi->param("taxname$taxnum"); my %hash = $old->hash; $hash{tax} = $cgi->param("tax$taxnum"); - $hash{exempt_amount} = $exempt_amount; - my($new)=new FS::cust_main_county \%hash; - my($error)=$new->replace($old); + $hash{exempt_amount} = $cgi->param("exempt_amount$taxnum"); + $hash{taxname} = $cgi->param("taxname$taxnum"); + my $new = new FS::cust_main_county \%hash; + my $error = $new->replace($old); if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); -- cgit v1.2.1 From 25fdab941288302f1aa8063d4e237f62876c59b8 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 25 Sep 2002 09:11:13 +0000 Subject: doc --- httemplate/docs/install.html | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index e6f4edbbc..3d19e4d35 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -64,7 +64,7 @@ Install the Freeside distribution:
      • with PostgreSQL:
        -$ su postgres
        +$ su postgres (pgsql on some distributions)
         $ createuser -P freeside
         Enter password for user "freeside": 
         Enter it again: 
        @@ -81,7 +81,7 @@ mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE,DROP on freeside.* T
         
           
      • Edit the top-level Makefile:
      • Add the freeside database to your database engine: @@ -164,7 +164,6 @@ require "/usr/local/apache/conf/handler.pl";
      • Restrict access to this web interface - see the Apache documentation on user authentication. For example, to configure user authentication with mod_auth (flat files):
         <Directory /usr/local/apache/htdocs/freeside-asp>
        -PerlSetVar Global /usr/local/etc/freeside/asp-global/
         AuthName Freeside
         AuthType Basic
         AuthUserFile /usr/local/etc/freeside/htpasswd
        @@ -181,7 +180,7 @@ $ freeside-adduser -c -h /usr/local/
         $ freeside-adduser -h /usr/local/etc/freeside/htpasswd username
      (using other auth types, add each user to your Apache authentication and then run: freeside-adduser username -
    • As the freeside UNIX user, run freeside--setup username (in the untar'ed freeside directory) to create the database tables, passing the username of a Freeside user you created above: +
    • As the freeside UNIX user, run freeside-setup username to create the database tables, passing the username of a Freeside user you created above:
       $ su freeside
       $ freeside-setup username
      @@ -190,7 +189,7 @@ $ freeside-setup username
         
    • As the freeside UNIX user, run bin/populate-msgcat username (in the untar'ed freeside directory) to populate the message catalog, passing the username of a Freeside user you created above:
       $ su freeside
      -$ cd /path/to/freeside-1.4.0/
      +$ cd /path/to/freeside/
       $ bin/populate-msgcat username
       
    • freeside-queued was installed with the Perl modules. Start it now and ensure that is run upon system startup (Do this manually, or edit the top-level Makefile, replacing INIT_FILE with the appropriate location on your systemand QUEUED_USER with the username of a Freeside user you created above, and run make install-init) -- cgit v1.2.1 From abfd68d00c867c64c033915374f8fc6b1ff7e6d2 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 26 Sep 2002 04:45:21 +0000 Subject: tyop --- httemplate/search/svc_acct.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index dcf261296..b2ed723e2 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -145,7 +145,7 @@ END $domain = "svcnum. "\">". $svc_domain->domain. ""; } else { - die "No svc_domain.svcnum record for svc_acct.domsvc: ".' + die "No svc_domain.svcnum record for svc_acct.domsvc: ". $svc_acct->domsvc; } my($cust_pkg,$cust_main); -- cgit v1.2.1 From c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 4 Oct 2002 12:57:06 +0000 Subject: working on the road: - easier "change package" link for changing one package to another - sqlradius export now compatible with Pg - indices on phone numbers - install instructions specify Pg 7.1 (at least until ILIKE thing is changed) - searching on phone number fragments --- httemplate/docs/install.html | 2 +- httemplate/edit/process/cust_pkg.cgi | 25 +++++++++----- httemplate/misc/change_pkg.cgi | 66 ++++++++++++++++++++++++++++++++++++ httemplate/search/cust_main.cgi | 19 +++++++---- httemplate/view/cust_main.cgi | 3 ++ 5 files changed, 99 insertions(+), 16 deletions(-) create mode 100755 httemplate/misc/change_pkg.cgi (limited to 'httemplate') diff --git a/httemplate/docs/install.html b/httemplate/docs/install.html index 3d19e4d35..3c48a746f 100644 --- a/httemplate/docs/install.html +++ b/httemplate/docs/install.html @@ -12,7 +12,7 @@ Before installing, you need:
    • rsync
    • A transactional database engine supported by Perl's DBI.
        -
      • PostgreSQL (v7 or higher) is recommended. +
      • PostgreSQL is recommended (v7.1.x or later, not 7.0.x).
      • MySQL versions before 4.1 do not support standard SQL subqueries and are NOT SUPPORTED. If you are a developer who wishes to contribute MySQL 3.x/4.0 support, see ticket #438 in the bug-tracking system and ask on the -devel mailing list. diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi index f8c9f5151..df8471c27 100755 --- a/httemplate/edit/process/cust_pkg.cgi +++ b/httemplate/edit/process/cust_pkg.cgi @@ -11,16 +11,23 @@ my @remove_pkgnums = map { $1; } $cgi->param('remove_pkg'); +my $error_redirect; my @pkgparts; -foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { - if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { - my $num_pkgs = $1; - while ( $num_pkgs-- ) { - push @pkgparts,$pkgpart; +if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) { #came from misc/change_pkg.cgi + $error_redirect = "misc/change_pkg.cgi"; + @pkgparts = ($1); +} else { #came from edit/cust_pkg.cgi + $error_redirect = "edit/cust_pkg.cgi"; + foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { + if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { + my $num_pkgs = $1; + while ( $num_pkgs-- ) { + push @pkgparts,$pkgpart; + } + } else { + $error = "Illegal quantity"; + last; } - } else { - $error = "Illegal quantity"; - last; } } @@ -28,7 +35,7 @@ $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); if ($error) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string ); + print $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string ); } else { print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); } diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi new file mode 100755 index 000000000..5346fd9d8 --- /dev/null +++ b/httemplate/misc/change_pkg.cgi @@ -0,0 +1,66 @@ + +<% + +my $pkgnum; +if ( $cgi->param('error') ) { + #$custnum = $cgi->param('custnum'); + #%remove_pkg = map { $_ => 1 } $cgi->param('remove_pkg'); + $pkgnum = ($cgi->param('remove_pkg'))[0]; +} else { + my($query) = $cgi->keywords; + $query =~ /^(\d+)$/; + #$custnum = $1; + $pkgnum = $1; + #%remove_pkg = (); +} + +my $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } ) + or die "unknown pkgnum $pkgnum"; +my $custnum = $cust_pkg->custnum; + +my $conf = new FS::Conf; + +my $p1 = popurl(1); + +my $cust_main = $cust_pkg->cust_main + or die "can't get cust_main record for custnum ". $cust_pkg->custnum. + " ( pkgnum ". cust_pkg->pkgnum. ")"; +my $agent = $cust_main->agent; + +print header("Change Package", menubar( + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + 'Main Menu' => $p, +)); + +print qq!Error: !, $cgi->param('error'), + "

        " + if $cgi->param('error'); + +my $part_pkg = $cust_pkg->part_pkg; + +print small_custview( $cust_main, $conf->config('countrydefault') ). + qq!!. + qq!!. + qq!!. + '
        Current package: '. $part_pkg->pkg. ' - '. $part_pkg->comment. + qq!
        New package: +
      • + + +END +%> diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 0a98b1891..ac238b63e 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -636,12 +636,19 @@ sub phonesearch { my $phone = $cgi->param('phone_text'); - #false laziness with Record::ut_phonen, only works with US/CA numbers... + #(no longer really) false laziness with Record::ut_phonen + #only works with US/CA numbers... $phone =~ s/\D//g; - $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ - or eidiot gettext('illegal_phone'). ": $phone"; - $phone = "$1-$2-$3"; - $phone .= " x$4" if $4; + if ( $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ ) { + $phone = "$1-$2-$3"; + $phone .= " x$4" if $4; + } elsif ( $phone =~ /^(\d{3})(\d{4})$/ ) { + $phone = "$1-$2"; + } elsif ( $phone =~ /^(\d{3,4})$/ ) { + $phone = $1; + } else { + eidiot gettext('illegal_phone'). ": $phone"; + } my @fields = qw(daytime night fax); push @fields, qw(ship_daytime ship_night ship_fax) @@ -650,7 +657,7 @@ sub phonesearch { for my $field ( @fields ) { push @cust_main, qsearch ( 'cust_main', { $field => { 'op' => 'LIKE', - 'value' => "$phone%" } } ); + 'value' => "%$phone%" } } ); } \@cust_main; diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 0610bc324..707de8d70 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -370,6 +370,9 @@ foreach my $package (@packages) { qq!$pkg - $comment ( Details )!; # | !; + print qq! ( !. + 'Change package )'; + #false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so unless ( $package->getfield('cancel') ) { print ' ( '; -- cgit v1.2.1