Esempio n. 1
0
    foreach ($cuclf as $cuc_obj) {
        $user_counts[$cuc_obj->getColumn('company_id')]['inactive'] = $cuc_obj->getColumn('total');
    }
}
$cuclf->getDeletedUsers();
if ($cuclf->getRecordCount() > 0) {
    foreach ($cuclf as $cuc_obj) {
        $user_counts[$cuc_obj->getColumn('company_id')]['deleted'] = $cuc_obj->getColumn('total');
    }
}
$cuclf->StartTransaction();
if (isset($user_counts) and count($user_counts) > 0) {
    foreach ($user_counts as $company_id => $user_count_arr) {
        $cucf = new CompanyUserCountFactory();
        $cucf->setCompany($company_id);
        $cucf->setDateStamp(time());
        if (!isset($user_count_arr['active'])) {
            $user_count_arr['active'] = 0;
        }
        $cucf->setActiveUsers($user_count_arr['active']);
        if (!isset($user_count_arr['inactive'])) {
            $user_count_arr['inactive'] = 0;
        }
        $cucf->setInActiveUsers($user_count_arr['inactive']);
        if (!isset($user_count_arr['deleted'])) {
            $user_count_arr['deleted'] = 0;
        }
        $cucf->setDeletedUsers($user_count_arr['deleted']);
        Debug::text('Company ID: ' . $company_id . ' Active: ' . $user_count_arr['active'] . ' InActive: ' . $user_count_arr['inactive'] . ' Deleted: ' . $user_count_arr['deleted'], __FILE__, __LINE__, __METHOD__, 10);
        if ($cucf->isValid()) {
            $cucf->Save();