@@ -62,19 +62,19 @@ discard block |
||
| 62 | 62 | // The select('bills.*') is important here, otherwise Eloquent overrides the |
| 63 | 63 | // Bill model id fields with those of another model, then making the dataset incorrect. |
| 64 | 64 | $query = Bill::select('bills.*'); |
| 65 | - if($charge->is_variable) |
|
| 65 | + if ($charge->is_variable) |
|
| 66 | 66 | { |
| 67 | 67 | return $query->join('fine_bills', 'fine_bills.bill_id', '=', 'bills.id') |
| 68 | 68 | ->where('fine_bills.charge_id', $charge->id) |
| 69 | 69 | ->where('fine_bills.session_id', $session->id); |
| 70 | 70 | } |
| 71 | - if($charge->period_session) |
|
| 71 | + if ($charge->period_session) |
|
| 72 | 72 | { |
| 73 | 73 | return $query->join('session_bills', 'session_bills.bill_id', '=', 'bills.id') |
| 74 | 74 | ->where('session_bills.charge_id', $charge->id) |
| 75 | 75 | ->where('session_bills.session_id', $session->id); |
| 76 | 76 | } |
| 77 | - if($charge->period_round) |
|
| 77 | + if ($charge->period_round) |
|
| 78 | 78 | { |
| 79 | 79 | return $query->join('round_bills', 'round_bills.bill_id', '=', 'bills.id') |
| 80 | 80 | ->where('round_bills.charge_id', $charge->id); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $bill = $this->getQuery($charge, $session)->with('settlement')->find($billId); |
| 99 | 99 | // Return if the bill is not found or the bill is already settled. |
| 100 | - if(!$bill || ($bill->settlement)) |
|
| 100 | + if (!$bill || ($bill->settlement)) |
|
| 101 | 101 | { |
| 102 | 102 | throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 103 | 103 | } |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $bill = $this->getQuery($charge, $session)->with('settlement')->find($billId); |
| 122 | 122 | // Return if the bill is not found or the bill is not settled. |
| 123 | - if(!$bill || !($bill->settlement)) |
|
| 123 | + if (!$bill || !($bill->settlement)) |
|
| 124 | 124 | { |
| 125 | 125 | throw new MessageException(trans('tontine.bill.errors.not_found')); |
| 126 | 126 | } |
| 127 | - if(($bill->settlement->online)) |
|
| 127 | + if (($bill->settlement->online)) |
|
| 128 | 128 | { |
| 129 | 129 | throw new MessageException(trans('tontine.bill.errors.online')); |
| 130 | 130 | } |
@@ -142,13 +142,13 @@ discard block |
||
| 142 | 142 | public function createAllSettlements(Charge $charge, Session $session): void |
| 143 | 143 | { |
| 144 | 144 | $bills = $this->getQuery($charge, $session)->whereDoesntHave('settlement')->get(); |
| 145 | - if($bills->count() === 0) |
|
| 145 | + if ($bills->count() === 0) |
|
| 146 | 146 | { |
| 147 | 147 | return; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | DB::transaction(function() use($bills, $session) { |
| 151 | - foreach($bills as $bill) |
|
| 151 | + foreach ($bills as $bill) |
|
| 152 | 152 | { |
| 153 | 153 | $settlement = new Settlement(); |
| 154 | 154 | $settlement->bill()->associate($bill); |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | ->filter(function($bill) { |
| 175 | 175 | return !$bill->settlement->online; |
| 176 | 176 | }); |
| 177 | - if($bills->count() === 0) |
|
| 177 | + if ($bills->count() === 0) |
|
| 178 | 178 | { |
| 179 | 179 | return; |
| 180 | 180 | } |
| 181 | 181 | DB::transaction(function() use($bills, $session) { |
| 182 | - foreach($bills as $bill) |
|
| 182 | + foreach ($bills as $bill) |
|
| 183 | 183 | { |
| 184 | 184 | $bill->settlement()->where('session_id', $session->id)->delete(); |
| 185 | 185 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function getSettlement(Charge $charge, Session $session): object |
| 196 | 196 | { |
| 197 | - if($charge->is_variable) |
|
| 197 | + if ($charge->is_variable) |
|
| 198 | 198 | { |
| 199 | 199 | return DB::table('settlements') |
| 200 | 200 | ->select(DB::raw('count(*) as total'), DB::raw('sum(bills.amount) as amount')) |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | ->where('fine_bills.charge_id', $charge->id) |
| 205 | 205 | ->first(); |
| 206 | 206 | } |
| 207 | - if($charge->period_session) |
|
| 207 | + if ($charge->period_session) |
|
| 208 | 208 | { |
| 209 | 209 | return DB::table('settlements') |
| 210 | 210 | ->select(DB::raw('count(*) as total'), DB::raw('sum(bills.amount) as amount')) |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | ->where('session_bills.charge_id', $charge->id) |
| 215 | 215 | ->first(); |
| 216 | 216 | } |
| 217 | - if($charge->period_round) |
|
| 217 | + if ($charge->period_round) |
|
| 218 | 218 | { |
| 219 | 219 | return DB::table('settlements') |
| 220 | 220 | ->select(DB::raw('count(*) as total'), DB::raw('sum(bills.amount) as amount')) |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | public function createDeposit(Pool $pool, Session $session, int $receivableId): void |
| 124 | 124 | { |
| 125 | 125 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 126 | - if(!$receivable || $receivable->deposit || !$pool->deposit_fixed) |
|
| 126 | + if (!$receivable || $receivable->deposit || !$pool->deposit_fixed) |
|
| 127 | 127 | { |
| 128 | 128 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 129 | 129 | } |
@@ -147,12 +147,12 @@ discard block |
||
| 147 | 147 | public function saveDepositAmount(Pool $pool, Session $session, int $receivableId, int $amount): void |
| 148 | 148 | { |
| 149 | 149 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 150 | - if(!$receivable || $pool->deposit_fixed) |
|
| 150 | + if (!$receivable || $pool->deposit_fixed) |
|
| 151 | 151 | { |
| 152 | 152 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if($receivable->deposit !== null) |
|
| 155 | + if ($receivable->deposit !== null) |
|
| 156 | 156 | { |
| 157 | 157 | $receivable->deposit->amount = $amount; |
| 158 | 158 | $receivable->deposit->save(); |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | public function deleteDeposit(Pool $pool, Session $session, int $receivableId): void |
| 179 | 179 | { |
| 180 | 180 | $receivable = $this->getReceivable($pool, $session, $receivableId); |
| 181 | - if(!$receivable || !$receivable->deposit) |
|
| 181 | + if (!$receivable || !$receivable->deposit) |
|
| 182 | 182 | { |
| 183 | 183 | throw new MessageException(trans('tontine.subscription.errors.not_found')); |
| 184 | 184 | } |
| 185 | - if(($receivable->deposit->online)) |
|
| 185 | + if (($receivable->deposit->online)) |
|
| 186 | 186 | { |
| 187 | 187 | throw new MessageException(trans('tontine.subscription.errors.online')); |
| 188 | 188 | } |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | public function createAllDeposits(Pool $pool, Session $session): void |
| 201 | 201 | { |
| 202 | 202 | $receivables = $this->getQuery($pool, $session)->whereDoesntHave('deposit')->get(); |
| 203 | - if($receivables->count() === 0) |
|
| 203 | + if ($receivables->count() === 0) |
|
| 204 | 204 | { |
| 205 | 205 | return; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | DB::transaction(function() use($session, $receivables) { |
| 209 | - foreach($receivables as $receivable) |
|
| 209 | + foreach ($receivables as $receivable) |
|
| 210 | 210 | { |
| 211 | 211 | $deposit = new Deposit(); |
| 212 | 212 | $deposit->receivable()->associate($receivable); |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | public function deleteAllDeposits(Pool $pool, Session $session): void |
| 228 | 228 | { |
| 229 | 229 | $receivables = $this->getQuery($pool, $session)->whereHas('deposit')->get(); |
| 230 | - if($receivables->count() === 0) |
|
| 230 | + if ($receivables->count() === 0) |
|
| 231 | 231 | { |
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | DB::transaction(function() use($session, $receivables) { |
| 236 | - foreach($receivables as $receivable) |
|
| 236 | + foreach ($receivables as $receivable) |
|
| 237 | 237 | { |
| 238 | 238 | $receivable->deposit()->where('session_id', $session->id)->delete(); |
| 239 | 239 | } |
@@ -35,12 +35,11 @@ |
||
| 35 | 35 | { |
| 36 | 36 | $icon = '<i class="fa fa-toggle-off"></i>'; |
| 37 | 37 | $linkClass = "btn-add-$name"; |
| 38 | - if(($payment)) |
|
| 38 | + if (($payment)) |
|
| 39 | 39 | { |
| 40 | 40 | $icon = '<i class="fa fa-toggle-on"></i>'; |
| 41 | 41 | $linkClass = "btn-del-$name"; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - return $disableLink ? $icon : |
|
| 45 | - '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>'; |
|
| 44 | + return $disableLink ? $icon : '<a href="javascript:void(0)" class="' . $linkClass . '">' . $icon . '</a>'; |
|
| 46 | 45 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | */ |
| 123 | 123 | public function addSettlement(int $billId) |
| 124 | 124 | { |
| 125 | - if($this->session->closed) |
|
| 125 | + if ($this->session->closed) |
|
| 126 | 126 | { |
| 127 | 127 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 128 | 128 | return $this->response; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function delSettlement(int $billId) |
| 146 | 146 | { |
| 147 | - if($this->session->closed) |
|
| 147 | + if ($this->session->closed) |
|
| 148 | 148 | { |
| 149 | 149 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 150 | 150 | return $this->response; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function addAllSettlements() |
| 166 | 166 | { |
| 167 | - if($this->session->closed) |
|
| 167 | + if ($this->session->closed) |
|
| 168 | 168 | { |
| 169 | 169 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 170 | 170 | return $this->response; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function delAllSettlements() |
| 186 | 186 | { |
| 187 | - if($this->session->closed) |
|
| 187 | + if ($this->session->closed) |
|
| 188 | 188 | { |
| 189 | 189 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 190 | 190 | return $this->response; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->target()->args()[0] : $this->bag('meeting')->get('pool.id'); |
| 69 | 69 | $this->pool = $this->depositService->getPool($poolId); |
| 70 | 70 | |
| 71 | - if(!$this->session || !$this->pool || $this->session->disabled($this->pool)) |
|
| 71 | + if (!$this->session || !$this->pool || $this->session->disabled($this->pool)) |
|
| 72 | 72 | { |
| 73 | 73 | $this->notify->error(trans('tontine.session.errors.disabled'), trans('common.titles.error')); |
| 74 | 74 | $this->pool = null; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function addDeposit(int $receivableId) |
| 136 | 136 | { |
| 137 | - if($this->session->closed) |
|
| 137 | + if ($this->session->closed) |
|
| 138 | 138 | { |
| 139 | 139 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 140 | 140 | return $this->response; |
@@ -153,21 +153,20 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function editAmount(int $receivableId) |
| 155 | 155 | { |
| 156 | - if($this->session->closed) |
|
| 156 | + if ($this->session->closed) |
|
| 157 | 157 | { |
| 158 | 158 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 159 | 159 | return $this->response; |
| 160 | 160 | } |
| 161 | 161 | $receivable = $this->depositService->getReceivable($this->pool, $this->session, $receivableId); |
| 162 | - if(!$receivable || !$receivable->deposit) |
|
| 162 | + if (!$receivable || !$receivable->deposit) |
|
| 163 | 163 | { |
| 164 | 164 | return $this->page(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $html = $this->view()->render('tontine.pages.meeting.deposit.libre.edit', [ |
| 168 | 168 | 'id' => $receivable->id, |
| 169 | - 'amount' => !$receivable->deposit ? '' : |
|
| 170 | - $this->localeService->getMoneyValue($receivable->deposit->amount), |
|
| 169 | + 'amount' => !$receivable->deposit ? '' : $this->localeService->getMoneyValue($receivable->deposit->amount), |
|
| 171 | 170 | ]); |
| 172 | 171 | $fieldId = 'receivable-' . $receivable->id; |
| 173 | 172 | $this->response->html($fieldId, $html); |
@@ -188,22 +187,21 @@ discard block |
||
| 188 | 187 | */ |
| 189 | 188 | public function saveAmount(int $receivableId, string $amount) |
| 190 | 189 | { |
| 191 | - if($this->session->closed) |
|
| 190 | + if ($this->session->closed) |
|
| 192 | 191 | { |
| 193 | 192 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 194 | 193 | return $this->response; |
| 195 | 194 | } |
| 196 | 195 | $amount = str_replace(',', '.', trim($amount)); |
| 197 | - if($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 196 | + if ($amount !== '' && filter_var($amount, FILTER_VALIDATE_FLOAT) === false) |
|
| 198 | 197 | { |
| 199 | 198 | $this->notify->error(trans('meeting.errors.amount.invalid', ['amount' => $amount])); |
| 200 | 199 | return $this->response; |
| 201 | 200 | } |
| 202 | - $amount = $amount === '' ? 0 : $this->localeService->convertMoneyToInt((float)$amount); |
|
| 201 | + $amount = $amount === '' ? 0 : $this->localeService->convertMoneyToInt((float) $amount); |
|
| 203 | 202 | |
| 204 | 203 | $amount > 0 ? |
| 205 | - $this->depositService->saveDepositAmount($this->pool, $this->session, $receivableId, $amount): |
|
| 206 | - $this->depositService->deleteDeposit($this->pool, $this->session, $receivableId); |
|
| 204 | + $this->depositService->saveDepositAmount($this->pool, $this->session, $receivableId, $amount) : $this->depositService->deleteDeposit($this->pool, $this->session, $receivableId); |
|
| 207 | 205 | |
| 208 | 206 | return $this->page(); |
| 209 | 207 | } |
@@ -215,7 +213,7 @@ discard block |
||
| 215 | 213 | */ |
| 216 | 214 | public function delDeposit(int $receivableId) |
| 217 | 215 | { |
| 218 | - if($this->session->closed) |
|
| 216 | + if ($this->session->closed) |
|
| 219 | 217 | { |
| 220 | 218 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 221 | 219 | return $this->response; |
@@ -231,12 +229,12 @@ discard block |
||
| 231 | 229 | */ |
| 232 | 230 | public function addAllDeposits() |
| 233 | 231 | { |
| 234 | - if($this->session->closed) |
|
| 232 | + if ($this->session->closed) |
|
| 235 | 233 | { |
| 236 | 234 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 237 | 235 | return $this->response; |
| 238 | 236 | } |
| 239 | - if(!$this->pool->deposit_fixed) |
|
| 237 | + if (!$this->pool->deposit_fixed) |
|
| 240 | 238 | { |
| 241 | 239 | return $this->response; |
| 242 | 240 | } |
@@ -251,12 +249,12 @@ discard block |
||
| 251 | 249 | */ |
| 252 | 250 | public function delAllDeposits() |
| 253 | 251 | { |
| 254 | - if($this->session->closed) |
|
| 252 | + if ($this->session->closed) |
|
| 255 | 253 | { |
| 256 | 254 | $this->notify->warning(trans('meeting.warnings.session.closed')); |
| 257 | 255 | return $this->response; |
| 258 | 256 | } |
| 259 | - if(!$this->pool->deposit_fixed) |
|
| 257 | + if (!$this->pool->deposit_fixed) |
|
| 260 | 258 | { |
| 261 | 259 | return $this->response; |
| 262 | 260 | } |