/** * Kick all user * */ function kickallAction() { $this->_helper->getHelper('layout')->disableLayout(); $this->_helper->getHelper('viewRenderer')->setNoRender(); $request = $this->getRequest(); $result = 'RESULT_ERROR'; if (Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) { if ($request->isPost()) { $id = $request->getPost('id'); $ids = array(); $ids = Zend_Json::decode($id); foreach ($ids as $id) { $modelUser = new App_Model_Db_Table_User(); $modelUser->update(array('ses' => '*'), array('kopel = ?' => $id)); $modelSession = new App_Model_Db_Table_Session(); $rowSession = $modelSession->fetchRow("sessionData LIKE '%{$id}%'"); if ($rowSession) { /** * Destroy any active session identified by sessionId */ try { session_id($rowSession->sessionId); session_destroy(); } catch (Exception $e) { } } } } $result = 'RESULT_OK'; } $this->getResponse()->setBody($result); }
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'); }
public function editAction() { 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'); $id = $this->_getParam("id"); $tblInvoice = new App_Model_Db_Table_Invoice(); $rowset = $tblInvoice->find($id)->current(); $this->view->row = $rowset; if ($this->getRequest()->isPost()) { $rowset->price = $this->getRequest()->getPost('price'); $rowset->discount = $this->getRequest()->getPost('disc'); $rowset->invoiceOutDate = $this->getRequest()->getPost('invoiceOutDate'); $rowset->invoiceConfirmDate = $this->getRequest()->getPost('invoiceConfirmDate'); $rowset->clientBankAccount = $this->getRequest()->getPost('clientBankAccount'); $rowset->isPaid = $this->getRequest()->getPost('isPaid'); $rowset->expirationDate = $this->getRequest()->getPost('expirationDate'); $rowset->save(); $notes = date("Y-m-d h:i:s") . ' ' . $this->_user->username . " - Modify invoice:" . $id; $data = array('notes' => new Zend_Db_Expr("CONCAT(ifnull(notes,''),' \n{$notes}')")); $modelUser = new App_Model_Db_Table_User(); $modelUser->update($data, "kopel='" . $this->getRequest()->getPost('uid') . "'"); $this->_redirect(ROOT_URL . '/' . $this->_zl->getLanguage() . '/customer/user/invoicelist/id/' . $this->getRequest()->getPost('uid')); } }