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


PHP Accounts::save方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Accounts();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Accounts'])) {
         $model->attributes = $_POST['Accounts'];
         $model->user_id = Yii::app()->user->id;
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:aleksGrantHub,项目名称:homebookkeeping,代码行数:18,代码来源:AccountsController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $rules = array('account_name' => 'required', 'account_name' => 'required|unique:accounts');
     $messages = array('account_name.required' => 'Please enter the account name !', 'account_name.unique' => 'Account Name already taken !');
     $validation = Validator::make($input, $rules, $messages);
     if ($validation->passes()) {
         $accounts = new Accounts();
         $accounts->account_name = Input::get('account_name');
         $accounts->manager_id = Session::get('manager_id');
         $accounts->save();
         return Redirect::to('/accounts');
     } else {
         return Redirect::to('/accounts/create')->withErrors($validation);
     }
 }
开发者ID:avinash-,项目名称:idtv2,代码行数:21,代码来源:AccountsController.php

示例3: createAction

 public function createAction()
 {
     $this->view->disable();
     $status = "OK";
     $params = json_decode(file_get_contents('php://input'));
     $model = Accounts::findFirst("name='{$params->name}'");
     if ($model == null) {
         $model = new Accounts();
         $model->group = $params->group;
         $model->name = $params->name;
         $model->email = $params->email;
         $model->pm = $params->pm;
         $model->save();
     }
     echo json_encode(array("status" => $status));
 }
开发者ID:vietdh85,项目名称:vh-utility,代码行数:16,代码来源:AccountsController.php

