PHP Class Ticket, glpi

Author: kspooner
Inheritance: extends AppModel
Datei anzeigen Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$computerfound Is a hardware found in getHardwareData / getFromDBwithData : hardware link to the job
$dohistory From CommonDBTM
$grouplinkclass
$hardwaredatas Hardware datas used by getFromDBwithData
$rightname
$supplierlinkclass
$userlinkclass From CommonITIL

Protected Properties

Property Type Description
$forward_entity_to
$userentity_oncreate

Public Methods

Method Description
addImagePaste ( ) : nothing Add image pasted to GLPI doc after ADD and before UPDATE of the item in the database
canAddFollowups ( ) : boolean Is the current user have right to add followups to the current ticket ?
canAddItem ( $type ) : rights Overloaded from commonDBTM
canAdminActors ( )
canApprove ( ) : boolean Is the current user have right to approve solution of the current ticket ?
canAssign ( )
canAssignToMe ( )
canCreateItem ( ) : boolean Is the current user have right to create the current ticket ?
canDelete ( )
canDeleteItem ( ) : boolean Is the current user have right to delete the current ticket ?
canMassiveAction ( $action, $field, $value )
canSolve ( ) : boolean Is the current user have right to solve the current ticket ?
canUpdate ( )
canUpdateItem ( ) : boolean Is the current user have right to update the current ticket ?
canView ( )
canViewItem ( ) : boolean Is the current user have right to show the current ticket ?
cleanDBonPurge ( )
cleanTagOrImage ( $content, $tags ) : htlm Delete tag or image from ticket content
computeTakeIntoAccountDelayStat ( ) Compute take into account stat of the current ticket
computeTco ( CommonDBTM $item ) : float Calculate Ticket TCO for an item
convertContentForNotification ( $content, $item ) : htlm Convert img or tag of ticket for notification mails
convertContentForTicket ( $content_html, $files, $tags ) : htlm Convert img of the collector for ticket
convertImageToTag ( $content_html, $force_update = false ) : htlm Convert image to tag
convertTagToImage ( $content_text, $force_update = false, $doc_data = [] ) : nothing Convert tag to image
countActiveTicketsForItem ( $itemtype, $items_id ) : integer Count active tickets for an hardware
countSolvedTicketsForItemLastDays ( $itemtype, $items_id, $days ) : integer Count solved tickets for an hardware last X days
cronAlertNotClosed ( $task ) : integer Cron for alert old tickets which are not solved
cronCloseTicket ( $task ) : integer Cron for ticket's automatic close
cronCreateInquest ( $task ) : integer Cron for ticketsatisfaction's automatic generated
cronInfo ( $name ) : arrray Give cron information
defineTabs ( $options = [] )
deleteSLT ( $id, $type, $delete_date ) : type Delete SLT for the ticket
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
dropdownType ( $name, $options = [] ) : string Dropdown of ticket type
filterTimeline ( )
getActiveOrSolvedLastDaysTicketsForItem ( $itemtype, $items_id, $days ) : integer Get active or solved tickets for an hardware last X days
getAdditionalDatas ( ) : nothing Retrieve data of the hardware linked to the ticket if exists
getAdditionalMenuContent ( )
getAdditionalMenuLinks ( )
getAdditionalMenuOptions ( )
getAllStatusArray ( $withmetaforsearch = false ) : an get the Ticket status list
getCalendar ( ) Get correct Calendar: Entity or Sla
getClosedStatusArray ( ) : an Get the ITIL object closed status list
getCommonLeftJoin ( )
getCommonSelect ( )
getDatasToAddSLT ( $slts_id, $entities_id, $date, $type ) : array Get Datas to be added for SLT add
getDefaultActor ( $type )
getDefaultActorRightSearch ( $type )
getDefaultSearchRequest ( ) Get default values to search engine to override
getDefaultValues ( $entity )
getForbiddenStandardMassiveAction ( )
getMenuShorcut ( )
getNewStatusArray ( ) : an Get the ITIL object new status list
getProcessStatusArray ( ) : an Get the ITIL object assign or plan status list
getReopenableStatusArray ( ) : an Get the ITIL object closed, solved or waiting status list
getRights ( $interface = 'central' )
getSearchOptions ( )
getSolvedStatusArray ( ) : an Get the ITIL object solved status list
getSpecificMassiveActions ( $checkitem = NULL )
getSpecificValueToDisplay ( $field, $values, array $options = [] )
getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] ) : string
getSplittedSubmitButtonHtml ( $tickets_id, $action = "add" )
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTicketActors ( )
getTicketTemplateToUse ( $force_template, $type, $itilcategories_id, $entities_id ) : ticket Get ticket template to use Use force_template first, then try on template define for type and category then use default template of active profile of connected user and then use default entity one
getTicketTypeName ( $value ) Get ticket type Name
getTimelineItems ( )
getTypeName ( $nb ) Name of the type
getTypes ( ) : array Get ticket types
getValueToSelect ( $field_id_or_search_options, $name = '', $values = '', $options = [] ) Select a field using standard system
manageSltLevel ( $slts_id ) Manage SLT level escalation
manageValidationAdd ( $input ) : nothing Manage Validation add from input
numberOfFollowups ( $with_private = 1 ) : followup Number of followups of the ticket
numberOfTasks ( $with_private = 1 ) : followup Number of tasks of the ticket
post_addItem ( )
post_updateItem ( $history = 1 )
pre_deleteItem ( )
pre_updateInDB ( )
prepareInputForAdd ( $input )
prepareInputForUpdate ( $input )
setRichTextContent ( $name, $content, $rand ) Convert simple text content to rich text content, init html editor
setSimpleTextContent ( $content ) Convert rich text content to simple text content
showCentralCount ( $foruser = false ) Get tickets count
showCentralList ( $start, $status = "process", $showgrouptickets = true )
showCentralNewList ( )
showDebug ( ) Display debug information for current object
showDocumentAddButton ( $size = 25 )
showForm ( $ID, $options = [] )
showFormHelpdesk ( $ID, $ticket_template = false ) : nothing Print the helpdesk form
showFormHelpdeskObserver ( $options = [] ) Display a single oberver selector
showListForItem ( CommonDBTM $item ) : nothing Display tickets for an item
showPreviewAssignAction ( $output )
showSubForm ( CommonDBTM $item, $id, $params )
showTimeline ( $rand )
showTimelineForm ( $rand )
showTimelineHeader ( )
showVeryShort ( $ID, $forcetab = '' )
sltAffect ( $type, &$input, $manual_slts_id ) SLT affect by rules : reset due_date and time_to_own Manual SLT defined : reset due date and time_to_own No manual SLT and due date defined : reset auto SLT
updateDateMod ( $ID, $no_stat_computation = false, $users_id_lastupdater ) Update date mod of the ticket

Method Details

addImagePaste() public method

Add image pasted to GLPI doc after ADD and before UPDATE of the item in the database
public addImagePaste ( ) : nothing
return nothing

canAddFollowups() public method

Is the current user have right to add followups to the current ticket ?
public canAddFollowups ( ) : boolean
return boolean

canAddItem() public method

Overloaded from commonDBTM
public canAddItem ( $type ) : rights
$type itemtype of object to add
return rights

canAdminActors() public method

public canAdminActors ( )

canApprove() public method

Is the current user have right to approve solution of the current ticket ?
public canApprove ( ) : boolean
return boolean

canAssign() public method

public canAssign ( )

canAssignToMe() public method

public canAssignToMe ( )

canCreateItem() public method

Is the current user have right to create the current ticket ?
public canCreateItem ( ) : boolean
return boolean

canDelete() static public method

static public canDelete ( )

canDeleteItem() public method

Is the current user have right to delete the current ticket ?
public canDeleteItem ( ) : boolean
return boolean

canMassiveAction() public method

See also: CommonDBTM::canMassiveAction()
public canMassiveAction ( $action, $field, $value )

canSolve() public method

Is the current user have right to solve the current ticket ?
public canSolve ( ) : boolean
return boolean

canUpdate() static public method

static public canUpdate ( )

canUpdateItem() public method

Is the current user have right to update the current ticket ?
public canUpdateItem ( ) : boolean
return boolean

canView() static public method

static public canView ( )

