Beispiel #1
0
 function associateAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted');
     }
     $this->_helper->layout->setLayout('layout-customer-credential');
     $r = $this->getRequest();
     if ($r->isPost()) {
         $newGroup = $r->getParam('aro_groups');
         $id = $r->getParam('id');
         $oldUser = App_Model_Show_User::show()->getUserById($id);
         $groupName = App_Model_Show_AroGroup::show()->getUserGroup($newGroup);
         $package = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $package['name'] . " TO " . $groupName['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $data = array('packageId' => $newGroup, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $modelUser->update($data, "kopel='" . $id . "'");
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $username = $r->getParam('username');
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($username);
         //$acl->removeUserFromGroup($username, $oldUser['packageId']);
         $acl->addUser($username, $groupName['name']);
         //$acl->addUserToGroup($username, $groupName['name']);
         $this->view->message = "Package was sucessfully changed.";
     }
     $id = $this->_getParam("id");
     $user = App_Model_Show_User::show()->getUserById($id);
     if ($user) {
         $acl = Pandamp_Acl::manager();
         $role = $acl->getUserGroupIds($user['username']);
         //print_r($role);
         $this->view->UserRoles = $role;
         $this->view->user = $user;
     }
 }
Beispiel #2
0
 public function payconfirmyesAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     //print_r($this->_request->getParams());
     $id = $this->_request->getParam('orderId');
     $tblOrder = new App_Model_Db_Table_Order();
     $tblHistory = new App_Model_Db_Table_OrderHistory();
     $tblConfirm = new App_Model_Db_Table_PaymentConfirmation();
     $rowOrder = $tblOrder->find($id)->current();
     if ($rowOrder->paymentMethodNote == 'membership') {
         $oldUser = App_Model_Show_User::show()->getUserById($rowOrder->userId);
         $oldpackage = App_Model_Show_AroGroup::show()->getUserGroup($oldUser['packageId']);
         $newGroup = App_Model_Show_AroGroup::show()->getUserGroup($rowOrder->note);
         $notes = date("Y-m-d h:i:s") . " - Changed package " . $oldpackage['name'] . " TO " . $newGroup['name'];
         $notes = $oldUser['notes'] ? $oldUser['notes'] . "\n" . $notes : $notes;
         $dataUser = array('packageId' => $rowOrder->note, 'notes' => $notes, 'modifiedDate' => date("Y-m-d h:i:s"), 'modifiedBy' => Zend_Auth::getInstance()->getIdentity()->username);
         $modelUser = new App_Model_Db_Table_User();
         $dataUserDetail = array('userId' => $oldUser['kopel'], 'packageId' => $oldUser['packageId'], 'promotionId' => $oldUser['promotionId'], 'educationId' => $oldUser['educationId'], 'expenseId' => $oldUser['expenseId'], 'paymentId' => $oldUser['paymentId'], 'businessTypeId' => $oldUser['businessTypeId'], 'periodeId' => $oldUser['periodeId'], 'activationDate' => $oldUser['activationDate'], 'createdDate' => $oldUser['createdDate'], 'createdBy' => $oldUser['createdBy'], 'modifiedDate' => $oldUser['modifiedDate'], 'modifiedBy' => $oldUser['modifiedBy'], 'isActive' => $oldUser['isActive'], 'isContact' => $oldUser['isContact']);
         $modelUserDetail = new App_Model_Db_Table_UserDetail();
         $modelUserDetail->insert($dataUserDetail);
         $acl = Pandamp_Acl::manager();
         $acl->deleteUser($oldUser['username']);
         $acl->addUser($oldUser['username'], $newGroup['name']);
         $tblInvoice = new App_Model_Db_Table_Invoice();
         $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $rowOrder->userId);
         $rowInvoice = $tblInvoice->fetchRow($where);
         if ($rowInvoice) {
             $rowInvoice->invoiceConfirmDate = date("Y-m-d");
             $rowInvoice->isPaid = 'Y';
             // get expiration date
             $temptime = time();
             $temptime = Pandamp_Lib_Formater::DateAdd('m', $oldUser['paymentId'], $temptime);
             $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
             $rowInvoice->save();
             $dataUser['periodeId'] = 3;
         }
         $modelUser->update($dataUser, "kopel='" . $rowOrder->userId . "'");
     }
     //select payment date from paymentconfirmation
     $date = $tblConfirm->fetchAll("orderId = " . $id . " AND confirmed = 0");
     $data['paymentDate'] = $date[0]->paymentDate;
     //update order
     $data['orderStatus'] = 3;
     $tblOrder->update($data, "orderId = " . $id);
     //update paymentconfirmation
     $dataConfirm['confirmed'] = 1;
     $tblConfirm->update($dataConfirm, "orderId = " . $id);
     //add history
     $dataHistory = $tblHistory->fetchNew();
     //history data
     $dataHistory['orderId'] = $id;
     $dataHistory['orderStatusId'] = 3;
     $dataHistory['dateCreated'] = date('Y-m-d');
     $dataHistory['userNotified'] = 1;
     $dataHistory['note'] = 'confirmed';
     $dataHistory->save();
     //mailer
     //$this->Mailer($id, 'user-confirm', 'user');
     $mod = new App_Model_Store_Mailer();
     $mod->sendReceiptToUser($id, ucwords($date[0]->paymentMethod));
     //redirect to confirmation page
     $this->_redirect($this->view->serverUrl() . '/' . $this->view->getLanguage() . '/store/confirm');
 }
 function deleteAction()
 {
     if (!Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
         $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/error/restricted');
     }
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $id = $this->_request->getParam('id') ? $this->_request->getParam('id') : '';
     $change = $this->_request->getParam('change') ? $this->_request->getParam('change') : '';
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $rowInvoice = $tblInvoice->find($id)->current();
     if ($rowInvoice) {
         if ($change == "y") {
             $modelUser = new App_Model_Db_Table_User();
             $rowset = $modelUser->find($rowInvoice->uid)->current();
             if ($rowset) {
                 $aclMan = Pandamp_Acl::manager();
                 $aclMan->deleteUser($rowset->username);
                 // add user to gacl
                 $aReturn = $aclMan->getGroupData(20);
                 // free
                 //print_r($aReturn);
                 $aclMan->addUser($rowset->username, $aReturn[2]);
                 $dataUserDetail = array('userId' => $rowset->kopel, 'packageId' => $rowset->packageId, 'promotionId' => $rowset->promotionId, 'educationId' => $rowset->educationId, 'expenseId' => $rowset->expenseId, 'paymentId' => $rowset->paymentId, 'businessTypeId' => $rowset->businessTypeId, 'periodeId' => $rowset->periodeId, 'activationDate' => $rowset->activationDate, 'createdDate' => $rowset->createdDate, 'createdBy' => $rowset->createdBy, 'modifiedDate' => $rowset->modifiedDate, 'modifiedBy' => $rowset->modifiedBy, 'isActive' => $rowset->isActive, 'isContact' => $rowset->isContact);
                 $modelUserDetail = new App_Model_Db_Table_UserDetail();
                 $modelUserDetail->insert($dataUserDetail);
                 $rowset->periodeId = 4;
                 $rowset->modifiedDate = date("Y-m-d h:i:s");
                 $rowset->save();
             }
         }
         $rowInvoice->delete();
     }
 }