Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Jul 30, 2021
2 parents e762721 + b238006 commit 41f934e
Show file tree
Hide file tree
Showing 37 changed files with 143 additions and 84 deletions.
2 changes: 1 addition & 1 deletion app/admin/actions/FormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ protected function validateFormRequest($model)
return;

if (!class_exists($requestClass))
throw new ApplicationException("Form Request class ($requestClass) not found");
throw new ApplicationException(sprintf(lang('admin::lang.form.request_class_not_found'), $requestClass));

$this->resolveFormRequest($requestClass);
}
Expand Down
9 changes: 3 additions & 6 deletions app/admin/classes/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ protected function processHandlers()
protected function validateHandler($handler)
{
if (!preg_match('/^(?:\w+\:{2})?on[A-Z]{1}[\w+]*$/', $handler)) {
throw new SystemException("Invalid ajax handler name: {$handler}");
throw new SystemException(sprintf(lang('admin::lang.alert_invalid_ajax_handler_name'), $handler));
}
}

Expand All @@ -326,7 +326,7 @@ protected function validateHandlerPartials()

foreach ($partials as $partial) {
if (!preg_match('/^(?:\w+\:{2}|@)?[a-z0-9\_\-\.\/]+$/i', $partial)) {
throw new SystemException("Invalid partial name: $partial");
throw new SystemException(sprintf(lang('admin::lang.alert_invalid_ajax_partial_name'), $partial));
}
}

Expand Down Expand Up @@ -391,10 +391,7 @@ protected function runHandler($handler, $params)
$this->pageAction();

if (!isset($this->widgets[$widgetName])) {
throw new Exception(sprintf(
"A widget with class name '%s' has not been bound to the controller",
$widgetName
));
throw new Exception(sprintf(lang('admin::lang.alert_widget_not_bound_to_controller'), $widgetName));
}

