diff --git a/src/application/config/config.php b/src/application/config/config.php index 25b13704..92e7a5bd 100644 --- a/src/application/config/config.php +++ b/src/application/config/config.php @@ -29,8 +29,8 @@ $config['base_url'] = SystemConfiguration::$base_url; | the global "config" variable. | */ -$config['ea_version'] = '0.7.1'; // This must be changed manually. -$config['ea_release_title'] = 'Beta'; // Leave empty for no title or add BETA, TEST etc ... +$config['ea_version'] = '1.0'; // This must be changed manually. +$config['ea_release_title'] = ''; // Leave empty for no title or add BETA, TEST etc ... $config['ea_google_sync_feature'] = SystemConfiguration::$google_sync_feature; /* diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index b8b73847..0cd0b7bf 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -619,7 +619,7 @@ class Appointments extends CI_Controller { */ public function ajax_install() { try { - // 2nd method using the ci database class. + // Create E!A database structure. $file_contents = file_get_contents($this->config->item('base_url') . 'assets/sql/structure.sql'); $sql_queries = explode(';', $file_contents); array_pop($sql_queries); @@ -633,7 +633,13 @@ class Appointments extends CI_Controller { $admin['settings']['username'] = $admin['username']; $admin['settings']['password'] = $admin['password']; unset($admin['username'], $admin['password']); - $this->admins_model->add($admin); + $admin['id'] = $this->admins_model->add($admin); + + $this->load->library('session'); + $this->session->set_userdata('user_id', $admin['id']); + $this->session->set_userdata('user_email', $admin['email']); + $this->session->set_userdata('role_slug', DB_SLUG_ADMIN); + $this->session->set_userdata('username', $admin['settings']['username']); // Save company settings $this->load->model('settings_model'); diff --git a/src/application/controllers/backend.php b/src/application/controllers/backend.php index 56a2edd0..9879b66b 100644 --- a/src/application/controllers/backend.php +++ b/src/application/controllers/backend.php @@ -265,7 +265,7 @@ class Backend extends CI_Controller { public function update() { try { if (!$this->hasPrivileges(PRIV_SYSTEM_SETTINGS, TRUE)) - throw new Exception('You do not have the required privileges for this task.'); + throw new Exception('You do not have the required privileges for this task!'); $this->load->library('migration'); diff --git a/src/application/controllers/backend_api.php b/src/application/controllers/backend_api.php index 71d37b66..1ee5d184 100644 --- a/src/application/controllers/backend_api.php +++ b/src/application/controllers/backend_api.php @@ -12,6 +12,14 @@ class Backend_api extends CI_Controller { $this->load->library('session'); $this->load->model('roles_model'); $this->privileges = $this->roles_model->get_privileges($this->session->userdata('role_slug')); + + // Set user's selected language. + if ($this->session->userdata('language')) { + $this->config->set_item('language', $this->session->userdata('language')); + $this->lang->load('translations', $this->session->userdata('language')); + } else { + $this->lang->load('translations', $this->config->item('language')); // default + } } /** @@ -176,25 +184,22 @@ class Backend_api extends CI_Controller { ->get_setting('notifications', $provider['id']); if (!$manage_mode) { - $customer_title = 'Your appointment has been successfully booked!'; - $customer_message = 'Thank you for arranging an appointment with us. ' - . 'Below you can see the appointment details. Make changes ' - . 'by clicking the appointment link.'; + $customer_title = $this->lang->line('appointment_booked'); + $customer_message = $this->lang->line('thank_your_for_appointment'); $customer_link = $this->config->item('base_url') . 'appointments/index/' . $appointment['hash']; - $provider_title = 'A new appointment has been added to your plan.'; - $provider_message = 'You can make changes by clicking the appointment ' - . 'link below'; + $provider_title = $this->lang->line('appointment_added_to_your_plan'); + $provider_message = $this->lang->line('appointment_link_description'); $provider_link = $this->config->item('base_url') . 'backend/index/' . $appointment['hash']; } else { - $customer_title = 'Appointment changes have been successfully saved!'; + $customer_title = $this->lang->line('appointment_changes_saved'); $customer_message = ''; $customer_link = $this->config->item('base_url') . 'appointments/index/' . $appointment['hash']; - $provider_title = 'Appointment changes have been successfully saved!'; + $provider_title = $this->lang->line('appointment_details_changed'); $provider_message = ''; $provider_link = $this->config->item('base_url') . 'backend/index/' . $appointment['hash']; diff --git a/src/application/controllers/test.php b/src/application/controllers/test.php index 4d45715c..062d340e 100644 --- a/src/application/controllers/test.php +++ b/src/application/controllers/test.php @@ -24,6 +24,12 @@ class Test extends CI_Controller { return; } + if (ENVIRONMENT !== 'development') { + $this->output->set_output('Tests are available only at development environment. ' + . 'Please check your "index.php" file settings.'); + return; + } + $this->load->view('general/test'); $this->unit_tests->run_all_tests(); } diff --git a/src/application/language/english/translations_lang.php b/src/application/language/english/translations_lang.php index 478d05b7..0f8d123a 100644 --- a/src/application/language/english/translations_lang.php +++ b/src/application/language/english/translations_lang.php @@ -226,7 +226,7 @@ $lang['backend_calendar'] = 'Backend Calendar'; $lang['start_date_time'] = 'Start Date / Time'; $lang['end_date_time'] = 'End Date / Time'; $lang['licensed_under'] = 'Licensed Under'; -$lang['unexpected_issues_occurred'] = 'Unexpected issues occured!'; +$lang['unexpected_issues_occurred'] = 'Unexpected issues occurred!'; $lang['service_communication_error'] = 'A server communication error occurred, please try again.'; $lang['no_privileges_edit_appointments'] = 'You do not have the required privileges to edit appointments.'; $lang['unavailable_updated'] = 'Unavailable time period updated successfully!'; diff --git a/src/application/language/german/translations_lang.php b/src/application/language/german/translations_lang.php index 409aadbb..6b845e2b 100644 --- a/src/application/language/german/translations_lang.php +++ b/src/application/language/german/translations_lang.php @@ -226,7 +226,7 @@ $lang['backend_calendar'] = 'Backend Kalender'; $lang['start_date_time'] = 'Start Datum / Zeit'; $lang['end_date_time'] = 'Ende Datum / Zeit'; $lang['licensed_under'] = 'Lizenzierte Unter'; -$lang['unexpected_issues_occured'] = 'Unerwartete Probleme aufgetreten!'; +$lang['unexpected_issues_occurred'] = 'Unerwartete Probleme aufgetreten!'; $lang['service_communication_error'] = 'Während der Kommunikation mit dem Server ist ein Fehler aufgetreten, bitte versuchen Sie es erneut.'; $lang['no_privileges_edit_appointments'] = 'Sie haben nicht die Berechtigung, um Termine zu bearbeiten.'; $lang['unavailable_updated'] = 'Nicht zur Verfügung stehender Zeitraum erfolgreich erneuert worden!'; diff --git a/src/application/language/greek/translations_lang.php b/src/application/language/greek/translations_lang.php index c29b582c..2abab803 100644 --- a/src/application/language/greek/translations_lang.php +++ b/src/application/language/greek/translations_lang.php @@ -226,7 +226,7 @@ $lang['backend_calendar'] = 'Ημερολόγιο Backend'; $lang['start_date_time'] = 'Ημ. / Ώρα Έναρξης'; $lang['end_date_time'] = 'Ημ. / Ώρα Λήξης'; $lang['licensed_under'] = 'Σύμφωνα Με Την Άδεια'; -$lang['unexpected_issues_occured'] = 'Παρουσιάστηκαν απροσδόκητα προβλήματα!'; +$lang['unexpected_issues_occurred'] = 'Παρουσιάστηκαν απροσδόκητα προβλήματα!'; $lang['service_communication_error'] = 'Παρουσιάστηκε σφάλμα κατά την επικοινωνία με τον διακομιστή, παρακαλώ προσπαθήστε ξανά.'; $lang['no_privileges_edit_appointments'] = 'Δεν έχετε τα απαραίτητα δικαιώματα για να επεξεργαστείτε ραντεβού.'; $lang['unavailable_updated'] = 'Η μη διαθέσιμη περίοδος ενημερώθηκε επιτυχώς!'; diff --git a/src/application/models/customers_model.php b/src/application/models/customers_model.php index 2c272ace..fb00e7ff 100644 --- a/src/application/models/customers_model.php +++ b/src/application/models/customers_model.php @@ -21,7 +21,7 @@ class Customers_Model extends CI_Model { */ public function add($customer) { // Validate the customer data before doing anything. - !$this->validate($customer); + $this->validate($customer); // :: CHECK IF CUSTOMER ALREADY EXIST (FROM EMAIL). if ($this->exists($customer) && !isset($customer['id'])) { @@ -103,6 +103,12 @@ class Customers_Model extends CI_Model { * @return int Returns the updated record id. */ private function update($customer) { + // Do not update empty string values. + foreach ($customer as $key => $value) { + if ($value === '') + unset($customer[$key]); + } + $this->db->where('id', $customer['id']); if (!$this->db->update('ea_users', $customer)) { throw new Exception('Could not update customer to the database.'); @@ -147,8 +153,7 @@ class Customers_Model extends CI_Model { } /** - * Validate customer data before the insert or - * update operation is executed. + * Validate customer data before the insert or update operation is executed. * * @param array $customer Contains the customer data. * @return bool Returns the validation result. @@ -156,7 +161,6 @@ class Customers_Model extends CI_Model { public function validate($customer) { $this->load->helper('data_validation'); - // If a customer id is provided, check whether the record // exist in the database. if (isset($customer['id'])) { diff --git a/src/application/models/user_model.php b/src/application/models/user_model.php index d9f826cf..38c60c01 100644 --- a/src/application/models/user_model.php +++ b/src/application/models/user_model.php @@ -81,7 +81,7 @@ class User_Model extends CI_Model { ->select('ea_users.id AS user_id, ea_users.email AS user_email, ' . 'ea_roles.slug AS role_slug, ea_user_settings.username') ->from('ea_users') - ->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'innder') + ->join('ea_roles', 'ea_roles.id = ea_users.id_roles', 'inner') ->join('ea_user_settings', 'ea_user_settings.id_users = ea_users.id') ->where('ea_user_settings.username', $username) ->where('ea_user_settings.password', $password) diff --git a/src/application/views/backend/calendar.php b/src/application/views/backend/calendar.php index 13b8c762..2841a47d 100644 --- a/src/application/views/backend/calendar.php +++ b/src/application/views/backend/calendar.php @@ -214,7 +214,7 @@ + style="display: none;" class="input-medium span4"/> diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index 4d55b823..ed11aa18 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -257,6 +257,7 @@ body .jspTrack { #filter-existing-customers { display: inline-block; height: 14px; + min-height: 24px; font-size: 12px; } @@ -312,7 +313,7 @@ body .form-horizontal .controls { } #customers-page #customer-appointments { - height: 250px; + height: 370px; width: 330px; border: 4px solid #E2E2E2; margin-bottom: 20px; @@ -502,7 +503,7 @@ body .form-horizontal .controls { #users-page #provider-services { border: 4px solid #ccc; width: 340px; - height: 140px; + height: 387px; overflow-y: scroll; padding: 7px; } diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index 3468962a..b0164eb1 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -548,7 +548,7 @@ var BackendCalendar = { $dialog.find('.modal-message').text(EALang['unexpected_issues_occurred']); $dialog.find('.modal-message').addClass('alert-error'); $dialog.find('.modal-message').fadeIn(); - return; + return false; } // Display success message to the user. @@ -882,7 +882,7 @@ var BackendCalendar = { $('#address').val(c.address); $('#city').val(c.city); $('#zip-code').val(c.zip_code); - $('#customer-code').val(c.notes); + $('#customer-notes').val(c.notes); return false; } }); @@ -1920,13 +1920,13 @@ var BackendCalendar = { } }); if (missingRequiredField) { - throw 'Fields with * are required!'; + throw EALang['fields_are_required']; } // :: CHECK EMAIL ADDRESS if (!GeneralFunctions.validateEmail($dialog.find('#email').val())) { $dialog.find('#email').parents().eq(1).addClass('error'); - throw 'Invalid email address!'; + throw EALang['invalid_email']; } // :: CHECK APPOINTMENT START AND END TIME @@ -1935,7 +1935,7 @@ var BackendCalendar = { if (start > end) { $dialog.find('#start-datetime').parents().eq(1).addClass('error'); $dialog.find('#end-datetime').parents().eq(1).addClass('error'); - throw 'Appointment start must be prior to appointment end date!'; + throw EALang['start_date_before_end_error']; } return true; diff --git a/src/assets/js/backend_users_secretaries.js b/src/assets/js/backend_users_secretaries.js index 6524df86..5bbf161c 100644 --- a/src/assets/js/backend_users_secretaries.js +++ b/src/assets/js/backend_users_secretaries.js @@ -359,7 +359,7 @@ SecretariesHelper.prototype.filter = function(key, selectId, display) { $('#filter-secretaries .results').jScrollPane({ mouseWheelSpeed: 70 }); if (response.length == 0) { - $('#filter-secretaries .results').html('No results found ...') + $('#filter-secretaries .results').html('' + EALang['no_records_found'] + '') } if (selectId != undefined) { diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index ba705df8..1b0804a2 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -267,7 +267,7 @@ var FrontendBook = { response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); GeneralFunctions.displayMessageBox('Unexpected Issues', 'Unfortunately ' + 'the check appointment time availability could not be completed. ' - + 'The following issues occured:'); + + 'The following issues occurred:'); $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions)); return false; } diff --git a/src/assets/js/working_plan.js b/src/assets/js/working_plan.js index b9b6a2d3..4f6e35e0 100644 --- a/src/assets/js/working_plan.js +++ b/src/assets/js/working_plan.js @@ -200,7 +200,7 @@ WorkingPlan.prototype.bindEventHandlers = function() { // Reset previous editable tds var $previousEdt = $(this).closest('table').find('.editable').get(); $.each($previousEdt, function(index, edt) { - edt.reset(); + if (edt.reset !== undefined) edt.reset(); }); // Make all cells in current row editable.