canViewItem() public method

Is the current user have right to show the current ticket ?
public canViewItem ( ) : boolean
return boolean

cleanDBonPurge() public method

public cleanDBonPurge ( )

cleanTagOrImage() public method

Delete tag or image from ticket content
public cleanTagOrImage ( $content, $tags ) : htlm
$content html content of input
$tags
return htlm content

computeTakeIntoAccountDelayStat() public method

Compute take into account stat of the current ticket

computeTco() static public method

Calculate Ticket TCO for an item
static public computeTco ( CommonDBTM $item ) : float
$item CommonDBTM CommonDBTM object of the item
return float

convertContentForNotification() public method

Convert img or tag of ticket for notification mails
public convertContentForNotification ( $content, $item ) : htlm
$content : html content of input
$item : item to store filenames and tags found for each image in $content
return htlm content

convertContentForTicket() static public method

Convert img of the collector for ticket
static public convertContentForTicket ( $content_html, $files, $tags ) : htlm
$content_html html content of input
$files array of filename
$tags array of image tag
return htlm content

convertImageToTag() public method

Convert image to tag
public convertImageToTag ( $content_html, $force_update = false ) : htlm
$content_html html content of input
$force_update force update of content in item (false by default
return htlm content

convertTagToImage() public method

Convert tag to image
public convertTagToImage ( $content_text, $force_update = false, $doc_data = [] ) : nothing
$content_text text content of input
$force_update force update of content in item (false by default
$doc_data array of filenames and tags
return nothing

countActiveTicketsForItem() public method

Count active tickets for an hardware
public countActiveTicketsForItem ( $itemtype, $items_id ) : integer
$itemtype string Item type
$items_id integer ID of the Item
return integer

countSolvedTicketsForItemLastDays() public method

Count solved tickets for an hardware last X days
public countSolvedTicketsForItemLastDays ( $itemtype, $items_id, $days ) : integer
$itemtype string Item type
$items_id integer ID of the Item
$days integer day number
return integer

cronAlertNotClosed() static public method

Cron for alert old tickets which are not solved
static public cronAlertNotClosed ( $task ) : integer
$task : crontask object
return integer (0 : nothing done - 1 : done)

cronCloseTicket() static public method

Cron for ticket's automatic close
static public cronCloseTicket ( $task ) : integer
$task : crontask object
return integer (0 : nothing done - 1 : done)

cronCreateInquest() static public method

Cron for ticketsatisfaction's automatic generated
static public cronCreateInquest ( $task ) : integer
$task : crontask object
return integer (0 : nothing done - 1 : done)

cronInfo() static public method

Give cron information
static public cronInfo ( $name ) : arrray
$name : task's name
return arrray of information

defineTabs() public method

public defineTabs ( $options = [] )

deleteSLT() public method

Delete SLT for the ticket
public deleteSLT ( $id, $type, $delete_date ) : type
$id
$type
$delete_date (default 0)
return type

displayTabContentForItem() static public method

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI

dropdownType() static public method

Dropdown of ticket type
static public dropdownType ( $name, $options = [] ) : string
$name select name
$options array of options: - value : integer / preselected value (default 0) - toadd : array / array of specific values to add at the begining - on_change : string / value to transmit to "onChange" - display : boolean / display or get string (default true)
return string id of the select

filterTimeline() public method

public filterTimeline ( )

getActiveOrSolvedLastDaysTicketsForItem() public method

Get active or solved tickets for an hardware last X days
public getActiveOrSolvedLastDaysTicketsForItem ( $itemtype, $items_id, $days ) : integer
$itemtype string Item type
$items_id integer ID of the Item
$days integer day number
return integer

getAdditionalDatas() public method

Retrieve data of the hardware linked to the ticket if exists
public getAdditionalDatas ( ) : nothing
return nothing : set computerfound to 1 if founded

getAdditionalMenuContent() static public method

See also: CommonGLPI::getAdditionalMenuContent()
static public getAdditionalMenuContent ( )

getAdditionalMenuOptions() static public method

See also: CommonGLPI::getAdditionalMenuOptions()
static public getAdditionalMenuOptions ( )

getAllStatusArray() static public method

get the Ticket status list
static public getAllStatusArray ( $withmetaforsearch = false ) : an
$withmetaforsearch boolean (false by default)
return an array

getCalendar() public method

Get correct Calendar: Entity or Sla
Since: 0.90.4
public getCalendar ( )

getClosedStatusArray() static public method

Get the ITIL object closed status list
static public getClosedStatusArray ( ) : an
return an array

getCommonLeftJoin() static public method

static public getCommonLeftJoin ( )

getCommonSelect() static public method

static public getCommonSelect ( )

getDatasToAddSLT() public method

Get Datas to be added for SLT add
public getDatasToAddSLT ( $slts_id, $entities_id, $date, $type ) : array
$slts_id SLT id
$entities_id entity ID of the ticket
$date begin date of the ticket
$type type of SLT
return array of datas to add in ticket

getDefaultActor() public method

See also: CommonITILObject::getDefaultActor()
public getDefaultActor ( $type )

getDefaultActorRightSearch() public method

See also: CommonITILObject::getDefaultActorRightSearch()
public getDefaultActorRightSearch ( $type )

getDefaultSearchRequest() static public method

Get default values to search engine to override
static public getDefaultSearchRequest ( )

getDefaultValues() static public method

static public getDefaultValues ( $entity )
$entity integer entities_id usefull is function called by cron (default 0)

getForbiddenStandardMassiveAction() public method

getMenuShorcut() static public method

See also: CommonGLPI::getMenuShorcut()
static public getMenuShorcut ( )

getNewStatusArray() static public method

Get the ITIL object new status list
static public getNewStatusArray ( ) : an
return an array

getProcessStatusArray() static public method

Get the ITIL object assign or plan status list
static public getProcessStatusArray ( ) : an
return an array

getReopenableStatusArray() static public method

Get the ITIL object closed, solved or waiting status list
static public getReopenableStatusArray ( ) : an
return an array

getRights() public method

See also: commonDBTM::getRights()
public getRights ( $interface = 'central' )

getSearchOptions() public method

public getSearchOptions ( )

getSolvedStatusArray() static public method

Get the ITIL object solved status list
static public getSolvedStatusArray ( ) : an
return an array

getSpecificMassiveActions() public method

See also: CommonDBTM::getSpecificMassiveActions()
public getSpecificMassiveActions ( $checkitem = NULL )

getSpecificValueToDisplay() static public method

static public getSpecificValueToDisplay ( $field, $values, array $options = [] )
$field
$values
$options array array

getSpecificValueToSelect() static public method

static public getSpecificValueToSelect ( $field, $name = '', $values = '', array $options = [] ) : string
$field
$name (default '')
$values (default '')
$options array array
return string

getSplittedSubmitButtonHtml() static public method

static public getSplittedSubmitButtonHtml ( $tickets_id, $action = "add" )
$tickets_id
$action (default 'add')

getTabNameForItem() public method

public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTicketActors() public method

public getTicketActors ( )

getTicketTemplateToUse() public method

Get ticket template to use Use force_template first, then try on template define for type and category then use default template of active profile of connected user and then use default entity one
public getTicketTemplateToUse ( $force_template, $type, $itilcategories_id, $entities_id ) : ticket
$force_template integer tickettemplate_id to used (case of preview for example) (default 0)
$type integer type of the ticket (default 0)
$itilcategories_id integer ticket category (default 0)
$entities_id integer (default -1)
return ticket template object

getTicketTypeName() static public method

Get ticket type Name
static public getTicketTypeName ( $value )
$value type ID

getTimelineItems() public method

public getTimelineItems ( )

getTypeName() static public method

Name of the type
static public getTypeName ( $nb )
$nb : number of item in the type (default 0)

getTypes() static public method

Get ticket types
static public getTypes ( ) : array
return array of types

getValueToSelect() public method

Select a field using standard system
public getValueToSelect ( $field_id_or_search_options, $name = '', $values = '', $options = [] )

manageSltLevel() public method

Manage SLT level escalation
public manageSltLevel ( $slts_id )
$slts_id

manageValidationAdd() public method

Manage Validation add from input
public manageValidationAdd ( $input ) : nothing
$input array : input array
return nothing

numberOfFollowups() public method

Number of followups of the ticket
public numberOfFollowups ( $with_private = 1 ) : followup
$with_private boolean : true : all followups / false : only public ones (default 1)
return followup count

numberOfTasks() public method

Number of tasks of the ticket
public numberOfTasks ( $with_private = 1 ) : followup
$with_private boolean : true : all ticket / false : only public ones (default 1)
return followup count

post_addItem() public method

public post_addItem ( )

post_updateItem() public method

public post_updateItem ( $history = 1 )

pre_deleteItem() public method

public pre_deleteItem ( )

pre_updateInDB() public method

public pre_updateInDB ( )

prepareInputForAdd() public method

public prepareInputForAdd ( $input )

prepareInputForUpdate() public method

public prepareInputForUpdate ( $input )

setRichTextContent() public method

Convert simple text content to rich text content, init html editor
public setRichTextContent ( $name, $content, $rand )
$name name of textarea
$content content to convert in html
$rand

setSimpleTextContent() public method

Convert rich text content to simple text content
public setSimpleTextContent ( $content )
$content : content to convert in html

showCentralCount() static public method

Get tickets count
static public showCentralCount ( $foruser = false )
$foruser boolean : only for current login user as requester (false by default)

showCentralList() static public method

static public showCentralList ( $start, $status = "process", $showgrouptickets = true )
$start
$status (default ''process)
$showgrouptickets (true by default)

showCentralNewList() static public method

static public showCentralNewList ( )

showDebug() public method

Display debug information for current object
public showDebug ( )

showDocumentAddButton() static public method

static public showDocumentAddButton ( $size = 25 )
$size (default 25)

showForm() public method

public showForm ( $ID, $options = [] )

showFormHelpdesk() public method

Print the helpdesk form
public showFormHelpdesk ( $ID, $ticket_template = false ) : nothing
$ID integer ID of the user who want to display the Helpdesk
$ticket_template boolean ticket template for preview : false if not used for preview (false by default)
return nothing (print the helpdesk)

showFormHelpdeskObserver() static public method

* @param $options array options for default values ($options of showActorAddFormOnCreate)
static public showFormHelpdeskObserver ( $options = [] )

showListForItem() static public method

Will also display tickets of linked items
static public showListForItem ( CommonDBTM $item ) : nothing
$item CommonDBTM CommonDBTM object
return nothing (display a table)

showPreviewAssignAction() static public method

static public showPreviewAssignAction ( $output )
$output

showSubForm() static public method

static public showSubForm ( CommonDBTM $item, $id, $params )
$item CommonDBTM
$id
$params

showTimeline() public method

public showTimeline ( $rand )
$rand

showTimelineForm() public method

public showTimelineForm ( $rand )
$rand

showTimelineHeader() public method

public showTimelineHeader ( )

showVeryShort() static public method

static public showVeryShort ( $ID, $forcetab = '' )
$ID
$forcetab string name of the tab to force at the display (default '')

sltAffect() public method

@since version 9.1
public sltAffect ( $type, &$input, $manual_slts_id )
$type
$input
$manual_slts_id

updateDateMod() public method

Update date mod of the ticket
public updateDateMod ( $ID, $no_stat_computation = false, $users_id_lastupdater )
$ID ID of the ticket
$no_stat_computation boolean do not cumpute take into account stat (false by default)
$users_id_lastupdater integer to force last_update id (default 0 = not used)

Property Details

$computerfound public_oe property

Is a hardware found in getHardwareData / getFromDBwithData : hardware link to the job
public $computerfound

$dohistory public_oe property

From CommonDBTM
public $dohistory

$forward_entity_to protected_oe static_oe property

protected static $forward_entity_to

$grouplinkclass public_oe property

public $grouplinkclass

$hardwaredatas public_oe property

Hardware datas used by getFromDBwithData
public $hardwaredatas

$rightname static_oe public_oe property

static public $rightname

$supplierlinkclass public_oe property

public $supplierlinkclass

$userentity_oncreate protected_oe property

protected $userentity_oncreate

$userlinkclass public_oe property

From CommonITIL
public $userlinkclass