Skip to content

Commit

Permalink
WIP: Finishing file import
Browse files Browse the repository at this point in the history
  • Loading branch information
dasistwas committed Oct 15, 2023
1 parent ed3d112 commit 0a968ba
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
16 changes: 9 additions & 7 deletions rule/ftpsyncfiles/rule_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class datalynx_rule_ftpsyncfiles extends datalynx_rule_base {
* @var mixed
*/
private array $sftpsetting;
private int $filefieldid;
private ?int $filefieldid;
private array $files;

/**
Expand All @@ -86,12 +86,14 @@ class datalynx_rule_ftpsyncfiles extends datalynx_rule_base {
*/
public function __construct($df = 0, $rule = 0) {
parent::__construct($df, $rule);
$this->sftpsetting = unserialize($this->rule->param2);
$this->sftpserver = $this->sftpsetting['sftpserver'];
$this->sftpport = $this->sftpsetting['sftpport'];
$this->sftpusername = $this->sftpsetting['sftpusername'];
$this->sftppassword = $this->sftpsetting['sftppassword'];
$this->sftppath = $this->sftpsetting['sftppath'];
if (isset($this->rule->param2)) {
$this->sftpsetting = unserialize($this->rule->param2);
$this->sftpserver = $this->sftpsetting['sftpserver'];
$this->sftpport = $this->sftpsetting['sftpport'];
$this->sftpusername = $this->sftpsetting['sftpusername'];
$this->sftppassword = $this->sftpsetting['sftppassword'];
$this->sftppath = $this->sftpsetting['sftppath'];
}
$this->matchingfield = $this->rule->param7;
$this->teammemberfieldid = $this->rule->param8;
$this->authorid = $this->rule->param9;
Expand Down
32 changes: 17 additions & 15 deletions rule/ftpsyncfiles/rule_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,23 @@ public function data_preprocessing(&$data) {
/**
*/
public function set_data($data) {
$sftpsetting = unserialize($data->param2);
if (isset($sftpsetting['sftpserver'])) {
$data->sftpserver = $sftpsetting['sftpserver'];
}
if (isset($sftpsetting['sftpport'])) {
$data->sftpport = $sftpsetting['sftpport'];
}
if (isset($sftpsetting['sftpusername'])) {
$data->sftpusername = $sftpsetting['sftpusername'];
}
if (isset($sftpsetting['sftppassword'])) {
$data->sftppassword = $sftpsetting['sftppassword'];
}
if (isset($sftpsetting['sftppath'])) {
$data->sftppath = $sftpsetting['sftppath'];
if (!empty($data->param2)) {
$sftpsetting = unserialize($data->param2);
if (isset($sftpsetting['sftpserver'])) {
$data->sftpserver = $sftpsetting['sftpserver'];
}
if (isset($sftpsetting['sftpport'])) {
$data->sftpport = $sftpsetting['sftpport'];
}
if (isset($sftpsetting['sftpusername'])) {
$data->sftpusername = $sftpsetting['sftpusername'];
}
if (isset($sftpsetting['sftppassword'])) {
$data->sftppassword = $sftpsetting['sftppassword'];
}
if (isset($sftpsetting['sftppath'])) {
$data->sftppath = $sftpsetting['sftppath'];
}
}
parent::set_data($data);
}
Expand Down

0 comments on commit 0a968ba

Please sign in to comment.