Skip to content
Snippets Groups Projects
Commit 16677936 authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #33379: redmine fix after functional tests

parent 67eccf7f
Branches
Tags
7 merge requests!1553Master,!1502Master,!1501Stable,!1472Stable,!1409Stable,!1403Dev#33379 redmine create and edit ticket,!1401Dev#33379 redmine create and edit ticket
......@@ -12,7 +12,9 @@
<table>
<tr>
<td></td>
<td class="gauche"><pre style="font-family:inherit;font-size:130%"><?php echo $this->issue->getdescription(); ?><pre></td>
<td class="gauche"><pre style="font-family:inherit;font-size:130%;white-space:normal;">
<?php echo nl2br($this->issue->getdescription()); ?><pre>
</td>
</tr>
</table>
</fieldset>
......
......@@ -217,22 +217,12 @@ class ZendAfi_Form_Admin_Library extends ZendAfi_Form {
'renderPassword' => true,
'autocomplete' => 'off'])
->addElement('text',
'redmine_status',
['label' => $this->_('Tester la configuration')])
->addDisplayGroup(['redmine_login',
'redmine_password',
'redmine_api_key',
'redmine_status'],
'redmine_api_key'],
'redmine',
['legend' => $this->_('Configuration du compte Redmine')]);
$this->getElement('redmine_status')
->addDecorator('Redmine', ['view' => $this->getView(),
'library' => $this->getView()->bib]);
return $this;
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -31,8 +31,7 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
return (new static())
->initIssue($issue)
->initMultiOptions($service)
->initHeader()
->initDescription();
->initInputs();
}
......@@ -56,25 +55,45 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
}
protected function initHeader() {
$inputs = ['customer', 'status_id', 'priority', 'module', 'contact'];
protected function initInputs() {
if (!$this->_issue->getid()) {
array_unshift($inputs, 'subject');
$this
->addElement('text',
'subject',
['label' => $this->_('Sujet'),
'size' => 50,
'size' => 70,
'required' => true,
'allowEmpty' => false])
->addElement('textarea',
'description',
['label' => $this->_('Description'),
'rows' => 10,
'cols' => 70,
'required' => true,
'allowEmpty' => false]);
'allowEmpty' => false,
'value' => $this->getDefaultDescription()])
->addDisplayGroup(['subject', 'description'],
'common',
['legend' => ''])
;
}
if ($this->_issue->getid()) {
$this
->addElement('textarea', 'notes', ['rows' => 5, 'cols' => 100])
->addDisplayGroup(['notes'], 'default', ['legend' => $this->_('Nouvelle note')]);
}
$this->addStatus()
->addElement('text',
'customer',
['label' => $this->_('Client'),
'size' => 70,
'value' => $this->_issue->getCustomer() ? $this->_issue->getCustomer() : $this->getDefaultCustomer()])
->addElement('select',
......@@ -94,16 +113,13 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
->addElement('textarea',
'contact',
['label' => $this->_('Personne à contacter'),
'rows' => 2, 'cols' => 50,
'rows' => 2, 'cols' => 70,
'value' => $this->_issue->getContact() ? $this->_issue->getContact() : $this->getDefaultContact()])
->addDisplayGroup($inputs, 'header_group', ['legend' => $this->_('Propriétés')]);
if ($this->_issue->getid()) {
$this->addElement('textarea', 'notes', ['rows' => 5]);
$this->addDisplayGroup(['notes'], 'default', ['legend' => $this->_('Nouvelle note')]);
}
->addDisplayGroup(['customer', 'status_id', 'priority', 'module', 'contact'],
'properties',
['legend' => $this->_('Propriétés')]);
return $this;
}
......@@ -198,27 +214,6 @@ class ZendAfi_Form_Redmine_Issue extends ZendAfi_Form {
}
protected function initDescription() {
if ($this->_issue->getid())
return $this;
$this
->addElement('textarea',
'description',
['rows' => 10,
'required' => true,
'allowEmpty' => false,
'value' => $this->getDefaultDescription()])
->addDisplayGroup(['description'],
'description_group',
['legend' => $this->_('Description')])
;
return $this;
}
protected function getDefaultDescription() {
$datas = [$this->_('Url : ') . Class_Url::rootUrl() . Class_Url::baseUrl(),
$this->_('Version : ') . BOKEH_RELEASE_NUMBER . ' (' . BOKEH_VERSION . ')',
......
......@@ -79,7 +79,10 @@ class ZendAfi_View_Helper_RenderForm extends ZendAfi_View_Helper_BaseHelper {
protected function _decoratorsForTableRendering($element) {
$newDecorators = [];
$element->onkeypress = 'if (event.keyCode == 13) {this.form.submit();return false;}';
if ('formText' == $element->helper)
$element->onkeypress = 'if (event.keyCode == 13) {this.form.submit();return false;}';
$decorators = $element->getDecorators();
foreach ($decorators as $name => $decorator) {
$name = explode('_', $name);
......
......@@ -1283,23 +1283,6 @@ class BibControllerWithRemineAPITest extends BibControllerWithRedmineAPITestCase
public function anchorRedmineShouldBePresent() {
$this->assertXPath('//form//a[@name="redmine"]');
}
/** @test */
public function anchorTestApiSettingsShouldBePresent() {
$this->assertXPath('//a[contains(@href, "/admin/redmine/test/id_bib/2")][@data-popup="true"][@data-status="/admin/redmine/test/id_bib/2"]', $this->_response->getBody());
}
/** @test */
public function redmineJSShouldBeLoaded() {
$this->assertXPath('//script[contains(@src, "/opac/js/redmine.js")]');
}
/** @test */
public function redmineAutoRefreshShouldLoaded() {
$this->assertXPathContentContains('//script', '$("a.redmine_status").autoRefresh();');
}
}
......
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