public function Payment() { if (!$this->opt_order->getPrimaryKey()) { $this->Edit(); return; } $va_months = array(); $o_tep = new TimeExpressionParser(); foreach ($o_tep->getMonthList() as $vn_m => $vs_month) { $va_months[$vs_month] = $vn_m + 1; } $this->view->setVar('credit_card_exp_month_list', $va_months); $va_tmp = getDate(); $vn_current_year = $va_tmp['year']; $vn_i = 0; $va_credit_card_exp_year_list = array(); while ($vn_i < 8) { $va_credit_card_exp_year_list[$vn_current_year + $vn_i] = $vn_current_year + $vn_i; $vn_i++; } $this->view->setVar('credit_card_exp_year_list', $va_credit_card_exp_year_list); $this->render('order_payment_html.php'); }
/** * */ public function refine(&$pa_destination_data, $pa_group, $pa_item, $pa_source_data, $pa_options = null) { $o_log = isset($pa_options['log']) && is_object($pa_options['log']) ? $pa_options['log'] : null; $pm_value = $pa_source_data[$pa_item['source']]; // not actually used $va_item_dest = explode(".", $pa_item['destination']); $vs_item_terminal = array_pop($va_item_dest); $vs_group_terminal = array_pop($va_item_dest); $o_tep = new TimeExpressionParser(); $o_tep->setLanguage('en_US'); switch ($vs_mode = $pa_item['settings']['dateJoiner_mode']) { default: case 'range': $vs_date_expression = $pa_item['settings']['dateJoiner_expression']; $vs_date_start = $pa_item['settings']['dateJoiner_start']; $vs_date_end = $pa_item['settings']['dateJoiner_end']; if ($vs_date_expression && ($vs_exp = BaseRefinery::parsePlaceholder($vs_date_expression, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { if ($o_tep->parse($vs_exp)) { return $o_tep->getText(); } else { if ($o_log) { $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from range', $vs_exp)); } } } $va_date = array(); if ($vs_date_start = BaseRefinery::parsePlaceholder($vs_date_start, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' '))) { if (!($vs_skip_start_exp = $pa_item['settings']['dateJoiner_skipStartIfExpression']) || !ExpressionParser::evaluate($vs_skip_start_exp, array_merge($pa_source_data, array('start' => $vs_date_start, 'end' => $vs_date_end, 'expression' => $ps_expression)))) { $va_date[] = $vs_date_start; } elseif ($vs_skip_start_replacement = $pa_item['settings']['dateJoiner_skipStartIfExpressionReplacementValue']) { $va_date[] = $vs_skip_start_replacement; } } if ($vs_date_end = BaseRefinery::parsePlaceholder($vs_date_end, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' '))) { if (!($vs_skip_end_exp = $pa_item['settings']['dateJoiner_skipEndIfExpression']) || !ExpressionParser::evaluate($vs_skip_end_exp, array_merge($pa_source_data, array('start' => $vs_date_start, 'end' => $vs_date_end, 'expression' => $ps_expression)))) { $va_date[] = $vs_date_end; } elseif ($vs_skip_end_replacement = $pa_item['settings']['dateJoiner_skipEndIfExpressionReplacementValue']) { $va_date[] = $vs_skip_end_replacement; } } foreach ($va_date as $vn_i => $vs_date) { $va_date[$vn_i] = preg_replace("![^\\d]+\$!", "", $vs_date); } $vs_date_expression = join(" - ", $va_date); if ($vs_date_expression && ($vs_exp = BaseRefinery::parsePlaceholder($vs_date_expression, $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { if ($o_tep->parse($vs_exp)) { return $o_tep->getText(); } else { if ($o_log) { $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from range', $vs_exp)); } } } break; case 'multiColumnDate': $va_month_list = $o_tep->getMonthList(); $va_date = array(); if ($vs_date_month = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_month'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { if (($vn_m = array_search($vs_date_month, $va_month_list)) !== false) { $vs_date_month = $vn_m + 1; } $va_date[] = $vs_date_month; } if ($vs_date_day = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_day'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_day; } if ($vs_date_year = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_year'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_year; } if (sizeof($va_date)) { // TODO: this is assuming US-style dates for now if ($o_tep->parse(join("/", $va_date))) { return $o_tep->getText(); } else { if ($o_log) { $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from multiColumnDate', join("/", $va_date))); } } } break; case 'multiColumnRange': $va_dates = array(); $va_month_list = $o_tep->getMonthList(); // Process start date $va_date = array(); if ($vs_date_month = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startMonth'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { if (($vn_m = array_search($vs_date_month, $va_month_list)) !== false) { $vs_date_month = $vn_m + 1; } $va_date[] = $vs_date_month; } if ($vs_date_day = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startDay'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_day; } if ($vs_date_year = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_startYear'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_year; } if (sizeof($va_date)) { if ($o_tep->parse(join("/", $va_date))) { // TODO: this is assuming US-style dates for now $va_dates[] = $o_tep->getText(); } else { if ($o_log) { $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from multiColumnRange', join("/", $va_date))); } } } // Process end date $va_date = array(); if ($vs_date_month = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_endMonth'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { if (($vn_m = array_search($vs_date_month, $va_month_list)) !== false) { $vs_date_month = $vn_m + 1; } $va_date[] = $vs_date_month; } if ($vs_date_day = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_endDay'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_day; } if ($vs_date_year = trim(BaseRefinery::parsePlaceholder($pa_item['settings']['dateJoiner_endYear'], $pa_source_data, $pa_item, $vn_c, array('reader' => caGetOption('reader', $pa_options, null), 'returnAsString' => true, 'delimiter' => ' ')))) { $va_date[] = $vs_date_year; } if (sizeof($va_date)) { if ($o_tep->parse(join("/", $va_date))) { // TODO: this is assuming US-style dates for now $va_dates[] = $o_tep->getText(); } else { if ($o_log) { $o_log->logWarn(_t('[dateJoinerRefinery] Could not parse date expression %1 assembled from multiColumnRange', join("/", $va_date))); } } } if (sizeof($va_dates) > 0) { return join(" - ", $va_dates); } break; } return null; }
public function Payment() { if (!$this->opt_order->getPrimaryKey()) { $this->Edit(); return; } $va_months = array(); $o_tep = new TimeExpressionParser(); foreach ($o_tep->getMonthList() as $vn_m => $vs_month) { $va_months[$vs_month] = $vn_m + 1; } $this->view->setVar('credit_card_exp_month_list', $va_months); $va_tmp = getDate(); $vn_current_year = $va_tmp['year']; $vn_i = 0; $va_credit_card_exp_year_list = array(); while ($vn_i < 8) { $va_credit_card_exp_year_list[$vn_current_year + $vn_i] = $vn_current_year + $vn_i; $vn_i++; } $this->view->setVar('credit_card_exp_year_list', $va_credit_card_exp_year_list); $this->opo_app_plugin_manager->hookEditItem(array('id' => $this->opt_order->getPrimaryKey(), 'table_num' => $this->opt_order->tableNum(), 'table_name' => $this->opt_order->tableName(), 'instance' => $this->opt_order)); $this->render('order_payment_html.php'); }
/** * */ public function ViewOrder() { if (!$this->request->isLoggedIn()) { return; } $pn_order_id = $this->request->getParameter('order_id', pInteger); $t_order = new ca_commerce_orders($pn_order_id); if (!$t_order->userHasAccessToOrder($this->request->getUserID())) { $this->notification->addNotification(_t("Invalid order_id"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302); return; } else { if (!in_array($t_order->get('order_status'), array('AWAITING_PAYMENT', 'PROCESSED', 'PROCESSED_AWAITING_DIGITIZATION', 'COMPLETED', 'REOPENED'))) { $this->notification->addNotification(_t("This order is not yet available for viewing"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302); return; } $this->view->setVar('t_order', $t_order); $this->view->setVar('item_list', $t_order->getItems()); if (!$t_order->getPrimaryKey()) { $this->notification->addNotification(_t("Invalid order_id"), __NOTIFICATION_TYPE_ERROR__); $this->response->setRedirect(caNavUrl($this->request, '', 'Account', 'Index'), 302); return; } else { $this->view->setVar('order_id', $t_order->getPrimaryKey()); } $va_months = array(); $o_tep = new TimeExpressionParser(); foreach ($o_tep->getMonthList() as $vn_m => $vs_month) { $va_months[$vs_month] = $vn_m + 1; } $o_tep = new TimeExpressionParser(); $this->view->setVar('credit_card_exp_month_list', $va_months); $va_tmp = getDate(); $vn_current_year = $va_tmp['year']; $vn_i = 0; $va_credit_card_exp_year_list = array(); while ($vn_i < 8) { $va_credit_card_exp_year_list[$vn_current_year + $vn_i] = $vn_current_year + $vn_i; $vn_i++; } $this->view->setVar('credit_card_exp_year_list', $va_credit_card_exp_year_list); # --- get any messages linked to this order $t_comm = new ca_commerce_communications(); $this->view->setVar('messages', $t_comm->getMessages($this->request->getUserID(), array('transaction_id' => $t_order->get("transaction_id")))); $this->render('Account/view_order_html.php'); } }