示例4: actionCreate

 public function actionCreate()
 {
     $model = new Clients();
     $account = new Accounts();
     $preference = new Preferences();
     if (isset($_POST['Clients'], $_POST['Accounts'], $_POST['Preferences'])) {
         $model->attributes = $_POST['Clients'];
         $account->attributes = $_POST['Accounts'];
         $preference->attributes = $_POST['Preferences'];
         $model->login_name = $account->login_name;
         $model->client_code = RandomGenerator::generateString(AdminGlobals::CLIENT_CODE_LENGTH);
         $model->subscription_status = "active";
         $preference->prepaid_passwd = RandomGenerator::generateString(AdminGlobals::PREPAID_PASSWD_LENGTH);
         $account->account_name = $model->client_name;
         $account->email = $model->email;
         $account->is_visible = 0;
         $valid = $model->validate();
         $valid = $account->validate() && $valid;
         $valid = $preference->validate() && $valid;
         if ($valid) {
             $transaction = Yii::app()->db->beginTransaction();
             $success = $model->save(false);
             if ($success) {
                 $account->client_id = $preference->client_id = $model->id;
             }
             $success = $success && $account->save(false);
             $success = $success && $preference->save(false);
             if ($success) {
                 $transaction->commit();
                 if (Yii::app()->request->isAjaxRequest) {
                     $this->renderPartial('view', array('model' => $this->loadModel($model->id), 'account' => $account, 'preference' => $preference), false, true);
                     Yii::app()->end();
                 }
                 $this->redirect(array('view', 'id' => $model->id));
             }
             $transaction->rollBack();
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial('create', array('model' => $model, 'account' => $account, 'preference' => $preference), false, true);
         Yii::app()->end();
     }
     $this->render('create', array('model' => $model, 'account' => $account, 'preference' => $preference));
 }
开发者ID:thehiddennepali,项目名称:Sample-Code,代码行数:44,代码来源:ClientsController.php

示例5: actionCreate

 public function actionCreate()
 {
     $model = new Accounts();
     if (isset($_POST['Accounts'])) {
         $model->attributes = $_POST['Accounts'];
         if ($model->save()) {
             if (Yii::app()->request->isAjaxRequest) {
                 $this->renderPartial('view', array('model' => $this->loadModel($model->id)), false, true);
                 Yii::app()->end();
             }
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if (Yii::app()->request->isAjaxRequest) {
         $this->renderPartial('create', array('model' => $model), false, true);
         Yii::app()->end();
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:thehiddennepali,项目名称:Sample-Code,代码行数:19,代码来源:AccountsController.php

示例6: create

 public function create()
 {
     $account = new Accounts();
     $account->account_name = date("mdYGis");
     if ($account->save(false)) {
         $user = new Users();
         $user->user_name = $this->user_name;
         $user->user_lastname = $this->user_lastname;
         $user->user_email = strtolower($this->user_email);
         $user->user_admin = 1;
         $user->user_active = 1;
         $user->user_accountManager = 1;
         $user->account_id = $account->primaryKey;
         $passBeforeMD5 = $this->user_password;
         $user->user_password = md5($this->user_password);
         if ($user->save(false)) {
             /*$auth=Yii::app()->authManager;
             		$auth->assign('SuperUser',$user->primaryKey, 'return !Yii::app()->user->isGuest;', 'N;');
             		
             		$str = Yii::app()->controller->renderPartial('//templates/account/registration',array(
             			'user' => $user,
             			'passBeforeMD5' => $passBeforeMD5,
             			'applicationName' => Yii::app()->name,
             			'applicationUrl' => "http://".$_SERVER['SERVER_NAME'].Yii::app()->request->baseUrl,
             		),true);
             		
             		$subject = Yii::t('email','NewAccountRegistration');
             		
             		Yii::import('application.extensions.phpMailer.yiiPhpMailer');
             		$mailer = new yiiPhpMailer;
             		$mailer->Ready($subject, $str, array('name'=>$user->CompleteName,'email'=>$user->user_email), Emails::PRIORITY_NORMAL);
             		*/
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:lanzelotik,项目名称:celestic-community,代码行数:40,代码来源:RegisterForm.php

示例7: trim

 /**	function used to create or map with existing account if the contact has mapped with an account during import
  */
 function add_create_account()
 {
     global $imported_ids;
     global $current_user;
     $acc_name = trim($this->column_fields['accountid']);
     if (!isset($acc_name) || $acc_name == '') {
         return;
     }
     $arr = array();
     // check if it already exists
     $focus = new Accounts();
     $query = '';
     // if user is defining the ec_account id to be associated with this contact..
     //Modified to remove the spaces at first and last in ec_account name -- after 4.2 patch 2
     $acc_name = trim(addslashes($acc_name));
     //Modified the query to get the available account only ie., which is not deleted
     $query = "select ec_account.* from ec_account WHERE accountname like '{$acc_name}%' \n\t\t\t\t\tand ec_account.deleted=0 ORDER BY accountname ";
     $result = $this->db->query($query);
     $row = $this->db->fetchByAssoc($result, -1, false);
     // we found a row with that id
     if (isset($row['accountid']) && $row['accountid'] != -1) {
         $focus->id = $row['accountid'];
     }
     // if we didnt find the ec_account, so create it
     if (!isset($focus->id) || $focus->id == '') {
         $focus->column_fields['accountname'] = $acc_name;
         $focus->column_fields['assigned_user_id'] = $current_user->id;
         $focus->column_fields['modified_user_id'] = $current_user->id;
         $focus->save("Accounts");
         $acc_id = $focus->id;
         // avoid duplicate mappings:
         if (!isset($imported_ids[$acc_id])) {
             $imported_ids[$acc_id] = 1;
         }
     }
     // now just link the ec_account
     $this->column_fields["account_id"] = $focus->id;
 }
开发者ID:Pengzw,项目名称:c3crm,代码行数:40,代码来源:ImportContact.php

示例8: actionAdduser

 public function actionAdduser()
 {
     $model = new Accounts();
     // uncomment the following code to enable ajax-based validation
     /*
     if(isset($_POST['ajax']) && $_POST['ajax']==='accounts-edituser-form')
     {
     	echo CActiveForm::validate($model);
     	Yii::app()->end();
     }
     */
     if (isset($_POST['Accounts'])) {
         $model->attributes = $_POST['Accounts'];
         if ($model->validate()) {
             $newSalt = $this->generateSalt(10);
             $newPass = md5($newSalt . $model->password);
             $model->salt = $newSalt;
             $model->password = $newPass;
             $model->save();
             $this->redirect(array('index'));
         }
     }
     $this->render('adduser', array('model' => $model));
 }
开发者ID:Covert-Inferno,项目名称:prohd,代码行数:24,代码来源:AdminController.php

示例9: retrieve_account_id

function retrieve_account_id($account_name, $user_id)
{
    if ($account_name == "") {
        return null;
    }
    $db = PearDatabase::getInstance();
    $query = "select vtiger_account.accountname accountname,vtiger_account.accountid accountid from vtiger_account inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_account.accountid where vtiger_crmentity.deleted=0 and vtiger_account.accountname=?";
    $result = $db->pquery($query, array($account_name)) or die("Not able to execute insert");
    $rows_count = $db->getRowCount($result);
    if ($rows_count == 0) {
        require_once 'modules/Accounts/Accounts.php';
        $account = new Accounts();
        $account->column_fields[accountname] = $account_name;
        $account->column_fields[assigned_user_id] = $user_id;
        //$account->saveentity("Accounts");
        $account->save("Accounts");
        //mysql_close();
        return $account->id;
    } else {
        if ($rows_count == 1) {
            $row = $db->fetchByAssoc($result, 0);
            //mysql_close();
            return $row["accountid"];
        } else {
            $row = $db->fetchByAssoc($result, 0);
            //mysql_close();
            return $row["accountid"];
        }
    }
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:30,代码来源:thunderbirdplugin.php

示例10: generateAccount

 /**
  * Generates an account from the contact's company field, if that field has a value 
  */
 private static function generateAccount(Contacts $contact)
 {
     if (isset($contact->company)) {
         $account = new Accounts();
         $account->name = $contact->company;
         if ($account->save()) {
             $account->refresh();
             $contact->company = $account->nameId;
             $contact->update();
         }
     }
 }
开发者ID:shayanyi,项目名称:CRM,代码行数:15,代码来源:WebFormAction.php

示例11: trim

 /**
 	function used to create or map with existing account if the contact has mapped with an account during import
 */
 function add_create_account()
 {
     global $imported_ids;
     global $current_user;
     require_once 'modules/Accounts/Accounts.php';
     $acc_name = trim($this->column_fields['account_id']);
     if (!isset($acc_name) || $acc_name == '') {
         return;
     }
     $arr = array();
     $focus = new Accounts();
     $query = '';
     $acc_name = trim(addslashes($acc_name));
     $query = "select  ec_account.* from ec_account WHERE accountname like '%{$acc_name}%' and deleted=0";
     $result = $this->db->query($query);
     $row = $this->db->fetchByAssoc($result, -1, false);
     if (isset($row['accountid']) && $row['accountid'] != -1) {
         $focus->id = $row['accountid'];
     }
     if (!isset($focus->id) || $focus->id == '') {
         $focus->column_fields['accountname'] = $acc_name;
         $focus->column_fields['assigned_user_id'] = $current_user->id;
         $focus->column_fields['modified_user_id'] = $current_user->id;
         $focus->save("Accounts");
         $acc_id = $focus->id;
         // avoid duplicate mappings:
         if (!isset($imported_ids[$acc_id])) {
             $imported_ids[$acc_id] = 1;
         }
     }
     // now just link the ec_account
     $this->column_fields["account_id"] = $focus->id;
 }
开发者ID:honj51,项目名称:taobaocrm,代码行数:36,代码来源:Relsettings.php

示例12: array

 /**	function used to create or map with existing account if the contact has mapped with an account during import
  */
 function add_create_account()
 {
     global $adb;
     // global is defined in UsersLastImport.php
     global $imported_ids;
     global $current_user;
     $acc_name = $this->column_fields['account_id'];
     $adb->println("contact add_create acc=" . $acc_name);
     if (!isset($acc_name) || $acc_name == '') {
         return;
     }
     $arr = array();
     // check if it already exists
     $focus = new Accounts();
     $query = '';
     // if user is defining the vtiger_account id to be associated with this contact..
     //Modified to remove the spaces at first and last in vtiger_account name -- after 4.2 patch 2
     $acc_name = trim($acc_name);
     //Modified the query to get the available account only ie., which is not deleted
     $query = "select vtiger_crmentity.deleted, vtiger_account.* from vtiger_account, vtiger_crmentity WHERE accountname=? and vtiger_crmentity.crmid =vtiger_account.accountid and vtiger_crmentity.deleted=0";
     $result = $adb->pquery($query, array($acc_name));
     $row = $this->db->fetchByAssoc($result, -1, false);
     $adb->println("fetched account");
     $adb->println($row);
     // we found a row with that id
     if (isset($row['accountid']) && $row['accountid'] != -1) {
         $focus->id = $row['accountid'];
         $adb->println("Account row exists - using same id=" . $focus->id);
     }
     // if we didnt find the vtiger_account, so create it
     if (!isset($focus->id) || $focus->id == '') {
         $adb->println("Createing new vtiger_account");
         $focus->column_fields['accountname'] = $acc_name;
         $focus->column_fields['assigned_user_id'] = $current_user->id;
         $focus->column_fields['modified_user_id'] = $current_user->id;
         //$focus->saveentity("Accounts");
         $focus->save("Accounts");
         $acc_id = $focus->id;
         $adb->println("New Account created id=" . $focus->id);
         // avoid duplicate mappings:
         if (!isset($imported_ids[$acc_id])) {
             $adb->println("inserting vtiger_users last import for vtiger_accounts");
             // save the new vtiger_account as a vtiger_users_last_import
             $last_import = new UsersLastImport();
             $last_import->assigned_user_id = $current_user->id;
             $last_import->bean_type = "Accounts";
             $last_import->bean_id = $focus->id;
             $last_import->save();
             $imported_ids[$acc_id] = 1;
         }
     }
     $adb->println("prev contact accid=" . $this->column_fields["account_id"]);
     // now just link the vtiger_account
     $this->column_fields["account_id"] = $focus->id;
     $adb->println("curr contact accid=" . $this->column_fields["account_id"]);
 }
开发者ID:hardikk,项目名称:HNH,代码行数:58,代码来源:ImportContact.php

示例13: create_account

function create_account($username, $sessionid, $accountname, $email, $phone, $primary_address_street, $primary_address_city, $primary_address_state, $primary_address_postalcode, $primary_address_country)
{
    if (!validateSession($username, $sessionid)) {
        return null;
    }
    global $current_user, $log, $adb;
    $log->DEBUG("Entering with data " . $username . $accountname . $email . $phone . "<br>" . $primary_address_street . $primary_address_city . $primary_address_state . $primary_address_postalcode . $primary_address_country);
    require_once "modules/Users/Users.php";
    $seed_user = new Users();
    $user_id = $seed_user->retrieve_user_id($username);
    $current_user = $seed_user;
    $current_user->retrieve_entity_info($user_id, 'Users');
    require_once "modules/Accounts/Accounts.php";
    if (isPermitted("Accounts", "EditView") == "yes") {
        $query = "SELECT accountname FROM vtiger_account,vtiger_crmentity WHERE accountname =? and vtiger_account.accountid = vtiger_crmentity.crmid and vtiger_crmentity.deleted != 1";
        $result = $adb->pquery($query, array($accountname));
        if ($adb->num_rows($result) > 0) {
            return "Accounts";
            die;
        }
        $account = new Accounts();
        $account->column_fields['accountname'] = $accountname;
        $account->column_fields['email1'] = $email;
        $account->column_fields['phone'] = $phone;
        $account->column_fields['bill_street'] = $primary_address_street;
        $account->column_fields['bill_city'] = $primary_address_city;
        $account->column_fields['bill_state'] = $primary_address_state;
        $account->column_fields['bill_code'] = $primary_address_postalcode;
        $account->column_fields['bill_country'] = $primary_address_country;
        $account->column_fields['ship_street'] = $primary_address_street;
        $account->column_fields['ship_city'] = $primary_address_city;
        $account->column_fields['ship_state'] = $primary_address_state;
        $account->column_fields['ship_code'] = $primary_address_postalcode;
        $account->column_fields['ship_country'] = $primary_address_country;
        $account->column_fields['assigned_user_id'] = $user_id;
        $account->save('Accounts');
        if ($account->id != '') {
            return "Success";
        } else {
            return "Error while adding Account.Try again";
        }
    } else {
        return $accessDenied;
    }
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:45,代码来源:firefoxtoolbar.php

示例14: explode

$return_action = $_REQUEST['return_action'];
global $rstart;
//Added to fix 4600
$url = getBasic_Advance_SearchURL();
if (isset($_REQUEST['start']) && $_REQUEST['start'] != '') {
    $rstart = "&start=" . $_REQUEST['start'];
}
$quickedit_field = $_REQUEST['quickedit_field'];
$quickedit_value = $_REQUEST['quickedit_value'];
global $log;
$log->info("quickedit_field=" . $quickedit_field . ",quickedit_value=" . $quickedit_value);
if (isset($idlist)) {
    $recordids = explode(';', $idlist);
    $_REQUEST['ajxaction'] = "DETAILVIEW";
    for ($index = 0; $index < count($recordids); ++$index) {
        $recordid = $recordids[$index];
        $log->info("recordid=" . $recordid);
        if ($recordid == '') {
            continue;
        }
        // Save each module record with update value.
        $focus = new Accounts();
        $focus->retrieve_entity_info($recordid, 'Accounts');
        $focus->mode = 'edit';
        $focus->id = $recordid;
        $focus->column_fields[$quickedit_field] = $quickedit_value;
        $focus->save('Accounts');
        // END
    }
}
header("Location: index.php?module={$return_module}&action=" . $return_module . "Ajax&file=ListView&ajax=changestate" . $rstart . "&viewname=" . $viewid . "&errormsg=" . $errormsg . $url);
开发者ID:Pengzw,项目名称:c3crm,代码行数:31,代码来源:QuickEditSave.php

示例15: strtolower

 $website = str_replace($whitespace, "", strtolower($account->column_fields["accountname"]));
 $account->column_fields["website"] = "www." . $website . ".com";
 $account->column_fields["bill_street"] = $street_address_array[rand(0, $street_address_count - 1)];
 $account->column_fields["bill_city"] = $city_array[rand(0, $city_array_count - 1)];
 $account->column_fields["bill_state"] = "CA";
 $account->column_fields["bill_code"] = rand(10000, 99999);
 $account->column_fields["bill_country"] = 'USA';
 $account->column_fields["ship_street"] = $account->column_fields["bill_street"];
 $account->column_fields["ship_city"] = $account->column_fields["bill_city"];
 $account->column_fields["ship_state"] = $account->column_fields["bill_state"];
 $account->column_fields["ship_code"] = $account->column_fields["bill_code"];
 $account->column_fields["ship_country"] = $account->column_fields["bill_country"];
 $key = array_rand($comboFieldArray['industry_dom']);
 $account->column_fields["industry"] = $comboFieldArray['industry_dom'][$key];
 $account->column_fields["account_type"] = "Customer";
 $account->save("Accounts");
 $account_ids[] = $account->id;
 if ($i > 3) {
     $freetag = $adb->getUniqueId('vtiger_freetags');
     $query = "insert into vtiger_freetags values (?,?,?)";
     $qparams = array($freetag, $cloudtag[1], $cloudtag[1]);
     $res = $adb->pquery($query, $qparams);
     $date = $adb->formatDate(date('YmdHis'), true);
     $query_tag = "insert into vtiger_freetagged_objects values (?,?,?,?,?)";
     $tag_params = array($freetag, 1, $account->id, $date, Accounts);
     $result = $adb->pquery($query_tag, $tag_params);
 }
 //Create new opportunities
 $opp = new Potentials();
 $opp->column_fields["assigned_user_id"] = $assigned_user_id;
 $opp->column_fields["potentialname"] = $account_name . " - 1000 units";
开发者ID:nvh3010,项目名称:quancrm,代码行数:31,代码来源:PopulateSeedData.php


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