diff --git a/VERSIONS_WIP/60288 b/VERSIONS_WIP/60288 new file mode 100644 index 0000000000000000000000000000000000000000..8e5a01428e0d8854aeca588fa3a120ba139889f6 --- /dev/null +++ b/VERSIONS_WIP/60288 @@ -0,0 +1 @@ + - ticket #60288 : Assistance : les informations techniques ne sont plus modifiables dans la description \ No newline at end of file diff --git a/library/Class/WebService/Redmine/Issue.php b/library/Class/WebService/Redmine/Issue.php index 25bc46db98f34ed1bc3bfe861ebf389ced566836..a415ab2e3a76a3553cf54662caebe9f2ac0af73a 100644 --- a/library/Class/WebService/Redmine/Issue.php +++ b/library/Class/WebService/Redmine/Issue.php @@ -21,6 +21,8 @@ class Class_WebService_Redmine_Issue extends Class_Entity { + use Trait_Translator; + public static function newWith($data) { $instance = new static(); $instance->updateAttributes($data); @@ -48,11 +50,23 @@ class Class_WebService_Redmine_Issue extends Class_Entity { public function getCreateParams() { return ['subject' => $this->_attribs['subject'], - 'description' => $this->_attribs['description'], + 'description' => $this->getTechnicalInformations() . "\n\n" . $this->_attribs['description'], '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() { return [['id' => Class_WebService_Redmine::CUSTOM_PRIORITY_ID, 'value' => $this->_attribs['priority']], diff --git a/library/ZendAfi/Form/Redmine/Issue.php b/library/ZendAfi/Form/Redmine/Issue.php index af2f6e2dcb7c4b316ae71d7a9924194785a58a67..4c902d8afdce9eb379a4cdeccc07d63976f6d1bb 100644 --- a/library/ZendAfi/Form/Redmine/Issue.php +++ b/library/ZendAfi/Form/Redmine/Issue.php @@ -37,7 +37,9 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { public function getValues() { $values = parent::getValues(); - $values['status'] = ['id' => $values['status_id']]; + $values['status'] = ['id' => isset($values['status_id']) + ? $values['status_id'] + : 1]; return $values; } @@ -72,6 +74,16 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { 'required' => true, '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', 'description', ['label' => $this->_('Description'), @@ -79,9 +91,10 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { 'cols' => 70, 'required' => true, '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', ['legend' => '']) ; @@ -202,14 +215,4 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form { 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 diff --git a/library/ZendAfi/View/Helper/Redmine/Header.php b/library/ZendAfi/View/Helper/Redmine/Header.php index ab8abaa2e86eed979d2e827dce25a7cdebbb92be..df6834e6b25eb2ff89045d2ce26813cb1bd236dd 100644 --- a/library/ZendAfi/View/Helper/Redmine/Header.php +++ b/library/ZendAfi/View/Helper/Redmine/Header.php @@ -36,13 +36,11 @@ class ZendAfi_View_Helper_Redmine_Header extends ZendAfi_View_Helper_BaseHelper return $this->shouldSelectLib(); $add_button = $user_info - ? $this->view->bouton('id=add_issue', - 'picto=add', - 'texte='.$this->_('Nouvelle demande'), - 'url=' . $this->view->url(['action' => 'add', - 'id' => null, - 'id_lib' => $library->getId()]), - 'largeur=250px;') + ? $this->view->button_New((new Class_Entity()) + ->setText($this->_('Nouvelle demande')) + ->setUrl($this->view->url(['action' => 'add', + 'id' => null, + 'id_lib' => $library->getId()]))) : ''; return $this->view->tag('p', $this->connectedThrough()) diff --git a/public/admin/skins/bokeh74/config.json b/public/admin/skins/bokeh74/config.json index ec94399f11f409aa9a8b5406b1f25c0d0eb511bf..dd261d49812b938a54510f0bf0a8f351105dd67b 100644 --- a/public/admin/skins/bokeh74/config.json +++ b/public/admin/skins/bokeh74/config.json @@ -62,7 +62,7 @@ "home": "icons/menu/home_24.png", "back_to_front": "icons/menu/site_24.png", "identity": "icons/menu/current_user_24.png", - "redmine": "icons/menu/support_24.png", + "redmine": "icons/menu/assistance_24.png", "logout": "icons/menu/logout_24.png", "books": "icons/menu/books_24.png", diff --git a/tests/application/modules/admin/controllers/RedmineControllerTest.php b/tests/application/modules/admin/controllers/RedmineControllerTest.php index 73044bcc5fd614f44d8774f53658fdfed67a5347..fcfdb19b818ff22b5152a01e5bebfdf4ae35fa0c 100644 --- a/tests/application/modules/admin/controllers/RedmineControllerTest.php +++ b/tests/application/modules/admin/controllers/RedmineControllerTest.php @@ -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 { protected $_update_params; @@ -676,6 +733,7 @@ class Admin_RedmineControllerAddIssueTest extends Admin_RedmineControllerFixture ['//select[@id="priority"]//option[@value="Normale"][@selected]'], ['//select[@id="module"]'], ['//textarea[@id="description"]'], + ['//textarea[@id="technical_informations"][@readonly][contains(text(), "Url :")]'], ['//textarea[@id="contact"]']]; }