Exemplo n.º 1
0
 function createCompany()
 {
     $cf = new CompanyFactory();
     $cf->setStatus(10);
     //Active
     if (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) {
         $cf->setProductEdition(20);
         //Professional
     } else {
         $cf->setProductEdition(10);
         //Standard
     }
     $cf->setName('ABC Company');
     $cf->setShortName('ABC');
     $cf->setBusinessNumber('123456789');
     //$cf->setOriginatorID( $company_data['originator_id'] );
     //$cf->setDataCenterID($company_data['data_center_id']);
     $cf->setAddress1('123 Main St');
     $cf->setAddress2('Unit #123');
     $cf->setCity('New York');
     $cf->setCountry('US');
     $cf->setProvince('NY');
     $cf->setPostalCode('12345');
     $cf->setWorkPhone('555-555-5555');
     $cf->setEnableAddCurrency(FALSE);
     if ($cf->isValid()) {
         $insert_id = $cf->Save();
         Debug::Text('Company ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         return $insert_id;
     }
     Debug::Text('Failed Creating Company!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Exemplo n.º 2
0
     $cf->setBillingContact($company_data['billing_contact']);
     $cf->setSupportContact($company_data['support_contact']);
     if (isset($company_data['enable_second_last_name']) and $company_data['enable_second_last_name'] == 1) {
         $cf->setEnableSecondLastName(TRUE);
     } else {
         $cf->setEnableSecondLastName(FALSE);
     }
     if ($cf->isNew() == TRUE) {
         $cf->setEnableAddCurrency(TRUE);
         $cf->setEnableAddPermissionGroupPreset(TRUE);
         $cf->setEnableAddStation(TRUE);
         $cf->setEnableAddPayStubEntryAccountPreset(TRUE);
         $cf->setEnableAddRecurringHolidayPreset(TRUE);
     }
     if ($cf->isValid()) {
         $cf->Save();
         //$cf->FailTransaction();
         $cf->CommitTransaction();
         if ($permission->Check('company', 'edit')) {
             Redirect::Page(URLBuilder::getURL(NULL, 'CompanyList.php'));
         } else {
             Redirect::Page(URLBuilder::getURL(NULL, '../index.php'));
         }
         break;
     }
     $cf->FailTransaction();
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $clf = new CompanyListFactory();
         if ($permission->Check('company', 'edit')) {
Exemplo n.º 3
0
        $cf->setShortName($company_data['short_name']);
        $cf->setAddress1($company_data['address1']);
        $cf->setAddress2($company_data['address2']);
        $cf->setCity($company_data['city']);
        $cf->setCountry($company_data['country']);
        $cf->setProvince($company_data['province']);
        $cf->setPostalCode($company_data['postal_code']);
        $cf->setWorkPhone($company_data['work_phone']);
        $cf->setEnableAddCurrency(TRUE);
        $cf->setEnableAddPermissionGroupPreset(TRUE);
        $cf->setEnableAddStation(TRUE);
        $cf->setEnableAddPayStubEntryAccountPreset(TRUE);
        $cf->setEnableAddCompanyDeductionPreset(TRUE);
        $cf->setEnableAddRecurringHolidayPreset(TRUE);
        if ($cf->isValid()) {
            $company_id = $cf->Save();
            $install_obj->writeConfigFile(array('primary_company_id' => $company_id));
            Redirect::Page(URLBuilder::getURL(array('company_id' => $company_id, 'external_installer' => $external_installer), 'User.php'));
            break;
        }
    default:
        //Select box options;
        $company_data['status_options'] = $cf->getOptions('status');
        $company_data['country_options'] = $cf->getOptions('country');
        if (!isset($id) and isset($company_data['id'])) {
            $id = $company_data['id'];
        }
        $company_data['user_list_options'] = UserListFactory::getByCompanyIdArray($id);
        $smarty->assign_by_ref('company_data', $company_data);
        break;
}