Initial Commit of AgileBill Open Source
This commit is contained in:
133
modules/voip_rate_prod/voip_rate_prod.inc.php
Normal file
133
modules/voip_rate_prod/voip_rate_prod.inc.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?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> and Thralling Penguin, LLC <http://www.thrallingpenguin.com>
|
||||
* @package AgileBill
|
||||
* @version 1.4.93
|
||||
*/
|
||||
|
||||
class voip_rate_prod
|
||||
{
|
||||
|
||||
# Open the constructor for this mod
|
||||
function voip_rate_prod()
|
||||
{
|
||||
# name of this module:
|
||||
$this->module = "voip_rate_prod";
|
||||
|
||||
# location of the construct XML file:
|
||||
$this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml";
|
||||
|
||||
# open the construct file for parsing
|
||||
$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"];
|
||||
}
|
||||
|
||||
##############################
|
||||
## ADD ##
|
||||
##############################
|
||||
function add($VAR)
|
||||
{
|
||||
// check this is not a duplicate for the selected product/voip_rate record combo
|
||||
$product_id = $VAR['voip_rate_prod_product_id'];
|
||||
$voip_rate_id = $VAR['voip_rate_prod_voip_rate_id'];
|
||||
$db=&DB();
|
||||
$rs = $db->Execute( sqlSelect($db,'voip_rate_prod','id',"product_id = ::$product_id:: AND voip_rate_id = ::$voip_rate_id::" ));
|
||||
if($rs && $rs->RecordCount() > 0) {
|
||||
echo "<script>alert('Specified product/voip_rate combo already exists, cannot create record'); history.back();</script>";
|
||||
return false;
|
||||
}
|
||||
|
||||
$type = "add";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->add($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## VIEW ##
|
||||
##############################
|
||||
function view($VAR)
|
||||
{
|
||||
$type = "view";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->view($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## UPDATE ##
|
||||
##############################
|
||||
function update($VAR)
|
||||
{
|
||||
$type = "update";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->update($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## DELETE ##
|
||||
##############################
|
||||
function delete($VAR)
|
||||
{
|
||||
$db = new CORE_database;
|
||||
$db->mass_delete($VAR, $this, "");
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH FORM ##
|
||||
##############################
|
||||
function search_form($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_form($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH ##
|
||||
##############################
|
||||
function search($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search($VAR, $this, $type);
|
||||
}
|
||||
|
||||
##############################
|
||||
## SEARCH SHOW ##
|
||||
##############################
|
||||
function search_show($VAR)
|
||||
{
|
||||
$type = "search";
|
||||
$this->method["$type"] = split(",", $this->method["$type"]);
|
||||
$db = new CORE_database;
|
||||
$db->search_show($VAR, $this, $type);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
42
modules/voip_rate_prod/voip_rate_prod_construct.xml
Normal file
42
modules/voip_rate_prod/voip_rate_prod_construct.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1" ?>
|
||||
<construct>
|
||||
<module>voip_rate_prod</module>
|
||||
<table>voip_rate_prod</table>
|
||||
<dependancy>voip</dependancy>
|
||||
<cache>0</cache>
|
||||
<order_by>product_id</order_by>
|
||||
<limit>25</limit>
|
||||
<index>
|
||||
<idx>product_id,voip_rate_id</idx>
|
||||
</index>
|
||||
<field>
|
||||
<id>
|
||||
<type>I4</type>
|
||||
<unique>1</unique>
|
||||
<index>1</index>
|
||||
</id>
|
||||
<site_id>
|
||||
<type>I4</type>
|
||||
<index>1</index>
|
||||
</site_id>
|
||||
<product_id>
|
||||
<type>I4</type>
|
||||
<index>1</index>
|
||||
<asso_table>product</asso_table>
|
||||
<asso_field>sku</asso_field>
|
||||
</product_id>
|
||||
<voip_rate_id>
|
||||
<type>I4</type>
|
||||
<asso_table>voip_rate</asso_table>
|
||||
<asso_field>name</asso_field>
|
||||
</voip_rate_id>
|
||||
</field>
|
||||
<method>
|
||||
<add>id,site_id,product_id,voip_rate_id</add>
|
||||
<update>id,site_id,product_id,voip_rate_id</update>
|
||||
<delete>id,site_id,product_id,voip_rate_id</delete>
|
||||
<view>id,site_id,product_id,voip_rate_id</view>
|
||||
<search>id,site_id,product_id,voip_rate_id</search>
|
||||
</method>
|
||||
<trigger>0</trigger>
|
||||
</construct>
|
31
modules/voip_rate_prod/voip_rate_prod_install.xml
Normal file
31
modules/voip_rate_prod/voip_rate_prod_install.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<install>
|
||||
<module_properties>
|
||||
<name>voip_rate_prod</name>
|
||||
<parent>voip</parent>
|
||||
<notes><![CDATA[This module allows you to associate call rates to products]]></notes>
|
||||
<menu_display>0</menu_display>
|
||||
<dependancy>voip</dependancy>
|
||||
</module_properties>
|
||||
<sql_inserts>
|
||||
<module_method>
|
||||
<search>
|
||||
<name>search</name>
|
||||
</search>
|
||||
<view>
|
||||
<name>view</name>
|
||||
</view>
|
||||
<add>
|
||||
<name>add</name>
|
||||
</add>
|
||||
<delete>
|
||||
<name>delete</name>
|
||||
</delete>
|
||||
<update>
|
||||
<name>update</name>
|
||||
</update>
|
||||
<search_show>
|
||||
<name>search_show</name>
|
||||
</search_show>
|
||||
</module_method>
|
||||
</sql_inserts>
|
||||
</install>
|
Reference in New Issue
Block a user