コード例 #1
0
function getServicesHtml($focus, $name, $value, $view)
{
    if ('EditView' != $view && 'DetailView' != $view) {
        return "";
        // skip the rest of the method if another view calls this method
    }
    global $app_list_strings;
    global $app_strings;
    $smarty = new Sugar_Smarty();
    // setup the popup link
    $popup_request_data = array('call_back_function' => 'OqcServices.handlePopUpClosed', 'formName' => 'EditView', 'field_to_name_array' => array("price" => "price", "is_recurring" => "is_recurring", "unit" => "unit", "name" => "name", "id" => "productId", "zeitbezug" => "zeitbezug", "currency_id" => "currency_id"), 'passthru_data' => array('unit_hours' => $app_list_strings['unit_list']['hours'], 'unit_pieces' => $app_list_strings['unit_list']['pieces'], 'zeitbezug_once' => $app_list_strings['zeitbezug_list']['once'], 'zeitbezug_monthly' => $app_list_strings['zeitbezug_list']['monthly'], 'zeitbezug_annually' => $app_list_strings['zeitbezug_list']['annually']));
    $json = getJSONobj();
    $encoded_request_data = $json->encode($popup_request_data);
    $languageStrings = $app_list_strings["oqc"]["Services"];
    //YUI error messages
    $languageStrings['LBL_NO_RECORDS_MESSAGE'] = $app_strings['LBL_NO_RECORDS_MESSAGE'];
    $languageStrings['LBL_DATA_ERROR_MESSAGE'] = $app_strings['LBL_DATA_ERROR_MESSAGE'];
    $languageStrings['LBL_LOADING_MESSAGE'] = $app_strings['LBL_LOADING_MESSAGE'];
    $languageStringsJSON = $json->encode($languageStrings);
    // $_GLOBALS['log']->fatal("asasdasd " . $languageStrings['totalNegotiatedPrice']);
    global $timedate;
    global $locale;
    $sqsJavascript = '<script type="text/javascript" src="include/oqc/QuickSearch/oqcQS.js"></script>';
    $sqsJavascript .= '<script type="text/javascript" language="javascript">';
    $sqsJavascript .= 'addToValidateDateBefore("EditView", "now", "date", true , "Deadline has to be in the future. " ,"deadline");';
    $sqsJavascript .= '</script>';
    //1.7.8 setup of currency variables for javascript
    $currencyScript = configureCurrencyVariables($focus);
    //2.2RC get contract currency
    if (isset($focus->currency_id) && $focus->currency_id != '') {
        $currentCurrency = new Currency();
        $currentCurrency->retrieve($focus->currency_id);
        $currencySymbol = $currentCurrency->symbol;
        $current_ratio = $currentCurrency->conversion_rate;
        $current_id = $currentCurrency->id;
    } else {
        $currencySymbol = $locale->getPrecedentPreference('default_currency_symbol');
        $current_ratio = 1;
        $current_id = '-99';
    }
    //	$default_currency = new Currency();
    //	$default_currency->retrieve('-99');
    //	$currencySymbol = $default_currency->symbol;
    //$currencySymbol = $locale->getPrecedentPreference('default_currency_symbol');
    //	require_once('include/oqc/common/common.php');
    require_once 'include/oqc/common/Configuration.php';
    $conf = Configuration::getInstance();
    $hideRecurringContainer = $conf->get('hideRecurringTable');
    //$GLOBALS['log']->error('OQC: Legacy Vat value is '.$vat);
    $sep = get_number_seperators();
    $vat_default = floatval(str_replace($sep[1], '.', $app_list_strings['oqc_vat_list']['default'])) / 100;
    //$GLOBALS['log']->error('OQC: Default Vat value is '.$vat_default);
    $smarty->assign('hideContainer', $hideRecurringContainer);
    $smarty->assign('thousandsSeparator', $sep[0]);
    $smarty->assign('decimalSeparator', $sep[1]);
    $smarty->assign('dropdownLabelsUnitJSON', $json->encode($app_list_strings['unit_list']));
    $smarty->assign('dropdownLabelsRecurrenceJSON', $json->encode($app_list_strings['zeitbezug_list']));
    $smarty->assign('dropdownLabelsDiscountTypeJSON', $json->encode($app_list_strings['discount_select_list']));
    $smarty->assign('dropdownLabelsVatJSON', $json->encode($app_list_strings['oqc_vat_list']));
    $smarty->assign('dateFormat', $locale->getPrecedentPreference('default_date_format'));
    $smarty->assign('currencyJavascript', $currencyScript);
    $smarty->assign('currencySymbol', $currencySymbol);
    $smarty->assign('current_rate', $current_ratio);
    $smarty->assign('current_id', $current_id);
    $smarty->assign('languageStrings', $languageStrings);
    $smarty->assign('languageStringsJSON', $languageStringsJSON);
    $smarty->assign('sqsJavascript', $sqsJavascript);
    $smarty->assign('now', date($timedate->get_date_format()));
    $smarty->assign('contractId', $focus->id);
    $smarty->assign('initialFilter', '&is_option=0');
    $smarty->assign('encoded_request_data', $encoded_request_data);
    $smarty->assign('vat_default', $vat_default);
    // default VAT value -1.7.8 just for information
    $smarty->assign('StartDate', $focus->startdate);
    $smarty->assign('EndDate', $focus->enddate);
    // new for yui
    $smarty->assign('id', $focus->id);
    $smarty->assign('moduleName', $focus->object_name);
    return $smarty->fetch('include/oqc/Services/' . $view . '.html');
}
コード例 #2
0
function getProductsHtml($focus, $name, $value, $view)
{
    if ('EditView' != $view && 'DetailView' != $view) {
        return "";
        // skip the rest of the method if another view calls this method
    }
    global $app_list_strings;
    global $app_strings;
    $smarty = new Sugar_Smarty();
    // setup the popup link
    $popup_request_data = array('call_back_function' => 'OqcProducts.handlePopUpClosed', 'formName' => 'EditView', 'field_to_name_array' => array("price" => "price", "is_recurring" => "is_recurring", "unit" => "unit", "name" => "name", "id" => "productId", "oqc_vat" => "oqc_vat", "cancellationperiod" => "cancellationperiod", "monthsguaranteed" => "monthsguaranteed", "currency_id" => "currency_id"), 'passthru_data' => array('unit_hours' => $app_list_strings['unit_list']['hours'], 'unit_pieces' => $app_list_strings['unit_list']['pieces'], 'zeitbezug_once' => $app_list_strings['zeitbezug_list']['once'], 'zeitbezug_monthly' => $app_list_strings['zeitbezug_list']['monthly'], 'zeitbezug_annually' => $app_list_strings['zeitbezug_list']['annually']));
    $json = getJSONobj();
    $encoded_request_data = $json->encode($popup_request_data);
    $languageStrings = $app_list_strings["oqc"]["Services"];
    //YUI error messages
    $languageStrings['LBL_NO_RECORDS_MESSAGE'] = $app_strings['LBL_NO_RECORDS_MESSAGE'];
    $languageStrings['LBL_DATA_ERROR_MESSAGE'] = $app_strings['LBL_DATA_ERROR_MESSAGE'];
    $languageStrings['LBL_LOADING_MESSAGE'] = $app_strings['LBL_LOADING_MESSAGE'];
    $languageStringsJSON = $json->encode($languageStrings);
    global $timedate;
    global $locale;
    $sqsJavascript = '<script type="text/javascript" src="include/oqc/QuickSearch/oqcQS.js"></script>';
    $sqsJavascript .= '<script type="text/javascript" language="javascript">';
    $sqsJavascript .= 'addToValidateDateBefore("EditView", "now", "date", true , "Deadline has to be in the future. " ,"deadline");';
    $sqsJavascript .= '</script>';
    //2.2RC get product currency
    if (isset($focus->currency_id) && $focus->currency_id != '') {
        $currentCurrency = new Currency();
        $currentCurrency->retrieve($focus->currency_id);
        $currencySymbol = $currentCurrency->symbol;
        $current_ratio = $currentCurrency->conversion_rate;
        $current_id = $currentCurrency->id;
    } else {
        $currencySymbol = $locale->getPrecedentPreference('default_currency_symbol');
        $current_ratio = 1;
        $current_id = '-99';
    }
    $currencyScript = configureCurrencyVariables();
    $sep = get_number_seperators();
    $smarty->assign('thousandsSeparator', $sep[0]);
    $smarty->assign('decimalSeparator', $sep[1]);
    $smarty->assign('dropdownLabelsUnitJSON', $json->encode($app_list_strings['unit_list']));
    $smarty->assign('dropdownLabelsRecurrenceJSON', $json->encode($app_list_strings['zeitbezug_list']));
    $smarty->assign('dateFormat', $locale->getPrecedentPreference('default_date_format'));
    $smarty->assign('currencySymbol', $currencySymbol);
    $smarty->assign('current_rate', $current_ratio);
    $smarty->assign('current_id', $current_id);
    $smarty->assign('currencyJavascript', $currencyScript);
    $smarty->assign('languageStrings', $languageStrings);
    $smarty->assign('languageStringsJSON', $languageStringsJSON);
    $smarty->assign('dropdownLabelsVatJSON', $json->encode($app_list_strings['oqc_vat_list']));
    //1.7.8
    $smarty->assign('sqsJavascript', $sqsJavascript);
    $smarty->assign('now', date($timedate->get_date_format()));
    $smarty->assign('contractId', $focus->id);
    $smarty->assign('initialFilter', "&not_this_product_id={$focus->id}");
    // see view.popup.php of oqc_Product :)
    $smarty->assign('encoded_request_data', $encoded_request_data);
    $smarty->assign('isPacket', $focus->isPacket());
    // new for yui
    $smarty->assign('id', $focus->id);
    $smarty->assign('moduleName', $focus->object_name);
    return $smarty->fetch('include/oqc/Products/Products.' . $view . '.html');
}