本文整理汇总了PHP中Customer::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Customer::delete方法的具体用法?PHP Customer::delete怎么用?PHP Customer::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionAddAjax
public function actionAddAjax()
{
if (!isset(Yii::app()->user->storeID)) {
$data['message'] = '<div class="alert alert-success">Store not found. </div>';
echo json_encode($data);
exit;
}
$model = new Customer();
if (isset($_POST['Customer'])) {
$model->attributes = $_POST['Customer'];
$data = array();
$mss = '';
if (count($data) == 0) {
$model->pk_s_id = '-1';
$model->i_flag_sync = 1;
$model->i_flag_deleted = 0;
$model->i_disable = 0;
if ($model->save()) {
$model->pk_s_id = 'SV' . $model->id;
if ($model->save()) {
$data['option'] = '<option selected="selected" value ="' . $model->pk_s_id . '">' . $model->s_name . '</option>';
$data['message'] = '<div class="alert alert-success">Success! Customer created. </div>';
} else {
$model->delete();
$data['message'] = '<div class="alert alert-danger">Error! Please try again later.</div>';
}
} else {
$data['message'] = json_encode($model->errors);
//'<div class="alert alert-danger">Error! Please try again later2.</div>';
}
}
echo json_encode($data);
}
}
示例2: delete
public function delete()
{
if ($this->f3->exists('PARAMS.id')) {
$user = new Customer($this->db);
$user->delete($this->f3->get('PARAMS.id'));
}
$this->f3->reroute('/customer');
}
示例3: testCustomerDelete
public function testCustomerDelete()
{
$token = 'cus_zDdjHBuNW3do8G3jaTqApzsI';
$this->mockResponse($this->success_customer_delete_response());
$customer = Customer::delete($token);
$this->assertNotNull($customer->token);
$this->assertNotNull($customer->email);
$this->assertFalse($customer->is_active);
}
示例4: __construct
public function __construct()
{
parent::__construct();
try {
TTransaction::open('samples');
// abre uma transação
$customer = new Customer(40);
$customer->delete();
// exclui o objeto
$customer = new Customer();
$customer->delete(41);
// exclui o objeto
new TMessage('info', 'Objeto excluído');
TTransaction::close();
// fecha a transação.
} catch (Exception $e) {
new TMessage('error', $e->getMessage());
}
}
示例5: Delete
/**
* method Delete()
* Delete a record
*/
function Delete($param)
{
try {
// get the parameter $key
$key = $param['key'];
// open a transaction with database 'samples'
TTransaction::open('samples');
// instantiates object Customer
$object = new Customer($key);
// deletes the object from the database
$object->delete();
// close the transaction
TTransaction::close();
// reload the listing
$this->onReload($param);
// shows the success message
new TMessage('info', "Record Deleted");
} catch (Exception $e) {
// shows the exception error message
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
示例6: uninstall
public function uninstall()
{
$id = Configuration::get('YA_POKUPKI_CUSTOMER');
$customer = new Customer($id);
$customer->id = $id;
$customer->delete();
Db::getInstance()->execute('DROP TABLE IF EXISTS ' . _DB_PREFIX_ . 'pokupki_orders');
foreach ($this->status as $s) {
$os = new OrderState((int) $s);
$os->id = $s;
$os->delete();
}
return parent::uninstall();
}
示例7: actionAddCust
/**
* 添加顾客
*/
public function actionAddCust()
{
$user_model = new User();
$addr_model = new Address();
$cust_model = new Customer();
$custhi_model = new Cust_Health_Info();
if (isset($_POST["User"]) && isset($_POST["Customer"])) {
$user_model->attributes = $_POST["User"];
//设定用户种别为:顾客
$user_model->usr_kind = 2;
//设定用户密码为:xyz123456
$user_model->usr_password = md5("xyz123456");
$user_model->user_chg_pwd_old = "oldpassword";
$user_model->user_chg_pwd_new = "newpassword";
$user_model->user_chg_pwd_new_cfm = "newpassword";
//设置用户头像的默认值
if ($user_model->usr_pic_id == '') {
$user_model->usr_pic_id = '100000';
}
if ($user_model->save()) {
$cust_model->attributes = $_POST["Customer"];
//customer表里面的主键是user表的外键,user表的外键又是自增的,所以要先保存完user表才能保存customer表
$cust_model->pk_cust_id = $user_model->pk_usr_id;
//将作为用户名的手机号填入顾客信息里
$cust_model->cust_mobile1 = $_POST['User']['usr_username'];
//将用户喜爱的项目按位计算并保存
$cust_prefer = 0;
//如果啥都没选的话,下记字符串应该为空,否则为数组(内容为数字)
if ($_POST['Customer']['cust_prefer'] != '') {
for ($i = 0; $i < count($_POST['Customer']['cust_prefer']); $i++) {
if ($_POST['Customer']['cust_prefer'][$i]) {
$cust_prefer |= (int) $_POST['Customer']['cust_prefer'][$i];
}
}
} else {
$cust_prefer = 0;
}
$cust_model->cust_prefer = $cust_prefer;
//将用户喜爱的美疗师按位计算并保存
$cust_beautician = 0;
//如果啥都没选的话,下记字符串应该为空,否则为字符串数组(内容为数字)
if ($_POST['Customer']['cust_beautician'] != '') {
for ($i = 0; $i < count($_POST['Customer']['cust_beautician']); $i++) {
if ($_POST['Customer']['cust_beautician'][$i]) {
$cust_beautician |= (int) $_POST['Customer']['cust_beautician'][$i];
}
}
} else {
$cust_beautician = 0;
}
$cust_model->cust_beautician = $cust_beautician;
if ($cust_model->save()) {
$addr_model->attributes = $_POST['Address'];
$addr_model->addr_cust_id = $user_model->pk_usr_id;
if (!$addr_model->save()) {
$cust_model->delete();
$user_model->delete();
echo "<script>alert('地址信息添加失败!');</script>";
}
$custhi_model->attributes = $_POST['Cust_Health_Info'];
$custhi_model->pk_custhi_cust_id = $user_model->pk_usr_id;
$custhi_model->custhi_height = (double) $_POST['Cust_Health_Info']['custhi_height'];
$custhi_model->custhi_weight = (double) $_POST['Cust_Health_Info']['custhi_weight'];
$custhi_model->custhi_date = date("Y-m-d H:i:s", time());
if (!$custhi_model->save()) {
$addr_model->delete();
$cust_model->delete();
$user_model->delete();
echo "<script>alert('用户健康信息添加失败!');</script>";
}
$this->redirect("./index.php?r=user/showCust");
} else {
$user_model->delete();
var_dump($cust_model->getErrors());
echo "<script>alert('顾客信息添加失败!');</script>";
}
} else {
// var_dump($user_model->getErrors());
echo "<script>alert('用户信息添加失败!');</script>";
}
}
$this->renderPartial('addCust', array('user_info' => $user_model, 'cust_info' => $cust_model, 'addr_info' => $addr_model, 'custhi_info' => $custhi_model));
}
示例8: customer_delete
/**
* Delete a customer
* @route DELETE customer/$id/$token (rewritten by codeigniter route)
* @param type $id
* @param type $token
*/
public function customer_delete($id, $token)
{
$token_entry = new Token();
$token_entry->get_by_valid_token($token)->get();
$response = new stdClass();
if ($token_entry->exists() && $token_entry->user->get()->is_admin) {
$customer = new Customer();
$customer->get_by_id($id);
$customer->delete();
$response->status = TRUE;
$this->response($response);
} else {
$response->status = FALSE;
$response->error = 'Token not found, not an admin or session expired';
$this->response($response);
}
}
示例9: delete
function delete($id)
{
$this->checkRole(array(1));
$customers = new Customer($id);
if (!$customers->exists()) {
show_404();
}
if ($customers->delete()) {
flash_message('success', 'Thành công. Đối tượng đã được xóa');
redirect($_SERVER['HTTP_REFERER']);
}
}
示例10: Customer
<?php
require_once "util.php";
require_once "DataBase/Customer.php";
require_once "DataBase/Tour.php";
require_once "DataBase/Priceset.php";
$db_action = var_get_post("db_action", "");
$customer = new Customer();
$tour = new Tour();
$priceset = new Priceset();
switch ($db_action) {
case "new":
$customer->create(var_post("customer_number", ""), array(var_post("password", ""), var_post("prename", ""), var_post("postname", ""), var_post("street", ""), var_post("streetnumber", ""), var_post("plz", ""), var_post("city", ""), var_post("telephone", ""), var_post("telefax", ""), var_post("email", ""), var_post("pricelist_id", ""), var_post("tour_id", ""), var_post("rabatt", ""), var_post("details", ""), var_post("bank_name", ""), var_post("bank_account", ""), var_post("blz", "")));
break;
case "edit":
$customer->update(var_post("customer_number", ""), array(var_post("password", ""), var_post("prename", ""), var_post("postname", ""), var_post("street", ""), var_post("streetnumber", ""), var_post("plz", ""), var_post("city", ""), var_post("telephone", ""), var_post("telefax", ""), var_post("email", ""), var_post("pricelist_id", ""), var_post("tour_id", ""), var_post("rabatt", ""), var_post("details", ""), var_post("bank_name", ""), var_post("bank_account", ""), var_post("blz", "")));
break;
case "delete":
$customer->delete(var_get("customer_id", ""));
break;
}
示例11: Customer
$error->check();
break;
case 'create_customer':
$customer = new Customer();
$customer_id = CUSTOMER_PREFIX . $customer_name;
$result = $customer->create($conn_asm, $conn_db, $customer_id, $customer_password);
$error->check();
break;
case 'exist_customer':
$customer = new Customer();
$result = $customer->check($conn_asm, $conn_db, $customer_id);
$error->check();
break;
case 'delete_customer':
$customer = new Customer();
$result = $customer->delete($conn_asm, $conn_db, $customer_id);
$error->check();
break;
case 'update_consumer_group':
$customer = new Customer();
$result = $customer->update_consumer_group($conn_db, $customer_id, $consumer_group);
$error->check();
break;
case 'update_storage_quota':
$drive = new Drive();
$result = $drive->update_storage_quota($conn_db, $customer_id, $max_gbytes);
$error->check();
break;
case 'update_compression':
$drive = new Drive();
$result = $drive->update_compression($conn_db, $customer_id, $compression);
示例12: deleteCustomer
function deleteCustomer($id)
{
if (is_null($id)) {
Functions::setResponse(400);
}
try {
$c = new Customer($id);
$c->delete();
return true;
} catch (RuntimeException $e) {
Functions::setResponse(404);
}
}
示例13: die
die("<b style='color:red'>Error CANNOT4:" . SmartTest::instance()->canwe);
exit;
}
SmartTest::instance()->progress();
$cust3 = new Customer();
$cust4 = new Customer();
$cust3->add($cust4);
$cust3->add($cust4);
//also test multiple assoc
$c = $cust3->getRelatedCustomer();
if (count($c) !== 1) {
die("<b style='color:red'>Error CANNOT5:" . SmartTest::instance()->canwe);
exit;
}
SmartTest::instance()->progress();
Customer::delete($cust4);
$c = $cust3->getRelatedCustomer();
if (count($c) !== 0) {
die("<b style='color:red'>Error CANNOT6:" . SmartTest::instance()->canwe);
exit;
}
SmartTest::instance()->progress();
SmartTest::instance()->canwe = "import from post";
$_POST["hallo"] = 123;
$_POST["there"] = 456;
$_POST["nope"] = 789;
$cust = new Customer();
$cust->importFromPost(array("hallo", "there"));
if ($cust->getHallo() == 123 && $cust->getThere() == 456 && !$cust->getNope()) {
SmartTest::instance()->progress();
} else {
示例14: truncateTables
private function truncateTables($case)
{
switch ((int) $case) {
case $this->entities[$this->l('Categories')]:
$categories = Db::getInstance()->ExecuteS('SELECT `id_category` FROM `' . _DB_PREFIX_ . 'category` WHERE id_category != 1');
foreach ($categories as $category) {
$c = new Category((int) $category['id_category']);
$c->delete();
}
break;
case $this->entities[$this->l('Products')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->delete(true);
}
break;
case $this->entities[$this->l('Customers')]:
$customers = Db::getInstance()->ExecuteS('SELECT `id_customer` FROM `' . _DB_PREFIX_ . 'customer`');
foreach ($customers as $customer) {
$c = new Customer((int) $customer['id_customer']);
$c->delete();
}
break;
case $this->entities[$this->l('Addresses')]:
$addresses = Db::getInstance()->ExecuteS('SELECT `id_address` FROM `' . _DB_PREFIX_ . 'address`');
foreach ($addresses as $address) {
$a = new Address((int) $address['id_address']);
$a->delete();
}
break;
case $this->entities[$this->l('Combinations')]:
$products = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product`');
foreach ($products as $product) {
$p = new Product((int) $product['id_product']);
$p->deleteProductAttributes();
}
break;
case $this->entities[$this->l('Manufacturers')]:
$manufacturers = Db::getInstance()->ExecuteS('SELECT `id_manufacturer` FROM `' . _DB_PREFIX_ . 'manufacturer`');
foreach ($manufacturers as $manufacturer) {
$m = new Manufacturer((int) $manufacturer['id_manufacturer']);
$m->delete();
}
break;
case $this->entities[$this->l('Suppliers')]:
$suppliers = Db::getInstance()->ExecuteS('SELECT `id_supplier` FROM `' . _DB_PREFIX_ . 'supplier`');
foreach ($suppliers as $supplier) {
$m = new Supplier((int) $supplier['id_supplier']);
$m->delete();
}
break;
}
Image::clearTmpDir();
return true;
}
示例15: array
function customers_list()
{
global $Shopp, $Customers, $wpdb;
$db = DB::get();
$defaults = array('page' => false, 'deleting' => false, 'selected' => false, 'update' => false, 'newstatus' => false, 'pagenum' => 1, 'per_page' => false, 'start' => '', 'end' => '', 'status' => false, 's' => '', 'range' => '', 'startdate' => '', 'enddate' => '');
$args = array_merge($defaults, $_GET);
extract($args, EXTR_SKIP);
if ($page == "shopp-customers" && !empty($deleting) && !empty($selected) && is_array($selected)) {
foreach ($selected as $deletion) {
$Customer = new Customer($deletion);
$Billing = new Billing($Customer->id, 'customer');
$Billing->delete();
$Shipping = new Shipping($Customer->id, 'customer');
$Shipping->delete();
$Customer->delete();
}
}
if (!empty($_POST['save'])) {
check_admin_referer('shopp-save-customer');
if ($_POST['id'] != "new") {
$Customer = new Customer($_POST['id']);
$Billing = new Billing($Customer->id, 'customer');
$Shipping = new Shipping($Customer->id, 'customer');
} else {
$Customer = new Customer();
}
$Customer->updates($_POST);
if (!empty($_POST['new-password']) && !empty($_POST['confirm-password']) && $_POST['new-password'] == $_POST['confirm-password']) {
$Customer->password = wp_hash_password($_POST['new-password']);
if (!empty($Customer->wpuser)) {
wp_set_password($_POST['new-password'], $Customer->wpuser);
}
}
$Customer->save();
$Billing->updates($_POST['billing']);
$Billing->save();
$Shipping->updates($_POST['shipping']);
$Shipping->save();
}
$pagenum = absint($pagenum);
if (empty($pagenum)) {
$pagenum = 1;
}
if (!$per_page || $per_page < 0) {
$per_page = 20;
}
$index = $per_page * ($pagenum - 1);
if (!empty($start)) {
$startdate = $start;
list($month, $day, $year) = explode("/", $startdate);
$starts = mktime(0, 0, 0, $month, $day, $year);
}
if (!empty($end)) {
$enddate = $end;
list($month, $day, $year) = explode("/", $enddate);
$ends = mktime(23, 59, 59, $month, $day, $year);
}
$customer_table = DatabaseObject::tablename(Customer::$table);
$billing_table = DatabaseObject::tablename(Billing::$table);
$purchase_table = DatabaseObject::tablename(Purchase::$table);
$users_table = $wpdb->users;
$where = '';
if (!empty($s)) {
$s = stripslashes($s);
if (preg_match_all('/(\\w+?)\\:(?="(.+?)"|(.+?)\\b)/', $s, $props, PREG_SET_ORDER)) {
foreach ($props as $search) {
$keyword = !empty($search[2]) ? $search[2] : $search[3];
switch (strtolower($search[1])) {
case "company":
$where .= (empty($where) ? "WHERE " : " AND ") . "c.company LIKE '%{$keyword}%'";
break;
case "login":
$where .= (empty($where) ? "WHERE " : " AND ") . "u.user_login LIKE '%{$keyword}%'";
break;
case "address":
$where .= (empty($where) ? "WHERE " : " AND ") . "(b.address LIKE '%{$keyword}%' OR b.xaddress='%{$keyword}%')";
break;
case "city":
$where .= (empty($where) ? "WHERE " : " AND ") . "b.city LIKE '%{$keyword}%'";
break;
case "province":
case "state":
$where .= (empty($where) ? "WHERE " : " AND ") . "b.state='{$keyword}'";
break;
case "zip":
case "zipcode":
case "postcode":
$where .= (empty($where) ? "WHERE " : " AND ") . "b.postcode='{$keyword}'";
break;
case "country":
$where .= (empty($where) ? "WHERE " : " AND ") . "b.country='{$keyword}'";
break;
}
}
} elseif (strpos($s, '@') !== false) {
$where .= (empty($where) ? "WHERE " : " AND ") . "c.email='{$s}'";
} else {
$where .= (empty($where) ? "WHERE " : " AND ") . " (c.id='{$s}' OR CONCAT(c.firstname,' ',c.lastname) LIKE '%{$s}%' OR c.company LIKE '%{$s}%')";
}
}
//.........这里部分代码省略.........