Initial Commit of AgileBill Open Source

This commit is contained in:
unknown
2008-11-26 14:50:40 -08:00
parent ae5a0fc25e
commit 02306ccc47
2954 changed files with 410976 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<construct>
<!-- define the module name -->
<module>charge</module>
<!-- define the module table name -->
<table>charge</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>date_orig</order_by>
<!-- define the methods -->
<limit>35</limit>
<!-- define the fields -->
<field>
<id>
<type>I8</type>
<unique>1</unique>
</id>
<site_id>
<type>I4</type>
</site_id>
<date_orig>
<type>I8</type>
</date_orig>
<status>
<type>L</type>
<index>1</index>
</status>
<sweep_type>
<type>I4</type>
</sweep_type>
<account_id>
<type>I8</type>
<asso_table>account</asso_table>
<asso_field>username</asso_field>
<validate>any</validate>
</account_id>
<product_id>
<type>I4</type>
<asso_table>product</asso_table>
<asso_field>sku</asso_field>
</product_id>
<service_id>
<type>I4</type>
</service_id>
<amount>
<type>F</type>
<validate>float</validate>
</amount>
<quantity>
<type>F</type>
<validate>float</validate>
</quantity>
<taxable>
<type>L</type>
</taxable>
<attributes>
<type>X2</type>
</attributes>
<description>
<type>C(32)</type>
</description>
</field>
<!-- define all the methods for this class, and the fields they have access to, if applicable. -->
<method>
<add>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</add>
<search_export>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</search_export>
<update>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</update>
<export_excel>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</export_excel>
<delete>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</delete>
<export_xml>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</export_xml>
<view>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</view>
<export_tab>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</export_tab>
<search>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</search>
<export_csv>id,site_id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</export_csv>
<import>id,date_orig,status,sweep_type,account_id,product_id,service_id,amount,quantity,taxable,attributes</import>
</method>
<!-- define database indexes -->
<index>
<sweep_type>sweep_type,status</sweep_type>
<service_id>account_id,service_id</service_id>
<sss>site_id,service_id,status</sss>
</index>
<!-- define the method triggers -->
<trigger>0</trigger>
</construct>

View File

@@ -0,0 +1,62 @@
<install>
<module_properties>
<name>charge</name>
<parent>account_admin</parent>
<notes><![CDATA[Stores incremental charges to be swept into a new invoice on a specified schedule]]></notes>
<menu_display>1</menu_display>
</module_properties>
<sql_inserts>
<module_method>
<add>
<name>add</name>
<page><![CDATA[%%:add]]></page>
<menu_display>1</menu_display>
</add>
<search_export>
<name>search_export</name>
</search_export>
<update>
<name>update</name>
</update>
<export_excel>
<name>export_excel</name>
</export_excel>
<delete>
<name>delete</name>
</delete>
<export_xml>
<name>export_xml</name>
</export_xml>
<view>
<name>view</name>
<page><![CDATA[core:search&module=%%&_escape=1]]></page>
<menu_display>1</menu_display>
</view>
<export_tab>
<name>export_tab</name>
</export_tab>
<search>
<name>search</name>
<page><![CDATA[%%:search_form]]></page>
<menu_display>1</menu_display>
</search>
<search_form>
<name>search_form</name>
</search_form>
<search_show>
<name>search_show</name>
</search_show>
<export_csv>
<name>export_csv</name>
</export_csv>
<import>
<name>import</name>
<page><![CDATA[core:import&module=%%]]></page>
<menu_display>1</menu_display>
</import>
<api>
<name>api</name>
</api>
</module_method>
</sql_inserts>
</install>

84
modules/charge/xmlrpc.php Normal file
View File

@@ -0,0 +1,84 @@
<?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/
*
* @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>
* @package AgileBill
* @version 1.4.93
*/
include_once('../../config.inc.php');
require_once(PATH_ADODB . 'adodb.inc.php');
require_once(PATH_CORE . 'database.inc.php');
require_once(PATH_CORE . 'setup.inc.php');
require_once(PATH_CORE . 'vars.inc.php');
include_once(PATH_INCLUDES.'xml-rpc/xml-rpc.php');
include_once(PATH_MODULES .'charge/charge.inc.php');
$C_debug = new CORE_debugger;
$C_vars = new CORE_vars;
$VAR = $C_vars->f;
$C_db = &DB();
$C_setup = new CORE_setup;
class ChargeServer extends IXR_Server {
var $account_id;
var $username;
var $password;
function ChargeServer() {
$this->IXR_Server(array(
'charge.add' => 'this:add'
));
}
function add($args) {
$this->username = $args[0];
$this->password = $args[1];
if(!$this->validate()) return array('status'=>false, 'charge_id'=>false, 'error'=> "Authentication failed");
@$var['account_id'] = $args[2];
@$var['service_id'] = $args[3];
@$var['amount'] = $args[4];
@$var['sweep_type'] = $args[5];
@$var['taxable'] = $args[6];
@$var['quantity'] = $args[7];
@$var['product_id'] = $args[8];
@$var['description'] = $args[9];
@$var['attributes'] = $args[10];
$charge = new charge;
$charge->xmlrpc=true;
$ret = $charge->api($var, $charge);
return $ret;
}
function validate() {
if(empty($this->username) || empty($this->password)) return false;
$p=AGILE_DB_PREFIX;
$s=DEFAULT_SITE;
$db=&DB();
$sql = "SELECT DISTINCT A.id,A.username FROM {$p}account as A, {$p}account_group as AG
WHERE A.username=".$db->qstr($this->username)." AND A.password=MD5(".$db->qstr($this->password).")
AND A.status=1 AND AG.account_id = A.id AND A.site_id={$s} AND AG.site_id={$s}
AND AG.group_id in ( SELECT DISTINCT GM.group_id FROM _group_method GM JOIN {$p}module M on (M.name='charge' and M.site_id={$s}) JOIN {$p}module_method MM on (MM.name='api' AND MM.module_id=M.id and MM.site_id={$s}))";
$rs=$db->Execute($sql);
if(!$rs || !$rs->RecordCount()) return false;
else return true;
}
}
$server = new ChargeServer();
?>