function populateCurrency() { global $mod_strings; require_once 'modules/Currencies/Currency.php'; $currency = new Currency(); $currText = ''; if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($this->bean->currency_id); if ($currency->deleted != 1) { $currText = $currency->iso4217 . ' ' . $currency->symbol; } else { $currText = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol(); } } else { $currText = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol(); } $javascript = "<script language='javascript'>\n"; $javascript .= "var CurrencyText = new Array(); \n"; $javascript .= "CurrencyText['-99'] = '" . $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol() . "';\n"; $sql = "SELECT id, iso4217, symbol FROM currencies"; $res = $this->bean->db->query($sql); while ($row = $this->bean->db->fetchByAssoc($res)) { $javascript .= "CurrencyText['" . $row['id'] . "'] = '" . $row['iso4217'] . ' ' . $row['symbol'] . "';\n"; } $javascript .= "</script>"; echo $javascript; $this->ss->assign('CURRENCY', "<div id =curr_symbol>{$currText}</div>"); $mod_strings['LBL_LIST_PRICE'] .= " (" . $currText . ")"; $mod_strings['LBL_UNIT_PRICE'] .= " (" . $currText . ")"; $mod_strings['LBL_VAT_AMT'] .= " (" . $currText . ")"; $mod_strings['LBL_TOTAL_PRICE'] .= " (" . $currText . ")"; $mod_strings['LBL_SERVICE_PRICE'] .= " (" . $currText . ")"; }
function display() { $currency = new Currency(); if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($this->bean->currency_id); if ($currency->deleted != 1) { $this->ss->assign('CURRENCY', $currency->iso4217 . ' ' . $currency->symbol); } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } parent::display(); }
function populateCurrency() { require_once 'modules/Currencies/Currency.php'; $currency = new Currency(); if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($focus->currency_id); if ($currency->deleted != 1) { $this->currSymbol = $currency->symbol; } else { $this->currSymbol = $currency->getDefaultCurrencySymbol(); } } else { $this->currSymbol = $currency->getDefaultCurrencySymbol(); } }
function display() { global $app_list_strings; $this->ss->assign('APP_LIST', $app_list_strings); if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'set_target') { require_once 'modules/Campaigns/utils.php'; //call function to create campaign logs $mess = track_campaign_prospects($this->bean); $confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass(); \n window.setTimeout(\"ajax_C_LOG_Status.showStatus('" . $mess . "')\",1000); \n window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500); \n window.setTimeout(\"ajax_C_LOG_Status.showStatus('" . $mess . "')\",2000); \n window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); "; $this->ss->assign("MSG_SCRIPT", $confirm_msg); } if ($this->bean->campaign_type == 'Email' || $this->bean->campaign_type == 'NewsLetter') { $this->ss->assign("ADD_BUTTON_STATE", "submit"); $this->ss->assign("TARGET_BUTTON_STATE", "hidden"); } else { $this->ss->assign("ADD_BUTTON_STATE", "hidden"); $this->ss->assign("DISABLE_LINK", "display:none"); $this->ss->assign("TARGET_BUTTON_STATE", "submit"); } $currency = new Currency(); if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($this->bean->currency_id); if ($currency->deleted != 1) { $this->ss->assign('CURRENCY', $currency->iso4217 . ' ' . $currency->symbol); } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } parent::display(); //We want to display subset of available, panels, so we will call subpanel //object directly instead of using sugarview. $GLOBALS['focus'] = $this->bean; require_once 'include/SubPanel/SubPanelTiles.php'; $subpanel = new SubPanelTiles($this->bean, $this->module); //get available list of subpanels $alltabs = $subpanel->subpanel_definitions->get_available_tabs(); if (!empty($alltabs)) { //iterate through list, and filter out all but 3 subpanels foreach ($alltabs as $key => $name) { if ($name != 'prospectlists' && $name != 'emailmarketing' && $name != 'tracked_urls') { //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls $subpanel->subpanel_definitions->exclude_tab($name); } } //only show email marketing subpanel for email/newsletter campaigns if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter') { //exclude emailmarketing subpanel if not on an email or newsletter campaign $subpanel->subpanel_definitions->exclude_tab('emailmarketing'); // Bug #49893 - 20120120 - Captivea (ybi) - Remove trackers subpanels if not on an email/newsletter campaign (useless subpannl) $subpanel->subpanel_definitions->exclude_tab('tracked_urls'); } } //show filtered subpanel list echo $subpanel->display(); }
public function tearDown() { global $sugar_config; $this->currency_system->symbol = $this->backupSymbol; $this->currency_system->save(false); $sugar_config['default_currency_symbol'] = $this->backupSymbol; format_number(0, 0, 0, array('currency_id' => $this->currency_51568->id, 'currency_symbol' => $this->currency_51568->symbol)); format_number(0, 0, 0, array('currency_id' => -99, 'currency_symbol' => $this->currency_51568->getDefaultCurrencySymbol())); $this->currency_51568->mark_deleted($this->currency_51568->id); SugarTestHelper::tearDown(); get_number_seperators(true); }
function populateCurrency() { global $mod_strings; require_once 'modules/Currencies/Currency.php'; $currency = new Currency(); $currText = ''; if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($focus->currency_id); if ($currency->deleted != 1) { $currText = $currency->iso4217 . ' ' . $currency->symbol; } else { $currText = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol(); } } else { $currText = $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol(); } $this->ss->assign('CURRENCY', $currText); $mod_strings['LBL_LIST_PRICE'] .= " (" . $currText . ")"; $mod_strings['LBL_UNIT_PRICE'] .= " (" . $currText . ")"; $mod_strings['LBL_VAT_AMT'] .= " (" . $currText . ")"; $mod_strings['LBL_TOTAL_PRICE'] .= " (" . $currText . ")"; }
/** * Sets up the Payment settings view * @param \Cx\Core\Html\Sigma $objTemplate The optional Template, * by reference * @return boolean True on success, * false otherwise */ static function view_settings(&$objTemplate = null) { if (!$objTemplate) { $objTemplate = new \Cx\Core\Html\Sigma(); $objTemplate->loadTemplateFile('module_shop_settings_payment.html'); } else { $objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_payment.html'); } $i = 0; foreach (Payment::getArray() as $payment_id => $arrPayment) { $zone_id = Zones::getZoneIdByPaymentId($payment_id); $objTemplate->setVariable(array('SHOP_PAYMENT_STYLE' => 'row' . (++$i % 2 + 1), 'SHOP_PAYMENT_ID' => $arrPayment['id'], 'SHOP_PAYMENT_NAME' => $arrPayment['name'], 'SHOP_PAYMENT_HANDLER_MENUOPTIONS' => PaymentProcessing::getMenuoptions($arrPayment['processor_id']), 'SHOP_PAYMENT_COST' => $arrPayment['fee'], 'SHOP_PAYMENT_COST_FREE_SUM' => $arrPayment['free_from'], 'SHOP_ZONE_SELECTION' => Zones::getMenu($zone_id, "zone_id[{$payment_id}]"), 'SHOP_PAYMENT_STATUS' => intval($arrPayment['active']) ? \Html::ATTRIBUTE_CHECKED : '')); $objTemplate->parse('shopPayment'); } $objTemplate->setVariable(array('SHOP_PAYMENT_HANDLER_MENUOPTIONS_NEW' => PaymentProcessing::getMenuoptions(-1), 'SHOP_ZONE_SELECTION_NEW' => Zones::getMenu(0, 'zone_id_new'))); // Payment Service Providers $objTemplate->setVariable(array('SHOP_PAYMILL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMILL_TEST_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 0 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_LIVE_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 1 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_TEST_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_private_key', 'Shop')), 'SHOP_PAYMILL_TEST_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_public_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_private_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_public_key', 'Shop')), 'SHOP_PAYMILL_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_private_key', 'Shop')), 'SHOP_PAYMILL_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_public_key', 'Shop')), 'SHOP_SAFERPAY_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'), 'SHOP_SAFERPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_TEST_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop'), 'SHOP_SAFERPAY_TEST_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_FINALIZE_PAYMENT' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_finalize_payment', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_WINDOW_MENUOPTIONS' => \Saferpay::getWindowMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')), 'SHOP_PAYREXX_INSTANCE_NAME' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_instance_name', 'Shop'), 'SHOP_PAYREXX_API_SECRET' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_api_secret', 'Shop'), 'SHOP_PAYREXX_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_SHOP_ID' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_shop_id', 'Shop'), 'SHOP_YELLOWPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_HASH_SIGNATURE_IN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_in', 'Shop')), 'SHOP_YELLOWPAY_HASH_SIGNATURE_OUT' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Shop')), 'SHOP_YELLOWPAY_AUTHORIZATION_TYPE_OPTIONS' => \Yellowpay::getAuthorizationMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_authorization_type', 'Shop')), 'SHOP_YELLOWPAY_USE_TESTSERVER_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_WEBUSER' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_webuser', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_SIGN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_sign', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_IJUSTWANTTOTEST_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_ijustwanttotest', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_status', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_AUTHORIZATION_TYPE_OPTIONS' => \Datatrans::getReqtypeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('datatrans_request_type', 'Shop')), 'SHOP_DATATRANS_MERCHANT_ID' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_merchant_id', 'Shop'), 'SHOP_DATATRANS_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_YES_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_NO_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_PAYPAL_EMAIL' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paypal_account_email', 'Shop')), 'SHOP_PAYPAL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYPAL_DEFAULT_CURRENCY_MENUOPTIONS' => \PayPal::getAcceptedCurrencyCodeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('paypal_default_currency', 'Shop')), 'SHOP_PAYMENT_LSV_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payment_lsv_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMENT_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()))); return true; }
/** * Returns HTML code for the option menu for an Attribute * * Used in the Backend for selecting and editing. * @global array $_ARRAYLANG Language array * @param integer $attribute_id The Attribute ID * @param string $name The name and ID attribute for the * menu * @param integer $selected_id The ID of the selected option * @param string $onchange The optional Javascript onchange * event * @param string $style The optional CSS style for the menu * @return string $menu The Option menu HTML code * @static */ static function getOptionMenu($attribute_id, $name, $selected_id = 0, $onchange = '', $style = '') { global $_ARRAYLANG; $arrOptions = self::getOptionArrayByAttributeId($attribute_id); // No options, or an error occurred if (!$arrOptions) { return ''; } $menu = '<select name="' . $name . '[' . $attribute_id . '][]" ' . 'id="' . $name . '-' . $attribute_id . '" size="1"' . ($onchange ? ' onchange="' . $onchange . '"' : '') . ($style ? ' style="' . $style . '"' : '') . '>' . "\n"; foreach ($arrOptions as $option_id => $arrValue) { $menu .= '<option value="' . $option_id . '"' . ($selected_id == $option_id ? ' selected="selected"' : '') . '>' . $arrValue['value'] . ' (' . $arrValue['price'] . ' ' . Currency::getDefaultCurrencySymbol() . ')</option>' . "\n"; } $menu .= '</select><br /><a href="javascript:{}" ' . 'id="optionMenuLink-' . $attribute_id . '" ' . 'style="display: none;" ' . 'onclick="removeSelectedValues(' . $attribute_id . ')" ' . 'title="' . $_ARRAYLANG['TXT_SHOP_REMOVE_SELECTED_VALUE'] . '" ' . '>' . $_ARRAYLANG['TXT_SHOP_REMOVE_SELECTED_VALUE'] . '</a>' . "\n"; return $menu; }
if (!empty($datef)) { $sugar_smarty->assign("DATEFORMAT", $sugar_config['date_formats'][$datef]); } if (!empty($timef)) { $sugar_smarty->assign("TIMEFORMAT", $sugar_config['time_formats'][$timef]); } $num_grp_sep = $focus->getPreference('num_grp_sep'); $dec_sep = $focus->getPreference('dec_sep'); $sugar_smarty->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $sugar_config['default_number_grouping_seperator'] : $num_grp_sep); $sugar_smarty->assign("DEC_SEP", empty($dec_sep) ? $sugar_config['default_decimal_seperator'] : $dec_sep); $currency = new Currency(); if ($focus->getPreference('currency')) { $currency->retrieve($focus->getPreference('currency')); $sugar_smarty->assign("CURRENCY", $currency->iso4217 . ' ' . $currency->symbol); } else { $sugar_smarty->assign("CURRENCY", $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } $sugar_smarty->assign('CURRENCY_SIG_DIGITS', $locale->getPrecedentPreference('default_currency_significant_digits', $focus)); $sugar_smarty->assign('NAME_FORMAT', $focus->getLocaleFormatDesc()); $sugar_smarty->assign("DESCRIPTION", nl2br(url2html($focus->description))); $sugar_smarty->assign("TITLE", $focus->title); $sugar_smarty->assign("DEPARTMENT", $focus->department); $sugar_smarty->assign("REPORTS_TO_ID", $focus->reports_to_id); $sugar_smarty->assign("REPORTS_TO_NAME", $focus->reports_to_name); $sugar_smarty->assign("PHONE_HOME", $focus->phone_home); $sugar_smarty->assign("PHONE_MOBILE", $focus->phone_mobile); $sugar_smarty->assign("PHONE_WORK", $focus->phone_work); $sugar_smarty->assign("PHONE_OTHER", $focus->phone_other); $sugar_smarty->assign("PHONE_FAX", $focus->phone_fax); if (!empty($focus->employee_status)) { $sugar_smarty->assign("EMPLOYEE_STATUS", $app_list_strings['employee_status_dom'][$focus->employee_status]);
protected function setupAdvancedTabLocaleSettings() { global $locale, $sugar_config, $app_list_strings; /////////////////////////////////////////////////////////////////////////////// //// LOCALE SETTINGS //// Date/time format $dformat = $locale->getPrecedentPreference($this->bean->id ? 'datef' : 'default_date_format', $this->bean); $tformat = $locale->getPrecedentPreference($this->bean->id ? 'timef' : 'default_time_format', $this->bean); $nformat = $locale->getPrecedentPreference('default_locale_name_format', $this->bean); if (!array_key_exists($nformat, $sugar_config['name_formats'])) { $nformat = $sugar_config['default_locale_name_format']; } $timeOptions = get_select_options_with_id($sugar_config['time_formats'], $tformat); $dateOptions = get_select_options_with_id($sugar_config['date_formats'], $dformat); $nameOptions = get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $nformat); $this->ss->assign('TIMEOPTIONS', $timeOptions); $this->ss->assign('DATEOPTIONS', $dateOptions); $this->ss->assign('NAMEOPTIONS', $nameOptions); $this->ss->assign('DATEFORMAT', $sugar_config['date_formats'][$dformat]); $this->ss->assign('TIMEFORMAT', $sugar_config['time_formats'][$tformat]); $this->ss->assign('NAMEFORMAT', $sugar_config['name_formats'][$nformat]); //// Timezone if (empty($this->bean->id)) { // remove default timezone for new users(set later) $this->bean->user_preferences['timezone'] = ''; } $userTZ = $this->bean->getPreference('timezone'); if (empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) { $userTZ = TimeDate::guessTimezone(); $this->bean->setPreference('timezone', $userTZ); } if (!$this->bean->getPreference('ut')) { $this->ss->assign('PROMPTTZ', ' checked'); } $this->ss->assign('TIMEZONE_CURRENT', $userTZ); $this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList()); $this->ss->assign("TIMEZONE", TimeDate::tzName($userTZ)); // FG - Bug 4236 - Managed First Day of Week $fdowDays = array(); foreach ($app_list_strings['dom_cal_day_long'] as $d) { if ($d != "") { $fdowDays[] = $d; } } $this->ss->assign("FDOWOPTIONS", $fdowDays); $currentFDOW = $this->bean->get_first_day_of_week(); if (!isset($currentFDOW)) { $currentFDOW = 0; } $this->ss->assign("FDOWCURRENT", $currentFDOW); $this->ss->assign("FDOWDISPLAY", $fdowDays[$currentFDOW]); //// Numbers and Currency display require_once 'modules/Currencies/ListCurrency.php'; $currency = new ListCurrency(); // 10/13/2006 Collin - Changed to use Localization.getConfigPreference // This was the problem- Previously, the "-99" currency id always assumed // to be defaulted to US Dollars. However, if someone set their install to use // Euro or other type of currency then this setting would not apply as the // default because it was being overridden by US Dollars. $cur_id = $locale->getPrecedentPreference('currency', $this->bean); if ($cur_id) { $selectCurrency = $currency->getSelectOptions($cur_id); $this->ss->assign("CURRENCY", $selectCurrency); } else { $selectCurrency = $currency->getSelectOptions(); $this->ss->assign("CURRENCY", $selectCurrency); } $currencyList = array(); foreach ($locale->currencies as $id => $val) { $currencyList[$id] = $val['symbol']; } $currencySymbolJSON = json_encode($currencyList); $this->ss->assign('currencySymbolJSON', $currencySymbolJSON); $currencyDisplay = new Currency(); if (isset($cur_id)) { $currencyDisplay->retrieve($cur_id); $this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217 . ' ' . $currencyDisplay->symbol); } else { $this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217() . ' ' . $currencyDisplay->getDefaultCurrencySymbol()); } // fill significant digits dropdown $significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $this->bean); $sigDigits = ''; for ($i = 0; $i <= 6; $i++) { if ($significantDigits == $i) { $sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>"; } else { $sigDigits .= "<option value=\"{$i}\">{$i}</option>"; } } $this->ss->assign('sigDigits', $sigDigits); $this->ss->assign('CURRENCY_SIG_DIGITS', $significantDigits); $num_grp_sep = $this->bean->getPreference('num_grp_sep'); $dec_sep = $this->bean->getPreference('dec_sep'); $this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep); $this->ss->assign("DEC_SEP", empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep); $this->ss->assign('getNumberJs', $locale->getNumberJs()); //// Name display format $this->ss->assign('default_locale_name_format', $locale->getLocaleFormatMacro($this->bean)); $this->ss->assign('getNameJs', $locale->getNameJs()); $this->ss->assign('NAME_FORMAT', $this->bean->getLocaleFormatDesc()); //// END LOCALE SETTINGS }
/** * Sets up the Order statistics * @param \Cx\Core\Html\Sigma $objTemplate The optional Template, * by reference * @global ADONewConnection $objDatabase * @global array $_ARRAYLANG * @todo Rewrite the statistics in a seperate class, extending Order * @static */ static function view_statistics(&$objTemplate = null) { global $objDatabase, $_ARRAYLANG; if (!$objTemplate || !$objTemplate->blockExists('no_order')) { $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Shop/View/Template/Backend'); $objTemplate->loadTemplateFile('module_shop_statistic.html'); } $objTemplate->setGlobalVariable($_ARRAYLANG); // Get the first order date; if its empty, no order has been placed yet $time_first_order = Order::getFirstOrderTime(); if (!$time_first_order) { $objTemplate->touchBlock('no_order'); return $objTemplate; } $year_first_order = date('Y', $time_first_order); $month_first_order = date('m', $time_first_order); $start_month = $end_month = $start_year = $end_year = NULL; if (isset($_REQUEST['submitdate'])) { // A range is requested $start_month = intval($_REQUEST['startmonth']); $end_month = intval($_REQUEST['stopmonth']); $start_year = intval($_REQUEST['startyear']); $end_year = intval($_REQUEST['stopyear']); } else { // Default range to one year, or back to the first order if less $start_month = $month_first_order; $end_month = Date('m'); $start_year = $end_year = Date('Y'); if ($year_first_order < $start_year) { $start_year -= 1; if ($year_first_order < $start_year || $month_first_order < $start_month) { $start_month = $end_month; } } } $objTemplate->setVariable(array('SHOP_START_MONTH' => Shopmanager::getMonthDropdownMenu($start_month), 'SHOP_END_MONTH' => Shopmanager::getMonthDropdownMenu($end_month), 'SHOP_START_YEAR' => Shopmanager::getYearDropdownMenu($start_year, $year_first_order), 'SHOP_END_YEAR' => Shopmanager::getYearDropdownMenu($end_year, $year_first_order))); $start_date = date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME, mktime(0, 0, 0, $start_month, 1, $start_year)); // mktime() will fix the month from 13 to 01, see example 2 // on http://php.net/manual/de/function.mktime.php. // Mind that this is exclusive and only used in the queries below // so that Order date < $end_date! $end_date = date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME, mktime(0, 0, 0, $end_month + 1, 1, $end_year)); $selectedStat = isset($_REQUEST['selectstats']) ? intval($_REQUEST['selectstats']) : 0; if ($selectedStat == 2) { // Product statistic $objTemplate->setVariable(array('TXT_COLUMN_1_DESC' => $_ARRAYLANG['TXT_PRODUCT_NAME'], 'TXT_COLUMN_2_DESC' => $_ARRAYLANG['TXT_COUNT_ARTICLES'], 'TXT_COLUMN_3_DESC' => $_ARRAYLANG['TXT_STOCK'], 'SHOP_ORDERS_SELECTED' => '', 'SHOP_ARTICLES_SELECTED' => \Html::ATTRIBUTE_SELECTED, 'SHOP_CUSTOMERS_SELECTED' => '')); $arrSql = \Text::getSqlSnippets('`B`.`id`', FRONTEND_LANG_ID, 'Shop', array('title' => Product::TEXT_NAME)); $query = "\n SELECT A.product_id AS id,\n A.quantity AS shopColumn2,\n A.price AS sum,\n B.stock AS shopColumn3,\n C.currency_id, " . $arrSql['field'] . "\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_order_items AS A\n JOIN " . DBPREFIX . "module_shop" . MODULE_INDEX . "_orders AS C\n ON A.order_id=C.id\n JOIN " . DBPREFIX . "module_shop" . MODULE_INDEX . "_products AS B\n ON A.product_id=B.id" . $arrSql['join'] . "\n WHERE C.date_time>='{$start_date}'\n AND C.date_time<'{$end_date}'\n AND ( C.status=" . Order::STATUS_CONFIRMED . "\n OR C.status=" . Order::STATUS_COMPLETED . ")\n ORDER BY shopColumn2 DESC"; } elseif ($selectedStat == 3) { // Customer statistic $objTemplate->setVariable(array('TXT_COLUMN_1_DESC' => $_ARRAYLANG['TXT_NAME'], 'TXT_COLUMN_2_DESC' => $_ARRAYLANG['TXT_COMPANY'], 'TXT_COLUMN_3_DESC' => $_ARRAYLANG['TXT_COUNT_ARTICLES'], 'SHOP_ORDERS_SELECTED' => '', 'SHOP_ARTICLES_SELECTED' => '', 'SHOP_CUSTOMERS_SELECTED' => \Html::ATTRIBUTE_SELECTED)); $query = "\n SELECT A.sum AS sum,\n A.currency_id AS currency_id,\n sum(B.quantity) AS shopColumn3,\n A.customer_id AS id\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_orders AS A\n JOIN " . DBPREFIX . "module_shop" . MODULE_INDEX . "_order_items AS B\n ON A.id=B.order_id\n WHERE A.date_time>='{$start_date}'\n AND A.date_time<'{$end_date}'\n AND ( A.status=" . Order::STATUS_CONFIRMED . "\n OR A.status=" . Order::STATUS_COMPLETED . ")\n GROUP BY B.order_id\n ORDER BY sum DESC"; } else { // Order statistic (default); sales per month $objTemplate->setVariable(array('TXT_COLUMN_1_DESC' => $_ARRAYLANG['TXT_DATE'], 'TXT_COLUMN_2_DESC' => $_ARRAYLANG['TXT_COUNT_ORDERS'], 'TXT_COLUMN_3_DESC' => $_ARRAYLANG['TXT_COUNT_ARTICLES'], 'SHOP_ORDERS_SELECTED' => \Html::ATTRIBUTE_SELECTED, 'SHOP_ARTICLES_SELECTED' => '', 'SHOP_CUSTOMERS_SELECTED' => '')); $query = "\n SELECT SUM(A.quantity) AS shopColumn3,\n COUNT(A.order_id) AS shopColumn2,\n B.currency_id,\n B.sum AS sum,\n DATE_FORMAT(B.date_time, '%m') AS month,\n DATE_FORMAT(B.date_time, '%Y') AS year\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_order_items AS A,\n " . DBPREFIX . "module_shop" . MODULE_INDEX . "_orders AS B\n WHERE A.order_id=B.id\n AND B.date_time>='{$start_date}'\n AND B.date_time<'{$end_date}'\n AND ( B.status=" . Order::STATUS_CONFIRMED . "\n OR B.status=" . Order::STATUS_COMPLETED . ")\n GROUP BY B.id\n ORDER BY year DESC, month DESC"; } $arrayResults = array(); $objResult = $objDatabase->Execute($query); if (!$objResult) { return Order::errorHandler(); } $sumColumn3 = $sumColumn4 = 0; $sumColumn2 = ''; if ($selectedStat == 2) { // Product statistc while (!$objResult->EOF) { // set currency id Currency::setActiveCurrencyId($objResult->fields['currency_id']); $key = $objResult->fields['id']; if (!isset($arrayResults[$key])) { $arrayResults[$key] = array('column1' => '<a href="index.php?cmd=Shop' . MODULE_INDEX . '&act=products&tpl=manage&id=' . $objResult->fields['id'] . '" title="' . $objResult->fields['title'] . '">' . $objResult->fields['title'] . '</a>', 'column2' => 0, 'column3' => $objResult->fields['shopColumn3'], 'column4' => 0); } $arrayResults[$key]['column2'] += +$objResult->fields['shopColumn2']; $arrayResults[$key]['column4'] += +$objResult->fields['shopColumn2'] * Currency::getDefaultCurrencyPrice($objResult->fields['sum']); $objResult->MoveNext(); } if (is_array($arrayResults)) { foreach ($arrayResults as $entry) { $sumColumn2 = $sumColumn2 + $entry['column2']; $sumColumn3 = $sumColumn3 + $entry['column3']; $sumColumn4 = $sumColumn4 + $entry['column4']; } rsort($arrayResults); } } elseif ($selectedStat == 3) { // Customer statistic while (!$objResult->EOF) { Currency::setActiveCurrencyId($objResult->fields['currency_id']); $key = $objResult->fields['id']; if (!isset($arrayResults[$key])) { $objUser = \FWUser::getFWUserObject()->objUser; $objUser = $objUser->getUser($key); $company = ''; $name = $_ARRAYLANG['TXT_SHOP_CUSTOMER_NOT_FOUND']; if ($objUser) { $company = $objUser->getProfileAttribute('company'); $name = $objUser->getProfileAttribute('firstname') . ' ' . $objUser->getProfileAttribute('lastname'); } $arrayResults[$key] = array('column1' => '<a href="index.php?cmd=Shop' . MODULE_INDEX . '&act=customerdetails&customer_id=' . $objResult->fields['id'] . '">' . $name . '</a>', 'column2' => $company, 'column3' => 0, 'column4' => 0); } $arrayResults[$key]['column3'] += $objResult->fields['shopColumn3']; $arrayResults[$key]['column4'] += Currency::getDefaultCurrencyPrice($objResult->fields['sum']); $sumColumn3 += $objResult->fields['shopColumn3']; $sumColumn4 += Currency::getDefaultCurrencyPrice($objResult->fields['sum']); $objResult->MoveNext(); } } else { // Order statistic (default) $arrayMonths = explode(',', $_ARRAYLANG['TXT_MONTH_ARRAY']); while (!$objResult->EOF) { $key = $objResult->fields['year'] . '.' . $objResult->fields['month']; if (!isset($arrayResults[$key])) { $arrayResults[$key] = array('column1' => '', 'column2' => 0, 'column3' => 0, 'column4' => 0); } $arrayResults[$key]['column1'] = $arrayMonths[intval($objResult->fields['month']) - 1] . ' ' . $objResult->fields['year']; $arrayResults[$key]['column2'] = $arrayResults[$key]['column2'] + 1; $arrayResults[$key]['column3'] = $arrayResults[$key]['column3'] + $objResult->fields['shopColumn3']; $arrayResults[$key]['column4'] = $arrayResults[$key]['column4'] + Currency::getDefaultCurrencyPrice($objResult->fields['sum']); $sumColumn2 = $sumColumn2 + 1; $sumColumn3 = $sumColumn3 + $objResult->fields['shopColumn3']; $sumColumn4 = $sumColumn4 + Currency::getDefaultCurrencyPrice($objResult->fields['sum']); $objResult->MoveNext(); } krsort($arrayResults, SORT_NUMERIC); } $objTemplate->setCurrentBlock('statisticRow'); $i = 0; if (is_array($arrayResults)) { foreach ($arrayResults as $entry) { $objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_COLUMN_1' => $entry['column1'], 'SHOP_COLUMN_2' => $entry['column2'], 'SHOP_COLUMN_3' => $entry['column3'], 'SHOP_COLUMN_4' => Currency::formatPrice($entry['column4']) . ' ' . Currency::getDefaultCurrencySymbol())); $objTemplate->parse('statisticRow'); } } $query_currency = "\n SELECT currency_id, sum,\n DATE_FORMAT(date_time, '%m') AS month,\n DATE_FORMAT(date_time, '%Y') AS year\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_orders\n WHERE status=" . Order::STATUS_CONFIRMED . "\n OR status=" . Order::STATUS_COMPLETED . "\n ORDER BY date_time DESC"; $objResult = $objDatabase->Execute($query_currency); if (!$objResult) { return Order::errorHandler(); } $totalSoldProducts = 0; $query_totalproducts = "\n SELECT sum(A.quantity) AS shopTotalSoldProducts\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_order_items AS A,\n " . DBPREFIX . "module_shop" . MODULE_INDEX . "_orders AS B\n WHERE A.order_id=B.id\n AND ( B.status=" . Order::STATUS_CONFIRMED . "\n OR B.status=" . Order::STATUS_COMPLETED . ")"; $objResult = $objDatabase->SelectLimit($query_totalproducts, 1); if ($objResult) { if (!$objResult->EOF) { $totalSoldProducts = $objResult->fields['shopTotalSoldProducts']; $objResult->MoveNext(); } } $totalOrderSum = 0; $totalOrders = 0; $bestMonthSum = 0; $bestMonthDate = ''; $arrShopMonthSum = array(); $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $orderSum = Currency::getDefaultCurrencyPrice($objResult->fields['sum']); if (!isset($arrShopMonthSum[$objResult->fields['year']][$objResult->fields['month']])) { $arrShopMonthSum[$objResult->fields['year']][$objResult->fields['month']] = 0; } $arrShopMonthSum[$objResult->fields['year']][$objResult->fields['month']] += $orderSum; $totalOrderSum += $orderSum; $totalOrders++; $objResult->MoveNext(); } $months = explode(',', $_ARRAYLANG['TXT_MONTH_ARRAY']); foreach ($arrShopMonthSum as $year => $arrMonth) { foreach ($arrMonth as $month => $sum) { if ($bestMonthSum < $sum) { $bestMonthSum = $sum; $bestMonthDate = $months[$month - 1] . ' ' . $year; } } } $objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_TOTAL_SUM' => Currency::formatPrice($totalOrderSum) . ' ' . Currency::getDefaultCurrencySymbol(), 'SHOP_MONTH' => $bestMonthDate, 'SHOP_MONTH_SUM' => Currency::formatPrice($bestMonthSum) . ' ' . Currency::getDefaultCurrencySymbol(), 'SHOP_TOTAL_ORDERS' => $totalOrders, 'SHOP_SOLD_ARTICLES' => $totalSoldProducts, 'SHOP_SUM_COLUMN_2' => $sumColumn2, 'SHOP_SUM_COLUMN_3' => $sumColumn3, 'SHOP_SUM_COLUMN_4' => Currency::formatPrice($sumColumn4) . ' ' . Currency::getDefaultCurrencySymbol())); return true; }
private function getProductCatalogVariables($productCatalog) { $rootCategoriesSmarty = $this->getSmartyCategories($productCatalog->getAllCategories()); $this->insertProducts($rootCategoriesSmarty); $description = htmlToLatex(from_html($productCatalog->description)); //1.7.6 TODO create error handling here if ($description == null) { $GLOBALS['log']->error('OQC: Product catalog description is null!'); //return null; } global $timedate; $validfrom = $timedate->to_display_date($productCatalog->validfrom); $validto = $timedate->to_display_date($productCatalog->validto); $frontpage = null; $attachment = null; if ($productCatalog->frontpage_id != null || $productCatalog->attachment_id != null) { $doc = new Document(); if ($doc->retrieve($productCatalog->frontpage_id)) { $frontpage = str_replace("\\", '/', TMP_DIR . DIRECTORY_SEPARATOR . $doc->document_revision_id . '.pdf'); copy(getcwd() . DIRECTORY_SEPARATOR . getDocumentFilename($doc->document_revision_id), $frontpage); } if ($doc->retrieve($productCatalog->attachment_id)) { $attachment = str_replace("\\", '/', TMP_DIR . DIRECTORY_SEPARATOR . $doc->document_revision_id . '.pdf'); copy(getcwd() . DIRECTORY_SEPARATOR . getDocumentFilename($doc->document_revision_id), $attachment); } } //ProductCatalog currency setup $currencyArray = array(); $currency = new Currency(); $currency_id = $currency->retrieve_id_by_name($productCatalog->currency_id); //$GLOBALS['log']->error('Contract variables: currency: '. var_export($currency_id,true)); if ($currency_id) { $currency->retrieve($currency_id); $currencyArray['currency_id'] = $currency->iso4217; $currencyArray['currency_symbol'] = $currency->symbol; $currencyArray['currency_ratio'] = $currency->conversion_rate; } else { $currencyArray['currency_id'] = $currency->getDefaultISO4217(); $currencyArray['currency_symbol'] = $currency->getDefaultCurrencySymbol(); $currencyArray['currency_ratio'] = 1.0; } $currencyArray['currency_symbol'] = str_replace("€", '\\euro{}', $currencyArray['currency_symbol']); $currencyArray['currency_symbol'] = str_replace('$', '\\$', $currencyArray['currency_symbol']); $currencyArray['currency_symbol'] = str_replace("£", '{\\pounds}', $currencyArray['currency_symbol']); $currencyArray['currency_symbol'] = str_replace("¥", '{Y\\hspace*{-1.4ex}--}', $currencyArray['currency_symbol']); $productCatalogVariables = array('name' => $productCatalog->name, 'validfrom' => $validfrom, 'validto' => $validto, 'graphicsDir' => LATEX_GRAPHICS_DIR, 'categoriesAndProducts' => $rootCategoriesSmarty, 'description' => $description, 'frontpage' => $frontpage, 'attachment' => $attachment, 'year' => date('Y'), 'currency' => $currencyArray, 'discount' => 1.0 - $productCatalog->oqc_catalog_discount / 100); //$GLOBALS['log']->error('Product Catalog variables: '. var_export($productCatalogVariables,true)); return $productCatalogVariables; }
function getContractVariables($contract) { $contractData = sanatizeBeanArrayForLatex($contract->toArray(true)); $clientContact = new Contact(); if ($clientContact->retrieve($contract->clientcontact_id)) { $contractData['clientContact'] = sanatizeBeanArrayForLatex($clientContact->toArray(true)); // Gets data from DB only $clientAccount = new Account(); if ($clientAccount->retrieve($clientContact->account_id)) { //$GLOBALS['log']->error('Account variables: variables transferred to latex template: '. var_export($clientAccount->toArray(true),true)); $contractData['clientContact']['account'] = sanatizeBeanArrayForLatex($clientAccount->toArray(true)); } //gets data from DB only } // only date is needed (not time) and we have to convert it to the user format global $timedate; //$GLOBALS['log']->error('Contract variables: date_modified: '. var_export($contract->date_modified,true)); //$contractData['date_modified'] = $timedate->to_display_date($contract->date_modified); $contractData['date_modified'] = $timedate->getDatePart($contract->date_modified); //$contractData['startdate'] = $timedate->to_display_date($contract->startdate); //$contractData['enddate'] = $timedate->to_display_date($contract->enddate); //$contractData['deadline'] = $timedate->to_display_date($contract->deadline); // translate global $app_list_strings; if (isset($contractData['periodofnotice'])) { $contractData['periodofnotice'] = $app_list_strings['periodofnotice_list'][$contractData['periodofnotice']]; } //contract currency setup $currency = new Currency(); $currency_id = $currency->retrieve_id_by_name($contract->currency_id); //$GLOBALS['log']->error('Contract variables: currency: '. var_export($currency_id,true)); if ($currency_id) { $currency->retrieve($currency_id); $contractData['currency_id'] = $currency->iso4217; $contractData['currency_symbol'] = $currency->symbol; } else { $contractData['currency_id'] = $currency->getDefaultISO4217(); $contractData['currency_symbol'] = $currency->getDefaultCurrencySymbol(); } $contractData['currency_symbol'] = str_replace("€", '\\euro{}', $contractData['currency_symbol']); $contractData['currency_symbol'] = str_replace('$', '\\$', $contractData['currency_symbol']); $contractData['currency_symbol'] = str_replace("£", '{\\pounds}', $contractData['currency_symbol']); $contractData['currency_symbol'] = str_replace("¥", '{Y\\hspace*{-1.4ex}--}', $contractData['currency_symbol']); // Get Sugar user information $userData = oqc_getUserVariables(); $contractData = array_merge($contractData, $userData); $outputData = array('contract' => $contractData, 'graphicsDir' => LATEX_GRAPHICS_DIR); //$GLOBALS['log']->error('Contract variables: variables transferred to latex template: '. var_export($contractData,true)); return $outputData; }
public function testgetDefaultCurrencySymbol() { $currency = new Currency(); $this->assertEquals('$', $currency->getDefaultCurrencySymbol()); }
/** * Set up the customer details */ function view_customer_details() { global $_ARRAYLANG; self::$objTemplate->loadTemplateFile("module_shop_customer_details.html"); if (isset($_POST['store'])) { self::storeCustomerFromPost(); } $customer_id = intval($_REQUEST['customer_id']); $objCustomer = Customer::getById($customer_id); if (!$objCustomer) { return \Message::error($_ARRAYLANG['TXT_SHOP_CUSTOMER_ERROR_NOT_FOUND']); } $customer_type = $objCustomer->is_reseller() ? $_ARRAYLANG['TXT_RESELLER'] : $_ARRAYLANG['TXT_CUSTOMER']; $active = $objCustomer->active() ? $_ARRAYLANG['TXT_ACTIVE'] : $_ARRAYLANG['TXT_INACTIVE']; self::$objTemplate->setVariable(array('SHOP_CUSTOMERID' => $objCustomer->id(), 'SHOP_GENDER' => $_ARRAYLANG['TXT_SHOP_' . strtoupper($objCustomer->gender())], 'SHOP_LASTNAME' => $objCustomer->lastname(), 'SHOP_FIRSTNAME' => $objCustomer->firstname(), 'SHOP_COMPANY' => $objCustomer->company(), 'SHOP_ADDRESS' => $objCustomer->address(), 'SHOP_CITY' => $objCustomer->city(), 'SHOP_USERNAME' => $objCustomer->username(), 'SHOP_COUNTRY' => \Cx\Core\Country\Controller\Country::getNameById($objCustomer->country_id()), 'SHOP_ZIP' => $objCustomer->zip(), 'SHOP_PHONE' => $objCustomer->phone(), 'SHOP_FAX' => $objCustomer->fax(), 'SHOP_EMAIL' => $objCustomer->email(), 'SHOP_COMPANY_NOTE' => $objCustomer->companynote(), 'SHOP_IS_RESELLER' => $customer_type, 'SHOP_REGISTER_DATE' => date(ASCMS_DATE_FORMAT_DATETIME, $objCustomer->register_date()), 'SHOP_CUSTOMER_STATUS' => $active, 'SHOP_DISCOUNT_GROUP_CUSTOMER' => Discount::getCustomerGroupName($objCustomer->group_id()))); // TODO: TEST $count = NULL; $orders = Orders::getArray($count, NULL, array(), \Paging::getPosition(), \Cx\Core\Setting\Controller\Setting::getValue('numof_orders_per_page_backend', 'Shop')); $i = 1; foreach ($orders as $order) { Currency::init($order->currency_id()); self::$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$i % 2 + 1), 'SHOP_ORDER_ID' => $order->id(), 'SHOP_ORDER_ID_CUSTOM' => ShopLibrary::getCustomOrderId($order->id(), $order->date_time()), 'SHOP_ORDER_DATE' => $order->date_time(), 'SHOP_ORDER_STATUS' => $_ARRAYLANG['TXT_SHOP_ORDER_STATUS_' . $order->status()], 'SHOP_ORDER_SUM' => Currency::getDefaultCurrencySymbol() . ' ' . Currency::getDefaultCurrencyPrice($order->sum()))); self::$objTemplate->parse('orderRow'); } return true; }
/** * Set up the detail view of the selected order * @access public * @param \Cx\Core\Html\Sigma $objTemplate The Template, by reference * @param boolean $edit Edit if true, view otherwise * @global ADONewConnection $objDatabase Database connection object * @global array $_ARRAYLANG Language array * @return boolean True on success, * false otherwise * @static * @author Reto Kohli <*****@*****.**> (parts) * @version 3.1.0 */ static function view_detail(&$objTemplate = null, $edit = false) { global $objDatabase, $_ARRAYLANG, $objInit; $backend = $objInit->mode == 'backend'; if ($objTemplate->blockExists('order_list')) { $objTemplate->hideBlock('order_list'); } $have_option = false; // The order total -- in the currency chosen by the customer $order_sum = 0; // recalculated VAT total $total_vat_amount = 0; $order_id = intval($_REQUEST['order_id']); if (!$order_id) { return \Message::error($_ARRAYLANG['TXT_SHOP_ORDER_ERROR_INVALID_ORDER_ID']); } if (!$objTemplate) { $template_name = $edit ? 'module_shop_order_edit.html' : 'module_shop_order_details.html'; $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Shop/View/Template/Backend'); //DBG::log("Orders::view_list(): new Template: ".$objTemplate->get()); $objTemplate->loadTemplateFile($template_name); //DBG::log("Orders::view_list(): loaded Template: ".$objTemplate->get()); } $objOrder = Order::getById($order_id); if (!$objOrder) { //DBG::log("Shop::shopShowOrderdetails(): Failed to find Order ID $order_id"); return \Message::error(sprintf($_ARRAYLANG['TXT_SHOP_ORDER_NOT_FOUND'], $order_id)); } // lsv data $query = "\n SELECT `holder`, `bank`, `blz`\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_lsv\n WHERE order_id={$order_id}"; $objResult = $objDatabase->Execute($query); if (!$objResult) { return self::errorHandler(); } if ($objResult->RecordCount() == 1) { $objTemplate->setVariable(array('SHOP_ACCOUNT_HOLDER' => contrexx_raw2xhtml($objResult->fields['holder']), 'SHOP_ACCOUNT_BANK' => contrexx_raw2xhtml($objResult->fields['bank']), 'SHOP_ACCOUNT_BLZ' => contrexx_raw2xhtml($objResult->fields['blz']))); } $customer_id = $objOrder->customer_id(); if (!$customer_id) { //DBG::log("Shop::shopShowOrderdetails(): Invalid Customer ID $customer_id"); \Message::error(sprintf($_ARRAYLANG['TXT_SHOP_INVALID_CUSTOMER_ID'], $customer_id)); } $objCustomer = Customer::getById($customer_id); if (!$objCustomer) { //DBG::log("Shop::shopShowOrderdetails(): Failed to find Customer ID $customer_id"); \Message::error(sprintf($_ARRAYLANG['TXT_SHOP_CUSTOMER_NOT_FOUND'], $customer_id)); $objCustomer = new Customer(); // No editing allowed! $have_option = true; } Vat::is_reseller($objCustomer->is_reseller()); Vat::is_home_country(\Cx\Core\Setting\Controller\Setting::getValue('country_id', 'Shop') == $objOrder->country_id()); $objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_CURRENCY' => Currency::getCurrencySymbolById($objOrder->currency_id()))); //DBG::log("Order sum: ".Currency::formatPrice($objOrder->sum())); $objTemplate->setVariable(array('SHOP_CUSTOMER_ID' => $customer_id, 'SHOP_ORDERID' => $order_id, 'SHOP_DATE' => date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME, strtotime($objOrder->date_time())), 'SHOP_ORDER_STATUS' => $edit ? Orders::getStatusMenu($objOrder->status(), false, null, 'swapSendToStatus(this.value)') : $_ARRAYLANG['TXT_SHOP_ORDER_STATUS_' . $objOrder->status()], 'SHOP_SEND_MAIL_STYLE' => $objOrder->status() == Order::STATUS_CONFIRMED ? 'display: inline;' : 'display: none;', 'SHOP_SEND_MAIL_STATUS' => $edit ? $objOrder->status() != Order::STATUS_CONFIRMED ? \Html::ATTRIBUTE_CHECKED : '' : '', 'SHOP_ORDER_SUM' => Currency::formatPrice($objOrder->sum()), 'SHOP_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_GENDER' => $edit ? Customer::getGenderMenu($objOrder->billing_gender(), 'billing_gender') : $_ARRAYLANG['TXT_SHOP_' . strtoupper($objOrder->billing_gender())], 'SHOP_COMPANY' => $objOrder->billing_company(), 'SHOP_FIRSTNAME' => $objOrder->billing_firstname(), 'SHOP_LASTNAME' => $objOrder->billing_lastname(), 'SHOP_ADDRESS' => $objOrder->billing_address(), 'SHOP_ZIP' => $objOrder->billing_zip(), 'SHOP_CITY' => $objOrder->billing_city(), 'SHOP_COUNTRY' => $edit ? \Cx\Core\Country\Controller\Country::getMenu('billing_country_id', $objOrder->billing_country_id()) : \Cx\Core\Country\Controller\Country::getNameById($objOrder->billing_country_id()), 'SHOP_PHONE' => $objOrder->billing_phone(), 'SHOP_FAX' => $objOrder->billing_fax(), 'SHOP_EMAIL' => $objOrder->billing_email(), 'SHOP_SHIP_GENDER' => $edit ? Customer::getGenderMenu($objOrder->gender(), 'shipPrefix') : $_ARRAYLANG['TXT_SHOP_' . strtoupper($objOrder->gender())], 'SHOP_SHIP_COMPANY' => $objOrder->company(), 'SHOP_SHIP_FIRSTNAME' => $objOrder->firstname(), 'SHOP_SHIP_LASTNAME' => $objOrder->lastname(), 'SHOP_SHIP_ADDRESS' => $objOrder->address(), 'SHOP_SHIP_ZIP' => $objOrder->zip(), 'SHOP_SHIP_CITY' => $objOrder->city(), 'SHOP_SHIP_COUNTRY' => $edit ? \Cx\Core\Country\Controller\Country::getMenu('shipCountry', $objOrder->country_id()) : \Cx\Core\Country\Controller\Country::getNameById($objOrder->country_id()), 'SHOP_SHIP_PHONE' => $objOrder->phone(), 'SHOP_PAYMENTTYPE' => Payment::getProperty($objOrder->payment_id(), 'name'), 'SHOP_CUSTOMER_NOTE' => $objOrder->note(), 'SHOP_COMPANY_NOTE' => $objCustomer->companynote(), 'SHOP_SHIPPING_TYPE' => $objOrder->shipment_id() ? Shipment::getShipperName($objOrder->shipment_id()) : ' ')); if ($backend) { $objTemplate->setVariable(array('SHOP_CUSTOMER_IP' => $objOrder->ip() ? '<a href="index.php?cmd=NetTools&tpl=whois&address=' . $objOrder->ip() . '" title="' . $_ARRAYLANG['TXT_SHOW_DETAILS'] . '">' . $objOrder->ip() . '</a>' : ' ', 'SHOP_CUSTOMER_HOST' => $objOrder->host() ? '<a href="index.php?cmd=NetTools&tpl=whois&address=' . $objOrder->host() . '" title="' . $_ARRAYLANG['TXT_SHOW_DETAILS'] . '">' . $objOrder->host() . '</a>' : ' ', 'SHOP_CUSTOMER_LANG' => \FWLanguage::getLanguageParameter($objOrder->lang_id(), 'name'), 'SHOP_CUSTOMER_BROWSER' => $objOrder->browser() ? $objOrder->browser() : ' ', 'SHOP_LAST_MODIFIED' => $objOrder->modified_on() && $objOrder->modified_on() != '0000-00-00 00:00:00' ? $objOrder->modified_on() . ' ' . $_ARRAYLANG['TXT_EDITED_BY'] . ' ' . $objOrder->modified_by() : $_ARRAYLANG['TXT_ORDER_WASNT_YET_EDITED'])); } else { // Frontend: Order history ONLY. Repeat the Order, go to cart $objTemplate->setVariable(array('SHOP_ACTION_URI_ENCODED' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'cart'))); } $ppName = ''; $psp_id = Payment::getPaymentProcessorId($objOrder->payment_id()); if ($psp_id) { $ppName = PaymentProcessing::getPaymentProcessorName($psp_id); } $objTemplate->setVariable(array('SHOP_SHIPPING_PRICE' => $objOrder->shipment_amount(), 'SHOP_PAYMENT_PRICE' => $objOrder->payment_amount(), 'SHOP_PAYMENT_HANDLER' => $ppName, 'SHOP_LAST_MODIFIED_DATE' => $objOrder->modified_on())); if ($edit) { // edit order $strJsArrShipment = Shipment::getJSArrays(); $objTemplate->setVariable(array('SHOP_SEND_TEMPLATE_TO_CUSTOMER' => sprintf($_ARRAYLANG['TXT_SEND_TEMPLATE_TO_CUSTOMER'], $_ARRAYLANG['TXT_ORDER_COMPLETE']), 'SHOP_SHIPPING_TYP_MENU' => Shipment::getShipperMenu($objOrder->country_id(), $objOrder->shipment_id(), "calcPrice(0);"), 'SHOP_JS_ARR_SHIPMENT' => $strJsArrShipment, 'SHOP_PRODUCT_IDS_MENU_NEW' => Products::getMenuoptions(null, null, $_ARRAYLANG['TXT_SHOP_PRODUCT_MENU_FORMAT']), 'SHOP_JS_ARR_PRODUCT' => Products::getJavascriptArray($objCustomer->group_id(), $objCustomer->is_reseller()))); } $options = $objOrder->getOptionArray(); if (!empty($options[$order_id])) { $have_option = true; } // Order items $total_weight = $i = 0; $total_net_price = $objOrder->view_items($objTemplate, $edit, $total_weight, $i); // Show VAT with the individual products: // If VAT is enabled, and we're both in the same country // ($total_vat_amount has been set above if both conditions are met) // show the VAT rate. // If there is no VAT, the amount is 0 (zero). //if ($total_vat_amount) { // distinguish between included VAT, and additional VAT added to sum $tax_part_percentaged = Vat::isIncluded() ? $_ARRAYLANG['TXT_TAX_PREFIX_INCL'] : $_ARRAYLANG['TXT_TAX_PREFIX_EXCL']; $objTemplate->setVariable(array('SHOP_TAX_PRICE' => Currency::formatPrice($total_vat_amount), 'SHOP_PART_TAX_PROCENTUAL' => $tax_part_percentaged)); //} else { // No VAT otherwise // remove it from the details overview if empty //$objTemplate->hideBlock('taxprice'); //$tax_part_percentaged = $_ARRAYLANG['TXT_NO_TAX']; //} // Parse Coupon if applicable to this product // Coupon $objCoupon = Coupon::getByOrderId($order_id); if ($objCoupon) { $discount = $objCoupon->discount_amount() != 0 ? $objCoupon->discount_amount() : $total_net_price / 100 * $objCoupon->discount_rate(); $objTemplate->setVariable(array('SHOP_COUPON_NAME' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODE'], 'SHOP_COUPON_CODE' => $objCoupon->code(), 'SHOP_COUPON_AMOUNT' => Currency::formatPrice(-$discount))); $total_net_price -= $discount; //DBG::log("Order::view_detail(): Coupon: ".var_export($objCoupon, true)); } $objTemplate->setVariable(array('SHOP_ROWCLASS_NEW' => 'row' . (++$i % 2 + 1), 'SHOP_TOTAL_WEIGHT' => Weight::getWeightString($total_weight), 'SHOP_NET_PRICE' => Currency::formatPrice($total_net_price))); $objTemplate->setVariable(array('TXT_PRODUCT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_TAX_RATE' => Vat::isIncluded() ? $_ARRAYLANG['TXT_TAX_PREFIX_INCL'] : $_ARRAYLANG['TXT_TAX_PREFIX_EXCL'], 'TXT_SHOP_ACCOUNT_VALIDITY' => $_ARRAYLANG['TXT_SHOP_VALIDITY'])); // Disable the "edit" button when there are Attributes if ($backend && !$edit) { if ($have_option) { if ($objTemplate->blockExists('order_no_edit')) { $objTemplate->touchBlock('order_no_edit'); } } else { if ($objTemplate->blockExists('order_edit')) { $objTemplate->touchBlock('order_edit'); } } } return true; }
function display() { if (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'set_target') { require_once 'modules/Campaigns/utils.php'; //call function to create campaign logs $mess = track_campaign_prospects($this->bean); $confirm_msg = "var ajax_C_LOG_Status = new SUGAR.ajaxStatusClass(); \n window.setTimeout(\"ajax_C_LOG_Status.showStatus('" . $mess . "')\",1000); \n window.setTimeout('ajax_C_LOG_Status.hideStatus()', 1500); \n window.setTimeout(\"ajax_C_LOG_Status.showStatus('" . $mess . "')\",2000); \n window.setTimeout('ajax_C_LOG_Status.hideStatus()', 5000); "; $this->ss->assign("MSG_SCRIPT", $confirm_msg); } # tracy: use the sms.lang.php language file to override the regular Campaign lang if ($this->bean->campaign_type == "SMS") { global $mod_strings; $mod_strings['LBL_QUEUE_BUTTON_LABEL'] = "Send SMS"; } if ($this->bean->campaign_type == 'Email' || $this->bean->campaign_type == 'NewsLetter' || $this->bean->campaign_type == 'SMS') { $this->ss->assign("ADD_BUTTON_STATE", "submit"); $this->ss->assign("TARGET_BUTTON_STATE", "hidden"); } else { $this->ss->assign("ADD_BUTTON_STATE", "hidden"); $this->ss->assign("DISABLE_LINK", "display:none"); $this->ss->assign("TARGET_BUTTON_STATE", "submit"); } $currency = new Currency(); if (isset($this->bean->currency_id) && !empty($this->bean->currency_id)) { $currency->retrieve($this->bean->currency_id); if ($currency->deleted != 1) { $this->ss->assign('CURRENCY', $currency->iso4217 . ' ' . $currency->symbol); } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } } else { $this->ss->assign('CURRENCY', $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } parent::display(); //We want to display subset of available, panels, so we will call subpanel //object directly instead of using sugarview. $GLOBALS['focus'] = $this->bean; require_once 'include/SubPanel/SubPanelTiles.php'; $subpanel = new SubPanelTiles($this->bean, $this->module); //get available list of subpanels # tracy: change the title key of email marketing subpanel for SMS if ($this->bean->campaign_type == "SMS") { $subpanel->subpanel_definitions->layout_defs['subpanel_setup']['emailmarketing']['title_key'] = "SMS Маркетинг"; } $alltabs = $subpanel->subpanel_definitions->get_available_tabs(); if (!empty($alltabs)) { //iterate through list, and filter out all but 3 subpanels foreach ($alltabs as $key => $name) { if ($this->bean->campaign_type == 'SMS' && $name == 'tracked_urls') { # tracy: hide trackers for SMS $subpanel->subpanel_definitions->exclude_tab($name); } elseif ($name != 'prospectlists' && $name != 'emailmarketing' && $name != 'tracked_urls') { //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls $subpanel->subpanel_definitions->exclude_tab($name); } } //only show email marketing subpanel for email/newsletter campaigns # tracy: include SMS if ($this->bean->campaign_type != 'Email' && $this->bean->campaign_type != 'NewsLetter' && $this->bean->campaign_type != 'SMS') { //exclude subpanels that are not prospectlists, emailmarketing, or tracked urls $subpanel->subpanel_definitions->exclude_tab('emailmarketing'); } } //show filtered subpanel list $this->options['show_subpanels'] = 0; echo $subpanel->display(); }
$query_click .= " AND marketing_id ='{$marketing_id}'"; } $query_click .= " GROUP BY activity_type, target_type"; $query_click .= " ORDER BY activity_type, target_type"; $result = $campaign->db->query($query_click); $xtpl->assign("OPP_COUNT", $opp_data1['opp_count']); $xtpl->assign("ACTUAL_COST", $opp_data1['actual_cost']); $xtpl->assign("PLANNED_BUDGET", $opp_data1['budget']); $xtpl->assign("EXPECTED_REVENUE", $opp_data1['expected_revenue']); $currency = new Currency(); if (isset($focus->currency_id) && !empty($focus->currency_id)) { $currency->retrieve($focus->currency_id); if ($currency->deleted != 1) { $xtpl->assign("CURRENCY", $currency->iso4217 . ' ' . $currency->symbol); } else { $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } } else { $xtpl->assign("CURRENCY", $currency->getDefaultISO4217() . ' ' . $currency->getDefaultCurrencySymbol()); } global $current_user; if (is_admin($current_user) && $_REQUEST['module'] != 'DynamicLayout' && !empty($_SESSION['editinplace'])) { $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $_REQUEST['record'] . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT']) . "</a>"); } //$detailView->processListNavigation($xtpl, "CAMPAIGN", $offset, $focus->is_AuditEnabled()); // adding custom fields: //require_once('modules/DynamicFields/templates/Files/DetailView.php'); /* we need to build the dropdown of related marketing values $latest_marketing_id = ''; $selected_marketing_id = ''; if(isset($_REQUEST['mkt_id'])) $selected_marketing_id = $_REQUEST['mkt_id'];
function get_next_row($result_field_name = 'result', $column_field_name = 'display_columns', $skip_non_summary_columns = false, $exporting = false) { global $current_user; $chart_cells = array(); if ($this->do_export) { $db_row = $this->db->fetchByAssoc($this->{$result_field_name}, false); } else { $db_row = $this->db->fetchByAssoc($this->{$result_field_name}); } if ($db_row == 0 || sizeof($db_row) == 0) { return 0; } // Call custom hooks if (isset($this->full_bean_list) && is_array($this->full_bean_list) && array_key_exists('self', $this->full_bean_list) && is_object($this->full_bean_list['self']) && method_exists($this->full_bean_list['self'], 'call_custom_logic')) { $this->full_bean_list['self']->call_custom_logic('process_report_row', array('row' => &$db_row, 'reporter' => $this)); } if ($result_field_name == 'summary_result') { if (!empty($this->child_filter) && !empty($db_row[$this->child_filter_name])) { $this->child_filter_by = $db_row[$this->child_filter_name]; } else { $this->child_filter = ''; $this->child_filter_by = ''; $this->child_filter_name = ''; } } $row = array(); $cells = array(); $fields = array(); foreach ($db_row as $key => $value) { //if value is null or not set, then change to empty string. This prevents array index errors while processing $fields[strtoupper($key)] = is_null($value) ? '' : $value; } // here we want to make copies, so use foreach foreach ($this->report_def[$column_field_name] as $display_column) { $display_column['table_alias'] = $this->getTableFromField($display_column); $this->register_field_for_query($display_column); if ($skip_non_summary_columns && empty($display_column['group_function'])) { if ($exporting || $this->plain_text_output) { array_push($cells, ' '); } else { array_push($cells, ' '); } continue; } $display_column['fields'] = $fields; if ($this->plain_text_output == true) { /*nsingh: bug 13554- date and time fields must be displayed using user's locale settings. * Since to_pdf uses plain_text_output=true, we handle the date and time case here by using the 'List' context of the layout_manager */ if ($display_column['type'] == 'date' || $display_column['type'] == 'time' || $display_column['type'] == 'datetimecombo') { $this->layout_manager->setAttribute('context', 'List'); } else { $this->layout_manager->setAttribute('context', 'ListPlain'); } } else { $this->layout_manager->setAttribute('context', 'List'); } // Make sure 'AVG' aggregate is shown as float, regardless of the original field type if (!empty($display_column['group_function']) && strtolower($display_column['group_function']) === 'avg' && $display_column['type'] != 'currency') { $display_column['type'] = 'float'; } if ($display_column['type'] != 'currency' || substr_count($display_column['name'], '_usdoll') == 0 && (isset($display_column['group_function']) ? $display_column['group_function'] != 'weighted_amount' && $display_column['group_function'] != 'weighted_sum' : true)) { $pos = $display_column['table_key']; $module_name = ''; if ($pos) { $module_name = substr($pos, strrpos($pos, ':') + 1); } $field_name = $this->getColumnFieldName($display_column); if ($module_name == 'currencies' && empty($display_column['fields'][$field_name])) { switch ($display_column['name']) { case 'iso4217': $display = $this->currency_obj->getDefaultISO4217(); break; case 'symbol': $display = $this->currency_obj->getDefaultCurrencySymbol(); break; case 'name': $display = $this->currency_obj->getDefaultCurrencyName(); break; default: $display = $this->layout_manager->widgetDisplay($display_column); } $display_column['fields'][$field_name] = $display; } else { if (!empty($field_name) && isset($display_column['fields'][$field_name])) { $display_column['fields'][$field_name] = $this->db->fromConvert($display_column['fields'][$field_name], $display_column['type']); } $display = $this->layout_manager->widgetDisplay($display_column); } } else { if (isset($display_column['group_function'])) { $field_name = $this->getTruncatedColumnAlias(strtoupper($display_column['table_alias']) . "_" . strtoupper($display_column['group_function']) . "_" . strtoupper($display_column['name'])); } else { unset($field_name); } if (!isset($field_name) || !isset($display_column['fields'][$field_name])) { $field_name = $this->getTruncatedColumnAlias(strtoupper($display_column['table_alias']) . "_" . strtoupper($display_column['name'])); } if (isset($display_column['fields'][$field_name])) { $display = $display_column['fields'][$field_name]; } } if ($display_column['type'] == 'currency' && (strpos($display_column['name'], '_usdoll') !== false || !empty($display_column['group_function']))) { // convert base to user preferred if set in user prefs if ($current_user->getPreference('currency_show_preferred')) { $userCurrency = SugarCurrency::getUserLocaleCurrency(); $raw_display = SugarCurrency::convertWithRate($display_column['fields'][$field_name], 1.0, $userCurrency->conversion_rate); $display = SugarCurrency::formatAmountUserLocale($raw_display, $userCurrency->id); } else { $raw_display = $display_column['fields'][$field_name]; $display = SugarCurrency::formatAmountUserLocale($raw_display, SugarCurrency::getBaseCurrency()->id); } } else { $raw_display = $display; } if (isset($display_column['type']) && $display_column['type'] == 'float') { $display = $this->layout_manager->widgetDisplay($display_column); } if (isset($display_column['type'])) { $alias = $this->alias_lookup[$display_column['table_key']]; $array_key = strtoupper($alias . '__count'); if (array_key_exists($array_key, $display_column['fields'])) { $displayData = $display_column['fields'][$array_key]; if (empty($displayData) && $display_column['type'] != 'bool' && ($display_column['type'] != 'enum' || $display_column['type'] == 'enum' && $displayData != '0')) { $display = ""; } } // if $module_bean = BeanFactory::getBean($this->module); if (is_array($module_bean->field_defs)) { if (isset($module_bean->field_defs[$display_column['type']])) { if (isset($module_bean->field_defs[$display_column['type']]['options'])) { $trans_options = translate($module_bean->field_defs[$display_column['type']]['options']); if (isset($trans_options[$display_column['fields'][$field_name]])) { $display = $trans_options[$display_column['fields'][$field_name]]; } } } } } // if // for charts if ($column_field_name == 'summary_columns' && $this->do_chart) { //_pp($display); $raw_value = ""; $keys = array_keys($fields); foreach ($this->report_def['summary_columns'] as $index => $column) { if ($column['name'] == $display_column['name'] && isset($keys[$index]) && isset($fields[$keys[$index]])) { $raw_value = $fields[$keys[$index]]; break; } } $cell_arr = array('val' => $raw_display, 'key' => $display_column['column_key'], 'raw_value' => $raw_value); //_pp($cell_arr); array_push($chart_cells, $cell_arr); } if ($exporting) { global $app_list_strings; // parse out checkboxes // TODO: wp this should be done in the widget if (preg_match('/type.*=.*checkbox/Uis', $display)) { if (preg_match('/checked/i', $display)) { $display = $app_list_strings['dom_switch_bool']['on']; } else { $display = $app_list_strings['dom_switch_bool']['off']; } } } array_push($cells, $display); } // END foreach $row['cells'] = $cells; // calculate summary rows count as the product of all count fields in summary $count = 1; $count_exists = false; foreach ($db_row as $count_column => $count_value) { if (substr($count_column, -10) == "__allcount" || $count_column == 'count') { $count *= max($count_value, 1); $count_exists = true; } } if ($count_exists) { $row['count'] = $count; } // for charts if ($column_field_name == 'summary_columns' && $this->do_chart) { $chart_row = 0; if (!empty($db_row['count'])) { $chart_row = array('cells' => $chart_cells, 'count' => $db_row['count']); } else { $chart_row = array('cells' => $chart_cells); } array_push($this->chart_rows, $chart_row); } if ($column_field_name == 'summary_columns' && isset($this->chart_group_position) && isset($this->group_header)) { $row['group_pos'] = $this->chart_group_position; $row['group_header'] = $this->group_header; $row['group_column_is_invisible'] = $this->group_column_is_invisible; } return $row; }