Inheritance: extends apiModel
Beispiel #1
0
function doLogin($referer_in, $post)
{
    extract($post);
    if ($submit_login) {
        if (!recaptchaCheck()) {
            return 0;
        }
        $database = connectToDatabase();
        $account = new Account($username);
        if ($account->checkPassword($password)) {
            session_name($username);
            $_SESSION['username'] = $username;
            $_SESSION['id'] = $account->getDatabaseID();
            if ($referer) {
                doRedirect($referer);
            } else {
                renderError("Cannot redirect you to the proper place.  Please press the back button and try again.");
                return 0;
            }
        } else {
            renderError("Your password is incorrect.  Please try again");
            return 0;
        }
    } else {
        renderError("You need to login to do that.");
        displayLoginForm($referer_in);
        return 0;
    }
}
 public function overwriteRead($return)
 {
     $objs = $return['objs'];
     foreach ($objs as $obj) {
         if (isset($obj->news_postdate)) {
             $obj->news_postdate = date("d-m-Y", strtotime($obj->news_postdate));
         }
         if (isset($obj->news_updatedate)) {
             $obj->news_updatedate = date("d-m-Y", strtotime($obj->news_updatedate));
         }
         if (isset($obj->news_validity_begin)) {
             $obj->news_validity_begin = date("d-m-Y", strtotime($obj->news_validity_begin));
         }
         if (isset($obj->news_validity_end)) {
             $obj->news_validity_end = date("d-m-Y", strtotime($obj->news_validity_end));
         }
         if (isset($obj->news_author)) {
             $acc = new Account();
             $acc->getByID($obj->news_author);
             $obj->news_author = $acc->admin_nama_depan;
         }
         if (isset($obj->news_channel_id)) {
             $acc = new NewsChannel();
             $acc->getByID($obj->news_channel_id);
             $obj->news_channel_id = $acc->channel_name;
         }
     }
     //pr($return);
     return $return;
 }
 /**
  * @param Identifier $memberId
  * @param string $name
  * @param Email $email
  * @param Account $account
  */
 public function __construct(Identifier $memberId, $name, Email $email, Account $account)
 {
     $this->memberId = $memberId;
     $this->name = $name;
     $this->email = $email;
     $this->account = $account->information();
 }
Beispiel #4
0
 public function searchResults($search)
 {
     $accounts = new Accounts();
     $accounts->userID = $_SESSION['userID'];
     $_SESSION['accounts'] = $accounts->getAccounts();
     $_SESSION['accountID'] = $search['accountID'];
     $this->setAccountSelected($_SESSION['accountID']);
     $account = new Account();
     $account->accountID = $_SESSION['accountID'];
     $account->getAccount();
     $_SESSION['searchDetails'] = $search['searchDetails'];
     $_SESSION['fromAmount'] = $search['fromAmount'];
     $_SESSION['toAmount'] = $search['toAmount'];
     if (strlen($search['toDate']) != 0) {
         $_SESSION['toDate'] = $search['toDate'];
     } else {
         $_SESSION['toDate'] = date('Y-m-d');
     }
     if (strlen($search['fromDate']) != 0) {
         $_SESSION['fromDate'] = $search['fromDate'];
     } else {
         $_SESSION['fromDate'] = date("Y-m-d", strtotime("-1 months"));
     }
     $_SESSION['period'] = date('d/m/Y', strtotime($_SESSION['fromDate'])) . ' to ' . date('d/m/Y', strtotime($_SESSION['toDate']));
     $transactions = new Transactions();
     $transactions->accountID = $_SESSION['accountID'];
     $arr = array('openBalance' => $account->openBalance);
     $_SESSION['history'] = $transactions->getTransactions($arr);
     $_SESSION['found'] = $transactions->countTransactions($arr);
     $_SESSION['historyDebit'] = $transactions->getDebits($arr);
     $_SESSION['historyCredit'] = $transactions->getCredits($arr);
     $_SESSION['historyFee'] = $transactions->getFees($arr);
     $_SESSION['historyNet'] = $transactions->getNet($arr);
 }
 public function testRequiredAttributesAreMissingFromLayout()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $account = AccountTestHelper::createAccountByNameForOwner('aTestAccount', $super);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/create');
     $this->assertNotContains('There are required fields missing from the following layout', $content);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
     $this->assertNotContains('There are required fields missing from the following layout', $content);
     $this->setGetArray(array('id' => $account->id));
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/edit');
     $this->assertNotContains('There are required fields missing from the following layout', $content);
     //Now create an attribute that is required.
     $this->createTextCustomFieldByModule('AccountsModule', 'text');
     $content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/create');
     $this->assertContains('There are required fields missing from the following layout', $content);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
     $this->assertNotContains('There are required fields missing from the following layout', $content);
     $this->setGetArray(array('id' => $account->id));
     $content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/edit');
     $this->assertContains('There are required fields missing from the following layout', $content);
     //Remove the new field.
     $modelAttributesAdapterClassName = TextAttributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName(new Account());
     $adapter->removeAttributeMetadata('text');
     RequiredAttributesValidViewUtil::resolveToRemoveAttributeAsMissingRequiredAttribute('Account', 'text');
     $account = new Account();
     $this->assertFalse($account->isAttribute('text'));
     unset($account);
 }
