From 6920182a7eb2f00d2a84e8b860698ab4651b0362 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki <arthur.suzuki@biblibre.com> Date: Wed, 14 Aug 2019 12:27:44 +0200 Subject: [PATCH] hotline#68507 : SIGB Koha : pre-registration dateformat updated --- VERSIONS_HOTLINE/68507 | 1 + application/modules/opac/controllers/AuthController.php | 7 ++----- library/Class/WebService/SIGB/PreRegistration.php | 4 ++++ .../opac/controllers/AuthControllerPreRegistrationTest.php | 7 +++---- 4 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 VERSIONS_HOTLINE/68507 diff --git a/VERSIONS_HOTLINE/68507 b/VERSIONS_HOTLINE/68507 new file mode 100644 index 00000000000..b1e881a4a33 --- /dev/null +++ b/VERSIONS_HOTLINE/68507 @@ -0,0 +1 @@ + - ticket #68507 : WebService Koha : Correction du format de la date de naissance dans le formulaire de pré-inscription. \ No newline at end of file diff --git a/application/modules/opac/controllers/AuthController.php b/application/modules/opac/controllers/AuthController.php index 90cd4f88b41..44a256ac0de 100644 --- a/application/modules/opac/controllers/AuthController.php +++ b/application/modules/opac/controllers/AuthController.php @@ -557,11 +557,8 @@ class AuthController extends ZendAfi_Controller_Action { if ('' != $this->_getParam('emailCheck')) return $this->_redirect('/'); - $form = $pre_registration - ->getForm() - ->populate(ZendAfi_Filters_Post::filterStatic($this->_request->getParams())); - - $this->view->form = $form; + $this->view->form = + $form->populate(ZendAfi_Filters_Post::filterStatic($this->_request->getParams())); $data = ZendAfi_Filters_Post::filterStatic($this->_request->getPost()); unset($data['emailCheck']); diff --git a/library/Class/WebService/SIGB/PreRegistration.php b/library/Class/WebService/SIGB/PreRegistration.php index 56164c231a5..cc22c45bed7 100644 --- a/library/Class/WebService/SIGB/PreRegistration.php +++ b/library/Class/WebService/SIGB/PreRegistration.php @@ -172,6 +172,10 @@ class Class_WebService_SIGB_PreRegistrationKoha extends Class_WebService_SIGB_Pr return $this->_pre_registration->addError($this->_('Échec de la préinscription, les informations saisies sont invalides.')); $data['branchcode'] = $this->getBranchCode($data); + + if(isset($data['dateofbirth'])) + $data['dateofbirth'] = Class_Date::humanDate($data['dateofbirth'],'yyyy-MM-dd'); + $response = $int_bib->getSIGBComm()->preRegistration($data); if(!$response['statut']) diff --git a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php index 6e1f538461f..2171c3acee1 100644 --- a/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php +++ b/tests/application/modules/opac/controllers/AuthControllerPreRegistrationTest.php @@ -136,7 +136,7 @@ class AuthControllerPreRegistrationKohaPostDispatchTest extends AuthControllerPr ['data' => json_encode(['branchcode' => 'GRA', 'surname' => 'Boulard', 'firstname' => 'Thom', - 'dateofbirth' => '15-09-1940', + 'dateofbirth' => '1940-09-15', 'streetnumber' => '10', 'address' => 'rue secret', 'zipcode' => '01630', @@ -156,8 +156,7 @@ class AuthControllerPreRegistrationKohaPostDispatchTest extends AuthControllerPr 'city' => 'Gotham', 'email' => 'thom@mail.com', 'phone' => '0123456789', - 'emailCheck' => ''], - true); + 'emailCheck' => '']); } @@ -213,7 +212,7 @@ class AuthControllerPreRegistrationKohaPostDispatchWithErrorReturnedTest extends ['data' => json_encode(['branchcode' => 'GRA', 'surname' => 'Boulard', 'firstname' => 'Thom', - 'dateofbirth' => '15-09-1940', + 'dateofbirth' => '1940-09-15', 'streetnumber' => '10', 'address' => 'rue secret', 'zipcode' => '01630', -- GitLab