if (($widget = $this->widgets[$widgetName]) AND method_exists($widget, $handlerName)) {
Expand Down
6 changes: 3 additions & 3 deletions app/admin/classes/BasePaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function supportsPaymentProfiles()
*/
public function updatePaymentProfile($customer, $data)
{
throw new SystemException('The updatePaymentProfile() method is not supported by the payment gateway.');
throw new SystemException(lang('admin::lang.payments.alert_update_payment_profile'));
}

/**
Expand All @@ -219,7 +219,7 @@ public function updatePaymentProfile($customer, $data)
*/
public function deletePaymentProfile($customer, $profile)
{
throw new SystemException('The deletePaymentProfile() method is not supported by the payment gateway.');
throw new SystemException(lang('admin::lang.payments.alert_delete_payment_profile'));
}

/**
Expand All @@ -229,7 +229,7 @@ public function deletePaymentProfile($customer, $profile)
*/
public function payFromPaymentProfile($order, $data = [])
{
throw new SystemException('The payFromPaymentProfile() method is not supported by the payment gateway.');
throw new SystemException(lang('admin::lang.payments.alert_pay_from_payment_profile'));
}

//
Expand Down
4 changes: 2 additions & 2 deletions app/admin/classes/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public function isSuperUser()
*/
public function staff()
{
return $this->user()->staff;
return optional($this->user())->staff;
}

/**
* @return \Illuminate\Database\Eloquent\Collection
*/
public function locations()
{
return $this->user()->staff->locations;
return optional($this->staff())->locations;
}

//
Expand Down
2 changes: 1 addition & 1 deletion app/admin/controllers/Menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function edit_onChooseMenuOption($context, $recordId)
{
$menuOptionId = post('Menu._options');
if (!$menuOption = Menu_options_model::find($menuOptionId))
throw new ApplicationException('Please select a menu option to attach');
throw new ApplicationException(lang('admin::lang.menus.alert_menu_option_not_attached'));

$model = $this->asExtension('FormController')->formFindModelObject($recordId);

Expand Down
2 changes: 1 addition & 1 deletion app/admin/controllers/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function invoice($context, $recordId = null)
$model = $this->formFindModelObject($recordId);

if (!$model->hasInvoice())
throw new ApplicationException('Invoice has not yet been generated');
throw new ApplicationException(lang('admin::lang.orders.alert_invoice_not_generated'));

$this->vars['model'] = $model;

Expand Down
4 changes: 2 additions & 2 deletions app/admin/controllers/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected function getGateway($code)
}

if (!$gateway = PaymentGateways::instance()->findGateway($code)) {
throw new Exception('Unable to find payment gateway with code '.$code);
throw new Exception(sprintf(lang('admin::lang.payments.alert_code_not_found'), $code));
}

return $this->gateway = $gateway;
Expand Down Expand Up @@ -133,7 +133,7 @@ public function formExtendFields($form)
public function formBeforeCreate($model)
{
if (!strlen($code = post('Payment.payment')))
throw new ApplicationException('Invalid payment gateway code selected');
throw new ApplicationException(lang('admin::lang.payments.alert_invalid_code'));

$paymentGateway = PaymentGateways::instance()->findGateway($code);

Expand Down
2 changes: 1 addition & 1 deletion app/admin/controllers/Reservations.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function calendarGenerateEvents($startAt, $endAt)
public function calendarUpdateEvent($eventId, $startAt, $endAt)
{
if (!$reservation = Reservations_model::find($eventId))
throw new Exception('No matching reservation found');
throw new Exception(lang('admin::lang.reservations.alert_no_reservation_found'));

$startAt = make_carbon($startAt);
$endAt = make_carbon($endAt);
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public function onLoadRecord()
$model = $this->getRelationModel()->find($recordId);

if (!$model)
throw new ApplicationException('Record not found');
throw new ApplicationException(lang('admin::lang.form.record_not_found'));

return $this->makePartial('recordeditor/form', [
'formRecordId' => $recordId,
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function getDataTableOptions($field, $data)
$methodName = 'get'.studly_case($this->fieldName).'DataTableOptions';

if (!$this->model->methodExists($methodName) AND !$this->model->methodExists('getDataTableOptions')) {
throw new Exception(sprintf('Missing method [%s] in %s', 'getDataTableOptions', get_class($this->model)));
throw new Exception(sprintf(lang('admin::lang.alert_missing_method'), 'getDataTableOptions', get_class($this->model)));
}

if ($this->model->methodExists($methodName)) {
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/MapArea.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public function onSaveRecord()
public function onDeleteArea()
{
if (!strlen($areaId = post('areaId')))
throw new ApplicationException('Invalid area selected');
throw new ApplicationException(lang('admin::lang.locations.alert_invalid_area'));

$model = $this->getRelationModel()->find($areaId);
if (!$model)
Expand Down
4 changes: 2 additions & 2 deletions app/admin/formwidgets/MediaFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ public function onAddAttachment()

$items = post('items');
if (!is_array($items))
throw new ApplicationException('Select an item to attach');
throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach'));

$model = $this->model;
if (!$model->exists)
throw new ApplicationException('You can only attach media to a saved form');
throw new ApplicationException(lang('main::lang.media_manager.alert_only_attach_to_saved'));

$manager = MediaLibrary::instance();
foreach ($items as &$item) {
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/RecordEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected function getRecordEditorOptions()
$methodName = 'get'.studly_case($this->fieldName).'RecordEditorOptions';

if (!$model->methodExists($methodName) AND !$model->methodExists('getRecordEditorOptions')) {
throw new ApplicationException(sprintf('Missing method [%s] in %s', 'getRecordEditorOptions', get_class($model)));
throw new ApplicationException(sprintf(lang('admin::lang.alert_missing_method'), 'getRecordEditorOptions', get_class($model)));
}

if ($model->methodExists($methodName)) {
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function getRelationObject()
[$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);

if (!$model OR !$model->hasRelation($attribute)) {
throw new Exception(sprintf("Model '%s' does not contain a definition for '%s'.",
throw new Exception(sprintf(lang('admin::lang.alert_missing_model_definition'),
get_class($this->model),
$this->valueFrom
));
Expand Down
2 changes: 1 addition & 1 deletion app/admin/formwidgets/ScheduleEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function onSaveRecord()
protected function getSchedule($scheduleCode)
{
if (!$schedule = array_get($this->listSchedules(), $scheduleCode))
throw new ApplicationException('Schedule not loaded');
throw new ApplicationException(lang('admin::lang.locations.alert_schedule_not_loaded'));

return $schedule;
}
Expand Down
4 changes: 2 additions & 2 deletions app/admin/formwidgets/StatusEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function onLoadRecord()
{
$context = post('recordId');
if (!in_array($context, ['load-status', 'load-assignee']))
throw new ApplicationException('Invalid action');
throw new ApplicationException(lang('admin::lang.statuses.alert_invalid_action'));

$this->setMode(str_after($context, 'load-'));

Expand Down Expand Up @@ -193,7 +193,7 @@ public function onLoadStatus()
throw new ApplicationException(lang('admin::lang.form.missing_id'));

if (!$status = Statuses_model::find($statusId))
throw new Exception('Status ID ['.$statusId.'] not found.');
throw new Exception(sprintf(lang('admin::lang.statuses.alert_status_not_found'), $statusId));

return $status->toArray();
}
Expand Down
2 changes: 1 addition & 1 deletion app/admin/jobs/AllocateAssignable.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle()
Allocator::addSlot($this->assignableLog->getKey());

if (!$assignee = $this->assignableLog->assignee_group->findAvailableAssignee())
throw new Exception('No available assignee');
throw new Exception(lang('admin::lang.staff_groups.alert_no_available_assignee'));

$this->assignableLog->assignable->assignTo($assignee);

Expand Down
53 changes: 52 additions & 1 deletion app/admin/language/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@
'alert_warning_locationable_delete' => 'Warning: You do not have the right permission to delete record(s) attached to multiple locations, please contact the system administrator.',
'alert_form_error_message' => 'Sorry but form validation has failed, please check for errors.',
'alert_error_set_default' => '"%s" is disabled and cannot be set as default.',
'alert_missing_method' => 'Missing method [%s] in %s.',
'alert_missing_model_definition' => "Model '%s' does not contain a definition for '%s'.",
'alert_valid_values' => 'Valid values for [locationAware] property are (none,show,hide).',
'alert_widget_class_name' => "The Widget class name '%s' has not been registered",
'alert_missing_field_property' => "Missing form field property 'modelClass' in '%s'",
'alert_invalid_ajax_handler_name' => 'Invalid ajax handler name: %s',
'alert_invalid_ajax_partial_name' => 'Invalid partial name: %s',
'alert_widget_not_bound_to_controller' => "A widget with class name '%s' has not been bound to the controller",
'alert_user_not_logged' => 'User is not logged in',
'alert_access_denied' => 'Access denied.',
'alert_invalid_csrf_token' => 'Invalid security token, please reload the page and try again.',
'text_settings_title' => 'Settings',
'text_message_title' => 'Your messages',
Expand Down Expand Up @@ -172,14 +182,19 @@
'tool' => 'Tools',
'media_manager' => 'Media Manager',
'system' => 'System',

'alert_no_definition' => 'No definition for item %s.',
'alert_invalid_menu' => 'Invalid item specified.',
'alert_menu_not_found' => 'No main menu item found matching {%s}.',
'alert_invalid_status' => 'Status message is required.',
],

'list' => [
'missing_model' => 'List action used in %s does not have a model defined.',
'missing_definitions' => 'List action used in %s does not have definitions.',
'missing_column' => 'Missing columns in List definitions %s',
'invalid_column_datetime' => 'Column value \'%s\' is not a DateTime object, are you missing a $dates reference in the Model?',
'delete_empty' => 'Nothing selected to delete.',
'missing_column' => 'List used in %s has no list columns defined.',
'text_empty' => 'Nothing found.',
'text_setup' => 'Setup',
'text_showing' => 'Showing %s-%s of %s records',
Expand All @@ -189,8 +204,11 @@
'button_reset_setup' => 'Reset',
'button_cancel_setup' => 'Cancel',
'button_apply_setup' => 'Apply changes',
'filter_missing_definitions' => "The model class %s must define a method %s returning options for the '%s' filter.",
'filter_missing_scope_definitions' => 'No definition for scope %s',
'help_visible_columns' => 'Set which columns are visible and in what order to display them',
'help_page_limit' => 'Limit how many records are shown per page',
'alert_relationship_not_supported' => 'The relationship %s is not supported for list columns.',
],

'calendar' => [
Expand Down Expand Up @@ -224,6 +242,9 @@
'missing_id' => 'Form record ID has not been specified.',
'not_found' => 'Form record with ID [%s] could not be found.',
'mass_assignment_failed' => "Mass assignment failed for Model attribute ':attribute'.",
'record_not_found' => 'Record not found.',
'request_class_not_found' => 'Form Request class (%s) not found',
'record_not_found_in_model' => 'Record ID [%s] not found in model %s.',

'save_actions' => [
'continue' => 'Continue Editing',
Expand Down Expand Up @@ -311,6 +332,8 @@
'alert_login_restricted' => 'Warning: You do not have the right permission to <b>access a customer account</b>, please contact system administrator.',
'alert_impersonate_confirm' => 'Are you sure you want to impersonate this customer? You can revert to your original state by logging out.',
'alert_impersonate_success' => 'You are now impersonating customer: %s',
'alert_customer_not_active' => "Cannot login user '%s' until activated.",
'alert_customer_payment_profile_not_found' => 'Customer payment profile not found!',
],

'dashboard' => [
Expand Down Expand Up @@ -370,6 +393,15 @@
'text_select_range' => 'Select date range',
'text_last_version_check' => 'Your last <b>TastyIgniter core version check</b> was more than a week ago. <a href="%s"><b>Check for Updates</b></a>',

'alert_select_widget_to_update' => 'Please select a widget to update.',
'alert_select_widget_to_add' => 'Please select a widget to add.',
'alert_widget_class_not_found' => 'The selected class does not exist.',
'alert_invalid_widget' => 'The selected class is not a dashboard widget.',
'alert_invalid_aliases' => 'Invalid aliases string.',
'alert_invalid_priorities' => "'Invalid priorities string.'",
'alert_invalid_data_posted' => 'Invalid data posted.',
'alert_widget_not_found' => 'The specified widget is not found.',

'onboarding' => [
'title' => 'Getting started',
'label_settings' => 'Complete required system settings',
Expand Down Expand Up @@ -527,6 +559,9 @@
'alert_set_default' => 'Location set as default',
'alert_missing_map_center' => 'Map is missing center coordinates, please enter an address then click save.',
'alert_missing_map_config' => 'Missing Google Maps Javascript Library, please provide your maps api key on the general system settings page.',
'alert_invalid_area' => 'Invalid area selected.',
'alert_schedule_not_loaded' => 'Schedule not loaded.',
'alert_invalid_schedule_type' => "Defined parameter '%s' is not a valid working type.",

'help_permalink_disabled' => 'Permalink is disabled when single location mode is activated.',
'help_image' => 'Select a logo for this location.',
Expand Down Expand Up @@ -685,6 +720,7 @@
'help_max_selected' => 'Maximum items to select from these options, leave blank to ignore.',
'help_option_required' => 'Select Enabled if a customer MUST choose this option. If this option is not required, select Disabled.',
'help_specials' => 'Select disable to deactivate Special. Select Enable to activate Special and enter the Start Date, End Date and price of your Special item.',
'alert_menu_option_not_attached' => 'Please select a menu option to attach.',
],

'orders' => [
Expand Down Expand Up @@ -759,6 +795,8 @@
'activity_event_log_assigned_title' => 'Order assigned',
'activity_event_log' => 'updated order (#:properties.order_id) status to <b>:properties.status_name</b>',
'activity_event_log_assigned' => 'assigned order (#:properties.order_id) to',

'alert_invoice_not_generated' => 'Invoice has not yet been generated.',
],

'payments' => [
Expand All @@ -774,6 +812,11 @@
'label_priority' => 'Priority',

'alert_setting_missing_id' => 'Extension setting code has not been specified.',
'alert_invalid_code' => 'Invalid payment gateway code selected.',
'alert_code_not_found' => 'Unable to find payment gateway with code %s',
'alert_update_payment_profile' => 'The updatePaymentProfile() method is not supported by the payment gateway.',
'alert_delete_payment_profile' => 'The deletePaymentProfile() method is not supported by the payment gateway.',
'alert_pay_from_payment_profile' => 'The payFromPaymentProfile() method is not supported by the payment gateway.',
],

'permissions' => [
Expand Down Expand Up @@ -857,6 +900,8 @@
'activity_event_log_assigned_title' => 'Reservation assigned',
'activity_event_log' => 'updated reservation (#:properties.reservation_id) status to <b>:properties.status_name</b>',
'activity_event_log_assigned' => 'assigned reservation (#:properties.reservation_id) to',

'alert_no_reservation_found' => 'No matching reservation found.',
],

'settings' => [
Expand All @@ -881,6 +926,8 @@

'column_users' => '# Users',

'alert_no_available_assignee' => 'No available assignee.',

'help_auto_assign' => 'Allocate and control the number of orders assigned to staff in this group.',
'help_round_robin' => 'Assign orders to the staff who are online in a circular fashion.',
'help_load_balanced' => 'Limit the number of orders a staff can handle simultaneously.',
Expand Down Expand Up @@ -966,6 +1013,8 @@
'help_assignee_group' => 'A notification is sent out to all the staff in the selected group',

'alert_already_added' => 'The selected %s must be different from the current %s',
'alert_invalid_action' => 'Invalid action.',
'alert_status_not_found' => 'Status ID [%s] not found.',
],

'tables' => [
Expand All @@ -990,5 +1039,7 @@
'help_extra_capacity' => 'Used internally by the staff to determine table convenience/inconvenience.',

'error_capacity' => 'The Maximum capacity value must be greater than minimum capacity value.',
'error_table_widget_data_not_specified' => 'The Table widget data source is not specified in the configuration.',
'error_table_widget_data_class_not_found' => 'The Table widget data source class "%s" could not be found.',
],
];
3 changes: 1 addition & 2 deletions app/admin/models/Customers_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ public function beforeLogin()
if ($this->is_activated OR $this->status)
return;

throw new Exception(sprintf(
'Cannot login user "%s" until activated.', $this->email
throw new Exception(sprintf(lang('admin::lang.customers.alert_customer_not_active'), $this->email
));
}

Expand Down
Loading

0 comments on commit 41f934e

Please sign in to comment.