Beispiel #6
0
 /**
  * Logs in the user using the given username and password in the model.
  * @return boolean whether login is successful
  */
 public function save()
 {
     $user = new Users();
     $user->setAttributes($this->attributes);
     $user->setAttribute("password", BaseTool::ENPWD($this->password));
     if ($user->validate() && $user->save()) {
         $accountarray = array('user_id' => Yii::app()->db->getLastInsertID(), 'total' => 0, 'use_money' => 0, 'no_use_money' => 0, 'newworth' => 0);
         $newAccount = new Account();
         $newAccount->setAttributes($accountarray);
         $newAccount->save();
         //发送邮件
         $activecode = BaseTool::getActiveMailCode($this->username);
         $message = MailTemplet::getActiveEmail($this->username, $activecode);
         $mail = Yii::app()->Smtpmail;
         $mail->SetFrom(Yii::app()->params['adminEmail']);
         $mail->Subject = "好帮贷测试邮件";
         $mail->MsgHTML($message);
         $mail->AddAddress($this->email);
         if ($mail->Send()) {
             $user->updateAll(array("regtaken" => $activecode, "regativetime" => time() + 60 * 60), "username=:username", array(":username" => $this->username));
         }
         Yii::import("application.models.form.LoginForm", true);
         $loginform = new LoginForm();
         $loginarray = array('rememberMe' => false, 'username' => $this->username, 'password' => $this->password);
         $loginform->setAttributes($loginarray);
         if ($loginform->validate() && $loginform->login()) {
         }
         return true;
     } else {
         $usererror = $user->errors;
         $this->addError("username", current(current($usererror)));
         return false;
     }
 }
Beispiel #7
0
 public function init()
 {
     $account = new Account();
     $account->accountID = $_SESSION['payAccountID'];
     $account->getAccount();
     $_SESSION['payAccount'] = $account->accountName;
 }
Beispiel #8
0
 /**
  * Test that depositing the same amount on contracted and non contracted
  * class yields the same result.
  */
 public function testDepositMoney()
 {
     $this->account->deposit($this->amount);
     $this->accountContract->deposit($this->amount);
     $this->assertEquals($this->amount, $this->account->getBalance());
     $this->assertEquals($this->account->getBalance(), $this->accountContract->getBalance());
 }
 public function create()
 {
     $user = Confide::user();
     //throw new Exception($user);
     if (Request::isMethod('GET')) {
         $patient = Patient::find($user->id);
         return View::make('home/patient/create', compact('user', 'patient'));
     } elseif (Request::isMethod('POST')) {
         // Create a new Appointment with the given data
         $user = Confide::user();
         $user->fill(Input::all());
         $user->save();
         // If patient already exists in system
         $patient = Patient::find($user->id);
         if ($patient != null) {
             // Retreive Patient
         } else {
             // Create a new account for the Patient
             $account = new Account();
             $account->patient_id = $user->id;
             $account->save();
             // Create a new Patient
             $patient = new Patient();
             $patient->fill(Input::all());
             //$patient->dob = new Date();
             $patient->user_id = $user->id;
             $patient->save();
         }
         return Redirect::route('home.index');
     }
 }
