From 2aef89294486c1075493653755a523efd17858ea Mon Sep 17 00:00:00 2001 From: abacab Date: Mon, 29 Dec 2008 20:43:41 -0500 Subject: [PATCH] Fix notice caused by voip_prepaid:task when tables are not installed. --- modules/voip_prepaid/voip_prepaid.inc.php | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/modules/voip_prepaid/voip_prepaid.inc.php b/modules/voip_prepaid/voip_prepaid.inc.php index 4330c9e7..029e8bd2 100644 --- a/modules/voip_prepaid/voip_prepaid.inc.php +++ b/modules/voip_prepaid/voip_prepaid.inc.php @@ -27,27 +27,30 @@ class voip_prepaid $db =& DB(); $rs = $db->Execute(sqlSelect($db,"voip","prepaid_low_balance","id=::".DEFAULT_SITE."::")); - # e-mail user's once when balance reaches this amount: - $this->lowBalance = $rs->fields[0]; - $this->pinLenth = 10; // up to 10 + if ($rs && $rs->RecordCount() > 0) + { + # e-mail user's once when balance reaches this amount: + $this->lowBalance = $rs->fields[0]; + $this->pinLenth = 10; // up to 10 - # name of this module: - $this->module = "voip_prepaid"; + # name of this module: + $this->module = "voip_prepaid"; - # location of the construct XML file: - $this->xml_construct = PATH_MODULES . "" . $this->module . "/" . $this->module . "_construct.xml"; + # 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); + # 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->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"]; + $this->method = $construct["construct"]["method"]; + $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"]; + } } /** generate a new pin */ @@ -514,4 +517,4 @@ class voip_prepaid } } } -?> \ No newline at end of file +?>