From: Ivan Kohler Date: Sat, 10 Feb 2018 03:10:00 +0000 (-0800) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=d45dd4a826f314fb5459747590d3e11cd80c211f;hp=-c Merge branch 'master' of git.freeside.biz:/home/git/freeside --- d45dd4a826f314fb5459747590d3e11cd80c211f diff --combined FS/FS/Schema.pm index b2df048c4,65eadad21..edecb7f38 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@@ -495,8 -495,44 +495,44 @@@ sub tables_hashref 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' => { @@@ -1757,7 -1793,8 +1793,8 @@@ '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' ], ], @@@ -5624,6 -5661,9 +5661,6 @@@ '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 @@@ -7598,6 -7638,57 +7635,57 @@@ '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' => { @@@ -7624,4 -7715,3 +7712,3 @@@ L) @@@ -240,6 -240,7 +240,6 @@@ sub table_info 'svcnum' => 'Freeside service', 'freesidestatus' => 'Freeside status', 'freesiderewritestatus' => 'Freeside rewrite status', - 'cdrbatch' => 'Legacy batch', 'cdrbatchnum' => 'Batch', 'detailnum' => 'Freeside invoice detail line', }, @@@ -1658,12 -1659,7 +1658,12 @@@ foreach my $INC ( @INC ) 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; @@@ -1737,6 -1733,14 +1737,14 @@@ sub _cdr_date_parse # 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... } @@@ -1864,6 -1868,41 +1872,6 @@@ sub process_batch_import # @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 @@@ -1901,4 -1940,3 +1909,3 @@@ L, schema.html from the bas =cut 1; - diff --combined httemplate/elements/menu.html index 3b3d244db,9b8b2cd1e..eb065b668 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@@ -418,6 -418,8 +418,8 @@@ if( $curuser->access_right('Financial r $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' ]; @@@ -516,9 -518,8 +518,9 @@@ tie my %tools_importing, 'Tie::IxHash' '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', '' ], @@@ -835,6 -836,11 +837,11 @@@ $config_misc{'Inventory classes and inv || $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'); @@@ -1039,4 -1045,3 +1046,3 @@@ sub submenu } -