allow scalar functions in where clause and order by clause to use more that one reference

Conflicts:
	sql/src/main/java/io/crate/executor/transport/task/elasticsearch/ESQueryBuilder.java
	sql/src/main/java/io/crate/operation/scalar/elasticsearch/script/AbstractScalarScriptFactory.java
	sql/src/test/java/io/crate/executor/transport/task/elasticsearch/ESQueryBuilderTest.java
fix using same function in order by clause as in output columns
Merge pull request #989 from crate/m/scripts_and_refs

M/scripts and refs