Beispiel #10
0
 public static function query($q)
 {
     $db = getDatabase();
     try {
         $stmt = $db->prepare($q);
         $stmt->execute();
     } catch (PDOException $ex) {
         Utils::HandlePDOException($ex);
     }
     $len = $stmt->rowCount();
     if ($len <= 0) {
         throw new Exception("no item");
     } else {
         if ($len == 1) {
             $temp = new Account();
             $temp->initWithVar($stmt->fetch());
             return $temp;
         } else {
             $result = array();
             foreach ($stmt->fetchAll() as $thread) {
                 $temp = new Account();
                 $temp->initWithVar($thread);
                 array_push($result, $temp);
             }
             return $result;
         }
     }
 }
Beispiel #11
0
 public function setUp()
 {
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('current_user');
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->contact = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->account = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     //Accounts to Contacts
     $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
     $_REQUEST['relate_id'] = $this->contact->id;
     $_REQUEST['relate_to'] = 'projects_contacts';
 }
Beispiel #12
0
 /**
  * Create test user
  *
  */
 public function setUp()
 {
     $this->markTestIncomplete('Skipping for now while investigating');
     //setup test portal user
     $this->_setupTestUser();
     $this->_soapClient = new nusoapclient($GLOBALS['sugar_config']['site_url'] . '/soap.php', false, false, false, false, false, 600, 600);
     $this->_login();
     //setup test account
     $account = new Account();
     $account->name = 'test account for bug 39855';
     $account->assigned_user_id = 'SugarUser';
     $account->save();
     $this->_acc = $account;
     //setup test cases
     $case1 = new aCase();
     $case1->name = 'test case for bug 39855 ASDF';
     $case1->account_id = $this->_acc->id;
     $case1->status = 'New';
     $case1->save();
     $this->_case1 = $case1;
     $case2 = new aCase();
     //$account->id = 'a_'.$unid;
     $case2->name = 'test case for bug 39855 QWER';
     $case2->account_id = $this->_acc->id;
     $case2->status = 'Rejected';
     $case2->save();
     $this->_case2 = $case2;
 }
