Merged colosa/processmaker into master
This commit is contained in:
@@ -4819,16 +4819,37 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText
|
||||
}
|
||||
}
|
||||
|
||||
$withHours = (strpos($mask, '%H') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false);
|
||||
$withHours = (strpos($mask, '%H') !== false || strpos($mask, '%I') !== false || strpos($mask, '%k') !== false || strpos($mask, '%l') !== false || strpos($mask, '%M') !== false || strpos($mask, '%S') !== false);
|
||||
|
||||
$tmp = str_replace( "%", "", $mask );
|
||||
return $this->date_create_from_format($tmp, $value, $withHours);
|
||||
}
|
||||
|
||||
/*
|
||||
//Year
|
||||
%Y year with the century
|
||||
%y year without the century (range 00 to 99)
|
||||
//Month
|
||||
%m month, range 01 to 12
|
||||
%B full month name
|
||||
%b abbreviated month name
|
||||
//Day
|
||||
%d the day of the month (range 01 to 31)
|
||||
%e the day of the month (range 1 to 31)
|
||||
//Hour
|
||||
%H hour, range 00 to 23 (24h format)
|
||||
%I hour, range 01 to 12 (12h format)
|
||||
%k hour, range 0 to 23 (24h format)
|
||||
%l hour, range 1 to 12 (12h format)
|
||||
//Min
|
||||
%M minute, range 00 to 59
|
||||
//Sec
|
||||
%S seconds, range 00 to 59
|
||||
*/
|
||||
function date_create_from_format( $dformat, $dvalue, $withHours = false )
|
||||
{
|
||||
$schedule = $dvalue;
|
||||
$schedule_format = str_replace(array('Y','m','d','H','M','S'),array('%Y','%m','%d','%H','%M','%S') ,$dformat);
|
||||
$schedule_format = str_replace(array('Y','y','m','B','b','d','e','H','I','k','l','M','S'),array('%Y','%y','%m','%B','%b','%d','%e','%H','%I','%k','%l','%M','%S') ,$dformat);
|
||||
$ugly = strptime($schedule, $schedule_format);
|
||||
$ymd = sprintf(
|
||||
'%04d-%02d-%02d %02d:%02d:%02d',
|
||||
|
||||
2
gulliver/thirdparty/creole/Creole.php
vendored
2
gulliver/thirdparty/creole/Creole.php
vendored
@@ -244,7 +244,7 @@ class Creole {
|
||||
try {
|
||||
$obj->connect($dsninfo, $flags);
|
||||
} catch(SQLException $sqle) {
|
||||
$sqle->setUserInfo($dsninfo);
|
||||
$sqle->setUserInfo((isset($dsninfo["username"]))? $dsninfo["username"] : "");
|
||||
throw $sqle;
|
||||
}
|
||||
$persistent = ($flags & Creole::PERSISTENT) === Creole::PERSISTENT;
|
||||
|
||||
@@ -6,6 +6,7 @@ class ConsolidatedCases
|
||||
{
|
||||
function saveConsolidated ($data)
|
||||
{
|
||||
$status = $data['con_status'];
|
||||
$sTasUid = $data['tas_uid'];
|
||||
$sDynUid = $data['dyn_uid'];
|
||||
$sProUid = $data['pro_uid'];
|
||||
@@ -14,11 +15,21 @@ class ConsolidatedCases
|
||||
$title = $data['title'];
|
||||
|
||||
if ($sRepTabUid != '') {
|
||||
if (!$status) {
|
||||
$oCaseConsolidated = new CaseConsolidated();
|
||||
$oCaseConsolidated = CaseConsolidatedPeer::retrieveByPK($sTasUid);
|
||||
if (!(is_object($oCaseConsolidated)) || get_class($oCaseConsolidated) != 'CaseConsolidated') {
|
||||
$oCaseConsolidated = new CaseConsolidated();
|
||||
$oCaseConsolidated->setTasUid($sTasUid);
|
||||
$oCaseConsolidated->setConStatus('INACTIVE');
|
||||
$oCaseConsolidated->save();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
$rptUid = null;
|
||||
$criteria = new Criteria();
|
||||
|
||||
$criteria->addSelectColumn(ReportTablePeer::REP_TAB_UID);
|
||||
$criteria->add(ReportTablePeer::REP_TAB_NAME, $tableName);
|
||||
$criteria->add(ReportTablePeer::REP_TAB_UID, $sRepTabUid);
|
||||
$rsCriteria = ReportTablePeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
@@ -39,6 +50,7 @@ class ConsolidatedCases
|
||||
@unlink($sPath . PATH_SEP . 'map' . PATH_SEP . $sClassName . 'MapBuilder.php');
|
||||
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . '.php');
|
||||
@unlink($sPath . PATH_SEP . 'om' . PATH_SEP . 'Base' . $sClassName . 'Peer.php');
|
||||
|
||||
$sRepTabUid = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -125,14 +125,18 @@ class pmDynaform
|
||||
if ($json->dbConnection !== "" && $json->dbConnection !== "none" && $json->sql !== "") {
|
||||
$cnn = Propel::getConnection($json->dbConnection);
|
||||
$stmt = $cnn->createStatement();
|
||||
$rs = $stmt->executeQuery(strtoupper($json->sql), \ResultSet::FETCHMODE_NUM);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
$option = array(
|
||||
"label" => isset($row[1]) ? $row[1] : $row[0],
|
||||
"value" => $row[0]
|
||||
);
|
||||
array_push($json->options, $option);
|
||||
try {
|
||||
$rs = $stmt->executeQuery($json->sql, \ResultSet::FETCHMODE_NUM);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
$option = array(
|
||||
"label" => isset($row[1]) ? $row[1] : $row[0],
|
||||
"value" => $row[0]
|
||||
);
|
||||
array_push($json->options, $option);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
if (isset($json->options[0])) {
|
||||
@@ -371,16 +375,11 @@ class pmDynaform
|
||||
public function synchronizeVariable($processUid, $newVariable, $oldVariable)
|
||||
{
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
|
||||
$criteria->add(DynaformPeer::PRO_UID, $processUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = DynaformPeer::doSelectRS($criteria);
|
||||
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$aRow = $rsCriteria->getRow();
|
||||
$json = G::json_decode($aRow['DYN_CONTENT']);
|
||||
@@ -415,10 +414,8 @@ class pmDynaform
|
||||
$json->name = $newVariable["VAR_NAME"];
|
||||
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"])
|
||||
$json->dbConnection = $newVariable["VAR_DBCONNECTION"];
|
||||
|
||||
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"])
|
||||
$json->sql = $newVariable["VAR_SQL"];
|
||||
|
||||
if (isset($json->options) && G::json_encode($json->options) === $oldVariable["VAR_ACCEPTED_VALUES"]) {
|
||||
$json->options = G::json_decode($newVariable["VAR_ACCEPTED_VALUES"]);
|
||||
}
|
||||
@@ -430,16 +427,11 @@ class pmDynaform
|
||||
public function isUsed($processUid, $variable)
|
||||
{
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
|
||||
$criteria->add(DynaformPeer::PRO_UID, $processUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = DynaformPeer::doSelectRS($criteria);
|
||||
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$aRow = $rsCriteria->getRow();
|
||||
$json = G::json_decode($aRow['DYN_CONTENT']);
|
||||
@@ -469,6 +461,210 @@ class pmDynaform
|
||||
return false;
|
||||
}
|
||||
|
||||
public function searchField($dyn_uid, $field_id)
|
||||
{
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->add(DynaformPeer::DYN_UID, $dyn_uid, Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$json = G::json_decode($row["DYN_CONTENT"]);
|
||||
return $this->jsonsf($json, $field_id);
|
||||
}
|
||||
|
||||
private function jsonsf(&$json, $id)
|
||||
{
|
||||
foreach ($json as $key => $value) {
|
||||
$sw1 = is_array($value);
|
||||
$sw2 = is_object($value);
|
||||
if ($sw1 || $sw2) {
|
||||
$val = $this->jsonsf($value, $id);
|
||||
if ($val !== null)
|
||||
return $val;
|
||||
}
|
||||
if (!$sw1 && !$sw2) {
|
||||
if ($key === "id" && $id === $value) {
|
||||
return $json;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function downloadLanguage($dyn_uid, $lang)
|
||||
{
|
||||
if ($lang === "en") {
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->add(DynaformPeer::DYN_UID, $dyn_uid, Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
if ($row["DYN_CONTENT"] !== null && $row["DYN_CONTENT"] !== "") {
|
||||
$json = \G::json_decode($row["DYN_CONTENT"]);
|
||||
$this->jsonl($json);
|
||||
}
|
||||
$string = "";
|
||||
$string = $string . "msgid \"\"\n";
|
||||
$string = $string . "msgstr \"\"\n";
|
||||
$string = $string . "\"Project-Id-Version: PM 4.0.1\\n\"\n";
|
||||
$string = $string . "\"POT-Creation-Date: \\n\"\n";
|
||||
$string = $string . "\"PO-Revision-Date: 2010-12-02 11:44+0100 \\n\"\n";
|
||||
$string = $string . "\"Last-Translator: Colosa<colosa@colosa.com>\\n\"\n";
|
||||
$string = $string . "\"Language-Team: Colosa Developers Team <developers@colosa.com>\\n\"\n";
|
||||
$string = $string . "\"MIME-Version: 1.0\\n\"\n";
|
||||
$string = $string . "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
|
||||
$string = $string . "\"Content-Transfer_Encoding: 8bit\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-Language: English\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-Country: United States\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-SourceCharset: utf-8\\n\"\n";
|
||||
$string = $string . "\"Content-Transfer-Encoding: 8bit\\n\"\n";
|
||||
$string = $string . "\"File-Name: processmaker.en.po\\n\"\n\n";
|
||||
|
||||
$n = count($this->dyn_conten_labels);
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$string = $string . "msgid \"" . $this->dyn_conten_labels[$i] . "\"\n";
|
||||
$string = $string . "msgstr \"" . $this->dyn_conten_labels[$i] . "\"\n\n";
|
||||
}
|
||||
return array("labels" => $string, "lang" => $lang);
|
||||
} else {
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
$a->add(DynaformPeer::DYN_UID, $dyn_uid, Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$data = G::json_decode($row["DYN_LABEL"]);
|
||||
$string = "";
|
||||
$string = $string . "msgid \"\"\n";
|
||||
$string = $string . "msgstr \"\"\n";
|
||||
foreach ($data->{$lang} as $key => $value) {
|
||||
if (is_string($value)) {
|
||||
$string = $string . "\"" . $key . ": " . $value . "\\n\"\n";
|
||||
}
|
||||
}
|
||||
$string = $string . "\n";
|
||||
foreach ($data->{$lang}->Labels as $key => $value) {
|
||||
$string = $string . "msgid \"" . $value->msgid . "\"\n";
|
||||
$string = $string . "msgstr \"" . $value->msgstr . "\"\n\n";
|
||||
}
|
||||
return array("labels" => $string, "lang" => $lang);
|
||||
}
|
||||
}
|
||||
|
||||
public function uploadLanguage($dyn_uid)
|
||||
{
|
||||
if (!isset($_FILES["LANGUAGE"])) {
|
||||
throw new Exception(G::LoadTranslation("ID_ERROR_UPLOADING_FILENAME"));
|
||||
}
|
||||
if (pathinfo($_FILES["LANGUAGE"]["name"], PATHINFO_EXTENSION) != "po") {
|
||||
throw new Exception(G::LoadTranslation("ID_FILE_UPLOAD_INCORRECT_EXTENSION"));
|
||||
}
|
||||
$translation = array();
|
||||
G::LoadSystem('i18n_po');
|
||||
$i18n = new i18n_PO($_FILES["LANGUAGE"]["tmp_name"]);
|
||||
$i18n->readInit();
|
||||
while ($rowTranslation = $i18n->getTranslation()) {
|
||||
array_push($translation, $rowTranslation);
|
||||
}
|
||||
$name = $_FILES["LANGUAGE"]["name"];
|
||||
$name = explode(".", $name);
|
||||
if (isset($name[1]) && isset($name[2]) && $name[1] . "." . $name[2] === "en.po") {
|
||||
return;
|
||||
}
|
||||
$content = $i18n->getHeaders();
|
||||
$content["File-Name"] = $_FILES["LANGUAGE"]["name"];
|
||||
$content["Labels"] = $translation;
|
||||
|
||||
$con = Propel::getConnection(DynaformPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
$oPro = DynaformPeer::retrieveByPk($dyn_uid);
|
||||
|
||||
$dyn_labels = new stdClass();
|
||||
if ($oPro->getDynLabel() !== null && $oPro->getDynLabel() !== "") {
|
||||
$dyn_labels = G::json_decode($oPro->getDynLabel());
|
||||
}
|
||||
$dyn_labels->$name[count($name) - 2] = $content;
|
||||
|
||||
$oPro->setDynLabel(G::json_encode($dyn_labels));
|
||||
$oPro->save();
|
||||
$con->commit();
|
||||
}
|
||||
|
||||
public function listLanguage($dyn_uid)
|
||||
{
|
||||
$list = array();
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
$a->add(DynaformPeer::DYN_UID, $dyn_uid, Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
|
||||
if ($row["DYN_LABEL"] === null || $row["DYN_LABEL"] === "") {
|
||||
return $list;
|
||||
}
|
||||
|
||||
$dyn_label = \G::json_decode($row["DYN_LABEL"]);
|
||||
foreach ($dyn_label as $key => $value) {
|
||||
array_push($list, array(
|
||||
"Lang" => $key,
|
||||
"File-Name" => isset($value->{"File-Name"}) ? $value->{"File-Name"} : "",
|
||||
"Project-Id-Version" => isset($value->{"Project-Id-Version"}) ? $value->{"Project-Id-Version"} : "",
|
||||
"POT-Creation-Date" => isset($value->{"POT-Creation-Date"}) ? $value->{"POT-Creation-Date"} : "",
|
||||
"PO-Revision-Date" => isset($value->{"PO-Revision-Date"}) ? $value->{"PO-Revision-Date"} : "",
|
||||
"Last-Translator" => isset($value->{"Last-Translator"}) ? $value->{"Last-Translator"} : "",
|
||||
"Language-Team" => isset($value->{"Language-Team"}) ? $value->{"Language-Team"} : "",
|
||||
"MIME-Version" => isset($value->{"MIME-Version"}) ? $value->{"MIME-Version"} : "",
|
||||
"Content-Type" => isset($value->{"Content-Type"}) ? $value->{"Content-Type"} : "",
|
||||
"Content-Transfer_Encoding" => isset($value->{"Content-Transfer_Encoding"}) ? $value->{"Content-Transfer_Encoding"} : "",
|
||||
"X-Poedit-Language" => isset($value->{"X-Poedit-Language"}) ? $value->{"X-Poedit-Language"} : "",
|
||||
"X-Poedit-Country" => isset($value->{"X-Poedit-Country"}) ? $value->{"X-Poedit-Country"} : "",
|
||||
"X-Poedit-SourceCharset" => isset($value->{"X-Poedit-SourceCharset"}) ? $value->{"X-Poedit-SourceCharset"} : "",
|
||||
"Content-Transfer-Encoding" => isset($value->{"Content-Transfer-Encoding"}) ? $value->{"Content-Transfer-Encoding"} : ""
|
||||
));
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
private $dyn_conten_labels = array();
|
||||
|
||||
private function jsonl(&$json)
|
||||
{
|
||||
foreach ($json as $key => $value) {
|
||||
$sw1 = is_array($value);
|
||||
$sw2 = is_object($value);
|
||||
if ($sw1 || $sw2) {
|
||||
$this->jsonl($value);
|
||||
}
|
||||
if (!$sw1 && !$sw2) {
|
||||
if ($key === "label") {
|
||||
$json->label;
|
||||
array_push($this->dyn_conten_labels, $json->label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteLanguage($dyn_uid, $lang)
|
||||
{
|
||||
$con = Propel::getConnection(DynaformPeer::DATABASE_NAME);
|
||||
$con->begin();
|
||||
$oPro = DynaformPeer::retrieveByPk($dyn_uid);
|
||||
|
||||
$dyn_labels = \G::json_decode($oPro->getDynLabel());
|
||||
unset($dyn_labels->{$lang});
|
||||
|
||||
$oPro->setDynLabel(G::json_encode($dyn_labels));
|
||||
$oPro->save();
|
||||
$con->commit();
|
||||
}
|
||||
|
||||
private function clientToken()
|
||||
{
|
||||
$client = $this->getClientCredentials();
|
||||
|
||||
@@ -1134,222 +1134,4 @@ class DynaForm
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* download file *.po
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $dynaFormUid Unique id of DynaForm
|
||||
*
|
||||
* return
|
||||
*/
|
||||
public function downloadLanguage($projectUid, $dynaFormUid, $lang)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \Dynaform();
|
||||
$arraydata = $dynaForm->Load($dynaFormUid);
|
||||
$data = \G::json_decode($arraydata["DYN_LABEL"]);
|
||||
$string = "";
|
||||
$string = $string . "msgid \"\"\n";
|
||||
$string = $string . "msgstr \"\"\n";
|
||||
foreach ($data->{$lang} as $key => $value) {
|
||||
if (is_string($value)) {
|
||||
$string = $string . "\"" . $key . ":" . $value . "\\n\"\n";
|
||||
}
|
||||
}
|
||||
$string = $string . "\n";
|
||||
foreach ($data->{$lang}->Labels as $key => $value) {
|
||||
$string = $string . "msgid \"" . $value->msgid . "\"\n";
|
||||
$string = $string . "msgstr \"" . $value->msgstr . "\"\n\n";
|
||||
}
|
||||
return array("labels" => $string, "lang" => $lang);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* upload file *.po
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $dynaFormUid Unique id of DynaForm
|
||||
*
|
||||
* return
|
||||
*/
|
||||
public function uploadLanguage($projectUid, $dynaFormUid)
|
||||
{
|
||||
try {
|
||||
if (isset($_FILES["LANGUAGE"]) && pathinfo($_FILES["LANGUAGE"]["name"], PATHINFO_EXTENSION) == "po") {
|
||||
$translation = array();
|
||||
\G::LoadSystem('i18n_po');
|
||||
$i18n = new \i18n_PO($_FILES["LANGUAGE"]["tmp_name"]);
|
||||
$i18n->readInit();
|
||||
while ($rowTranslation = $i18n->getTranslation()) {
|
||||
array_push($translation, $rowTranslation);
|
||||
}
|
||||
$name = $_FILES["LANGUAGE"]["name"];
|
||||
$name = explode(".", $name);
|
||||
$content = $i18n->getHeaders();
|
||||
$content["File-Name"] = $_FILES["LANGUAGE"]["name"];
|
||||
$content["Labels"] = $translation;
|
||||
|
||||
$dynaForm = new \Dynaform();
|
||||
$arraydata = $dynaForm->Load($dynaFormUid);
|
||||
|
||||
if ($arraydata["DYN_LABEL"] !== null && $arraydata["DYN_LABEL"] !== "") {
|
||||
$dyn_labels = \G::json_decode($arraydata["DYN_LABEL"]);
|
||||
} else {
|
||||
$dyn_labels = new \stdClass();
|
||||
}
|
||||
$dyn_labels->$name[count($name) - 2] = $content;
|
||||
|
||||
$arraydata["DYN_LABEL"] = \G::json_encode($dyn_labels);
|
||||
$dynaForm->update($arraydata);
|
||||
return $dyn_labels;
|
||||
} else {
|
||||
throw new \Exception(\G::LoadTranslation("ID_DYNAFORM_INCORRECT_FILE_NAME"));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list file .po
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $dynaFormUid Unique id of DynaForm
|
||||
*
|
||||
* return
|
||||
*/
|
||||
public function listLanguage($projectUid, $dynaFormUid)
|
||||
{
|
||||
try {
|
||||
$list = array();
|
||||
$dynaForm = new \Dynaform();
|
||||
$arraydata = $dynaForm->Load($dynaFormUid);
|
||||
|
||||
if ($arraydata["DYN_LABEL"] === null || $arraydata["DYN_LABEL"] === "")
|
||||
return $list;
|
||||
$dyn_labels = \G::json_decode($arraydata["DYN_LABEL"]);
|
||||
foreach ($dyn_labels as $key => $value) {
|
||||
array_push($list, array(
|
||||
"Lang" => $key,
|
||||
"File-Name" => isset($value->{"File-Name"}) ? $value->{"File-Name"} : "",
|
||||
"Project-Id-Version" => isset($value->{"Project-Id-Version"}) ? $value->{"Project-Id-Version"} : "",
|
||||
"POT-Creation-Date" => isset($value->{"POT-Creation-Date"}) ? $value->{"POT-Creation-Date"} : "",
|
||||
"PO-Revision-Date" => isset($value->{"PO-Revision-Date"}) ? $value->{"PO-Revision-Date"} : "",
|
||||
"Last-Translator" => isset($value->{"Last-Translator"}) ? $value->{"Last-Translator"} : "",
|
||||
"Language-Team" => isset($value->{"Language-Team"}) ? $value->{"Language-Team"} : "",
|
||||
"MIME-Version" => isset($value->{"MIME-Version"}) ? $value->{"MIME-Version"} : "",
|
||||
"Content-Type" => isset($value->{"Content-Type"}) ? $value->{"Content-Type"} : "",
|
||||
"Content-Transfer_Encoding" => isset($value->{"Content-Transfer_Encoding"}) ? $value->{"Content-Transfer_Encoding"} : "",
|
||||
"X-Poedit-Language" => isset($value->{"X-Poedit-Language"}) ? $value->{"X-Poedit-Language"} : "",
|
||||
"X-Poedit-Country" => isset($value->{"X-Poedit-Country"}) ? $value->{"X-Poedit-Country"} : "",
|
||||
"X-Poedit-SourceCharset" => isset($value->{"X-Poedit-SourceCharset"}) ? $value->{"X-Poedit-SourceCharset"} : "",
|
||||
"Content-Transfer-Encoding" => isset($value->{"Content-Transfer-Encoding"}) ? $value->{"Content-Transfer-Encoding"} : ""
|
||||
));
|
||||
}
|
||||
return $list;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* list file .po
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $dynaFormUid Unique id of DynaForm
|
||||
*
|
||||
* return
|
||||
*/
|
||||
public function downloadLabels($projectUid, $dynaFormUid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \Dynaform();
|
||||
$arraydata = $dynaForm->Load($dynaFormUid);
|
||||
if ($arraydata["DYN_CONTENT"] !== null && $arraydata["DYN_CONTENT"] !== "") {
|
||||
$json = \G::json_decode($arraydata["DYN_CONTENT"]);
|
||||
$this->jsonr($json);
|
||||
}
|
||||
$string = "";
|
||||
$string = $string . "msgid \"\"\n";
|
||||
$string = $string . "msgstr \"\"\n";
|
||||
$string = $string . "\"Project-Id-Version: PM 4.0.1\\n\"\n";
|
||||
$string = $string . "\"POT-Creation-Date: \\n\"\n";
|
||||
$string = $string . "\"PO-Revision-Date: 2010-12-02 11:44+0100 \\n\"\n";
|
||||
$string = $string . "\"Last-Translator: Colosa<colosa@colosa.com>\\n\"\n";
|
||||
$string = $string . "\"Language-Team: Colosa Developers Team <developers@colosa.com>\\n\"\n";
|
||||
$string = $string . "\"MIME-Version: 1.0\\n\"\n";
|
||||
$string = $string . "\"Content-Type: text/plain; charset=utf-8\\n\"\n";
|
||||
$string = $string . "\"Content-Transfer_Encoding: 8bit\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-Language: English\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-Country: United States\\n\"\n";
|
||||
$string = $string . "\"X-Poedit-SourceCharset: utf-8\\n\"\n";
|
||||
$string = $string . "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
|
||||
|
||||
$n = count($this->dyn_conten_labels);
|
||||
for ($i = 0; $i < $n; $i++) {
|
||||
$string = $string . "msgid \"" . $this->dyn_conten_labels[$i] . "\"\n";
|
||||
$string = $string . "msgstr \"" . $this->dyn_conten_labels[$i] . "\"\n\n";
|
||||
}
|
||||
return array("labels" => $string, "lang" => "en");
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
private $dyn_conten_labels = array();
|
||||
|
||||
/**
|
||||
* labels in dyn_content
|
||||
*
|
||||
* @param array $dyn_content
|
||||
*/
|
||||
private function jsonr(&$json)
|
||||
{
|
||||
foreach ($json as $key => $value) {
|
||||
$sw1 = is_array($value);
|
||||
$sw2 = is_object($value);
|
||||
if ($sw1 || $sw2) {
|
||||
$this->jsonr($value);
|
||||
}
|
||||
if (!$sw1 && !$sw2) {
|
||||
if ($key === "label") {
|
||||
$json->label;
|
||||
array_push($this->dyn_conten_labels, $json->label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete labels
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param string $dynaFormUid Unique id of DynaForm
|
||||
*
|
||||
* return
|
||||
*/
|
||||
public function deleteLanguage($projectUid, $dynaFormUid, $lang)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \Dynaform();
|
||||
$arraydata = $dynaForm->Load($dynaFormUid);
|
||||
|
||||
if ($arraydata["DYN_LABEL"] !== null && $arraydata["DYN_LABEL"] !== "") {
|
||||
$dyn_labels = \G::json_decode($arraydata["DYN_LABEL"]);
|
||||
unset($dyn_labels->{$lang});
|
||||
}
|
||||
|
||||
$arraydata["DYN_LABEL"] = \G::json_encode($dyn_labels);
|
||||
$dynaForm->update($arraydata);
|
||||
return;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -387,6 +387,7 @@ class Task
|
||||
G::LoadClass("consolidatedCases");
|
||||
$consolidated = new \ConsolidatedCases();
|
||||
$dataConso = array(
|
||||
'con_status' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_enable'],
|
||||
'tas_uid' => $arrayProperty['TAS_UID'],
|
||||
'dyn_uid' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_dynaform'],
|
||||
'pro_uid' => $arrayProperty['PRO_UID'],
|
||||
@@ -395,7 +396,6 @@ class Task
|
||||
'title' => $arrayProperty['CONSOLIDATE_DATA']['consolidated_title']
|
||||
);
|
||||
$consolidated->saveConsolidated($dataConso);
|
||||
|
||||
}
|
||||
$arrayResult["status"] = "OK";
|
||||
|
||||
|
||||
@@ -1060,7 +1060,7 @@ class User
|
||||
}
|
||||
}
|
||||
}
|
||||
$oCriteria->add(\UsersPeer::USR_STATUS, 'CLOSED', \Criteria::ALT_NOT_EQUAL);
|
||||
$oCriteria->add(\UsersPeer::USR_STATUS, "ACTIVE", \Criteria::EQUAL);
|
||||
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($oDataset->next()) {
|
||||
|
||||
@@ -494,30 +494,12 @@ class Variable
|
||||
$process->throwExceptionIfNotExistsProcess($processUid, strtolower("PRJ_UID"));
|
||||
|
||||
//Set data
|
||||
$variableDbConnectionUid = "";
|
||||
$variableSql = "";
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DBCONNECTION);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_SQL);
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_NAME, $variableName, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$variableDbConnectionUid = $row["VAR_DBCONNECTION"];
|
||||
$variableSql = strtoupper($row["VAR_SQL"]);
|
||||
} else {
|
||||
throw new \Exception(G::LoadTranslation("ID_PROCESS_VARIABLE_DOES_NOT_EXIST", array("VAR_NAME", $variableName)));
|
||||
}
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, $arrayVariable);
|
||||
|
||||
\G::LoadClass('pmDynaform');
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$field = $pmDynaform->searchField($arrayVariable["dyn_uid"], $arrayVariable["field_id"]);
|
||||
$variableDbConnectionUid = $field !== null ? $field->dbConnection : "";
|
||||
$variableSql = $field !== null ? $field->sql : "";
|
||||
|
||||
//Get data
|
||||
$_SESSION["PROCESS"] = $processUid;
|
||||
|
||||
@@ -533,7 +515,7 @@ class Variable
|
||||
|
||||
$arrayRecord[] = array(
|
||||
strtolower("VALUE") => $row[0],
|
||||
strtolower("TEXT") => $row[1]
|
||||
strtolower("TEXT") => isset($row[1]) ? $row[1] : $row[0]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +122,12 @@ class DynaForm extends Api
|
||||
public function doGetDynaFormLanguage($dyn_uid, $prj_uid, $lang)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$response = $dynaForm->downloadLanguage($prj_uid, $dyn_uid, $lang);
|
||||
return $response;
|
||||
\G::LoadClass('pmDynaform');
|
||||
$pmDynaform = new \pmDynaform();
|
||||
return $pmDynaform->downloadLanguage($dyn_uid, $lang);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,10 +139,9 @@ class DynaForm extends Api
|
||||
public function doPostDynaFormLanguage($dyn_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$response = $dynaForm->uploadLanguage($prj_uid, $dyn_uid);
|
||||
return $response;
|
||||
\G::LoadClass('pmDynaform');
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform->uploadLanguage($dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -158,10 +156,9 @@ class DynaForm extends Api
|
||||
public function doDeleteDynaFormLanguage($dyn_uid, $prj_uid, $lang)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$response = $dynaForm->deleteLanguage($prj_uid, $dyn_uid, $lang);
|
||||
return $response;
|
||||
\G::LoadClass('pmDynaform');
|
||||
$pmDynaform = new \pmDynaform();
|
||||
$pmDynaform->deleteLanguage($dyn_uid, $lang);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
@@ -176,33 +173,12 @@ class DynaForm extends Api
|
||||
public function doGetListDynaFormLanguage($dyn_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$response = $dynaForm->listLanguage($prj_uid, $dyn_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/dynaform/:dyn_uid/download-labels
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetListDynaFormLabels($dyn_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$response = $dynaForm->downloadLabels($prj_uid, $dyn_uid);
|
||||
return $response;
|
||||
\G::LoadClass('pmDynaform');
|
||||
$pmDynaform = new \pmDynaform();
|
||||
return $pmDynaform->listLanguage($dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user