예제 #1
0
 if ($_POST['type'] == "option") {
     Branch::findAllOption();
 } else {
     if ($_POST['type'] == "edit") {
         try {
             $branch = new Branch($_POST['key']);
             $branch->populate();
             $branch->store();
         } catch (fExpectedException $e) {
             echo $e->printMessage();
         }
     } else {
         if ($_POST['type'] == "delete") {
             try {
                 $branch = new Branch($_POST['key']);
                 $branch->delete();
             } catch (fExpectedException $e) {
                 echo $e->printMessage();
             }
         } else {
             if ($_POST['type'] == "add") {
                 try {
                     $branch = new Branch();
                     $branch->populate();
                     $branch->store();
                     $theId = $branch->getId();
                     $ids = Inv_item::findIdUB($db);
                     foreach ($ids as $id) {
                         $stock = new Inv_stock();
                         $stock->setBranchId($theId);
                         $stock->setItemId($id);
예제 #2
0
 public function deleteAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $id = $this->_helper->IdConvert->hexToStr($id);
     $model = new Branch();
     //$select = $model->delete($id);
     try {
         $select = $model->delete($id);
         $translate = new Zend_View_Helper_Translate();
         $this->_helper->messenger("success", $translate->translate('Branch was successfully deleted.'));
         $this->_helper->redirector('index');
     } catch (Logic_Branch_Exception $e) {
         $this->_helper->error(MSG_ERROR, $e);
     }
     $this->_helper->redirector('index');
 }