Committer: vtroitsky
LJSUP-11192: Current price not equal Your price: current price showed instead of buyout priceU 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-02-08 14:41:06 UTC (rev 11434) +++ trunk/cgi-bin/LJ/Widget/Shop/View/SelfPromo.pm 2012-02-08 15:43:21 UTC (rev 11435) @@ -47,19 +47,26 @@ my $hide_buyout = 0; my $owner_cancel = 0; - # TODO (refactoring): Move that method into SelfPromo object + # TODO (refactoring): Move that method into SelfPromo object: get_current_promo_object()->price() + # my $current_promo = LJ::Pay::SelfPromo->get_current_promo(type => $type); + # my $data_selfpromo = $current_promo ? $current_promo->get_template_params() : []; + my $data_selfpromo = LJ::PersonalStats->get_selfpromo_data( { 'type' => $type } ); - # TODO (refactoring): encapsulate logic into PromoObject + # TODO (refactoring): encapsulate all thet logic into PromoObject::get_template_params() function my $buyout_cost = $class->buyout_cost; + + my $promo = $class->current_promo_info(); + my $current_price = $promo ? $promo->cost : 0; + ## 12345678 --> 12 345 678 - my $buyout_split = join ' ', grep { $_ } ($buyout_cost =~ /^(.?.?.?)(...)*$/); - my $ml_current_price = LJ::Lang::ml( '/shop/selfpromo.bml.current_price', { 'price' => $buyout_split } ); + my $current_split = join ' ', grep { $_ } ($current_price =~ /^(.?.?.?)(...)*$/); + my $ml_current_price = LJ::Lang::ml( '/shop/selfpromo.bml.current_price', { 'price' => $current_split } ); + foreach my $row (@$data_selfpromo) { # TODO (refactoring): Incapsulate that logic into PromoObject + SelfPromo processor my $promo = $class->current_promo_info( $row->{'promoid'} ); - # TODO (refactoring): Incapsulate that logic inside PromoObject functions $promo->can_withdraw($remote); my $can_withdraw = LJ::u_equals($promo->promoter, $remote) || LJ::u_equals($promo->owner, $remote); @@ -85,6 +92,7 @@ ); } + # TODO END my $elem = { 'type' => $type,