本文整理汇总了PHP中UserListFactory::CommitTransaction方法的典型用法代码示例。如果您正苦于以下问题:PHP UserListFactory::CommitTransaction方法的具体用法?PHP UserListFactory::CommitTransaction怎么用?PHP UserListFactory::CommitTransaction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserListFactory
的用法示例。
在下文中一共展示了UserListFactory::CommitTransaction方法的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;
}
示例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();
}
//.........这里部分代码省略.........
示例3: UserListFactory
$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();
}
}
Redirect::Page(URLBuilder::getURL(array('saved_search_id' => $saved_search_id), 'UserList.php'));
break;
case 'search_form_delete':
case 'search_form_update':
case 'search_form_save':
case 'search_form_clear':
case 'search_form_search':
Debug::Text('Action: ' . $action, __FILE__, __LINE__, __METHOD__, 10);
$saved_search_id = UserGenericDataFactory::searchFormDataHandler($action, $filter_data, URLBuilder::getURL(NULL, 'UserList.php'));
default:
BreadCrumb::setCrumb($title);
extract(UserGenericDataFactory::getSearchFormData($saved_search_id, $sort_column));
Debug::Text('Sort Column: ' . $sort_column, __FILE__, __LINE__, __METHOD__, 10);