diff --git a/rsc/design/logo/installation-banner.png b/rsc/design/logo/installation-banner.png new file mode 100644 index 00000000..6fb4cab1 Binary files /dev/null and b/rsc/design/logo/installation-banner.png differ diff --git a/rsc/design/logo/installation-banner.psd b/rsc/design/logo/installation-banner.psd new file mode 100644 index 00000000..05bae64b Binary files /dev/null and b/rsc/design/logo/installation-banner.psd differ diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index da7d351a..ea7cbaab 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -12,6 +12,8 @@ class Appointments extends CI_Controller { * record. */ public function index($appointment_hash = '') { + if (!$this->check_installation()) return; + $this->load->model('appointments_model'); $this->load->model('providers_model'); $this->load->model('services_model'); @@ -602,6 +604,41 @@ class Appointments extends CI_Controller { return $available_periods_with_appointments; } + + /** + * This method checks whether the application is installed. + * + * This method resides in this controller because the "index()" function will + * be the first to be launched after the files are on the server. NOTE that the + * "configuration.php" file must be already set because we won't be able to + * connect to the database otherwise. + */ + public function check_installation() { + try { + if (!$this->db->table_exists('ea_users')) { + // This is the first time the website is launched an the user needs to set + // the basic settings. + + // We will use mysqli to create the database structure from the "structure.sql" file. + require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php'; + $mysqli = new mysqli(SystemConfiguration::$db_host, SystemConfiguration::$db_username, + SystemConfiguration::$db_password, SystemConfiguration::$db_name); + $structure = file_get_contents($this->config->item('base_url') . 'assets/sql/structure.sql'); + $mysqli->multi_query($structure); + $mysqli->close(); + + // Display the installation view page. + $view['base_url'] = $this->config->item('base_url'); + $this->load->view('general/installation', $view); + + return FALSE; // Do not display the book appointment view file. + } else { + return TRUE; + } + } catch(Exception $exc) { + echo $exc->getTrace(); + } + } } /* End of file appointments.php */ diff --git a/src/application/controllers/backend.php b/src/application/controllers/backend.php index 6cc1ca3f..dc24c83b 100644 --- a/src/application/controllers/backend.php +++ b/src/application/controllers/backend.php @@ -174,7 +174,7 @@ class Backend extends CI_Controller { $user_id = $this->session->userdata('user_id'); $view['base_url'] = $this->config->item('base_url'); - $view['user_display_name'] = $this->user_model->get_user_display_name($this->session->userdata('user_id')); + $view['user_display_name'] = $this->user_model->get_user_display_name($user_id); $view['active_menu'] = PRIV_SYSTEM_SETTINGS; $view['company_name'] = $this->settings_model->get_setting('company_name'); $view['role_slug'] = $this->session->userdata('role_slug'); diff --git a/src/application/controllers/user.php b/src/application/controllers/user.php index 138706da..6976a8a3 100644 --- a/src/application/controllers/user.php +++ b/src/application/controllers/user.php @@ -29,12 +29,12 @@ class User extends CI_Controller { $this->session->unset_userdata('dest_url'); $view['base_url'] = $this->config->item('base_url'); - $this->load->view('user/logout', $view); } public function forgot_password() { - + $view['base_url'] = $this->config->item('base_url'); + $this->load->view('user/forgot_password', $view); } public function no_privileges() { @@ -73,6 +73,43 @@ class User extends CI_Controller { )); } } + + /** + * Regenerate a new password for the current user, only if the username and + * email address given corresond to an existing user in db. + * + * @param string $_POST['username'] + * @param string $_POST['email'] + */ + public function ajax_forgot_password() { + try { + if (!isset($_POST['username']) || !isset($_POST['email'])) { + throw new Exception('You must enter a valid username and email address in ' + . 'order to get a new password!'); + } + + $this->load->model('user_model'); + $this->load->model('settings_model'); + + $new_password = $this->user_model->regenerate_password($_POST['username'], $_POST['email']); + + if ($new_password != FALSE) { + $this->load->library('notifications'); + $company_settings = array( + 'company_name' => $this->settings_model->get_setting('company_name'), + 'company_link' => $this->settings_model->get_setting('company_link'), + 'company_email' => $this->settings_model->get_setting('company_email') + ); + $this->notifications->send_password($new_password, $_POST['email'], $company_settings); + } + + echo ($new_password != FALSE) ? json_encode(AJAX_SUCCESS) : json_encode(AJAX_FAILURE); + } catch(Exception $exc) { + echo json_encode(array( + 'exceptions' => array(exceptionToJavaScript($exc)) + )); + } + } } /* End of file user.php */ diff --git a/src/application/helpers/general_helper.php b/src/application/helpers/general_helper.php index 1a51b93f..9f665c8d 100644 --- a/src/application/helpers/general_helper.php +++ b/src/application/helpers/general_helper.php @@ -61,5 +61,21 @@ function generate_salt() { return substr($salt, 0, $max_length); } +/** + * This method generates a random string. + * + * @param int $length (OPTIONAL = 10) The length of the generated string. + * @return string Returns the randomly generated string. + * @link http://stackoverflow.com/a/4356295/1718162 + */ +function generate_random_string($length = 10) { + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $random_string = ''; + for ($i = 0; $i < $length; $i++) { + $random_string .= $characters[rand(0, strlen($characters) - 1)]; + } + return $random_string; +} + /* End of file general_helper.php */ /* Location: ./application/helpers/general_helper.php */ \ No newline at end of file diff --git a/src/application/libraries/notifications.php b/src/application/libraries/notifications.php index 57b3291a..26dfed65 100644 --- a/src/application/libraries/notifications.php +++ b/src/application/libraries/notifications.php @@ -164,6 +164,45 @@ class Notifications { return TRUE; } + + /** + * This method sends an email with the new password of a user. + * + * @param string $password Contains the new password. + * @param string $email The receiver's email address. + */ + public function send_password($password, $email, $company_settings) { + $replace_array = array( + '$email_title' => 'New Account Password', + '$email_message' => 'Your new account password is ' . $password . '. ' + . 'Please store this email to be able to retrieve your password if necessary. ' + . 'You can also change this password with a new one in the settings page.', + '$company_name' => $company_settings['company_name'], + '$company_email' => $company_settings['company_email'], + '$company_link' => $company_settings['company_link'] + ); + + $email_html = file_get_contents(dirname(dirname(__FILE__)) + . '/views/emails/new_password.php'); + $email_html = $this->replace_template_variables($replace_array, $email_html); + + // :: SETUP EMAIL OBJECT AND SEND NOTIFICATION + $mail = new PHPMailer(); + $mail->From = $company_settings['company_email']; + $mail->FromName = $company_settings['company_name']; + $mail->AddAddress($email); // "Name" argument crushes the phpmailer class. + $mail->IsHTML(true); + $mail->CharSet = 'UTF-8'; + $mail->Subject = 'New Account Password'; + $mail->Body = $email_html; + + if (!$mail->Send()) { + throw new Exception('Email could not been sent. ' + . 'Mailer Error (Line ' . __LINE__ . '): ' . $mail->ErrorInfo); + } + + return TRUE; + } } /* End of file notifications.php */ diff --git a/src/application/models/user_model.php b/src/application/models/user_model.php index ed85d31d..d9f826cf 100644 --- a/src/application/models/user_model.php +++ b/src/application/models/user_model.php @@ -102,6 +102,38 @@ class User_Model extends CI_Model { $user = $this->db->get_where('ea_users', array('id' => $user_id))->row_array(); return $user['first_name'] . ' ' . $user['last_name']; } + + /** + * If the given arguments correspond to an existing user record, generate a new + * password and send it with an email. + * + * @param string $username + * @param string $email + * @return string|bool Returns the new password on success or FALSE on failure. + */ + public function regenerate_password($username, $email) { + $this->load->helper('general'); + + $result = $this->db + ->select('ea_users.id') + ->from('ea_users') + ->join('ea_user_settings', 'ea_user_settings.id_users = ea_users.id', 'inner') + ->where('ea_users.email', $email) + ->where('ea_user_settings.username', $username) + ->get(); + + if ($result->num_rows() == 0) return FALSE; + + $user_id = $result->row()->id; + + // Create a new password and send it with an email to the given email address. + $new_password = generate_random_string(); + $salt = $this->db->get_where('ea_user_settings', array('id_users' => $user_id))->row()->salt; + $hash_password = hash_password($salt, $new_password); + $this->db->update('ea_user_settings', array('password' => $hash_password), array('id_users' => $user_id)); + + return $new_password; + } } /* End of file user_model.php */ diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 8ef2ea61..81a1b769 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -346,7 +346,7 @@ // ------------------------------------------------------ ?> diff --git a/src/application/views/backend/calendar.php b/src/application/views/backend/calendar.php index 0267ad0e..5eb7e2d2 100644 --- a/src/application/views/backend/calendar.php +++ b/src/application/views/backend/calendar.php @@ -41,7 +41,8 @@
- + + + +
+ + + + \ No newline at end of file diff --git a/src/application/views/user/forgot_password.php b/src/application/views/user/forgot_password.php index b6eddc13..663f9627 100644 --- a/src/application/views/user/forgot_password.php +++ b/src/application/views/user/forgot_password.php @@ -1,7 +1,124 @@ - + + + + + + + + + + + + + + + + + + + + + + + +
+

Forgot Your Password?

+

Type your username and your email address to get your new password.

+
+ +
+ + + + + + +

+ + + + +
+
+ + \ No newline at end of file diff --git a/src/application/views/user/logout.php b/src/application/views/user/logout.php index f6d8af5c..508a682c 100644 --- a/src/application/views/user/logout.php +++ b/src/application/views/user/logout.php @@ -70,7 +70,7 @@ - + Backend Section
diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index 2386dbc1..a899c815 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -53,12 +53,13 @@ root { font-size: 16px; } -#header #header-menu .menu-item:hover { +#header #header-menu .menu-item:hover:not(.active) { background-color: #247A4B; } #header #header-menu .active { - color: #D6FF80; + color: #E7FFB3; + text-shadow: 1px 1px 0px #57814D; } #footer { diff --git a/src/assets/images/installation-banner.png b/src/assets/images/installation-banner.png new file mode 100644 index 00000000..6fb4cab1 Binary files /dev/null and b/src/assets/images/installation-banner.png differ diff --git a/src/assets/js/backend_customers.js b/src/assets/js/backend_customers.js index 9091c4cf..cf62813d 100644 --- a/src/assets/js/backend_customers.js +++ b/src/assets/js/backend_customers.js @@ -342,7 +342,7 @@ CustomersHelper.prototype.display = function(customer) { ''; $('#customer-appointments').append(html); }); - $('#customer-appointments').jScrollPane(); + $('#customer-appointments').jScrollPane({ mouseWheelSpeed: 70 }); }; /** @@ -375,8 +375,7 @@ CustomersHelper.prototype.filter = function(key, selectId, display) { var html = BackendCustomers.helper.getFilterHtml(customer); $('#filter-customers .results').append(html); }); - - $('#filter-customers .results').jScrollPane(); + $('#filter-customers .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-customers .results').html('No records found...'); diff --git a/src/assets/js/backend_services.js b/src/assets/js/backend_services.js index ac76da5a..9eb61b62 100644 --- a/src/assets/js/backend_services.js +++ b/src/assets/js/backend_services.js @@ -54,7 +54,7 @@ var BackendServices = { * Changes the displayed tab. */ $('.tab').click(function() { - $('.active').removeClass('active'); + $(this).parent().find('.active').removeClass('active'); $(this).addClass('active'); $('.tab-content').hide(); @@ -389,7 +389,7 @@ ServicesHelper.prototype.filter = function(key, selectId, display) { var html = ServicesHelper.prototype.getFilterHtml(service); $('#filter-services .results').append(html); }); - $('#filter-services .results').jScrollPane(); + $('#filter-services .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-services .result').html('No results found ...'); @@ -613,7 +613,7 @@ CategoriesHelper.prototype.filter = function(key, selectId, display) { var html = BackendServices.helper.getFilterHtml(category); $('#filter-categories .results').append(html); }); - $('#filter-categories .results').jScrollPane(); + $('#filter-categories .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-categories .results').html('No records found...'); diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 422dfee3..8bc8d230 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -116,7 +116,7 @@ var BackendSettings = { // and apply it whenever the user tab is clicked.. var areNotificationsActive = $('#user-notifications').hasClass('active'); - $('.active').removeClass('active'); + $(this).parent().find('.active').removeClass('active'); $(this).addClass('active'); $('.tab-content').hide(); diff --git a/src/assets/js/backend_users.js b/src/assets/js/backend_users.js index 27a51fd8..6e2d7d55 100644 --- a/src/assets/js/backend_users.js +++ b/src/assets/js/backend_users.js @@ -49,14 +49,14 @@ var BackendUsers = { + service.name + ''; $('#provider-services').append(html); }); - $('#provider-services').jScrollPane(); + $('#provider-services').jScrollPane({ mouseWheelSpeed: 70 }); $.each(GlobalVariables.providers, function(index, provider) { var html = ''; $('#secretary-providers').append(html); }); - $('#secretary-providers').jScrollPane(); + $('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 }); // Bind event handlers. if (defaultEventHandlers) BackendUsers.bindEventHandlers(); @@ -73,7 +73,7 @@ var BackendUsers = { * Changes the displayed tab. */ $('.tab').click(function() { - $('.active').removeClass('active'); + $(this).parent().find('.active').removeClass('active'); $(this).addClass('active'); $('.tab-content').hide(); @@ -83,7 +83,7 @@ var BackendUsers = { } else if ($(this).hasClass('providers-tab')) { // display providers tab $('#providers').show(); $('#provider-services').data('jsp').destroy(); - $('#provider-services').jScrollPane(); + $('#provider-services').jScrollPane({ mouseWheelSpeed: 70 }); BackendUsers.helper = new ProvidersHelper(); } else if ($(this).hasClass('secretaries-tab')) { // display secretaries tab $('#secretaries').show(); @@ -109,7 +109,7 @@ var BackendUsers = { $('#secretary-providers').append(html); }); $('#secretary-providers input[type="checkbox"]').prop('disabled', true); - $('#secretary-providers').jScrollPane(); + $('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 }); }, 'json'); } diff --git a/src/assets/js/backend_users_admins.js b/src/assets/js/backend_users_admins.js index a6426990..83ee3259 100644 --- a/src/assets/js/backend_users_admins.js +++ b/src/assets/js/backend_users_admins.js @@ -330,7 +330,7 @@ AdminsHelper.prototype.filter = function(key, selectId, display) { var html = AdminsHelper.prototype.getFilterHtml(admin); $('#filter-admins .results').append(html); }); - $('#filter-admins .results').jScrollPane(); + $('#filter-admins .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-admins .results').html('No results found ...') diff --git a/src/assets/js/backend_users_providers.js b/src/assets/js/backend_users_providers.js index 7367065f..ef4b3b3e 100644 --- a/src/assets/js/backend_users_providers.js +++ b/src/assets/js/backend_users_providers.js @@ -397,7 +397,7 @@ ProvidersHelper.prototype.filter = function(key, selectId, display) { var html = ProvidersHelper.prototype.getFilterHtml(provider); $('#filter-providers .results').append(html); }); - $('#filter-providers .results').jScrollPane(); + $('#filter-providers .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-providers .results').html('No results found ...') diff --git a/src/assets/js/backend_users_secretaries.js b/src/assets/js/backend_users_secretaries.js index 272146e3..5494ebdf 100644 --- a/src/assets/js/backend_users_secretaries.js +++ b/src/assets/js/backend_users_secretaries.js @@ -351,7 +351,7 @@ SecretariesHelper.prototype.filter = function(key, selectId, display) { var html = SecretariesHelper.prototype.getFilterHtml(secretary); $('#filter-secretaries .results').append(html); }); - $('#filter-secretaries .results').jScrollPane(); + $('#filter-secretaries .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { $('#filter-secretaries .results').html('No results found ...') diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql new file mode 100644 index 00000000..3fbe8c56 --- /dev/null +++ b/src/assets/sql/structure.sql @@ -0,0 +1,227 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.1 +-- http://www.phpmyadmin.net +-- +-- Φιλοξενητής: localhost +-- Χρόνος δημιουργίας: 11 Οκτ 2013 στις 16:58:08 +-- Έκδοση διακομιστή: 5.5.24-log +-- Έκδοση PHP: 5.4.3 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Βάση: `easy_appointments` +-- + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_appointments` +-- + +CREATE TABLE IF NOT EXISTS `ea_appointments` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `book_datetime` datetime DEFAULT NULL, + `start_datetime` datetime DEFAULT NULL, + `end_datetime` datetime DEFAULT NULL, + `notes` text, + `hash` text, + `is_unavailable` tinyint(4) DEFAULT '0', + `id_users_provider` bigint(20) unsigned DEFAULT NULL, + `id_users_customer` bigint(20) unsigned DEFAULT NULL, + `id_services` bigint(20) unsigned DEFAULT NULL, + `id_google_calendar` text, + PRIMARY KEY (`id`), + KEY `id_users_customer` (`id_users_customer`), + KEY `id_services` (`id_services`), + KEY `id_users_provider` (`id_users_provider`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_roles` +-- + +CREATE TABLE IF NOT EXISTS `ea_roles` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `slug` varchar(256) DEFAULT NULL, + `is_admin` tinyint(4) DEFAULT NULL COMMENT '0', + `appointments` int(4) DEFAULT NULL COMMENT '0', + `customers` int(4) DEFAULT NULL COMMENT '0', + `services` int(4) DEFAULT NULL COMMENT '0', + `users` int(4) DEFAULT NULL COMMENT '0', + `system_settings` int(4) DEFAULT NULL COMMENT '0', + `user_settings` int(11) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_secretaries_providers` +-- + +CREATE TABLE IF NOT EXISTS `ea_secretaries_providers` ( + `id_users_secretary` bigint(20) unsigned NOT NULL, + `id_users_provider` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id_users_secretary`,`id_users_provider`), + KEY `fk_ea_secretaries_providers_1` (`id_users_secretary`), + KEY `fk_ea_secretaries_providers_2` (`id_users_provider`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_services` +-- + +CREATE TABLE IF NOT EXISTS `ea_services` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `duration` int(11) DEFAULT NULL, + `price` decimal(10,2) DEFAULT NULL, + `currency` varchar(32) DEFAULT NULL, + `description` text, + `id_service_categories` bigint(20) unsigned DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `id_service_categories` (`id_service_categories`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=13 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_services_providers` +-- + +CREATE TABLE IF NOT EXISTS `ea_services_providers` ( + `id_users` bigint(20) unsigned NOT NULL, + `id_services` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id_users`,`id_services`), + KEY `id_services` (`id_services`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_service_categories` +-- + +CREATE TABLE IF NOT EXISTS `ea_service_categories` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(256) DEFAULT NULL, + `description` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=24 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_settings` +-- + +CREATE TABLE IF NOT EXISTS `ea_settings` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(512) DEFAULT NULL, + `value` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_users` +-- + +CREATE TABLE IF NOT EXISTS `ea_users` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `first_name` varchar(256) DEFAULT NULL, + `last_name` varchar(512) DEFAULT NULL, + `email` varchar(512) DEFAULT NULL, + `mobile_number` varchar(128) DEFAULT NULL, + `phone_number` varchar(128) DEFAULT NULL, + `address` varchar(256) DEFAULT NULL, + `city` varchar(256) DEFAULT NULL, + `state` varchar(128) DEFAULT NULL, + `zip_code` varchar(64) DEFAULT NULL, + `notes` text, + `id_roles` bigint(20) unsigned NOT NULL, + PRIMARY KEY (`id`), + KEY `id_roles` (`id_roles`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=84 ; + +-- -------------------------------------------------------- + +-- +-- Δομή πίνακα για τον πίνακα `ea_user_settings` +-- + +CREATE TABLE IF NOT EXISTS `ea_user_settings` ( + `id_users` bigint(20) unsigned NOT NULL, + `username` varchar(256) DEFAULT NULL, + `password` varchar(512) DEFAULT NULL, + `salt` varchar(512) DEFAULT NULL, + `working_plan` text, + `notifications` tinyint(4) DEFAULT '0', + `google_sync` tinyint(4) DEFAULT '0', + `google_token` text, + `sync_past_days` int(11) DEFAULT '5', + `sync_future_days` int(11) DEFAULT '5', + PRIMARY KEY (`id_users`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Περιορισμοί για άχρηστους πίνακες +-- + +-- +-- Περιορισμοί για πίνακα `ea_appointments` +-- +ALTER TABLE `ea_appointments` + ADD CONSTRAINT `ea_appointments_ibfk_2` FOREIGN KEY (`id_users_customer`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_3` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_appointments_ibfk_4` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_secretaries_providers` +-- +ALTER TABLE `ea_secretaries_providers` + ADD CONSTRAINT `fk_ea_secretaries_providers_1` FOREIGN KEY (`id_users_secretary`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `fk_ea_secretaries_providers_2` FOREIGN KEY (`id_users_provider`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_services` +-- +ALTER TABLE `ea_services` + ADD CONSTRAINT `ea_services_ibfk_1` FOREIGN KEY (`id_service_categories`) REFERENCES `ea_service_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_services_providers` +-- +ALTER TABLE `ea_services_providers` + ADD CONSTRAINT `ea_services_providers_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `ea_services_providers_ibfk_2` FOREIGN KEY (`id_services`) REFERENCES `ea_services` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_users` +-- +ALTER TABLE `ea_users` + ADD CONSTRAINT `ea_users_ibfk_1` FOREIGN KEY (`id_roles`) REFERENCES `ea_roles` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Περιορισμοί για πίνακα `ea_user_settings` +-- +ALTER TABLE `ea_user_settings` + ADD CONSTRAINT `ea_user_settings_ibfk_1` FOREIGN KEY (`id_users`) REFERENCES `ea_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;