[ljcom] r10945: LJSV-1763. Userhead resets when another,...

Committer: gprochaev
LJSV-1763. Userhead resets when another, unused custom userhead expires

U   trunk/cgi-bin/LJ/Pay/Payment/PayItem/UserHead.pm
Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem/UserHead.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem/UserHead.pm	2011-08-31 06:33:46 UTC (rev 10944)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem/UserHead.pm	2011-08-31 08:30:49 UTC (rev 10945)
@@ -117,7 +117,12 @@
     my $u = LJ::load_userid($args{u});
     return undef unless $u;
 
-    $u->set_custom_usericon (undef);
+    my $subitem = $self->{subitem};
+    my ($uh_id) = $subitem =~ m#uh-(\d+)#;
+    my $uh = LJ::UserHead->get_userhead ($uh_id);
+    if ($uh && ($uh->get_uh_img eq $u->custom_usericon)) {
+        $u->set_custom_usericon (undef);
+    }
     
     # Drop this item from the list
     my $dbh = _get_dbh();