Skip to content

Commit

Permalink
Merge pull request #74 from sampoyigi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sampoyigi committed Aug 11, 2015
2 parents 93c66e1 + 7bedd45 commit f349d35
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
14 changes: 7 additions & 7 deletions admin/controllers/Locations.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,13 @@ private function validateForm() {

if ($this->input->post('delivery_areas')) {
foreach ($this->input->post('delivery_areas') as $key => $value) {
$this->form_validation->set_rules('delivery_areas['.$key.'][shape]', $key.' lang:label_area_shape', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][circle]', $key.' lang:label_area_circle', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][vertices]', $key.' lang:label_area_vertices', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][type]', $key.' lang:label_area_type', 'xss_clean|trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][name]', $key.' lang:label_area_name', 'xss_clean|trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][charge]', $key.' lang:label_area_charge', 'xss_clean|trim|required|numeric');
$this->form_validation->set_rules('delivery_areas['.$key.'][min_amount]', $key.' lang:label_area_min_amount', 'xss_clean|trim|required|numeric');
$this->form_validation->set_rules('delivery_areas['.$key.'][shape]', 'lang:label_area_shape', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][circle]', 'lang:label_area_circle', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][vertices]', 'lang:label_area_vertices', 'trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][type]', 'lang:label_area_type', 'xss_clean|trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][name]', 'lang:label_area_name', 'xss_clean|trim|required');
$this->form_validation->set_rules('delivery_areas['.$key.'][charge]', 'lang:label_area_charge', 'xss_clean|trim|required|numeric');
$this->form_validation->set_rules('delivery_areas['.$key.'][min_amount]', 'lang:label_area_min_amount', 'xss_clean|trim|required|numeric');
}
}

