From f9ec4e30a05104a4b1b3595261a0f3ea8d105991 Mon Sep 17 00:00:00 2001 From: samverstraete Date: Sat, 21 Jan 2017 12:45:25 +0100 Subject: [PATCH] Update RestoreModel.php There's a situation where if $mergefilesets==0 and $mergejobs==1, the $cmd variable isn't set and code is executed, leading into an error trying to get jobids. The user shouldn't be able to select this situation, but I have tried this, and it can happen. I'm proposing a change in the if-structure so that $cmd is always correctly set. --- module/Restore/src/Restore/Model/RestoreModel.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/module/Restore/src/Restore/Model/RestoreModel.php b/module/Restore/src/Restore/Model/RestoreModel.php index c0a19f19..50e98ccd 100644 --- a/module/Restore/src/Restore/Model/RestoreModel.php +++ b/module/Restore/src/Restore/Model/RestoreModel.php @@ -91,15 +91,15 @@ public function getFiles(&$bsock=null, $jobid=null, $pathid=null) { public function getJobIds(&$bsock=null, $jobid=null, $mergefilesets=0, $mergejobs=0) { if(isset($bsock)) { - if($mergefilesets == 0 && $mergejobs == 0) { + if($mergefilesets == 1 && $mergejobs == 1) { + return $jobid; + } + if($mergefilesets == 0) { $cmd = '.bvfs_get_jobids jobid='.$jobid.' all'; } - elseif($mergefilesets == 1 && $mergejobs == 0) { + else { $cmd = '.bvfs_get_jobids jobid='.$jobid.''; } - elseif($mergefilesets == 1 && $mergejobs == 1) { - return $jobid; - } $result = $bsock->send_command($cmd, 2, null); $jobids = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY); if(!empty($jobids['result'])) {