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


PHP UserListFactory::getByCompanyId方法代码示例

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


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

示例1: postInstall

 function postInstall()
 {
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     $clf = new CompanyListFactory();
     $clf->StartTransaction();
     $clf->getAll();
     if ($clf->getRecordCount() > 0) {
         foreach ($clf as $c_obj) {
             if ($c_obj->getStatus() == 10) {
                 $ulf = new UserListFactory();
                 $ulf->getHighestEmployeeNumberByCompanyId($c_obj->getId());
                 if ($ulf->getRecordCount() > 0) {
                     $next_available_employee_number = $ulf->getCurrent()->getEmployeeNumber() + 1;
                 } else {
                     $next_available_employee_number = 1;
                 }
                 $ulf->getByCompanyId($c_obj->getId(), NULL, NULL, NULL, array('hire_date' => 'asc'));
                 if ($ulf->getRecordCount() > 0) {
                     foreach ($ulf as $u_obj) {
                         if ($u_obj->getEmployeeNumber() == '') {
                             Debug::text('Setting Employee Number to: ' . $next_available_employee_number . ' for ' . $u_obj->getUserName(), __FILE__, __LINE__, __METHOD__, 9);
                             $u_obj->setEmployeeNumber($next_available_employee_number);
                             if ($u_obj->isValid()) {
                                 $u_obj->Save();
                                 $next_available_employee_number++;
                             }
                         } else {
                             Debug::text('NOT Setting Employee Number for ' . $u_obj->getUserName() . ' already set to: ' . $u_obj->getEmployeeNumber(), __FILE__, __LINE__, __METHOD__, 9);
                         }
                     }
                 }
             }
         }
     }
     //$clf->FailTransaction();
     $clf->CommitTransaction();
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:38,代码来源:InstallSchema_1008A.class.php

示例2: getUsers

 function getUsers($station_id)
 {
     Debug::Text('Getting Users for Station ID: ' . $station_id, __FILE__, __LINE__, __METHOD__, 10);
     if ($station_id == '') {
         return FALSE;
     }
     $permission = new Permission();
     //Gets all users allowed to punch in/out from this station
     $slf = new StationListFactory();
     $slf->getByStationID($station_id);
     if ($slf->getRecordCount() > 0) {
         Debug::Text('Found Station!!', __FILE__, __LINE__, __METHOD__, 10);
         $s_obj = $slf->getCurrent();
         $company_id = $s_obj->getCompany();
         if ($company_id != FALSE) {
             Debug::Text('Found Company: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10);
             $ulf = new UserListFactory();
             $ulf->getByCompanyId($company_id);
             if ($ulf->getRecordCount() > 0) {
                 Debug::Text('Found Users ' . $ulf->getRecordCount() . ' for Company: ' . $company_id, __FILE__, __LINE__, __METHOD__, 10);
                 $x = 0;
                 foreach ($ulf as $u_obj) {
                     //Debug::Text('User ID: '. $u_obj->getId() .' iButton ID: '. $u_obj->getiButtonId() , __FILE__, __LINE__, __METHOD__,10);
                     $enable_job_tracking = $permission->Check('job', 'enabled', $u_obj->getId(), $u_obj->getCompany());
                     //Debug::Text('Enable Job Tracking for User: '. $u_obj->getUserName() .' Result: '. (int)$enable_job_tracking, __FILE__, __LINE__, __METHOD__,10);
                     if (version_compare($this->getClientVersion(), '2.7.0', '<')) {
                         //In offline punch mode, we use the system local time
                         //as we assume it is in the proper timezone for the user.
                         /*
                         $u_obj_prefs = $u_obj->getUserPreferenceObject();
                         if ( is_object( $u_obj_prefs ) ) {
                         	$time_zone = $u_obj_prefs->getTimeZone();
                         	$language = $u_obj_prefs->getLanguage();
                         } else {
                         	$time_zone = NULL;
                         	$language = NULL;
                         }
                         */
                         $ibutton = FALSE;
                         $finger_print_1 = FALSE;
                         $finger_print_2 = FALSE;
                         $finger_print_3 = FALSE;
                         $finger_print_4 = FALSE;
                         //Get User identification rows for ibutton and fingerprints.
                         $uilf = new UserIdentificationListFactory();
                         $uilf->getByUserIdAndTypeId($u_obj->getId(), array(10, 20));
                         //iButton and Griaule Fingerprints.
                         //Debug::Text('User Identication Records: '. $uilf->getRecordCount(), __FILE__, __LINE__, __METHOD__,10);
                         if ($uilf->getRecordCount() > 0) {
                             foreach ($uilf as $ui_obj) {
                                 if ($ui_obj->getType() == 10) {
                                     Debug::Text('Found iButton... User:  ' . $u_obj->getID() . ' Number: ' . $ui_obj->getNumber(), __FILE__, __LINE__, __METHOD__, 10);
                                     $ibutton = $ui_obj->getValue();
                                 } elseif ($ui_obj->getType() == 20) {
                                     Debug::Text('Found Griaule FingerPrint... User:  ' . $u_obj->getID() . ' Number: ' . $ui_obj->getNumber(), __FILE__, __LINE__, __METHOD__, 10);
                                     switch ($ui_obj->getNumber()) {
                                         case 10:
                                             $finger_print_1 = $ui_obj->getValue();
                                             break;
                                         case 20:
                                             $finger_print_2 = $ui_obj->getValue();
                                             break;
                                         case 30:
                                             $finger_print_3 = $ui_obj->getValue();
                                             break;
                                         case 40:
                                             $finger_print_4 = $ui_obj->getValue();
                                             break;
                                     }
                                 }
                             }
                         }
                         $user_list["'{$x}'"] = array('id' => (int) $u_obj->getId(), 'ibutton_id' => $ibutton, 'employee_number' => $u_obj->getEmployeeNumber(), 'user_name' => $u_obj->getUserName(), 'full_name' => $u_obj->getFullName(), 'default_branch_id' => (int) $u_obj->getDefaultBranch(), 'default_department_id' => (int) $u_obj->getDefaultDepartment(), 'finger_print_1' => $finger_print_1, 'finger_print_2' => $finger_print_2, 'finger_print_3' => $finger_print_3, 'finger_print_4' => $finger_print_4, 'enable_job_tracking' => $enable_job_tracking);
                     } else {
                         $user_list["'{$x}'"] = array('id' => (int) $u_obj->getId(), 'employee_number' => $u_obj->getEmployeeNumber(), 'user_name' => $u_obj->getUserName(), 'full_name' => $u_obj->getFullName(), 'default_branch_id' => (int) $u_obj->getDefaultBranch(), 'default_department_id' => (int) $u_obj->getDefaultDepartment(), 'enable_job_tracking' => $enable_job_tracking);
                     }
                     unset($enable_job_tracking, $time_zone, $language);
                     $x++;
                 }
                 if (isset($user_list)) {
                     Debug::Text('Returning User List!', __FILE__, __LINE__, __METHOD__, 10);
                     return $user_list;
                 }
             }
         }
     }
     Debug::Text('Returning FALSE!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:89,代码来源:TimeTrexSoapServerUnAuthenticated.class.php

示例3: array

         $generic_data['id'] = $ugd_obj->getId();
     } else {
         Debug::Text('Default Settings!', __FILE__, __LINE__, __METHOD__, 10);
         //Default selections
         $filter_data['user_status_ids'] = array(-1);
         $filter_data['branch_ids'] = array(-1);
         $filter_data['department_ids'] = array(-1);
         $filter_data['user_title_ids'] = array(-1);
         $filter_data['group_ids'] = array(-1);
     }
 }
 $filter_data = Misc::preSetArrayValues($filter_data, array('include_user_ids', 'exclude_user_ids', 'user_status_ids', 'group_ids', 'branch_ids', 'department_ids', 'user_title_ids', 'pay_period_ids', 'column_ids'), NULL);
 $ulf = new UserListFactory();
 $all_array_option = array('-1' => TTi18n::gettext('-- All --'));
 //Get include employee list.
 $ulf->getByCompanyId($current_company->getId());
 $user_options = $ulf->getArrayByListFactory($ulf, FALSE, TRUE);
 $filter_data['src_include_user_options'] = Misc::arrayDiffByKey((array) $filter_data['include_user_ids'], $user_options);
 $filter_data['selected_include_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['include_user_ids'], $user_options);
 //Get exclude employee list
 $exclude_user_options = Misc::prependArray($all_array_option, $ulf->getArrayByListFactory($ulf, FALSE, TRUE));
 $filter_data['src_exclude_user_options'] = Misc::arrayDiffByKey((array) $filter_data['exclude_user_ids'], $user_options);
 $filter_data['selected_exclude_user_options'] = Misc::arrayIntersectByKey((array) $filter_data['exclude_user_ids'], $user_options);
 //Get employee status list.
 $user_status_options = Misc::prependArray($all_array_option, $ulf->getOptions('status'));
 $filter_data['src_user_status_options'] = Misc::arrayDiffByKey((array) $filter_data['user_status_ids'], $user_status_options);
 $filter_data['selected_user_status_options'] = Misc::arrayIntersectByKey((array) $filter_data['user_status_ids'], $user_status_options);
 //Get Employee Groups
 $uglf = new UserGroupListFactory();
 $group_options = Misc::prependArray($all_array_option, $uglf->getArrayByNodes(FastTree::FormatArray($uglf->getByCompanyIdArray($current_company->getId()), 'TEXT', TRUE)));
 $filter_data['src_group_options'] = Misc::arrayDiffByKey((array) $filter_data['group_ids'], $group_options);
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:31,代码来源:Form940ez.php

示例4: 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

示例5: getByCompanyIdArray

 static function getByCompanyIdArray($company_id, $include_blank = TRUE, $include_disabled = TRUE, $last_name_first = TRUE)
 {
     $ulf = new UserListFactory();
     $ulf->getByCompanyId($company_id);
     if ($include_blank == TRUE) {
         $user_list[0] = '--';
     }
     foreach ($ulf as $user) {
         if ($user->getStatus() > 10) {
             //INACTIVE
             $status = '(' . Option::getByKey($user->getStatus(), $user->getOptions('status')) . ') ';
         } else {
             $status = NULL;
         }
         if ($include_disabled == TRUE or $include_disabled == FALSE and $user->getStatus() == 10) {
             $user_list[$user->getID()] = $status . $user->getFullName($last_name_first);
         }
     }
     if (isset($user_list)) {
         return $user_list;
     }
     return FALSE;
 }
开发者ID:alachaum,项目名称:timetrex,代码行数:23,代码来源:UserListFactory.class.php

示例6: dirname

 * schedule to another, then they click on a day without a user_date row.
 * TimeTrex doesn't know which pay period the day belongs too.
 *
 *
 * Run this twice a day. AFTER AddPayPeriod if possible.
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
$clf = new CompanyListFactory();
$clf->getAll();
if ($clf->getRecordCount() > 0) {
    foreach ($clf as $c_obj) {
        if ($c_obj->getStatus() != 30) {
            $ppslf = new PayPeriodScheduleListFactory();
            $ulf = new UserListFactory();
            $ulf->getByCompanyId($c_obj->getId());
            if ($ulf->getRecordCount() > 0) {
                $i = 0;
                foreach ($ulf as $u_obj) {
                    if ($u_obj->getStatus() != 10) {
                        continue;
                    }
                    Debug::text($i . '. User: ' . $u_obj->getUserName(), __FILE__, __LINE__, __METHOD__, 10);
                    //Find the pay period schedule for each user and change the timezone to that of the pay period schedule.
                    $ppslf->getByCompanyIdAndUserId($c_obj->getId(), $u_obj->getId());
                    if ($ppslf->getRecordCount() > 0) {
                        $pps_obj = $ppslf->getCurrent();
                        $pps_obj->setPayPeriodTimeZone();
                        //Insert user date row for TOMORROW.
                        $epoch = time() + (86400 + 3601);
                        //$epoch = strtotime('22-Jan-08');
开发者ID:alachaum,项目名称:timetrex,代码行数:31,代码来源:AddUserDate.php

示例7: sendCompanyUserLocationData

 function sendCompanyUserLocationData($company_id)
 {
     if ($company_id == '') {
         return FALSE;
     }
     $clf = new CompanyListFactory();
     $clf->getById($company_id);
     if ($clf->getRecordCount() > 0) {
         $location_data['registration_key'] = $this->getLocalRegistrationKey();
         $location_data['company_id'] = $company_id;
         $ulf = new UserListFactory();
         $ulf->getByCompanyId($company_id);
         if ($ulf->getRecordCount() > 0) {
             foreach ($ulf as $u_obj) {
                 $key = str_replace(' ', '', strtolower($u_obj->getCity() . $u_obj->getCity() . $u_obj->getCountry()));
                 $location_data['location_data'][$key] = array('city' => $u_obj->getCity(), 'province' => $u_obj->getProvince(), 'country' => $u_obj->getCountry());
             }
             if (isset($location_data['location_data'])) {
                 return $this->getSoapObject()->saveCompanyUserLocationData($location_data);
             }
         }
     }
     return FALSE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:24,代码来源:TimeTrexSoapClient.class.php

示例8: postInstall

 function postInstall()
 {
     global $cache;
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     Debug::text('l: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     /*
     	Take permission groups we put into memory from preInstall and create them now,
     	  after schema has been updated.
     */
     if (isset($this->permission_groups) and is_array($this->permission_groups)) {
         //Create permission groups and assign proper employees to each.
         //Debug::Arr($this->permission_groups, 'All Permission Groups: ', __FILE__, __LINE__, __METHOD__,9);
         foreach ($this->permission_groups as $company_id => $permission_group_data) {
             //Get all active users for this company, so we can assign them
             //to the default permission group.
             $ulf = new UserListFactory();
             $ulf->getByCompanyId($company_id);
             $all_user_ids = array_keys((array) $ulf->getArrayByListFactory($ulf, FALSE, TRUE));
             $assigned_user_ids = array();
             foreach ($permission_group_data as $group_name => $permission_data) {
                 Debug::text('zGroup Name: ' . $group_name, __FILE__, __LINE__, __METHOD__, 10);
                 $pcf = new PermissionControlFactory();
                 $pcf->StartTransaction();
                 $pcf->setCompany($company_id);
                 $pcf->setName(ucfirst($group_name));
                 $pcf->setDescription('Automatically Created By Installer');
                 if ($pcf->isValid()) {
                     $pcf_id = $pcf->Save(FALSE);
                     if (strtolower($group_name) == 'default') {
                         //Assign all unassigned users to this permission group.
                         $tmp_user_ids = array_merge((array) $this->permission_group_users[$company_id][$group_name], array_diff($all_user_ids, $assigned_user_ids));
                         //Debug::Arr($all_user_ids, 'Default Group All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
                         //Debug::Arr($assigned_user_ids, 'Default Group All User IDs:', __FILE__, __LINE__, __METHOD__, 10);
                         //Debug::Arr($tmp_user_ids, 'Default Group User IDs:', __FILE__, __LINE__, __METHOD__, 10);
                         $pcf->setUser($tmp_user_ids);
                         unset($tmp_user_ids);
                     } else {
                         if (isset($this->permission_group_users[$company_id][$group_name]) and is_array($this->permission_group_users[$company_id][$group_name])) {
                             $pcf->setUser($this->permission_group_users[$company_id][$group_name]);
                             $assigned_user_ids = array_merge($assigned_user_ids, $this->permission_group_users[$company_id][$group_name]);
                         }
                     }
                     if (is_array($permission_data)) {
                         $pcf->setPermission($permission_data);
                     }
                 }
                 //$pcf->FailTransaction();
                 $pcf->CommitTransaction();
             }
             unset($all_user_ids, $assigned_user_ids);
         }
     }
     return TRUE;
 }
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:54,代码来源:InstallSchema_1014A.class.php

示例9: postInstall

 function postInstall()
 {
     global $cache;
     Debug::text('postInstall: ' . $this->getVersion(), __FILE__, __LINE__, __METHOD__, 9);
     //Configure currencies for Standard Edition.
     if ($this->getIsUpgrade() == TRUE) {
         $clf = new CompanyListFactory();
         $clf->StartTransaction();
         $clf->getAll();
         if ($clf->getRecordCount() > 0) {
             foreach ($clf as $c_obj) {
                 if ($c_obj->getStatus() == 10) {
                     //Converting to new Accrual Policy table.
                     Debug::text('Converting to new Accrual Policy Table: ' . $c_obj->getName() . ' ID: ' . $c_obj->getId(), __FILE__, __LINE__, __METHOD__, 9);
                     $pglf = new PolicyGroupListFactory();
                     $pglf->getByCompanyId($c_obj->getId());
                     if ($pglf->getRecordCount() > 0) {
                         foreach ($pglf as $pg_obj) {
                             Debug::text('Accrual Policy ID: ' . $pg_obj->getColumn('accrual_policy_id'), __FILE__, __LINE__, __METHOD__, 9);
                             if ($pg_obj->getColumn('accrual_policy_id') != '' and $pg_obj->getColumn('accrual_policy_id') != 0) {
                                 $pg_obj->setAccrualPolicy(array($pg_obj->getColumn('accrual_policy_id')));
                                 if ($pg_obj->isValid()) {
                                     $pg_obj->Save();
                                 }
                             }
                         }
                     }
                     Debug::text('Adding Currency Information to Company: ' . $c_obj->getName() . ' ID: ' . $c_obj->getId(), __FILE__, __LINE__, __METHOD__, 9);
                     $crlf = new CurrencyListFactory();
                     $crlf->getByCompanyId($c_obj->getId());
                     if ($crlf->getRecordCount() == 0) {
                         $cf = new CurrencyFactory();
                         $country_to_currency_map_arr = $cf->getOptions('country_currency');
                         if (isset($country_to_currency_map_arr[$c_obj->getCountry()])) {
                             $base_currency = $country_to_currency_map_arr[$c_obj->getCountry()];
                             Debug::text('Found Base Currency For Country: ' . $c_obj->getCountry() . ' Currency: ' . $base_currency, __FILE__, __LINE__, __METHOD__, 9);
                         } else {
                             Debug::text('DID NOT Find Base Currency For Country: ' . $c_obj->getCountry() . ' Using default USD.', __FILE__, __LINE__, __METHOD__, 9);
                             $base_currency = 'USD';
                         }
                         $cf->setCompany($c_obj->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()) {
                             $base_currency_id = $cf->Save();
                             Debug::text('Base Currency ID: ' . $base_currency_id, __FILE__, __LINE__, __METHOD__, 10);
                             //Set Employee Hire Defaults.
                             $udlf = new UserDefaultListFactory();
                             $udlf->getByCompanyId($c_obj->getId());
                             if ($udlf->getRecordCount() > 0) {
                                 $ud_obj = $udlf->getCurrent();
                                 $ud_obj->setCurrency($base_currency_id);
                                 $ud_obj->setLanguage('en');
                                 if ($ud_obj->isValid()) {
                                     $ud_obj->Save();
                                 }
                             }
                             unset($udlf, $ud_obj);
                             if (is_numeric($base_currency_id)) {
                                 $ulf = new UserListFactory();
                                 $ulf->getByCompanyId($c_obj->getId());
                                 if ($ulf->getRecordCount() > 0) {
                                     foreach ($ulf as $u_obj) {
                                         $user_id = $u_obj->getID();
                                         Debug::text('Setting Base Currency For User: ' . $u_obj->getUserName() . ' ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                                         $u_obj->setCurrency($base_currency_id);
                                         if ($u_obj->isValid()) {
                                             if ($u_obj->Save() == TRUE) {
                                                 //Set User Default Language
                                                 $uplf = new UserPreferenceListFactory();
                                                 $uplf->getByUserIDAndCompanyID($user_id, $c_obj->getId());
                                                 if ($uplf->getRecordCount() > 0) {
                                                     $up_obj = $uplf->getCurrent();
                                                     $up_obj->setLanguage('en');
                                                     //Englist
                                                     if ($up_obj->isValid()) {
                                                         $up_obj->Save();
                                                     }
                                                 }
                                                 unset($uplf, $up_obj);
                                                 Debug::text('  Setting Base Currency for Pay Stubs, User ID: ' . $user_id, __FILE__, __LINE__, __METHOD__, 10);
                                                 //Change all pay stubs for this user to the base currency.
                                                 //Do this in a single query for speed purposes.
                                                 $ph = array('currency_id' => $base_currency_id, 'currency_rate' => '1.000000000', 'user_id' => $user_id);
                                                 $query = 'update pay_stub set currency_id = ?, currency_rate = ? where user_id = ?';
                                                 Debug::text('  Pay Stub Currency Query: ' . $query, __FILE__, __LINE__, __METHOD__, 10);
                                                 $u_obj->db->Execute($query, $ph);
                                                 /*
                                                 $pslf = new PayStubListFactory();
                                                 $pslf->getByUserIdAndCompanyId( $user_id, $c_obj->getId() );
                                                 if ( $pslf->getRecordCount() > 0 ) {
                                                 	foreach( $pslf as $ps_obj ) {
                                                 		//Debug::text('    Setting Base Currency for Pay Stub ID: '. $ps_obj->getId(), __FILE__, __LINE__, __METHOD__,10);
                                                 		
                                                 		$ps_obj->setCurrency( $base_currency_id );
//.........这里部分代码省略.........
开发者ID:J-P-Hanafin,项目名称:TimeTrex-1,代码行数:101,代码来源:InstallSchema_1011A.class.php


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