kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2011-08-22 07:04 pm

[dw-free] Option for admin tool to email when adding paid time

[commit: http://hg.dwscoalition.org/dw-free/rev/6c0f33d1e44b]

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

Add a checkbox for emailing the user when paid time is applied by an admin.

Patch by [staff profile] denise.

Files modified:
  • bin/upgrading/en.dat
  • htdocs/admin/pay/index.bml
--------------------------------------------------------------------------------
diff -r c645c0d26223 -r 6c0f33d1e44b bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Mon Aug 22 13:44:36 2011 -0500
+++ b/bin/upgrading/en.dat	Mon Aug 22 14:04:50 2011 -0500
@@ -3055,6 +3055,21 @@
 
 shop.email.acct.subject=[[sitename]] Account Purchase
 
+shop.email.admin.subject=[[sitename]] Account Upgrade
+
+shop.email.admin.body<<
+Dear [[touser]],
+
+A [[sitename]] admin has added paid time to your account. The type of account and amount of time added is:
+
+   [[type]] for [[nummonths]] [[?nummonths|month|months]] [[numdays]] [[?numdays|day|days]]
+
+If you have any questions about this upgrade, you can reply to this email.
+
+Regards,
+The [[sitename]] Team
+.
+
 shop.email.comm.anon=Someone has chosen to upgrade your [[sitename]] community [[commname]].
 
 shop.email.comm.close=Congratulations on your community's paid time!
diff -r c645c0d26223 -r 6c0f33d1e44b htdocs/admin/pay/index.bml
--- a/htdocs/admin/pay/index.bml	Mon Aug 22 13:44:36 2011 -0500
+++ b/htdocs/admin/pay/index.bml	Mon Aug 22 14:04:50 2011 -0500
@@ -56,6 +56,23 @@
                 if ( $rv ) {
                     LJ::statushistory_add( $u, $remote, 'paidstatus',
                                            "Admin override: gave paid time to user: months=$months days=$days type=$type" );
+                    LJ::send_mail( {
+                                to => $u->email_raw,
+                                from => $LJ::ACCOUNTS_EMAIL,
+                                fromname => $LJ::SITENAME,
+                                subject => LJ::Lang::ml(
+                                 'shop.email.admin.subject', {
+                                   sitename => $LJ::SITENAME } ),
+                                body => LJ::Lang::ml(
+                                 'shop.email.admin.body', {
+                                   touser => $u->display_name,
+                                   type => $type,
+                                   nummonths => $months,
+                                   numdays => $days,
+                                   sitename => $LJ::SITENAME,
+                                } ),
+                    } ) if $POST{sendemail};
+
                     return BML::redirect( "$LJ::SITEROOT/admin/pay/index?view=$u->{user}" );
                 }
             }
@@ -125,6 +142,7 @@
         for <input type="text" name="months" maxlength="2" size="3" /> months, 
         <input type="text" name="days" maxlength="2" size="3" /> days
 </td>
+        <td><input type="checkbox" name="sendemail">Email?</td>
 <td><input type="submit" name="submit" value="Give!" /></td></tr>
 $body_date
 </table>
--------------------------------------------------------------------------------