本文整理汇总了PHP中customer::get方法的典型用法代码示例。如果您正苦于以下问题:PHP customer::get方法的具体用法?PHP customer::get怎么用?PHP customer::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类customer
的用法示例。
在下文中一共展示了customer::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process($template = null)
{
list($tpl_block, $tpl_item) = def_module::loadTemplates("emarket/payment/invoice/" . $template, 'legal_person_block', 'legal_person_item');
$collection = umiObjectsCollection::getInstance();
$types = umiObjectTypesCollection::getInstance();
$typeId = $types->getBaseType("emarket", "legal_person");
$customer = customer::get();
$order = $this->order;
$mode = getRequest('param2');
if ($mode == 'do') {
$personId = getRequest('legal-person');
$isNew = $personId == null || $personId == 'new';
if ($isNew) {
$typeId = $types->getBaseType("emarket", "legal_person");
$personId = $collection->addObject("", $typeId);
$controller = cmsController::getInstance();
$data = getRequest('data');
if ($data && ($dataModule = $controller->getModule("data"))) {
$person = $collection->getObject($personId);
$person->setName($data['new']['name']);
$dataModule->saveEditedObject($personId, $isNew, true);
}
if ($collection->getObject($personId) instanceof umiObject) {
$customer = customer::get();
$customer->legal_persons = array_merge($customer->legal_persons, array($personId));
}
}
$order->legal_person = $personId;
$order->order();
$order->payment_document_num = $order->id;
$result = $this->printInvoice($order);
$buffer = outputBuffer::current();
$buffer->charset('utf-8');
$buffer->contentType('text/html');
$buffer->clear();
$buffer->push($result);
$buffer->end();
return true;
} else {
if ($mode == 'delete') {
$personId = (int) getRequest('person-id');
if ($collection->isExists($personId)) {
$customer = customer::get();
$customer->legal_persons = array_diff($customer->legal_persons, array($personId));
$collection->delObject($personId);
}
}
}
$items = array();
$persons = $customer->legal_persons;
if (is_array($persons)) {
foreach ($persons as $personId) {
$person = $collection->getObject($personId);
$item_arr = array('attribute:id' => $personId, 'attribute:name' => $person->name);
$items[] = def_module::parseTemplate($tpl_item, $item_arr, false, $personId);
}
}
$block_arr = array('attribute:type-id' => $typeId, 'attribute:type_id' => $typeId, 'xlink:href' => 'udata://data/getCreateForm/' . $typeId, 'subnodes:items' => $items);
return def_module::parseTemplate($tpl_block, $block_arr);
}
示例2: validate
public function validate()
{
$customer = customer::get();
if (is_array($this->user_groups) && is_array($customer->groups)) {
return sizeof(array_intersect($customer->groups, $this->user_groups));
} else {
return false;
}
}
示例3: validate
public function validate()
{
if (is_array($this->users)) {
$customer = customer::get();
return in_array($customer->id, $this->users);
} else {
return false;
}
}
示例4: detail
public static function detail()
{
//get customers
$detail['expense_account_all'] = expenseaccount::get_all();
//get customers
$detail['customer'] = customer::get();
$detail['customer_all'] = customer::get_all();
//get billers
$detail['biller_all'] = biller::get_all();
//get invoices
$detail['invoice_all'] = invoice::get_all();
//get products
$detail['product_all'] = product::get_all();
return $detail;
}
示例5: create
/**
* Создать новый пустой заказ
* @return Integer $order id нового заказа
*/
public static function create($useDummyOrder = false)
{
$objectTypes = umiObjectTypesCollection::getInstance();
$objects = umiObjectsCollection::getInstance();
$permissions = permissionsCollection::getInstance();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$orderTypeId = $objectTypes->getBaseType('emarket', 'order');
if ($useDummyOrder) {
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('name')->equals('dummy');
$sel->limit(0, 1);
if ($sel->length()) {
$orderId = $sel->first->id;
} else {
$orderTypeId = $objectTypes->getBaseType('emarket', 'order');
$orderId = $objects->addObject('dummy', $orderTypeId);
$order = $objects->getObject($orderId);
if ($order instanceof iUmiObject == false) {
throw new publicException("Can't load dummy object for order #{$orderId}");
} else {
$order->setValue('domain_id', $domainId);
$order->commit();
}
}
return self::get($orderId);
}
$managerId = 0;
$statusId = self::getStatusByCode('basket');
$customer = customer::get();
$createTime = time();
$orderId = $objects->addObject('', $orderTypeId);
$order = $objects->getObject($orderId);
if ($order instanceof iUmiObject == false) {
throw new publicException("Can't load created object for order #{$orderId}");
}
$order->domain_id = $domainId;
$order->manager_id = $managerId;
$order->status_id = $statusId;
$order->customer_id = $customer->getId();
$order->order_create_date = $createTime;
$order->commit();
$customer->setLastOrder($orderId, $domainId);
return self::get($orderId);
}
示例6: getCustomerOrders
protected function getCustomerOrders()
{
static $customerOrders = null;
if (!is_null($customerOrders)) {
return $customerOrders;
}
$customer = customer::get();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals($customer->id);
$sel->where('domain_id')->equals($domainId);
$sel->where('status_id')->equals(order::getStatusByCode('ready'));
return $customerOrders = $sel->result;
}
示例7: show_user_orders
/**
* Функция рисует список заказов пользователя
* @param string $template Название шаблона
* @return mixed Список заказов пользователя
*/
public function show_user_orders($template = 'default')
{
list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals(customer::get()->id);
$sel->where('name')->isNull(false);
$sel->where('domain_id')->equals($domainId);
if ($sel->length == 0) {
$tpl_block = $tpl_block_empty;
}
$items_arr = array();
foreach ($sel->result as $selOrder) {
$order = order::get($selOrder->id);
$item_arr['attribute:id'] = $order->id;
$item_arr['attribute:name'] = $order->name;
$item_arr['attribute:type-id'] = $order->typeId;
$item_arr['attribute:guid'] = $order->GUID;
$item_arr['attribute:type-guid'] = $order->typeGUID;
$item_arr['attribute:ownerId'] = $order->ownerId;
$item_arr['xlink:href'] = $order->xlink;
$item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
//print_r($order->getValue('order_items'));
//Получаем список товаров заказа
$items = array();
foreach ($order->getItems() as $orderItem) {
// print_r($order_item); die;
$item_line = array();
// print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
$item_line['attribute:element_id'] = $orderItem->id;
$item_line['attribute:name'] = $orderItem->name;
$item_line['attribute:item_amount'] = $orderItem->getAmount();
// $item_line['attribute:options'] = $orderItem->getOptions();
// print_r($order_item->options);
$items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
}
$item_arr['subnodes:order_items'] = $items;
$items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
}
return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
}
示例8: detail
public function detail()
{
//get expenseaccount
$expenseaccountobj = new expenseaccount();
$detail['expense_account_all'] = $expenseaccountobj->get_all();
//get customers with domain_id from session by constructor
$customerobj = new customer();
$detail['customer'] = $customerobj->get();
$detail['customer_all'] = $customerobj->get_all();
//get billers with domain_id from session by constructor
$billerobj = new biller();
$detail['biller_all'] = $billerobj->get_all();
//get invoices
$invoiceobj = new invoice();
$detail['invoice_all'] = $invoiceobj->get_all();
//get products
$productobj = new product();
$detail['product_all'] = $productobj->get_all();
return $detail;
}
示例9: getCurrentCurrency
/**
* Получить текущую валюту
* @return iUmiObject текущая валюта
*/
public function getCurrentCurrency()
{
static $currency = null;
if (!is_null($currency)) {
return $currency;
}
if (permissionsCollection::getInstance()->isAuth()) {
$customer = customer::get();
if ($customer->preffered_currency) {
$currencyTypeId = umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'currency');
$currency = selector::get('object')->id($customer->preffered_currency);
if ($currency->typeId == $currencyTypeId) {
return $currency;
}
}
} else {
if ($v = (int) getCookie('customer_currency')) {
return $currency = selector::get('object')->id($v);
}
}
$guest = umiObjectsCollection::getInstance()->getObjectByGUID('system-guest');
if ($v = $guest->getValue('preffered_currency')) {
return $currency = selector::get('object')->id($v);
}
return $currency = $this->getDefaultCurrency();
}
示例10: ucwords
*
* showitem.customer.php
*
* showitem.customer dialog
*
*/
// enable or disable logging
error_reporting(E_ALL);
ini_set('display_errors', '1');
// 0 - disabled; 1 - enabled
//
$o = new customer($data->data->id);
$o->details();
?>
<div class="title"><?php
echo ucwords($o->get("id") == -1 ? CUSTOMER_NEW_CUSTOMER : CUSTOMER_EDIT_NEW_CUSTOMER);
?>
</div>
<div class="form">
<div class="column"><input type="hidden" id="id" value="<?php
echo $o->get('id');
?>
" />
<?php
if ($_customer_name === true) {
?>
<div class="row name">
<div class="caption"><?php
echo ucwords(CUSTOMER_NAME);
?>
</div>
示例11: payment
public function payment()
{
global $config;
global $logger;
$SI_BILLER = new SimpleInvoices_Db_Table_Biller();
$SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();
//set customer,biller and preference if not defined
if(empty($this->customer))
{
$this->customer = customer::get($this->invoice['customer_id']);
}
if(empty($this->biller))
{
$this->biller = $SI_BILLER->getBiller($this->invoice['biller_id']);
}
if(empty($this->preference))
{
$this->preference = $SI_PREFERENCES->getPreferenceById($this->invoice['preference_id']);
}
$eway = new ewaylib($this->biller['eway_customer_id'],'REAL_TIME', false);
//Eway only accepts amount in cents - so times 100
$value = $this->invoice['total']*100;
$eway_invoice_total = htmlsafe(trim($value));
$logger->log("eway totla: " . $eway_invoice_total, Zend_Log::INFO);
$enc = new encryption();
$key = $config->encryption->default->key;
$credit_card_number = $enc->decrypt($key, $this->customer['credit_card_number']);
$eway->setTransactionData("TotalAmount", $eway_invoice_total); //mandatory field
$eway->setTransactionData("CustomerFirstName", $this->customer['name']);
$eway->setTransactionData("CustomerLastName", "");
$eway->setTransactionData("CustomerAddress", "");
$eway->setTransactionData("CustomerPostcode", "");
$eway->setTransactionData("CustomerInvoiceDescription", "");
$eway->setTransactionData("CustomerEmail", $this->customer['email']);
$eway->setTransactionData("CustomerInvoiceRef", $this->invoice['index_name']);
$eway->setTransactionData("CardHoldersName", $this->customer['credit_card_holder_name']); //mandatory field
$eway->setTransactionData("CardNumber", $credit_card_number); //mandatory field
$eway->setTransactionData("CardExpiryMonth", $this->customer['credit_card_expiry_month']); //mandatory field
$eway->setTransactionData("CardExpiryYear", $this->customer['credit_card_expiry_year']); //mandatory field
$eway->setTransactionData("Option1", "");
$eway->setTransactionData("Option2", "");
$eway->setTransactionData("Option3", "");
$eway->setTransactionData("TrxnNumber", $this->invoice['id']);
//special preferences for php Curl
$eway->setCurlPreferences(CURLOPT_SSL_VERIFYPEER, 0); //pass a long that is set to a zero value to stop curl from verifying the peer's certificate
$ewayResponseFields = $eway->doPayment();
$this->message = $ewayResponseFields;
$message ="";
if($ewayResponseFields["EWAYTRXNSTATUS"]=="False"){
$logger->log("Transaction Error: " . $ewayResponseFields["EWAYTRXNERROR"] . "<br>\n", Zend_Log::INFO);
foreach($ewayResponseFields as $key => $value)
$message .= "\n<br>\$ewayResponseFields[\"$key\"] = $value";
$logger->log("Eway message: " . $message . "<br>\n", Zend_Log::INFO);
//header("Location: trasnactionerrorpage.php");
//exit();
$return = 'false';
}else if($ewayResponseFields["EWAYTRXNSTATUS"]=="True"){
$logger->log("Transaction Success: " . $ewayResponseFields["EWAYTRXNERROR"] . "<br>\n", Zend_Log::INFO);
foreach($ewayResponseFields as $key => $value)
$message .= "\n<br>\$ewayResponseFields[\"$key\"] = $value";
$logger->log("Eway message: " . $message . "<br>\n", Zend_Log::INFO);
//header("Location: trasnactionsuccess.php");
//exit();
$payment = new payment();
$payment->ac_inv_id = $this->invoice['id'];
#$payment->ac_inv_id = $_POST['invoice'];
$payment->ac_amount = $this->invoice['total'];
#$payment->ac_amount = $ewayResponseFields['EWAYRETURNAMOUNT']/100;
#$payment->ac_amount = $_POST['mc_gross'];
$payment->ac_notes = $message;
$payment->ac_date = date( 'Y-m-d' );
$payment->online_payment_id = $ewayResponseFields['EWAYTRXNNUMBER'];
$payment->domain_id = domain_id::get($this->domain_id);
$payment_type = new payment_type();
$payment_type->type = "Eway";
$payment_type->domain_id = $domain_id;
$payment->ac_payment_type = $payment_type->select_or_insert_where();
$logger->log('Paypal - payment_type='.$payment->ac_payment_type, Zend_Log::INFO);
$payment->insert();
#echo $db->lastInsertID();
$return = 'true';
}
return $return ;
}
示例12: run
public function run()
{
global $db;
global $auth_session;
$SI_BILLER = new SimpleInvoices_Db_Table_Biller();
$SI_PREFERENCES = new SimpleInvoices_Db_Table_Preferences();
$today = date('Y-m-d');
$domain_id = domain_id::get($this->domain_id);
$cron_log = new cronlog();
$cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
$check_cron_log = $cron_log->check();
//only proceed if cron has not been run for today
$cron = new cron();
$data = $cron->select_all('no_limit');
$return['cron_message'] ="Cron started";
$number_of_crons_run = "0";
foreach ($data as $key=>$value)
{
$cron_log = new cronlog();
$cron_log->run_date = empty($this->run_date) ? $today : $this->run_date;
$cron_log->cron_id = $data[$key]['cron_id'];
$check_cron_log = $cron_log->check();
$i="0";
if ($check_cron_log == 0)
{
$run_cron ='false';
$start_date = date('Y-m-d', strtotime( $data[$key]['start_date'] ) );
$end_date = $data[$key]['end_date'] ;
$diff = number_format((strtotime($today) - strtotime($start_date)) / (60 * 60 * 24),0);
//only check if diff is positive
if (($diff >= 0) AND ($end_date =="" OR $end_date >= $today))
{
if($data[$key]['recurrence_type'] == 'day')
{
$modulus = $diff % $data[$key]['recurrence'] ;
if($modulus == 0)
{
$run_cron ='true';
} else {
#$return .= "cron does not runs TODAY-days";
}
}
if($data[$key]['recurrence_type'] == 'week')
{
$period = 7 * $data[$key]['recurrence'];
$modulus = $diff % $period ;
if($modulus == 0)
{
$run_cron ='true';
} else {
#$return .= "cron is not runs TODAY-week";
}
}
if($data[$key]['recurrence_type'] == 'month')
{
$start_day = date('d', strtotime( $data[$key]['start_date'] ) );
$start_month = date('m', strtotime( $data[$key]['start_date'] ) );
$start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
$today_day = date('d');
$today_month = date('m');
$today_year = date('Y');
$months = ($today_month-$start_month)+12*($today_year-$start_year);
$modulus = $months % $data[$key]['recurrence'] ;
if( ($modulus == 0) AND ( $start_day == $today_day ) )
{
$run_cron ='true';
} else {
#$return .= "cron is not runs TODAY-month";
}
}
if($data[$key]['recurrence_type'] == 'year')
{
$start_day = date('d', strtotime( $data[$key]['start_date'] ) );
$start_month = date('m', strtotime( $data[$key]['start_date'] ) );
$start_year = date('Y', strtotime( $data[$key]['start_date'] ) );
$today_day = date('d');
$today_month = date('m');
$today_year = date('Y');
$years = $today_year-$start_year;
$modulus = $years % $data[$key]['recurrence'] ;
if( ($modulus == 0) AND ( $start_day == $today_day ) AND ( $start_month == $today_month ) )
{
//.........这里部分代码省略.........
示例13: isOwnerOfObject
/**
* Узнать, является ли пользователь $user_id владельцем объекта (класс umiObject) $object_id
* @param Integer $object_id id объекта (класс umiObject)
* @param $user_id id пользователя
* @return Boolean true, если пользователь является владельцем
*/
public function isOwnerOfObject($object_id, $user_id = false)
{
if ($user_id == false) {
$user_id = $this->getUserId();
}
if ($user_id == $object_id) {
//Objects == User, that's ok
return true;
} else {
$object = umiObjectsCollection::getInstance()->getObject($object_id);
if ($object instanceof umiObject) {
$owner_id = $object->getOwnerId();
} else {
$owner_id = 0;
}
if ($owner_id == 0 || $owner_id == $user_id) {
return true;
} else {
$guestId = umiObjectsCollection::getInstance()->getObjectIdByGUID('system-guest');
if ($owner_id == $guestId && class_exists('customer')) {
$customer = customer::get();
if ($cusotmer && $customer->id == $owner_id) {
return true;
}
}
return false;
}
}
}
示例14: expense
<?php
//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
#get the invoice id
$expense_id = $_GET['id'];
$expenseobj = new expense();
$customerobj = new customer();
$billerobj = new biller();
$invoiceobj = new invoice();
$productobj = new product();
$expenseaccountobj = new expenseaccount();
$expensetaxobj = new expensetax();
$expense = $expenseobj->get($expense_id);
$detail = $expenseobj->detail();
$detail['customer'] = $customerobj->get($expense['customer_id']);
$detail['biller'] = $billerobj->select($expense['biller_id']);
$detail['invoice'] = $invoiceobj->select($expense['invoice_id']);
$detail['product'] = $productobj->get($expense['product_id']);
$detail['expense_account'] = $expenseaccountobj->select($expense['expense_account_id']);
$detail['expense_tax'] = $expensetaxobj->get_all($expense_id);
$detail['expense_tax_total'] = $expense['amount'] + $expensetaxobj->get_sum($expense_id);
$detail['expense_tax_grouped'] = $expensetaxobj->grouped($expense_id);
$detail['status_wording'] = $expense['status'] == 1 ? $LANG['paid'] : $LANG['not_paid'];
$taxes = getActiveTaxes();
#$tax_selected = getTaxRate($product['default_tax_id']);
$defaults = getSystemDefaults();
$smarty->assign('expense', $expense);
$smarty->assign('detail', $detail);
$smarty->assign('taxes', $taxes);
$smarty->assign('defaults', $defaults);
示例15: chooseDeliveryAddress
public function chooseDeliveryAddress(order $order)
{
$addressId = getRequest('delivery-address');
$urlPrefix = cmsController::getInstance()->getUrlPrefix() ? cmsController::getInstance()->getUrlPrefix() . '/' : '';
if (!$addressId) {
$this->redirect($this->pre_lang . '/' . $urlPrefix . 'emarket/purchase/delivery/address/');
}
if (strpos($addressId, 'delivery_') === 0) {
$order->delivery_address = false;
$deliveryId = substr($addressId, 9);
$_REQUEST['delivery-id'] = $deliveryId;
$this->chooseDelivery($order);
}
if ($addressId == 'new') {
$controller = cmsController::getInstance();
$collection = umiObjectsCollection::getInstance();
$types = umiObjectTypesCollection::getInstance();
$typeId = $types->getBaseType("emarket", "delivery_address");
$customer = customer::get();
$addressId = $collection->addObject("Address for customer #" . $customer->id, $typeId);
$dataModule = $controller->getModule("data");
if ($dataModule) {
$dataModule->saveEditedObject($addressId, true, true);
}
$customer->delivery_addresses = array_merge($customer->delivery_addresses, array($addressId));
}
$order->delivery_address = $addressId;
$order->commit();
$this->redirect($this->pre_lang . '/' . $urlPrefix . 'emarket/purchase/delivery/choose/');
}