From f4902002b901bd18ec8fc0a26f288037508a2c45 Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 6 Dec 2022 15:02:23 +0400 Subject: [PATCH] Bugfixes - Commenting out non-working portions of migrations - Fixing company_logo location --- app/Controllers/Login.php | 19 ++++++++++--------- app/Controllers/Sales.php | 2 +- app/Events/Load_config.php | 2 ++ app/Views/login.php | 6 +++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/Controllers/Login.php b/app/Controllers/Login.php index d81d020ae..c2da8f455 100644 --- a/app/Controllers/Login.php +++ b/app/Controllers/Login.php @@ -23,21 +23,22 @@ class Login extends BaseController $migration = new MY_Migration(config('Migrations')); $data = [ 'validation' => Services::validation(), - 'latest_version' => $migration->is_latest() + 'latest_version' => $migration->is_latest(), + 'application_version' => $migration->get_current_version() ]; - if(strtolower($this->request->getMethod()) !== 'post') - { +// if(strtolower($this->request->getMethod()) != 'post') +// { echo view('login', $data); - } +// } - if(!$this->validate(['username' => 'required|login_check'])) - { - echo view('login', ['validation' => $this->validator->getErrors()]); - } +// if(!$this->validate(['username' => 'required|login_check'])) +// { +// echo view('login', ['validation' => $this->validator->getErrors()]); +// } } - redirect('home'); +// redirect('home'); } /* public function login_check(string $username): bool diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index 39d32cff6..e54444aa3 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -899,7 +899,7 @@ class Sales extends Secure_Controller new Token_customer((object)$sale_data) ]; $text = $this->token_lib->render($text, $tokens); - $sale_data['mimetype'] = mime_content_type('uploads/' . config('OSPOS')->settings['company_logo']); + $sale_data['mimetype'] = mime_content_type(WRITEPATH . 'uploads/' . config('OSPOS')->settings['company_logo']); // generate email attachment: invoice in pdf format $view = Services::renderer(); diff --git a/app/Events/Load_config.php b/app/Events/Load_config.php index e50097a0c..c3c8d928a 100644 --- a/app/Events/Load_config.php +++ b/app/Events/Load_config.php @@ -31,6 +31,8 @@ class Load_config $config = config('OSPOS'); $appconfig = model(Appconfig::class); + $config->settings['application_version'] = $migration->get_current_version(); + if (!$migration->is_latest()) { $this->session->destroy(); diff --git a/app/Views/login.php b/app/Views/login.php index a1974bc9d..e9fc84939 100644 --- a/app/Views/login.php +++ b/app/Views/login.php @@ -26,7 +26,7 @@
- +
config('OSPOS')->settings['application_version']]) ?>
- + settings['login_form']) || 'floating_labels'==(config('OSPOS')->settings['login_form'])): ?>