Skip to content
Snippets Groups Projects
Commit ecacee6f authored by Laurent's avatar Laurent
Browse files

dev #60288 redmine issue: add technical informations

parent 5328e0b7
Branches
Tags
2 merge requests!2334Master,!2162Dev#60288 integration redmine ne pas rendre editable les infos techniques bokeh
Pipeline #1530 passed with stage
in 11 minutes
- ticket #60288 : Intégration Redmine : ne pas rendre éditable les infos techniques Bokeh - ticket #60288 : Assistance : les informations techniques ne sont plus modifiables dans la description
\ No newline at end of file \ No newline at end of file
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
class Class_WebService_Redmine_Issue extends Class_Entity { class Class_WebService_Redmine_Issue extends Class_Entity {
use Trait_Translator;
public static function newWith($data) { public static function newWith($data) {
$instance = new static(); $instance = new static();
$instance->updateAttributes($data); $instance->updateAttributes($data);
...@@ -48,11 +50,23 @@ class Class_WebService_Redmine_Issue extends Class_Entity { ...@@ -48,11 +50,23 @@ class Class_WebService_Redmine_Issue extends Class_Entity {
public function getCreateParams() { public function getCreateParams() {
return ['subject' => $this->_attribs['subject'], return ['subject' => $this->_attribs['subject'],
'description' => $this->_attribs['description'], 'description' => $this->getTechnicalInformations() . "\n\n" . $this->_attribs['description'],
'custom_fields' => $this->getCustomFieldsParams()]; 'custom_fields' => $this->getCustomFieldsParams()];
} }
public function getTechnicalInformations() {
$datas = [$this->_('Url : ') . Class_Url::rootUrl() . Class_Url::baseUrl(),
$this->_('Version : ') . BOKEH_RELEASE_NUMBER . ' (' . BOKEH_VERSION . ')',
$this->_('Navigateur : ') . Zend_Controller_Front::getInstance()->getRequest()->getHeader('User-Agent'),
$this->_('Base de données : ') . Zend_Db_Table::getDefaultAdapter()->getConfig()['dbname']];
return implode("\n", $datas);
}
protected function getCustomFieldsParams() { protected function getCustomFieldsParams() {
return [['id' => Class_WebService_Redmine::CUSTOM_PRIORITY_ID, return [['id' => Class_WebService_Redmine::CUSTOM_PRIORITY_ID,
'value' => $this->_attribs['priority']], 'value' => $this->_attribs['priority']],
......
...@@ -37,7 +37,9 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { ...@@ -37,7 +37,9 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
public function getValues() { public function getValues() {
$values = parent::getValues(); $values = parent::getValues();
$values['status'] = ['id' => $values['status_id']]; $values['status'] = ['id' => isset($values['status_id'])
? $values['status_id']
: 1];
return $values; return $values;
} }
...@@ -72,6 +74,16 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { ...@@ -72,6 +74,16 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
'required' => true, 'required' => true,
'allowEmpty' => false]) 'allowEmpty' => false])
->addElement('textarea',
'technical_informations',
['label' => $this->_('Informations techniques'),
'rows' => 4,
'cols' => 70,
'required' => false,
'readonly' => 'readonly',
'allowEmpty' => false,
'value' => $this->_issue->getTechnicalInformations()])
->addElement('textarea', ->addElement('textarea',
'description', 'description',
['label' => $this->_('Description'), ['label' => $this->_('Description'),
...@@ -79,9 +91,10 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { ...@@ -79,9 +91,10 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
'cols' => 70, 'cols' => 70,
'required' => true, 'required' => true,
'allowEmpty' => false, 'allowEmpty' => false,
'value' => $this->getDefaultDescription()]) 'value' => '',
'placeholder' => $this->_('Merci de préciser les différentes étapes pour reproduire le problème rencontré, l\'adresse de la page, si il faut être connecté avec un compte particulier')])
->addDisplayGroup(['subject', 'description'], ->addDisplayGroup(['subject', 'description', 'technical_informations'],
'common', 'common',
['legend' => '']) ['legend' => ''])
; ;
...@@ -202,14 +215,4 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { ...@@ -202,14 +215,4 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
return $this; return $this;
} }
protected function getDefaultDescription() {
$datas = [$this->_('Url : ') . Class_Url::rootUrl() . Class_Url::baseUrl(),
$this->_('Version : ') . BOKEH_RELEASE_NUMBER . ' (' . BOKEH_VERSION . ')',
$this->_('Navigateur : ') . Zend_Controller_Front::getInstance()->getRequest()->getHeader('User-Agent'),
$this->_('Base de données : ') . Zend_Db_Table::getDefaultAdapter()->getConfig()['dbname']];
return implode("\n", $datas);
}
} }
\ No newline at end of file
...@@ -574,6 +574,63 @@ class Admin_RedmineControllerEditIssue34248Test extends Admin_RedmineControllerF ...@@ -574,6 +574,63 @@ class Admin_RedmineControllerEditIssue34248Test extends Admin_RedmineControllerF
class Admin_RedmineControllerPostAddIssueTest extends Admin_RedmineControllerWithApiTestCase {
protected $_create_params;
public function setUp() {
parent::setUp();
$this->_redmine_api
->whenCalled('all')
->with(['project_id' => 123])
->answers([])
->whenCalled('create')
->answers([]);
$this->postDispatch('admin/redmine/add/id_lib/1',
['priority' => 'Normale',
'notes' => 'Change priority',
'subject' => 'there\'s a bug',
'description' => 'I think it does not work as expected',
'technical_informations' => 'pouet',
'module' => '',
'contact' => '']);
$this->_create_params = $this->_redmine_api->getFirstAttributeForLastCallOn('create');
}
/** @test */
public function descriptionFieldShouldContainsAsExpected() {
$this->assertContains('as expected',
$this->_create_params['description']);
}
/** @test */
public function descriptionFieldShouldContainsTechnicalInformations() {
$this->assertContains('Url : ',
$this->_create_params['description']);
}
/** @test */
public function descriptionFieldShouldContainsPouet() {
$this->assertNotContains('pouet',
$this->_create_params['description']);
}
/** @test */
public function createParamsFieldsShouldNotContainsTechnicalInformations() {
$this->assertNotContains('technical_informations', array_keys($this->_create_params));
}
}
class Admin_RedmineControllerPostEditIssue34247Test extends Admin_RedmineControllerWithApiTestCase { class Admin_RedmineControllerPostEditIssue34247Test extends Admin_RedmineControllerWithApiTestCase {
protected $_update_params; protected $_update_params;
...@@ -676,6 +733,7 @@ class Admin_RedmineControllerAddIssueTest extends Admin_RedmineControllerFixture ...@@ -676,6 +733,7 @@ class Admin_RedmineControllerAddIssueTest extends Admin_RedmineControllerFixture
['//select[@id="priority"]//option[@value="Normale"][@selected]'], ['//select[@id="priority"]//option[@value="Normale"][@selected]'],
['//select[@id="module"]'], ['//select[@id="module"]'],
['//textarea[@id="description"]'], ['//textarea[@id="description"]'],
['//textarea[@id="technical_informations"][@readonly][contains(text(), "Url :")]'],
['//textarea[@id="contact"]']]; ['//textarea[@id="contact"]']];
} }
......
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