Kernel::System::FormDraft - draft lib
All draft functions.
create an object
use Kernel::System::ObjectManager; local $Kernel::OM = Kernel::System::ObjectManager->new(); my $FormDraftObject = $Kernel::OM->Get('Kernel::System::FormDraft');
get draft attributes
my $FormDraft = $FormDraftObject->FormDraftGet( FormDraftID => 123, GetContent => 1, # optional, default 1 UserID => 123, );
Returns (with GetContent = 0):
$FormDraft = { FormDraftID => 123, ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', CreateTime => '2016-04-07 15:41:15', CreateBy => 1, ChangeTime => '2016-04-07 15:59:45', ChangeBy => 2, };
Returns (without GetContent or GetContent = 1):
$FormDraft = { FormData => { InformUserID => [ 123, 124, ], Subject => 'Request for information', ... }, FileData => [ { 'Content' => 'Dear customer\n\nthank you!', 'ContentType' => 'text/plain', 'ContentID' => undef, # optional 'Filename' => 'thankyou.txt', 'Filesize' => 25, 'FileID' => 1, 'Disposition' => 'attachment', }, ... ], FormDraftID => 123, ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', CreateTime => '2016-04-07 15:41:15', CreateBy => 1, ChangeTime => '2016-04-07 15:59:45', ChangeBy => 2, Title => 'my draft', };
add a new draft
my $Success = $FormDraftObject->FormDraftAdd( FormData => { InformUserID => [ 123, 124, ], Subject => 'Request for information', ... }, FileData => [ # optional { 'Content' => 'Dear customer\n\nthank you!', 'ContentType' => 'text/plain', 'ContentID' => undef, # optional 'Filename' => 'thankyou.txt', 'Filesize' => 25, 'FileID' => 1, 'Disposition' => 'attachment', }, ... ], ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', Title => 'my draft', # optional UserID => 123, );
update an existing draft
my $Success = $FormDraftObject->FormDraftUpdate( FormData => { InformUserID => [ 123, 124, ], Subject => 'Request for information', ... }, FileData => [ # optional { 'Content' => 'Dear customer\n\nthank you!', 'ContentType' => 'text/plain', 'ContentID' => undef, # optional 'Filename' => 'thankyou.txt', 'Filesize' => 25, 'FileID' => 1, 'Disposition' => 'attachment', }, ... ], ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', Title => 'my draft', FormDraftID => 1, UserID => 123, );
remove draft
my $Success = $FormDraftObject->FormDraftDelete( FormDraftID => 123, UserID => 123, );
get list of drafts, optionally filtered by object type, object id and action
my $FormDraftList = $FormDraftObject->FormDraftListGet( ObjectType => 'Ticket', # optional ObjectID => 123, # optional Action => 'AgentTicketCompose', # optional UserID => 123, );
Returns:
$FormDraftList = [ { FormDraftID => 123, ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', Title => 'my draft', CreateTime => '2016-04-07 15:41:15', CreateBy => 1, ChangeTime => '2016-04-07 15:59:45', ChangeBy => 2, }, ... ];
remove all potentially affected caches
my $Success = $FormDraftObject->_DeleteAffectedCaches( FormDraftID => 1, # optional ObjectType => 'Ticket', ObjectID => 12, Action => 'AgentTicketCompose', );
This software is part of the OTRS project (https://otrs.org/).
This software comes with ABSOLUTELY NO WARRANTY. For details, see the enclosed file COPYING for license information (GPL). If you did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.