Henry Lyne (henrylyne) wrote in changelog,
Henry Lyne
henrylyne
changelog

[ljcom] r7379: LJSUP-4428: Add new hook for checking re...

Committer: henrylyne
LJSUP-4428: Add new hook for checking required fields.

U   trunk/cgi-bin/LJ/Hooks/SMS.pm
Modified: trunk/cgi-bin/LJ/Hooks/SMS.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/SMS.pm	2009-06-10 09:03:12 UTC (rev 7378)
+++ trunk/cgi-bin/LJ/Hooks/SMS.pm	2009-06-11 12:08:52 UTC (rev 7379)
@@ -399,10 +399,6 @@
         }
     }
 
-    if ($POST{msisdn} && !$POST{sms_tos}) {
-        push @$errorsref, "Please agree to the terms and conditions.";
-    }
-
     # if they have no num, clear yes_means
     clear_yes_means($u) unless $u->sms_mapped_number;
 });
@@ -529,4 +525,20 @@
     LJ::SMS::Promo->apply_all_valid($u);
 });
 
+LJ::register_hook('sms_bml_post_check', sub {
+    my %opts = @_;
+
+    my $u         = delete $opts{u} or croak "No user";
+    my $errorsref = delete $opts{errors};
+    my $postref   = delete $opts{POST} or croak "No POST data";
+
+    my %POST = %$postref;
+
+    if ($POST{msisdn} && !$POST{sms_tos}) {
+        push @$errorsref, "Please agree to the terms and conditions.";
+        return;
+    }
+
+});
+
 1;

Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments