public function testAddCashier($page, $phpunit) { $form = new \COREPOS\common\mvc\ValueContainer(); $form->_method = 'get'; $page->setForm($form); $get = $this->runRESTfulPage($page, $form); $phpunit->assertNotEquals(0, strlen($get)); $form->_method = 'post'; $form->lname = 'test'; $form->fname = 'cashier'; $form->fes = 20; $form->birthdate = date('Y-m-d'); $page->setForm($form); $post = $this->runRESTfulPage($page, $form); $this->connection->selectDB($this->config->get('OP_DB')); $emp = new EmployeesModel($this->connection); $emp->FirstName($form->fname); $emp->LastName($form->lname); $emp->frontendsecurity($form->fes); $emp->backendsecurity($form->fes); $emp->birthdate($form->birthdate); $phpunit->assertNotEquals(0, count($emp->find())); }
function body_content() { global $FANNIE_OP_DB, $FANNIE_URL; $filter = FormLib::get_form_value('filter', 1); $order = FormLib::get_form_value('order', 'num'); $orderby = ''; switch ($order) { case 'num': default: $orderby = 'emp_no'; break; case 'name': $orderby = 'FirstName'; break; case 'pass': $orderby = 'CashierPassword'; break; case 'fes': $orderby = 'frontendsecurity'; break; } $ret = '<div id="alert-area"></div><div class="form-inline">'; $ret .= "<label>Showing</label> <select class=\"form-control\"\n onchange=\"location='ViewCashiersPage.php?filter='+this.value;\">"; if ($filter == 1) { $ret .= "<option value=1 selected>Active Cashiers</option>"; $ret .= "<option value=0>Disabled Cashiers</option>"; } else { $ret .= "<option value=1>Active Cashiers</option>"; $ret .= "<option value=0 selected>Disabled Cashiers</option>"; } $ret .= "</select></div><hr />"; $ret .= "<table class=\"table\"><tr>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=num>#</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=name>Name</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=pass>Password</th>"; $ret .= "<th><a href=ViewCashiersPage.php?filter={$filter}&order=fes>Privileges</th>"; $ret .= "<th> </th><th> </th></tr>"; $dbc = FannieDB::get($FANNIE_OP_DB); $employees = new EmployeesModel($dbc); $employees->EmpActive($filter); foreach ($employees->find($orderby) as $emp) { $ret .= sprintf("<tr><td>%d</td><td>%s</td><td>%d</td><td>%s</td>", $emp->emp_no(), $emp->FirstName() . ' ' . $emp->LastName(), $emp->CashierPassword(), $emp->frontendsecurity() <= 20 ? 'Regular' : 'Manager'); $ret .= sprintf("<td><a href=\"CashierEditor.php?emp_no=%d\">%s</a></td>\n <td><a href=\"\" onclick=\"deleteEmp(%d,%d); return false;\">%s</a></td></tr>", $emp->emp_no(), \COREPOS\Fannie\API\lib\FannieUI::editIcon(), $emp->emp_no(), $filter, \COREPOS\Fannie\API\lib\FannieUI::deleteIcon()); } $ret .= "</table>"; return $ret; }