Changes to AgileBill

This commit is contained in:
Deon George
2009-08-03 14:10:16 +10:00
parent 0a22cfe22c
commit 27aee719b0
1051 changed files with 219109 additions and 117219 deletions

View File

@@ -24,15 +24,15 @@
*/
class base_checkout_plugin
{
var $checkout_id; /* current checkout plugin id */
var $name; /* plugin name */
protected $checkout_id; /* current checkout plugin id */
protected $name; /* plugin name */
var $type; /* redirect, gateway, or other */
var $recurr_only=false; /* bool */
var $return_url; /* return url */
var $success_url; /* decline url */
var $support_cur; /* supported currency array */
var $cfg;
var $flds;
protected $flds;
var $eft; /* true if checkout plugin type is eft */
var $req_all_flds=true; /* require all account fields (first/last name, address1, state/province, zip) */
var $req_fields_arr=false; /* if req_all_fields=false, use this array to define which fields will be required */
@@ -42,15 +42,32 @@ class base_checkout_plugin
/**
* Get the checkout plugin settings from the database
*/
function getDetails($checkout_id) {
if(!$checkout_id) return;
$this->checkout_id = $checkout_id;
protected function getDetails($checkout_id) {
if (! $checkout_id)
return;
$db = &DB();
$q = "SELECT * FROM ".AGILE_DB_PREFIX."checkout WHERE site_id=".DEFAULT_SITE." AND id=".$db->qstr($checkout_id);
$rs = $db->Execute($q);
if($rs && $rs->RecordCount()) {
@$this->cfg = unserialize($rs->fields["plugin_data"]);
$rs = $db->Execute(sqlSelect($db,'checkout','*',array('id'=>$checkout_id)));
if ($rs && $rs->RecordCount()) {
@$this->cfg = unserialize($rs->fields['plugin_data']);
$this->flds = $rs->fields;
$this->checkout_id = $rs->fields['id'];
}
}
/**
* Get the checkout plugin settings from the database
*/
protected function getDetailsName($checkout_name) {
if (! $checkout_name)
return;
$db = &DB();
$rs = $db->Execute(sqlSelect($db,'checkout','*',array('name'=>$checkout_name)));
if ($rs && $rs->RecordCount()) {
@$this->cfg = unserialize($rs->fields['plugin_data']);
$this->flds = $rs->fields;
$this->checkout_id = $rs->fields['id'];
}
}
@@ -427,4 +444,4 @@ class base_checkout_plugin
return false;
}
}
?>
?>

View File

@@ -1,48 +1,57 @@
<?php
/**
* AgileBill - Open Billing Software
*
* This body of work is free software; you can redistribute it and/or
* modify it under the terms of the Open AgileBill License
* License as published at http://www.agileco.com/agilebill/license1-4.txt
*
* For questions, help, comments, discussion, etc., please join the
* Agileco community forums at http://forum.agileco.com/
*
* Originally authored by Tony Landis, AgileBill LLC
*
* Recent modifications by Deon George
*
* @author Deon George <deonATleenooksDOTnet>
* @copyright 2009 Deon George
* @link http://osb.leenooks.net
*
* @link http://www.agileco.com/
* @copyright 2004-2008 Agileco, LLC.
* @license http://www.agileco.com/agilebill/license1-4.txt
* @author Tony Landis <tony@agileco.com>
* @author Tony Landis <tony@agileco.com>
* @package AgileBill
* @version 1.4.93
* @subpackage Module:Checkout
*/
class checkout
{
/**
* The main AgileBill Checkout Class
*
* @package AgileBill
* @subpackage Module:Checkout
*/
class checkout extends OSB_module {
var $account_id;
var $session_id;
var $affiliate_id;
var $campaign_id;
var $admin_view=false;
var $admin_checkout=false;
var $admin_checkout_option=false;
var $admin_checkout_option=false;
/**
* Add Discount for Admin Checkout
* Add Discount for Admin Checkout
*/
function admin_adddiscount($VAR) {
if(empty($VAR['amount'])) return false;
if(empty($VAR['id'])) return false;
if(empty($VAR['id'])) return false;
$db=&DB();
$fields=Array('ad_hoc_discount'=>round($VAR['amount'],2));
$db->Execute(sqlUpdate($db,"cart",$fields,"id = ::{$VAR['id']}:: "));
$db->Execute(sqlUpdate($db,"cart",$fields,"id = ::{$VAR['id']}:: "));
return true;
}
/**
* Add Discount Code to Sess
* Add Discount Code to Sess
*/
function adddiscount($VAR)
{
@@ -52,10 +61,10 @@ class checkout
}
/**
* Admin Create the Invoice Record
* Admin Create the Invoice Record
*/
function admin_checkoutnow($VAR)
{
{
# Get the account id & session_id
if(!empty($VAR['account_id']))
{
@@ -101,7 +110,7 @@ class checkout
}
$this->redirect = true;
$this->admin_checkout = true;
# Is processor free checkout?
if(@$VAR['option'] == '999') $this->admin_checkout_option = true;
@@ -127,25 +136,25 @@ class checkout
* @param bool $any_recurring
* @return array
*/
function get_checkout_options($account_id,$total=0,$product_arr=false,$country_id=1,$any_new=false,$any_trial=false,$any_recurring=false) {
$options=false;
function get_checkout_options($account_id,$total=0,$product_arr=false,$country_id=1,$any_new=false,$any_trial=false,$any_recurring=false) {
$options=false;
if($any_trial) $options .= " AND allow_trial=1 ";
if($any_recurring) $options .= " AND allow_recurring=1 ";
if($any_new) $options .= " AND allow_new=1 ";
if(!$options) return false;
if(!$options) return false;
$db=&DB();
$chopt = $db->Execute(sqlSelect($db,"checkout","*","active=1 $options"));
$chopt = $db->Execute(sqlSelect($db,"checkout","*","active=1 $options"));
if($chopt && $chopt->RecordCount()) {
while( !$chopt->EOF ) {
$show = true;
# Check that the cart total is not to low:
if ( $show == true && $chopt->fields["total_minimum"] != "" && $total < $chopt->fields["total_minimum"] ) $show = false;
if ( $show == true && $chopt->fields["total_minimum"] != "" && $total < $chopt->fields["total_minimum"] ) $show = false;
# Check that the cart total is not to high:
if ( $show == true && $chopt->fields["total_maximum"] != "" && $total > $chopt->fields["total_maximum"] ) {
$show = false;
} elseif ($chopt->fields["total_maximum"] == '0' && $total > 0) {
$show = false;
}
}
# Check that the group requirement is met:
if ( $show == true && !$this->admin_view && !empty ( $chopt->fields["required_groups"] ) ) {
global $C_auth;
@@ -157,7 +166,7 @@ class checkout
$i=count($arr);
}
}
}
}
# Check that the customer is not ordering a blocked SKU:
if ( $show == true && !$this->admin_view && !empty ( $chopt->fields["excluded_products"] ) && $product_arr ) {
$arr = unserialize ( $chopt->fields["excluded_products"] );
@@ -172,36 +181,36 @@ class checkout
}
}
}
}
}
$list_ord = 100;
# Check if this method should be the default method:
if ( $show == true) {
# Check if this method should be the default method:
if ( $show == true) {
# By Amount:
if ( !empty ( $chopt->fields["default_when_amount"] ) ) {
@$arr = unserialize ( $chopt->fields["default_when_amount"] );
for ( $i=0; $i<count($arr); $i++ ) if ( $total >= $arr[$i] ) $list_ord--; $i=count($arr);
}
for ( $i=0; $i<count($arr); $i++ ) if ( $total >= $arr[$i] ) $list_ord--; $i=count($arr);
}
# By Currency
if ( !empty ( $chopt->fields["default_when_currency"] ) ) {
@$arr = unserialize ( $chopt->fields["default_when_currency"] );
for ( $i=0; $i<count($arr); $i++ ) if ( SESS_CURRENCY == $arr[$i] ) $list_ord--; $i=count($arr);
}
for ( $i=0; $i<count($arr); $i++ ) if ( SESS_CURRENCY == $arr[$i] ) $list_ord--; $i=count($arr);
}
# By Group
if ( !empty ( $chopt->fields["default_when_group"] ) ) {
@$arr = unserialize ( $chopt->fields["default_when_group"] );
global $C_auth;
for ( $i=0; $i<count($arr); $i++ ) if ( $C_auth->auth_group_by_account_id( $account_id, $arr[$i] ) ) $list_ord--; $i=count($arr);
}
for ( $i=0; $i<count($arr); $i++ ) if ( $C_auth->auth_group_by_account_id( $account_id, $arr[$i] ) ) $list_ord--; $i=count($arr);
}
# By Country
if ( !empty ( $chopt->fields["default_when_country"] ) ) {
@$arr = unserialize ( $chopt->fields["default_when_country"] );
for ( $i=0; $i<count($arr); $i++ ) if ( $country_id == $arr[$i] ) $list_ord--; $i=count($arr);
}
for ( $i=0; $i<count($arr); $i++ ) if ( $country_id == $arr[$i] ) $list_ord--; $i=count($arr);
}
# Add to the array
$checkout_options[] = Array ('sort'=>$list_ord, 'fields'=>$chopt->fields);
$checkout_options[] = Array ('sort'=>$list_ord, 'fields'=>$chopt->fields);
}
$chopt->MoveNext();
}
}
# Sort the checkout_options array by the [fields] element
if(count($checkout_options) > 0 ) {
foreach ( $checkout_options as $key => $row ) $sort[$key] = $row["sort"];
@@ -210,220 +219,229 @@ class checkout
}
} else {
return false;
}
}
return false;
}
/**
* Admin View Preview / Confirm prior to checkout
* Admin View Preview / Confirm prior to checkout
*/
function admin_preview($VAR) {
function admin_preview($VAR) {
global $C_auth;
if(!empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) {
$this->account_id=$VAR['account_id'];
$this->admin_view = true;
} else {
$this->account_id=SESS_ACCOUNT;
$this->account_id=SESS_ACCOUNT;
}
$this->preview($VAR, $this);
}
/**
* Preview / Confirm prior to checkout
*/
function preview($VAR) {
if(!SESS_LOGGED) return false;
$db = &DB();
if(empty($this->session_id)) $this->session_id = SESS;
if(empty($this->account_id)) $this->account_id = SESS_ACCOUNT;
include_once ( PATH_MODULES . '/cart/cart.inc.php' );
*/
public function preview($VAR) {
if (! SESS_LOGGED)
return false;
$db = &DB();
if (empty($this->session_id))
$this->session_id = SESS;
if (empty($this->account_id))
$this->account_id = SESS_ACCOUNT;
include_once(PATH_MODULES.'/cart/cart.inc.php');
$cartObj = new cart;
$cartObj->account_id=$this->account_id;
$cartObj->session_id=$this->session_id;
$result = $cartObj->get_contents($db);
if($result->RecordCount() == 0) return false;
// load invoice object
$cartObj->account_id = $this->account_id;
$cartObj->session_id = $this->session_id;
$result = $cartObj->get_contents();
if (! $result || $result->RecordCount() == 0)
return false;
# Load invoice object
include_once(PATH_MODULES.'invoice/invoice.inc.php');
$invoice = new invoice;
$invoice->initNew(0);
$invoice->initNew(0);
$invoice->account_id = $this->account_id;
// Get the account details:
$account = $db->Execute(sqlSelect($db,"account","*","id=::$this->account_id::"));
# Get the account details:
$account = $db->Execute(sqlSelect($db,'account','*',array('id'=>$this->account_id)));
$invoice->country_id = $account->fields['country_id'];
$invoice->state = $account->fields['state'];
// load tax object for tax calculation
include_once(PATH_MODULES.'tax/tax.inc.php');
$taxObj=new tax;
// load discount object for discount calculation
include_once(PATH_MODULES.'discount/discount.inc.php');
$discountObj=new discount;
$discountObj->available_discounts($invoice->account_id);
// put cart contents into invoice format
$cartObj->put_contents_invoice($db, $result, $invoice, $smart, $taxObj, $discountObj);
// get available checkout options
foreach($invoice->invoice_item as $item) if(!empty($item['product_id'])) $product_arr[]=$item['product_id'];
$checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,@$product_arr,$invoice->country_id,$invoice->any_new, $invoice->any_trial, $invoice->any_recurring);
# Put cart contents into invoice format
$smart = $cartObj->put_contents_invoice($result,$invoice);
# Get available checkout options
$product_arr = array();
foreach ($invoice->invoice_item as $item)
if (! empty($item['product_id']))
array_push($product_arr,$item['product_id']);
$checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,$product_arr,$invoice->country_id,$invoice->any_new,$invoice->any_trial,$invoice->any_recurring);
$checkout_c = count($checkout_options);
global $smarty;
$smarty->assign('results', count($invoice->invoice_item));
$smarty->assign('cart', $smart);
$smarty->assign('results',count($invoice->invoice_item));
$smarty->assign('cart',$smart);
$smarty->assign('sub_total',($invoice->total_amt+$invoice->discount_amt)-$invoice->tax_amt);
$smarty->assign('total', $invoice->total_amt);
$smarty->assign('discount', $invoice->group_discounts());
$smarty->assign('tax', $invoice->group_taxes());
$smarty->assign('checkout', $checkout_options);
$smarty->assign('checkout_c', $checkout_c);
$smarty->assign('total',$invoice->total_amt);
$smarty->assign('discount',$invoice->group_discounts());
$smarty->assign('tax',$invoice->group_taxes());
$smarty->assign('checkout',$checkout_options);
$smarty->assign('checkout_c',$checkout_c);
$checkout_c--;
$smarty->assign('last_checkout_id', $checkout_options["$checkout_c"]['fields']['id']);
$smarty->assign('last_checkout_id',$checkout_options[$checkout_c]['fields']['id']);
}
/**
* Create the Invoice Record and send user to checkout
* Create the Invoice Record and send user to checkout
*/
function checkoutnow($VAR)
{
global $C_translate, $C_list, $smarty;
public function checkoutnow($VAR) {
global $C_translate,$C_list,$smarty;
$db = &DB();
// Validate user is logged in:
if(!SESS_LOGGED) {
echo '<script language="JavaScript">alert("You must be logged in to complete this purchase! Please refresh this page in your browser to login now...");</script>';
# Validate user is logged in:
if (! SESS_LOGGED) {
printf('<script type="text/javascript">alert("%s...");</script>',
_('You must be logged in to complete this purchase! Please refresh this page in your browser to login now.'));
return false;
}
// check for admin
if(!$this->admin_checkout && !empty($VAR['account_id'])) {
# Check for admin
if (! $this->admin_checkout && ! empty($VAR['account_id'])) {
global $C_auth;
if(!empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) {
$this->account_id=$VAR['account_id'];
$this->admin_checkout=true;
if (! empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) {
$this->account_id = $VAR['account_id'];
$this->admin_checkout = true;
} else {
$this->account_id=SESS_ACCOUNT;
}
$this->account_id = SESS_ACCOUNT;
}
}
if(empty($this->session_id)) $this->session_id = SESS;
if(empty($this->account_id)) $this->account_id = SESS_ACCOUNT;
include_once ( PATH_MODULES . '/cart/cart.inc.php' );
if (empty($this->session_id))
$this->session_id = SESS;
if (empty($this->account_id))
$this->account_id = SESS_ACCOUNT;
include_once(PATH_MODULES.'/cart/cart.inc.php');
$cartObj = new cart;
$cartObj->account_id=$this->account_id;
$cartObj->session_id=$this->session_id;
$result = $cartObj->get_contents($db);
if($result->RecordCount() == 0) return false;
// load invoice object
$cartObj->account_id = $this->account_id;
$cartObj->session_id = $this->session_id;
$result = $cartObj->get_contents();
if (! $result || $result->RecordCount() == 0)
return false;
# Load invoice object
include_once(PATH_MODULES.'invoice/invoice.inc.php');
$invoice = new invoice;
$invoice->initNew(0);
$invoice->account_id = $this->account_id;
$invoice->initNew(0);
// Get the account details:
$account = $db->Execute(sqlSelect($db,"account","*","id=::$this->account_id::"));
# Get the account details:
$account = $db->Execute(sqlSelect($db,'account','*',array('id'=>$this->account_id)));
$invoice->country_id = $account->fields['country_id'];
$invoice->state = $account->fields['state'];
// load tax object for tax calculation
include_once(PATH_MODULES.'tax/tax.inc.php');
$taxObj=new tax;
// load discount object for discount calculation
include_once(PATH_MODULES.'discount/discount.inc.php');
$discountObj=new discount;
$discountObj->available_discounts($invoice->account_id);
// put cart contents into invoice format
$cartObj->put_contents_invoice($db, $result, $invoice, $smart, $taxObj, $discountObj);
# Put cart contents into invoice format
$cartObj->put_contents_invoice($result,$invoice);
// Validate and init a checkout plugin
$checkout=false;
if($this->admin_checkout_option) {
// admin checkout option specified
include_once ( PATH_MODULES . 'checkout/checkout_admin.inc.php' );
$PLG = new checkout_admin;
$checkout=true;
$invoice->checkout_plugin_id=false;
} else {
// get available checkout options and check against the one provided
$invoice->checkout_plugin_id=$VAR['option'];
foreach($invoice->invoice_item as $item) if(!empty($item['product_id'])) $product_arr[]=$item['product_id'];
$checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,@$product_arr,$invoice->country_id,$invoice->any_new, $invoice->any_trial, $invoice->any_recurring);
if($checkout_options) {
foreach($checkout_options as $a) {
if($a['fields']['id']==$invoice->checkout_plugin_id) {
// load the selected checkout plugin and run pre-validation
$checkout_plugin=$a['fields']['checkout_plugin'];
$plugin_file = PATH_PLUGINS . 'checkout/'.$checkout_plugin.'.php';
include_once ( $plugin_file );
eval ( '$PLG = new plg_chout_'.$checkout_plugin.'("'.$invoice->checkout_plugin_id.'");');
$plugin_validate = $PLG->validate($VAR, $this);
if ( $plugin_validate != true ) {
$checkout = false;
if ($this->admin_checkout_option) {
# Admin checkout option specified
include_once(PATH_MODULES.'checkout/checkout_admin.inc.php');
$PLG = new checkout_admin;
$checkout = true;
$invoice->checkout_plugin_id = false;
} else {
// Get available checkout options and check against the one provided
$invoice->checkout_plugin_id = $VAR['option'];
$product_arr = array();
foreach ($invoice->invoice_item as $item)
if (! empty($item['product_id']))
array_push($product_arr,$item['product_id']);
$checkout_options = $this->get_checkout_options($this->account_id,$invoice->total_amt,$product_arr,$invoice->country_id,$invoice->any_new,$invoice->any_trial,$invoice->any_recurring);
if ($checkout_options) {
foreach ($checkout_options as $a) {
if ($a['fields']['id'] == $invoice->checkout_plugin_id) {
# Load the selected checkout plugin and run pre-validation
$checkout_plugin = $a['fields']['checkout_plugin'];
include_once(sprintf('%scheckout/%s.php',PATH_PLUGINS,$checkout_plugin));
eval ('$PLG = new plg_chout_'.$checkout_plugin.'("'.$invoice->checkout_plugin_id.'");');
$plugin_validate = $PLG->validate($VAR,$this);
if ($plugin_validate != true) {
echo $plugin_validate;
return false;
}
}
$checkout=true;
break;
}
}
}
}
}
if(!$checkout) {
if (! $checkout) {
echo '<script language=Javascript> alert("Unable to checkout with the selected method, please select another."); </script> ';
return false;
}
// validate credit card on file details
global $VAR;
if(!empty($VAR['account_billing_id']) && @$VAR['new_card']==2) {
$invoice->account_billing_id=$VAR['account_billing_id'];
/* validate credit card on file details */
if(!$PLG->setBillingFromDB($this->account_id, $invoice->account_billing_id, $invoice->checkout_plugin_id)) {
global $VAR;
if (! empty($VAR['account_billing_id']) && @$VAR['new_card']==2) {
$invoice->account_billing_id=$VAR['account_billing_id'];
/* validate credit card on file details */
if(!$PLG->setBillingFromDB($this->account_id, $invoice->account_billing_id, $invoice->checkout_plugin_id)) {
global $C_debug;
$C_debug->alert("Sorry, we cannot use that billing record for this purchase.");
return false;
}
} else {
/* use passed in vars */
$PLG->setBillingFromParams($VAR);
}
}
// validate recurring processing options
if ($PLG->recurr_only) {
if ($invoice->recur_amt<=0) {
echo '<script language=Javascript> alert("Cannot process non-recurring charges with this payment option, please select another payment option."); </script> ';
return false;
}
if(is_array($invoice->recur_arr) && count($invoice->recur_arr)>1) {
$recurring = true;
// validate recur day and recurring schedule are the same for both products
foreach($invoice->recur_arr as $a) {
foreach($invoice->recur_arr as $b) {
foreach($b as $key=>$val) {
foreach($invoice->recur_arr as $a) {
foreach($invoice->recur_arr as $b) {
foreach($b as $key=>$val) {
if($key != 'price' && $key != 'recurr_week' && $a[$key] != $val) {
$recurring=false;
break;
}
}
}
}
}
if (!$recurring) {
echo '<script language=Javascript> alert("This payment option cannot be used when ordering both prorated and non-prorated subscriptions, or when ordering two or more subscriptions with different billing schedules selected. Please make sure all your subscriptions have the same billing schedule selected, try another payment option, or order one subscription at a time. We apologize for any inconvenience."); </script> ';
return false;
}
}
}
# Affiliate
if(empty($this->affiliate_id)) {
if(!empty($account->fields['affiliate_id']))
@@ -439,15 +457,15 @@ class checkout
else
$invoice->campaign_id = SESS_CAMPAIGN;
}
$invoice->record_id = sqlGenID($db,"invoice");
$invoice->record_id = sqlGenID($db,"invoice");
$invoice->actual_billed_currency_id = SESS_CURRENCY;
$invoice->billed_currency_id = DEFAULT_CURRENCY;
$invoice->checkout_type = $PLG->type;
// initial invoice status
if( $invoice->total_amt == 0 || $PLG->type == 'gateway') {
$invoice->billing_status = 1;
$invoice->billing_status = 1;
$invoice->actual_billed_amt = $C_list->format_currency_decimal($invoice->total_amt, SESS_CURRENCY);
$invoice->billed_amt = $invoice->total_amt;
}
@@ -460,7 +478,7 @@ class checkout
$bill_amt = round($invoice->total_amt,2);
$recur_amt = round($invoice->recur_amt,2);
}
// Get currency ISO (three_digit) for checkout plugin
$currrs = $db->Execute(sqlSelect($db,"currency","three_digit","id=".SESS_CURRENCY));
if($currrs && $currrs->RecordCount()) $currency_iso = $currrs->fields['three_digit'];
@@ -470,12 +488,12 @@ class checkout
$invoice->checkout_plugin_data = $PLG->bill_checkout($bill_amt, $invoice->record_id, $currency_iso, $account->fields, $recur_amt, $invoice->recur_arr);
if($invoice->checkout_plugin_data === false || $invoice->checkout_plugin_data == '' ) {
if(!empty($PLG->redirect)) echo $PLG->redirect;
return false;
return false;
} elseif ($PLG->type == "gateway" || empty($PLG->redirect)) {
$VAR['id'] = $invoice->record_id;
if(!$this->admin_checkout) $VAR['_page'] = "invoice:thankyou";
$invoice->checkout_plugin_data=false;
} elseif(!$this->admin_checkout) {
$VAR['id'] = $invoice->record_id;
if(!$this->admin_checkout) $VAR['_page'] = "invoice:thankyou";
$invoice->checkout_plugin_data=false;
} elseif(!$this->admin_checkout) {
echo "<html><head></head><body><center>
Please wait while we redirect you to the secure payment site....
{$PLG->redirect}</center></body></html>";
@@ -483,36 +501,36 @@ class checkout
// Call the Plugin method for storing the checkout data:
$invoice->account_billing_id = $PLG->store_billing($VAR, $invoice->account_id);
// clear user discounts
// clear user discounts
$fields=Array('discounts'=>"");
$db->Execute(sqlUpdate($db,"session",$fields,"id = ::".SESS."::"));
// admin options
$email=true;
if($this->admin_checkout) {
if($this->admin_checkout) {
if(empty($VAR['send_email']) || $VAR['send_email']=='false') $email=false; else $email=true;
if(!empty($VAR['due_date'])) $invoice->due_date=$this->getInputDate($VAR['due_date']);
if(!empty($VAR['grace_period'])) $invoice->grace_period=$VAR['grace_period'];
if(!empty($VAR['notice_max'])) $invoice->notice_max=$VAR['notice_max'];
if(!empty($VAR['notice_max'])) $invoice->notice_max=$VAR['notice_max'];
}
if($invoice->commitNew($taxObj, $discountObj, $email)) {
// delete all cart items
$db->Execute(sqlDelete($db,"cart", "(session_id=::".SESS.":: OR account_id=$invoice->account_id)"));
// admin redirect
if($this->admin_checkout) {
$url = URL.'admin.php?_page=invoice:view&id='.$invoice->record_id;
echo '<script language="javascript"> parent.location.href=\''.$url.'\';</script>';
}
}
return false;
if ($invoice->commitNew($taxObj,$discountObj,$email)) {
# Delete all cart items
$db->Execute(sqlDelete($db,'cart',sprintf('(session_id=::%s:: OR account_id=%s)',SESS,$invoice->account_id)));
# Admin redirect
if ($this->admin_checkout)
printf('<script language="javascript">parent.location.href=\'%sadmin.php?_page=invoice:view&id=%s\';</script>',URL,$invoice->record_id);
}
return false;
}
/** Convert a localized d,m,y string to epoch timestamp
/** Convert a localized d,m,y string to epoch timestamp
*/
function getInputDate($date) {
function getInputDate($date) {
$Arr_format = explode(DEFAULT_DATE_DIVIDER, UNIX_DATE_FORMAT);
$Arr_date = explode(DEFAULT_DATE_DIVIDER, $date);
for($i=0; $i<3; $i++)
@@ -522,26 +540,26 @@ class checkout
if($Arr_format[$i] == 'Y') $year = $Arr_date[$i];
}
$timestamp = mktime(0, 0, 0, $month, $day, $year);
return $timestamp;
return $timestamp;
return time();
}
/**
* Manage postback for multiple invoices
* Manage postback for multiple invoices
*/
function postback_multiple($arr) {
$db=&DB();
include_once(PATH_MODULES.'invoice/invoice.inc.php');
$invoice=new invoice;
$invoice=new invoice;
// get multi-invoice details
$total = $invoice->multiple_invoice_total($arr['invoice_id']);
if(!$total) return false;
if(!$total) return false;
$amt = $arr['amount'];
foreach($invoice->invoice_id as $id)
foreach($invoice->invoice_id as $id)
{
if($amt > 0)
{
@@ -549,56 +567,56 @@ class checkout
$rs=sqlSelect($db, "invoice","SUM(total_amt-billed_amt) as total","id=$id");
if($rs && $rs->RecordCount()) {
$thisamt = $rs->fields["total"];
if($thisamt > $amt)
$arr['amount'] = $amt;
else
$arr['amount'] = $thisamt;
$arr["invoice_id"] = $id;
$this->postback($arr);
$amt -= $thisamt;
}
}
}
}
}
}
/**
* Postback for Redirect Pay
* Postback for Redirect Pay
*/
function postback($arr)
{
global $C_debug;
if(empty($arr['invoice_id'])) return false;
if(empty($arr['transaction_id'])) return false;
if(empty($arr['invoice_id'])) return false;
if(empty($arr['transaction_id'])) return false;
if(empty($arr['amount'])) return false;
if(eregi("MULTI-", $arr['invoice_id'])) {
$this->postback_multiple($arr);
return;
}
# Get the latest invoice info:
$db = &DB();
$db = &DB();
$sql1 ="";
if(!empty($arr['subscription_id']))
$sql1 = "checkout_plugin_data = ".$db->qstr( trim($arr['subscription_id']) )." OR ";
$q = "SELECT * FROM ".AGILE_DB_PREFIX."invoice WHERE
(
(
$sql1
parent_id = ".$db->qstr(@$arr['invoice_id'])."
OR
id = ".$db->qstr(@$arr['invoice_id'])."
)
id = ".$db->qstr(@$arr['invoice_id'])."
)
AND
billing_status != 1
AND
AND
site_id = ".$db->qstr(DEFAULT_SITE)."
ORDER BY date_orig
LIMIT 0,1";
LIMIT 0,1";
$invoice = $db->Execute($q);
if ($invoice === false || $invoice->RecordCount()==0)
@@ -706,7 +724,7 @@ class checkout
invoice_id = ".$db->qstr($invoice_id)." AND
type = ".$db->qstr('postback')." AND
memo = ".$db->qstr($arr['transaction_id'])." AND
site_id = ".$db->qstr(DEFAULT_SITE);
site_id = ".$db->qstr(DEFAULT_SITE);
$memo = $db->Execute($q);
if ($memo === false)
@@ -719,14 +737,14 @@ class checkout
# Create the invoice memo:
$memo_id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id');
$q = "INSERT INTO
".AGILE_DB_PREFIX."invoice_memo
".AGILE_DB_PREFIX."invoice_memo
SET
id = ".$db->qstr($memo_id).",
site_id = ".$db->qstr(DEFAULT_SITE).",
date_orig = ".$db->qstr(time()).",
invoice_id = ".$db->qstr($invoice_id).",
account_id = ".$db->qstr(0).",
type = ".$db->qstr('postback').",
date_orig = ".$db->qstr(time()).",
invoice_id = ".$db->qstr($invoice_id).",
account_id = ".$db->qstr(0).",
type = ".$db->qstr('postback').",
memo = ".$db->qstr($arr['transaction_id']) ;
$memosql = $db->Execute($q);
@@ -735,14 +753,14 @@ class checkout
# Update the invoice billing info:
$q = "UPDATE
".AGILE_DB_PREFIX."invoice
".AGILE_DB_PREFIX."invoice
SET
date_last = ".$db->qstr(time()).",
billing_status = ".$db->qstr($this->billing_status).",
checkout_plugin_id = ".$db->qstr($this->checkout_id).",
checkout_plugin_data = ".$db->qstr($this->subscription_id).",
billed_amt = ".$db->qstr($this->billed_amt).",
actual_billed_amt = ".$db->qstr($this->actual_billed_amt).",
date_last = ".$db->qstr(time()).",
billing_status = ".$db->qstr($this->billing_status).",
checkout_plugin_id = ".$db->qstr($this->checkout_id).",
checkout_plugin_data = ".$db->qstr($this->subscription_id).",
billed_amt = ".$db->qstr($this->billed_amt).",
actual_billed_amt = ".$db->qstr($this->actual_billed_amt).",
actual_billed_currency_id = ".$db->qstr($this->actual_billed_currency_id)."
WHERE
id = ".$db->qstr($invoice_id)." AND
@@ -764,14 +782,14 @@ class checkout
# create a record of the viod in an invoice memo:
$memo_id = $db->GenID(AGILE_DB_PREFIX . 'invoice_memo_id');
$q = "INSERT INTO
".AGILE_DB_PREFIX."invoice_memo
".AGILE_DB_PREFIX."invoice_memo
SET
id = ".$db->qstr($memo_id).",
site_id = ".$db->qstr(DEFAULT_SITE).",
date_orig = ".$db->qstr(time()).",
invoice_id = ".$db->qstr($invoice_id).",
account_id = ".$db->qstr(0).",
type = ".$db->qstr('void').",
date_orig = ".$db->qstr(time()).",
invoice_id = ".$db->qstr($invoice_id).",
account_id = ".$db->qstr(0).",
type = ".$db->qstr('void').",
memo = ".$db->qstr("Voided due to postback: ".$arr['transaction_id']) ;
$rsql = $db->Execute($q);
@@ -797,109 +815,55 @@ class checkout
}
/**
* Display Checkout Data Form
* Display Checkout Data Form
*/
function checkoutoption($VAR) {
global $VAR, $C_translate, $smarty;
global $VAR,$C_translate,$C_auth,$C_vars,$smarty;
if(SESS_LOGGED != '1') {
$smarty->assign('plugin_template', false);
if (SESS_LOGGED != '1') {
$smarty->assign('plugin_template',false);
return false;
}
// Normal checkout
# Normal checkout
$db = &DB();
$q = "SELECT * FROM ".AGILE_DB_PREFIX."checkout WHERE site_id=".DEFAULT_SITE." AND id=".$db->qstr(@$VAR["option"]);
$rs = $db->Execute($q);
if($rs == false || $rs->RecordCount() == 0) {
$smarty->assign('plugin_template', false);
$rs = $db->Execute(sqlSelect($db,'checkout','*',array('id'=>$VAR['option'])));
if (! $rs || $rs->RecordCount() == 0) {
$smarty->assign('plugin_template',false);
return false;
}
// determine account id
global $C_auth;
if(!empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) {
$this->account_id=$VAR['account_id'];
$this->admin_view = true;
} else {
$this->account_id=SESS_ACCOUNT;
}
// Set account options && seed VAR with defaults
if(empty($VAR['detailsnocopy'])) {
$acct = $db->Execute($sql=sqlSelect($db,"account","first_name,last_name,address1,address2,city,state,zip,country_id,email,company","id=".$this->account_id));
if($acct && $acct->RecordCount())
foreach($acct->fields as $key=>$val)
if(!is_numeric($key) && empty($VAR["$key"]))
$VAR["$key"]=stripslashes($acct->fields["$key"]);
}
global $C_vars;
$C_vars->strip_slashes_all();
$smarty->assign('VAR', $VAR);
$smarty->assign('plugin_template', 'checkout_plugin:plugin_ord_' . $rs->fields["checkout_plugin"]);
# Determine account id
if (! empty($VAR['account_id']) && $C_auth->auth_method_by_name('checkout','admin_checkoutnow')) {
$this->account_id = $VAR['account_id'];
$this->admin_view = true;
} else {
$this->account_id=SESS_ACCOUNT;
}
# Set account options && seed VAR with defaults
if (empty($VAR['detailsnocopy'])) {
$acct = $db->Execute(sqlSelect($db,'account','first_name,last_name,address1,address2,city,state,zip,country_id,email,company',array('id'=>$this->account_id)));
if ($acct && $acct->RecordCount())
foreach ($acct->fields as $key=>$val)
if(!is_numeric($key) && empty($VAR[$key]))
$VAR[$key]=stripslashes($acct->fields[$key]);
}
$C_vars->strip_slashes_all();
$smarty->assign('VAR',$VAR);
$smarty->assign('plugin_template','checkout_plugin:plugin_ord_'.$rs->fields['checkout_plugin']);
}
function add($VAR) {
$this->checkout_construct();
$type = "add";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->add($VAR, $this, $type);
}
public function tpl_get_plugindata($VAR) {
global $smarty;
function view($VAR) {
$this->checkout_construct();
$type = "view";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->view($VAR, $this, $type);
}
function update($VAR) {
$this->checkout_construct();
$type = "update";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->update($VAR, $this, $type);
}
function delete($VAR) {
$this->checkout_construct();
$db = new CORE_database;
$db->mass_delete($VAR, $this, "");
}
function search($VAR) {
$this->checkout_construct();
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search($VAR, $this, $type);
}
function search_show($VAR) {
$this->checkout_construct();
$type = "search";
$this->method["$type"] = explode(",", $this->method["$type"]);
$db = new CORE_database;
$db->search_show($VAR, $this, $type);
}
function checkout_construct() {
$this->module = "checkout";
$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
$C_xml = new CORE_xml;
$construct = $C_xml->xml_to_array($this->xml_construct);
$this->method = $construct["construct"]["method"];
$this->trigger = $construct["construct"]["trigger"];
$this->field = $construct["construct"]["field"];
$this->table = $construct["construct"]["table"];
$this->module = $construct["construct"]["module"];
$this->cache = $construct["construct"]["cache"];
$this->order_by = $construct["construct"]["order_by"];
$this->limit = $construct["construct"]["limit"];
# Normal checkout
$db = &DB();
$rs = $db->Execute(sqlSelect($db,'checkout','plugin_data',array('id'=>$VAR['checkout_id'])));
if ($rs || $rs->RecordCount() == 1)
$smarty->assign('plugin_data',$rs->fields['plugin_data']);
}
}
?>
?>

View File

@@ -1,140 +1,178 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<!-- define the module name -->
<module>checkout</module>
<!-- define the module table name -->
<table>checkout</table>
<!-- define the module dependancy(s) -->
<dependancy/>
<!-- define the DB cache in seconds -->
<cache>0</cache>
<!-- define the default order_by field for SQL queries -->
<order_by>name</order_by>
<!-- define the methods -->
<limit>25</limit>
<!-- define the fields -->
<field>
<id>
<type>I4</type>
<unique>1</unique>
<index>1</index>
</id>
<site_id>
<type>I4</type>
<index>1</index>
</site_id>
<name>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</name>
<description>
<type>C(255)</type>
</description>
<active>
<type>L</type>
</active>
<checkout_plugin>
<type>C(32)</type>
<validate>any</validate>
</checkout_plugin>
<plugin_data>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</plugin_data>
<allow_recurring>
<type>L</type>
</allow_recurring>
<allow_new>
<type>L</type>
</allow_new>
<allow_trial>
<type>L</type>
</allow_trial>
<total_minimum>
<type>F</type>
</total_minimum>
<total_maximum>
<type>F</type>
</total_maximum>
<max_decline_attempts>
<type>I4</type>
</max_decline_attempts>
<manual_approval_all>
<type>L</type>
</manual_approval_all>
<manual_approval_recur>
<type>L</type>
</manual_approval_recur>
<manual_approval_country>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_country>
<manual_approval_group>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_group>
<manual_approval_amount>
<type>F</type>
</manual_approval_amount>
<manual_approval_currency>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_currency>
<default_when_currency>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_currency>
<default_when_country>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_country>
<default_when_group>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_group>
<default_when_amount>
<type>F</type>
</default_when_amount>
<allowed_currencies>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
<validate>any</validate>
</allowed_currencies>
<email_template>
<type>X2</type>
</email_template>
<required_groups>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</required_groups>
<excluded_products>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</excluded_products>
<graphic_url>
<type>C(128)</type>
</graphic_url>
</field>
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
<method>
<add>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</add>
<update>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</update>
<delete>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,excluded_products,required_groups</delete>
<view>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</view>
<search>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups</search>
</method>
<!-- define the method triggers -->
<trigger>0</trigger>
<!-- Module name -->
<module>checkout</module>
<!-- Module supporting database table -->
<table>checkout</table>
<!-- Module dependancy(s) (module wont install if these modules are not yet installed) -->
<dependancy></dependancy>
<!-- DB cache in seconds -->
<cache>15</cache>
<!-- Default order_by field for SQL queries -->
<order_by>name</order_by>
<!-- Default SQL limit for SQL queries -->
<limit>25</limit>
<!-- Schema version (used to determine if the schema has change during upgrades) -->
<version>1</version>
<!-- Database indexes -->
<index>
</index>
<!-- Database fields -->
<field>
<!-- Record ID -->
<id>
<index>1</index>
<type>I4</type>
<unique>1</unique>
</id>
<!-- Site ID -->
<site_id>
<index>1</index>
<type>I4</type>
</site_id>
<!-- Record active (BOOL)-->
<active>
<display>Active</display>
<type>L</type>
</active>
<name>
<type>C(32)</type>
<min_len>1</min_len>
<max_len>32</max_len>
<validate>any</validate>
</name>
<description>
<type>C(255)</type>
</description>
<checkout_plugin>
<type>C(32)</type>
<validate>any</validate>
</checkout_plugin>
<plugin_data>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</plugin_data>
<allow_recurring>
<type>L</type>
</allow_recurring>
<allow_new>
<type>L</type>
</allow_new>
<allow_trial>
<type>L</type>
</allow_trial>
<total_minimum>
<type>F</type>
</total_minimum>
<total_maximum>
<type>F</type>
</total_maximum>
<max_decline_attempts>
<type>I4</type>
</max_decline_attempts>
<manual_approval_all>
<type>L</type>
</manual_approval_all>
<manual_approval_recur>
<type>L</type>
</manual_approval_recur>
<manual_approval_country>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_country>
<manual_approval_group>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_group>
<manual_approval_amount>
<type>F</type>
</manual_approval_amount>
<manual_approval_currency>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</manual_approval_currency>
<default_when_currency>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_currency>
<default_when_country>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_country>
<default_when_group>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</default_when_group>
<default_when_amount>
<type>F</type>
</default_when_amount>
<allowed_currencies>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
<validate>any</validate>
</allowed_currencies>
<email_template>
<type>X2</type>
</email_template>
<required_groups>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</required_groups>
<excluded_products>
<type>X2</type>
<convert>array</convert>
<arr_force>1</arr_force>
</excluded_products>
<graphic_url>
<type>C(128)</type>
</graphic_url>
</field>
<!-- Methods for this class, and the fields they have access to, if applicable -->
<method>
<add>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</add>
<update>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</update>
<delete>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,excluded_products,required_groups</delete>
<view>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups,graphic_url</view>
<search>id,site_id,name,description,active,checkout_plugin,plugin_data,allow_recurring,allow_new,allow_trial,total_minimum,total_maximum,max_decline_attempts,manual_approval_all,manual_approval_recur,manual_approval_country,manual_approval_group,manual_approval_amount,manual_approval_currency,default_when_currency,default_when_country,default_when_group,default_when_amount,allowed_currencies,email_template,excluded_products,required_groups</search>
</method>
<!-- Method triggers -->
<trigger></trigger>
<!-- Template page display titles -->
<title></title>
<!-- Template helpers -->
<tpl>
<search_show>
<checkbox>
<field>id</field>
<type>checkbox</type>
<width>25px</width>
</checkbox>
<name>
<field>name</field>
</name>
<checkout_plugin>
<field>checkout_plugin</field>
</checkout_plugin>
<icon>
<field>active</field>
<type>bool_icon</type>
<width>20px</width>
</icon>
</search_show>
</tpl>
</construct>

View File

@@ -1,45 +1,68 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<install>
<!-- Tree Menu Module Properties -->
<module_properties>
<name>checkout</name>
<parent>setup</parent>
<notes><![CDATA[This module controls the various checkout options and plugins.]]></notes>
<!-- MODULE Dependancy, this module wont be installed if the dependant modules dont exist -->
<dependancy></dependancy>
<!-- Translated display to use on the tree -->
<display>Checkout</display>
<!-- Display a module in the menu tree -->
<menu_display>1</menu_display>
<!-- MODULE Name -->
<name>checkout</name>
<!-- MODULE Notes, these notes show up in the modules table, as a description of the module -->
<notes><![CDATA[This module controls the various checkout options and plugins.]]></notes>
<!-- MODULE Parent, the parent node in the tree -->
<parent>setup</parent>
<!-- SUB Modules to install with this one -->
<sub_modules></sub_modules>
<!-- MODULE Type (core|base), core modules cannot be deleted, unrecognised types are ignored. -->
<type></type>
</module_properties>
<sql_inserts>
<module_method>
<search_form>
<name>search_form</name>
</search_form>
<search>
<name>search</name>
</search>
<view>
<name>view</name>
<page><![CDATA[core:search&module=%%&_escape=1]]></page>
<menu_display>1</menu_display>
</view>
<delete>
<name>delete</name>
</delete>
<add>
<name>add</name>
<menu_display>1</menu_display>
</add>
<update>
<name>update</name>
</update>
<search_show>
<name>search_show</name>
</search_show>
<admin_checkoutnow>
<name>admin_checkoutnow</name>
</admin_checkoutnow>
<admin_adddiscount>
<name>admin_adddiscount</name>
</admin_adddiscount>
<admin_preview>
<name>admin_preview</name>
</admin_preview>
</module_method>
</sql_inserts>
</install>
<!-- Tree Menu & Module Methods to load, they will be assigned the group permissions on install time, as selected by the user. -->
<module_method>
<add>
<display>Add</display>
<menu_display>1</menu_display>
<name>add</name>
<notes><![CDATA[Add records]]></notes>
</add>
<delete>
<name>delete</name>
<notes><![CDATA[Delete records]]></notes>
</delete>
<search>
<display>List</display>
<menu_display>1</menu_display>
<name>search</name>
<notes><![CDATA[List records]]></notes>
<page><![CDATA[core:search&module=%%&_next_page_one=view]]></page>
</search>
<search_form>
<name>search_form</name>
<notes><![CDATA[Search for records]]></notes>
</search_form>
<search_show>
<name>search_show</name>
<notes><![CDATA[Show the results of a search]]></notes>
</search_show>
<update>
<name>update</name>
<notes><![CDATA[Update a record]]></notes>
</update>
<view>
<name>view</name>
<notes><![CDATA[View a record]]></notes>
</view>
<admin_checkoutnow>
<name>admin_checkoutnow</name>
</admin_checkoutnow>
<admin_adddiscount>
<name>admin_adddiscount</name>
</admin_adddiscount>
<admin_preview>
<name>admin_preview</name>
</admin_preview>
</module_method>
</install>