Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
jio
Commits
89ba2620
Commit
89ba2620
authored
Jul 25, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5storage converts now js complex queries to erp5 queries
parent
489a5f0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
2 deletions
+42
-2
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+42
-2
No files found.
src/jio.storage/erp5storage.js
View file @
89ba2620
...
...
@@ -249,6 +249,47 @@ jIO.addStorageType("erp5", function (spec, my) {
return
jql
;
};
/**
* Use option object and converts a query to a compatible ERP5 Query.
*
* @param {Object} option The command options
*/
priv
.
convertToErp5Query
=
function
(
option
)
{
option
.
query
=
complex_queries
.
QueryFactory
.
create
(
option
.
query
||
""
);
if
(
option
.
wildcard_character
===
undefined
||
(
option
.
wildcard_character
!==
null
&&
typeof
option
.
wildcard_character
!==
'
string
'
))
{
option
.
wildcard_character
=
'
%
'
;
}
else
{
option
.
wildcard_character
=
option
.
wildcard_character
||
''
;
}
option
.
query
.
onParseSimpleQuery
=
function
(
object
)
{
if
(
option
.
wildcard_character
.
length
===
1
&&
object
.
parsed
.
operator
===
'
=
'
)
{
object
.
parsed
.
operator
=
'
like
'
;
if
(
option
.
wildcard_character
===
'
%
'
)
{
object
.
parsed
.
value
=
object
.
parsed
.
value
.
replace
(
/_/g
,
'
\\
_
'
);
}
else
if
(
option
.
wildcard_character
===
'
_
'
)
{
object
.
parsed
.
value
=
object
.
parsed
.
value
.
replace
(
/%/g
,
'
\\
%
'
).
replace
(
/_/g
,
'
%
'
);
}
else
{
object
.
parsed
.
value
=
object
.
parsed
.
value
.
replace
(
/
([
%_
])
/g
,
'
\\
$1
'
).
replace
(
new
RegExp
(
complex_queries
.
stringEscapeRegexpCharacters
(
option
.
wildcard_character
),
'
g
'
),
'
%
'
);
}
}
};
option
.
query
=
option
.
query
.
parse
();
};
// ERP5 REQUESTS //
/**
* Sends a request to ERP5
...
...
@@ -305,8 +346,7 @@ jIO.addStorageType("erp5", function (spec, my) {
if
(
complex_queries
!==
undefined
&&
method
===
'
allDocs
'
&&
option
.
query
)
{
option
.
query
=
complex_queries
.
QueryFactory
.
create
(
option
.
query
||
""
).
serialized
();
priv
.
convertToErp5Query
(
option
);
}
erp5
.
genericRequest
(
command
.
cloneDoc
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment