Esempio n. 1
0
 public function editProductsAction()
 {
     $productsString = $this->getRequest()->getParam('products');
     $idGroup = $this->getRequest()->getParam('id');
     $products = explode(',', $productsString);
     foreach ($products as $key => $idProductGroups) {
         //all products that need to be in the table
         $modelGroup = new Default_Model_ProductGroups();
         $modelGroup->setIdProduct($idProductGroups);
         $modelGroup->setIdGroup($idGroup);
         $modelGroupFind = new Default_Model_ProductGroups();
         $selectFind = $modelGroupFind->getMapper()->getDbTable()->select()->where('idProduct = ?', $idProductGroups)->where('idGroup = ?', $idGroup);
         $modelGroupFind->fetchRow($selectFind);
         if ($modelGroupFind->getId() == NULL) {
             //existing product added in the database
             $modelGroup->setOrder($key);
             $modelGroup->save();
         }
     }
 }
Esempio n. 2
0
 public function delete(Default_Model_ProductGroups $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 group ' . $product_name . ' ';
     Needs_Logs::DbLogTracking(0, $id, 'expenses', 'stergere', $action_done);
     //end logs action done
     return $id;
 }