Beispiel #1
0
 function edit(Default_Model_Expenses $model)
 {
     $expenseId = new Zend_Form_Element_Hidden('expenseId');
     $expenseId->setValue($model->getId());
     $this->addElement($expenseId);
     $this->name->setValue($model->getName());
     $this->name->setLabel(Zend_Registry::get('translate')->_('admin_name'));
     $this->price->setValue($model->getPrice());
     $this->price->setLabel(Zend_Registry::get('translate')->_('admin_price'));
     $this->date->setValue(date('m/d/Y', strtotime($model->getDate())));
     $this->date->setLabel(Zend_Registry::get('translate')->_('admin_date'));
     $productGroups = new Default_Model_ProductGroups();
     $select = $productGroups->getMapper()->getDbTable()->select()->where('idProduct=?', $model->getId());
     $result = $productGroups->fetchAll($select);
     if (NULL != $result) {
         foreach ($result as $value) {
             $options[$value->getId()] = $value->getIdGroup();
         }
     }
     $this->idGroup->setValue($options);
     $this->idGroup->setLabel(Zend_Registry::get('translate')->_('category'));
     $this->submit->setValue(Zend_Registry::get('translate')->_('admin_edit_expense'));
 }
Beispiel #2
0
 public function delete(Default_Model_Expenses $value)
 {
     $id = $value->getId();
     $data = array('deleted' => '1');
     $this->getDbTable()->update($data, array('id = ?' => $id));
     //logs	action done
     //$user_name = $value->getUserName()->getName().' '.$value->getUserName()->getSurname();
     $product_name = $value->getName();
     $action_done = ' User deleted the expense ' . $product_name . ' ';
     Needs_Logs::DbLogTracking(0, $id, 'expenses', 'stergere', $action_done);
     //end logs action done
     return $id;
 }