public function pjActionIndex() { $this->checkLogin(); if ($this->isAdmin()) { if (isset($_POST['working_time'])) { $pjWorkingTimeModel = pjWorkingTimeModel::factory(); $arr = $pjWorkingTimeModel->find($_POST['location_id'])->getData(); $data = array(); $data['location_id'] = $_POST['location_id']; $types = array('p_' => 'pickup', 'd_' => 'delivery'); $weekDays = pjUtil::getWeekdays(); foreach ($types as $prefix => $type) { foreach ($weekDays as $day) { if (!isset($_POST[$prefix . $day . '_dayoff'])) { $data[$prefix . $day . '_from'] = $_POST[$prefix . $day . '_hour_from'] . ":" . $_POST[$prefix . $day . '_minute_from']; $data[$prefix . $day . '_to'] = $_POST[$prefix . $day . '_hour_to'] . ":" . $_POST[$prefix . $day . '_minute_to']; } } } if (count($arr) > 0) { $pjWorkingTimeModel->reset()->setAttributes(array('location_id' => $_POST['location_id']))->erase(); } $pjWorkingTimeModel->reset()->setAttributes($data)->insert(); pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminTime&action=pjActionIndex&id=" . $_POST['location_id'] . "&err=AT01"); } if (isset($_POST['custom_time'])) { $date = pjUtil::formatDate($_POST['date'], $this->option_arr['o_date_format']); $pjDateModel = pjDateModel::factory(); $pjDateModel->where('type', $_POST['type'])->where('date', $date)->eraseAll(); $data = array(); $data['location_id'] = $_POST['location_id']; $data['start_time'] = join(":", array($_POST['start_hour'], $_POST['start_minute'])); $data['end_time'] = join(":", array($_POST['end_hour'], $_POST['end_minute'])); $data['date'] = $date; $data['type'] = $_POST['type']; $data['is_dayoff'] = $_POST['is_dayoff']; $pjDateModel->reset()->setAttributes($data)->insert(); pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminTime&action=pjActionIndex&id=" . $_POST['location_id'] . "&err=AT02&tab_id=tabs-2"); } $arr = pjLocationModel::factory()->find($_GET['id'])->getData(); if (count($arr) === 0) { pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminLocations&action=pjActionIndex&err=AL08"); } $arr['i18n'] = pjMultiLangModel::factory()->getMultiLang($arr['id'], 'pjLocation'); $this->set('arr', $arr); $this->set('wt_arr', pjWorkingTimeModel::factory()->find($_GET['id'])->getData()); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('additional-methods.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('jquery.datagrid.js', PJ_FRAMEWORK_LIBS_PATH . 'pj/js/'); $this->appendJs('pjAdminTime.js'); } else { $this->set('status', 2); } }
public function pjActionGetWTime() { $this->setAjax(true); if ($this->isXHR()) { if (isset($_POST['date']) && !empty($_POST['date'])) { $date = pjUtil::formatDate($_POST['date'], $this->option_arr['o_date_format']); $wt_arr = pjAppController::getWorkingTime($date, $_POST['location_id'], $_POST['type']); } else { $date = '1981-02-01'; $wt_arr = array('start_hour' => 0, 'end_hour' => 23); $this->_set('p_hour', 0); $this->_set('p_minute', 0); $this->_set('d_hour', 0); $this->_set('d_minute', 0); } $this->tpl['date'] = $date; $this->tpl['wt_arr'] = $wt_arr; } }
" />--> <input type="text" name="p_date" id="fd_p_date_<?php echo $index; ?> " class="fdText fdPointer fdW70 fdDatepick fdFloatLeft fdMr5 fdPickupDate" readonly="readonly" value="<?php echo htmlspecialchars(stripslashes(@$STORAGE['p_date'])); ?> " /> <span class="fdInlineBlock fdPickupTime"> <?php $p_hour = isset($STORAGE['p_hour']) ? $STORAGE['p_hour'] : NULL; $p_minute = isset($STORAGE['p_minute']) ? $STORAGE['p_minute'] : NULL; $opts = array('start' => 0, 'end' => 23, 'skip' => array()); $options = array('start' => 0, 'end' => 59, 'skip' => array()); if (isset($tpl['wt_arr'])) { $date = pjUtil::formatDate(@$STORAGE['p_date'], $tpl['option_arr']['o_date_format']); $opts['start'] = (int) $tpl['wt_arr']['start_hour']; $opts['end'] = (int) $tpl['wt_arr']['end_hour']; $opts['skip'] = array(); if ((int) $tpl['wt_arr']['end_hour'] == (int) $p_hour) { $options['end'] = $tpl['wt_arr']['end_minutes']; } elseif ((int) $tpl['wt_arr']['start_hour'] == (int) $p_hour) { $options['start'] = $tpl['wt_arr']['start_minutes']; } $options['skip'] = array(); if (strtotime($date) == strtotime(date("Y-m-d"))) { list($hour, $minute) = explode("-", date("G-i")); foreach (range(0, 23) as $i) { if ($i < $hour) { $opts['skip'][] = $i; }
public function pjActionUpdate() { $this->checkLogin(); if ($this->isAdmin()) { if (isset($_POST['voucher_update'])) { $data = array(); $data['code'] = $_POST['code']; $data['discount'] = $_POST['discount']; $data['type'] = $_POST['type']; $data['valid'] = $_POST['valid']; switch ($_POST['valid']) { case 'fixed': $data['date_from'] = pjUtil::formatDate($_POST['f_date'], $this->option_arr['o_date_format']); $data['date_to'] = $data['date_from']; $data['time_from'] = $_POST['f_hour_from'] . ":" . $_POST['f_minute_from'] . ":00"; $data['time_to'] = $_POST['f_hour_to'] . ":" . $_POST['f_minute_to'] . ":00"; $data['every'] = array('NULL'); break; case 'period': $data['date_from'] = pjUtil::formatDate($_POST['p_date_from'], $this->option_arr['o_date_format']); $data['date_to'] = pjUtil::formatDate($_POST['p_date_to'], $this->option_arr['o_date_format']); $data['time_from'] = $_POST['p_hour_from'] . ":" . $_POST['p_minute_from'] . ":00"; $data['time_to'] = $_POST['p_hour_to'] . ":" . $_POST['p_minute_to'] . ":00"; $data['every'] = array('NULL'); break; case 'recurring': $data['date_from'] = array('NULL'); $data['date_to'] = array('NULL'); $data['every'] = $_POST['r_every']; $data['time_from'] = $_POST['r_hour_from'] . ":" . $_POST['r_minute_from'] . ":00"; $data['time_to'] = $_POST['r_hour_to'] . ":" . $_POST['r_minute_to'] . ":00"; break; } pjVoucherModel::factory()->where('id', $_POST['id'])->limit(1)->modifyAll($data); pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminVouchers&action=pjActionIndex&err=AV01"); } else { $arr = pjVoucherModel::factory()->find($_GET['id'])->getData(); if (count($arr) === 0) { pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminVouchers&action=pjActionIndex&err=AV08"); } $this->set('arr', $arr); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('additional-methods.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('pjAdminVouchers.js'); } } else { $this->set('status', 2); } }
public function pjActionUpdate() { $this->checkLogin(); if ($this->isAdmin() || $this->isEditor()) { if (isset($_POST['order_update'])) { $pjOrderModel = pjOrderModel::factory(); $pjOrderItemModel = pjOrderItemModel::factory(); $pjProductPriceModel = pjProductPriceModel::factory(); $pjExtraModel = pjExtraModel::factory(); $pjProductModel = pjProductModel::factory(); $arr = $pjOrderModel->find($_POST['id'])->getData(); if (empty($arr)) { pjUtil::redirect($_SERVER['PHP_SELF'] . "?controller=pjAdminOrders&action=pjActionIndex&err=AR08"); } if (isset($_POST['product_id']) && count($_POST['product_id']) > 0) { $keys = array_keys($_POST['product_id']); $pjOrderItemModel->reset()->where('order_id', $_POST['id'])->whereNotIn('hash', $keys)->eraseAll(); $pjOrderItemModel->reset()->where('order_id', $_POST['id'])->where('type', 'extra')->eraseAll(); foreach ($_POST['product_id'] as $k => $pid) { $product = $pjProductModel->reset()->find($pid)->getData(); $price = 0; $price_id = ":NULL"; if ($product['set_different_sizes'] == 'T') { $price_id = $_POST['price_id'][$k]; $price_arr = $pjProductPriceModel->reset()->find($price_id)->getData(); if ($price_arr) { $price = $price_arr['price']; } } else { $price = $product['price']; } if (strpos($k, 'new_') === 0) { $hash = md5(uniqid(rand(), true)); $oid = $pjOrderItemModel->reset()->setAttributes(array('order_id' => $_POST['id'], 'foreign_id' => $pid, 'type' => 'product', 'hash' => $hash, 'price_id' => $price_id, 'price' => $price, 'cnt' => $_POST['cnt'][$k]))->insert()->getInsertId(); if ($oid !== false && (int) $oid > 0) { if (isset($_POST['extra_id']) && isset($_POST['extra_id'][$k])) { foreach ($_POST['extra_id'][$k] as $i => $eid) { $extra_price = 0; $extra_arr = $pjExtraModel->reset()->find($eid)->getData(); if (!empty($extra_arr) && !empty($extra_arr['price'])) { $extra_price = $extra_arr['price']; } $pjOrderItemModel->reset()->setAttributes(array('order_id' => $_POST['id'], 'foreign_id' => $eid, 'type' => 'extra', 'hash' => $hash, 'price_id' => ':NULL', 'price' => $extra_price, 'cnt' => $_POST['extra_cnt'][$k][$i]))->insert(); } } } } else { $pjOrderItemModel->reset()->where('hash', $k)->where('type', 'product')->limit(1)->modifyAll(array('foreign_id' => $pid, 'cnt' => $_POST['cnt'][$k], 'price_id' => $price_id, 'price' => $price)); if (isset($_POST['extra_id']) && isset($_POST['extra_id'][$k])) { foreach ($_POST['extra_id'][$k] as $i => $eid) { $extra_price = 0; $extra_arr = $pjExtraModel->reset()->find($eid)->getData(); if (!empty($extra_arr) && !empty($extra_arr['price'])) { $extra_price = $extra_arr['price']; } $pjOrderItemModel->reset()->setAttributes(array('order_id' => $_POST['id'], 'foreign_id' => $eid, 'type' => 'extra', 'hash' => $k, 'price_id' => ':NULL', 'price' => $extra_price, 'cnt' => $_POST['extra_cnt'][$k][$i]))->insert(); } } } } } $data = array(); $data['ip'] = pjUtil::getClientIp(); switch ($_POST['type']) { case 'pickup': if (!empty($_POST['p_dt'])) { $date_time = $_POST['p_dt']; if (count(explode(" ", $date_time)) == 3) { list($_date, $_time, $_period) = explode(" ", $date_time); $time = pjUtil::formatTime($_time . ' ' . $_period, $this->option_arr['o_time_format']); } else { list($_date, $_time) = explode(" ", $date_time); $time = pjUtil::formatTime($_time, $this->option_arr['o_time_format']); } unset($_POST['p_dt']); unset($_POST['d_dt']); $data['p_dt'] = pjUtil::formatDate($_date, $this->option_arr['o_date_format']) . ' ' . $time; } if (isset($_POST['p_location_id']) && (int) $_POST['p_location_id'] > 0) { $data['location_id'] = $_POST['p_location_id']; } break; case 'delivery': if (!empty($_POST['d_dt'])) { $date_time = $_POST['d_dt']; if (count(explode(" ", $date_time)) == 3) { list($_date, $_time, $_period) = explode(" ", $date_time); $time = pjUtil::formatTime($_time . ' ' . $_period, $this->option_arr['o_time_format']); } else { list($_date, $_time) = explode(" ", $date_time); $time = pjUtil::formatTime($_time, $this->option_arr['o_time_format']); } unset($_POST['p_dt']); unset($_POST['d_dt']); $data['d_dt'] = pjUtil::formatDate($_date, $this->option_arr['o_date_format']) . ' ' . $time; } if (isset($_POST['d_location_id']) && (int) $_POST['d_location_id'] > 0) { $data['location_id'] = $_POST['d_location_id']; } break; } if ($_POST['payment_method'] == 'creditcard') { $data['cc_exp'] = $_POST['cc_exp_month'] . "/" . $_POST['cc_exp_year']; } $pjOrderModel->reset()->where('id', $_POST['id'])->limit(1)->modifyAll(array_merge($_POST, $data)); $err = 'AR01'; pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminOrders&action=pjActionIndex&err={$err}"); } else { $arr = pjOrderModel::factory()->join('pjClient', "t2.id=t1.client_id", 'left outer')->select('t1.*,t2.c_name as client_name')->find($_GET['id'])->getData(); if (count($arr) <= 0) { pjUtil::redirect(PJ_INSTALL_URL . "index.php?controller=pjAdminOrders&action=pjActionIndex&err=AR08"); } $this->set('arr', $arr); $country_arr = pjCountryModel::factory()->select('t1.id, t2.content AS country_title')->join('pjMultiLang', "t2.model='pjCountry' AND t2.foreign_id=t1.id AND t2.field='name' AND t2.locale='" . $this->getLocaleId() . "'", 'left outer')->orderBy('`country_title` ASC')->findAll()->getData(); $this->set('country_arr', $country_arr); $product_arr = pjProductModel::factory()->join('pjMultiLang', "t2.foreign_id = t1.id AND t2.model = 'pjProduct' AND t2.locale = '" . $this->getLocaleId() . "' AND t2.field = 'name'", 'left')->select("t1.*, t2.content AS name, (SELECT GROUP_CONCAT(extra_id SEPARATOR '~:~') FROM `" . pjProductExtraModel::factory()->getTable() . "` WHERE product_id = t1.id GROUP BY product_id LIMIT 1) AS allowed_extras ")->orderBy("name ASC")->findAll()->toArray('allowed_extras', '~:~')->getData(); $this->set('product_arr', $product_arr); $location_arr = pjLocationModel::factory()->join('pjMultiLang', "t2.foreign_id = t1.id AND t2.model = 'pjLocation' AND t2.locale = '" . $this->getLocaleId() . "' AND t2.field = 'name'", 'left')->select("t1.*, t2.content AS name")->orderBy("name ASC")->findAll()->getData(); $this->set('location_arr', $location_arr); $extra_arr = pjExtraModel::factory()->join('pjMultiLang', "t2.foreign_id = t1.id AND t2.model = 'pjExtra' AND t2.locale = '" . $this->getLocaleId() . "' AND t2.field = 'name'", 'left')->select("t1.*, t2.content AS name")->orderBy("name ASC")->findAll()->getData(); $this->set('extra_arr', $extra_arr); $pjProductPriceModel = pjProductPriceModel::factory(); $oi_arr = array(); $_oi_arr = pjOrderItemModel::factory()->where('t1.order_id', $arr['id'])->findAll()->getData(); foreach ($_oi_arr as $item) { if ($item['type'] == 'product') { $item['price_arr'] = $pjProductPriceModel->reset()->join('pjMultiLang', "t2.foreign_id = t1.id AND t2.model = 'pjProductPrice' AND t2.locale = '" . $this->getLocaleId() . "' AND t2.field = 'price_name'", 'left')->select("t1.*, t2.content AS price_name")->where('product_id', $item['foreign_id'])->findAll()->getData(); } $oi_arr[] = $item; } $this->set('oi_arr', $oi_arr); $this->appendJs('chosen.jquery.js', PJ_THIRD_PARTY_PATH . 'harvest/chosen/'); $this->appendCss('chosen.css', PJ_THIRD_PARTY_PATH . 'harvest/chosen/'); $this->appendJs('jquery-ui-sliderAccess.js', PJ_THIRD_PARTY_PATH . 'timepicker/'); $this->appendJs('jquery-ui-timepicker-addon.js', PJ_THIRD_PARTY_PATH . 'timepicker/'); $this->appendCss('jquery-ui-timepicker-addon.css', PJ_THIRD_PARTY_PATH . 'timepicker/'); $this->appendJs('jquery.validate.min.js', PJ_THIRD_PARTY_PATH . 'validate/'); $this->appendJs('jquery.noty.packaged.min.js', PJ_THIRD_PARTY_PATH . 'noty/packaged/'); $this->appendJs('pjAdminOrders.js'); } } else { $this->set('status', 2); } }
public function pjActionSaveOrder() { $this->setAjax(true); if ($this->isXHR()) { $cart = $this->_get('cart'); $pjOrderModel = pjOrderModel::factory(); $STORAGE = $_SESSION[$this->defaultStore]; $FORM = $_SESSION[$this->defaultForm]; $data = array(); $data['status'] = $this->option_arr['o_booking_status']; $data['price'] = $this->_get('price'); $data['price_delivery'] = $this->_get('delivery'); $data['discount'] = $this->_get('discount'); $data['subtotal'] = $this->_get('subtotal'); $data['tax'] = $this->_get('tax'); $data['total'] = $this->_get('total'); $data['uuid'] = time(); $data['ip'] = $_SERVER['REMOTE_ADDR']; $data['user_id'] = $this->_get('user_id'); $data['location_id'] = $this->_get('p_location_id'); switch ($this->_get('type')) { case 'pickup': $data['p_dt'] = pjUtil::formatDate($this->_get('p_date'), $this->option_arr['o_date_format']) . " " . $this->_get('p_hour') . ":" . $this->_get('p_minute') . ":00"; unset($STORAGE['d_address_1']); unset($STORAGE['d_address_2']); unset($STORAGE['d_country_id']); unset($STORAGE['d_state']); unset($STORAGE['d_city']); unset($STORAGE['d_zip']); unset($STORAGE['d_notes']); unset($STORAGE['d_date']); unset($STORAGE['d_hour']); unset($STORAGE['d_minute']); break; case 'delivery': $data['d_dt'] = pjUtil::formatDate($this->_get('d_date'), $this->option_arr['o_date_format']) . " " . $this->_get('d_hour') . ":" . $this->_get('d_minute') . ":00"; unset($STORAGE['p_date']); unset($STORAGE['p_hour']); unset($STORAGE['p_minute']); break; } unset($STORAGE['cart']); unset($STORAGE['subtotal']); unset($STORAGE['total']); unset($STORAGE['delivery']); $payment = 'none'; if (isset($FORM['payment_method'])) { if ($FORM['payment_method'] == 'creditcard') { $data['cc_exp'] = $FORM['cc_exp_month'] . "/" . $FORM['cc_exp_year']; } else { unset($FORM['cc_type']); unset($FORM['cc_num']); unset($FORM['cc_exp_month']); unset($FORM['cc_exp_year']); unset($FORM['cc_code']); } $payment = $FORM['payment_method']; } $is_new_client = false; $update_client = false; $pjClientModel = pjClientModel::factory(); $data['client_id'] = ':NULL'; if ($this->isFrontLogged()) { $cnt = $pjClientModel->where('t1.id', $this->getClientId())->findCount()->getData(); if ($cnt == 0) { $is_new_client = true; } else { $update_client = true; } } else { $is_new_client = true; } if ($is_new_client == true) { $c_data = array(); $c_data['status'] = 'T'; $c_data['user_id'] = $this->_get('user_id'); $c_data['c_password'] = pjUtil::getRandomPassword(6); $c_data = array_merge($FORM, $c_data); $client_id = $pjClientModel->reset()->setAttributes($c_data)->insert()->getInsertId(); if ($client_id !== false && (int) $client_id > 0) { $data['client_id'] = $client_id; if ($this->isFrontLogged()) { $client = $pjClientModel->reset()->find($client_id)->getData(); unset($_SESSION[$this->defaultClient]); $_SESSION[$this->defaultClient] = $client; } pjFront::pjActionConfirmSend($this->option_arr, $c_data, PJ_SALT, 'account'); } } if ($update_client == true) { if (isset($FORM['update_address'])) { $c_data = array(); if (isset($FORM['c_address_1'])) { $c_data['c_address_1'] = $FORM['c_address_1']; } if (isset($FORM['c_address_2'])) { $c_data['c_address_1'] = $FORM['c_address_1']; } if (isset($FORM['c_country'])) { $c_data['c_country'] = $FORM['c_country']; } if (isset($FORM['c_state'])) { $c_data['c_state'] = $FORM['c_state']; } if (isset($FORM['c_city'])) { $c_data['c_city'] = $FORM['c_city']; } if (isset($FORM['c_zip'])) { $c_data['c_zip'] = $FORM['c_zip']; } $pjClientModel->reset()->where('id', $this->getClientId())->limit(1)->modifyAll($c_data); } if (isset($FORM['update_details'])) { $c_data = array(); if (isset($FORM['c_title'])) { $c_data['c_title'] = $FORM['c_title']; } if (isset($FORM['c_name'])) { $c_data['c_name'] = $FORM['c_name']; } if (isset($FORM['c_email'])) { $c_data['c_email'] = $FORM['c_email']; } if (isset($FORM['c_phone'])) { $c_data['c_phone'] = $FORM['c_phone']; } if (isset($FORM['c_company'])) { $c_data['c_company'] = $FORM['c_company']; } if (isset($FORM['c_notes'])) { $c_data['c_notes'] = $FORM['c_notes']; } $pjClientModel->reset()->where('id', $this->getClientId())->limit(1)->modifyAll($c_data); } $client = $pjClientModel->reset()->find($this->getClientId())->getData(); unset($_SESSION[$this->defaultClient]); $_SESSION[$this->defaultClient] = $client; $data['client_id'] = $this->getClientId(); } $data = array_merge($STORAGE, $FORM, $data); $order_id = $pjOrderModel->setAttributes($data)->insert()->getInsertId(); if ($order_id !== false && (int) $order_id > 0) { $pjOrderItemModel = pjOrderItemModel::factory(); $pjProductPriceModel = pjProductPriceModel::factory(); $pjProductModel = pjProductModel::factory(); $pjExtraModel = pjExtraModel::factory(); foreach ($cart as $item) { $price_id = ':NULL'; $price = 0; if (!empty($item['price_id'])) { $price_arr = $pjProductPriceModel->find($item['price_id'])->getData(); if ($price_arr) { $price_id = $price_arr['id']; $price = $price_arr['price']; } } else { $price_arr = $pjProductModel->reset()->find($item['product_id'])->getData(); if (!empty($price_arr)) { $price = $price_arr['price']; } } $hash = md5(uniqid(rand(), true)); $oid = $pjOrderItemModel->reset()->setAttributes(array('order_id' => $order_id, 'foreign_id' => $item['product_id'], 'type' => 'product', 'price_id' => $price_id, 'price' => $price, 'hash' => $hash, 'cnt' => $item['cnt']))->insert(); foreach ($item['extras'] as $extra_id => $extra_cnt) { if ($extra_cnt > 0) { $extra_price = 0; $extra_arr = $pjExtraModel->reset()->find($extra_id)->getData(); if (!empty($extra_arr) && !empty($extra_arr['price'])) { $extra_price = $extra_arr['price']; } $pjOrderItemModel->reset()->setAttributes(array('order_id' => $order_id, 'foreign_id' => $extra_id, 'type' => 'extra', 'price_id' => ':NULL', 'price' => $extra_price, 'hash' => $hash, 'cnt' => $extra_cnt))->insert(); } } } $order_arr = $pjOrderModel->reset()->join('pjClient', "t2.id=t1.client_id", 'left outer')->select('t1.*, t2.c_title, t2.c_email, t2.c_name, t2.c_phone, t2.c_company, t2.c_address_1, t2.c_address_2, t2.c_country, t2.c_state, t2.c_city, t2.c_zip, t2.c_notes')->find($order_id)->getData(); $pdata = array(); $pdata['order_id'] = $order_id; $pdata['payment_method'] = $payment; $pdata['payment_type'] = 'online'; $pdata['amount'] = $order_arr['total']; $pdata['status'] = 'notpaid'; pjOrderPaymentModel::factory()->setAttributes($pdata)->insert(); pjAppController::addOrderDetails($order_arr, $this->getLocaleId()); pjFront::pjActionConfirmSend($this->option_arr, $order_arr, PJ_SALT, 'confirm'); unset($_SESSION[$this->defaultStore]); unset($_SESSION[$this->defaultForm]); unset($_SESSION[$this->defaultClient]); //Redirect to Credit card payment url. if ($payment == 'creditcard') { $cardData = $_SESSION['cardData']; $params = 'amount=' . base64_encode($cardData['total']) . '&oid=' . $cardData['clover_order_id'] . '&mid=' . $cardData['clover_mid'] . '&at=' . $cardData['clover_access_token'] . '&uid=' . base64_encode($cardData['o_user_id']) . '&mname=' . base64_encode($cardData['o_m_name']); $url = PJ_INSTALL_URL . 'payment/creditcard.php?' . $params; $json = array('code' => 200, 'text' => '', 'order_id' => $order_id, 'payment' => $payment, 'path' => $url); } else { $json = array('code' => 200, 'text' => '', 'order_id' => $order_id, 'payment' => $payment, 'path' => 'cash'); } } else { $json = array('code' => 100, 'text' => ''); } pjAppController::jsonResponse($json); } }
<div class="clear_left t20 overflow"> <div class="float_left black t30 t20"><span class="gray"><?php echo ucfirst(__('lblDashLastLogin', true)); ?> :</span> <?php echo pjUtil::formatDate(date('Y-m-d', strtotime($_SESSION[$controller->defaultUser]['last_login'])), 'Y-m-d', $tpl['option_arr']['o_date_format']) . ', ' . pjUtil::formatTime(date('H:i:s', strtotime($_SESSION[$controller->defaultUser]['last_login'])), 'H:i:s', $tpl['option_arr']['o_time_format']); ?> </div> <div class="float_right overflow"> <?php list($hour, $day, $other) = explode("_", date("H:i_l_F d, Y")); $days = __('days', true, false); ?> <div class="dashboard_date"> <abbr><?php echo $days[date('w')]; ?> </abbr> <?php echo pjUtil::formatDate(date('Y-m-d'), 'Y-m-d', $tpl['option_arr']['o_date_format']); ?> </div> <div class="dashboard_hour"><?php echo $hour; ?> </div> </div> </div> <?php }
__('lblSpecialInstructions'); ?> </label> <span class="inline-block"> <textarea name="d_notes" id="d_notes" class="pj-form-field w500 h120<?php echo $tpl['option_arr']['o_df_include_notes'] == 3 ? ' required' : NULL; ?> "><?php echo stripslashes($tpl['arr']['d_notes']); ?> </textarea> </span> </p> <?php } $date_time = !empty($tpl['arr']['d_dt']) ? pjUtil::formatDate(date('Y-m-d', strtotime($tpl['arr']['d_dt'])), 'Y-m-d', $tpl['option_arr']['o_date_format']) . ' ' . pjUtil::formatTime(date('H:i:s', strtotime($tpl['arr']['d_dt'])), 'H:i:s', $tpl['option_arr']['o_time_format']) : ''; ?> <p> <label class="title"><?php __('lblDeliveryDateTime'); ?> </label> <span class="block overflow"> <span class="pj-form-field-custom pj-form-field-custom-after float_left r5"> <input type="text" name="d_dt" id="d_dt" class="pj-form-field pointer w150 datetimepick required" readonly="readonly" rel="<?php echo $week_start; ?> " rev="<?php echo $jqDateFormat; ?> " lang="<?php
echo $_SERVER['PHP_SELF']; ?> ?controller=pjAdminTime&action=pjActionIndex" method="post" class="form pj-form" id="frmTimeCustom"> <input type="hidden" name="custom_time" value="1" /> <input type="hidden" name="location_id" value="<?php echo $tpl['arr']['location_id']; ?> " /> <p> <label class="title"><?php __('lblDate'); ?> </label> <span class="pj-form-field-custom pj-form-field-custom-after"> <input type="text" name="date" id="date" class="pj-form-field pointer w80 datepick required" value="<?php echo pjUtil::formatDate($tpl['arr']['date'], 'Y-m-d', $tpl['option_arr']['o_date_format']); ?> " readonly="readonly" rel="<?php echo $week_start; ?> " rev="<?php echo $jqDateFormat; ?> "/> <span class="pj-form-field-after"><abbr class="pj-form-field-icon-date"></abbr></span> </span> </p> <p> <label class="title"><?php __('lblType'); ?>
public function getDiscount($data, $option_arr) { $resp = array(); if (isset($data['voucher_code']) && !empty($data['voucher_code'])) { $_arr = pjVoucherModel::factory()->where('code', $data['voucher_code'])->findAll()->getData(); if (count($_arr) > 0) { $arr = $_arr[0]; if ($data['type'] == 'delivery') { $date = null; $time = "00:00:00"; if (isset($data['d_dt'])) { $date_time = $data['d_dt']; if (count(explode(" ", $date_time)) == 3) { list($_date, $_time, $_period) = explode(" ", $date_time); $time = pjUtil::formatTime($_time . ' ' . $_period, $option_arr['o_time_format']); } else { list($_date, $_time) = explode(" ", $date_time); $time = pjUtil::formatTime($_time, $option_arr['o_time_format']); } $date = $_date; } if (isset($data['p_date'])) { $date = $data['d_date']; if (isset($data['d_hour']) && isset($data['d_minute'])) { $time = $data['d_hour'] . ":" . $data['d_minute'] . ":00"; } } } else { $date = null; $time = "00:00:00"; if (isset($data['p_dt'])) { $date_time = $data['p_dt']; if (count(explode(" ", $date_time)) == 3) { list($_date, $_time, $_period) = explode(" ", $date_time); $time = pjUtil::formatTime($_time . ' ' . $_period, $option_arr['o_time_format']); } else { list($_date, $_time) = explode(" ", $date_time); $time = pjUtil::formatTime($_time, $option_arr['o_time_format']); } $date = $_date; } if (isset($data['d_date'])) { $date = $data['p_date']; if (isset($data['p_hour']) && isset($data['p_minute'])) { $time = $data['p_hour'] . ":" . $data['p_minute'] . ":00"; } } } if (!empty($date)) { $date = pjUtil::formatDate($date, $option_arr['o_date_format']); $d = strtotime($date); $dt = strtotime($date . " " . $time); $valid = false; switch ($arr['valid']) { case 'fixed': $time_from = strtotime($arr['date_from'] . " " . $arr['time_from']); $time_to = strtotime($arr['date_to'] . " " . $arr['time_to']); if ($time_from <= $dt && $time_to >= $dt) { $valid = true; } break; case 'period': $d_from = strtotime($arr['date_from']); $d_to = strtotime($arr['date_to']); $t_from = strtotime($arr['date_from'] . " " . $arr['time_from']); $t_to = strtotime($arr['date_to'] . " " . $arr['time_to']); if ($d_from <= $d && $d_to >= $d && $t_from <= $dt && $t_to >= $dt) { $valid = true; } break; case 'recurring': $t_from = strtotime($date . " " . $arr['time_from']); $t_to = strtotime($date . " " . $arr['time_to']); if ($arr['every'] == strtolower(date("l", $dt)) && $t_from <= $dt && $t_to >= $dt) { $valid = true; } break; } if ($valid) { $resp['voucher_code'] = $arr['code']; $resp['voucher_type'] = $arr['type']; /* Manmohan code here */ $resp['voucher_code_for'] = $arr['code_for']; $resp['voucher_product_id'] = $arr['product_id']; $resp['voucher_category_id'] = $arr['category_id']; /* Manmohan end of code here */ $resp['voucher_discount'] = $arr['discount']; $resp['code'] = 200; } else { $resp['code'] = 102; } } else { $resp['code'] = 103; } } else { $resp['code'] = 101; } } else { $resp['code'] = 100; } return $resp; }