Beispiel #13
0
 public function setUp()
 {
     global $current_user, $currentModule;
     global $beanList;
     require 'include/modules.php';
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->contact = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->account = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     //Accounts to Contacts
     $GLOBALS['db']->query("INSERT INTO accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
     $_REQUEST['relate_id'] = $this->contact->id;
     $_REQUEST['relate_to'] = 'projects_contacts';
 }
Beispiel #14
0
 function execute(&$bean)
 {
     if ($bean->sales_stage == "completed") {
         $realty_list = $bean->get_linked_beans("realty_opportunities", "Realty");
         if (!empty($bean->contact_id)) {
             $contact = new Contact();
             $contact->retrieve($bean->contact_id);
             foreach ($realty_list as $realty) {
                 if ($realty->operation == 'rent') {
                     $contact->load_relationship("realty_contacts_rent");
                     $contact->realty_contacts_rent->add($realty->id);
                 } elseif ($realty->operation == 'buying') {
                     $contact->load_relationship("realty_contacts_buying");
                     $contact->realty_contacts_buying->add($realty->id);
                 }
             }
         }
         if (!empty($bean->account_id)) {
             $account = new Account();
             $account->retrieve($bean->account_id);
             foreach ($realty_list as $realty) {
                 if ($realty->operation == 'rent') {
                     $account->load_relationship("realty_accounts_rent");
                     $account->realty_accounts_rent->add($realty->id);
                 } elseif ($realty->operation == 'buying') {
                     $account->load_relationship("realty_accounts_buying");
                     $account->realty_accounts_buying->add($realty->id);
                 }
             }
         }
     }
 }
 public function writeDefaultConfig($config)
 {
     $account = new Account();
     $account->name = $config['name'];
     $account->workingdays = '31';
     $account->type = 'unlimited';
     $account->save();
     // add timeitem types
     $tit = new TimeItemType();
     $tit->account_id = $account->id;
     $tit->name = 'DEV';
     $tit->save();
     $tit = new TimeItemType();
     $tit->account_id = $account->id;
     $tit->name = 'ADMIN';
     $tit->default_item = true;
     $tit->save();
     $admin_settings = new Setting();
     $admin_settings->theme = 'green';
     $admin = new User();
     $admin->Account = $account;
     $admin->administrator = true;
     $admin->username = $config['username'];
     $admin->password = md5($config['password']);
     $admin->Setting = $admin_settings;
     $admin->save();
     return $account->id;
 }
Beispiel #16
0
 public function setUp()
 {
     global $current_user, $currentModule;
     $mod_strings = return_module_language($GLOBALS['current_language'], "Contacts");
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $unid = uniqid();
     $time = date('Y-m-d H:i:s');
     $contact = new Contact();
     $contact->id = 'c_' . $unid;
     $contact->first_name = 'testfirst';
     $contact->last_name = 'testlast';
     $contact->new_with_id = true;
     $contact->disable_custom_fields = true;
     $contact->save();
     $this->c = $contact;
     $account = new Account();
     $account->id = 'a_' . $unid;
     $account->first_name = 'testfirst';
     $account->last_name = 'testlast';
     $account->assigned_user_id = 'SugarUser';
     $account->new_with_id = true;
     $account->disable_custom_fields = true;
     $account->save();
     $this->a = $account;
     $ac_id = 'ac_' . $unid;
     $this->ac_id = $ac_id;
     $GLOBALS['db']->query("insert into accounts_contacts (id , contact_id, account_id, date_modified, deleted) values ('{$ac_id}', '{$contact->id}', '{$account->id}', '{$time}', 0)");
 }
Beispiel #17
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $account = new Account();
     ///$account->setDomain(Input::get('domain'));
     $account->setNit(Input::get('nit'));
     $account->setName(Input::get('name'));
     $account->setEmail(Input::get('email'));
     // return $account->getErrorMessage();
     if ($account->Guardar()) {
         //redireccionar con el mensaje a la siguiente vista
         Session::flash('mensaje', $account->getErrorMessage());
         $direccion = "http://cascada.ipx";
         //enviando correo de bienvenida
         global $correo;
         $correo = $account->getEmail();
         // return Response::json($correo);
         Mail::send('emails.bienvenida', array('direccion' => $direccion, 'name' => $account->getName(), 'nit' => $account->getNit()), function ($message) {
             global $correo;
             $message->to($correo, '')->subject('EMIZOR');
         });
         //
         // $direccion = "/crear/sucursal";
         return Redirect::to($direccion);
     }
     Session::flash('error', $account->getErrorMessage());
     return Redirect::to('crear');
 }
 public function actionRandomOperation()
 {
     $rec = new Account();
     $rec->amount = rand(-1000, 1000);
     $rec->save();
     echo "OK";
 }
 function display($defines)
 {
     global $app_strings;
     global $currentModule;
     $title = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_TITLE'];
     $accesskey = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_KEY'];
     $value = $app_strings['LBL_COMPOSE_EMAIL_BUTTON_LABEL'];
     $this->module = 'Emails';
     $to_addrs = '';
     $additionalFormFields = array();
     $additionalFormFields['type'] = 'out';
     // cn: bug 5727 - must override the parents' parent for contacts (which could be an Account)
     $additionalFormFields['parent_type'] = $defines['focus']->module_dir;
     $additionalFormFields['parent_id'] = $defines['focus']->id;
     $additionalFormFields['parent_name'] = $defines['focus']->name;
     if (isset($defines['focus']->email1)) {
         $to_addrs = $defines['focus']->email1;
     } elseif ($defines['focus']->object_name == 'Case') {
         require_once 'modules/Accounts/Account.php';
         $acct = new Account();
         $acct->retrieve($defines['focus']->account_id);
         $to_addrs = $acct->email1;
     }
     if (!empty($to_addrs)) {
         $additionalFormFields['to_email_addrs'] = $to_addrs;
     }
     if (ACLController::moduleSupportsACL($defines['module']) && !ACLController::checkAccess($defines['module'], 'edit', true)) {
         $button = "<input title='{$title}' class='button' type='button' name='button' value='  {$value}  '/>\n";
         return $button;
     }
     $button = $this->_get_form($defines, $additionalFormFields);
     $button .= "<input title='{$title}' accesskey='{$accesskey}' class='button' type='submit' name='button' value='  {$value}  '/>\n";
     $button .= "</form>";
     return $button;
 }
    public function signin() {
        $email = $this->f3->get('POST.email');
        $password = $this->f3->get('POST.password');

        $v = new Valitron\Validator(array('Email' => $email, 'Password' => $password));
        $v->rule('required', ['Email', 'Password']);
        $v->rule('email', 'Email');

        if ($v->validate()) {
            $account = new Account($this->db);
            $pwd = md5($password);
            $acc = $account->select("*", "email='$email' and password='$pwd'");
            if ($acc) {
                $this->f3->set('SESSION.acc', $acc);
                $acc = $acc[0];
                $acc['lastlogin'] = date('Y-m-d H:i:s');
                $account->update($acc,'id='.$acc['id']);
                $this->f3->reroute('/dashboard');
            } else {
                $this->f3->set('email', $email);
                $this->f3->set('errors', array(array('Login fail, wrong username or password')));
                echo Template::instance()->render('index.html');
            }
        } else {
            $this->f3->set('email', $email);
            $this->f3->set('errors', $v->errors());
            echo Template::instance()->render('index.html');
        }
    }
