RT#39586 Manual check refunds cannot be unapplied [source_paynum field, reason bug...
[freeside.git] / FS / FS / Schema.pm
index f1c4e08..ff6a924 100644 (file)
@@ -3061,6 +3061,7 @@ sub tables_hashref {
        'paymask', 'varchar', 'NULL', $char_d, '', '', 
         'paybatch',     'varchar',   'NULL', $char_d, '', '', 
         'closed',    'char', 'NULL', 1, '', '', 
+        'source_paynum', 'int', 'NULL', '', '', '', # link to cust_payby, to prevent unapply of gateway-generated refunds
         # credit card/EFT fields (formerly in paybatch)
         'gatewaynum',     'int', 'NULL', '', '', '', # payment_gateway FK
         'processor',  'varchar', 'NULL', $char_d, '', '', # module name
@@ -3083,6 +3084,10 @@ sub tables_hashref {
                           { columns    => [ 'gatewaynum' ],
                             table      => 'payment_gateway',
                           },
+                          { columns    => [ 'source_paynum' ],
+                            table      => 'cust_pay',
+                            references => [ 'paynum' ],
+                          },
                         ],
     },
 
@@ -5775,10 +5780,11 @@ sub tables_hashref {
 
     'access_user_log' => {
       'columns'      => [
-        'lognum',  'serial', '',        '', '', '',
-        'usernum',    'int', '',        '', '', '',
-        'path',   'varchar', '', 2*$char_d, '', '',
-        '_date',         @date_type,        '', '',
+        'lognum',          'serial',     '',        '', '', '',
+        'usernum',            'int',     '',        '', '', '',
+        'path',           'varchar',     '', 2*$char_d, '', '',
+        '_date',                   @date_type,          '', '',
+        'render_seconds',     'int', 'NULL',        '', '', '',
       ],
       'primary_key'  => 'lognum',
       'unique'       => [],