my $username_len = 64; #usernamemax config file
- # name type nullability length default local
+ # Return a hashref defining the entire application database schema
+ # Each key of the hashref contains a structure describing a database table
+ #
+ # table_name => {
+ # columns => [...],
+ # primary_key => 'column',
+ # unique => [column,column,...],
+ # index => [[column],[column,column],...],
+ # foreign_keys => [{...},{...},...],
+ # }
+ #
+ #
+ # columns => [
+ #
+ # 'column_name',
+ #
+ # 'column_type',
+ #
+ # 'NULL' or '', # 'NULL' : Allow null values
+ # # '' : Disallow null values
+ #
+ # 'length', # Column size value. eg:
+ # # 40 : VARCHAR(40)
+ # # '10,2' : FLOAT(10,2)
+ #
+ # 'default', # Default column value for a new record
+ # # (Unclear if setting this to '' results in a default
+ # # value of NULL or empty string?)
+ #
+ # '', # local ?
+ #
+ # name, type, nullability, length, default, local,
+ # name, type, nullability, length, default, local,
+ # ...
+ #
+ # ],
+ # name type nullability length default local
return {
'agent' => {
'classnum', 'int', 'NULL', '', '', '',
'comment', 'varchar', 'NULL', 255, '', '',
'selfservice_access', 'char', 'NULL', 1, '', '',
- 'invoice_dest', 'char', 'NULL', 1, '', '',
+ 'invoice_dest', 'char', 'NULL', 1, '', '', # Y or NULL
+ 'message_dest', 'char', 'NULL', 1, '', '', # Y or NULL
],
'primary_key' => 'custcontactnum',
'unique' => [ [ 'custnum', 'contactnum' ], ],
'sessionnum', 'int', 'NULL', '', '', '',
'subscriber', 'varchar', 'NULL', $char_d, '', '',
- #old
- 'cdrbatch', 'varchar', 'NULL', 255, '', '',
- #new
'cdrbatchnum', 'int', 'NULL', '', '', '',
# FK to cust_bill_pkg_detail; having a value here absolutely means
'foreign_keys' => [],
},
+ 'realestate_unit' => {
+ 'columns' => [
+ 'realestatenum', 'serial', '', '', '', '',
+ 'realestatelocnum', 'int', '', '', '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'unit_title', 'varchar', '', $char_d, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ 'primary_key' => 'realestatenum',
+ 'unique' => [ ['unit_title'] ],
+ 'index' => [
+ ['agentnum'],
+ ['realestatelocnum'],
+ ['disabled'],
+ ['unit_title'],
+ ],
+ 'foreign_keys' => [
+ {columns => ['agentnum'], table => 'agent'},
+ {columns => ['realestatelocnum'] => table => 'realestate_location'},
+ ],
+ },
+
+ realestate_location => {
+ 'columns' => [
+ 'realestatelocnum', 'serial', '', '', '', '',
+ 'agentnum', 'int', 'NULL', '', '', '',
+ 'location_title', 'varchar', '', $char_d, '', '',
+ 'address1', 'varchar', 'NULL', $char_d, '', '',
+ 'address2', 'varchar', 'NULL', $char_d, '', '',
+ 'city', 'varchar', 'NULL', $char_d, '', '',
+ 'state', 'varchar', 'NULL', $char_d, '', '',
+ 'zip', 'char', 'NULL', 5, '', '',
+ 'disabled', 'char', 'NULL', 1, '', '',
+ ],
+ primary_key => 'realestatelocnum',
+ 'unique' => [ ['location_title'] ],
+ 'index' => [ ['agentnum'], ['disabled'] ],
+ 'foreign_keys' => [
+ {columns => ['agentnum'], table => 'agent'},
+ ],
+ },
+
+ svc_realestate => {
+ columns => [
+ 'svcnum', 'serial', '', '', '', '',
+ 'realestatenum', 'int', 'NULL', '', '', '',
+ ],
+ primary_key => 'svcnum',
+ index => [],
+ },
+
# name type nullability length default local
#'new_table' => {
=cut
1;
-
=item freesiderewritestatus - NULL, done, skipped
-=item cdrbatch
+=item cdrbatchnum
=item detailnum - Link to invoice detail (L<FS::cust_bill_pkg_detail>)
'svcnum' => 'Freeside service',
'freesidestatus' => 'Freeside status',
'freesiderewritestatus' => 'Freeside rewrite status',
- 'cdrbatch' => 'Legacy batch',
'cdrbatchnum' => 'Batch',
'detailnum' => 'Freeside invoice detail line',
},
tie my %import_formats, 'Tie::IxHash',
map { $_ => $cdr_info{$_}->{'name'} }
- sort { $cdr_info{$a}->{'weight'} <=> $cdr_info{$b}->{'weight'} }
+
+ #this is not doing anything useful anymore
+ #sort { $cdr_info{$a}->{'weight'} <=> $cdr_info{$b}->{'weight'} }
+ #so just sort alpha
+ sort { lc($cdr_info{$a}->{'name'}) cmp lc($cdr_info{$b}->{'name'}) }
+
grep { exists($cdr_info{$_}->{'import_fields'}) }
keys %cdr_info;
# Telos 2014-10-10T05:30:33Z
($year, $mon, $day, $hour, $min, $sec) = ( $1, $2, $3, $4, $5, $6 );
$options{gmt} = 1;
+ } elsif ( $date =~ /^(\d+):(\d+):(\d+)\.\d+ \w+ (\w+) (\d+) (\d+)$/ ) {
+ ($hour, $min, $sec, $mon, $day, $year) = ( $1, $2, $3, $4, $5, $6 );
+ $mon = { # Acme Packet: 15:54:56.868 PST DEC 18 2017
+ # My best guess of month abbv they may use
+ JAN => '01', FEB => '02', MAR => '03', APR => '04',
+ MAY => '05', JUN => '06', JUL => '07', AUG => '08',
+ SEP => '09', OCT => '10', NOV => '11', DEC => '12'
+ }->{$mon};
} else {
die "unparsable date: $date"; #maybe we shouldn't die...
}
# @columns = map { s/^ +//; $_; } @columns;
# }
-# _ upgrade_data
-#
-# Used by FS::Upgrade to migrate to a new database.
-
-sub _upgrade_data {
- my ($class, %opts) = @_;
-
- warn "$me upgrading $class\n" if $DEBUG;
-
- my $sth = dbh->prepare(
- 'SELECT DISTINCT(cdrbatch) FROM cdr WHERE cdrbatch IS NOT NULL'
- ) or die dbh->errstr;
-
- $sth->execute or die $sth->errstr;
-
- my %cdrbatchnum = ();
- while (my $row = $sth->fetchrow_arrayref) {
-
- my $cdr_batch = qsearchs( 'cdr_batch', { 'cdrbatch' => $row->[0] } );
- unless ( $cdr_batch ) {
- $cdr_batch = new FS::cdr_batch { 'cdrbatch' => $row->[0] };
- my $error = $cdr_batch->insert;
- die $error if $error;
- }
-
- $cdrbatchnum{$row->[0]} = $cdr_batch->cdrbatchnum;
- }
-
- $sth = dbh->prepare('UPDATE cdr SET cdrbatch = NULL, cdrbatchnum = ? WHERE cdrbatch IS NOT NULL AND cdrbatch = ?') or die dbh->errstr;
-
- foreach my $cdrbatch (keys %cdrbatchnum) {
- $sth->execute($cdrbatchnum{$cdrbatch}, $cdrbatch) or die $sth->errstr;
- }
-
-}
=item ip_addr_sql FIELD RANGE
=cut
1;
-
$report_financial{'Customer Accounting Summary'} = [ $fsurl.'search/report_customer_accounting_summary.html', 'Customer accounting summary report' ];
+ $report_financial{'Upcoming Auto-Bill Transactions'} = [ $fsurl.'search/report_future_autobill.html', 'Upcoming auto-bill transactions' ];
+
} elsif($curuser->access_right('Receivables report')) {
$report_financial{'A/R Aging'} = [ $fsurl.'search/report_receivables.html', 'Accounts Receivable Aging report' ];
'Customers' => [ $fsurl.'misc/cust_main-import.cgi', '' ],
'Package definitions' => [ $fsurl.'misc/part_pkg-import.html', '' ],
'Customer packages' => [ $fsurl.'misc/cust_pkg-import.html', '' ],
+# 'Customer broadband services' => [ $fsurl.'misc/svc_broadband-import.html', '' ],
'Customer notes' => [ $fsurl.'misc/cust_main_note-import.html', '' ],
- 'Customer Contacts' => [ $fsurl.'misc/contact-import.cgi', '' ],
+ 'Customer contacts' => [ $fsurl.'misc/contact-import.cgi', '' ],
'One-time charges' => [ $fsurl.'misc/cust_main-import_charges.cgi', '' ],
'Payments' => [ $fsurl.'misc/cust_pay-import.cgi', '' ],
'Credits' => [ $fsurl.'misc/cust_credit-import.html', '' ],
|| $curuser->access_right('Edit global inventory')
|| $curuser->access_right('Configuration');
+ $config_misc{'Real estate inventory'} = [ $fsurl.'browse/realestate_unit.html', 'Setup real estate inventory' ]
+ if $curuser->access_right('Edit realestate inventory')
+ || $curuser->access_right('Edit global inventory')
+ || $curuser->access_right('Configuration');
+
$config_misc{'Upload targets'} = [ $fsurl.'browse/upload_target.html', 'Billing and payment upload destinations' ]
if $curuser->access_right('Configuration');
}
</%init>
-