示例#1
0
 public function invoiceAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->getHelper('viewRenderer')->setNoRender(TRUE);
     $tblUser = new App_Model_Db_Table_User();
     $rowUser = $tblUser->fetchRow("kopel='00015'");
     $temptime = strtotime($rowUser->createdDate);
     //$temptime = time();
     $temptime = Pandamp_Lib_Formater::DateAdd('d', 5, $temptime);
     $rowInvoice = strftime('%Y-%m-%d', $temptime);
     Pandamp_Debug::manager($rowInvoice);
 }
示例#2
0
 function confirmAction()
 {
     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);
     $aResult = array();
     $id = $this->_request->getParam('id') ? $this->_request->getParam('id') : '';
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $rowInvoice = $tblInvoice->find($id)->current();
     if ($rowInvoice) {
         if ($rowInvoice->isPaid == "N") {
             $tblUser = new App_Model_Db_Table_User();
             $sql = $tblUser->select()->setIntegrityCheck(false);
             $sql->from(array('ku' => 'KutuUser'))->join(array('gag' => 'gacl_aro_groups'), 'ku.packageId = gag.id')->where('ku.kopel=?', $rowInvoice->uid);
             $rowUser = $tblUser->fetchRow($sql);
             if ($rowUser) {
                 if (in_array($rowUser->packageId, array(14, 15, 16, 17, 18))) {
                     $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();
                     $rowUser->periodeId = 3;
                     $rowUser->modifiedDate = date("Y-m-d h:i:s");
                     $rowUser->modifiedBy = "{$rowUser->username}";
                     $result = $rowUser->save();
                     if ($result) {
                         $aResult['isError'] = false;
                         $aResult['msg'] = $rowUser->username . ", confirm saved";
                     } else {
                         $aResult['isError'] = true;
                         $aResult['msg'] = "Error user confirmation!";
                     }
                 }
             } else {
                 $aResult['isError'] = true;
                 $aResult['msg'] = 'There is no such user!';
             }
         } else {
             $aResult['isError'] = true;
             $aResult['msg'] = 'Invoice has been paid!';
         }
     } else {
         $aResult['isError'] = true;
         $aResult['msg'] = 'Wrong Package!';
     }
     echo Zend_Json::encode($aResult);
 }
示例#3
0
 /**
  * _writeInvoice : Individual & Korporasi
  * @modifiedDate : 2012-11-20 12:53N
  * @todo Changed invoiceOutDate with createdDate from User Table
  * @return 
  */
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '')
 {
     //$aclMan	= Pandamp_Acl::manager();
     $tblInvoice = new App_Model_Db_Table_Invoice();
     $where = $tblInvoice->getAdapter()->quoteInto("uid=?", "{$memberId}");
     $rowInvoice = $tblInvoice->fetchAll($where);
     if (count($rowInvoice) <= 0) {
         $tblUser = new App_Model_Db_Table_User();
         $rowUser = $tblUser->fetchRow("kopel='" . $memberId . "'");
         $rowInvoice = $tblInvoice->fetchNew();
         $rowInvoice->uid = $memberId;
         $rowInvoice->price = $totalPromo;
         $rowInvoice->discount = $discPromo;
         //$rowInvoice->invoiceOutDate = date("Y-m-d");
         $rowInvoice->invoiceOutDate = date("Y-m-d", strtotime($rowUser->createdDate));
         $rowInvoice->invoiceConfirmDate = "0000-00-00";
         //$temptime = time();
         $temptime = strtotime($rowUser->createdDate);
         if ($rowUser->trialInDays == 0) {
             $trial = 5;
         } else {
             $trial = $rowUser->trialInDays;
         }
         $temptime = Pandamp_Lib_Formater::DateAdd('d', $trial, $temptime);
         $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
         if (empty($access)) {
             $rowInvoice->save();
         } else {
             $result = $rowInvoice->save();
             if ($result) {
                 $r = $memberId . " OK";
             } else {
                 $r = 'failure';
             }
         }
     } else {
         if (!empty($access)) {
             $r = "invoice:{$memberId} sudah pernah dibuat!";
         }
     }
     return $r;
 }
示例#4
0
 function checkusernameAction()
 {
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $username = $this->_getParam('username') ? $this->_getParam('username') : '';
     $modelUser = new App_Model_Db_Table_User();
     $rowset = $modelUser->fetchRow("username='******'");
     if ($rowset) {
         $valid = 'false';
     } else {
         $valid = 'true';
     }
     echo $valid;
     die;
 }
