Fix redmine search

parent 2d5f1eca
...@@ -52,9 +52,20 @@ class SupportController extends Controller ...@@ -52,9 +52,20 @@ class SupportController extends Controller
$user = $client->user->getCurrentUser(); $user = $client->user->getCurrentUser();
$models = $client->issue->all([ $params = [
'author_id' => $user['user']['id'], 'author_id' => $user['user']['id'],
];
if(Yii::$app->request->get('s'))
{
$params = ArrayHelper::merge($params, [
'f[]' => 'subject',
'op[subject]' => '~',
'v[subject][]' => Yii::$app->request->get('s'),
]); ]);
}
$models = $client->issue->all($params);
return $this->render('index', [ return $this->render('index', [
'models' => $models, 'models' => $models,
......
...@@ -6,9 +6,10 @@ use common\models\Settings; ...@@ -6,9 +6,10 @@ use common\models\Settings;
class IssueHelper class IssueHelper
{ {
public static function sort($issues) public static function sort($issues = null)
{
if($issues)
{ {
$settings = [ $settings = [
[ [
'statuses' => explode(',', Settings::getValue('support-status-work')), 'statuses' => explode(',', Settings::getValue('support-status-work')),
...@@ -48,4 +49,7 @@ class IssueHelper ...@@ -48,4 +49,7 @@ class IssueHelper
return $settings; return $settings;
} }
return null;
}
} }
\ No newline at end of file
...@@ -64,8 +64,8 @@ use common\modules\support\models\redmine\IssueHelper; ...@@ -64,8 +64,8 @@ use common\modules\support\models\redmine\IssueHelper;
<td class="no_pad"> <td class="no_pad">
<?php <?php
$issues = IssueHelper::sort($models['issues']); if($issues = IssueHelper::sort($models['issues']))
{
foreach ($issues as $issue) foreach ($issues as $issue)
{ {
if(!isset($issue['close'])) if(!isset($issue['close']))
...@@ -77,6 +77,7 @@ use common\modules\support\models\redmine\IssueHelper; ...@@ -77,6 +77,7 @@ use common\modules\support\models\redmine\IssueHelper;
$accepteds = $issue['models']; $accepteds = $issue['models'];
} }
} }
}
?> ?>
</td> </td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment