本文整理汇总了PHP中number_empty函数的典型用法代码示例。如果您正苦于以下问题:PHP number_empty函数的具体用法?PHP number_empty怎么用?PHP number_empty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了number_empty函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkRequired
/**
* Check for null or zero for list of values
* @param $prefix the prefix of value to be checked
* @param $required array of value to be checked
* @return boolean true if all values are set in the array
*/
function checkRequired($prefix, $required)
{
foreach ($required as $key) {
if (!isset($_POST[$prefix . $key]) || number_empty($_POST[$prefix . $key])) {
return false;
}
}
return true;
}
示例2: perform_save
function perform_save(&$focus)
{
//US DOLLAR
if (isset($focus->amount) && !number_empty($focus->amount)) {
$currency = new Currency();
$currency->retrieve($focus->currency_id);
$focus->amount_usdollar = $currency->convertToDollar($focus->amount);
}
}
示例3: perform_save
function perform_save(&$focus)
{
require_once 'modules/Currencies/Currency.php';
//US DOLLAR
if (isset($focus->price) && !number_empty($focus->price)) {
$currency = new Currency();
$currency->retrieve($focus->currency_id);
$focus->price_usdollar = $currency->convertToDollar(unformat_number($focus->price));
}
}
示例4: save
function save($check_notify = FALSE)
{
//"amount_usdollar" is really amount_basecurrency. We need to save a copy of the amount in the base currency.
if (isset($this->amount) && !number_empty($this->amount)) {
//$currency = new Currency();
//$currency->retrieve($this->currency_id);
//$this->amount_usdollar = $currency->convertToDollar($this->amount);
$this->amount_usdollar = $this->amount;
}
return parent::save($check_notify);
}
示例5: perform_aos_save
/**
* Products, Quotations & Invoices modules.
* Extensions to SugarCRM
* @package Advanced OpenSales for SugarCRM
* @subpackage Products
* @copyright SalesAgility Ltd http://www.salesagility.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with this program; if not, see http://www.gnu.org/licenses
* or write to the Free Software Foundation,Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Salesagility Ltd <info@salesagility.com>
*/
function perform_aos_save($focus)
{
foreach ($focus->field_defs as $field) {
$fieldName = $field['name'];
$fieldNameDollar = $field['name'] . '_usdollar';
if (isset($focus->field_defs[$fieldNameDollar])) {
$focus->{$fieldNameDollar} = '';
if (!number_empty($focus->field_defs[$field['name']])) {
$currency = new Currency();
$currency->retrieve($focus->currency_id);
$focus->{$fieldNameDollar} = $currency->convertToDollar(unformat_number($fieldName));
}
}
}
}
示例6: perform_aos_save
/**
* Products, Quotations & Invoices modules.
* Extensions to SugarCRM
* @package Advanced OpenSales for SugarCRM
* @subpackage Products
* @copyright SalesAgility Ltd http://www.salesagility.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with this program; if not, see http://www.gnu.org/licenses
* or write to the Free Software Foundation,Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA
*
* @author Salesagility Ltd <info@salesagility.com>
*/
function perform_aos_save($focus)
{
//US DOLLAR
foreach ($focus->field_defs as $field) {
if (isset($focus->field_defs[$field['name'] . '_usdollar'])) {
$fieldName = $field['name'] . '_usdollar';
$focus->{$fieldName} = '';
if (!number_empty($focus->field_defs[$field['name']])) {
$currency = new Currency();
$currency->retrieve($focus->currency_id);
$focus->{$fieldName} = $currency->convertToDollar($focus->{$field}['name']);
}
}
}
}
示例7: perform_save
/**
* @param Opportunity $focus The Current Opportunity we are working with
*/
function perform_save($focus)
{
global $app_list_strings, $timedate, $current_language;
$app_list_strings = return_app_list_strings_language($current_language);
/* @var $admin Administration */
$admin = BeanFactory::getBean('Administration');
$settings = $admin->getConfigForModule('Forecasts');
// if any of the case fields are NULL or an empty string set it to the amount from the main opportunity
if (is_null($focus->best_case) || strval($focus->best_case) === "") {
$focus->best_case = $focus->amount;
}
if (is_null($focus->worst_case) || strval($focus->worst_case) === "") {
$focus->worst_case = $focus->amount;
}
// Bug49495: amount may be a calculated field
$focus->updateCalculatedFields();
//Store the base currency value
if (isset($focus->amount) && !number_empty($focus->amount)) {
$focus->amount_usdollar = SugarCurrency::convertWithRate($focus->amount, $focus->base_rate);
}
}
示例8: testNumberEmpty
public function testNumberEmpty()
{
$num1 = 0;
$num2 = '0';
$num3 = -1;
$num4 = 'true';
$num5 = 'false';
$num6 = false;
$num7 = 10;
$num8 = '10';
$num9 = '';
$this->assertEquals(false, number_empty($num1), "Found 0 to be empty");
$this->assertEquals(false, number_empty($num2), "Found '0' to be empty");
$this->assertEquals(false, number_empty($num3), "Found -1 to be empty");
$this->assertEquals(false, number_empty($num4), "Found 'true' to be empty");
$this->assertEquals(false, number_empty($num5), "Found 'false' to be empty");
$this->assertEquals(false, number_empty($num6), "Found false to be empty");
$this->assertEquals(false, number_empty($num7), "Found 10 to be empty");
$this->assertEquals(false, number_empty($num8), "Found '10' to be empty");
$this->assertEquals(true, number_empty($num9), "Did not find empty string to be empty");
}