Coder Social home page Coder Social logo

custom_field_sql's Introduction

Redmine sql custom field

This plugin add two sql format for custom fields

  • sql - format for simple sql-expression.
  • sql_search - format for search sql query with form parameters

Compatibility

  • Redmine 3.4.0 or higher

Installation

  • Clone or download this repo into your redmine_root/plugins/ folder
$ git clone https://github.com/apsmir/custom_field_sql.git
  • If you downloaded this repo, make sure to rename the extracted folder to custom_field_sql
  • Restart Redmine

Usage

  1. Visit Administration->Custom fields.
  2. Press the button New custom field. Select format Sql or Sql search.
  3. Enter sql query

SQL parameters

You can use parameters for sql expression. sql format: support %id% => id of the customized object. This may be id of issue or id of project

sql_search Query must have field 'value'. This field used be as field value. format: support multiply forms parameters. Parameters must be written in jquery.


Simple 1:

"sql expression":

select subject as value, description as label from issues where subject like ? and description like ?

"sql form params":

p0='%'+$('#issue_custom_field_values_31').val()+'%' p1='%'+$('#issue_custom_field_values_30').val()+'%'


Simple 2 (for MySQL):

"sql expression":

select subject as value from issues where id = if( ? ='new', id, ?);

"sql form params":

p0=window.location.toString().split('/').pop()

p1=window.location.toString().split('/').pop()

This expression window.location.toString().split('/').pop() calculate issue id on form. For new issues calculated value = 'new'.


Query in sql search field can be executed by mouse click. Use parametr "search by click" in settings page.

Scripts

view_customize/custom_field_autselect_first_value.js It is script for plugin "view customize" https://www.redmine.org/plugins/view_customize The script allows you to automatically select the first value for a custom field (drop-down list)

Uninstall

  1. Delete all custom fields with format Sql.
  2. Remove folder redmine_root/plugins/custom_field_sql
  3. Restart Redmine

custom_field_sql's People

Contributors

apsmir avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.