Exemplo n.º 1
0
 function activateAction()
 {
     $this->_helper->layout()->disableLayout();
     $guid = $this->_getParam('uid') ? $this->_getParam('uid') : '';
     //$aclMan		= new Kutu_Acl_Adapter_Local();
     $obj = new Pandamp_Crypt_Password();
     $formater = new Pandamp_Core_Hol_User();
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $rowset = $tblUser->find(base64_decode($guid))->current();
     if ($rowset) {
         if ($rowset->periodeId == 2) {
             $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 106));
         } elseif ($rowset->periodeId == 3) {
             $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 102));
         } elseif ($rowset->periodeId == 4) {
             $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 'downgrade'));
         } else {
             // set activation date
             $rowset->activationDate = date("Y-m-d h:i:s");
             $rowset->isActive = 1;
             // check package
             if ($rowset->packageId == 26 or $rowset->packageId == 27) {
                 // set period = trial
                 $rowset->periodeId = 2;
                 // add user to gacl
                 // $aclMan->addUser($rowset->username,'member_gratis');
                 // -- write invoice
                 // Get disc promo
                 $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->promotionId, $rowset->paymentId);
                 // Get total promo
                 $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->promotionId, $rowset->paymentId);
                 $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId);
             } else {
                 $rowset->periodeId = 3;
             }
             // update
             //				$result = $rowset->save();
             //				if ($result)
             //				{
             if ($rowset->packageId == 26 or $rowset->packageId == 27) {
                 $this->_forward('redirect-subscription-url', 'manager', 'membership', array('guid' => base64_decode($guid)));
             } else {
                 $this->_forward('redirect-url', 'manager', 'membership', array('username' => $rowset->username));
             }
             //				}
             //				else
             //				{
             //					$this->_forward('restricted','manager','membership',array('type' => 'user','num' => 101));
             //				}
         }
     } else {
         $this->_forward('restricted', 'manager', 'membership', array('type' => 'user', 'num' => 105));
     }
 }
Exemplo n.º 2
0
 /**	
  * Set Invoice
  * @param guid
  */
 function setInvoiceAction()
 {
     $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');
             $modelUser = new App_Model_Db_Table_User();
             $rowset = $modelUser->fetchRow("kopel='" . $id . "'");
             $modelPackage = new App_Model_Db_Table_Package();
             $rowPackage = $modelPackage->fetchRow("packageId=" . $rowset->packageId);
             //if ((in_array($rowset->packageId,array(14,15,16,17,18))) && ($rowset->paymentId <> 0) && ($rowset->isActive == 1))
             if ($rowPackage && $rowset->paymentId != 0 && $rowset->isActive == 1) {
                 $formater = new Pandamp_Core_Hol_User();
                 /**
                  * @modifiedDate: Dec 07, 2012
                  */
                 // GET disc promo
                 //$disc = $formater->checkPromoValidation('Disc',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
                 // GET total promo
                 //$total = $formater->checkPromoValidation('Total',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
                 $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->paymentId);
                 $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->paymentId);
                 // WRITE invoice
                 //$r = $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId,'admin');
                 $r = $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId, 'admin');
                 $result = $r;
             } else {
                 $result = "check your payment/status";
             }
         }
     }
     $this->getResponse()->setBody($result);
 }
Exemplo n.º 3
0
 /**	
  * Set Invoice
  * @param guid
  */
 function setInvoiceAction()
 {
     $kopel = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $rowset = $tblUser->fetchRow("kopel='" . $kopel . "'");
     if (($rowset->packageId == 26 || $rowset->packageId == 27) && $rowset->paymentId != 0) {
         $formater = new Pandamp_Core_Hol_User();
         // GET disc promo
         $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->promotionId, $rowset->paymentId);
         // GET total promo
         $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->promotionId, $rowset->paymentId);
         // WRITE invoice
         $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId, 'admin');
     } else {
         $response = array();
         $response['success'] = false;
         $response['message'] = "check your payment, make sure not 0";
         echo Zend_Json::encode($response);
     }
 }
Exemplo n.º 4
0
 function newAction()
 {
     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);
     $formater = new Pandamp_Core_Hol_User();
     $r = $this->getRequest();
     $kopel = $r->getParam('id');
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $rowInvoice = $tblInvoice->fetchRow("uid='" . $kopel . "'");
     // add invoice but only if empty
     if (!$rowInvoice) {
         $modelUser = new App_Model_Db_Table_User();
         $rowset = $modelUser->find($kopel)->current();
         if (in_array($rowset->packageId, array(14, 15, 16, 17, 18))) {
             if (isset($rowset->paymentId) && $rowset->paymentId != 0) {
                 $periodeId = 2;
                 /**
                  * @modifiedDate: Dec 07, 2012
                  */
                 // Get disc promo
                 //$disc = $formater->checkPromoValidation('Disc',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
                 // Get total promo
                 //$total = $formater->checkPromoValidation('Total',$rowset->packageId,$rowset->promotionId,$rowset->paymentId);
                 $total = $formater->checkPromoValidation('Total', $rowset->packageId, $rowset->paymentId);
                 $disc = $formater->checkPromoValidation('Disc', $rowset->packageId, $rowset->paymentId);
                 $formater->_writeInvoice($rowset->kopel, $total, $disc, $rowset->paymentId);
             } else {
                 die('Lamanya berlangganan kosong');
             }
         } else {
             $periodeId = 3;
         }
         $data = array('periodeId' => $periodeId, 'modifiedDate' => date("Y-m-d h:i:s"), 'isActive' => 1);
         $modelUser->update($data, "kopel='" . $kopel . "'");
     }
     $zl = Zend_Registry::get("Zend_Locale");
     $this->_redirect(ROOT_URL . "/" . $zl->getLanguage() . '/customer/user/invoicelist/id/' . $kopel);
 }