add part_referral external ID for API signups, #39776
authorMark Wells <mark@freeside.biz>
Thu, 6 Oct 2016 23:26:08 +0000 (16:26 -0700)
committerMark Wells <mark@freeside.biz>
Thu, 6 Oct 2016 23:26:08 +0000 (16:26 -0700)
FS/FS/Schema.pm
FS/FS/part_referral.pm
httemplate/edit/part_referral.html

index cd8213a..2acbe3d 100644 (file)
@@ -2445,11 +2445,12 @@ sub tables_hashref {
         'refnum',   'serial',     '',        '', '', '', 
         'referral', 'varchar',    '',   $char_d, '', '', 
         'disabled', 'char',   'NULL',         1, '', '', 
         'refnum',   'serial',     '',        '', '', '', 
         'referral', 'varchar',    '',   $char_d, '', '', 
         'disabled', 'char',   'NULL',         1, '', '', 
-        'agentnum', 'int',    'NULL',        '', '', '', 
+        'agentnum', 'int',    'NULL',        '', '', '',
+        'title',   'varchar', 'NULL',   $char_d, '', '', 
       ],
       ],
-      'primary_key' => 'refnum',
-      'unique' => [],
-      'index' => [ ['disabled'], ['agentnum'], ],
+      'primary_key'  => 'refnum',
+      'unique'       => [ ['agentnum', 'title'] ],
+      'index'        => [ ['disabled'], ['agentnum'], ],
     },
 
     'part_svc' => {
     },
 
     'part_svc' => {
index 992e1c5..38f9fc1 100644 (file)
@@ -44,6 +44,9 @@ The following fields are currently supported:
 
 =item agentnum - Optional agentnum (see L<FS::agent>)
 
 
 =item agentnum - Optional agentnum (see L<FS::agent>)
 
+=item title - an optional external string that identifies this
+referral source, such as an advertising campaign code.
+
 =back
 
 =head1 NOTE
 =back
 
 =head1 NOTE
@@ -101,6 +104,7 @@ sub check {
     || $self->ut_text('referral')
     || $self->ut_enum('disabled', [ '', 'Y' ] )
     #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
     || $self->ut_text('referral')
     || $self->ut_enum('disabled', [ '', 'Y' ] )
     #|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
+    || $self->ut_textn('title')
     || ( $setup_hack
            ? $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum' )
            : $self->ut_agentnum_acl('agentnum', 'Edit global advertising sources')
     || ( $setup_hack
            ? $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum' )
            : $self->ut_agentnum_acl('agentnum', 'Edit global advertising sources')
index e9fd794..04287d6 100755 (executable)
@@ -3,11 +3,13 @@
                 'table'       => 'part_referral',
                 'fields'      => [ 'referral',
                                    { field=>'agentnum', type=>'select-agent', },
                 'table'       => 'part_referral',
                 'fields'      => [ 'referral',
                                    { field=>'agentnum', type=>'select-agent', },
+                                   'title',
                                    { field=>'disabled', type=>'checkbox', value=>'Y'  } ,
                                  ],
                 'labels'      => { 'refnum'   => 'Ad Source',
                                    'referral' => 'Advertising source',
                                    'agentnum' => 'Agent',
                                    { field=>'disabled', type=>'checkbox', value=>'Y'  } ,
                                  ],
                 'labels'      => { 'refnum'   => 'Ad Source',
                                    'referral' => 'Advertising source',
                                    'agentnum' => 'Agent',
+                                   'title'    => 'External ID',
                                    'disabled' => 'Disabled',
                                  },
                 'viewall_dir' => 'browse',
                                    'disabled' => 'Disabled',
                                  },
                 'viewall_dir' => 'browse',