wordsonline_connector-1.0.x-dev/src/WordsOnlineConst.php
src/WordsOnlineConst.php
<?php
namespace Drupal\wordsonline_connector;
/**
* All constant string.
*/
class WordsOnlineConst {
const API_URL = "https://api.wordsonline.com/v5/";
const JOB_NEW = "NEW";
const JOB_CREATED = "CREATED";
const JOB_ORDERED = "ORDERED";
const JOB_QUOTED = "QUOTED";
const JOB_CANCELLED = "CANCELLED";
const JOB_DELIVERED = "DELIVERED";
const JOB_IMPORTED = "IMPORTED";
const JOB_FINISHED = "FINISHED";
const JOB_AUTOMATION_FAILED = "AUTOMATION FAILED";
const CREATE_REQUEST_URL = 'requests';
const STATE_FINISHED = 5;
const VIEW_XLF_LINK = 'admin/tmgmt/view-xlf?job_id=';
const CONFIRM_ORDER_LINK = 'admin/tmgmt/wordsonline/wol-order?job_id=';
const NOT_AVAILABLE = 'N/A';
const GET_PROJECT_URL = 'Projects?projectId=';
const JOB_TABLE = 'wordsonline_connector_jobs';
const SELECT_CONFIG = 'SELECT * FROM wordsonline_connector_configs LIMIT 1';
const SEARCH_PLACEHOLDER = 'Search by request name, request id.';
const HELPDESK_MAIL = 'helpdesk@wordsonline.com';
const SUPPORT_LANG_URL = 'admin/tmgmt/wordsonline/support-languages';
const IMPORT_SUPPORT_LANG_URL = 'admin/tmgmt/wordsonline/import_support_languages';
const LANGUAGE_JOB_TABLE = 'wordsonline_connector_support_languges';
const UPLOAD_FOLDER = 'public://wordsonline_upload';
const MODULE_ID = 'wordsonline_connector';
const ALL_JOB_QUERY = "SELECT request_guid,job_id,status FROM wordsonline_connector_jobs order by job_id desc";
const ALL_JOB_FOR_FILTER_QUERY ="SELECT tjid FROM `tmgmt_job` j join wordsonline_connector_jobs w on w.job_id = j.tjid where w.project_guid=:prj_guid and j.state > 0";
const GET_WORDSONLINE_JOB_BY_JOB_ID_QUERY ="SELECT * FROM wordsonline_connector_jobs where job_id = :job_id LIMIT 1";
const DELETE_JOB_FILE_QUERY ="DELETE FROM wordsonline_connector_job_files WHERE job_id = :job_id AND job_item_id = :job_item_id LIMIT 1";
const GET_WORDSONLINE_SUPPORT_LANGUAGE_BY_CODE_QUERY ="SELECT code,lang_name,wol_code FROM wordsonline_connector_support_languges WHERE code =:code LIMIT 1 ";
const GET_ALL_WORDSONLINE_SUPPORT_LANGUAGES_QUERY ="SELECT code,lang_name,wol_code FROM wordsonline_connector_support_languges order by lang_name";
const GET_JOB_ITEM_HAS_TRANSLATED_QUERY ="SELECT ji.tjiid FROM `tmgmt_job` j JOIN `tmgmt_job_item` ji ON ji.tjid = j.tjid WHERE j.state = 5 AND j.job_type ='normal' AND j.source_language =:source_language AND j.target_language=:target_language AND ji.state =3 AND ji.item_id =:item_id ORDER BY ji.tjiid DESC LIMIT 1;";
}
/**
* Common message for module.
*/
class WordsOnlineMessage {
const NEW_ORDER_CREATED = "New order was created!";
const FAILED_TO_CREATE_NEW_ORDER = "Failed to create new order!";
const UNABLE_TO_CONNECT_SERVICES = 'Unable to connect to wordsonline service due to following error: @error';
const UNABLE_TO_CONNECT_SERVICES_WITH_URL = 'Unable to connect to the wordsonline service due to following error: @error at @url';
const AUTHEN_SAVED = 'The authentication data has been succesfully saved';
const AUTHEN_ERROR = 'Username or password is not correct.';
}
/**
* State of job from api.
*/
class WordsOnlineState {
const AUTOMATION_FAILED = 'AutomationFailed';
const QUOTE_SUBMITTED = 'QuoteSubmitted';
const PAYMENT_FAILED = 'PaymentFailed';
const PREPARINGQUOTE = 'Preparing Quote';
}
/**
* Status of job from api.
*/
class WordsOnlineStatus {
const IMPORTED_STATUS = 'Imported';
const IMPORT_FAIL_STATUS = 'ImportFailed';
const FINISHED_STATUS = 'Finished';
const DELIVERED = 'Delivered';
const UNPAID = 'In Your Cart';
const QUOTE_SUBMITTED = 'Quote Submitted';
const IMPORT_FAILED_STATUS = "Import Failed";
const IN_PROGRESS_STATUS = "In Progress";
const PREPARING_QUOTE="Preparing Quote";
}
