本文整理汇总了PHP中customer类的典型用法代码示例。如果您正苦于以下问题:PHP customer类的具体用法?PHP customer怎么用?PHP customer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了customer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSales
function addSales($sale = null)
{
if ($sale == null) {
$sale = $this;
}
$sale_id = $this->db_handler->add_model($sale);
if (is_array($this->sales_items) and count($this->sales_items) != 0) {
foreach ($this->sales_items as $sales_item) {
$sales_item->sale_id = $sale_id;
$sales_item->company_id = $sale->company_id;
$sales_item->addSaleItem();
$inv = new inventry();
$inv->company_id = $sale->company_id;
$inv->item_id = $sales_item->item_id;
$invs = $inv->getInventryForSpecificCompanyAndItem();
$inv = $invs[0];
$inv->in_stock_count = $inv->in_stock_count - $sales_item->quantity;
$inv->updateInventry();
}
}
$description = "Added new Sale (" . $sale->to_string() . ")";
$customer = new customer();
$customer->id = $sale->customer_id;
$customer->getCustomer();
$customer->total_purchace_amount = $customer->total_purchace_amount + $sale->amount;
$customer->updateCustomer();
Log::i($this->tag, $description);
return $sale_id;
}
示例2: get
public static function get($nocache = false) {
static $customer;
if(!$nocache && !is_null($customer)) {
return $customer;
}
$objects = umiObjectsCollection::getInstance();
$permissions = permissionsCollection::getInstance();
if($permissions->isAuth()) {
$userId = $permissions->getUserId();
$object = $objects->getObject($userId);
} else {
$object = self::getCustomerId();
//Second try may be usefull to avoid server after-reboot conflicts
if($object === false) $object = self::getCustomerId(true);
}
if($object instanceof iUmiObject) {
$customer = new customer($object);
$customer->tryMerge();
return $customer;
}
}
示例3: store
public function store(Request $request)
{
$customer = new customer(array('customer' => $request->get('customer'), 'street' => $request->get('street'), 'city' => $request->get('city'), 'state' => $request->get('state'), 'zip' => $request->get('zip')));
$customer->save();
Toastr::success('Customer created.');
return redirect('/customers');
}
示例4: store
public static function store()
{
$params = $_POST;
//Kint::dump($params);
$attributes = array('name' => $params['name'], 'phone' => $params['phone'], 'e_mail' => $params['e_mail']);
$customer = new customer($attributes);
$errors = $customer->errors();
if (count($errors) == 0) {
$customer->save();
Redirect::to('/waybill/new', array('message' => 'Asiakas on lisätty onnistuneesti!'));
} else {
View::make('/customer/new.html', array('errors' => $errors, 'attributes' => $attributes));
}
}
示例5: 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);
}
示例6: new_one
/**
* Don't let the customer on the login page if they are already authenticated
* @Developer brandon
* @Date Oct 12, 2010
*/
public function new_one()
{
if (customer::logged_in()) {
url::redirect(url::site());
}
parent::new_one();
}
示例7: updateFromMobile
function updateFromMobile($mobile, $customer)
{
try {
$entity_id_array = customer::getEntityId($mobile);
if ($entity_id_array['success'] == 0) {
$errorcode = $entity_id_array['errorcode'];
throw new Exception($entity_id_array['data']);
} else {
$entity_id = $entity_id_array['data'];
foreach ($customer as $customer_name => $column_value) {
$enable_list = array('sex', 'nickname', 'myimage', 'birthday');
if (in_array($customer_name, $enable_list)) {
$column_tmp = customer::updateCustomerColumn($entity_id, $customer_name, $column_value);
if ($column_tmp['success'] == 0) {
$errorcode = $column_tmp['errorcode'];
throw new Exception($column_tmp['data']);
}
}
}
return array("data" => 'Update customer success', "success" => 1, 'errorcode' => 0);
}
} catch (Exception $e) {
return array("data" => $e->getMessage(), "success" => 0, 'errorcode' => $errorcode);
}
}
示例8: validate
public function validate()
{
if (is_array($this->users)) {
$customer = customer::get();
return in_array($customer->id, $this->users);
} else {
return false;
}
}
示例9: 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;
}
}
示例10: addCust
/**
* adds customer to delivery table
*/
public function addCust()
{
$delivery = new delivery();
$customer = new customer();
$data = $this->input->post(NULL, true);
$cdata = array('cname' => $data['cname'], 'caddress' => $data['address'] . ', ' . $data['city'] . ',' . $data['state'] . ' ' . $data['zip'], 'cphone' => $data['cphone']);
$ddata = array('schd' => $data['schd'], 'note' => $data['note']);
$list = $this->input->post('list');
$customer->setData($cdata);
$delivery->setDelv($ddata);
$delivery->cid = $customer->cid;
$items = $this->item->getItems($customer->bname);
if ($list == 'Yes') {
$this->load->view('bChkList', array('delivery' => $delivery, 'items' => $items));
} else {
echo 'reset';
}
$this->db->insert('capsql.delivery', $delivery);
}
示例11: 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;
}
示例12: __construct
/**
* Require administrator login
* @Developer brandon
* @Date Oct 11, 2010
*/
public function __construct()
{
parent::__construct();
$this->template = View::factory('layouts/admin');
meta::set_title(store::name() . ' | Admin | ' . ucwords(Router::$controller));
// Set the route for updating and creating files
Kohana::config_set('routes.base_crud_route', 'admin/');
// Require an admin login if we are in production.
if (IN_PRODUCTION) {
customer::require_admin_login();
}
ORM::factory('audit_trail')->create(array('user_id' => customer::current(), 'store_id' => store::get(), 'controller' => Router::$controller, 'method' => Router::$method, 'object_id' => $this->input->post('id')));
}
示例13: edit
function edit($id = 0)
{
$customer = new customer($id);
if ($_SERVER['REQUEST_METHOD'] == "GET") {
} else {
$customer->name = $this->input->post('name');
$customer->address = $this->input->post('address');
$customer->username = $this->input->post('username');
$customer->homePhone = $this->input->post('homePhone');
$customer->mobilePhone = $this->input->post('mobilePhone');
$customer->email = $this->input->post('email');
$customer->username = $this->input->post('username');
if ($this->input->post('password') != "") {
if ($this->input->post('password') == $this->input->post('confirmPassword')) {
$customer->password = md5($this->input->post('password'));
if ($customer->save()) {
redirect($this->admin . 'customers/edit/' . $customer->id);
}
} else {
flash_message("error", "Xác nhận mật khẩu phải giống mật khẩu");
}
} else {
if ($customer->save()) {
redirect($this->admin . 'customers/edit/' . $customer->id);
}
}
}
setPagination($this->admin . 'carts/list_all/', 1, 100000000, 4);
$dis['carts'] = $customer->cartitem;
$dis['nav_menu'] = array(array("type" => "back", "text" => "Back", "link" => $this->admin . 'customers/list_all/', "onclick" => ""));
$dis['title_table'] = "Danh sách đơn hàng ";
$dis['base_url'] = base_url();
$dis['title'] = "Menu";
$dis['menu_active'] = "Khách hàng";
$dis['view'] = "customer/edit";
$dis['object'] = $customer;
$this->viewadmin($dis);
}
示例14: get
/**
* Get the cart
* @Developer brandon
* @Date Oct 20, 2010
*/
public static function get()
{
if (customer::logged_in()) {
return customer::current()->load_cart();
} else {
if (Session::instance()->get('cart_' . store::get())) {
return ORM::factory('cart', Session::instance()->get('cart_' . store::get()));
} else {
$cart = ORM::factory('cart');
$cart->save();
Session::instance()->set('cart_' . store::get(), (string) $cart);
return $cart;
}
}
}
示例15: 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;
}