Documentation

Add

Description and parameters

int
CSaleUserAccount::Add(
 array arFields
);

Method adds a new user account as per parameters from the arFields array. Non-static method.

Call parameters

ParameterDescription
arFields Associative array with the new account parameters. Can contain the following keys: 
  • USER_ID - owner user code 
  • CURRENT_BUDGET - current amount deposited at the account 
  • CURRENCY - currency 
  • NOTES - text description 
  • LOCKED - flag for locked account 
  • DATE_LOCKED - account locking date

Returned values

Method returns code for added account or false otherwise.

Examples

if($USER->IsAuthorized())
{
$user_id = $USER->GetID();
$arFields = Array("USER_ID" => $user_id, "CURRENCY" => "USD", "CURRENT_BUDGET" => 0);
$accountID = CSaleUserAccount::Add($arFields);
}

Создание счета для текущего пользователя

if(!CSaleUserAccount::GetByUserID($USER->GetID(), "USD")){
   $arFields = Array("USER_ID" => $USER->GetID(), "CURRENCY" => "USD", "CURRENT_BUDGET" => 0);
   CSaleUserAccount::Add($arFields);  
}

© «Bitrix24», 2001-2024
Up