Beispiel #21
0
 public function addAccount($username, $password, $firstname)
 {
     // Loop through the current accounts to see if the username already exists
     // If the username does not exist, we will push the new account in to the array & return true
     // Else, return false
     $accountExists = false;
     foreach ($this::$data as $account) {
         if ($account->getUsername() == $username) {
             $accountExists = true;
             break;
         }
     }
     if ($accountExists) {
         return false;
     } else {
         $account = new Account();
         $account->setUsername($username);
         $account->setPassword($password);
         $account->setFirstname($firstname);
         echo "adding to data..";
         array_push(InMemoryDatabase::$data, $account);
         var_dump($this::$data);
         return true;
     }
 }
 public function display()
 {
     // Cancel the transfer if a request is submitted.
     if (isset($_POST['cancel'])) {
         $transfer = new Transfer();
         $transfer->cancelSessions();
         unset($_POST['cancel']);
         $pos = strrpos($_SERVER['HTTP_REFERER'], '/');
         $pos = strlen($_SERVER['HTTP_REFERER']) - $pos;
         header("Location: " . substr($_SERVER['HTTP_REFERER'], 0, -$pos + 1) . "New-Funds-Transfer");
         // Otherwise process the transfer.
     } elseif (isset($_POST['submit'])) {
         unset($_POST['submit']);
         // To negate any back button issues.
         if (!isset($_SESSION['transferDate']) || !isset($_SESSION['transferDescription']) || !isset($_SESSION['transferRemitter']) || !isset($_SESSION['transferAmount'])) {
             header('Location: New-Funds-Transfer');
         }
         if (isset($_POST['password'])) {
             $validate = new Validation();
             // Validate the password.
             try {
                 $validate->password($_POST['password']);
             } catch (ValidationException $e) {
                 $_SESSION['error'] = $e->getError();
             }
             if (isset($_SESSION['error'])) {
                 unset($_POST['password']);
                 header('Location: New-Funds-Transfer');
             } else {
                 $user = new Users();
                 $user->userID = $_SESSION['userID'];
                 $user->password = $_POST['password'];
                 unset($_POST['password']);
                 // Confirm the password is corredt.
                 try {
                     $user->confirmPassword();
                 } catch (ValidationException $e) {
                     $_SESSION['error'] = $e->getError();
                 }
                 if (isset($_SESSION['error'])) {
                     header('Location: New-Funds-Transfer');
                 } else {
                     // If everything is ok, process the transfer and display
                     // the Transfer Acknowledgement Page
                     $account = new Account();
                     $account->accountID = $_SESSION['transferAccountID'];
                     if ($account->processTransfer()) {
                         include 'view/layout/transferack.php';
                     } else {
                         // Otherwise return to the Check Transfer page.
                         $checkTransfer = new CheckTransfer();
                         $checkTransfer->init();
                         include 'view/layout/checktransfer.php';
                     }
                 }
             }
         }
     }
 }
 public function doSignUp($request, $dbConnection)
 {
     $account = new Account($dbConnection);
     $account->setPassword($request['password']);
     $account->setUsername($request['username']);
     $account->setEmail($request['email']);
     $account->insert();
 }
Beispiel #24
0
 public static function initializeAccount($options)
 {
     $account = new Account();
     $account['name'] = isset($options['name']) ? $options['name'] : 'New Account';
     $account['type'] = isset($options['type']) ? $options['type'] : Account::TYPE_NORMAL;
     $account->save();
     return $account->account_id;
 }
