Committer: amyshkin
LJSUP-10748: Free2payU trunk/bin/upgrading/en_LJ.dat U trunk/bin/upgrading/update-db-local.pl U trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm U trunk/templates/Shop/Wallet.tmpl
Modified: trunk/bin/upgrading/en_LJ.dat =================================================================== --- trunk/bin/upgrading/en_LJ.dat 2012-01-16 09:25:57 UTC (rev 11313) +++ trunk/bin/upgrading/en_LJ.dat 2012-01-16 11:31:41 UTC (rev 11314) @@ -13902,3 +13902,8 @@ . esn.event=LiveJournal + +esn.ftp.lower100.subject=On the Freetopay account are left 100 LJ Tokens +esn.ftp.lower100.body=On the Freetopay account are left 100 LJ Tokens +esn.ftp.lower1000.subject=On the Freetopay account are left 1000 LJ Tokens +esn.ftp.lower1000.body=On the Freetopay account are left 1000 LJ Tokens Modified: trunk/bin/upgrading/update-db-local.pl =================================================================== --- trunk/bin/upgrading/update-db-local.pl 2012-01-16 09:25:57 UTC (rev 11313) +++ trunk/bin/upgrading/update-db-local.pl 2012-01-16 11:31:41 UTC (rev 11314) @@ -15,6 +15,19 @@ ) EOC +register_tablecreate("ftp_transactions", <<EOC); +CREATE TABLE `ftp_transactions` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + `date` datetime default NULL, + `state` char(3) NOT NULL default '', + `tokens` int(5) NOT NULL, + `desc` text, + PRIMARY KEY(`id`), + KEY `state_idx` (`state`), + KEY `find_idx` (`name`,`date`) +) +EOC register_tablecreate("paid_invites", <<EOC); CREATE TABLE `paid_invites` ( Modified: trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm =================================================================== --- trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm 2012-01-16 09:25:57 UTC (rev 11313) +++ trunk/cgi-bin/LJ/Widget/Shop/View/Wallet.pm 2012-01-16 11:31:41 UTC (rev 11314) @@ -108,6 +108,9 @@ my $js_complete = LJ::JSUtil::autocomplete(list => \@flist); my $free_tokens_status = __is_free_tokens_enabled(); + # reserved + my $transac_id = 0; + return { 'siteroot' => $LJ::SITEROOT, 'promo_block_for_empty_wallet' => ($balance == 0), @@ -130,26 +133,31 @@ offerpal_url => $LJ::OFFERPAL_URL . $remote->userid, offerpal_disabled => $LJ::DISABLED{'offerpal'}, + + 'sid' => $LJ::FREE_TOKENS->{'freetopay'}->{'sid'}, + 'uid' => $remote ? $remote->id : 0, + 'transac_id' => $transac_id, + 'location' => $remote ? $remote->prop('city') || '' : '', + 'sex' => $remote ? $remote->prop('gender') : '', + 'age' => $remote ? $remote->best_guess_age : 0, }; } sub __is_free_tokens_enabled { - my $u_sapato = LJ::load_user( $LJ::SAPATO_USER ); - if ( !$u_sapato ) { - return 0; - } - - if ( $LJ::DISABLED{'sapato'} ) - { - return 0; - } + my $u_ftp = LJ::load_user( $LJ::FREE_TOKENS->{'freetopay'}->{'account'} ); + return 0 unless $u_ftp; + + my $balance = LJ::Pay::Wallet->get_user_balance( $u_ftp ); + return 0 if $balance < 100; + if (!LJ::SUP->is_remote_sup) { return 0; } - my $balance = LJ::Pay::Wallet->get_user_balance( $u_sapato ); - return ($balance >= 100); + return 1 if $LJ::FREE_TOKENS_ENABLED; + + return 0; } sub _assert_remote_eligible { @@ -223,7 +231,7 @@ LJ::Pay::Wallet::Error->raise(ERROR_UNKNOWN_RCPT, { 'username' => $rcpt_username, }) unless $rcpt; - + LJ::Pay::Wallet::Error->raise(ERROR_RCPT_IS_SELF) if $rcpt==$remote; Modified: trunk/templates/Shop/Wallet.tmpl =================================================================== --- trunk/templates/Shop/Wallet.tmpl 2012-01-16 09:25:57 UTC (rev 11313) +++ trunk/templates/Shop/Wallet.tmpl 2012-01-16 11:31:41 UTC (rev 11314) @@ -36,7 +36,7 @@ <li><a href="<TMPL_VAR self_uri>?show=send"><TMPL_VAR expr="ml('wallet.bml.landing.tab.send')"></a></li> <TMPL_IF free_tokens_enabled> <li class="current"><a href="<TMPL_VAR self_uri>?show=free"><TMPL_VAR expr="ml('wallet.bml.landing.tab.free')"></a></li> - </TMPL_IF> + </TMPL_IF> </TMPL_IF> </ul> @@ -79,6 +79,11 @@ </li> <li class="b-wallet-tokens-item b-wallet-tokens-free<TMPL_IF name='tab_tokens_free'> current</TMPL_IF>"> <form action="<TMPL_VAR self_uri>" method="post"> + sid: <TMPL_VAR sid></br> + uid: <TMPL_VAR uid></br> + sex: <TMPL_VAR sex></br> + age: <TMPL_VAR age></br> + location: <TMPL_VAR location></br> <div class="b-wallet-tokens-sapato"> <a href="http://www.sapato.ru" target="_blank"><img src="/img/sapato.png?v=14198" width="133" height="49" alt="SAPATO" /></a> <p><strong><TMPL_VAR expr="ml('wallet.bml.free.tokens.sapato')"></strong></p>