Esempio n. 1
0
function processJsForSelectorField(&$javascript, $field, $type, $tempModule, $fieldNumber, $ifAdvanced = 'field')
{
    $jsString = '';
    $javascript = new javascript();
    // Validate everything.
    $workFlowActionsExceptionFields = array();
    if (in_array($type, $workFlowActionsExceptionFields) != 1) {
        $jsString .= "removeFromValidate('EditView', 'field_{$fieldNumber}__{$ifAdvanced}_value');";
    }
    if (in_array($type, array('date', 'time', 'datetimecombo'))) {
        $jsString .= "addToValidate('EditView', 'field_{$fieldNumber}__{$ifAdvanced}_value', 'assigned_user_name', 1,'{$javascript->stripEndColon(translate($tempModule->field_name_map[$field]['vname']))}' )";
    } else {
        if (!(in_array($type, $workFlowActionsExceptionFields) == 1)) {
            $javascript->setFormName('EditView');
            $javascript->setSugarBean($tempModule);
            $javascript->addField($field, '', '', "field_{$_REQUEST['field_num']}__{$ifAdvanced}_value");
            $jsString .= $javascript->getScript(false);
        }
    }
    return $jsString;
}
Esempio n. 2
0
    $xtpl->assign('FORM_NAME', $form_name);
    $xtpl->parse("main");
    $xtpl->out("main");
    //rsmith
    $temp_module = BeanFactory::getBean($exp_object->lhs_module);
    $field = $exp_object->lhs_field;
    //now build toggle js
    global $mod_strings, $current_language;
    $mod_strings = return_module_language($current_language, $temp_module->module_dir);
    $javascript = new javascript();
    $javascript->setFormName('FieldViewNonSelector');
    $javascript->setSugarBean($temp_module);
    $type = $temp_module->field_name_map[$field]['type'];
    $js = "";
    if (isset($temp_module->field_name_map[$field]['required'])) {
        if ($type == 'date' || $type == 'time') {
            $js = "<script type=\"text/javascript\">";
            $js .= "addToValidate('EditView', '" . $exp_object->parent_type . "__field_value', 'assigned_user_name', 1,'" . $javascript->stripEndColon(translate($temp_module->field_name_map[$field]['vname'])) . "' )";
            $js .= "</script>";
        } else {
            if (in_array($type, ProcessView::get_js_exception_fields()) == 1) {
                $js = '';
            } else {
                $javascript->addField($field, true, '', $exp_object->parent_type . "__field_value");
                $js = $javascript->getScript();
            }
        }
    }
    echo $js;
    //rsmith
}