Luca Parisio 1 år sedan
förälder
incheckning
c8dd1f1690
2 ändrade filer med 15 tillägg och 7 borttagningar
  1. 11 7
      app/Http/Livewire/CourseList.php
  2. 4 0
      app/Http/Livewire/RecordIN.php

+ 11 - 7
app/Http/Livewire/CourseList.php

@@ -271,17 +271,21 @@ class CourseList extends Component
 
     public function newPayment($course_id, $months, $member_id, $id, $subscription)
     {
+        
         $newMonths = array();
-        $mm = explode(",", $months);
-        foreach($mm as $month)
+        if ($months != '')
         {
-            if ($month < 5) $month += 12;
-            if ($month >= 5) $month -= 4;
-            $newMonths[] = $month;
+            $mm = explode(",", $months);        
+            foreach($mm as $month)
+            {
+                if ($month < 5) $month += 12;
+                if ($month >= 5) $month -= 4;
+                $newMonths[] = $month;
+            }
         }
-
+        
         $c = \App\Models\Course::findOrFail($course_id);
-        return redirect()->to('/in?new=1&memberId=' . $member_id . '&causalId=' . $c->causal_id . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . ($subscription ? 1 : 0) . '&months=' . implode("|", $newMonths) . '&price=' . $c->price . '&subscription_price=' . $c->subscription_price . "&courseId=" . $id);
+        return redirect()->to('/in?new=1&memberId=' . $member_id . (sizeof($newMonths) > 0 ? '&causalId=' . $c->causal_id : '') . '&subCausalId=' . $c->sub_causal_id . '&createSubscription=' . ($subscription ? 1 : 0) . (sizeof($newMonths) > 0 ? '&months=' . implode("|", $newMonths) : '') . (sizeof($newMonths) > 0 ? '&price=' . $c->price : '') . '&subscription_price=' . $c->subscription_price . "&courseId=" . $id);
 
     }
     /*

+ 4 - 0
app/Http/Livewire/RecordIN.php

@@ -376,7 +376,10 @@ class RecordIN extends Component
                 }
                 $this->rows[0]["note"] = $desc;
                 $count += 1;
+
             }
+
+            
             if (isset($_GET["createSubscription"]) && $_GET["createSubscription"] == 1)
             {
 
@@ -395,6 +398,7 @@ class RecordIN extends Component
                     $this->rows[$count]["causal_id"] = $_GET["subCausalId"];
                 }
             }
+            
         }
         $this->first = false;