[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 require_once ('include/utils/utils.php'); 13 14 class RecurringInvoiceHandler extends VTEventHandler { 15 public function handleEvent($handlerType, $entityData){ 16 global $log, $adb; 17 $moduleName = $entityData->getModuleName(); 18 if ($moduleName == 'SalesOrder') { 19 $soId = $entityData->getId(); 20 $data = $entityData->getData(); 21 if($data['enable_recurring'] == 'on' || $data['enable_recurring'] == 1) { 22 $frequency = $data['recurring_frequency']; 23 $startPeriod = getValidDBInsertDateValue($data['start_period']); 24 $endPeriod = getValidDBInsertDateValue($data['end_period']); 25 $paymentDuration = $data['payment_duration']; 26 $invoiceStatus = $data['invoicestatus']; 27 if (isset($frequency) && $frequency != '' && $frequency != '--None--') { 28 $check_query = "SELECT * FROM vtiger_invoice_recurring_info WHERE salesorderid=?"; 29 $check_res = $adb->pquery($check_query, array($soId)); 30 $noofrows = $adb->num_rows($check_res); 31 if ($noofrows > 0) { 32 $row = $adb->query_result_rowdata($check_res, 0); 33 $query = "UPDATE vtiger_invoice_recurring_info SET recurring_frequency=?, start_period=?, end_period=?, payment_duration=?, invoice_status=? WHERE salesorderid=?"; 34 $params = array($frequency,$startPeriod,$endPeriod,$paymentDuration,$invoiceStatus,$soId); 35 } else { 36 $query = "INSERT INTO vtiger_invoice_recurring_info VALUES (?,?,?,?,?,?,?)"; 37 $params = array($soId,$frequency,$startPeriod,$endPeriod,$startPeriod,$paymentDuration,$invoiceStatus); 38 } 39 $adb->pquery($query, $params); 40 } 41 } else { 42 $query = "DELETE FROM vtiger_invoice_recurring_info WHERE salesorderid = ?"; 43 $adb->pquery($query, array($soId)); 44 } 45 } 46 } 47 } 48 49 50 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |