PMC-885
This commit is contained in:
@@ -300,6 +300,24 @@ abstract class Importer
|
||||
$this->preserveEmailEventConfiguration($emailEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->importData["tables"]["workflow"]["dynaforms"])) {
|
||||
foreach ($this->importData["tables"]["workflow"]["dynaforms"] as &$dynaform) {
|
||||
$this->preserveDynaformId($dynaform);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->importData["tables"]["workflow"]["inputs"])) {
|
||||
foreach ($this->importData["tables"]["workflow"]["inputs"] as &$input) {
|
||||
$this->preserveInputDocumentId($input);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->importData["tables"]["workflow"]["outputs"])) {
|
||||
foreach ($this->importData["tables"]["workflow"]["outputs"] as &$output) {
|
||||
$this->preserveOutputDocumentId($output);
|
||||
}
|
||||
}
|
||||
|
||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
|
||||
if (sizeof($objectList) > 0 && $processGranulate) {
|
||||
@@ -602,6 +620,18 @@ abstract class Importer
|
||||
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
|
||||
$this->preserveEmailEventConfiguration($emailEvent);
|
||||
}
|
||||
|
||||
foreach ($arrayWorkflowTables["dynaforms"] as &$dynaform) {
|
||||
$this->preserveDynaformId($dynaform);
|
||||
}
|
||||
|
||||
foreach ($arrayWorkflowTables["inputs"] as &$input) {
|
||||
$this->preserveInputDocumentId($input);
|
||||
}
|
||||
|
||||
foreach ($arrayWorkflowTables["outputs"] as &$output) {
|
||||
$this->preserveOutputDocumentId($output);
|
||||
}
|
||||
|
||||
$this->importWfTables($arrayWorkflowTables);
|
||||
|
||||
@@ -862,6 +892,8 @@ abstract class Importer
|
||||
* Saves the current objects before import.
|
||||
*
|
||||
* @param string $proUid
|
||||
*
|
||||
* @see ProcessMaker\Importer\Importer::import()
|
||||
*/
|
||||
public function saveCurrentProcess($proUid)
|
||||
{
|
||||
@@ -873,9 +905,9 @@ abstract class Importer
|
||||
$result->tasks = $processes->getTaskRows($proUid);
|
||||
$result->abeConfigurations = $processes->getActionsByEmail($proUid);
|
||||
$result->emailEvents = $processes->getEmailEvent($proUid);
|
||||
$result->dynaforms = $processes->getDynaformRows($proUid);
|
||||
$result->inputs = $processes->getInputRows($proUid);
|
||||
$result->outputs = $processes->getOutputRows($proUid);
|
||||
$result->dynaforms = $processes->getDynaformRows($proUid, false);
|
||||
$result->inputs = $processes->getInputRows($proUid, false);
|
||||
$result->outputs = $processes->getOutputRows($proUid, false);
|
||||
|
||||
$this->setCurrentProcess($result);
|
||||
}
|
||||
@@ -948,4 +980,87 @@ abstract class Importer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore DYN_ID value for specific dynaform.
|
||||
* The value of __DYN_ID_UPDATE__ only used like a reference.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @see ProcessMaker\Importer\Importer::import()
|
||||
* @see ProcessMaker\Importer\Importer::doImport()
|
||||
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||
*/
|
||||
public function preserveDynaformId(&$data)
|
||||
{
|
||||
$currentProccess = $this->getCurrentProcess();
|
||||
if (!is_object($currentProccess)) {
|
||||
return;
|
||||
}
|
||||
if (!is_array($currentProccess->dynaforms)) {
|
||||
return;
|
||||
}
|
||||
foreach ($currentProccess->dynaforms as $dynaform) {
|
||||
if ($data["DYN_UID"] === $dynaform["DYN_UID"]) {
|
||||
$data["DYN_ID"] = $dynaform["DYN_ID"];
|
||||
$data["__DYN_ID_UPDATE__"] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore INP_DOC_ID value for specific input document.
|
||||
* The value of __INP_DOC_ID_UPDATE__ only used like a reference.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @see ProcessMaker\Importer\Importer::import()
|
||||
* @see ProcessMaker\Importer\Importer::doImport()
|
||||
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||
*/
|
||||
public function preserveInputDocumentId(&$data)
|
||||
{
|
||||
$currentProccess = $this->getCurrentProcess();
|
||||
if (!is_object($currentProccess)) {
|
||||
return;
|
||||
}
|
||||
if (!is_array($currentProccess->inputs)) {
|
||||
return;
|
||||
}
|
||||
foreach ($currentProccess->inputs as $inputDocument) {
|
||||
if ($data["INP_DOC_UID"] === $inputDocument["INP_DOC_UID"]) {
|
||||
$data["INP_DOC_ID"] = $inputDocument["INP_DOC_ID"];
|
||||
$data["__INP_DOC_ID_UPDATE__"] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore OUT_DOC_ID value for specific output document.
|
||||
* The value of __OUT_DOC_ID_UPDATE__ only used like a reference.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @see ProcessMaker\Importer\Importer::import()
|
||||
* @see ProcessMaker\Importer\Importer::doImport()
|
||||
* @link https://wiki.processmaker.com/3.1/Importing_and_Exporting_Projects#Importing_a_Project
|
||||
*/
|
||||
public function preserveOutputDocumentId(&$data)
|
||||
{
|
||||
$currentProccess = $this->getCurrentProcess();
|
||||
if (!is_object($currentProccess)) {
|
||||
return;
|
||||
}
|
||||
if (!is_array($currentProccess->outputs)) {
|
||||
return;
|
||||
}
|
||||
foreach ($currentProccess->outputs as $outputDocument) {
|
||||
if ($data["OUT_DOC_UID"] === $outputDocument["OUT_DOC_UID"]) {
|
||||
$data["OUT_DOC_ID"] = $outputDocument["OUT_DOC_ID"];
|
||||
$data["__OUT_DOC_ID_UPDATE__"] = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,13 @@ use Illuminate\Support\Facades\DB;
|
||||
class Dynaform extends Model
|
||||
{
|
||||
protected $table = 'DYNAFORM';
|
||||
protected $primaryKey = "DYN_ID";
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Return relation process.
|
||||
* @return object
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
|
||||
45
workflow/engine/src/ProcessMaker/Model/InputDocument.php
Normal file
45
workflow/engine/src/ProcessMaker/Model/InputDocument.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Represents a input document object in the system.
|
||||
*/
|
||||
class InputDocument extends Model
|
||||
{
|
||||
protected $table = 'INPUT_DOCUMENT';
|
||||
protected $primaryKey = 'INP_DOC_ID';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Return relation process.
|
||||
* @return object
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get input documents by PRO_UID
|
||||
* @param string $proUid
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public static function getByProUid($proUid)
|
||||
{
|
||||
return InputDocument::where('PRO_UID', '=', $proUid)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get input document by INP_DOC_UID
|
||||
* @param type $inpDocUid
|
||||
* @return Model
|
||||
*/
|
||||
public static function getByInpDocUid($inpDocUid)
|
||||
{
|
||||
return InputDocument::where('INP_DOC_UID', '=', $inpDocUid)->first();
|
||||
}
|
||||
}
|
||||
45
workflow/engine/src/ProcessMaker/Model/OutputDocument.php
Normal file
45
workflow/engine/src/ProcessMaker/Model/OutputDocument.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* Represents a output document object in the system.
|
||||
*/
|
||||
class OutputDocument extends Model
|
||||
{
|
||||
protected $table = 'OUTPUT_DOCUMENT';
|
||||
protected $primaryKey = 'OUT_DOC_ID';
|
||||
public $timestamps = false;
|
||||
|
||||
/**
|
||||
* Return relation process.
|
||||
* @return object
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
return $this->belongsTo(Process::class, 'PRO_UID', 'PRO_UID');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output documents by PRO_UID.
|
||||
* @param string $proUid
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public static function getByProUid($proUid)
|
||||
{
|
||||
return OutputDocument::where('PRO_UID', '=', $proUid)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get output document by OUT_DOC_UID.
|
||||
* @param string $outDocUid
|
||||
* @return Model
|
||||
*/
|
||||
public static function getByOutDocUid($outDocUid)
|
||||
{
|
||||
return OutputDocument::where('OUT_DOC_UID', '=', $outDocUid)->first();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user