diff --git a/VERSIONS_HOTLINE/222323 b/VERSIONS_HOTLINE/222323 new file mode 100644 index 0000000000000000000000000000000000000000..3f32f20f525636b2d0903396175a62a34fd5933c --- /dev/null +++ b/VERSIONS_HOTLINE/222323 @@ -0,0 +1 @@ + - correctif #222323 : Administration : Assistance : Les dates sont maintenant affichées au bon format. \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Redmine/IssueJournal.php b/library/ZendAfi/View/Helper/Redmine/IssueJournal.php index a30273dd9209c67b6182a1b6eb526f70603aa828..e6e65a3cc69c2184afabcc289e4c87b6276bc087 100644 --- a/library/ZendAfi/View/Helper/Redmine/IssueJournal.php +++ b/library/ZendAfi/View/Helper/Redmine/IssueJournal.php @@ -70,10 +70,14 @@ class ZendAfi_View_Helper_Redmine_IssueJournal extends ZendAfi_View_Helper_BaseH } - protected function renderDate($event) { - $time = Class_Date::parseTimeWithFormat($event['created_on'], "yyyy-MM-ee'T'HH:mm:ss'Z'"); - - return $this->_tag('td', Class_Date::timestampToFormat($time, "ee/MM/yyyy 'à ' HH:mm:ss")); + protected function renderDate(array $event): string + { + $time = Class_Date::parseTimeWithFormat($event['created_on'], + "yyyy-MM-dd'T'HH:mm:ss'Z'"); + + return $this->_tag('td', + Class_Date::timestampToFormat($time, + "dd/MM/yyyy 'à ' HH:mm:ss")); } diff --git a/library/ZendAfi/View/Helper/Redmine/Issues.php b/library/ZendAfi/View/Helper/Redmine/Issues.php index ef5cb801c4bb8f112f49b032a20e0ea3fcf28845..543b631db18f89218e0638498e607ae981f1af6e 100644 --- a/library/ZendAfi/View/Helper/Redmine/Issues.php +++ b/library/ZendAfi/View/Helper/Redmine/Issues.php @@ -20,13 +20,13 @@ */ -class ZendAfi_View_Helper_Redmine_Issues extends ZendAfi_View_Helper_BaseHelper { - /** - * @param $library Class_Bib - * @param $issues Class_WebService_Redmine_Issues - */ - public function Redmine_Issues($library, $issues) { - if (!Class_AdminVar::isRedmineEnabled() || !$issues) +class ZendAfi_View_Helper_Redmine_Issues extends ZendAfi_View_Helper_BaseHelper +{ + + public function Redmine_Issues(Class_Bib $library, + Class_WebService_Redmine_Issues $issues): string + { + if ( ! Class_AdminVar::isRedmineEnabled() || ! $issues || $issues->isEmpty()) return ''; $script_loader = Class_ScriptLoader::getInstance() @@ -41,11 +41,10 @@ return $this->_tag('div', ['id' => 'issues_list']); } - - protected function renderIssues($library, $issues, $label) { - if (!$issues) - return ''; - + protected function renderIssues(Class_Bib $library, + Class_WebService_Redmine_Issues $issues, + string $label): string + { $editAction = fn($issue) => $this->view->tagAnchor(['module' => 'admin', 'controller' => 'redmine', 'action' => 'edit-issue', @@ -55,13 +54,12 @@ return $this->_tag('div', $status_renderer = fn($model) => $model->getstatus()['name']; - $date_renderer = function($model): string { - $time = Class_Date::parseTimeWithFormat($model->getcreated_on(), "yyyy-MM-ee'T'HH:mm:ss'Z'"); - - return Class_Date::timestampToFormat($time, 'ee/MM/yyyy'); - }; + $date_renderer = fn($model) => Class_Date::dateToFormat(substr((string) $model->getcreated_on(), 0, 10), + 'dd/MM/yyyy'); - return $this->_tag('h2', $label . $this->_tag('small', count($issues), ['style' => 'margin-left: 1em;'])) + return $this->_tag('h2', $label . $this->_tag('small', + $issues->count(), + ['style' => 'margin-left: 1em;'])) . $this->_tag('div', $this->view->tagModelTable($issues, [$this->_('Numéro'), $this->_('Sujet'), diff --git a/tests/application/modules/admin/controllers/RedmineControllerTest.php b/tests/application/modules/admin/controllers/RedmineControllerTest.php index 873401e6eb9151bfd38ca4bcac8798bb35853c3b..3d555b1e6b1ea2676b874273a50c824cda4f3b55 100644 --- a/tests/application/modules/admin/controllers/RedmineControllerTest.php +++ b/tests/application/modules/admin/controllers/RedmineControllerTest.php @@ -297,8 +297,16 @@ class Admin_RedmineControllerIndexTest extends Admin_RedmineControllerWithApiTes /** @test */ - public function tix34247DateShouldBePresent() { - $this->assertXPathContentContains('//td', '04/12/2015'); + public function tix34247DateShouldBePresent() + { + $this->assertXPathContentContains('//tr[1]/td', '04/12/2015'); + } + + + /** @test */ + public function tix34248DateShouldBePresent() + { + $this->assertXPathContentContains('//tr[3]/td', '20/01/2025'); } @@ -537,7 +545,8 @@ abstract class Admin_RedmineControllerFixtureAbstractTest class Admin_RedmineControllerEditIssue34248Test - extends Admin_RedmineControllerFixtureAbstractTest { + extends Admin_RedmineControllerFixtureAbstractTest +{ public function setUp(): void { @@ -546,19 +555,25 @@ class Admin_RedmineControllerEditIssue34248Test $this->dispatch('admin/redmine/edit-issue/id_lib/1/id/34248'); } - /** @test */ - public function selectedStatusShouldBeAffecteHotline() { + public function selectedStatusShouldBeAffecteHotline() + { $this->assertXPathContentContains('//select[@name="status_id"]//option[@selected="selected"]', 'Affecté hotline'); } - /** @test */ - public function statusQuestionClientShouldBeAvailable() { + public function statusQuestionClientShouldBeAvailable() + { $this->assertXPathContentContains('//select[@name="status_id"]//option[not(@selected)]', 'Question au client'); } + + /** @test */ + public function date29092015ShouldBePresent() + { + $this->assertXpathContentContains('//tr[1]/td', '07/01/2016 à 11:12:45'); + } } diff --git a/tests/fixtures/RedmineFixtures.php b/tests/fixtures/RedmineFixtures.php index 4aac063424b4e3c9167b4b75ad4a0f4e9db3b9cf..92e21806f63f994cb0a8aa03e89e65ae93b799a4 100644 --- a/tests/fixtures/RedmineFixtures.php +++ b/tests/fixtures/RedmineFixtures.php @@ -153,7 +153,7 @@ class RedmineFixtures { ['id' => 11, 'name' => 'Phase', 'value' => '']], - 'created_on' => '2015-12-04T09:19:11Z', + 'created_on' => '2025-01-20T09:25:00Z', 'updated_on' => '2015-12-04T09:25:42Z', 'story_points' => '']; }