initializeFilterAndPager( $data, $disable_paging ); //Only allow getting report data for currently logged in user. $data['filter_data']['user_id'] = $this->getCurrentUserObject()->getId(); //This is done so that users can set a saved report on payroll remittance agency event and then other users can run the tax wizard with that same saved report. if ( isset( $data['filter_data']['id'] ) && $this->getPermissionObject()->Check( 'pay_stub', 'add' ) && $this->getPermissionObject()->Check( 'pay_stub', 'edit' ) ) { //FIXME: perhaps add additional checks that the id is specified in a payroll remittance agency event. unset( $data['filter_data']['user_id'] ); } Debug::Arr( $data, 'Getting User Report Data: ', __FILE__, __LINE__, __METHOD__, 10 ); $ugdlf = TTnew( 'UserReportDataListFactory' ); /** @var UserReportDataListFactory $ugdlf */ $ugdlf->getAPISearchByCompanyIdAndArrayCriteria( $this->getCurrentCompanyObject()->getId(), $data['filter_data'], $data['filter_items_per_page'], $data['filter_page'], null, $data['filter_sort'] ); Debug::Text( 'Record Count: ' . $ugdlf->getRecordCount(), __FILE__, __LINE__, __METHOD__, 10 ); if ( $ugdlf->getRecordCount() > 0 ) { $this->setPagerObject( $ugdlf ); $retarr = []; foreach ( $ugdlf as $ugd_obj ) { $retarr[] = $ugd_obj->getObjectAsArray( $data['filter_columns'] ); } return $this->returnHandler( $retarr ); } return $this->returnHandler( true ); } /** * Set user data for one or more users. * @param array $data user data * @param bool $validate_only * @param bool $ignore_warning * @return array */ function setUserReportData( $data, $validate_only = false, $ignore_warning = true ) { if ( !is_array( $data ) ) { return $this->returnHandler( false ); } $validate_only = (bool)$validate_only; $ignore_warning = (bool)$ignore_warning; [ $data, $total_records ] = $this->convertToMultipleRecords( $data ); Debug::Text( 'Received data for: ' . $total_records . ' Users', __FILE__, __LINE__, __METHOD__, 10 ); Debug::Arr( $data, 'Data: ', __FILE__, __LINE__, __METHOD__, 10 ); if ( $validate_only == true ) { Debug::Text( 'Validating Only!', __FILE__, __LINE__, __METHOD__, 10 ); $permission_children_ids = false; } else { //Get Permission Hierarchy Children first, as this can be used for viewing, or editing. $permission_children_ids = $this->getPermissionChildren(); } $validator_stats = [ 'total_records' => $total_records, 'valid_records' => 0 ]; $validator = $save_result = []; $key = false; if ( is_array( $data ) && $total_records > 0 ) { foreach ( $data as $key => $row ) { $row['company_id'] = $this->getCurrentUserObject()->getCompany(); if ( !isset( $row['user_id'] ) || !( $this->getPermissionObject()->Check( 'user', 'view' ) || ( $this->getPermissionObject()->Check( 'user', 'view_child' ) && $this->getPermissionObject()->isChild( $row['user_id'], $permission_children_ids ) === true ) ) ) { //Force user_id to currently logged in user. Debug::Text( 'Forcing user_id...', __FILE__, __LINE__, __METHOD__, 10 ); $row['user_id'] = $this->getCurrentUserObject()->getId(); } $primary_validator = new Validator(); // The value of auto_refresh is directly placed into a