Expand Down
10 changes: 5 additions & 5 deletions main/controllers/Checkout.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ public function __construct() {
public function index() {
if ( ! $this->cart->contents()) { // checks if cart contents is empty
$this->alert->set('alert', $this->lang->line('alert_no_menu_to_order'));
redirect(referrer_url()); // redirect to menus page and display error
redirect(restaurant_url()); // redirect to menus page and display error
}

if ($this->config->item('location_order') === '1' AND ! $this->location->hasSearchQuery()) { // else if local restaurant is not selected
$this->alert->set('alert', $this->lang->line('alert_no_selected_local'));
redirect(referrer_url()); // redirect to menus page and display error
redirect(restaurant_url()); // redirect to menus page and display error
}

if ( ! $this->location->isOpened() AND $this->config->item('future_orders') !== '1') { // else if local restaurant is not open
$this->alert->set('alert', $this->lang->line('alert_location_closed'));
redirect(referrer_url()); // redirect to previous page and display error
redirect(restaurant_url()); // redirect to previous page and display error
}

if (( ! $this->location->hasDelivery() AND ! $this->location->hasCollection()) AND $this->config->item('location_order') === '1') { // else if local restaurant is not open
$this->alert->set('alert', $this->lang->line('alert_order_unavailable'));
redirect(referrer_url()); // redirect to previous page and display error
redirect(restaurant_url()); // redirect to previous page and display error
}

if ($this->location->orderType() === '1' AND ! $this->location->checkMinimumOrder($this->cart->total())) { // checks if cart contents is empty
redirect(referrer_url()); // redirect to previous page and display error
redirect(restaurant_url()); // redirect to previous page and display error
}

if ( ! $this->customer->islogged() AND $this->config->item('guest_order') !== '1') { // else if customer is not logged in
Expand Down
31 changes: 24 additions & 7 deletions system/tastyigniter/helpers/TI_url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@ function admin_url($uri = '', $protocol = NULL)
return get_instance()->config->root_url(ADMINDIR.'/'.$uri, $protocol);
}
}
if ( ! function_exists('roott_url'))
{
function roott_url($uri = '', $protocol = NULL)
{
return get_instance()->config->root_url(ADMINDIR.'/'.$uri, $protocol);
}
}

// ------------------------------------------------------------------------

Expand Down Expand Up @@ -154,6 +147,30 @@ function page_url()

// ------------------------------------------------------------------------

/**
* Restaurant URL
*
* Returns the full URL (including segments) of the local restaurant if any,
* else locations URL is returned
*
* @access public
* @return string
*/
if ( ! function_exists('restaurant_url'))
{
function restaurant_url()
{
$CI =& get_instance();
if (isset($CI->location) AND !empty($CI->location->getId())) {
return site_url('local?location_id='.$CI->location->getId());
} else {
return site_url('locations');
}
}
}

// ------------------------------------------------------------------------

/**
* Referrer URL
*
Expand Down
2 changes: 1 addition & 1 deletion system/tastyigniter/migrations/initial_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ VALUES
(14, 'module', 'cart_module', 'a:3:{s:16:\"show_cart_images\";s:1:\"0\";s:13:\"cart_images_h\";s:0:\"\";s:13:\"cart_images_w\";s:0:\"\";}', 1, 1, 'Cart'),
(15, 'module', 'reservation_module', 'a:1:{s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"16\";s:8:\"position\";s:4:\"left\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}}', 1, 1, 'Reservation'),
(16, 'module', 'slideshow', 'a:6:{s:11:\"dimension_h\";s:3:\"420\";s:11:\"dimension_w\";s:4:\"1170\";s:6:\"effect\";s:4:\"fade\";s:5:\"speed\";s:3:\"500\";s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"15\";s:8:\"position\";s:3:\"top\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}s:6:\"slides\";a:3:{i:0;a:3:{s:4:\"name\";s:9:\"slide.png\";s:9:\"image_src\";s:14:\"data/slide.jpg\";s:7:\"caption\";s:0:\"\";}i:1;a:3:{s:4:\"name\";s:10:\"slide1.png\";s:9:\"image_src\";s:15:\"data/slide1.jpg\";s:7:\"caption\";s:0:\"\";}i:2;a:3:{s:4:\"name\";s:10:\"slide2.png\";s:9:\"image_src\";s:15:\"data/slide2.jpg\";s:7:\"caption\";s:0:\"\";}}}', 1, 1, 'Slideshow'),
(18, 'payment', 'cod', 'a:5:{s:4:\"name\";N;s:11:\"order_total\";s:7:\"1000.00\";s:12:\"order_status\";s:2:\"11\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}', 1, 1, 'Cash On Delivery'),
(18, 'payment', 'cod', 'a:5:{s:4:\"name\";N;s:11:\"order_total\";s:4:\"0.00\";s:12:\"order_status\";s:2:\"11\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}', 1, 1, 'Cash On Delivery'),
(20, 'module', 'pages_module', 'a:1:{s:7:\"layouts\";a:1:{i:0;a:4:{s:9:\"layout_id\";s:2:\"17\";s:8:\"position\";s:5:\"right\";s:8:\"priority\";s:1:\"1\";s:6:\"status\";s:1:\"1\";}}}', 1, 1, 'Pages'),
(21, 'payment', 'paypal_express', 'a:11:{s:8:\"priority\";s:0:\"\";s:6:\"status\";s:1:\"0\";s:8:\"api_mode\";s:7:\"sandbox\";s:8:\"api_user\";s:0:\"\";s:8:\"api_pass\";s:0:\"\";s:13:\"api_signature\";s:0:\"\";s:10:\"api_action\";s:4:\"sale\";s:10:\"return_uri\";s:24:\"paypal_express/authorize\";s:10:\"cancel_uri\";s:21:\"paypal_express/cancel\";s:11:\"order_total\";s:4:\"0.00\";s:12:\"order_status\";s:2:\"11\";}', 1, 1, 'PayPal Express'),
(23, 'theme', 'tastyigniter-orange', 'a:13:{s:11:\"logo_height\";s:2:\"40\";s:16:\"logo_padding_top\";s:2:\"25\";s:19:\"logo_padding_bottom\";s:2:\"25\";s:11:\"font_family\";s:25:\"\"Oxygen\",Arial,sans-serif\";s:11:\"font_weight\";s:6:\"normal\";s:9:\"font_size\";s:2:\"13\";s:10:\"font_color\";s:7:\"#333333\";s:4:\"body\";a:2:{s:10:\"background\";s:7:\"#ffffff\";s:5:\"image\";s:0:\"\";}s:6:\"header\";a:3:{s:10:\"background\";s:7:\"#fdeae2\";s:5:\"image\";s:0:\"\";s:5:\"color\";s:7:\"#333333\";}s:7:\"sidebar\";a:4:{s:10:\"background\";s:7:\"#ffffff\";s:5:\"image\";s:0:\"\";s:4:\"font\";s:7:\"#484848\";s:6:\"border\";s:7:\"#ffffff\";}s:4:\"link\";a:2:{s:5:\"color\";s:7:\"#428bca\";s:5:\"hover\";s:7:\"#2a6496\";}s:6:\"button\";a:4:{s:7:\"default\";a:2:{s:10:\"background\";s:7:\"#ffffff\";s:6:\"border\";s:7:\"#cccccc\";}s:7:\"primary\";a:2:{s:10:\"background\";s:7:\"#428bca\";s:6:\"border\";s:7:\"#357ebd\";}s:7:\"success\";a:2:{s:10:\"background\";s:7:\"#5cb85c\";s:6:\"border\";s:7:\"#4cae4c\";}s:6:\"danger\";a:2:{s:10:\"background\";s:7:\"#d9534f\";s:6:\"border\";s:7:\"#d43f3a\";}}s:10:\"custom_css\";s:0:\"\";}', 1, 1, 'TastyIgniter Orange'),
Expand Down

0 comments on commit f349d35

Please sign in to comment.