示例#5
0
 function inaAction()
 {
     /* get GroupName
          echo $this->getUserGroupName('enisetiati');
        *
        */
     /* get Group Name Id
          $getGroupId = $this->getUserGroupId($this->getUserGroupName('enisetiati'));
          echo $getGroupId;
        *
        */
     /*
      * Hukumonline Indonesia
      * 11 = admin
      * 41 = klinik_admin
      * 39 = marketing
      * 36 = member_admin
      * 34 = news_admin
      * 40 = holproject
      * 20 = dc_admin
      * 25 = member_gratis
      * 26 = member_individual
      * 27 = member_corporate
      */
     $title = "<h4>MIGRASI HUKUMONLINE INDONESIA</h4><hr/>";
     echo $title . '<br>';
     $groupId = 36;
     require_once CONFIG_PATH . '/master-status.php';
     $aroMap = App_Model_Show_Migration_AroGroupMapIn::show()->getObjectsByGroup($groupId);
     /*
     echo '<pre>';
     print_r($aroMap);
     echo '</pre>';
     *
     */
     foreach ($aroMap as $value) {
         //			$modelUser = new App_Model_Db_Table_User();
         //			$rowUser = $modelUser->fetchRow("username='******'name']."'");
         //			if (!$rowUser) {
         $ignoredUser = MasterStatus::ignoreUserMigration();
         if (!in_array($value['name'], $ignoredUser)) {
             //echo $id.' - '.$value['name'].'<br>';
             $rowUser = App_Model_Show_Migration_UserIn::show()->getUser($value['name']);
             //echo $id.' - '.$rowUser['fullName'].'<br>';
             /*
                             $groupName = $this->getUserGroupName($rowUser['username']);
                             $getGroupId = $this->getUserGroupId($groupName);
             * 
             */
             if ($rowUser) {
                 $rowUser['packageId'] = $groupId;
                 //list($ret, $body) = Pandamp_Lib_Remote::serverCmd('migrationUser', $rowUser);
                 $modelUser = new App_Model_Db_Table_User();
                 $dUser = $modelUser->fetchRow("username='******'username'] . "'");
                 $groupName = $this->getGroupName($groupId);
                 if (!$dUser) {
                     $data = $this->transformMigrationUser($rowUser);
                     $result = $modelUser->insert($data);
                     if ($result) {
                         $this->updateKopel();
                         $groupName = $this->getGroupName($groupId);
                         //$acl = new Kutu_Acl_Adapter_Local();
                         $acl = Pandamp_Acl::manager();
                         //$acl->addUser($_POST['username'],$groupName);
                         $acl->addUserToGroup($rowUser['username'], $groupName);
                         $message = "\n                            <div class='box box-info closeable'>\n                            User&nbsp;:&nbsp;<abbr>" . $rowUser['username'] . "</abbr> data has been successfully saved to local.\n                            </div><br>";
                     } else {
                         $message = "\n                        <div class='box box-error'>ERROR</div>    \n                        <div class='box box-error-msg'>\n                        <ol>\n                        <li>User&nbsp;:&nbsp;<abbr>" . $rowUser['username'] . "</abbr> data has failed saved to local.</li>\n                        </ol>\n                        </div><br>";
                     }
                     echo $message;
                 }
                 /*
                 echo '<pre>';
                 print_r($body);
                 echo '</pre>';
                 die;
                 *
                 */
                 /*
                 switch ($ret)
                 {
                     case 200:
                         $message = "
                             <div class='box box-info closeable'>
                             User&nbsp;:&nbsp;<abbr>".$rowUser['username']."</abbr> data has been successfully saved to local.
                             </div><br>";
                         break;
                     default:
                         $message = "
                         <div class='box box-error'>ERROR</div>    
                         <div class='box box-error-msg'>
                         <ol>
                         <li>User&nbsp;:&nbsp;<abbr>".$rowUser['username']."</abbr> data has failed saved to local.</li>
                         </ol>
                         </div><br>";
                 }
                 */
                 //                echo $message;
             }
             /*
             else 
             {
             	echo "
                     <div class='box box-error'>ERROR</div>    
                     <div class='box box-error-msg'>
                     <ol>
                     <li>User&nbsp;:&nbsp;<abbr>".$value['name']."</abbr> not active.</li>
                     </ol>
                     </div><br>";
             }
             */
         }
         //			}
     }
 }
示例#6
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);
 }