Ejemplo n.º 1
0
 protected function post_fname_lname_fes_birthdate_handler()
 {
     global $FANNIE_OP_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $passwd = $this->genPassword($dbc);
     $emp_no = $this->nextEmpNo($dbc);
     $employee = new EmployeesModel($dbc);
     $employee->emp_no($emp_no);
     $employee->CashierPassword($passwd);
     $employee->AdminPassword($passwd);
     $employee->FirstName($this->fname);
     $employee->LastName($this->lname);
     $employee->JobTitle('');
     $employee->EmpActive(1);
     $employee->frontendsecurity($this->fes);
     $employee->backendsecurity($this->fes);
     $employee->birthdate($this->birthdate);
     $employee->save();
     try {
         $this->saveStoreMapping($dbc, $emp_no, $this->form->stores);
     } catch (Exception $e) {
         // likely means HQ is disabled or
         // not stores were selected
     }
     $message = sprintf("Cashier Created<br />Name:%s<br />Emp#:%d<br />Password:%d", $this->fname . ' ' . $this->lname, $emp_no, $passwd);
     return '?flash=' . base64_encode($message);
 }