mirror of
https://github.com/opensourcepos/opensourcepos.git
synced 2026-05-24 16:28:40 -04:00
Add warning if migration is needed (#2247)
This commit is contained in:
@@ -4,6 +4,7 @@ class Login extends CI_Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->load->library('migration');
|
||||
if($this->Employee->is_logged_in())
|
||||
{
|
||||
redirect('home');
|
||||
@@ -14,6 +15,7 @@ class Login extends CI_Controller
|
||||
|
||||
$this->form_validation->set_rules('username', 'lang:login_username', 'required|callback_login_check');
|
||||
|
||||
|
||||
if($this->config->item('gcaptcha_enable'))
|
||||
{
|
||||
$this->form_validation->set_rules('g-recaptcha-response', 'lang:login_gcaptcha', 'required|callback_gcaptcha_check');
|
||||
@@ -41,7 +43,6 @@ class Login extends CI_Controller
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->load->library('migration');
|
||||
if (!$this->migration->is_latest())
|
||||
{
|
||||
set_time_limit(1200);
|
||||
|
||||
@@ -7,6 +7,12 @@ function load_config()
|
||||
{
|
||||
$CI =& get_instance();
|
||||
|
||||
$migration = $CI->load->library('migration');
|
||||
if (!$CI->migration->is_latest())
|
||||
{
|
||||
$CI->session->sess_destroy();
|
||||
}
|
||||
|
||||
foreach($CI->Appconfig->get_all()->result() as $app_config)
|
||||
{
|
||||
$CI->config->set_item($CI->security->xss_clean($app_config->key), $CI->security->xss_clean($app_config->value));
|
||||
|
||||
@@ -38,6 +38,7 @@ $lang["common_last_page"] = "Last";
|
||||
$lang["common_learn_about_project"] = "to learn the latest information about the project.";
|
||||
$lang["common_list_of"] = "List of";
|
||||
$lang["common_logout"] = "Logout";
|
||||
$lang["common_migration_needed"] = "A database migration to %1 will start after login.";
|
||||
$lang["common_new"] = "New";
|
||||
$lang["common_no_persons_to_display"] = "There are no people to display.";
|
||||
$lang["common_none_selected_text"] = "[Select]";
|
||||
|
||||
@@ -4,11 +4,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class MY_Migration extends CI_Migration {
|
||||
|
||||
public function is_latest()
|
||||
public function get_last_migration()
|
||||
{
|
||||
$migrations = $this->find_migrations();
|
||||
$last_migration = basename(end($migrations));
|
||||
return basename(end($migrations));
|
||||
}
|
||||
|
||||
public function is_latest()
|
||||
{
|
||||
$last_migration = $this->get_last_migration();
|
||||
$last_version = $this->_get_migration_number($last_migration);
|
||||
$current_version = $this->_get_version();
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class Employee extends Person
|
||||
//Run these queries as a transaction, we want to make sure we do all or nothing
|
||||
$this->db->trans_start();
|
||||
|
||||
if(parent::save($person_data, $employee_id))
|
||||
if(ENVIRONMENT != 'testing' && parent::save($person_data, $employee_id))
|
||||
{
|
||||
if(!$employee_id || !$this->exists($employee_id))
|
||||
{
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
<div id="container">
|
||||
<div align="center" style="color:red"><?php echo validation_errors(); ?></div>
|
||||
|
||||
<?php if ($this->migration->is_latest()): ?>
|
||||
<div align="center" style="color:red"><?php echo $this->lang->line('common_migration_needed'); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="login_form">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-user"></span></span>
|
||||
|
||||
Reference in New Issue
Block a user