make the cart need_logon() method work
authorTony Cook <tony@develop-help.com>
Sat, 21 Dec 2019 05:34:17 +0000 (16:34 +1100)
committerTony Cook <tony@develop-help.com>
Sat, 21 Dec 2019 05:34:17 +0000 (16:34 +1100)
site/cgi-bin/modules/BSE/Cart.pm

index a2c69b3f69f7519f2c1a1af267118a985a04ae2b..8c1c6c810d55c4aa95c8eb0d150916d201e0a739 100644 (file)
@@ -711,17 +711,17 @@ sub _need_logon {
       if (grep $_->forSale, @files) {
        $self->{logon_reason} =
          [ "register before checkout", "shop/fileitems" ];
-       return;
+       return 1;
       }
       if ($prod->{subscription_id} != -1) {
        $self->{logon_reason} =
          [ "you must be logged in to purchase a subscription", "shop/buysub" ];
-       return;
+       return 1;
       }
       if ($prod->{subscription_required} != -1) {
        $self->{logon_reason} = 
          [ "must be logged in to purchase a product requiring a subscription", "shop/subrequired" ];
-       return;
+       return 1;
       }
     }
   }
@@ -730,7 +730,7 @@ sub _need_logon {
   if (!$user && $require_logon) {
     $self->{logon_reason} =
       [ "register before checkout", "shop/logonrequired" ];
-    return;
+    return 1;
   }
 
   # check the user has the right required subs
@@ -741,7 +741,7 @@ sub _need_logon {
       if ($sub && !$user->subscribed_to($sub)) {
        $self->{logon_reason} =
          [ "you must be subscribed to $sub->{title} to purchase one of these products", "shop/subrequired" ];
-       return;
+       return 1;
       }
 
       $sub = $prod->subscription;
@@ -756,13 +756,13 @@ sub _need_logon {
        if ($user->subscribed_to_grace($sub)) {
          $self->{logon_reason} =
            [ "you must not be subscribed to $sub->{title} already to use this new subscription only product", "sub/newsubonly" ];
-         return;
+         return 1;
        }
       }
     }
   }
   
-  return;
+  return 0;
 }
 
 sub _product {