mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-07-13 05:29 am

[dw-free] fix autovivification error in AccountLevel.pm

[commit: http://hg.dwscoalition.org/dw-free/rev/279e0674d6fa]

http://bugs.dwscoalition.org/show_bug.cgi?id=1409

Fix error where someone didn't have a paidstatus row leading to an
autovivification error.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/DW/Setting/Display/AccountLevel.pm
--------------------------------------------------------------------------------
diff -r 653249cfe994 -r 279e0674d6fa cgi-bin/DW/Setting/Display/AccountLevel.pm
--- a/cgi-bin/DW/Setting/Display/AccountLevel.pm	Mon Jul 13 03:34:01 2009 +0000
+++ b/cgi-bin/DW/Setting/Display/AccountLevel.pm	Mon Jul 13 05:28:58 2009 +0000
@@ -48,8 +48,11 @@ sub option {
     my ( $class, $u, $errs, $args ) = @_;
 
     my $paidstatus = DW::Pay::get_paid_status( $u );
-    my $paidtype = "<strong>" . $paidstatus ? DW::Pay::type_name( $paidstatus->{typeid} ) : "" . "</strong>";
-    my $expiretime = LJ::mysql_time( $paidstatus->{expiretime} );
+    my $typeid = $paidstatus ? $paidstatus->{typeid} : DW::Pay::default_typeid();
+    my $expiretime = "(never)";
+
+    my $paidtype = "<strong>" . DW::Pay::type_name( $typeid ) . "</strong>";
+    $expiretime = LJ::mysql_time( $paidstatus->{expiretime} ) if $paidstatus && ! $paidstatus->{permanent};
 
     if ( $paidstatus && $paidstatus->{expiresin} > 0 && ! $paidstatus->{permanent} ) {
         return BML::ml( 'setting.display.accounttype.status', { status => $paidtype, exptime => $expiretime } );
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org