128 lines
2.3 KiB
C++
Executable File
128 lines
2.3 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#include "readticket.h"
|
|
|
|
|
|
namespace Fun
|
|
{
|
|
|
|
ReadTicket::ReadTicket()
|
|
{
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ReadTicket::ReadTicketType()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("type", temp);
|
|
ticket->type = atoi(temp.c_str());
|
|
|
|
if( ticket->type >= system->mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
|
ticket->type = system->mounts.pmount->param[Mount::par_ticket_type].arg.size();
|
|
}
|
|
|
|
|
|
|
|
void ReadTicket::ReadTicketStatus()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("status", temp);
|
|
ticket->status = atoi(temp.c_str());
|
|
|
|
if( ticket->status >= system->mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
|
ticket->status = system->mounts.pmount->param[Mount::par_ticket_status].arg.size();
|
|
}
|
|
|
|
|
|
|
|
void ReadTicket::ReadTicketPriority()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("priority", temp);
|
|
ticket->priority = atoi(temp.c_str());
|
|
|
|
if( ticket->priority >= system->mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
|
ticket->priority = system->mounts.pmount->param[Mount::par_ticket_priority].arg.size();
|
|
}
|
|
|
|
|
|
|
|
void ReadTicket::ReadTicketCategory()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("category", temp);
|
|
ticket->category = atoi(temp.c_str());
|
|
|
|
if( ticket->category >= system->mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
|
ticket->category = system->mounts.pmount->param[Mount::par_ticket_category].arg.size();
|
|
}
|
|
|
|
|
|
void ReadTicket::ReadTicketExpected()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("expected", temp);
|
|
ticket->expected = atoi(temp.c_str());
|
|
|
|
if( ticket->expected >= system->mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
|
ticket->expected = system->mounts.pmount->param[Mount::par_ticket_expected].arg.size();
|
|
}
|
|
|
|
|
|
void ReadTicket::ReadTicketProgress()
|
|
{
|
|
static std::string temp;
|
|
|
|
request->PostVar("progress", temp);
|
|
int p = atoi(temp.c_str());
|
|
|
|
if( p < 0 )
|
|
p = 0;
|
|
|
|
if( p > 100 )
|
|
p = 100;
|
|
|
|
ticket->progress = p;
|
|
}
|
|
|
|
|
|
|
|
void ReadTicket::Read(System * psystem, Request * prequest, Ticket * pticket)
|
|
{
|
|
system = psystem;
|
|
request = prequest;
|
|
ticket = pticket;
|
|
|
|
ticket->parent_id = request->dir_tab.back()->id;
|
|
|
|
ReadTicketType();
|
|
ReadTicketStatus();
|
|
ReadTicketPriority();
|
|
ReadTicketCategory();
|
|
ReadTicketExpected();
|
|
ReadTicketProgress();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace
|