Example #1
0
 function viewinvoiceAction()
 {
     $orderId = $this->_request->getParam('orderId');
     $tblOrder = new Kutu_Core_Orm_Table_Order();
     $items = $tblOrder->getOrderDetail($orderId);
     $this->view->orderId = $orderId;
     $this->view->invoiceNumber = $items[0]['invoiceNumber'];
     $this->view->datePurchased = Kutu_Lib_Formater::get_date($items[0]['datePurchased']);
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     if ($this->_user->kopel != $items[0]['userId']) {
         $this->_redirect(KUTU_ROOT_URL . '/store/cartempty');
     }
     $result = array();
     $result['subTotal'] = 0;
     for ($iCart = 0; $iCart < count($items); $iCart++) {
         $itemId = $items[$iCart]['itemId'];
         $qty = 1;
         $itemPrice = $items[$iCart]['price'];
         $result['items'][$iCart]['itemId'] = $itemId;
         $result['items'][$iCart]['item_name'] = $items[$iCart]['documentName'];
         $result['items'][$iCart]['itemPrice'] = $itemPrice;
         $result['items'][$iCart]['qty'] = $qty;
         $result['subTotal'] += $itemPrice * $qty;
     }
     $result['taxAmount'] = $result['subTotal'] * $rowTaxRate->settingValue / 100;
     $result['grandTotal'] = $result['subTotal'] + $result['taxAmount'];
     $this->view->cart = $result;
     $data = array();
     $data['taxNumber'] = $items[0]['taxNumber'];
     $data['taxCompany'] = $items[0]['taxCompany'];
     $data['taxAddress'] = $items[0]['taxAddress'];
     $data['taxCity'] = $items[0]['taxCity'];
     $data['taxZip'] = $items[0]['taxZip'];
     $data['taxProvince'] = $items[0]['taxProvince'];
     $data['taxCountry'] = $items[0]['taxCountryId'];
     $data['paymentMethod'] = $items[0]['paymentMethod'];
     $data['currencyValue'] = $items[0]['currencyValue'];
     $this->view->data = $data;
 }
Example #2
0
 function sendInvoiceToUser($orderId)
 {
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/configs/mail.ini', 'mail');
     $siteOwner = "Hukumonline";
     $siteName = $config->mail->sender->support->name;
     $contactEmail = $config->mail->sender->support->email;
     $tblOrder = new Kutu_Core_Orm_Table_Order();
     $rowOrder = $tblOrder->find($orderId)->current();
     $userId = $rowOrder->userId;
     $tblUser = new Kutu_Core_Orm_Table_User();
     $rowUser = $tblUser->find($userId)->current();
     $userEmail = $rowUser->email;
     $userFullname = $rowUser->fullName;
     $datePurchased = Kutu_Lib_Formater::get_date($rowOrder->datePurchased);
     if ($rowOrder->paymentMethodNote == "membership") {
         $duedate = date("d/m/y", strtotime($rowOrder->invoiceExpirationDate));
     } else {
         $duedate = "-";
     }
     $message = "Kepada Yth, \r\n{$userFullname}\r\n\r\nBerikut kami beritahukan bahwa Invoice untuk anda sudah dibuat pada tanggal {$datePurchased}.\r\n\r\nDengan metode pembayaran: {$rowOrder->paymentMethod}\r\n\r\nInvoice # {$rowOrder->invoiceNumber}\r\nJumlah tagihan: Rp. {$rowOrder->orderTotal}\r\nJatuh tempo: {$duedate}\r\n\r\nAnda bisa login di Ruang Konsumen untuk melihat status invoice ini atau melakukan pembayaran secara online di " . KUTU_ROOT_URL . "/store/viewinvoice/orderId/{$orderId}.\r\n\r\nTerima kasih,\r\n\r\nHukumonline\r\n\r\n==============================";
     $this->send($config->mail->sender->support->email, $config->mail->sender->support->name, $userEmail, '', "Hukumonline Invoice: " . $rowOrder->invoiceNumber, $message);
 }
Example #3
0
 /**
  * _writeInvoice : Individual & Korporasi
  * @return 
  */
 function _writeInvoice($memberId, $totalPromo, $discPromo, $payment, $access = '')
 {
     $aclMan = new Kutu_Acl_Adapter_Local();
     $tblInvoice = new Kutu_Core_Orm_Table_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 = Kutu_Lib_Formater::DateAdd('d', 5, $temptime);
         $rowInvoice->expirationDate = strftime('%Y-%m-%d', $temptime);
         $tblUser = new Kutu_Core_Orm_Table_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;
             } else {
                 $response['failure'] = true;
             }
             echo Zend_Json::encode($response);
         }
     } else {
         if (!empty($access)) {
             $response['success'] = true;
             echo Zend_Json::encode($response);
         }
     }
 }
