From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/misc/process/delete-customer.cgi | 50 ++++++++++++++++++ httemplate/misc/process/link.cgi | 80 +++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100755 httemplate/misc/process/delete-customer.cgi create mode 100755 httemplate/misc/process/link.cgi (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi new file mode 100755 index 000000000..b15ffef17 --- /dev/null +++ b/httemplate/misc/process/delete-customer.cgi @@ -0,0 +1,50 @@ +<% +# +# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# $Log: delete-customer.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.1 1999/04/15 16:44:36 ivan +# delete customers +# + +use strict; +use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::CGI qw(popurl); +use FS::cust_main; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$conf = new FS::Conf; +die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); + +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; +if ( $cgi->param('new_custnum') ) { + $cgi->param('new_custnum') =~ /^(\d+)$/ + or die "Illegal new customer number: ". $cgi->param('new_custnum'); + $new_custnum = $1; +} else { + $new_custnum = ''; +} +$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) + or die "Customer not found: $custnum"; + +$error = $cust_main->delete($new_custnum); + +if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "delete-customer.cgi?". $cgi->query_string ); +} elsif ( $new_custnum ) { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$new_custnum"); +} else { + print $cgi->redirect(popurl(3)); +} +%> diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi new file mode 100755 index 000000000..94afa289a --- /dev/null +++ b/httemplate/misc/process/link.cgi @@ -0,0 +1,80 @@ +<% +# +# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ +# +# ivan@voicenet.com 97-feb-5 +# +# rewrite ivan@sisd.com 98-mar-18 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 +# +# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 +# +# $Log: link.cgi,v $ +# Revision 1.1 2001-07-30 07:36:04 ivan +# templates!!! +# +# Revision 1.6 2000/07/17 17:59:33 ivan +# oops +# +# Revision 1.5 1999/04/15 14:09:17 ivan +# get rid of top-level my() variables +# +# Revision 1.4 1999/02/07 09:59:35 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.3 1999/01/19 05:14:10 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.2 1998/12/17 09:15:00 ivan +# s/CGI::Request/CGI.pm/; +# + +use strict; +use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::CGI qw(popurl idiot eidiot); +use FS::UID qw(cgisuidsetup); +use FS::cust_svc; +use FS::Record qw(qsearchs); + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('pkgnum') =~ /^(\d+)$/; +$pkgnum = $1; +$cgi->param('svcpart') =~ /^(\d+)$/; +$svcpart = $1; +$cgi->param('svcnum') =~ /^(\d*)$/; +$svcnum = $1; + +unless ( $svcnum ) { + my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my($svcdb) = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; + my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_acct; + $svcnum=$svc_acct->svcnum; +} + +$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +die "svcnum not found!" unless $old; +$new = new FS::cust_svc ({ + 'svcnum' => $svcnum, + 'pkgnum' => $pkgnum, + 'svcpart' => $svcpart, +}); + +$error = $new->replace($old); + +unless ($error) { + #no errors, so let's view this customer. + print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); +} else { + idiot($error); +} + +%> -- cgit v1.2.1 From 8a8c9386cbd3383b0134aae8e32b5995f8886fb2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 19 Aug 2001 15:53:36 +0000 Subject: added user interface for svc_forward and vpopmail support --- httemplate/misc/process/catchall.cgi | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 httemplate/misc/process/catchall.cgi (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi new file mode 100755 index 000000000..0d84d7c4e --- /dev/null +++ b/httemplate/misc/process/catchall.cgi @@ -0,0 +1,55 @@ +<% +# +# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ +# +# Usage: post form to: +# http://server.name/path/catchall.cgi +# +# $Log: catchall.cgi,v $ +# Revision 1.1 2001-08-19 15:53:35 jeff +# added user interface for svc_forward and vpopmail support +# +# + +use strict; +use vars qw( $cgi $svcnum $old $new $error ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs fields); +use FS::svc_domain; +use FS::CGI qw(popurl); + +$FS::svc_domain::whois_hack=1; + +$cgi = new CGI; +cgisuidsetup($cgi); + +$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +$svcnum =$1; + +$old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; + +$new = new FS::svc_domain ( { + map { + ($_, scalar($cgi->param($_))); + } ( fields('svc_domain'), qw( pkgnum svcpart ) ) +} ); + +$new->setfield('action' => 'M'); + +if ( $svcnum ) { + $error = $new->replace($old); +} else { + $error = $new->insert; + $svcnum = $new->getfield('svcnum'); +} + +if ($error) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "catchall.cgi?". $cgi->query_string ); +} else { + print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +} + +%> -- cgit v1.2.1 From 3d671921441ba8422650b54435a1959ad1d4c71d Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 21 Aug 2001 02:31:57 +0000 Subject: remove $Log$ messages. whew. --- httemplate/misc/process/catchall.cgi | 12 +---------- httemplate/misc/process/delete-customer.cgi | 11 +--------- httemplate/misc/process/link.cgi | 33 +---------------------------- 3 files changed, 3 insertions(+), 53 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 0d84d7c4e..6b1147633 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,15 +1,5 @@ <% -# -# $Id: catchall.cgi,v 1.1 2001-08-19 15:53:35 jeff Exp $ -# -# Usage: post form to: -# http://server.name/path/catchall.cgi -# -# $Log: catchall.cgi,v $ -# Revision 1.1 2001-08-19 15:53:35 jeff -# added user interface for svc_forward and vpopmail support -# -# +# use strict; use vars qw( $cgi $svcnum $old $new $error ); diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index b15ffef17..4be52004b 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,14 +1,5 @@ <% -# -# $Id: delete-customer.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# $Log: delete-customer.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.1 1999/04/15 16:44:36 ivan -# delete customers -# +# use strict; use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 94afa289a..6b34e8a5d 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,36 +1,5 @@ <% -# -# $Id: link.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -# -# ivan@voicenet.com 97-feb-5 -# -# rewrite ivan@sisd.com 98-mar-18 -# -# Changes to allow page to work at a relative position in server -# bmccane@maxbaud.net 98-apr-3 -# -# can also link on some other fields now (about time) ivan@sisd.com 98-jun-24 -# -# $Log: link.cgi,v $ -# Revision 1.1 2001-07-30 07:36:04 ivan -# templates!!! -# -# Revision 1.6 2000/07/17 17:59:33 ivan -# oops -# -# Revision 1.5 1999/04/15 14:09:17 ivan -# get rid of top-level my() variables -# -# Revision 1.4 1999/02/07 09:59:35 ivan -# more mod_perl fixes, and bugfixes Peter Wemm sent via email -# -# Revision 1.3 1999/01/19 05:14:10 ivan -# for mod_perl: no more top-level my() variables; use vars instead -# also the last s/create/new/; -# -# Revision 1.2 1998/12/17 09:15:00 ivan -# s/CGI::Request/CGI.pm/; -# +# use strict; use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); -- cgit v1.2.1 From 1fd6d8cf5d7854860ef4fd10ed89828e0c04ec39 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 30 Jan 2002 14:18:09 +0000 Subject: remove use Module; and $cgi = new CGI; &cgisuidsetup(); from all templates. should work better under Mason. --- httemplate/misc/process/catchall.cgi | 21 +++++---------------- httemplate/misc/process/delete-customer.cgi | 23 ++++++----------------- httemplate/misc/process/link.cgi | 26 +++++++------------------- 3 files changed, 18 insertions(+), 52 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index 6b1147633..cf6f8d751 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,26 +1,14 @@ + <% -# - -use strict; -use vars qw( $cgi $svcnum $old $new $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs fields); -use FS::svc_domain; -use FS::CGI qw(popurl); $FS::svc_domain::whois_hack=1; -$cgi = new CGI; -cgisuidsetup($cgi); - $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -$svcnum =$1; +my $svcnum =$1; -$old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; +my $old = qsearchs('svc_domain',{'svcnum'=>$svcnum}) if $svcnum; -$new = new FS::svc_domain ( { +my $new = new FS::svc_domain ( { map { ($_, scalar($cgi->param($_))); } ( fields('svc_domain'), qw( pkgnum svcpart ) ) @@ -28,6 +16,7 @@ $new = new FS::svc_domain ( { $new->setfield('action' => 'M'); +my $error; if ( $svcnum ) { $error = $new->replace($old); } else { diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 4be52004b..6f26c8107 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,23 +1,12 @@ + <% -# -use strict; -use vars qw ( $cgi $conf $custnum $new_custnum $cust_main $error ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs); -use FS::CGI qw(popurl); -use FS::cust_main; - -$cgi = new CGI; -cgisuidsetup($cgi); - -$conf = new FS::Conf; +my $conf = new FS::Conf; die "Customer deletions not enabled" unless $conf->exists('deletecustomers'); $cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; +my $custnum = $1; +my $new_custnum; if ( $cgi->param('new_custnum') ) { $cgi->param('new_custnum') =~ /^(\d+)$/ or die "Illegal new customer number: ". $cgi->param('new_custnum'); @@ -25,10 +14,10 @@ if ( $cgi->param('new_custnum') ) { } else { $new_custnum = ''; } -$cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) +my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -$error = $cust_main->delete($new_custnum); +my $error = $cust_main->delete($new_custnum); if ( $error ) { $cgi->param('error', $error); diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 6b34e8a5d..80a5de81f 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,24 +1,12 @@ + <% -# - -use strict; -use vars qw ( $cgi $old $new $error $pkgnum $svcpart $svcnum ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use FS::CGI qw(popurl idiot eidiot); -use FS::UID qw(cgisuidsetup); -use FS::cust_svc; -use FS::Record qw(qsearchs); - -$cgi = new CGI; -cgisuidsetup($cgi); $cgi->param('pkgnum') =~ /^(\d+)$/; -$pkgnum = $1; +my $pkgnum = $1; $cgi->param('svcpart') =~ /^(\d+)$/; -$svcpart = $1; +my $svcpart = $1; $cgi->param('svcnum') =~ /^(\d*)$/; -$svcnum = $1; +my $svcnum = $1; unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); @@ -29,15 +17,15 @@ unless ( $svcnum ) { $svcnum=$svc_acct->svcnum; } -$old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); +my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; -$new = new FS::cust_svc ({ +my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, 'svcpart' => $svcpart, }); -$error = $new->replace($old); +my $error = $new->replace($old); unless ($error) { #no errors, so let's view this customer. -- cgit v1.2.1 From 4c18a45810f000bb013d23d4738cfca012794c4b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 9 Feb 2002 17:45:26 +0000 Subject: have FS::cust_svc::check look up & check pkg_svc.quantity like httemplate/view/cust_pkg.cgi (closes: Bug#43) --- httemplate/misc/process/link.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 80a5de81f..f8b7812e1 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,4 @@ - + <% $cgi->param('pkgnum') =~ /^(\d+)$/; @@ -12,13 +12,14 @@ unless ( $svcnum ) { my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); my($svcdb) = $part_svc->getfield('svcdb'); $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; - my($svc_acct)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); - eidiot("$link_field not found!") unless $svc_acct; - $svcnum=$svc_acct->svcnum; + my($svc_x)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + eidiot("$link_field not found!") unless $svc_x; + $svcnum=$svc_x->svcnum; } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); die "svcnum not found!" unless $old; +#die "svcnum $svcnum already linked to package ". $old->pkgnum if $old->pkgnum; my $new = new FS::cust_svc ({ 'svcnum' => $svcnum, 'pkgnum' => $pkgnum, -- cgit v1.2.1 From 22a35047ecdffff80110e06cc08fc84f9ddba9b0 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 13:21:31 +0000 Subject: removed from all files to fix any redirects, whew Mason handler.pl overrides CGI::redirect fixed strict; problems in edit/part_pkg.cgi & edit/process/part_pkg.cgi --- httemplate/misc/process/catchall.cgi | 1 - httemplate/misc/process/delete-customer.cgi | 1 - httemplate/misc/process/link.cgi | 1 - 3 files changed, 3 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/catchall.cgi b/httemplate/misc/process/catchall.cgi index cf6f8d751..44a63f9f8 100755 --- a/httemplate/misc/process/catchall.cgi +++ b/httemplate/misc/process/catchall.cgi @@ -1,4 +1,3 @@ - <% $FS::svc_domain::whois_hack=1; diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index 6f26c8107..16bdbaea8 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index f8b7812e1..af96c0bcd 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -1,4 +1,3 @@ - <% $cgi->param('pkgnum') =~ /^(\d+)$/; -- cgit v1.2.1 From a4c96748eb6eab29a70f3a944c6520283a635c78 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 10 Feb 2002 16:05:22 +0000 Subject: *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. *finally* seems to be working under Mason. sheesh. --- httemplate/misc/process/link.cgi | 3 +++ 1 file changed, 3 insertions(+) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index af96c0bcd..4b220a867 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -31,6 +31,9 @@ unless ($error) { #no errors, so let's view this customer. print $cgi->redirect(popurl(3). "view/cust_pkg.cgi?$pkgnum"); } else { +%> + +<% idiot($error); } -- cgit v1.2.1 From 04af7174c8f52ff484af7851f687e98f4d88670c Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 30 Aug 2002 17:34:06 +0000 Subject: working CSV import for crcmn --- httemplate/misc/process/cust_main-import.cgi | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 httemplate/misc/process/cust_main-import.cgi (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/cust_main-import.cgi b/httemplate/misc/process/cust_main-import.cgi new file mode 100644 index 000000000..9e1adce54 --- /dev/null +++ b/httemplate/misc/process/cust_main-import.cgi @@ -0,0 +1,30 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_import( { + filehandle => $fh, + agentnum => scalar($cgi->param('agentnum')), + refnum => scalar($cgi->param('refnum')), + pkgpart => scalar($cgi->param('pkgpart')), + 'fields' => [qw( cust_pkg.setup dayphone first last address1 address2 + city state zip comments )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 10ffb6447a6e045b379f38bb78a7cb154076c2fd Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 5 Sep 2002 13:28:00 +0000 Subject: batch charge/credit import --- .../misc/process/cust_main-import_charges.cgi | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 httemplate/misc/process/cust_main-import_charges.cgi (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi new file mode 100644 index 000000000..14df1bd8d --- /dev/null +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -0,0 +1,26 @@ +<% + + my $fh = $cgi->upload('csvfile'); + #warn $cgi; + #warn $fh; + + my $error = defined($fh) + ? FS::cust_main::batch_charge( { + filehandle => $fh, + 'fields' => [qw( custnum amount pkg )], + } ) + : 'No file'; + + if ( $error ) { + %> + + <% + eidiot($error); +# $cgi->param('error', $error); +# print $cgi->redirect( "${p}cust_main-import_charges.cgi + } else { + %> + + <%= header('Import sucessful') %> <% + } +%> -- cgit v1.2.1 From 69a956aecd4bc89c683e60f9ec3fe0c9e11ea0d7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 26 Nov 2002 11:58:14 +0000 Subject: link by username now only links to same svcpart --- httemplate/misc/process/link.cgi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/link.cgi b/httemplate/misc/process/link.cgi index 4b220a867..5d80adeb9 100755 --- a/httemplate/misc/process/link.cgi +++ b/httemplate/misc/process/link.cgi @@ -8,12 +8,15 @@ $cgi->param('svcnum') =~ /^(\d*)$/; my $svcnum = $1; unless ( $svcnum ) { - my($part_svc) = qsearchs('part_svc',{'svcpart'=>$svcpart}); - my($svcdb) = $part_svc->getfield('svcdb'); - $cgi->param('link_field') =~ /^(\w+)$/; my($link_field)=$1; - my($svc_x)=qsearchs($svcdb,{$link_field => $cgi->param('link_value') }); + my $part_svc = qsearchs('part_svc',{'svcpart'=>$svcpart}); + my $svcdb = $part_svc->getfield('svcdb'); + $cgi->param('link_field') =~ /^(\w+)$/; + my $link_field = $1; + my $svc_x = ( grep { $_->cust_svc->svcpart == $svcpart } + qsearch( $svcdb, { $link_field => $cgi->param('link_value') }) + )[0]; eidiot("$link_field not found!") unless $svc_x; - $svcnum=$svc_x->svcnum; + $svcnum = $svc_x->svcnum; } my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -- cgit v1.2.1 From 6addb511875324241cb002b2fe96225c066d0ddc Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Dec 2002 00:12:22 +0000 Subject: beginning of web-based data importer --- httemplate/misc/process/meta-import.cgi | 145 ++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 httemplate/misc/process/meta-import.cgi (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi new file mode 100644 index 000000000..d42d6d466 --- /dev/null +++ b/httemplate/misc/process/meta-import.cgi @@ -0,0 +1,145 @@ + +<%= header('Map tables') %> + +<% + #one + unless ( $cgi->param('magic') ) { + + #oops, silly + #my $fh = $cgi->upload('csvfile'); + ##warn $cgi; + ##warn $fh; + # + #use Archive::Tar; + #$tar = Archive::Tar->new(); + #$tar->create_archive($fh); #or die $tar->error; + + #haha for now + my @files = qw( +authserv credtype dunprev invoice pmtdet product taxplan +ccdet customer genlog ledger pops pubvars +cchist discplan glacct origco prodcat recur users +credcode dundet invline payment prodclas repforms webserv + ); + + %> +
+ + <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> +
+
+ + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> +
+ + <% + + my $schema_string = $cgi->param('schema'); + my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + + #*** should be in global.asa/handler.pl like the rest + eval 'use Text::CSV_XS;'; + + foreach my $table ( keys %schema ) { + + my $csv = Text::CSV_XS->new({ 'binary'=>1 }); + open(FILE,"); + close FILE; + $csv->parse($header) or die; + my @from_columns = $csv->fields; + + my @fs_columns = dbdef->table($schema{$table})->columns; + + %> + <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> +


+ <% + + } + + %> +
+
+ + + <% + + } elsif ( $cgi->param('magic') eq 'process' ) { + + %> + print results!! + <% + } + + #hashmaker widget + sub hashmaker { + my($name, $from, $to, $labelfrom, $labelto) = @_; + $fromsize = scalar(@$from); + $tosize = scalar(@$to); + "'. + '
$labelfrom$labelto
". + qq!\n". + ''. + qq!\n". + '
'. + qq!!. + '
'. + qq!!. + '
'. + "". + ''; + } + +%> -- cgit v1.2.1 From 64d21fc13eddf275f614f54ff9e17eca74dcd858 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 13 Dec 2002 00:31:32 +0000 Subject: taxclass fix (?) --- httemplate/misc/process/meta-import.cgi | 50 +++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index d42d6d466..4c3c7d665 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -19,6 +19,7 @@ function SafeOnsubmit() { gSafeOnsubmit[i](); } +
<% #one unless ( $cgi->param('magic') ) { @@ -41,23 +42,19 @@ credcode dundet invline payment prodclas repforms webserv ); %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %>
-
- - <% } elsif ( $cgi->param('magic') eq 'process' ) { %> -
<% my $schema_string = $cgi->param('schema'); + %><% my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ or die "guru meditation #420: $_"; ( $1 => $2 ); @@ -88,18 +85,47 @@ credcode dundet invline payment prodclas repforms webserv %>
-
- - <% - } elsif ( $cgi->param('magic') eq 'process' ) { + } elsif ( $cgi->param('magic') eq 'process2' ) { - %> - print results!! - <% + print "
\n";
+    #false laziness with above
+    my $schema_string = $cgi->param('schema');
+    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $schema_string );
+    foreach my $table ( keys %schema ) {
+      ( my $spaces = $table ) =~ s/./ /g;
+      print "'$table' => { 'table' => '$schema{$table}',\n".
+            #(length($table) x ' '). "         'map'   => {\n";
+            "$spaces        'map'   => {\n";
+      my %map = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
+                         or die "guru meditation #420: $_";
+                       ( $1 => $2 );
+                     }
+                 split( /\n/, $cgi->param($table) );
+      foreach ( keys %map ) {
+        print "$spaces                     '$_' => '$map{$_}',\n";
+      }
+      print "$spaces                   },\n";
+      print "$spaces      },\n";
+
+    }
+    print "\n
"; + + } else { + warn "unrecognized magic: ". $cgi->param('magic'); } + %> + + + + + <% #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_; -- cgit v1.2.1 From c174642d32c139d1233597e3fa6a467586207023 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Mar 2003 11:36:51 +0000 Subject: minor meta import webUI updates --- httemplate/misc/process/meta-import.cgi | 82 +++++++++++++-------------------- 1 file changed, 32 insertions(+), 50 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 4c3c7d665..9e374b508 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -1,5 +1,6 @@ <%= header('Map tables') %> + +
+ <% - #one - unless ( $cgi->param('magic') ) { - - #oops, silly - #my $fh = $cgi->upload('csvfile'); - ##warn $cgi; - ##warn $fh; - # - #use Archive::Tar; - #$tar = Archive::Tar->new(); - #$tar->create_archive($fh); #or die $tar->error; - - #haha for now - my @files = qw( -authserv credtype dunprev invoice pmtdet product taxplan -ccdet customer genlog ledger pops pubvars -cchist discplan glacct origco prodcat recur users -credcode dundet invline payment prodclas repforms webserv - ); + #use DBIx::DBSchema; + my $schema = new_native DBIx::DBSchema + map { $cgi->param($_) } qw( data_source username password ); + foreach my $field (qw( data_source username password )) { %> + VALUE="<%= $cgi->param($field) %>"> + <% } + + my %schema = (); + if ( $cgi->param('schema') ) { + my $schema_string = $cgi->param('schema'); + %> <% + %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ + or die "guru meditation #420: $_"; + ( $1 => $2 ); + } + split( /\n/, $schema_string ); + } + + #first page + unless ( $cgi->param('magic') ) { %> - %> - <%= hashmaker('schema', \@files, [ grep { ! /^h_/ } dbdef->tables ] ) %> + <%= hashmaker('schema', [ $schema->tables ], + [ grep !/^h_/, dbdef->tables ], ) %>
<% - } elsif ( $cgi->param('magic') eq 'process' ) { + #second page + } elsif ( $cgi->param('magic') eq 'process' ) { %> - %> <% - my $schema_string = $cgi->param('schema'); - %><% - my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/ - or die "guru meditation #420: $_"; - ( $1 => $2 ); - } - split( /\n/, $schema_string ); - - #*** should be in global.asa/handler.pl like the rest - eval 'use Text::CSV_XS;'; - foreach my $table ( keys %schema ) { - my $csv = Text::CSV_XS->new({ 'binary'=>1 }); - open(FILE,"); - close FILE; - $csv->parse($header) or die; - my @from_columns = $csv->fields; - + my @from_columns = $schema->table($table)->columns; my @fs_columns = dbdef->table($schema{$table})->columns; %> - <%= hashmaker($table, \@from_columns, \@fs_columns, $table, $schema{$table} ) %> + <%= hashmaker($table, \@from_columns => \@fs_columns, + $table => $schema{$table}, ) %>


<% @@ -87,16 +74,11 @@ credcode dundet invline payment prodclas repforms webserv
<% + #third (results) } elsif ( $cgi->param('magic') eq 'process2' ) { print "
\n";
-    #false laziness with above
-    my $schema_string = $cgi->param('schema');
-    my %schema = map { /^\s*(\w+)\s*=>\s*(\w+)\s*$/
-                         or die "guru meditation #420: $_";
-                       ( $1 => $2 );
-                     }
-                 split( /\n/, $schema_string );
+
     foreach my $table ( keys %schema ) {
       ( my $spaces = $table ) =~ s/./ /g;
       print "'$table' => { 'table' => '$schema{$table}',\n".
-- 
cgit v1.2.1


From 856a62ca215f921ef3e9ddf4080626565727532a Mon Sep 17 00:00:00 2001
From: ivan 
Date: Wed, 2 Apr 2003 09:46:50 +0000
Subject: updated meta-import web UI to allow duplicate import tables

---
 httemplate/misc/process/meta-import.cgi | 37 +++++++++++++++++++++++++++------
 1 file changed, 31 insertions(+), 6 deletions(-)

(limited to 'httemplate/misc/process')

diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi
index 9e374b508..2939c8fb2 100644
--- a/httemplate/misc/process/meta-import.cgi
+++ b/httemplate/misc/process/meta-import.cgi
@@ -31,7 +31,9 @@ function SafeOnsubmit() {
      VALUE="<%= $cgi->param($field) %>">
   <% }
 
-  my %schema = ();
+  my %schema;
+  use Tie::DxHash;
+  tie %schema, 'Tie::DxHash';
   if ( $cgi->param('schema') ) {
     my $schema_string = $cgi->param('schema');
     %>  <%
@@ -57,14 +59,16 @@ function SafeOnsubmit() {
     
     <%
 
+    my %unique;
     foreach my $table ( keys %schema ) {
 
       my @from_columns = $schema->table($table)->columns;
       my @fs_columns = dbdef->table($schema{$table})->columns;
 
       %>
-      <%= hashmaker($table, \@from_columns => \@fs_columns,
-                            $table         =>  $schema{$table}, ) %>
+      <%= hashmaker( $table.'__'.$unique{$table}++,
+                     \@from_columns => \@fs_columns,
+                     $table         =>  $schema{$table}, ) %>
       


<% @@ -79,6 +83,7 @@ function SafeOnsubmit() { print "
\n";
 
+    my %unique;
     foreach my $table ( keys %schema ) {
       ( my $spaces = $table ) =~ s/./ /g;
       print "'$table' => { 'table' => '$schema{$table}',\n".
@@ -88,7 +93,7 @@ function SafeOnsubmit() {
                          or die "guru meditation #420: $_";
                        ( $1 => $2 );
                      }
-                 split( /\n/, $cgi->param($table) );
+                 split( /\n/, $cgi->param($table.'__'.$unique{$table}++) );
       foreach ( keys %map ) {
         print "$spaces                     '$_' => '$map{$_}',\n";
       }
@@ -116,11 +121,13 @@ function SafeOnsubmit() {
     "'.
       '
$labelfrom$labelto
". qq!\n". + "\n
". + qq!!. '
'. qq!\n". + "\n
". + qq!!. '
'. qq!!. @@ -146,6 +153,24 @@ function SafeOnsubmit() { object.options[index] = null; return value; } + function repack_${name}_from() { + var object = document.OneTrueForm.${name}_from; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$from ) ). " + } + function repack_${name}_to() { + var object = document.OneTrueForm.${name}_to; + object.options.length = 0; + ". join("\n", + map { "addOption_$name(object, '$_');\n" } + ( sort { $a cmp $b } @$to ) ). " + } + function addOption_$name(object,value) { + var length = object.length; + object.options[length] = new Option(value, value, false, false); + } ". ''; } -- cgit v1.2.1 From 066c1665efce43307446207a33f876b0baefe1d6 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 10 Nov 2003 13:54:21 +0000 Subject: hmm forgot to check this in? --- httemplate/misc/process/meta-import.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc/process') diff --git a/httemplate/misc/process/meta-import.cgi b/httemplate/misc/process/meta-import.cgi index 2939c8fb2..59d236f64 100644 --- a/httemplate/misc/process/meta-import.cgi +++ b/httemplate/misc/process/meta-import.cgi @@ -116,8 +116,8 @@ function SafeOnsubmit() { #hashmaker widget sub hashmaker { my($name, $from, $to, $labelfrom, $labelto) = @_; - $fromsize = scalar(@$from); - $tosize = scalar(@$to); + my $fromsize = scalar(@$from); + my $tosize = scalar(@$to); "
$labelfrom$labelto
". qq!