Example #1
0
function update_s_attribute_type($s_attribute_type, $description, $prompt, $input_type, $input_type_arg1, $input_type_arg2, $input_type_arg3, $input_type_arg4, $input_type_arg5, $display_type, $display_type_arg1, $display_type_arg2, $display_type_arg3, $display_type_arg4, $display_type_arg5, $s_field_type, $site_type, $listing_link_ind, $file_attribute_ind, $lookup_attribute_ind, $multi_attribute_ind, $view_perm)
{
    validate_s_attribute_type($s_attribute_type, $description, $prompt, $input_type, $input_type_arg1, $input_type_arg2, $input_type_arg3, $input_type_arg4, $input_type_arg5, $display_type, $display_type_arg1, $display_type_arg2, $display_type_arg3, $display_type_arg4, $display_type_arg5, $s_field_type, $site_type, $listing_link_ind, $file_attribute_ind, $lookup_attribute_ind, $multi_attribute_ind, $view_perm);
    $query = "UPDATE s_attribute_type " . "SET description = '" . $description . "'" . ", prompt = '" . $prompt . "'" . ($input_type !== FALSE ? ", input_type = '" . $input_type . "'" : "") . ($input_type_arg1 !== FALSE ? ", input_type_arg1 = '" . $input_type_arg1 . "'" : "") . ($input_type_arg2 !== FALSE ? ", input_type_arg2 = '" . $input_type_arg2 . "'" : "") . ($input_type_arg3 !== FALSE ? ", input_type_arg3 = '" . $input_type_arg3 . "'" : "") . ($input_type_arg4 !== FALSE ? ", input_type_arg4 = '" . $input_type_arg4 . "'" : "") . ($input_type_arg5 !== FALSE ? ", input_type_arg5 = '" . $input_type_arg5 . "'" : "") . ($display_type !== FALSE ? ", display_type = '" . $display_type . "'" : "") . ($display_type_arg1 !== FALSE ? ", display_type_arg1 = '" . $display_type_arg1 . "'" : "") . ($display_type_arg2 !== FALSE ? ", display_type_arg2 = '" . $display_type_arg2 . "'" : "") . ($display_type_arg3 !== FALSE ? ", display_type_arg3 = '" . $display_type_arg3 . "'" : "") . ($display_type_arg4 !== FALSE ? ", display_type_arg4 = '" . $display_type_arg4 . "'" : "") . ($display_type_arg5 !== FALSE ? ", display_type_arg5 = '" . $display_type_arg5 . "'" : "") . ($s_field_type !== FALSE ? ", s_field_type = '" . $s_field_type . "'" : "") . ($site_type !== FALSE ? ", site_type = '" . $site_type . "'" : "") . ($listing_link_ind !== FALSE ? ", listing_link_ind = '" . $listing_link_ind . "'" : "") . ($file_attribute_ind !== FALSE ? ", file_attribute_ind = '" . $file_attribute_ind . "'" : "") . ($lookup_attribute_ind !== FALSE ? ", lookup_attribute_ind = '" . $lookup_attribute_ind . "'" : "") . ($multi_attribute_ind !== FALSE ? ", multi_attribute_ind = '" . $multi_attribute_ind . "'" : "") . ($view_perm !== FALSE ? ", view_perm = '" . $view_perm . "'" : "") . " WHERE s_attribute_type = '{$s_attribute_type}'";
    $update = db_query($query);
    // We should not treat updates that were not actually updated because value did not change as failures.
    $rows_affected = db_affected_rows();
    if ($update && $rows_affected !== -1) {
        if ($rows_affected > 0) {
            opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, NULL, array($description, $prompt, $input_type, $input_type_arg1, $input_type_arg2, $input_type_arg3, $input_type_arg4, $input_type_arg5, $display_type, $display_type_arg1, $display_type_arg2, $display_type_arg3, $display_type_arg4, $display_type_arg5, $s_field_type, $site_type, $listing_link_ind, $file_attribute_ind, $lookup_attribute_ind, $multi_attribute_ind, $view_perm));
        }
        return TRUE;
    } else {
        opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, db_error(), array($description, $prompt, $input_type, $input_type_arg1, $input_type_arg2, $input_type_arg3, $input_type_arg4, $input_type_arg5, $display_type, $display_type_arg1, $display_type_arg2, $display_type_arg3, $display_type_arg4, $display_type_arg5, $s_field_type, $site_type, $listing_link_ind, $file_attribute_ind, $lookup_attribute_ind, $multi_attribute_ind, $view_perm));
        return FALSE;
    }
}
Example #2
0
function validate_item_column_conf(&$column_no, &$column_type, &$s_field_type, &$s_attribute_type, &$override_prompt, &$printable_support_ind, &$orderby_support_ind, &$orderby_datatype, &$orderby_default_ind, &$orderby_sort_order, &$error)
{
    $column_type = validate_column_type($column_type);
    if ($column_type !== FALSE) {
        if ($column_type == 'borrow_status' || $column_type == 'action_links') {
            $s_field_type = NULL;
            $s_attribute_type = NULL;
            $orderby_support_ind = 'N';
            $orderby_default_ind = 'N';
            $orderby_datatype = NULL;
            $orderby_sort_order = NULL;
        } else {
            if ($column_type == 's_field_type') {
                $s_field_type = validate_s_field_type($s_field_type);
                if ($s_field_type === FALSE) {
                    $error = 'Invalid System Field Type';
                    return FALSE;
                }
                if ($s_field_type == 'STATUSCMNT' || $s_field_type == 'RATING') {
                    $orderby_support_ind = 'N';
                }
            } else {
                $s_field_type = NULL;
            }
            if ($column_type == 's_attribute_type') {
                $s_attribute_type = validate_s_attribute_type($s_attribute_type);
                if ($s_attribute_type === FALSE) {
                    $error = 'Invalid System Attribute Type';
                    return FALSE;
                }
            } else {
                $s_attribute_type = NULL;
            }
            $orderby_support_ind = validate_ind_column($orderby_support_ind);
            if ($orderby_support_ind == 'Y') {
                $orderby_datatype = validate_orderby_datatype($orderby_datatype);
            } else {
                $orderby_datatype = NULL;
            }
            $orderby_default_ind = validate_ind_column($orderby_default_ind);
            if ($orderby_default_ind == 'Y') {
                $orderby_sort_order = validate_orderby_sort_order($orderby_sort_order);
            } else {
                $orderby_sort_order = NULL;
            }
            $printable_support_ind = validate_ind_column($printable_support_ind);
        }
        //else
        return TRUE;
    } else {
        $error = 'Invalid Column Type';
        return FALSE;
    }
}