Example #4
0
 function completeAction()
 {
     $formater = new Kutu_Core_Hol_User();
     $defaultCurrency = 'Rp';
     $kopel = $this->_request->getParam('kopel');
     $method = $this->_request->getParam('method');
     $packageId = $this->_request->getParam('packageId');
     $paymentSubscription = $this->_request->getParam('payment');
     $tblPaymentSetting = new Kutu_Core_Orm_Table_PaymentSetting();
     $usdIdrEx = $tblPaymentSetting->fetchRow(" settingKey= 'USDIDR'");
     $currencyValue = $usdIdrEx->settingValue;
     $rowTaxRate = $tblPaymentSetting->fetchRow("settingKey='taxRate'");
     $taxRate = $rowTaxRate->settingValue;
     $tblUser = new Kutu_Core_Orm_Table_User();
     $rowUser = $tblUser->find($kopel)->current();
     /*
         	$modelGroup = new Kutu_Core_Orm_Table_Group();
         	$row = $modelGroup->fetchRow("id=".$this->_user->packageId);
     if ($row->name == "free") {
     	$rowUser->periodeId = 2;
     	$rowUser->save();
     }
     */
     $this->view->rowUser = $rowUser;
     // discount
     $disc = $formater->checkPromoValidation('Disc', $packageId, $rowUser->promotionId, $paymentSubscription);
     $total = $formater->checkPromoValidation('Total', $packageId, $rowUser->promotionId, $paymentSubscription);
     $tblPackage = new Kutu_Core_Orm_Table_Package();
     $rowPackage = $tblPackage->fetchRow("packageId={$packageId}");
     $this->view->rowPackage = $rowPackage;
     $tblOrder = new Kutu_Core_Orm_Table_Order();
     $row = $tblOrder->fetchNew();
     $row->userId = $kopel;
     if ($this->getRequest()->getPost()) {
         $value = $this->getRequest()->getPost();
         $row->taxNumber = $value['taxNumber'];
         $row->taxCompany = $value['taxCompany'];
         $row->taxAddress = $value['taxAddress'];
         $row->taxCity = $value['taxCity'];
         $row->taxZip = $value['taxZip'];
         $row->taxProvince = $value['taxProvince'];
         $row->taxCountryId = $value['taxCountry'];
         $row->paymentMethod = $method;
     }
     $row->datePurchased = date('YmdHis');
     $row->paymentMethodNote = "membership";
     if ($method == "nsiapay") {
         $row->orderStatus = 8;
     } else {
         $row->orderStatus = 1;
         //pending
     }
     $row->currency = $defaultCurrency;
     $row->currencyValue = $currencyValue;
     $row->orderTotal = $total;
     $row->ipAddress = Kutu_Lib_Formater::getRealIpAddr();
     $orderId = $row->save();
     $rowJustInserted = $tblOrder->find($orderId)->current();
     $rowJustInserted->invoiceNumber = date('Ymd') . '.' . $orderId;
     $temptime = time();
     $temptime = Kutu_Lib_Formater::DateAdd('d', 5, $temptime);
     $rowJustInserted->discount = $disc;
     $rowJustInserted->invoiceExpirationDate = strftime('%Y-%m-%d', $temptime);
     $rowJustInserted->save();
     $this->view->invoiceNumber = $rowJustInserted->invoiceNumber;
     $this->view->datePurchased = $rowJustInserted->datePurchased;
     $tblOrderDetail = new Kutu_Core_Orm_Table_OrderDetail();
     $rowDetail = $tblOrderDetail->fetchNew();
     $rowDetail->orderId = $orderId;
     $rowDetail->itemId = $rowPackage->packageId;
     $modelGroup = new Kutu_Core_Orm_Table_Group();
     $row = $modelGroup->fetchRow("id={$packageId}");
     $group = "Subsciption for Member " . ucwords(strtolower($row->name)) . " " . $paymentSubscription . " Months";
     $this->view->packageId = $packageId;
     $this->view->paymentSubscription = $paymentSubscription;
     $this->view->itemName = $group;
     $rowDetail->documentName = $group;
     $rowDetail->price = $total;
     $numOfUsers = $tblUser->getUserCount($rowUser->kopel);
     $this->view->numOfUsers = $numOfUsers;
     $this->view->grandtotal = $total;
     $this->view->method = $method;
     $this->view->orderId = $orderId;
     $this->view->total = $rowPackage->charge;
     $rowDetail->qty = $numOfUsers;
     $rowDetail->finalPrice = $total;
     $rowDetail->save();
     $data = $this->_request->getParams();
     $this->view->data = $data;
     $modDir = $this->getFrontController()->getModuleDirectory();
     require_once $modDir . '/models/Store/Mailer.php';
     $mod = new Membership_Model_Store_Mailer();
     switch (strtolower($method)) {
         case 'manual':
         case 'bank':
             $mod->sendBankInvoiceToUser($orderId);
             break;
         case 'nsiapay':
             $mod->sendInvoiceToUser($orderId);
             break;
     }
 }
