From 0186436eb38e70da0a015e49dab67cec5f1a3467 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 21 Sep 2005 12:49:51 +0000 Subject: [PATCH] add prepaid support which sets RADIUS Expiration attribute, update customer view package UI --- FS/FS/Conf.pm | 7 + FS/FS/Record.pm | 43 ++++- FS/FS/svc_acct.pm | 29 +++- FS/MANIFEST | 1 + FS/bin/freeside-daily | 13 ++ FS/bin/freeside-prepaidd | 75 +++++++++ httemplate/edit/REAL_cust_pkg.cgi | 162 +++++++++++------- httemplate/view/cust_main/packages.html | 280 ++++++++++++++++++++++---------- init.d/freeside-init | 12 +- 9 files changed, 459 insertions(+), 163 deletions(-) create mode 100644 FS/bin/freeside-prepaidd diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 463d0b49e..37d649bf9 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -1562,6 +1562,13 @@ httemplate/docs/config.html ], }, + { + 'key' => 'cust_pkg-display_times', + 'section' => 'UI', + 'description' => 'Display full timestamps (not just dates) for customer packages. Useful if you are doing real-time things like hourly prepaid.', + 'type' => 'checkbox', + }, + ); 1; diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 9cff57936..d84365804 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -185,13 +185,36 @@ sub create { } } -=item qsearch TABLE, HASHREF, SELECT, EXTRA_SQL, CACHE_OBJ, ADDL_FROM +=item qsearch PARAMS_HASHREF | TABLE, HASHREF, SELECT, EXTRA_SQL, CACHE_OBJ, ADDL_FROM Searches the database for all records matching (at least) the key/value pairs in HASHREF. Returns all the records found as `FS::TABLE' objects if that module is loaded (i.e. via `use FS::cust_main;'), otherwise returns FS::Record objects. +The preferred usage is to pass a hash reference of named parameters: + + my @records = qsearch( { + 'table' => 'table_name', + 'hashref' => { 'field' => 'value' + 'field' => { 'op' => '<', + 'value' => '420', + }, + }, + + #these are optional... + 'select' => '*', + 'extra_sql' => 'AND field ', + #'cache_obj' => '', #optional + 'addl_from' => 'LEFT JOIN othtable USING ( field )', + } + ); + +Much code still uses old-style positional parameters, this is also probably +fine in the common case where there are only two parameters: + + my @records = qsearch( 'table', { 'field' => 'value' } ); + ###oops, argh, FS::Record::new only lets us create database fields. #Normal behaviour if SELECT is not specified is `*', as in #C!; +%> + +
+ + +<% if ( $error ) { %> + Error: <%= $error %> +<% } %> -print qq!Error: $error! - if $error; +<% #my $format = "%c %z (%Z)"; my $format = "%m/%d/%Y %T %z (%Z)"; -print ntable("#cccccc",2), - 'Package number', - $pkgnum, '', - 'Package', - $pkg, '', - 'Comment', - $comment, '', - 'Order taker', - $otaker, '', - 'Setup date'. - ''. - ' '. - ''; - -print 'Last bill date', - ''. - ' '. - '' - if $cust_pkg->dbdef_table->column('last_bill'); - -print 'Next bill date', - ''. - ' '. - ''; - -print 'Suspension date', - time2str($format, $susp), '' - if $susp; - -#print 'Expiration date', -# time2str("%D",$expire), '' -# if $expire; -print 'Expiration date'. - '', - ''. - ' '. - '
(will cancel this package'. - ' when the date is reached)'. - ''; - -print 'Cancellation date', - time2str($format, $cancel), '' - if $cancel; +#false laziness w/view/cust_main/packages.html +#my( $billed_or_prepaid, +my( $last_bill_or_renewed, $next_bill_or_prepaid_until ); +unless ( $part_pkg->is_prepaid ) { + #$billed_or_prepaid = 'billed'; + $last_bill_or_renewed = 'Last bill'; + $next_bill_or_prepaid_until = 'Next bill'; +} else { + #$billed_or_prepaid = 'prepaid'; + $last_bill_or_renewed = 'Renewed'; + $next_bill_or_prepaid_until = 'Prepaid until'; +} %> + +<%= ntable("#cccccc",2) %> + + + Package number + <%= $pkgnum %> + + + + Package + <%= $pkg %> + + + + Comment + <%= $comment %> + + + + Order taker + <%= $otaker %> + + + + Setup date + + "> + + + + + + <%= $last_bill_or_renewed %> date + + "> + + + + + + <%= $next_bill_or_prepaid_until %> date + + "> + + + + + <% if ( $susp ) { %> + + Suspension date + <%= time2str($format, $susp) %> + + <% } %> + + + Expiration date + + "> + +
(will cancel this package when the date is reached) + + + + <% if ( $cancel ) { %> + + Cancellation date + <%= time2str($format, $cancel) %> + + <% } %> + +