Beispiel #1
0
 protected function get_type_handler()
 {
     if ($this->type == '') {
         echo '';
         return false;
     }
     $this->connection->selectDB($this->config->get('OP_DB'));
     $model = new CustomReceiptModel($this->connection);
     $model->type($this->type);
     $ret = '<table class="table table-bordered">
         <tr>
             <th>Line #</th>
             <th>Text</th>
             <th>' . \COREPOS\Fannie\API\lib\FannieUI::deleteIcon() . '</th>
         </tr>';
     foreach ($model->find('seq') as $obj) {
         $ret .= sprintf('<tr>
             <td>%d<input type="hidden" name="id[]" value="%d" /></td>
             <td><input type="text" maxlength="55" name="line[]" class="form-control" value="%s" /></td>
             <td><input type="checkbox" name="del[]" value="%d" /></td>
             </tr>', $obj->seq(), $obj->seq(), $obj->text(), $obj->seq());
     }
     $ret .= '<tr><td>NEW</td><td><input type="text" name="newLine" class="form-control" /></td>
         <td>&nbsp;</td></tr>';
     $ret .= '</table>';
     echo $ret;
     return false;
 }
Beispiel #2
0
 public function testDeleteLine($page, $phpunit)
 {
     $form = new \COREPOS\common\mvc\ValueContainer();
     $form->_method = 'post';
     $form->type = 'receiptHeader';
     $form->id = array(0);
     $form->line = array('TEST CHANGED LINE');
     $form->del = array(0);
     $post = $this->runRESTfulPage($page, $form);
     $model = new CustomReceiptModel($this->connection);
     $model->type($form->type);
     $model->text($form->line[0]);
     $phpunit->assertEquals(0, count($model->find()));
 }