Пример #1
0
 function createUser($company_id, $type, $policy_group_id = 0, $default_branch_id = 0, $default_department_id = 0, $default_currency_id = 0, $user_group_id = 0)
 {
     $uf = new UserFactory();
     $uf->setCompany($company_id);
     $uf->setStatus(10);
     //$uf->setPolicyGroup( 0 );
     if ($default_currency_id == 0) {
         Debug::Text('Get Default Currency...', __FILE__, __LINE__, __METHOD__, 10);
         //Get Default.
         $crlf = new CurrencyListFactory();
         $crlf->getByCompanyIdAndDefault($company_id, TRUE);
         if ($crlf->getRecordCount() > 0) {
             $default_currency_id = $crlf->getCurrent()->getId();
             Debug::Text('Default Currency ID: ' . $default_currency_id, __FILE__, __LINE__, __METHOD__, 10);
         }
     }
     $hire_date = strtotime(rand(2000, 2005) . '-' . rand(1, 12) . '-' . rand(1, 28));
     switch ($type) {
         case 10:
             //John Doe
             $uf->setUserName('john.doe' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('John');
             $uf->setLastName('Doe');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Springfield St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 11:
             //Theodora  Simmons
             $uf->setUserName('theodora.simmons' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Theodora');
             $uf->setLastName('Simmons');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Springfield St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 12:
             //Kitty  Nicholas
             $uf->setUserName('kitty.nicholas' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Kitty');
             $uf->setLastName('Nicholas');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Ethel St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 13:
             //Tristen  Braun
             $uf->setUserName('tristen.braun' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Tristen');
             $uf->setLastName('Braun');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Ethel St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 14:
             //Gale  Mench
             $uf->setUserName('gale.mench' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Gale');
             $uf->setLastName('Mench');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Gordon St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 15:
             //Beau  Mayers
             $uf->setUserName('beau.mayers' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Beau');
             $uf->setLastName('Mayers');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Gordon St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 16:
             //Ian  Schofield
             $uf->setUserName('ian.schofield' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Ian');
             $uf->setLastName('Schofield');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Sussex St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 17:
             //Gabe  Hoffhants
             $uf->setUserName('gabe.hoffhants' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Gabe');
             $uf->setLastName('Hoffhants');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Sussex St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 18:
             //Franklin  Mcmichaels
             $uf->setUserName('franklin.mcmichaels' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Franklin');
             $uf->setLastName('McMichaels');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Georgia St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 19:
             //Donald  Whitling
             $uf->setUserName('donald.whitling' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Donald');
             $uf->setLastName('Whitling');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Georgia St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 20:
             //Jane Doe
             $uf->setUserName('jane.doe' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '2222' );
             //$uf->setPhonePassword( '2222' );
             $uf->setFirstName('Jane');
             $uf->setLastName('Doe');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Ontario St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 21:
             //Tamera  Erschoff
             $uf->setUserName('tamera.erschoff' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Tamera');
             $uf->setLastName('Erschoff');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Ontario St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 22:
             //Redd  Rifler
             $uf->setUserName('redd.rifler' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Redd');
             $uf->setLastName('Rifler');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Main St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 23:
             //Brent  Pawle
             $uf->setUserName('brent.pawle' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Brent');
             $uf->setLastName('Pawle');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Pandosy St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 24:
             //Heather  Grant
             $uf->setUserName('heather.grant' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Heather');
             $uf->setLastName('Grant');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Lakeshore St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 25:
             //Steph  Mench
             $uf->setUserName('steph.mench' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Steph');
             $uf->setLastName('Mench');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Dobbin St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 26:
             //Kailey  Klockman
             $uf->setUserName('kailey.klockman' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Kailey');
             $uf->setLastName('Klockman');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Spall St');
             //$uf->setAddress2( 'Unit #123' );
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 27:
             //Matt  Marcotte
             $uf->setUserName('matt.marcotte' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Matt');
             $uf->setLastName('Marcotte');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Spall St');
             //$uf->setAddress2( 'Unit #123' );
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 28:
             //Nick  Hanseu
             $uf->setUserName('nick.hanseu' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Nick');
             $uf->setLastName('Hanseu');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Gates St');
             //$uf->setAddress2( 'Unit #123' );
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 29:
             //Rich  Wiggins
             $uf->setUserName('rich.wiggins' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '1111' );
             //$uf->setPhonePassword( '1111' );
             $uf->setFirstName('Rich');
             $uf->setLastName('Wiggins');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Gates St');
             //$uf->setAddress2( 'Unit #123' );
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 30:
             //Mike Smith
             $uf->setUserName('mike.smith' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '2222' );
             //$uf->setPhonePassword( '2222' );
             $uf->setFirstName('Mike');
             $uf->setLastName('Smith');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Main St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 40:
             //John Hancock
             $uf->setUserName('john.hancock' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '2222' );
             //$uf->setPhonePassword( '2222' );
             $uf->setFirstName('John');
             $uf->setLastName('Hancock');
             $uf->setSex(20);
             $uf->setAddress1(rand(100, 9999) . ' Main St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('Seattle');
             $uf->setCountry('US');
             $uf->setProvince('WA');
             $uf->setPostalCode(rand(98000, 99499));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 100:
             //Administrator
             $uf->setUserName('demoadmin' . $this->getUserNamePostfix());
             $uf->setPassword('demo');
             //$uf->setPhoneId( '3333' );
             //$uf->setPhonePassword( '3333' );
             $uf->setFirstName('Mr.');
             $uf->setLastName('Administrator');
             $uf->setSex(10);
             $uf->setAddress1(rand(100, 9999) . ' Main St');
             $uf->setAddress2('Unit #' . rand(10, 999));
             $uf->setCity('New York');
             $uf->setCountry('US');
             $uf->setProvince('NY');
             $uf->setPostalCode(str_pad(rand(400, 599), 5, 0, STR_PAD_LEFT));
             $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkPhoneExt(rand(100, 1000));
             $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
             $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
             $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
             $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
             $uf->setHireDate($hire_date);
             $uf->setEmployeeNumber($type);
             $uf->setDefaultBranch($default_branch_id);
             $uf->setDefaultDepartment($default_department_id);
             $uf->setCurrency($default_currency_id);
             $uf->setGroup($user_group_id);
             break;
         case 999:
             //Random user
             $first_name = $this->getRandomFirstName();
             $last_name = $this->getRandomLastName();
             if ($first_name != '' and $last_name != '') {
                 $uf->setUserName($first_name . '.' . $last_name . $this->getUserNamePostfix());
                 $uf->setPassword('demo');
                 $uf->setFirstName($first_name);
                 $uf->setLastName($last_name);
                 $uf->setSex(20);
                 $uf->setAddress1(rand(100, 9999) . ' ' . $this->getRandomLastName() . ' St');
                 $uf->setAddress2('Unit #' . rand(10, 999));
                 $uf->setCity($this->getRandomArrayValue($this->city_names));
                 $uf->setCountry('US');
                 $uf->setProvince('WA');
                 $uf->setPostalCode(rand(98000, 99499));
                 $uf->setWorkPhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
                 $uf->setWorkPhoneExt(rand(100, 1000));
                 $uf->setHomePhone(rand(403, 600) . '-' . rand(250, 600) . '-' . rand(1000, 9999));
                 $uf->setWorkEmail($uf->getUserName() . '@abc-company.com');
                 $uf->setSIN(rand(100, 999) . '-' . rand(100, 999) . '-' . rand(100, 999));
                 $uf->setBirthDate(strtotime(rand(1970, 1990) . '-' . rand(1, 12) . '-' . rand(1, 28)));
                 $uf->setHireDate($hire_date);
                 $uf->setEmployeeNumber(rand(1000, 25000));
                 $uf->setDefaultBranch($default_branch_id);
                 $uf->setDefaultDepartment($default_department_id);
                 $uf->setCurrency($default_currency_id);
                 $uf->setGroup($user_group_id);
             }
             unset($first_name, $last_name);
             break;
     }
     if ($uf->isValid()) {
         $insert_id = $uf->Save();
         Debug::Text('User ID: ' . $insert_id, __FILE__, __LINE__, __METHOD__, 10);
         $this->createUserPreference($insert_id);
         /*
         			$preset_flags = array(
         								'invoice' => 0,
         								'job' => 1,
         								'document' => 0,
         								);
         */
         if ($type == 100) {
             //$this->createUserPermission( array( $insert_id ), 40, $preset_flags );
             $this->createUserPermission($insert_id, 40);
         } else {
             //$this->createUserPermission( array( $insert_id ), 10, $preset_flags );
             $this->createUserPermission($insert_id, 10);
         }
         //$this->createUserPermission( array( -1 ), 10, $preset_flags );
         //Default wage group
         $this->createUserWage($insert_id, '19.50', $hire_date);
         $this->createUserWage($insert_id, '19.75', strtotime('01-Jun-04'));
         $this->createUserWage($insert_id, '20.15', strtotime('01-Jan-05'));
         $this->createUserWage($insert_id, '21.50', strtotime('01-Jan-06'));
         $this->createUserWage($insert_id, '10.00', strtotime('01-Jan-04'), $this->user_wage_groups[0]);
         $this->createUserWage($insert_id, '20.00', strtotime('01-Jan-04'), $this->user_wage_groups[1]);
         //Assign Taxes to user
         $this->createUserDeduction($company_id, $insert_id);
         return $insert_id;
     }
     Debug::Text('Failed Creating User!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Пример #2
0
     break;
 case 'next':
     //Debug::setVerbosity(11);
     Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
     $uf->StartTransaction();
     $uf->setCompany($user_data['company_id']);
     $uf->setStatus(10);
     $uf->setUserName($user_data['user_name']);
     if (!empty($user_data['password']) and $user_data['password'] == $user_data['password2']) {
         $uf->setPassword($user_data['password']);
     } else {
         $uf->Validator->isTrue($uf->password_validator_label, FALSE, $uf->password_validator_match_msg);
     }
     $uf->setEmployeeNumber(1);
     $uf->setFirstName($user_data['first_name']);
     $uf->setLastName($user_data['last_name']);
     $uf->setWorkEmail($user_data['work_email']);
     //Get Permission Control with highest ID, assume its for Administrators
     //and use it.
     $pclf = new PermissionControlListFactory();
     $pclf->getByCompanyId($user_data['company_id'], NULL, NULL, NULL, array('id' => 'desc'));
     if ($pclf->getRecordCount() > 0) {
         $pc_obj = $pclf->getCurrent();
         if (is_object($pc_obj)) {
             Debug::Text('Adding User to Permission Control: ' . $pc_obj->getId(), __FILE__, __LINE__, __METHOD__, 10);
             $uf->setPermissionControl($pc_obj->getId());
         }
     }
     if ($uf->isValid()) {
         $user_id = $uf->Save();
         $uf->CommitTransaction();