Changes to AgileBill
This commit is contained in:
@@ -1,58 +1,102 @@
|
||||
<?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 Core
|
||||
*/
|
||||
|
||||
class CORE_list
|
||||
{
|
||||
var $id;
|
||||
|
||||
function menu($input_id, $name, $table, $field, $id, $class, $all=false) {
|
||||
/**
|
||||
* The main AgileBill CORE List Class
|
||||
*
|
||||
* @package AgileBill
|
||||
* @subpackage Core
|
||||
*/
|
||||
class CORE_list {
|
||||
private $id = 100;
|
||||
|
||||
/**
|
||||
* @todo deprecite this function - replace with mmenu()
|
||||
*/
|
||||
public function menu($input_id,$name,$table,$field,$default,$class,$all=false) {
|
||||
$this->mmenu($input_id,$name,$table,$field,$default,'',$class,$all);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a select list, using the values in a table
|
||||
*
|
||||
* @param string $input_id HTML id="" value.
|
||||
* + If 'no', then a hot click img wont be included
|
||||
* + If 'all', then a blank item will be included
|
||||
* @param string $name HTML name="" value.
|
||||
* @param string $table Table to query for a list of items.
|
||||
* @param string $field Column to query for a list of items.
|
||||
* @param string $default Default Value to pre-select (if it exists)
|
||||
* + If 'all', then a blank item will be included
|
||||
* @param string|array $where SQL where conditions
|
||||
* @param string $class CSS class for the select list
|
||||
* @param bool $all If true, then a blank item will be included.
|
||||
*
|
||||
* @todo Remove the many ways of selecting all
|
||||
*/
|
||||
public function mmenu($input_id,$name,$table,$field,$default,$where,$class,$all=false) {
|
||||
global $C_translate;
|
||||
if($all == true || $id == 'all') $all = true;
|
||||
if(!isset($this->id)) $this->id = 100;
|
||||
if($input_id <= 0 && $input_id != 'no') $input_id = $this->id++;
|
||||
|
||||
$noicon = false;
|
||||
|
||||
if ($input_id == 'no') {
|
||||
$input_id = '';
|
||||
$noicon = true;
|
||||
}
|
||||
|
||||
if (! $input_id)
|
||||
$input_id = sprintf('%s_%s_%s',$table,$field,$this->id++);
|
||||
|
||||
$db = &DB();
|
||||
$sql= "SELECT id, $field FROM ".AGILE_DB_PREFIX."$table WHERE site_id = '" . DEFAULT_SITE . "' ORDER BY $field";
|
||||
$result = $db->Execute($sql);
|
||||
if ($result === false)
|
||||
{
|
||||
$result = $db->Execute(sqlSelect($db,$table,sprintf('id,%s',$field),$where,$field));
|
||||
if ($result === false) {
|
||||
global $C_debug;
|
||||
$C_debug->error('list.inc.php','menu', $db->ErrorMsg());
|
||||
|
||||
$C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg());
|
||||
|
||||
} else {
|
||||
$return = '<select id="'. $field .'_'. $input_id .'" name="'. $name .'" class="'.$class.'">';
|
||||
if($all)
|
||||
$return .= '<option value=""></option>';
|
||||
$return = sprintf('<select id="%s" name="%s" class="%s">',$input_id,$name,$class);
|
||||
|
||||
if ($all)
|
||||
$return .= '<option value=""> </option>';
|
||||
|
||||
$i = 0;
|
||||
while (!$result->EOF) {
|
||||
$return .= '<option value="' . $result->fields["id"] . '"';
|
||||
if($id == $result->fields["id"])
|
||||
$return .= "selected";
|
||||
$return .= '>' . $result->fields["$field"] . '</option>
|
||||
';
|
||||
$i++;
|
||||
while (! $result->EOF) {
|
||||
$return .= sprintf('<option value="%s"%s>%s</option>',$result->fields['id'],($default == $result->fields['id']) ? ' selected="selected"' : '',$result->fields[$field]);
|
||||
$result->MoveNext();
|
||||
|
||||
$i++;
|
||||
}
|
||||
if($i==0)
|
||||
$return .= '<option value="">'. $C_translate->translate('lists_none_defined','CORE','').'</option>';
|
||||
|
||||
$return .= '</select>';
|
||||
if($i > 0 && $input_id != 'no')
|
||||
$return .= ' <img src="themes/' . THEME_NAME . '/images/icons/zoomi_16.gif" border="0" width="16" height="16" onclick="menu_item_view(\''.$table.'\',\''.$field .'_'.$input_id.'\');">';
|
||||
|
||||
if ($i==0)
|
||||
$return = $C_translate->translate('lists_none_defined');
|
||||
|
||||
if ($i > 0 && ! $noicon)
|
||||
$return .= sprintf(' <img src="themes/%s/images/icons/zoomi_16.gif" alt="Zoom" width="16" height="16" style="border: 0px;" onclick="menu_item_view(\'%s\',\'%s\');"/>',THEME_NAME,$table,$input_id);
|
||||
|
||||
echo $return;
|
||||
}
|
||||
}
|
||||
@@ -66,25 +110,190 @@ class CORE_list
|
||||
include_once(PATH_MODULES . 'account_billing/account_billing.inc.php');
|
||||
$acct_bill = new account_billing;
|
||||
echo $acct_bill->menu_admin($field, $account, $default, $class, $user);
|
||||
}
|
||||
}
|
||||
|
||||
function menu_multi($default, $name, $table, $field, $id, $max, $class) {
|
||||
include_once(PATH_CORE . 'list_menu_multi.inc.php');
|
||||
echo list_menu_multi($default, $name, $table, $field, $id, $max, $class);
|
||||
include_once(PATH_CORE.'list_menu_multi.inc.php');
|
||||
echo list_menu_multi($default, $name, $table, $field, $id, $max, $class);
|
||||
}
|
||||
|
||||
function menu_files($id, $name, $default, $path, $pre, $ext, $class) {
|
||||
include_once(PATH_CORE . 'list_menu_files.inc.php');
|
||||
include_once(PATH_CORE.'list_menu_files.inc.php');
|
||||
echo list_menu_files($id, $name, $default, $path, $pre, $ext, $class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a list of frequently used selections in OSB
|
||||
*
|
||||
* @param string $type List type
|
||||
* @param string $input_id HTML id="" value.
|
||||
* @param string $name HTML name="" value.
|
||||
* @param string $default Default Value to pre-select (if it exists)
|
||||
* @param string $class CSS class for the select list
|
||||
* @param bool $all If true, then a blank item will be included.
|
||||
*/
|
||||
public function menu_staticlist($type,$input_id,$name,$default,$class,$all=false) {
|
||||
global $C_list;
|
||||
|
||||
# Whether the values are also keys.
|
||||
$nokeys = false;
|
||||
$list = array();
|
||||
|
||||
switch ($type) {
|
||||
case 'assoc_grant_type':
|
||||
$list = array(0=>_('Grant access for specified amount of days'),1=>_('Grant access while associated subscription is active'),2=>_('Grant access forerver'));
|
||||
break;
|
||||
|
||||
case 'assoc_prod_type':
|
||||
$list = array(0=>_('Require All Selected Products'),1=>_('Require Any One Selected Product'));
|
||||
break;
|
||||
|
||||
case 'charge_sweep':
|
||||
$list = array(0=>_('Daily'),1=>_('Weekly'),2=>_('Monthly'),3=>_('Quarterly'),4=>_('Semi-Annually'),5=>_('Annually'),6=>_('Service Rebill'));
|
||||
break;
|
||||
|
||||
case 'commissiontype':
|
||||
$list = array(0=>_('None'),1=>_('Percentage Based'),2=>('Flat Rate'));
|
||||
break;
|
||||
|
||||
# @todo To deprecate this and standardise with commissiontype
|
||||
case 'discounttype':
|
||||
$list = array(0=>_('Percentage Based'),1=>('Flat Rate'));
|
||||
break;
|
||||
|
||||
case 'copluginmode':
|
||||
$list = array(0=>_('Test'),1=>_('Live'));
|
||||
break;
|
||||
|
||||
case 'domaintype':
|
||||
$list = array(
|
||||
'register'=>_('Register'),
|
||||
'transfer'=>_('Transfer'),
|
||||
'park'=>_('Park')
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'email_piping':
|
||||
$list = array(0=>' ',1=>'POP',2=>'IMAP');
|
||||
break;
|
||||
|
||||
case 'email_piping_action':
|
||||
$list = array(0=>_('Leave message in mailbox'),1=>_('Delete message from mailbox'));
|
||||
break;
|
||||
|
||||
case 'invoice_delivery':
|
||||
$list = array(0=>_('None'),1=>_('E-Mail'),2=>_('Print'));
|
||||
break;
|
||||
|
||||
case 'invoice_show_itemized':
|
||||
$list = array(0=>_('Overview Only'),1=>_('Full Detail'));
|
||||
break;
|
||||
|
||||
case 'nametitle':
|
||||
$list = array(_('Mr'),_('Ms'),_('Mrs'),_('Miss'),_('Dr'),_('Prof'));
|
||||
$nokeys = true;
|
||||
break;
|
||||
|
||||
case 'os':
|
||||
$list = array(0=>'Linux',1=>'Windows');
|
||||
break;
|
||||
|
||||
case 'recur_schedule':
|
||||
$list = array(0=>_('Weekly'),1=>_('Monthly'),2=>_('Quarterly'),3=>_('Semi-Annually'),4=>_('Annually'),5=>_('Two years'),6=>_('Three Years'));
|
||||
break;
|
||||
|
||||
case 'recur_type':
|
||||
$list = array(0=>_('Bill on Aniversary Date of Subscription'),1=>_('Bill on Fixed Schedule'));
|
||||
break;
|
||||
|
||||
case 'pricetype':
|
||||
$list = array(0=>_('One-time Charge'),1=>_('Recurring Membership/Subscription'),2=>_('Trial for Membership/Subscription'));
|
||||
break;
|
||||
|
||||
case 'servicetype':
|
||||
if ($C_list->is_installed('host_server')) {
|
||||
$list['host'] = _('Hosting');
|
||||
$list['host_group'] = _('Hosting & Group Access');
|
||||
$list['domain'] = _('Domain Name');
|
||||
}
|
||||
$list['none'] = _('Recurring Only');
|
||||
|
||||
break;
|
||||
|
||||
case 'servicequeue':
|
||||
$list = array(
|
||||
'new'=>_('Add New'),
|
||||
'active'=>_('Activate'),
|
||||
'inactive'=>_('Deactivate'),
|
||||
'delete'=>_('Delete'),
|
||||
'edit'=>_('Edit/Update'),
|
||||
'queue_none'=>_('None')
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'statictype':
|
||||
$list = array(
|
||||
'small_text'=>_('Small Text'),
|
||||
'medium_text'=>_('Medium Text'),
|
||||
'large_text'=>_('Large Text'),
|
||||
'dropdown_list'=>_('Dropdown List'),
|
||||
'calendar'=>_('Calendar'),
|
||||
'file_upload'=>_('File Upload'),
|
||||
'status'=>_('Status'),
|
||||
'checkbox'=>_('Checkbox'),
|
||||
'hidden'=>_('Hidden')
|
||||
);
|
||||
break;
|
||||
|
||||
case 'tasktype':
|
||||
$list = array(0=>_('Internal Method'),1=>_('System Call'));
|
||||
break;
|
||||
|
||||
case 'trial_length':
|
||||
$list = array(0=>_('Days'),1=>_('Weeks'),2=>_('Months'));
|
||||
break;
|
||||
|
||||
default: return sprintf('Unknown staticlist: %s',$type);
|
||||
}
|
||||
|
||||
# If id is blank, we'll just return the value
|
||||
if (! $input_id)
|
||||
return $list[$default];
|
||||
|
||||
$return = sprintf('<select id="%s" name="%s" class="%s">',$input_id,$name,$class);
|
||||
|
||||
if ($all)
|
||||
$return .= '<option value=""> </option>';
|
||||
|
||||
foreach ($list as $element => $details) {
|
||||
$selected = '';
|
||||
|
||||
if ($nokeys) {
|
||||
if ($default == $details)
|
||||
$selected = ' selected="selected"';
|
||||
|
||||
} else {
|
||||
if ($default == $element)
|
||||
$selected = ' selected="selected"';
|
||||
}
|
||||
|
||||
$return .= sprintf('<option value="%s"%s>%s</option>',$nokeys ? $details : $element,$selected,$details);
|
||||
}
|
||||
|
||||
$return .= '</select>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function format_currency ($number, $currency_id) {
|
||||
if(empty($number)) $number = 0;
|
||||
if(empty($number)) $number = 0;
|
||||
if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY;
|
||||
if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id);
|
||||
if($currency_id != DEFAULT_CURRENCY)
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY]))
|
||||
$this->currency(DEFAULT_CURRENCY);
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY]))
|
||||
$this->currency(DEFAULT_CURRENCY);
|
||||
$number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"];
|
||||
if($number > .05 || $number == 0 || $number < -1)
|
||||
return $this->format_currency[$currency_id]["symbol"]
|
||||
@@ -93,33 +302,33 @@ class CORE_list
|
||||
else
|
||||
return $this->format_currency[$currency_id]["symbol"]
|
||||
. "" . number_format($number, 3) . " "
|
||||
. $this->format_currency[$currency_id]["iso"];
|
||||
. $this->format_currency[$currency_id]["iso"];
|
||||
}
|
||||
|
||||
function format_currency_num ($number, $currency_id) {
|
||||
if(empty($number)) $number = 0;
|
||||
if(empty($number)) $number = 0;
|
||||
if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY;
|
||||
if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id);
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY);
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY);
|
||||
$number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"];
|
||||
if($number > .05 || $number == 0 || $number < -1)
|
||||
return $this->format_currency[$currency_id]["symbol"] . number_format($number, DEFAULT_DECIMAL_PLACE);
|
||||
else
|
||||
return $this->format_currency[$currency_id]["symbol"] . number_format($number, 3);
|
||||
}
|
||||
return $this->format_currency[$currency_id]["symbol"] . number_format($number, 2);
|
||||
}
|
||||
|
||||
function format_currency_decimal ($number, $currency_id) {
|
||||
if(empty($number)) return 0;
|
||||
if(empty($currency_id)) $currency_id = DEFAULT_CURRENCY;
|
||||
if(!isset($this->format_currency[$currency_id])) $this->currency($currency_id);
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY);
|
||||
if(!isset($this->format_currency[DEFAULT_CURRENCY])) $this->currency(DEFAULT_CURRENCY);
|
||||
return round($number *= $this->format_currency[DEFAULT_CURRENCY]["convert"][$currency_id]["rate"], 2);
|
||||
}
|
||||
}
|
||||
|
||||
function currency_list($ret) {
|
||||
if(!isset($this->format_currency[$currency_id])) $this->currency(DEFAULT_CURRENCY);
|
||||
global $smarty;
|
||||
$smarty->assign("$ret", $this->format_currency[DEFAULT_CURRENCY]["convert"]);
|
||||
$smarty->assign("$ret", $this->format_currency[DEFAULT_CURRENCY]["convert"]);
|
||||
}
|
||||
|
||||
function currency_iso ($currency_id) {
|
||||
@@ -147,13 +356,13 @@ class CORE_list
|
||||
|
||||
function radio($input_id, $name, $table, $field, $id, $class) {
|
||||
include_once(PATH_CORE . 'list_radio.inc.php');
|
||||
echo list_radio($input_id, $name, $table, $field, $id, $class);
|
||||
}
|
||||
echo list_radio($input_id, $name, $table, $field, $id, $class);
|
||||
}
|
||||
|
||||
function check($input_id, $name, $table, $field, $default, $class) {
|
||||
include_once(PATH_CORE . 'list_check.inc.php');
|
||||
echo list_check($input_id, $name, $table, $field, $default, $class);
|
||||
}
|
||||
}
|
||||
|
||||
function select_groups($default, $field_name, $class, $size, $own_account) {
|
||||
include_once(PATH_CORE . 'list_select_groups.inc.php');
|
||||
@@ -161,46 +370,52 @@ class CORE_list
|
||||
}
|
||||
|
||||
function calender_view($field, $default, $css, $id) {
|
||||
if(isset($default) && $default != '' && $default != '0')
|
||||
if(isset($default) && $default != '' && $default != '0')
|
||||
$default = date(UNIX_DATE_FORMAT, $default);
|
||||
else
|
||||
$default = '';
|
||||
include_once(PATH_CORE.'list_calendar.inc.php');
|
||||
echo list_calender_add($field, $default, $css);
|
||||
}
|
||||
|
||||
function calender_add($field, $default, $css) {
|
||||
if($default == 'now') $default = date(UNIX_DATE_FORMAT, time());
|
||||
include_once(PATH_CORE.'list_calendar.inc.php');
|
||||
echo list_calender_add($field, $default, $css);
|
||||
echo list_calender_add($field, $default, $css,$id);
|
||||
}
|
||||
|
||||
public function calender_add($field,$default,$css,$id='') {
|
||||
if ($default == 'now')
|
||||
$default = date(UNIX_DATE_FORMAT,time());
|
||||
|
||||
include_once(PATH_CORE.'list_calendar.inc.php');
|
||||
echo list_calender_add($field,$default,$css,$id);
|
||||
}
|
||||
|
||||
# @todo Remove?
|
||||
function calender_add_static_var($field, $default, $css) {
|
||||
if($default == 'now') $default = date(UNIX_DATE_FORMAT, time());
|
||||
include_once(PATH_CORE.'list_calendar.inc.php');
|
||||
echo list_calender_add_static($field, $default, $css);
|
||||
}
|
||||
|
||||
function calender_search($field, $default, $css) {
|
||||
if($default == 'now') $default = date(UNIX_DATE_FORMAT, time());
|
||||
function calender_search($field, $default, $css) {
|
||||
if ($default == 'now')
|
||||
$default = date(UNIX_DATE_FORMAT, time());
|
||||
|
||||
echo '
|
||||
<select name="field_option['.$field.'][0]">
|
||||
<option value=">">></option>
|
||||
<option value=">">></option>
|
||||
<option value="<="><=</option>
|
||||
<option value=">=">>=</option>
|
||||
<option value="!=">!=</option>
|
||||
</select> ';
|
||||
$this->calender_view($field.'[0]', $default, $css, 1);
|
||||
echo '<BR>
|
||||
<select name="field_option['.$field.'][1]">
|
||||
<option value="<"><</option>
|
||||
<option value="<"><</option>
|
||||
<option value="<="><=</option>
|
||||
<option value=">=">>=</option>
|
||||
<option value="!=">!=</option>
|
||||
</select> ';
|
||||
$this->calender_view($field.'[1]', $default, $css, 1);
|
||||
|
||||
$this->calender_view($field,$default,$css,0);
|
||||
echo '<br/>
|
||||
<select name="field_option['.$field.'][1]">
|
||||
<option value="<"><</option>
|
||||
<option value=">">></option>
|
||||
<option value="<="><=</option>
|
||||
<option value=">=">>=</option>
|
||||
<option value="!=">!=</option>
|
||||
</select> ';
|
||||
$this->calender_view($field,$default,$css,1);
|
||||
}
|
||||
|
||||
function setup_default_date($default, $css) {
|
||||
@@ -208,19 +423,20 @@ class CORE_list
|
||||
echo list_setup_default_date($default, $css);
|
||||
}
|
||||
|
||||
function card_type_menu($default_selected, $checkout_id, $field='checkout_plugin_data[card_type]', $class) {
|
||||
function card_type_menu($default_selected, $checkout_id, $field='checkout_plugin_data[card_type]', $class,$all=false) {
|
||||
include_once(PATH_CORE . 'list_card_type_menu.inc.php');
|
||||
echo list_card_type_menu($default_selected, $checkout_id, $field, $class);
|
||||
}
|
||||
echo list_card_type_menu($default_selected, $checkout_id, $field, $class,$all);
|
||||
}
|
||||
|
||||
function date($date) {
|
||||
function date($date) {
|
||||
if($date == '') $date = time();
|
||||
return date(UNIX_DATE_FORMAT, $date);
|
||||
}
|
||||
return date(UNIX_DATE_FORMAT, $date);
|
||||
}
|
||||
|
||||
function date_time($date) {
|
||||
if($date == '') $date = time();
|
||||
$ret = date(UNIX_DATE_FORMAT, $date);
|
||||
function date_time($date) {
|
||||
if ($date == '')
|
||||
return 'UNKNOWN';
|
||||
$ret = date(UNIX_DATE_FORMAT, $date);
|
||||
$ret .= " ".date(DEFAULT_TIME_FORMAT, $date);
|
||||
return $ret;
|
||||
}
|
||||
@@ -228,7 +444,7 @@ class CORE_list
|
||||
function unserial ($data, $var) {
|
||||
global $smarty;
|
||||
if(is_string($data)) $array = unserialize($data);
|
||||
if(is_array($array)) $smarty->assign($var, $array);
|
||||
if(is_array($array)) $smarty->assign($var, $array);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,18 +453,18 @@ class CORE_list
|
||||
$sql= "SELECT id, $field FROM ".AGILE_DB_PREFIX."$table
|
||||
WHERE site_id = '" . DEFAULT_SITE . "'" . $sql . "
|
||||
ORDER BY $field";
|
||||
$result = $db->Execute($sql);
|
||||
$result = $db->Execute($sql);
|
||||
if ($result === false)
|
||||
{
|
||||
global $C_debug;
|
||||
$C_debug->error('list.inc.php','smarty_array', $db->ErrorMsg());
|
||||
$C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
while (!$result->EOF)
|
||||
{
|
||||
{
|
||||
$smart[] = $result->fields;
|
||||
$result->MoveNext();
|
||||
}
|
||||
}
|
||||
global $smarty;
|
||||
$smarty->assign("$return", $smart);
|
||||
return true;
|
||||
@@ -261,11 +477,11 @@ class CORE_list
|
||||
WHERE site_id = " . $db->qstr(DEFAULT_SITE) . " AND
|
||||
language_id = " . $db->qstr(SESS_LANGUAGE). " AND " .
|
||||
$field2 . " = " . $db->qstr($id);
|
||||
$result = $db->Execute($sql);
|
||||
$result = $db->Execute($sql);
|
||||
if ($result === false)
|
||||
{
|
||||
global $C_debug;
|
||||
$C_debug->error('list.inc.php','translate', $db->ErrorMsg());
|
||||
$C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg());
|
||||
return false;
|
||||
} else if($result->RecordCount() > 0) {
|
||||
$smarty->assign("$var", $result->fields);
|
||||
@@ -278,10 +494,10 @@ class CORE_list
|
||||
WHERE site_id = " . $db->qstr(DEFAULT_SITE) . " AND
|
||||
language_id = " . $db->qstr(DEFAULT_LANGUAGE). " AND " .
|
||||
$field2 . " = " . $db->qstr($id);
|
||||
$result = $db->Execute($sql);
|
||||
$result = $db->Execute($sql);
|
||||
if ($result === false) {
|
||||
global $C_debug;
|
||||
$C_debug->error('list.inc.php','translate', $db->ErrorMsg());
|
||||
$C_debug->error(__FILE__,__METHOD__,$db->ErrorMsg());
|
||||
return false;
|
||||
} else if($result->RecordCount() > 0) {
|
||||
$smarty->assign("$var", $result->fields);
|
||||
@@ -293,29 +509,39 @@ class CORE_list
|
||||
}
|
||||
}
|
||||
|
||||
function bool($field, $curr_value, $extra) {
|
||||
public function bool($field,$curr_value,$class='form_menu',$extra='') {
|
||||
global $C_translate;
|
||||
if($curr_value == 'all') {
|
||||
|
||||
# If the field is blank, we'll just return true/false
|
||||
if (! $field)
|
||||
return $curr_value ? $C_translate->translate('true') : $C_translate->translate('false');
|
||||
|
||||
if ($curr_value == 'all') {
|
||||
$true = '';
|
||||
$false= '';
|
||||
} else if($curr_value == "1") {
|
||||
$true = ' selected';
|
||||
|
||||
} elseif($curr_value == '1') {
|
||||
$true = ' selected="selected"';
|
||||
$false= '';
|
||||
|
||||
} else {
|
||||
$true = '';
|
||||
$false= ' selected';
|
||||
$false= ' selected="selected"';
|
||||
}
|
||||
|
||||
$return = '<select id="'.$field.'" name="'. $field .'" '.$extra.'>';
|
||||
if($curr_value == 'all')
|
||||
$return .= '<option value="" selected></option>
|
||||
';
|
||||
$return .= '<option value="1"' . $true . '>'. $C_translate->translate('true', 'CORE','') . '</option>';
|
||||
$return .= '<option value="0"' . $false . '>'. $C_translate->translate('false','CORE','') . '</option>';
|
||||
$return .= '</select>';
|
||||
$return = sprintf('<select id="%s" name="%s" class="%s" %s>',$field,$field,$class,$extra);
|
||||
|
||||
if ($curr_value == 'all')
|
||||
$return .= '<option value="" selected="selected"> </option>';
|
||||
|
||||
$return .= sprintf('<option value="1"%s>%s</option>',$true,$C_translate->translate('true'));
|
||||
$return .= sprintf('<option value="0"%s>%s</option>',$false,$C_translate->translate('false'));
|
||||
$return .= '</select>';
|
||||
|
||||
echo $return;
|
||||
}
|
||||
|
||||
// @todo this looks the same as bool()
|
||||
function bool_static_var($field, $curr_value, $class) {
|
||||
global $C_translate;
|
||||
if ($curr_value == 'all') {
|
||||
@@ -328,12 +554,12 @@ class CORE_list
|
||||
$true = ' selected';
|
||||
$false= '';
|
||||
}
|
||||
$return = '<select id="'.$field.'" name="'. $field .'">';
|
||||
$return = '<select id="'.$field.'" name="'. $field .'">';
|
||||
if($curr_value == 'all')
|
||||
$return .= '<option value="" selected></option>';
|
||||
$return .= '<option value="" selected> </option>';
|
||||
$return .= '<option value="1"' . $true . '>'. $C_translate->translate('true', 'CORE','') . '</option>';
|
||||
$return .= '<option value="0"' . $false . '>'. $C_translate->translate('false','CORE','') . '</option>';
|
||||
$return .= '</select>';
|
||||
$return .= '</select>';
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -372,7 +598,9 @@ class CORE_list
|
||||
$graph->PIE_graph($module, $method, $range, $start, $extra);
|
||||
}
|
||||
|
||||
function is_installed($module) {
|
||||
# @todo consider changing this so that it returns the .inc file if the module is installed
|
||||
# so that $a = x->is_installed('y'); require_once $a can be used
|
||||
function is_installed($module) {
|
||||
if(@$this->is_installed[$module] == true) return true;
|
||||
if($this->auth_method_by_name($module, 'search')) {
|
||||
$this->is_installed[$module] = true;
|
||||
@@ -393,15 +621,22 @@ class CORE_list
|
||||
}
|
||||
|
||||
function auth_method_by_name($module, $method) {
|
||||
global $C_auth;
|
||||
if(!is_object($C_auth)) return false;
|
||||
return $C_auth->auth_method_by_name($module, $method);
|
||||
global $C_auth;
|
||||
|
||||
if (!is_object($C_auth))
|
||||
return false;
|
||||
|
||||
return $C_auth->auth_method_by_name($module,$method);
|
||||
}
|
||||
|
||||
function generate_admin_menu() {
|
||||
/**
|
||||
* Generate the admin menu
|
||||
*/
|
||||
public function generate_admin_menu() {
|
||||
global $C_auth;
|
||||
|
||||
echo $C_auth->generate_admin_menu();
|
||||
}
|
||||
}
|
||||
|
||||
function account($field) {
|
||||
if (empty($this->account) && SESS_LOGGED) {
|
||||
@@ -413,11 +648,11 @@ class CORE_list
|
||||
$this->account = $result->fields;
|
||||
}
|
||||
echo $this->account[$field];
|
||||
}
|
||||
}
|
||||
|
||||
# Get the AgileBill version info
|
||||
function version() {
|
||||
require_once(PATH_CORE.'version.inc.php');
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
Reference in New Issue
Block a user