diff --git a/app/Http/Controllers/Banking/Reconciliations.php b/app/Http/Controllers/Banking/Reconciliations.php index 81f0f8229..a904a8380 100644 --- a/app/Http/Controllers/Banking/Reconciliations.php +++ b/app/Http/Controllers/Banking/Reconciliations.php @@ -177,10 +177,10 @@ class Reconciliations extends Controller */ protected function getTransactions($account, $started_at, $ended_at) { - $started = explode(' ', $started_at); - $ended = explode(' ', $ended_at); + $started = explode(' ', $started_at)[0] . ' 00:00:00'; + $ended = explode(' ', $ended_at)[0] . ' 23:59:59'; - $transactions = Transaction::where('account_id', $account->id)->whereBetween('paid_at', [$started[0], $ended[0]])->get(); + $transactions = Transaction::where('account_id', $account->id)->whereBetween('paid_at', [$started, $ended])->get(); return collect($transactions)->sortByDesc('paid_at'); } diff --git a/app/Http/Controllers/Common/Dashboards.php b/app/Http/Controllers/Common/Dashboards.php index 53afd6784..633e87057 100644 --- a/app/Http/Controllers/Common/Dashboards.php +++ b/app/Http/Controllers/Common/Dashboards.php @@ -13,6 +13,7 @@ use App\Models\Common\Widget; use App\Traits\DateTime; use App\Traits\Users; use App\Utilities\Widgets; +use Illuminate\Database\Eloquent\ModelNotFoundException; class Dashboards extends Controller { @@ -51,9 +52,9 @@ class Dashboards extends Controller { $dashboard_id = $dashboard_id ?? session('dashboard_id'); - if (!empty($dashboard_id)) { - $dashboard = Dashboard::find($dashboard_id); - } else { + try { + $dashboard = Dashboard::findOrFail($dashboard_id); + } catch (ModelNotFoundException $e) { $dashboard = user()->dashboards()->enabled()->first(); } diff --git a/config/version.php b/config/version.php index 67c380c7e..12658e312 100644 --- a/config/version.php +++ b/config/version.php @@ -10,15 +10,15 @@ return [ 'minor' => '0', - 'patch' => '24', + 'patch' => '25', 'build' => '', 'status' => 'Stable', - 'date' => '21-October-2020', + 'date' => '26-October-2020', - 'time' => '14:00', + 'time' => '15:00', 'zone' => 'GMT +3', diff --git a/overrides/Illuminate/View/Concers/ManagesStacks.php b/overrides/Illuminate/View/Concerns/ManagesStacks.php similarity index 100% rename from overrides/Illuminate/View/Concers/ManagesStacks.php rename to overrides/Illuminate/View/Concerns/ManagesStacks.php diff --git a/overrides/symfony/process/PhpExecutableFinder.php b/overrides/symfony/process/PhpExecutableFinder.php index a6ce5c636..bbd2e2e74 100644 --- a/overrides/symfony/process/PhpExecutableFinder.php +++ b/overrides/symfony/process/PhpExecutableFinder.php @@ -27,19 +27,53 @@ class PhpExecutableFinder //$this->executableFinder = new ExecutableFinder(); } + public function getPhpPath() + { + if ($this->isCpanel()) { + return '/usr/local/bin/php'; + } + + return 'php'; + } + public function isCpanel() { - return is_dir('/usr/local/cpanel'); + return $this->checkFolderAndPort('/usr/local/cpanel', 2082); } public function isPlesk() { - return is_dir('/usr/local/psa'); + return $this->checkFolderAndPort('/usr/local/psa', 8443); } public function isVirtualmin() { - return is_dir('/usr/share/webmin'); + return $this->checkFolderAndPort('/usr/share/webmin', 10000); + } + + public function checkFolderAndPort($folder, $port) + { + try { + return is_dir($folder); + } catch (\ErrorException | \Exception | \Throwable $e) { + return $this->checkSocket($port); + } + } + + public function checkSocket($port) + { + try { + $ip = @gethostbyname('localhost'); + $link = @fsockopen($ip, $port, $errno, $error); + + if ($link) { + return true; + } + + return false; + } catch (\ErrorException | \Exception | \Throwable $e) { + return false; + } } /** @@ -51,11 +85,7 @@ class PhpExecutableFinder { # @override // Not working on shared hosting due to "open_basedir" restriction applied by cPanel/Plesk - if ($this->isCpanel()) { - return '/usr/local/bin/php'; - } else { - return 'php'; - } + return $this->getPhpPath(); if ($php = getenv('PHP_BINARY')) { if (!is_executable($php)) { diff --git a/resources/assets/js/components/AkauntingMoney.vue b/resources/assets/js/components/AkauntingMoney.vue index 8514695d7..4df05bc9d 100644 --- a/resources/assets/js/components/AkauntingMoney.vue +++ b/resources/assets/js/components/AkauntingMoney.vue @@ -6,7 +6,7 @@
- +
diff --git a/resources/views/banking/reconciliations/create.blade.php b/resources/views/banking/reconciliations/create.blade.php index d9246830e..1e170db8f 100644 --- a/resources/views/banking/reconciliations/create.blade.php +++ b/resources/views/banking/reconciliations/create.blade.php @@ -74,7 +74,7 @@ @date($item->paid_at) {{ $item->description }} {{ $item->contact->name }} - @if ($item->type == 'income') + @if ($item->isIncome()) @money($item->amount, $item->currency_code, true) N/A @else @@ -83,14 +83,15 @@ @endif
- {{ Form::checkbox($item->type . '_' . $item->id, $item->amount_for_account, $item->reconciled, [ + @php $type = $item->isIncome() ? 'income' : 'expense'; @endphp + {{ Form::checkbox($type . '_' . $item->id, $item->amount_for_account, $item->reconciled, [ 'data-field' => 'transactions', - 'v-model' => 'form.transactions.' . $item->type . '_' . $item->id, - 'id' => 'transaction-' . $item->id . '-'. $item->type, + 'v-model' => 'form.transactions.' . $type . '_' . $item->id, + 'id' => 'transaction-' . $item->id . '-'. $type, 'class' => 'custom-control-input', '@change' => 'onCalculate' ]) }} - +
diff --git a/resources/views/banking/reconciliations/edit.blade.php b/resources/views/banking/reconciliations/edit.blade.php index af1c1e6c4..5bbb351a1 100644 --- a/resources/views/banking/reconciliations/edit.blade.php +++ b/resources/views/banking/reconciliations/edit.blade.php @@ -46,7 +46,7 @@ @date($item->paid_at) {{ $item->description }} {{ $item->contact->name }} - @if ($item->type == 'income') + @if ($item->isIncome()) @money($item->amount, $item->currency_code, true) N/A @else @@ -55,14 +55,15 @@ @endif
- {{ Form::checkbox($item->type . '_' . $item->id, $item->amount_for_account, $item->reconciled, [ + @php $type = $item->isIncome() ? 'income' : 'expense'; @endphp + {{ Form::checkbox($type . '_' . $item->id, $item->amount_for_account, $item->reconciled, [ 'data-field' => 'transactions', - 'v-model' => 'form.transactions.' . $item->type . '_' . $item->id, - 'id' => 'transaction-' . $item->id . '-'. $item->type, + 'v-model' => 'form.transactions.' . $type . '_' . $item->id, + 'id' => 'transaction-' . $item->id . '-'. $type, 'class' => 'custom-control-input', '@change' => 'onCalculate' ]) }} - +