Example #5
0
 function logoutAction()
 {
     /*
     $phpBB = new Kutu_Lib_Forum();
     $phpBB->user_logout();
     */
     Kutu_Lib_Formater::updateUserLog();
     $auth = Zend_Auth::getInstance();
     $username = $auth->getIdentity()->username;
     $dbAdapters = Zend_Registry::get('dbAdapters');
     $config = $dbAdapters['hol'];
     $sql = "DELETE FROM `session` WHERE sessionData LIKE '%{$username}%'";
     $config->query($sql);
     $auth->clearIdentity();
     $returnUrl = base64_decode($this->_getParam('returnTo'));
     $this->_redirect($returnUrl);
 }
Example #6
0
 function _writeConfirmCorporateEmail($mailcontent, $company, $payment, $disc, $total, $username, $guid, $email)
 {
     $formater = new Kutu_Lib_Formater();
     $obj = new Kutu_Crypt_Password();
     $mailcontent = str_replace('$company', $company, $mailcontent);
     $mailcontent = str_replace('$timeline', $payment, $mailcontent);
     $mailcontent = str_replace('$disc', $disc, $mailcontent);
     $mailcontent = str_replace('$price', number_format($total), $mailcontent);
     $mailcontent = str_replace('$username1', $username, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     // table User
     $tblUser = new Kutu_Core_Orm_Table_User();
     $where = $tblUser->getAdapter()->quoteInto('company=?', $company);
     $rowUser = $tblUser->fetchAll($where, 'username ASC');
     $tag = '<table>';
     $tag .= '<tr><td><b>Username</b></td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td><b>Password</b></td></tr>';
     foreach ($rowUser as $rowsetUser) {
         $tag .= '<tr><td>' . $rowsetUser->username . '</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>' . $obj->decryptPassword($rowsetUser->password) . '</td></tr>';
     }
     $tag .= '</table>';
     $mailcontent = str_replace('$tag', $tag, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/app/config/config.ini', 'mail');
     $mailAttempt = $formater->add_mail($config->from, $email, $username, 'Hukumonline-ID', $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $formater->send_mail();
         if ($sendAttempt) {
             $response['success'] = true;
             $response['message'] = "Please check your email at {$email}!";
         } else {
             ob_clean();
             $response['failure'] = false;
             $response['message'] = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $response['failure'] = true;
         $response['message'] = "Error saving mail!";
     }
     echo Zend_Json::encode($response);
 }
Example #7
0
 public function reIndexCatalog()
 {
     gc_enable();
     $this->emptyIndex();
     $time_start = microtime(true);
     $solr =& $this->_solr;
     $log = new Kutu_Log();
     $formater = new Kutu_Lib_Formater();
     $title = new Kutu_View_Helper_GetCatalogTitle();
     //		$tbl = new Kutu_Core_Orm_Table_Catalog();
     //		$rowset = $tbl->fetchAll(); //("profileGuid='kutu_peraturan'");
     $query = "SELECT * FROM KutuCatalog";
     $results = $this->_conn->query($query);
     $rowset = $results->fetchAll(PDO::FETCH_OBJ);
     $documents = array();
     $rowCount = count($rowset);
     for ($iCount = 0; $iCount < $rowCount; $iCount++) {
         $row = $rowset[$iCount];
         //			if($iCount == 100)
         //				break;
         //			echo 'urutan: '.$iCount .'<br>';
         $nextRow = $rowset[$iCount + 1];
         //			echo 'current guid: '.$row->guid.'  '.'next guid: '.$nextRow->guid.'<br>';
         if ($row->modifiedBy !== $row->createdBy) {
             $modified = '<font color=red>[modifiedBy:<i>' . $row->modifiedBy . '</i>]</font>&nbsp;';
         } else {
             $modified = '';
         }
         echo '<li><span style="font:11px verdana,arial,helvetica,sans-serif;">[urutan:' . $iCount . ']&nbsp;indexing:<font color=green>' . $title->getCatalogTitle($row->guid) . '</font>[current guid: ' . $row->guid . '  ' . 'next guid: ' . $nextRow->guid . '][author:<i>' . $row->createdBy . '</i>]&nbsp;' . $modified . '[createdDate:<i>' . $formater->get_date($row->createdDate) . '</i>]</span></li>';
         $documents[] = $this->_createSolrDocument($row);
         if ($iCount % 500 == 0) {
             try {
                 $solr->addDocuments($documents);
                 $solr->commit();
                 //					$solr->optimize();
                 $documents = array();
             } catch (Exception $e) {
                 //					echo "Error occured when processing record starting from number: ". ($iCount - 1000) . ' to '.$iCount.' '.$row->guid;
                 $log->err($e->getMessage());
                 throw new Zend_Exception($e->getMessage());
                 //					echo $e->getMessage().'<br>';
             }
         }
         flush();
     }
     echo '</ul></div></td></tr></table>';
     try {
         $solr->addDocuments($documents);
         $solr->commit();
         //			$solr->optimize();
     } catch (Exception $e) {
         $log->err($e->getMessage());
         throw new Zend_Exception($e->getMessage());
         //			echo $e->getMessage().'<br>';
     }
     $time_end = microtime(true);
     $time = $time_end - $time_start;
     //		echo'<br>WAKTU EKSEKUSI: '. $time;
     $log->info("WAKTU EKSEKUSI: " . $time . " indexing catalog " . $iCount . " dari " . $rowCount . " " . $username);
     echo '<br><br><span style="font:11px verdana,arial,helvetica,sans-serif;color:#00FF00">WAKTU EKSEKUSI: ' . $time . '<br>indexing catalog ' . $iCount . ' dari ' . $rowCount . '</span>';
     // log to assetSetting
     $tblAssetSetting = new Kutu_Core_Orm_Table_AssetSetting();
     $rowAsset = $tblAssetSetting->fetchRow("application='INDEX CATALOG'");
     if ($rowAsset) {
         $rowAsset->valueText = "Update {$rowCount} indexing-catalog at " . date("Y-m-d H:i:s") . $username;
         $rowAsset->valueInt = $rowAsset->valueInt + 1;
     } else {
         $gman = new Kutu_Core_Guid();
         $catalogGuid = $gman->generateGuid();
         $rowAsset = $tblAssetSetting->fetchNew();
         $rowAsset->guid = $catalogGuid;
         $rowAsset->application = "INDEX CATALOG";
         $rowAsset->part = "KUTU";
         $rowAsset->valueType = "INDEX";
         $rowAsset->valueInt = 0;
         $rowAsset->valueText = $rowCount . " Indexing catalog at " . date("Y-m-d H:i:s") . $username;
     }
     $rowAsset->save();
 }
 function indexingTempAction()
 {
     $start = $this->_getParam('start') ? $this->_getParam('start') : 0;
     $end = $this->_getParam('limit') ? $this->_getParam('limit') : 10;
     $formater = new Kutu_Lib_Formater();
     $hTitle = new Pandamp_Controller_Action_Helper_GetCatalogTitle();
     $isFile = new Pandamp_Controller_Action_Helper_GetCatalogIsFile();
     $tblTmpIndex = new Pandamp_Modules_Extension_Index_Model_TmpIndex();
     $rowset = $tblTmpIndex->fetchAll(null, null, $end, $start);
     $rowCount = $tblTmpIndex->countCatalogsTempIndex();
     //		switch ($profileGuid)
     //		{
     //			case 'peraturan':
     //				$rowset = $tblTmpIndex->fetchAll("profileGuid IN ('kutu_doc','kutu_peraturan','kutu_putusan','kutu_peraturan_kolonial','kutu_rancangan_peraturan')",'',$end,$start);
     //				$rowCount = $tblTmpIndex->countCatalogsTempIndexPeraturan();
     //			break;
     //			case 'berita':
     //				$rowset = $tblTmpIndex->fetchAll("profileGuid IN ('aktual','suratpembaca','komunitas','news','talks','resensi','isuhangat','fokus','kolom','tokoh','jeda','tajuk','info','utama')",'',$end,$start);
     //				$rowCount = $tblTmpIndex->countCatalogsTempIndexArticle();
     //			break;
     //		}
     $a = array();
     $a['totalCount'] = $rowCount;
     $i = 0;
     if ($a['totalCount'] != 0) {
         foreach ($rowset as $row) {
             $a['index'][$i]['guid'] = $row->guid;
             $a['index'][$i]['catalogGuid'] = $row->catalogGuid;
             $a['index'][$i]['title'] = $hTitle->getCatalogTitle($row->catalogGuid) . '&nbsp;<font color=green>[' . $formater->getCatalogAuthor($row->catalogGuid) . ']</font>' . '&nbsp;' . $isFile->GetCatalogIsFile($row->catalogGuid) . '&nbsp;<font color=blue>[' . $row->profileGuid . ']</font>';
             $a['index'][$i]['status'] = $row->status;
             $a['index'][$i]['createdDate'] = $formater->get_date($row->createdDate);
             $i++;
         }
     }
     if ($a['totalCount'] == 0) {
         $a['index'][0]['guid'] = '';
         $a['index'][0]['title'] = '';
         $a['index'][0]['status'] = "";
         $a['index'][0]['createdDate'] = '';
     }
     echo Zend_Json::encode($a);
 }