Committer: vtroitsky
LJSUP-11372: Develop regional self promo for Ukraine. Minor fixes.U trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm
Modified: trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm 2012-04-26 12:34:31 UTC (rev 11817) +++ trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm 2012-04-26 12:40:55 UTC (rev 11818) @@ -75,26 +75,27 @@ my $ml_current_price = LJ::Lang::ml( '/shop/selfpromo.bml.current_price', { 'price' => $current_split } ); # add some stuff (actually 1 element in array) - foreach my $row (@$data_selfpromo) { - $row->{'can_withdraw'} = $promo->can_withdraw($remote); - $hide_buyout = $row->{'can_withdraw'}; - $owner_cancel = $promo->can_cancel( $remote); + if ($promo) { + foreach my $row (@$data_selfpromo) { + $row->{'can_withdraw'} = $promo->can_withdraw($remote); + $hide_buyout = $row->{'can_withdraw'}; + $owner_cancel = $promo->can_cancel( $remote); - # if for some reason the entry has already expired, this silently - # casts its remaining time to zero: - my $remtime = List::Util::max( $promo->stop_time - time, 0 ); - my $remtime_hours = int ( $remtime / 3600 ); - my $remtime_minutes = int ( ( $remtime % 3600 ) / 60 ); - $row->{'ml_remaining'} = LJ::Lang::ml( - '/shop/selfpromo.bml.remaining_time', - { - 'hours' => sprintf( '%02d', $remtime_hours ), - 'minutes' => sprintf( '%02d', $remtime_minutes ), - }, - ); - # $row->{'country_style'} = $result->{'country_style'}; + # if for some reason the entry has already expired, this silently + # casts its remaining time to zero: + my $remtime = List::Util::max( $promo->stop_time - time, 0 ); + my $remtime_hours = int ( $remtime / 3600 ); + my $remtime_minutes = int ( ( $remtime % 3600 ) / 60 ); + $row->{'ml_remaining'} = LJ::Lang::ml( + '/shop/selfpromo.bml.remaining_time', + { + 'hours' => sprintf( '%02d', $remtime_hours ), + 'minutes' => sprintf( '%02d', $remtime_minutes ), + }, + ); + # $row->{'country_style'} = $result->{'country_style'}; + } } - my $elem = { 'type' => $type, 'country' => $active_region,