protected function _postDelete() { $tblUserDetail = new Pandamp_Modules_Identity_User_Model_UserDetail(); $rowsetUserDetail = $tblUserDetail->fetchAll("uid='{$this->guid}'"); foreach ($rowsetUserDetail as $row) { // delete $row->delete(); } //delete from table KutuUserInvoice $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice(); $tblInvoice->delete("uid='{$this->kopel}'"); //delete from table KutuUserAccessLog $tblUserLog = new Pandamp_Modules_Identity_Log_Model_Log(); $tblUserLog->delete("user_id='{$this->guid}'"); //delete from ACL $aclMan = Pandamp_Acl::manager(); $aclMan->deleteUser($this->username); // delete physical user folder define by guid $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . $this->guid; try { $this->removeRessource($sDir); } catch (Exception $e) { throw new Exception($e); } $sDir = ROOT_DIR . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR . 'photo'; try { if (file_exists($sDir . "/" . $this->guid . ".gif")) { unlink($sDir . "/" . $this->guid . ".gif"); } if (file_exists($sDir . "/" . $this->guid . ".jpg")) { unlink($sDir . "/" . $this->guid . ".jpg"); } if (file_exists($sDir . "/" . $this->guid . ".jpeg")) { unlink($sDir . "/" . $this->guid . ".jpeg"); } if (file_exists($sDir . "/" . $this->guid . ".png")) { unlink($sDir . "/" . $this->guid . ".png"); } } catch (Exception $e) { } }
/** * confirm is for administrator directly from GridPanel * confirm is for user packed Individual or Corporate * If this function is execute then * User status changed isActive = 1 and period = active and * Also check, if invoice exist then update it * @param uid */ function confirmAction() { $uid = $this->_getParam('uid') ? $this->_getParam('uid') : ''; //$formater = new Kutu_Lib_Formater(); $aclMan = Pandamp_Acl::manager(); $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $sql = $tblUser->select()->setIntegrityCheck(false); $sql->from(array('ku' => 'KutuUser'))->join(array('gag' => 'gacl_aro_groups'), 'ku.packageId = gag.id')->where('ku.kopel=?', $uid); $rowUser = $tblUser->fetchRow($sql); if ($rowUser->packageId == 26 || $rowUser->packageId == 27) { $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice(); $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $uid); $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', $rowUser->paymentId, $temptime); $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime); $rowInvoice->save(); // delete user group = trial from gacl $aclMan->deleteUser($rowUser->username); // add user to gacl $aReturn = $aclMan->getGroupData($rowUser->packageId); $aclMan->addUser($rowUser->username, $aReturn[2]); $rowUser->periodeId = 3; $rowUser->isActive = 1; $rowUser->updatedDate = date("Y-m-d h:i:s"); $rowUser->updatedBy = "{$rowUser->username}"; $result = $rowUser->save(); if ($result) { $this->view->success = true; $this->view->message = $rowUser->username . ", confirm saved"; } else { $this->view->success = false; $this->view->message = "Error user confirmation!"; } } else { $this->view->success = false; $this->view->message = "Please, create invoice first!"; } } else { $this->view->success = false; $this->view->message = $rowUser->username . ", wrong packed"; } }
/** * _writeInvoice : Individual & Korporasi * @return */ function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '') { $aclMan = Pandamp_Acl::manager(); $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice(); $where = $tblInvoice->getAdapter()->quoteInto("uid=?", $memberId); $rowInvoice = $tblInvoice->fetchAll($where); if (count($rowInvoice) <= 0) { $rowInvoice = $tblInvoice->fetchNew(); $rowInvoice->uid = $memberId; $rowInvoice->price = $totalPromo; $rowInvoice->discount = $discPromo; $rowInvoice->invoiceOutDate = date("Y-m-d"); $rowInvoice->invoiceConfirmDate = "0000-00-00"; $temptime = time(); $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime); $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime); $tblUser = new Pandamp_Modules_Identity_User_Model_User(); $rowUser = $tblUser->fetchRow("kopel=" . $memberId); // add user to gacl // $aclMan->addUser($rowUser->username,'member_gratis'); if (empty($access)) { $rowInvoice->save(); } else { $result = $rowInvoice->save(); if ($result) { $response['success'] = true; $response['message'] = "set invoice:{$memberId} successfully"; } else { $response['failure'] = true; } echo Zend_Json::encode($response); } } else { if (!empty($access)) { $response['success'] = true; $response['message'] = "invoice:{$memberId} sudah dibuat!"; echo Zend_Json::encode($response); } } }
function invoiceAction() { $uid = $this->_getParam('uid') ? $this->_getParam('uid') : ''; $tblInvoice = new Pandamp_Modules_Payment_Invoice_Model_Invoice(); $rowset = $tblInvoice->fetchAll("uid='" . $uid . "'", 'invoiceId DESC'); $a = array(); $a['totalCount'] = count($rowset); $i = 0; if ($a['totalCount'] != 0) { foreach ($rowset as $row) { $a['invoice'][$i]['invoiceId'] = $row->invoiceId; $a['invoice'][$i]['uid'] = $row->uid; $a['invoice'][$i]['price'] = $row->price; $a['invoice'][$i]['discount'] = $row->discount; $a['invoice'][$i]['invoiceOutDate'] = $row->invoiceOutDate; $a['invoice'][$i]['invoiceConfirmDate'] = $row->invoiceConfirmDate; $a['invoice'][$i]['clientBankAccount'] = $row->clientBankAccount; $a['invoice'][$i]['isPaid'] = $row->isPaid; $a['invoice'][$i]['expirationDate'] = $row->expirationDate; $i++; } } if ($a['totalCount'] == 0) { $a['invoice'][0]['invoiceId'] = ''; $a['invoice'][0]['uid'] = ""; $a['invoice'][0]['price'] = ''; $a['invoice'][0]['discount'] = ''; $a['invoice'][0]['invoiceOutDate'] = ''; $a['invoice'][0]['invoiceConfirmDate'] = ''; $a['invoice'][0]['clientBankAccount'] = ''; $a['invoice'][0]['isPaid'] = ""; $a['invoice'][0]['expirationDate'] = ''; } echo Zend_Json::encode($a); }