summaryrefslogtreecommitdiff
path: root/eg
diff options
context:
space:
mode:
authorcvs2git <cvs2git>2001-04-23 12:44:07 +0000
committercvs2git <cvs2git>2001-04-23 12:44:07 +0000
commitb05ab53315716b57305cbe6b2f5032eed314049c (patch)
tree3cc3737d6b3b47896d3f364cdf85d39651b78c09 /eg
parentfd337973c05b8cd15ecc8c4c9b913c7261e17ed6 (diff)
parent80ba0c074354875c288c143721af08a0a5d02e42 (diff)
This commit was manufactured by cvs2svn to create branchfreeside_1_3_0_pci_mods
'freeside_1_3_0_pci_mods'.
Diffstat (limited to 'eg')
-rwxr-xr-xeg/TEMPLATE_cust_main.import208
-rw-r--r--eg/table_template-svc.pm180
-rw-r--r--eg/table_template.pm116
3 files changed, 0 insertions, 504 deletions
diff --git a/eg/TEMPLATE_cust_main.import b/eg/TEMPLATE_cust_main.import
deleted file mode 100755
index 448186991..000000000
--- a/eg/TEMPLATE_cust_main.import
+++ /dev/null
@@ -1,208 +0,0 @@
-#!/usr/bin/perl -w
-
-# Template for importing legacy customer data
-#
-# $Id: TEMPLATE_cust_main.import,v 1.3 1999-03-26 13:15:56 ivan Exp $
-#
-# ivan@sisd.com 98-aug-17 - 20
-#
-# $Log: TEMPLATE_cust_main.import,v $
-# Revision 1.3 1999-03-26 13:15:56 ivan
-# s/create/new/, use all necessary FS::table_names to avoid warnings
-#
-# Revision 1.2 1998/12/16 05:29:45 ivan
-# adminsuidsetup now need user
-#
-
-use strict;
-use Date::Parse;
-use FS::UID qw(adminsuidsetup datasrc);
-use FS::Record qw(fields qsearch qsearchs);
-use FS::cust_main;
-use FS::cust_pkg;
-use FS::cust_svc;
-use FS::svc_acct;
-use FS::pkg_svc;
-
-my $user = shift or die &usage;
-adminsuidsetup $user;
-
-# use these for the imported cust_main records (unless you have these in legacy
-# data)
-my($agentnum)=4;
-my($refnum)=5;
-
-# map from legacy billing data to pkgpart, maps imported field
-# LegacyBillingData to pkgpart. your names and pkgparts will be different
-my(%pkgpart)=(
- 'Employee' => 10,
- 'Business' => 11,
- 'Individual' => 12,
- 'Basic PPP' => 13,
- 'Slave' => 14,
- 'Co-Located Server' => 15,
- 'Virtual Web' => 16,
- 'Perk Mail' => 17,
- 'Credit Hold' => 18,
-);
-
-my($file)="legacy_file";
-
-open(CLIENT,$file)
- or die "Can't open $file: $!";
-
-# put a tab-separated header atop the file, or define @fields
-# (use these names or change them below)
-#
-# for cust_main
-# custnum - unique
-# last - (name)
-# first - (name)
-# company
-# address1
-# address2
-# city
-# state
-# zip
-# country
-# daytime - (phone)
-# night - (phone)
-# fax
-# payby - CARD, BILL or COMP
-# payinfo - Credit card #, P.O. # or COMP authorization
-# paydate - Expiration
-# tax - 'Y' for tax exempt
-# for cust_pkg
-# LegacyBillingData - maps via %pkgpart above to a pkgpart
-# for svc_acct
-# username
-
-my($header);
-$header=<CLIENT>;
-chop $header;
-my(@fields)=map { /^\s*(.*[^\s]+)\s*$/; $1 } split(/\t/,$header);
-#print join("\n",@fields);
-
-my($error);
-my($link,$line)=(0,0);
-while (<CLIENT>) {
- chop;
- next if /^[\s\t]*$/; #skip any blank lines
-
- #define %svc hash for this record
- my(@record)=split(/\t/);
- my(%svc);
- foreach (@fields) {
- $svc{$_}=shift @record;
- }
-
- # might need to massage some data like this
- $svc{'payby'} =~ s/^Credit Card$/CARD/io;
- $svc{'payby'} =~ s/^Check$/BILL/io;
- $svc{'payby'} =~ s/^Cash$/BILL/io;
- $svc{'payby'} =~ s/^$/BILL/o;
- $svc{'First'} =~ s/&/and/go;
- $svc{'Zip'} =~ s/\s+$//go;
-
- my($cust_main) = new FS::cust_main ( {
- 'custnum' => $svc{'custnum'},
- 'agentnum' => $agentnum,
- 'last' => $svc{'last'},
- 'first' => $svc{'first'},
- 'company' => $svc{'company'},
- 'address1' => $svc{'address1'},
- 'address2' => $svc{'address2'},
- 'city' => $svc{'city'},
- 'state' => $svc{'state'},
- 'zip' => $svc{'zip'},
- 'country' => $svc{'country'},
- 'daytime' => $svc{'daytime'},
- 'night' => $svc{'night'},
- 'fax' => $svc{'fax'},
- 'payby' => $svc{'payby'},
- 'payinfo' => $svc{'payinfo'},
- 'paydate' => $svc{'paydate'},
- 'payname' => $svc{'payname'},
- 'tax' => $svc{'tax'},
- 'refnum' => $refnum,
- } );
-
- $error=$cust_main->insert;
-
- if ( $error ) {
- warn $cust_main->_dump;
- warn map "$_: ". $svc{$_}. "|\n", keys %svc;
- die $error;
- }
-
- my($cust_pkg)=new FS::cust_pkg ( {
- 'custnum' => $svc{'custnum'},
- 'pkgpart' => $pkgpart{$svc{'LegacyBillingData'}},
- 'setup' => '',
- 'bill' => '',
- 'susp' => '',
- 'expire' => '',
- 'cancel' => '',
- } );
-
- $error=$cust_pkg->insert;
- if ( $error ) {
- warn $svc{'LegacyBillingData'};
- die $error;
- }
-
- unless ( $svc{'username'} ) {
- warn "Empty login";
- } else {
- #find svc_acct record (imported with bin/svc_acct.import) for this username
- my($svc_acct)=qsearchs('svc_acct',{'username'=>$svc{'username'}});
- unless ( $svc_acct ) {
- warn "username ", $svc{'username'}, " not found\n";
- } else {
- #link to the cust_pkg record we created above
-
- #find cust_svc record for this svc_acct record
- my($o_cust_svc)=qsearchs('cust_svc',{
- 'svcnum' => $svc_acct->svcnum,
- 'pkgnum' => '',
- } );
- unless ( $o_cust_svc ) {
- warn "No unlinked cust_svc for svcnum ", $svc_acct->svcnum;
- } else {
-
- #make sure this svcpart is in pkgpart
- my($pkg_svc)=qsearchs('pkg_svc',{
- 'pkgpart' => $pkgpart{$svc{'LegacyBillingData'}},
- 'svcpart' => $o_cust_svc->svcpart,
- 'quantity' => 1,
- });
- unless ( $pkg_svc ) {
- warn "login ", $svc{'username'}, ": No svcpart ", $o_cust_svc->svcpart,
- " for pkgpart ", $pkgpart{$svc{'Acct. Type'}}, "\n" ;
- } else {
-
- #create new cust_svc record linked to cust_pkg record
- my($n_cust_svc) = new FS::cust_svc ({
- 'svcnum' => $o_cust_svc->svcnum,
- 'pkgnum' => $cust_pkg->pkgnum,
- 'svcpart' => $pkg_svc->svcpart,
- });
- my($error) = $n_cust_svc->replace($o_cust_svc);
- die $error if $error;
- $link++;
- }
- }
- }
- }
-
- $line++;
-
-}
-
-warn "\n$link of $line lines linked\n";
-
-# ---
-
-sub usage {
- die "Usage:\n\n cust_main.import user\n";
-}
diff --git a/eg/table_template-svc.pm b/eg/table_template-svc.pm
deleted file mode 100644
index a4f5028f5..000000000
--- a/eg/table_template-svc.pm
+++ /dev/null
@@ -1,180 +0,0 @@
-package FS::svc_table;
-
-use strict;
-use vars qw(@ISA);
-#use FS::Record qw( qsearch qsearchs );
-use FS::svc_Common;
-use FS::cust_svc;
-
-@ISA = qw(svc_Common);
-
-=head1 NAME
-
-FS::table_name - Object methods for table_name records
-
-=head1 SYNOPSIS
-
- use FS::table_name;
-
- $record = new FS::table_name \%hash;
- $record = new FS::table_name { 'column' => 'value' };
-
- $error = $record->insert;
-
- $error = $new_record->replace($old_record);
-
- $error = $record->delete;
-
- $error = $record->check;
-
- $error = $record->suspend;
-
- $error = $record->unsuspend;
-
- $error = $record->cancel;
-
-=head1 DESCRIPTION
-
-An FS::table_name object represents an example. FS::table_name inherits from
-FS::svc_Common. The following fields are currently supported:
-
-=over 4
-
-=item field - description
-
-=back
-
-=head1 METHODS
-
-=over 4
-
-=item new HASHREF
-
-Creates a new example. To add the example to the database, see L<"insert">.
-
-Note that this stores the hash reference, not a distinct copy of the hash it
-points to. You can ask the object for a copy with the I<hash> method.
-
-=cut
-
-sub table { 'table_name'; }
-
-=item insert
-
-Adds this record to the database. If there is an error, returns the error,
-otherwise returns false.
-
-The additional fields pkgnum and svcpart (see L<FS::cust_svc>) should be
-defined. An FS::cust_svc record will be created and inserted.
-
-=cut
-
-sub insert {
- my $self = shift;
- my $error;
-
- $error = $self->SUPER::insert;
- return $error if $error;
-
- '';
-}
-
-=item delete
-
-Delete this record from the database.
-
-=cut
-
-sub delete {
- my $self = shift;
- my $error;
-
- $error = $self->SUPER::delete;
- return $error if $error;
-
- '';
-}
-
-
-=item replace OLD_RECORD
-
-Replaces the OLD_RECORD with this one in the database. If there is an error,
-returns the error, otherwise returns false.
-
-=cut
-
-sub replace {
- my ( $new, $old ) = ( shift, shift );
- my $error;
-
- $error = $new->SUPER::replace($old);
- return $error if $error;
-
- '';
-}
-
-=item suspend
-
-Called by the suspend method of FS::cust_pkg (see L<FS::cust_pkg>).
-
-=item unsuspend
-
-Called by the unsuspend method of FS::cust_pkg (see L<FS::cust_pkg>).
-
-=item cancel
-
-Called by the cancel method of FS::cust_pkg (see L<FS::cust_pkg>).
-
-=item check
-
-Checks all fields to make sure this is a valid example. If there is
-an error, returns the error, otherwise returns false. Called by the insert
-and repalce methods.
-
-=cut
-
-sub check {
- my $self = shift;
-
- my $x = $self->setfixed;
- return $x unless ref($x);
- my $part_svc = $x;
-
-
- ''; #no error
-}
-
-=back
-
-=head1 VERSION
-
-$Id: table_template-svc.pm,v 1.1 1999-08-04 08:03:03 ivan Exp $
-
-=head1 BUGS
-
-The author forgot to customize this manpage.
-
-=head1 SEE ALSO
-
-L<FS::svc_Common>, L<FS::Record>, L<FS::cust_svc>, L<FS::part_svc>,
-L<FS::cust_pkg>, schema.html from the base documentation.
-
-=head1 HISTORY
-
-ivan@voicenet.com 97-jul-21
-
-$Log: table_template-svc.pm,v $
-Revision 1.1 1999-08-04 08:03:03 ivan
-move table subclass examples out of production directory
-
-Revision 1.4 1998/12/30 00:30:48 ivan
-svc_ stuff is more properly OO - has a common superclass FS::svc_Common
-
-Revision 1.2 1998/11/15 04:33:01 ivan
-updates for newest versoin
-
-
-=cut
-
-1;
-
diff --git a/eg/table_template.pm b/eg/table_template.pm
deleted file mode 100644
index 2cc1e1d6e..000000000
--- a/eg/table_template.pm
+++ /dev/null
@@ -1,116 +0,0 @@
-package FS::table_name;
-
-use strict;
-use vars qw( @ISA );
-use FS::Record qw( qsearch qsearchs );
-
-@ISA = qw(FS::Record);
-
-=head1 NAME
-
-FS::table_name - Object methods for table_name records
-
-=head1 SYNOPSIS
-
- use FS::table_name;
-
- $record = new FS::table_name \%hash;
- $record = new FS::table_name { 'column' => 'value' };
-
- $error = $record->insert;
-
- $error = $new_record->replace($old_record);
-
- $error = $record->delete;
-
- $error = $record->check;
-
-=head1 DESCRIPTION
-
-An FS::table_name object represents an example. FS::table_name inherits from
-FS::Record. The following fields are currently supported:
-
-=over 4
-
-=item field - description
-
-=back
-
-=head1 METHODS
-
-=over 4
-
-=item new HASHREF
-
-Creates a new example. To add the example to the database, see L<"insert">.
-
-Note that this stores the hash reference, not a distinct copy of the hash it
-points to. You can ask the object for a copy with the I<hash> method.
-
-=cut
-
-# the new method can be inherited from FS::Record, if a table method is defined
-
-sub table { 'table_name'; }
-
-=item insert
-
-Adds this record to the database. If there is an error, returns the error,
-otherwise returns false.
-
-=cut
-
-# the insert method can be inherited from FS::Record
-
-=item delete
-
-Delete this record from the database.
-
-=cut
-
-# the delete method can be inherited from FS::Record
-
-=item replace OLD_RECORD
-
-Replaces the OLD_RECORD with this one in the database. If there is an error,
-returns the error, otherwise returns false.
-
-=cut
-
-# the replace method can be inherited from FS::Record
-
-=item check
-
-Checks all fields to make sure this is a valid example. If there is
-an error, returns the error, otherwise returns false. Called by the insert
-and replace methods.
-
-=cut
-
-# the check method should currently be supplied - FS::Record contains some
-# data checking routines
-
-sub check {
- my $self = shift;
-
- ''; #no error
-}
-
-=back
-
-=head1 VERSION
-
-$Id: table_template.pm,v 1.2 2000-10-27 20:15:50 ivan Exp $
-
-=head1 BUGS
-
-The author forgot to customize this manpage.
-
-=head1 SEE ALSO
-
-L<FS::Record>, schema.html from the base documentation.
-
-=cut
-
-1;
-