getByStatusID( [ 10, 20, 23 ], null, [ 'a.id' => 'asc' ] ); //10=Active, 20=Hold, 23=Expired if ( $clf->getRecordCount() > 0 ) { $system_job_queue_batch_id = TTUUID::generateUUID(); foreach ( $clf as $c_obj ) { if ( in_array( $c_obj->getStatus(), [ 10, 20, 23 ] ) ) { //10=Active, 20=Hold, 23=Expired if ( !isset( $config_vars['other']['enable_job_queue'] ) || $config_vars['other']['enable_job_queue'] == true ) { SystemJobQueue::Add( TTi18n::getText( 'Add Pay Periods' ), $system_job_queue_batch_id, 'PayPeriodScheduleFactory', 'createPayPeriodsForJobQueue', [ $c_obj->getID() ], 110 ); } else { //Get all pay period schedules. $ppslf->getByCompanyId( $c_obj->getId() ); foreach ( $ppslf as $pay_period_schedule_obj ) { /** @var PayPeriodScheduleFactory $pay_period_schedule_obj */ $end_date = null; //Create pay periods X days in the future as set in Pay Period Schedule by the user. $offset = ( $pay_period_schedule_obj->getCreateDaysInAdvance() * 86400 ); $i = 0; $max = 53; //Never create more than this number of pay periods in a row. $repeat_pay_period_creation = true; while ( $i <= $max && $repeat_pay_period_creation === true ) { //Repeat function until returns false. (No more pay periods to create) $repeat_pay_period_creation = $pay_period_schedule_obj->createNextPayPeriod( $end_date, $offset ); $i++; } if ( PRODUCTION == true && DEMO_MODE == false ) { $pay_period_schedule_obj->forceClosePreviousPayPeriods( $current_epoch ); } unset( $pay_period_schedule_obj ); } } } } } ?>