From 89da4b96c4e2fce7079be8d2729750c088f8035b Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 6 Aug 2010 21:31:04 +0000 Subject: communigate phase 3: archive messages, RT#7515 --- FS/FS/part_export/communigate_pro.pm | 10 +- FS/FS/svc_acct.pm | 24 +- httemplate/edit/part_svc.cgi | 8 +- httemplate/edit/svc_acct.cgi | 222 +---------------- httemplate/edit/svc_acct/communigate.html | 249 +++++++++++++++++++ httemplate/edit/svc_domain.cgi | 272 +-------------------- .../edit/svc_domain/communigate-acct_defaults.html | 223 +++++++++++++++++ httemplate/edit/svc_domain/communigate-basics.html | 82 +++++++ httemplate/view/svc_acct/communigate.html | 8 + httemplate/view/svc_domain/acct_defaults.html | 8 + 10 files changed, 613 insertions(+), 493 deletions(-) create mode 100644 httemplate/edit/svc_acct/communigate.html create mode 100644 httemplate/edit/svc_domain/communigate-acct_defaults.html create mode 100644 httemplate/edit/svc_domain/communigate-basics.html diff --git a/FS/FS/part_export/communigate_pro.pm b/FS/FS/part_export/communigate_pro.pm index 2cad24467..3e1213e84 100644 --- a/FS/FS/part_export/communigate_pro.pm +++ b/FS/FS/part_export/communigate_pro.pm @@ -85,10 +85,12 @@ sub _export_insert_svc_acct { 'MailToAll' =>($svc_acct->cgp_mailtoall ?'YES':'NO'), 'AddMailTrailer' =>($svc_acct->cgp_addmailtrailer ?'YES':'NO'), + 'ArchiveMessagesAfter' => $svc_acct->cgp_archiveafter, + map { $quotas{$_} => $svc_acct->$_() } grep $svc_acct->$_(), keys %quotas ); - #XXX phase 3: archive messages, mailing lists + #XXX phase 3: mailing lists my @options = ( 'CreateAccount', 'accountName' => $self->export_username($svc_acct), @@ -194,6 +196,7 @@ sub _export_insert_svc_domain { 'RPOPAllowed' =>($svc_domain->acct_def_cgp_rpopallowed ?'YES':'NO'), 'MailToAll' =>($svc_domain->acct_def_cgp_mailtoall ?'YES':'NO'), 'AddMailTrailer' =>($svc_domain->acct_def_cgp_addmailtrailer ?'YES':'NO'), + 'ArchiveMessagesAfter' => $svc_domain->acct_def_cgp_archiveafter, ); warn "WARNING: error queueing SetAccountDefaults job: $def_err" if $def_err; @@ -318,8 +321,10 @@ sub _export_replace_svc_acct { if $old->cgp_mailtoall ne $new->cgp_mailtoall; $settings{'AddMailTrailer'} = ( $new->cgp_addmailtrailer ? 'YES':'NO' ) if $old->cgp_addmailtrailer ne $new->cgp_addmailtrailer; + $settings{'ArchiveMessagesAfter'} = $new->cgp_archiveafter + if $old->cgp_archiveafter ne $new->cgp_archiveafter; - #XXX phase 3: archive messages, mailing lists + #XXX phase 3: mailing lists if ( keys %settings ) { my $error = $self->communigate_pro_queue( @@ -441,6 +446,7 @@ sub _export_replace_svc_domain { 'RPOPAllowed' => ( $new->acct_def_cgp_rpopallowed ? 'YES' : 'NO' ), 'MailToAll' => ( $new->acct_def_cgp_mailtoall ? 'YES' : 'NO' ), 'AddMailTrailer' => ( $new->acct_def_cgp_addmailtrailer ? 'YES' : 'NO' ), + 'ArchiveMessagesAfter' => $new->acct_def_cgp_archiveafter, ); warn "WARNING: error queueing SetAccountDefaults job: $def_err" if $def_err; diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 707b33a6f..801c46533 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -444,19 +444,19 @@ sub table_info { label => 'Archive messages after', type => 'select', select_hash => [ - -2 => 'default(730 day(s))', + -2 => 'default(730 days)', 0 => 'Never', - 86400 => '24 hour(s)', - 172800 => '2 day(s)', - 259200 => '3 day(s)', - 432000 => '5 day(s)', - 604800 => '7 day(s)', - 1209600 => '2 week(s)', - 2592000 => '30 day(s)', - 7776000 => '90 day(s)', - 15552000 => '180 day(s)', - 31536000 => '365 day(s)', - 63072000 => '730 day(s)', + 86400 => '24 hours', + 172800 => '2 days', + 259200 => '3 days', + 432000 => '5 days', + 604800 => '7 days', + 1209600 => '2 weeks', + 2592000 => '30 days', + 7776000 => '90 days', + 15552000 => '180 days', + 31536000 => '365 days', + 63072000 => '730 days', ], disable_inventory => 1, disable_select => 1, diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi index 7f2e3aa3c..940ea8d25 100755 --- a/httemplate/edit/part_svc.cgi +++ b/httemplate/edit/part_svc.cgi @@ -298,10 +298,10 @@ that field. % $item. ''; % } #next $item % } elsif ( $def->{select_hash} ) { -% $def->{select_hash} = tie %{ $def->{select_hash} }, -% 'Tie::IxHash', -% @{ $def->{select_hash} } -% if ref($def->{select_hash}) eq 'ARRAY'; +% if ( ref($def->{select_hash}) eq 'ARRAY' ) { +% tie my %hash, 'Tie::IxHash', @{ $def->{select_hash} }; +% $def->{select_hash} = \%hash; +% } % foreach my $key ( keys %{$def->{select_hash}} ) { % $html .= qq!