当前位置: 首页>>代码示例>>PHP>>正文


PHP Customers::getIncremented方法代码示例

本文整理汇总了PHP中Customers::getIncremented方法的典型用法代码示例。如果您正苦于以下问题:PHP Customers::getIncremented方法的具体用法?PHP Customers::getIncremented怎么用?PHP Customers::getIncremented使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Customers的用法示例。


在下文中一共展示了Customers::getIncremented方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Create

 /**
  * Create a new customer 
  * 
  * List of all the array parameters
  * 
  * @param array_item firstname
  * @param array_item lastname
  * @param array_item email
  * @param array_item password
  * @param array_item company
  * @param array_item statusId
  * @param array_item gender
  * @param array_item birthplace
  * @param array_item birthdate
  * @param array_item birthcountry
  * @param array_item birthnationality
  * @param array_item vat
  * @param array_item taxpayernumber
  * @param array_item contact
  * @param array_item contacttype
  * @param array_item address
  * @param array_item city
  * @param array_item code
  * @param array_item country
  * @param array_item area
  * @param array_item legalform
  * @param array_item company_type_id
  * @param array_item welcome_mail
  * @param array_item parent_id
  * @param array_item isreseller
  */
 public static function Create($data)
 {
     $locale = Shineisp_Registry::getInstance()->Zend_Locale;
     $customer = new Customers();
     $isDisabled = false;
     $language_id = Languages::get_language_id_by_code((string) $locale);
     // By default, welcome mail is sent
     $data['welcome_mail'] = isset($data['welcome_mail']) ? intval($data['welcome_mail']) : true;
     // Customer's parameters.
     $customer->company = !empty($data['company']) ? $data['company'] : null;
     $customer->firstname = !empty($data['firstname']) ? $data['firstname'] : null;
     $customer->lastname = !empty($data['lastname']) ? $data['lastname'] : null;
     $customer->gender = !empty($data['gender']) ? $data['gender'] : null;
     $customer->email = $data['email'] ? $data['email'] : null;
     $customer->password = crypt($data['password']);
     $customer->birthplace = !empty($data['birthplace']) ? $data['birthplace'] : null;
     $customer->birthdate = !empty($data['birthdate']) ? Shineisp_Commons_Utilities::formatDateIn($data['birthdate']) : null;
     $customer->birthdistrict = !empty($data['birthdistrict']) ? $data['birthdistrict'] : null;
     $customer->birthcountry = !empty($data['birthcountry']) ? $data['birthcountry'] : null;
     $customer->birthnationality = !empty($data['birthnationality']) ? $data['birthnationality'] : null;
     $customer->note = !empty($data['note']) ? $data['note'] : Null;
     $customer->vat = !empty($data['vat']) ? $data['vat'] : Null;
     $customer->taxpayernumber = !empty($data['taxpayernumber']) ? $data['taxpayernumber'] : Null;
     // Let's try to get status_id from status
     if (isset($data['status']) && !empty($data['status'])) {
         $customer->status_id = Statuses::id($data['status'], 'Customers');
         $isDisabled = isset($data['status']) && strtolower($data['status']) == 'disabled' ? true : false;
     } else {
         $customer->status_id = !empty($data['status_id']) ? $data['status_id'] : Statuses::id('Active', 'Customers');
     }
     $customer->legalform_id = !empty($data['legalform']) ? $data['legalform'] : Null;
     $customer->type_id = !empty($data['company_type_id']) ? $data['company_type_id'] : Null;
     $customer->parent_id = !empty($data['parent_id']) ? $data['parent_id'] : Null;
     $customer->isreseller = !empty($data['isreseller']) ? $data['isreseller'] : Null;
     $customer->language_id = !empty($language_id) ? intval($language_id) : 1;
     $customer->created_at = date('Y-m-d H:i:s');
     $customer->updated_at = date('Y-m-d H:i:s');
     // Try to get the real isp_id, based on logged user or on request uri
     // TODO: this should be done better
     $customer->isp_id = Isp::getCurrentId();
     // Generate an UUID. Used for API when you need to sync customers between services
     // TODO: allow custom uuid coming from api ? If yes, we should check for uniqueness in database
     $customer->uuid = Shineisp_Commons_Uuid::generate();
     // customer disabled? Disable its password
     if ($isDisabled) {
         $customer->password = '!' . $customer->password;
     }
     // Save the data
     $customer->save();
     if (!empty($data['contact'])) {
         $customer->Contacts[0]->contact = !empty($data['contact']) ? $data['contact'] : Null;
         $customer->Contacts[0]->type_id = !empty($data['contacttypes']) ? $data['contacttypes'] : Null;
         $customer->Contacts[0]->base = 1;
         $customer->save();
     }
     if (!empty($data['address'])) {
         $customer->Addresses[0]->address = !empty($data['address']) ? $data['address'] : Null;
         $customer->Addresses[0]->city = !empty($data['city']) ? $data['city'] : Null;
         $customer->Addresses[0]->code = !empty($data['code']) ? $data['code'] : Null;
         $customer->Addresses[0]->country_id = !empty($data['country_id']) ? $data['country_id'] : Null;
         $customer->Addresses[0]->area = !empty($data['area']) ? $data['area'] : Null;
         $customer->save();
     }
     $customerID = $customer->getIncremented();
     // Add the customer email in the newsletter list
     if (!$isDisabled) {
         NewslettersSubscribers::customer_optIn($customer['customer_id']);
     }
     // Send the welcome email
//.........这里部分代码省略.........
开发者ID:kokkez,项目名称:shineisp,代码行数:101,代码来源:Customers.php


注:本文中的Customers::getIncremented方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。