Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
0741df92
Commit
0741df92
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
Comments
parent
c7873e62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
process/Ticket_lib/process.js
+51
-5
51 additions, 5 deletions
process/Ticket_lib/process.js
with
51 additions
and
5 deletions
process/Ticket_lib/process.js
+
51
−
5
View file @
0741df92
...
...
@@ -13,6 +13,10 @@ import("Sql_lib");
* Tickets are in an extra Table 'TICKET' and the task table is joined to it. All tasks with type Ticket should be also in 'TICKET'.
* --> if you need all information for a Ticket, just select from TICKET left join TASK on TASK_ID = TASKID
*
* Note that all methods which do not need the ticket type are static.
*
* @param {String} pTicketType the Keyid of Keyword TicketType
*
* @class
*/
function
TicketUtils
(
pTicketType
)
...
...
@@ -20,11 +24,22 @@ function TicketUtils(pTicketType)
this
.
type
=
pTicketType
;
}
/**
* create new instance. You can also use normal constructor. This is just for convenience.
* TicketUtils.begin(vars.get("$field.TICKETTYPE"))
* ...
* @param {String} pTicketType the Keyid of Keyword TicketType
* @return {TicketUtils}
*/
TicketUtils
.
begin
=
function
(
pTicketType
)
{
return
new
TicketUtils
(
pTicketType
);
}
/**
* get the icon for the status. (from Keyword attributes)
* @return {String} pStatus
*/
TicketUtils
.
getStatusIcon
=
function
(
pStatus
)
{
return
TaskUtils
.
getStatusIcon
(
pStatus
);
...
...
@@ -39,8 +54,8 @@ TicketUtils.getStatusIcon = function(pStatus)
*/
TicketUtils
.
addLinkRecords
=
function
(
pObjectIdField
,
pRowIdField
,
pAdditionalLinksField
,
pParentContextField
,
pParentIdField
)
{
throw
Error
(
"
Not
fully
implemented yet
"
);
TaskUtils
.
addLinkRecords
(
pObjectIdField
,
pRowIdField
,
pAdditionalLinksField
,
pParentContextField
,
pParentIdField
,
"
Links
"
);
throw
Error
(
"
Not implemented yet
"
);
//
TaskUtils.addLinkRecords(pObjectIdField, pRowIdField, pAdditionalLinksField, pParentContextField, pParentIdField, "Links");
}
/**
...
...
@@ -52,7 +67,11 @@ TicketUtils.prototype.createNewTicket = function(pRowId, pAdditionalLinks, pPare
}
/**
* check if an object has tickets
* check if an object has tickets (of current ticket type)
* @param {String} pRowId
* @param {String} pObjectType
*
* @return {Boolean} true, if object is linked with at least one ticket of the given TicketType
*/
TicketUtils
.
prototype
.
hasTickets
=
function
(
pRowId
,
pObjectType
)
{
...
...
@@ -71,17 +90,32 @@ TicketUtils.prototype.hasTickets = function(pRowId, pObjectType)
return
true
;
}
/**
* Check if the given TicketType has attributes. (stored as keyword attribute as json array containing AtributeIds)
*
* @return {Boolean} true if the type has attributes
*/
TicketUtils
.
prototype
.
typeHasAttributes
=
function
()
{
return
this
.
getTypeAttributes
().
length
>
0
;
}
/**
* Get all possible attributes for the given TicketType. (stored as keyword attribute as json array containing AtributeIds)
*
* @return {String[]} all possible attributes (or attribute groups) of a TicketType
*/
TicketUtils
.
prototype
.
getTypeAttributes
=
function
()
{
logging
.
log
(
this
.
type
+
"
a
"
+
JSON
.
parse
(
KeywordUtils
.
getAttributeRelation
(
this
.
type
,
$KeywordRegistry
.
ticketType
(),
"
attributes
"
,
"
[]
"
)).
toSource
())
return
JSON
.
parse
(
KeywordUtils
.
getAttributeRelation
(
this
.
type
,
$KeywordRegistry
.
ticketType
(),
"
attributes
"
,
"
[]
"
));
}
/**
* Get list of all available Status.
* Alle Tasks and Tickets use the same Status Keyword. This enables to use a group by / search over the full Task-table
*
* @return {String[]|null} all status keyids stored as keywordattribute of the TicketType keyword. Or null if the keywordattribute doesn't exist
*/
TicketUtils
.
prototype
.
getAvailableStatus
=
function
()
{
states
=
JSON
.
parse
(
KeywordUtils
.
getAttributeRelation
(
this
.
type
,
$KeywordRegistry
.
ticketType
(),
"
availableStatus
"
,
""
))
...
...
@@ -91,11 +125,21 @@ TicketUtils.prototype.getAvailableStatus = function()
return
states
.
map
(
TicketUtils
.
_toChar36
);
}
/**
* Get the default status stored as keywordattribute of the TicketType keyword.
*
* @return {String} the Keyid of the default status
*/
TicketUtils
.
prototype
.
getDefaultStatus
=
function
()
{
return
TicketUtils
.
_toChar36
(
KeywordUtils
.
getAttributeRelation
(
this
.
type
,
$KeywordRegistry
.
ticketType
(),
"
defaultStatus
"
,
""
));
}
/**
* Get the default priority for the tickettype.
*
* @return {String} the keyid of the default priority
*/
TicketUtils
.
prototype
.
getDefaultPriority
=
function
()
{
// Imporant: if you would like to change priority/ add or remove possible priorities
...
...
@@ -104,8 +148,10 @@ TicketUtils.prototype.getDefaultPriority = function()
return
$KeywordRegistry
.
taskPriority
$low
();
}
/**
* converts a string to a string of always 36 chars. Whitespaces are added at the end if needed.
*/
TicketUtils
.
_toChar36
=
function
(
pValue
)
{
logging
.
log
(
pValue
)
return
(
pValue
+
"
"
).
slice
(
0
,
36
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment