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


PHP UserListFactory::StartTransaction方法代码示例

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


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

示例1: releaseAllAccruals

 static function releaseAllAccruals($user_id, $effective_date = NULL)
 {
     Debug::Text('Release 100% of all accruals!', __FILE__, __LINE__, __METHOD__, 10);
     if ($user_id == '') {
         return FALSE;
     }
     if ($effective_date == '') {
         $effective_date = TTDate::getTime();
     }
     Debug::Text('Effective Date: ' . TTDate::getDate('DATE+TIME', $effective_date), __FILE__, __LINE__, __METHOD__, 10);
     $ulf = new UserListFactory();
     $ulf->getById($user_id);
     if ($ulf->getRecordCount() > 0) {
         $user_obj = $ulf->getCurrent();
     } else {
         return FALSE;
     }
     //Get all PSE acccount accruals
     $psealf = new PayStubEntryAccountListFactory();
     $psealf->getByCompanyIdAndStatusIdAndTypeId($user_obj->getCompany(), 10, 50);
     if ($psealf->getRecordCount() > 0) {
         $ulf->StartTransaction();
         foreach ($psealf as $psea_obj) {
             //Get PSE account that affects this accrual.
             $psealf_tmp = new PayStubEntryAccountListFactory();
             $psealf_tmp->getByCompanyIdAndAccrualId($user_obj->getCompany(), $psea_obj->getId());
             if ($psealf_tmp->getRecordCount() > 0) {
                 $release_account_id = $psealf_tmp->getCurrent()->getId();
                 $psaf = new PayStubAmendmentFactory();
                 $psaf->setStatus(50);
                 //Active
                 $psaf->setType(20);
                 //Percent
                 $psaf->setUser($user_obj->getId());
                 $psaf->setPayStubEntryNameId($release_account_id);
                 $psaf->setPercentAmount(100);
                 $psaf->setPercentAmountEntryNameId($psea_obj->getId());
                 $psaf->setEffectiveDate($effective_date);
                 $psaf->setDescription('Release Accrual Balance');
                 if ($psaf->isValid()) {
                     Debug::Text('Release Accrual Is Valid!!: ', __FILE__, __LINE__, __METHOD__, 10);
                     $psaf->Save();
                 }
             } else {
                 Debug::Text('No Release Account for this Accrual!!', __FILE__, __LINE__, __METHOD__, 10);
             }
         }
         //$ulf->FailTransaction();
         $ulf->CommitTransaction();
     } else {
         Debug::Text('No Accruals to release...', __FILE__, __LINE__, __METHOD__, 10);
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:54,代码来源:PayStubAmendmentFactory.class.php

示例2: postSave

 function postSave()
 {
     $this->removeCache($this->getId());
     $this->remoteSave();
     if ($this->getDeleted() == FALSE) {
         //Add base currency for this new company.
         if ($this->getEnableAddCurrency() == TRUE) {
             $clf = new CurrencyListFactory();
             $clf->getByCompanyId($this->getId());
             if ($clf->getRecordCount() == 0) {
                 Debug::text('Adding Default Currency', __FILE__, __LINE__, __METHOD__, 9);
                 $cf = new CurrencyFactory();
                 $country_to_currency_map_arr = $cf->getOptions('country_currency');
                 if (isset($country_to_currency_map_arr[$this->getCountry()])) {
                     $base_currency = $country_to_currency_map_arr[$this->getCountry()];
                     Debug::text('Found Base Currency For Country: ' . $this->getCountry() . ' Currency: ' . $base_currency, __FILE__, __LINE__, __METHOD__, 9);
                 } else {
                     Debug::text('DID NOT Find Base Currency For Country: ' . $this->getCountry() . ' Using default USD.', __FILE__, __LINE__, __METHOD__, 9);
                     $base_currency = 'USD';
                 }
                 $cf->setCompany($this->getId());
                 $cf->setStatus(10);
                 $cf->setName($base_currency);
                 $cf->setISOCode($base_currency);
                 $cf->setConversionRate('1.000000000');
                 $cf->setAutoUpdate(FALSE);
                 $cf->setBase(TRUE);
                 $cf->setDefault(TRUE);
                 if ($cf->isValid()) {
                     $cf->Save();
                 }
             }
         }
         if ($this->getEnableAddPermissionGroupPreset() == TRUE) {
             Debug::text('Adding Preset Permission Groups', __FILE__, __LINE__, __METHOD__, 9);
             $pf = new PermissionFactory();
             $pf->StartTransaction();
             if ($this->getProductEdition() == 20) {
                 $preset_flags = array('job' => 1, 'invoice' => 1, 'document' => 1);
             } else {
                 $preset_flags = array();
             }
             $preset_options = $pf->getOptions('preset');
             foreach ($preset_options as $preset_id => $preset_name) {
                 $pcf = new PermissionControlFactory();
                 $pcf->setCompany($this->getId());
                 $pcf->setName($preset_name);
                 $pcf->setDescription('');
                 if ($pcf->isValid()) {
                     $pcf_id = $pcf->Save(FALSE);
                     $pf->applyPreset($pcf_id, $preset_id, $preset_flags);
                 }
             }
             //$pf->FailTransaction();
             $pf->CommitTransaction();
         }
         if ($this->getEnableAddStation() == TRUE) {
             Debug::text('Adding Default Station', __FILE__, __LINE__, __METHOD__, 9);
             //Enable punching in from all stations
             $sf = new StationFactory();
             $sf->setCompany($this->getId());
             $sf->setStatus(20);
             $sf->setType(10);
             $sf->setSource('ANY');
             $sf->setStation('ANY');
             $sf->setDescription('All stations');
             $sf->setGroupSelectionType(10);
             $sf->setBranchSelectionType(10);
             $sf->setDepartmentSelectionType(10);
             if ($sf->isValid()) {
                 $sf->Save();
             }
         }
         if ($this->getEnableAddPayStubEntryAccountPreset() == TRUE) {
             Debug::text('Adding Pay Stub Entry Account Presets', __FILE__, __LINE__, __METHOD__, 9);
             PayStubEntryAccountFactory::addPresets($this->getId());
         }
         if ($this->getEnableAddCompanyDeductionPreset() == TRUE) {
             Debug::text('Adding Company Deduction Presets', __FILE__, __LINE__, __METHOD__, 9);
             CompanyDeductionFactory::addPresets($this->getId());
         }
         if ($this->getEnableAddRecurringHolidayPreset() == TRUE) {
             Debug::text('Adding Recurring Holiday Presets', __FILE__, __LINE__, __METHOD__, 9);
             RecurringHolidayFactory::addPresets($this->getId(), $this->getCountry());
         }
     }
     if ($this->getDeleted() == TRUE) {
         $ulf = new UserListFactory();
         $ulf->getByCompanyId($this->getID());
         if ($ulf->getRecordCount() > 0) {
             $ulf->StartTransaction();
             foreach ($ulf as $u_obj) {
                 Debug::text('Deleting User ID: ' . $u_obj->getId(), __FILE__, __LINE__, __METHOD__, 9);
                 $u_obj->setDeleted(TRUE);
                 if ($u_obj->isValid()) {
                     $u_obj->Save();
                 }
             }
             $ulf->CommitTransaction();
         }
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:CompanyFactory.class.php

示例3: UserListFactory

switch ($action) {
    case 'add':
        Redirect::Page(URLBuilder::getURL(array('saved_search_id' => $saved_search_id, 'company_id' => $company_id), 'EditUser.php'));
        break;
    case 'delete':
    case 'undelete':
        //Debug::setVerbosity( 11 );
        if (strtolower($action) == 'delete') {
            $delete = TRUE;
        } else {
            $delete = FALSE;
        }
        if (DEMO_MODE == FALSE and ($permission->Check('user', 'delete') or $permission->Check('user', 'delete_own') or $permission->Check('user', 'delete_child'))) {
            if (is_array($ids)) {
                $ulf = new UserListFactory();
                $ulf->StartTransaction();
                foreach ($ids as $id) {
                    if ($id != $current_user->getId()) {
                        $ulf->getByIdAndCompanyId($id, $current_company->getID());
                        foreach ($ulf as $user) {
                            $is_owner = $permission->isOwner($user->getCreatedBy(), $user->getID());
                            $is_child = $permission->isChild($user->getId(), $permission_children_ids);
                            if ($permission->Check('user', 'delete') or $permission->Check('user', 'delete_child') and $is_child === TRUE or $permission->Check('user', 'delete_own') and $is_owner === TRUE) {
                                $user->setDeleted($delete);
                                $user->Save();
                            }
                        }
                    }
                }
                $ulf->CommitTransaction();
            }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:UserList.php


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