Beispiel #25
0
 public function deductAccountForOrder(Account $account, Order $order, $money, $remark = '')
 {
     $account->deduct($money);
     // log
     Pdb::insert(array('subject' => $this->id, 'action' => 'DeductAccount', 'target' => $order->id, 'info' => json_encode(compact('money', 'remark')), 'time=NOW()' => null), UserLog::$table);
     // accout log
     Pdb::insert(array('`time` = NOW()' => null, 'account' => $account->id, 'name' => '订单扣款', '`order`' => $order->id, 'money' => $money, '`type`' => 'consume', 'remain' => $account->remain(), 'pay_type' => '账户扣款'), AccountHistory::$table);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Account $account, $token, $image_id)
 {
     $image = $account->images()->find($image_id);
     if ($image) {
         return Response::json(['status' => ['message' => 'OK', 'code' => 1], 'data' => $image->toArray(), 'meta' => []], 200);
     }
     return Response::json(['status' => ['message' => 'Not Found', 'code' => 2], 'data' => [], 'meta' => ['errors' => ["The resource you requested was not found."]]], 404);
 }
 protected function createTransaction(\SimpleXMLElement $node, Transaction $tx, Account $account)
 {
     $nodes = ['accountFrom' => $account->getAccountNumber(), 'currency' => $tx->getCurrency(), 'amount' => number_format($tx->getAmount(), 2), 'accountTo' => $tx->getAccountNumber(), 'ks' => $tx->getConstantSymbol(), 'vs' => $tx->getVariableSymbol(), 'ss' => $tx->getSpecificSymbol(), 'bic' => $tx->getBankCode(), 'date' => $tx->getDate()->format('Y-m-d'), 'comment' => $tx->getComment(), 'benefName' => $tx->getBenefName(), 'benefStreet' => $tx->getBenefStreet(), 'benefCity' => $tx->getBenefCity(), 'benefCountry' => $tx->getBenefCountry(), 'remittanceInfo1' => $tx->getRemittanceInfo1(), 'remittanceInfo2' => $tx->getRemittanceInfo2(), 'remittanceInfo3' => $tx->getRemittanceInfo3(), 'paymentType' => $tx->getSpecification()];
     foreach ($nodes as $el => $value) {
         if (!empty($value)) {
             $node->addChild($el, $value);
         }
     }
 }
 protected function createTransaction(\SimpleXMLElement $node, Transaction $tx, Account $account)
 {
     $nodes = ['accountFrom' => $account->getAccountNumber(), 'currency' => $tx->getCurrency(), 'amount' => number_format($tx->getAmount(), 2), 'accountTo' => $tx->getAccountNumber(), 'bankCode' => $tx->getBankCode(), 'ks' => $tx->getConstantSymbol(), 'vs' => $tx->getVariableSymbol(), 'ss' => $tx->getSpecificSymbol(), 'date' => $tx->getDate()->format('Y-m-d'), 'messageForRecipient' => $tx->getUserMessage(), 'comment' => $tx->getComment(), 'paymentType' => $tx->getSpecification()];
     foreach ($nodes as $el => $value) {
         if (!empty($value)) {
             $node->addChild($el, $value);
         }
     }
 }
Beispiel #29
0
 function process_record_hook(&$bean, $event, $arguments)
 {
     $bean->acct_mgr_c = '';
     $full_copy = new Account();
     $full_copy->retrieve($bean->account_id);
     $full_copy->custom_fields->retrieve();
     $bean->acct_mgr_c = $full_copy->assigned_user_name;
     echo "<!-- FINDMOI " . $bean->acct_mgr_c . " -->\n";
 }
 /**
  * Success
  */
 protected function success(Account $account, $balance)
 {
     // TODO: вынести в шаблон
     $props = $account->toArray(false);
     $result = array('id' => (int) $account['id'], 'type' => (int) $account['type_id'], 'name' => $account['name'], 'currency' => (int) $account['currency_id'], 'comment' => $account['description'], 'initBalance' => $balance, 'totalBalance' => $balance, 'state' => (int) $account['state']);
     // Content-Type ставим ручками поскольку не используем шаблоны
     $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     return $this->renderText(json_encode(array('result' => array('account' => $result, 'text' => 'Счёт успешно добавлен'))));
 }