本文整理汇总了PHP中UserListFactory::getByCompanyIdAndStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP UserListFactory::getByCompanyIdAndStatus方法的具体用法?PHP UserListFactory::getByCompanyIdAndStatus怎么用?PHP UserListFactory::getByCompanyIdAndStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserListFactory
的用法示例。
在下文中一共展示了UserListFactory::getByCompanyIdAndStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPayStubAmendments
function createPayStubAmendments($epoch = NULL)
{
//Get all recurring pay stub amendments and generate single pay stub amendments if appropriate.
if ($epoch == '') {
$epoch = TTDate::getTime();
}
$ulf = new UserListFactory();
Debug::text('Recurring PS Amendment ID: ' . $this->getId() . ' Frequency: ' . $this->getFrequency(), __FILE__, __LINE__, __METHOD__, 10);
$this->StartTransaction();
$tmp_user_ids = $this->getUser();
if ($tmp_user_ids[0] == -1) {
$ulf->getByCompanyIdAndStatus($this->getCompany(), 10);
foreach ($ulf as $user_obj) {
$user_ids[] = $user_obj->getId();
}
unset($user_obj);
} else {
$user_ids = $this->getUser();
}
unset($tmp_user_ids);
Debug::text('Total User IDs: ' . count($user_ids), __FILE__, __LINE__, __METHOD__, 10);
if (is_array($user_ids) and count($user_ids) > 0) {
//Make the PS amendment duplicate check start/end date separate
//Make the PS amendment effective date separate.
switch ($this->getFrequency()) {
case 10:
//Get all open pay periods
$pplf = new PayPeriodListFactory();
//FIXME: Get all non-closed pay periods AFTER the start date.
$pplf->getByUserIdListAndNotStatusAndStartDateAndEndDate($user_ids, 20, $this->getStartDate(), $this->getEndDate());
//All non-closed pay periods
Debug::text('Found Open Pay Periods: ' . $pplf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10);
foreach ($pplf as $pay_period_obj) {
Debug::text('Working on Pay Period: ' . $pay_period_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
//If near the end of a pay period, or a pay period is already ended, add PS amendment if
//it does not already exist.
if ($epoch >= $pay_period_obj->getEndDate() and $this->checkTimeFrame($epoch)) {
Debug::text('After end of pay period.', __FILE__, __LINE__, __METHOD__, 10);
$psalf = new PayStubAmendmentListFactory();
//Loop through each user of this Pay Period Schedule adding PS amendments if they don't already exist.
$pay_period_schedule_users = $pay_period_obj->getPayPeriodScheduleObject()->getUser();
Debug::text(' Pay Period Schedule Users: ' . count($pay_period_schedule_users), __FILE__, __LINE__, __METHOD__, 10);
foreach ($pay_period_schedule_users as $user_id) {
//Make sure schedule user is in the PS amendment user list and user is active.
Debug::text(' Pay Period Schedule User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
//Debug::Arr($user_ids, ' Recurring PS Amendment Selected Users: ', __FILE__, __LINE__, __METHOD__,10);
if ($ulf->getById($user_id)->getCurrent()->getStatus() == 10 and in_array($user_id, $user_ids)) {
//Check to see if the amendment was added already.
if ($psalf->getByUserIdAndRecurringPayStubAmendmentIdAndStartDateAndEndDate($user_id, $this->getId(), $pay_period_obj->getStartDate(), $pay_period_obj->getEndDate())->getRecordCount() == 0) {
//No amendment, good to insert one
Debug::text('Inserting Recurring PS Amendment for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
$psaf = new PayStubAmendmentFactory();
$psaf->setUser($user_id);
$psaf->setStatus(50);
$psaf->setType($this->getType());
$psaf->setRecurringPayStubAmendmentId($this->getId());
$psaf->setPayStubEntryNameId($this->getPayStubEntryNameId());
if ($this->getType() == 10) {
$psaf->setRate($this->getRate());
$psaf->setUnits($this->getUnits());
$psaf->setAmount($this->getAmount());
} else {
$psaf->setPercentAmount($this->getPercentAmount());
$psaf->setPercentAmountEntryNameID($this->getPercentAmountEntryNameId());
}
$psaf->setDescription($this->getPayStubAmendmentDescription());
$psaf->setEffectiveDate(TTDate::getBeginDayEpoch($pay_period_obj->getEndDate()));
if ($psaf->isValid()) {
$psaf->Save();
}
} else {
//Amendment already inserted!
Debug::text('Recurring PS Amendment already inserted for User: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
}
} else {
Debug::text('Skipping User because they are INACTIVE or are not on the Recurring PS Amendment User List - ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
//continue;
}
}
} else {
Debug::text('Not in TimeFrame, not inserting amendments: Epoch: ' . $epoch . ' Pay Period End Date: ' . $pay_period_obj->getEndDate(), __FILE__, __LINE__, __METHOD__, 10);
}
}
break;
case 30:
//Weekly
//Weekly
case 40:
//Monthly
//Monthly
case 70:
//Annually
switch ($this->getFrequency()) {
case 30:
$trigger_date = TTDate::getDateOfNextDayOfWeek(TTDate::getBeginWeekEpoch($epoch), $this->getStartDate());
$start_date = TTDate::getBeginWeekEpoch($epoch);
$end_date = TTDate::getEndWeekEpoch($epoch);
break;
case 40:
$trigger_date = TTDate::getDateOfNextDayOfMonth(TTDate::getBeginMonthEpoch($epoch), $this->getStartDate());
//.........这里部分代码省略.........