add comments field
[freeside.git] / bin / fs-setup
index c1e87c8..314a7c2 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -Tw
 #
-# $Id: fs-setup,v 1.37 2001-06-03 14:16:11 ivan Exp $
+# $Id: fs-setup,v 1.40 2001-08-11 05:53:42 ivan Exp $
 #
 # ivan@sisd.com 97-nov-8,9
 #
 # fix radius attributes ivan@sisd.com 98-sep-27
 #
 # $Log: fs-setup,v $
-# Revision 1.37  2001-06-03 14:16:11  ivan
+# Revision 1.40  2001-08-11 05:53:42  ivan
+# add comments field
+#
+# Revision 1.39  2001/07/30 07:42:39  ivan
+# need an DBIx::DBSchema with delcolumn
+#
+# Revision 1.38  2001/07/30 07:36:04  ivan
+# templates!!!
+#
+# Revision 1.37  2001/06/03 14:16:11  ivan
 # allow empty refund reasons
 #
 # Revision 1.36  2001/04/15 12:56:31  ivan
@@ -141,7 +150,7 @@ BEGIN { $FS::Record::setup_hack = 1; }
 
 use strict;
 use DBI;
-use DBIx::DBSchema;
+use DBIx::DBSchema 0.18;
 use DBIx::DBSchema::Table;
 use DBIx::DBSchema::Column;
 use DBIx::DBSchema::ColGroup::Unique;
@@ -177,12 +186,24 @@ separated by whitespace.
 END
 my @attributes = map { s/\-/_/g; $_; } split(" ",&getvalue);
 
+print "\n\n", <<END, ":";
+Do you wish to enable the tracking of a second, separate shipping/service
+address?
+END
+my $ship = &_yesno;
+
 sub getvalue {
   my($x)=scalar(<STDIN>);
   chop $x;
   $x;
 }
 
+sub _yesno {
+  print " [y/N]:";
+  my $x = scalar(<STDIN>);
+  $x =~ /^y/i;
+}
+
 ###
 
 my($char_d) = 80; #default maxlength for text fields
@@ -214,6 +235,12 @@ my($dbdef) = new DBIx::DBSchema ( map {
   );
 } (keys %tables) );
 
+#remove ship_ from cust_main
+unless ($ship) {
+  my $cust_main = $dbdef->table('cust_main');
+  $cust_main->delcolumn($_) foreach ( grep /^ship_/, $cust_main->columns );
+}
+
 #add radius attributes to svc_acct
 
 my($svc_acct)=$dbdef->table('svc_acct');
@@ -452,6 +479,20 @@ sub tables_hash_hack {
         'daytime',  'varchar', 'NULL', 20,
         'night',    'varchar', 'NULL', 20,
         'fax',      'varchar', 'NULL', 12,
+        'ship_last',     'varchar', 'NULL', $char_d,
+#        'ship_middle',   'varchar', 'NULL', $char_d,
+        'ship_first',    'varchar', 'NULL', $char_d,
+        'ship_company',  'varchar', 'NULL', $char_d,
+        'ship_address1', 'varchar', 'NULL', $char_d,
+        'ship_address2', 'varchar', 'NULL', $char_d,
+        'ship_city',     'varchar', 'NULL', $char_d,
+        'ship_county',   'varchar', 'NULL', $char_d,
+        'ship_state',    'varchar', 'NULL', $char_d,
+        'ship_zip',      'varchar', 'NULL', 10,
+        'ship_country',  'char', 'NULL', 2,
+        'ship_daytime',  'varchar', 'NULL', 20,
+        'ship_night',    'varchar', 'NULL', 20,
+        'ship_fax',      'varchar', 'NULL', 12,
         'payby',    'char', '',     4,
         'payinfo',  'varchar', 'NULL', 16,
         #'paydate',  @date_type,
@@ -460,6 +501,7 @@ sub tables_hash_hack {
         'tax',      'char', 'NULL', 1,
         'otaker',   'varchar', '',     8,
         'refnum',   'int',  '',     '',
+        'comments', 'varchar', 'NULL', '',
       ],
       'primary_key' => 'custnum',
       'unique' => [ [] ],