Merge branch 'master' of bitbucket.org:colosa/processmaker into CONSOLIDATED
This commit is contained in:
@@ -14,26 +14,22 @@ class pmDynaform
|
||||
public $fields = null;
|
||||
public $record = null;
|
||||
public $credentials = null;
|
||||
public $data = array();
|
||||
public $lang = null;
|
||||
public $langs = null;
|
||||
|
||||
public function __construct($fields)
|
||||
{
|
||||
$this->fields = $fields;
|
||||
if (count($fields) && count($fields['APP_DATA'])) {
|
||||
$this->getDynaform();
|
||||
$this->getCredentials();
|
||||
}
|
||||
$this->getDynaform();
|
||||
$this->getCredentials();
|
||||
if (isset($this->fields["APP_UID"])) {
|
||||
//current
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$this->data = $cases->getCaseVariables($this->fields["APP_UID"]);
|
||||
} else {
|
||||
//history
|
||||
$this->fields["APP_UID"] = null;
|
||||
if (isset($this->fields["APP_DATA"]))
|
||||
$this->data = $this->fields["APP_DATA"];
|
||||
if (isset($this->data["DYN_CONTENT_HISTORY"]))
|
||||
$this->record["DYN_CONTENT"] = $this->data["DYN_CONTENT_HISTORY"];
|
||||
if (isset($this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"]))
|
||||
$this->record["DYN_CONTENT"] = $this->fields["APP_DATA"]["DYN_CONTENT_HISTORY"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +40,7 @@ class pmDynaform
|
||||
}
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
@@ -53,6 +50,7 @@ class pmDynaform
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
$this->record = isset($row) ? $row : null;
|
||||
$this->langs = ($this->record["DYN_LABEL"] !== "" && $this->record["DYN_LABEL"] !== null) ? G::json_decode($this->record["DYN_LABEL"]) : null;
|
||||
return $this->record;
|
||||
}
|
||||
|
||||
@@ -87,8 +85,8 @@ class pmDynaform
|
||||
$prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
|
||||
if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) {
|
||||
$triggerValue = substr($value, 2);
|
||||
if (isset($this->app_data[$triggerValue])) {
|
||||
$json->$key = $this->app_data[$triggerValue];
|
||||
if (isset($this->fields["APP_DATA"][$triggerValue])) {
|
||||
$json->$key = $this->fields["APP_DATA"][$triggerValue];
|
||||
}
|
||||
}
|
||||
//query & options
|
||||
@@ -107,16 +105,18 @@ class pmDynaform
|
||||
$json->options = array();
|
||||
else {
|
||||
//convert stdClass to array
|
||||
$option = array();
|
||||
foreach ($json->options as $valueOptions) {
|
||||
array_push($option, array(
|
||||
"value" => $valueOptions->value,
|
||||
"label" => $valueOptions->label
|
||||
));
|
||||
if (is_array($json->options)) {
|
||||
$option = array();
|
||||
foreach ($json->options as $valueOptions) {
|
||||
array_push($option, array(
|
||||
"value" => $valueOptions->value,
|
||||
"label" => isset($valueOptions->label) ? $valueOptions->label : ""
|
||||
));
|
||||
}
|
||||
$json->options = $option;
|
||||
}
|
||||
$json->options = $option;
|
||||
}
|
||||
if ($json->dbConnection !== "none" && $json->sql !== "") {
|
||||
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);
|
||||
@@ -136,21 +136,21 @@ class pmDynaform
|
||||
//data
|
||||
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "suggest" || $value === "dropdown" || $value === "checkbox" || $value === "radio" || $value === "datetime")) {
|
||||
$json->data = array(
|
||||
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : $json->data["value"],
|
||||
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : $json->data["label"]
|
||||
"value" => isset($this->fields["APP_DATA"][$json->name]) ? $this->fields["APP_DATA"][$json->name] : (is_array($json->data) ? $json->data["value"] : $json->data->value),
|
||||
"label" => isset($this->fields["APP_DATA"][$json->name . "_label"]) ? $this->fields["APP_DATA"][$json->name . "_label"] : (is_array($json->data) ? $json->data["label"] : $json->data->label)
|
||||
);
|
||||
}
|
||||
if ($key === "type" && ($value === "checkbox")) {
|
||||
$json->data = array(
|
||||
"value" => isset($this->data[$json->name]) ? $this->data[$json->name] : array(),
|
||||
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "[]"
|
||||
"value" => isset($this->fields["APP_DATA"][$json->name]) ? $this->fields["APP_DATA"][$json->name] : array(),
|
||||
"label" => isset($this->fields["APP_DATA"][$json->name . "_label"]) ? $this->fields["APP_DATA"][$json->name . "_label"] : "[]"
|
||||
);
|
||||
}
|
||||
if ($key === "type" && ($value === "file") && isset($this->app_data["APPLICATION"])) {
|
||||
if ($key === "type" && ($value === "file") && isset($this->fields["APP_DATA"]["APPLICATION"])) {
|
||||
$oCriteria = new Criteria("workflow");
|
||||
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||
$oCriteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
|
||||
$oCriteria->add(AppDocumentPeer::APP_UID, $this->app_data["APPLICATION"]);
|
||||
$oCriteria->add(AppDocumentPeer::APP_UID, $this->fields["APP_DATA"]["APPLICATION"]);
|
||||
$oCriteria->add(AppDocumentPeer::APP_DOC_FIELDNAME, $json->name);
|
||||
$rs = AppDocumentPeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
@@ -161,14 +161,14 @@ class pmDynaform
|
||||
}
|
||||
$json->data = array(
|
||||
"value" => $links,
|
||||
"label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "[]"
|
||||
"label" => isset($this->fields["APP_DATA"][$json->name . "_label"]) ? $this->fields["APP_DATA"][$json->name . "_label"] : "[]"
|
||||
);
|
||||
}
|
||||
//grid
|
||||
if ($key === "type" && ($value === "grid")) {
|
||||
if (isset($this->data[$json->name])) {
|
||||
if (isset($this->fields["APP_DATA"][$json->name])) {
|
||||
//rows
|
||||
$rows = $this->data[$json->name];
|
||||
$rows = $this->fields["APP_DATA"][$json->name];
|
||||
foreach ($rows as $keyRow => $row) {
|
||||
//cells
|
||||
$cells = array();
|
||||
@@ -193,6 +193,24 @@ class pmDynaform
|
||||
$json->data = $rows;
|
||||
}
|
||||
}
|
||||
//languages
|
||||
if ($this->lang === null && $key === "language" && isset($json->language)) {
|
||||
$this->lang = $json->language;
|
||||
}
|
||||
if ($key === "label" && isset($json->label) && $this->langs !== null && isset($this->langs->{$this->lang})) {
|
||||
$langs = $this->langs->{$this->lang}->Labels;
|
||||
foreach ($langs as $langsValue) {
|
||||
if ($json->label === $langsValue->msgid)
|
||||
$json->label = $langsValue->msgstr;
|
||||
}
|
||||
}
|
||||
if ($key === "title" && isset($json->title) && $this->langs !== null && isset($this->langs->{$this->lang})) {
|
||||
$langs = $this->langs->{$this->lang}->Labels;
|
||||
foreach ($langs as $langsValue) {
|
||||
if ($json->title === $langsValue->msgid)
|
||||
$json->title = $langsValue->msgstr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,10 +262,6 @@ class pmDynaform
|
||||
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/pmdynaform.html');
|
||||
$file = str_replace("{javascript}", $javascrip, $file);
|
||||
echo $file;
|
||||
echo "<pre>";
|
||||
//echo print_r($this->fields, true);
|
||||
// echo print_r($this->data, true);
|
||||
echo "</pre>";
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@ class DynaformMapBuilder
|
||||
|
||||
$tMap->addColumn('DYN_CONTENT', 'DynContent', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('DYN_LABEL', 'DynLabel', 'string', CreoleTypes::LONGVARCHAR, false, null);
|
||||
|
||||
$tMap->addColumn('DYN_VERSION', 'DynVersion', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addValidator('DYN_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'xmlform|grid', 'Please select a valid dynaform type.');
|
||||
|
||||
@@ -57,6 +57,12 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
*/
|
||||
protected $dyn_content;
|
||||
|
||||
/**
|
||||
* The value for the dyn_label field.
|
||||
* @var string
|
||||
*/
|
||||
protected $dyn_label;
|
||||
|
||||
/**
|
||||
* The value for the dyn_version field.
|
||||
* @var int
|
||||
@@ -132,6 +138,17 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
return $this->dyn_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [dyn_label] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDynLabel()
|
||||
{
|
||||
|
||||
return $this->dyn_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [dyn_version] column value.
|
||||
*
|
||||
@@ -253,6 +270,28 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
|
||||
} // setDynContent()
|
||||
|
||||
/**
|
||||
* Set the value of [dyn_label] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return void
|
||||
*/
|
||||
public function setDynLabel($v)
|
||||
{
|
||||
|
||||
// Since the native PHP type for this column is string,
|
||||
// we will cast the input to a string (if it is not).
|
||||
if ($v !== null && !is_string($v)) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->dyn_label !== $v) {
|
||||
$this->dyn_label = $v;
|
||||
$this->modifiedColumns[] = DynaformPeer::DYN_LABEL;
|
||||
}
|
||||
|
||||
} // setDynLabel()
|
||||
|
||||
/**
|
||||
* Set the value of [dyn_version] column.
|
||||
*
|
||||
@@ -302,14 +341,16 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
|
||||
$this->dyn_content = $rs->getString($startcol + 4);
|
||||
|
||||
$this->dyn_version = $rs->getInt($startcol + 5);
|
||||
$this->dyn_label = $rs->getString($startcol + 5);
|
||||
|
||||
$this->dyn_version = $rs->getInt($startcol + 6);
|
||||
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
|
||||
// FIXME - using NUM_COLUMNS may be clearer.
|
||||
return $startcol + 6; // 6 = DynaformPeer::NUM_COLUMNS - DynaformPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
return $startcol + 7; // 7 = DynaformPeer::NUM_COLUMNS - DynaformPeer::NUM_LAZY_LOAD_COLUMNS).
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating Dynaform object", $e);
|
||||
@@ -529,6 +570,9 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
return $this->getDynContent();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getDynLabel();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getDynVersion();
|
||||
break;
|
||||
default:
|
||||
@@ -556,7 +600,8 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
$keys[2] => $this->getDynType(),
|
||||
$keys[3] => $this->getDynFilename(),
|
||||
$keys[4] => $this->getDynContent(),
|
||||
$keys[5] => $this->getDynVersion(),
|
||||
$keys[5] => $this->getDynLabel(),
|
||||
$keys[6] => $this->getDynVersion(),
|
||||
);
|
||||
return $result;
|
||||
}
|
||||
@@ -604,6 +649,9 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
$this->setDynContent($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setDynLabel($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setDynVersion($value);
|
||||
break;
|
||||
} // switch()
|
||||
@@ -650,7 +698,11 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[5], $arr)) {
|
||||
$this->setDynVersion($arr[$keys[5]]);
|
||||
$this->setDynLabel($arr[$keys[5]]);
|
||||
}
|
||||
|
||||
if (array_key_exists($keys[6], $arr)) {
|
||||
$this->setDynVersion($arr[$keys[6]]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -684,6 +736,10 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
$criteria->add(DynaformPeer::DYN_CONTENT, $this->dyn_content);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(DynaformPeer::DYN_LABEL)) {
|
||||
$criteria->add(DynaformPeer::DYN_LABEL, $this->dyn_label);
|
||||
}
|
||||
|
||||
if ($this->isColumnModified(DynaformPeer::DYN_VERSION)) {
|
||||
$criteria->add(DynaformPeer::DYN_VERSION, $this->dyn_version);
|
||||
}
|
||||
@@ -750,6 +806,8 @@ abstract class BaseDynaform extends BaseObject implements Persistent
|
||||
|
||||
$copyObj->setDynContent($this->dyn_content);
|
||||
|
||||
$copyObj->setDynLabel($this->dyn_label);
|
||||
|
||||
$copyObj->setDynVersion($this->dyn_version);
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class BaseDynaformPeer
|
||||
const CLASS_DEFAULT = 'classes.model.Dynaform';
|
||||
|
||||
/** The total number of columns. */
|
||||
const NUM_COLUMNS = 6;
|
||||
const NUM_COLUMNS = 7;
|
||||
|
||||
/** The number of lazy-loaded columns. */
|
||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||
@@ -46,6 +46,9 @@ abstract class BaseDynaformPeer
|
||||
/** the column name for the DYN_CONTENT field */
|
||||
const DYN_CONTENT = 'DYNAFORM.DYN_CONTENT';
|
||||
|
||||
/** the column name for the DYN_LABEL field */
|
||||
const DYN_LABEL = 'DYNAFORM.DYN_LABEL';
|
||||
|
||||
/** the column name for the DYN_VERSION field */
|
||||
const DYN_VERSION = 'DYNAFORM.DYN_VERSION';
|
||||
|
||||
@@ -60,10 +63,10 @@ abstract class BaseDynaformPeer
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
private static $fieldNames = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DynUid', 'ProUid', 'DynType', 'DynFilename', 'DynContent', 'DynVersion', ),
|
||||
BasePeer::TYPE_COLNAME => array (DynaformPeer::DYN_UID, DynaformPeer::PRO_UID, DynaformPeer::DYN_TYPE, DynaformPeer::DYN_FILENAME, DynaformPeer::DYN_CONTENT, DynaformPeer::DYN_VERSION, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('DYN_UID', 'PRO_UID', 'DYN_TYPE', 'DYN_FILENAME', 'DYN_CONTENT', 'DYN_VERSION', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DynUid', 'ProUid', 'DynType', 'DynFilename', 'DynContent', 'DynLabel', 'DynVersion', ),
|
||||
BasePeer::TYPE_COLNAME => array (DynaformPeer::DYN_UID, DynaformPeer::PRO_UID, DynaformPeer::DYN_TYPE, DynaformPeer::DYN_FILENAME, DynaformPeer::DYN_CONTENT, DynaformPeer::DYN_LABEL, DynaformPeer::DYN_VERSION, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('DYN_UID', 'PRO_UID', 'DYN_TYPE', 'DYN_FILENAME', 'DYN_CONTENT', 'DYN_LABEL', 'DYN_VERSION', ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -73,10 +76,10 @@ abstract class BaseDynaformPeer
|
||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
private static $fieldKeys = array (
|
||||
BasePeer::TYPE_PHPNAME => array ('DynUid' => 0, 'ProUid' => 1, 'DynType' => 2, 'DynFilename' => 3, 'DynContent' => 4, 'DynVersion' => 5, ),
|
||||
BasePeer::TYPE_COLNAME => array (DynaformPeer::DYN_UID => 0, DynaformPeer::PRO_UID => 1, DynaformPeer::DYN_TYPE => 2, DynaformPeer::DYN_FILENAME => 3, DynaformPeer::DYN_CONTENT => 4, DynaformPeer::DYN_VERSION => 5, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('DYN_UID' => 0, 'PRO_UID' => 1, 'DYN_TYPE' => 2, 'DYN_FILENAME' => 3, 'DYN_CONTENT' => 4, 'DYN_VERSION' => 5, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, )
|
||||
BasePeer::TYPE_PHPNAME => array ('DynUid' => 0, 'ProUid' => 1, 'DynType' => 2, 'DynFilename' => 3, 'DynContent' => 4, 'DynLabel' => 5, 'DynVersion' => 6, ),
|
||||
BasePeer::TYPE_COLNAME => array (DynaformPeer::DYN_UID => 0, DynaformPeer::PRO_UID => 1, DynaformPeer::DYN_TYPE => 2, DynaformPeer::DYN_FILENAME => 3, DynaformPeer::DYN_CONTENT => 4, DynaformPeer::DYN_LABEL => 5, DynaformPeer::DYN_VERSION => 6, ),
|
||||
BasePeer::TYPE_FIELDNAME => array ('DYN_UID' => 0, 'PRO_UID' => 1, 'DYN_TYPE' => 2, 'DYN_FILENAME' => 3, 'DYN_CONTENT' => 4, 'DYN_LABEL' => 5, 'DYN_VERSION' => 6, ),
|
||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -187,6 +190,8 @@ abstract class BaseDynaformPeer
|
||||
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_LABEL);
|
||||
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user