Changes to add classified reasons for invoice void
[freeside.git] / FS / FS / Schema.pm
index 184c6c9..6b5d658 100644 (file)
@@ -204,6 +204,7 @@ sub dbdef_dist {
            && ( ! /^queue(_arg|_depend|_stat)?$/ || ! $opt->{'queue-no_history'} )
            && ! $tables_hashref_torrus->{$_}
            && ! /^cacti_page$/
+           && ! /^template_image$/
          }
       $dbdef->tables
   ) {
@@ -734,8 +735,9 @@ sub tables_hashref {
 
         #void fields
         'void_date', @date_type, '', '', 
-        'reason',    'varchar',   'NULL', $char_d, '', '', 
-        'void_usernum',   'int', 'NULL', '', '', '',
+        'reason',     'varchar', 'NULL', $char_d, '', '', 
+        'reasonnum',      'int', 'NULL',      '', '', '',
+        'void_usernum',   'int', 'NULL',      '', '', '',
       ],
       'primary_key'  => 'invnum',
       'unique'       => [ [ 'custnum', 'agent_invid' ] ], #agentnum?  huh
@@ -749,6 +751,9 @@ sub tables_hashref {
                           { columns    => [ 'statementnum' ],
                             table      => 'cust_statement', #_void? both?
                           },
+                          { columns    => [ 'reasonnum' ],
+                            table      => 'reason',
+                          },
                           { columns    => [ 'void_usernum' ],
                             table      => 'access_user',
                             references => [ 'usernum' ],
@@ -1196,8 +1201,9 @@ sub tables_hashref {
         'feepart',              'int', 'NULL',      '', '', '',
         #void fields
         'void_date', @date_type, '', '', 
-        'reason',    'varchar',   'NULL', $char_d, '', '', 
-        'void_usernum',   'int', 'NULL', '', '', '',
+        'reason',     'varchar', 'NULL', $char_d, '', '', 
+        'reasonnum',      'int', 'NULL',      '', '', '',
+        'void_usernum',   'int', 'NULL',      '', '', '',
       ],
       'primary_key'  => 'billpkgnum',
       'unique'       => [],
@@ -1208,6 +1214,9 @@ sub tables_hashref {
                           { columns    => [ 'invnum' ],
                             table      => 'cust_bill_void',
                           },
+                          { columns    => [ 'reasonnum' ],
+                            table      => 'reason',
+                          },
                           #pkgnum 0 and -1 are used for special things
                           #{ columns    => [ 'pkgnum' ],
                           #  table      => 'cust_pkg',
@@ -1961,13 +1970,31 @@ sub tables_hashref {
                         ],
     },
 
+    'quotation_pkg_detail' => {
+      'columns' => [
+        'detailnum', 'serial', '', '', '', '', 
+        'billpkgnum', 'int', '', '', '', '',        # actually links to quotationpkgnum
+        'format',  'char', 'NULL', 1, '', '',       # not used for anything
+        'detail',  'varchar', '', 255, '', '',
+      ],
+      'primary_key'  => 'detailnum',
+      'unique'       => [],
+      'index'        => [ [ 'billpkgnum' ] ],
+      'foreign_keys' => [
+                          { columns    => [ 'billpkgnum' ],
+                            table      => 'quotation_pkg',
+                            references => [ 'quotationpkgnum' ],
+                          },
+                        ],
+    },
+
     'quotation_pkg_discount' => {
       'columns' => [
         'quotationpkgdiscountnum', 'serial', '', '', '', '',
         'quotationpkgnum',            'int', '', '', '', '', 
         'discountnum',                'int', '', '', '', '',
-        'setup_amount',        @money_typen,         '', '',
-        'recur_amount',        @money_typen,         '', '',
+        'setuprecur',             'varchar', 'NULL', $char_d, '', '',
+        'amount',              @money_typen, '', '',
         #'end_date',              @date_type,         '', '',
       ],
       'primary_key'  => 'quotationpkgdiscountnum',
@@ -2504,6 +2531,7 @@ sub tables_hashref {
         #void fields
         'void_date',  @date_type,                  '', '', 
         'reason',      'varchar', 'NULL', $char_d, '', '', 
+        'reasonnum',       'int', 'NULL',      '', '', '', 
         'void_usernum',    'int', 'NULL',      '', '', '',
       ],
       'primary_key'  => 'paynum',
@@ -2525,6 +2553,9 @@ sub tables_hashref {
                           { columns    => [ 'gatewaynum' ],
                             table      => 'payment_gateway',
                           },
+                          { columns    => [ 'reasonnum' ],
+                            table      => 'reason',
+                          },
                           { columns    => [ 'void_usernum' ],
                             table      => 'access_user',
                             references => [ 'usernum' ],
@@ -2887,6 +2918,7 @@ sub tables_hashref {
         'otaker',        'varchar', 'NULL',    32, '', '', 
         'usernum',           'int', 'NULL',    '', '', '',
         'disabled',         'char', 'NULL',     1, '', '', 
+        'setuprecur',       'char', 'NULL',     5, '', '',
       ],
       'primary_key'  => 'pkgdiscountnum',
       'unique'       => [],
@@ -4332,6 +4364,7 @@ sub tables_hashref {
         'custnum',        'int', 'NULL',      '', '', '',
         'secure',        'char', 'NULL',       1, '', '',
         'priority',       'int', 'NULL',      '', '', '',
+        'usernum',        'int', 'NULL',      '', '', '',
       ],
       'primary_key'  => 'jobnum',
       'unique'       => [],
@@ -4345,6 +4378,9 @@ sub tables_hashref {
                           { columns    => [ 'custnum' ],
                             table      => 'cust_main',
                           },
+                          { columns    => [ 'usernum' ],
+                            table      => 'access_user',
+                          },
                         ],
     },
 
@@ -6315,8 +6351,11 @@ sub tables_hashref {
         'mime_type', 'varchar',     '', $char_d, '', '',
         'body',         'blob', 'NULL',      '', '', '',
         'disabled',     'char', 'NULL',       1, '', '', 
+          # migrate these to msg_template_email
         'from_addr', 'varchar', 'NULL',     255, '', '',
         'bcc_addr',  'varchar', 'NULL',     255, '', '',
+          # change to not null on v5
+        'msgclass',  'varchar', 'NULL',      16, '', '',
       ],
       'primary_key'  => 'msgnum',
       'unique'       => [ ],
@@ -6328,6 +6367,26 @@ sub tables_hashref {
                         ],
     },
 
+    'msg_template_http' => {
+      'columns' => [
+        'num',          'serial',     '',      '', '', '',
+        'msgnum',          'int',     '',      '', '', '',
+        'prepare_url', 'varchar', 'NULL',     255, '', '',
+        'send_url',    'varchar', 'NULL',     255, '', '',
+        'username',    'varchar', 'NULL', $char_d, '', '',
+        'password',    'varchar', 'NULL', $char_d, '', '',
+        'content',        'text', 'NULL',      '', '', '',
+      ],
+      'primary_key'  => 'num',
+      'unique'       => [ [ 'msgnum' ], ],
+      'index'        => [ ],
+      'foreign_keys' => [
+                          { columns    => [ 'msgnum' ],
+                            table      => 'msg_template',
+                          },
+                        ],
+    },
+
     'template_content' => {
       'columns' => [
         'contentnum', 'serial',     '',      '', '', '',
@@ -6346,6 +6405,19 @@ sub tables_hashref {
                         ],
     },
 
+    'template_image' => {
+      'columns' => [
+        'imgnum',     'serial',     '',      '', '', '',
+        'name',      'varchar',     '', $char_d, '', '',
+        'agentnum',      'int', 'NULL',      '', '', '',
+        'mime_type', 'varchar',     '', $char_d, '', '',
+        'base64',       'text',     '',      '', '', '',
+      ],
+      'primary_key'  => 'imgnum',
+      'unique'       => [ ],
+      'index'        => [ ['name'], ['agentnum'] ],
+    },
+
     'cust_msg' => {
       'columns' => [
         'custmsgnum', 'serial',     '',     '', '', '',
@@ -6359,6 +6431,7 @@ sub tables_hashref {
         'error',     'varchar', 'NULL',    255, '', '',
         'status',    'varchar',     '',$char_d, '', '',
         'msgtype',   'varchar', 'NULL',     16, '', '',
+        'preview',      'text', 'NULL',     '', '', '',
       ],
       'primary_key'  => 'custmsgnum',
       'unique'       => [ ],
@@ -6502,6 +6575,25 @@ sub tables_hashref {
                         ],
     },
 
+    'log_email' => {
+      'columns' => [
+        'logemailnum', 'serial', '', '', '', '',
+        'context', 'varchar', 'NULL', $char_d, '', '',
+        'min_level', 'int',  'NULL', '', '', '',
+        'msgnum', 'int', '',  '', '', '',
+        'to_addr', 'varchar', 'NULL',     255, '', '',
+      ],
+      'primary_key'  => 'logemailnum',
+      'unique'       => [],
+      'index'        => [ ['context'], ['min_level'] ],
+      'foreign_keys' => [
+                          { columns    => [ 'msgnum' ],
+                            table      => 'msg_template',
+                            references => [ 'msgnum' ],
+                          },
+                        ],
+    },
+
     'svc_alarm' => {
       'columns' => [
 #       name               type        null   length   default local
@@ -6996,6 +7088,7 @@ sub tables_hashref {
         'zonenum',        'serial',  '',     '',      '', '',
         'description',    'char',    'NULL', $char_d, '', '',
         'agentnum',       'int',     '',     '',      '', '',
+        'censusyear',     'char',    'NULL', 4,      '', '',
         'dbaname',        'char',    'NULL', $char_d, '', '',
         'zonetype',       'char',    '',     1,       '', '',
         'technology',     'int',     '',     '',      '', '',
@@ -7027,7 +7120,7 @@ sub tables_hashref {
         'blocknum',       'serial',  '',     '',      '', '',
         'zonenum',        'int',     '',     '',      '', '',
         'censusblock',    'char',    '',     15,      '', '',
-        'censusyear',     'char',    '',      4,      '', '',
+        'censusyear',     'char','NULL',      4,      '', '',
       ],
       'primary_key' => 'blocknum',
       'unique' => [],
@@ -7082,6 +7175,37 @@ sub tables_hashref {
                         ],
     },
 
+    'report_batch' => {
+      'columns' => [
+        'reportbatchnum', 'serial',      '',  '', '', '',
+        'reportname',     'varchar',     '', 255, '', '',
+        'agentnum',           'int', 'NULL',  '', '', '',
+        'send_date',     @date_type,              '', '',
+        'sdate',         @date_type,              '', '',
+        'edate',         @date_type,              '', '',
+        'usernum',            'int', 'NULL',  '', '', '',
+        'msgnum',             'int', 'NULL',  '', '', '',
+        # add report params here as necessary
+      ],
+      'primary_key' => 'reportbatchnum',
+      'unique' => [],
+      'index'  => [],
+      'foreign_keys' => [
+                          { columns    => [ 'agentnum' ],
+                            table      => 'agent',
+                            references => [ 'agentnum' ],
+                          },
+                          { columns    => [ 'usernum' ],
+                            table      => 'access_user',
+                            references => [ 'usernum' ],
+                          },
+                          { columns    => [ 'msgnum' ],
+                            table      => 'msg_template',
+                            references => [ 'msgnum' ],
+                          },
+                        ],
+    },
+
     # name type nullability length default local
 
     #'new_table' => {