Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
bibliossimo
opacce
Commits
006a31f9
Commit
006a31f9
authored
Jan 09, 2018
by
Laurent
Browse files
hotline #69403 : fix add album to record in frontoffice
parent
f2698065
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
10 deletions
+66
-10
VERSIONS_HOTLINE/69403
VERSIONS_HOTLINE/69403
+1
-0
library/Class/Album.php
library/Class/Album.php
+0
-2
library/ZendAfi/Controller/Plugin/Manager/Album.php
library/ZendAfi/Controller/Plugin/Manager/Album.php
+5
-4
library/ZendAfi/View/Helper/Admin/RenderForm.php
library/ZendAfi/View/Helper/Admin/RenderForm.php
+4
-4
public/admin/skins/bokeh74/form.css
public/admin/skins/bokeh74/form.css
+4
-0
tests/application/modules/admin/controllers/AlbumControllerTest.php
...ication/modules/admin/controllers/AlbumControllerTest.php
+52
-0
No files found.
VERSIONS_HOTLINE/69403
0 → 100644
View file @
006a31f9
- ticket #69403 : Catalogue : correction de l'ajout d'un album à partir d'une notice en front
\ No newline at end of file
library/Class/Album.php
View file @
006a31f9
...
...
@@ -118,10 +118,8 @@ class Class_Album extends Storm_Model_Abstract {
protected
$_default_attribute_values
=
[
'notice_id'
=>
null
,
'titre'
=>
''
,
'sous_titre'
=>
''
,
'editeur'
=>
''
,
'fichier'
=>
''
,
'pdf'
=>
''
,
'auteur'
=>
''
,
'description'
=>
''
,
'date_maj'
=>
''
,
'genre'
=>
''
,
...
...
library/ZendAfi/Controller/Plugin/Manager/Album.php
View file @
006a31f9
...
...
@@ -399,10 +399,10 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_
/**
* @param Class_Album $album
* @param ZendAfi_Form_Album $form
* @return null
*/
public
function
_validateAndSaveAlbum
(
$album
)
{
$form
=
$this
->
_albumForm
(
$album
);
protected
function
_validateAndSaveAlbum
(
$album
,
$form
)
{
$this
->
_view
->
form
=
$form
;
if
(
...
...
@@ -493,11 +493,12 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_
* @param string $titre
*/
protected
function
_renderAlbumForm
(
$album
,
$titre
)
{
if
(
$this
->
_validateAndSaveAlbum
(
$album
))
$form
=
$this
->
_albumForm
(
$album
);
if
(
$this
->
_validateAndSaveAlbum
(
$album
,
$form
))
return
$this
->
_redirectToEdit
(
$album
);;
$this
->
_view
->
titre
=
$titre
;
$this
->
_view
->
errors
=
$
albu
m
->
getErrors
();
$this
->
_view
->
errors
=
$
for
m
->
getErrors
();
$this
->
_view
->
album
=
$album
;
$this
->
_view
->
form
->
getElement
(
'fichier'
)
->
setValue
(
$album
->
getFichier
());
...
...
library/ZendAfi/View/Helper/Admin/RenderForm.php
View file @
006a31f9
...
...
@@ -33,13 +33,13 @@ class ZendAfi_View_Helper_Admin_RenderForm extends ZendAfi_View_Helper_RenderFor
if
(
'true'
==
$form
->
getAttrib
(
'data-disable-onchange'
))
$this
->
view
->
disable_onchange
=
true
;
$this
->
_tabify
(
$form
);
$this
->
_customizeRendering
();
$content
=
parent
::
renderForm
(
$form
,
$buttons
);
return
parent
::
renderForm
(
$form
,
$buttons
);
}
$this
->
_tabify
(
$form
);
return
$content
;
}
protected
function
_tabify
(
$form
)
{
...
...
public/admin/skins/bokeh74/form.css
View file @
006a31f9
...
...
@@ -15,6 +15,10 @@
background
:
var
(
--main-background
);
}
.admin-form
.errors
{
color
:
var
(
--error-text
);
}
.admin-form
input
{
height
:
auto
;
width
:
auto
;
...
...
tests/application/modules/admin/controllers/AlbumControllerTest.php
View file @
006a31f9
...
...
@@ -3169,6 +3169,24 @@ class Admin_AlbumControllerAddAlbumToAjaxPostNoVisibleTest extends Admin_AlbumCo
}
/**
* @test
* @expectedException Storm_Model_Exception
* */
public
function
albumShouldNotHaveEditorField
()
{
Class_Album
::
findFirstBy
([
'titre'
=>
'Dark'
])
->
getEditeur
();
}
/**
* @test
* @expectedException Storm_Model_Exception
* */
public
function
albumShouldNotHaveAuteurField
()
{
Class_Album
::
findFirstBy
([
'titre'
=>
'Dark'
])
->
getAuteur
();
}
/** @test */
public
function
darkAlbumShouldBeSaved
()
{
$this
->
assertNotNull
(
Class_Album
::
findFirstBy
([
'titre'
=>
'Dark'
]));
...
...
@@ -3184,6 +3202,40 @@ class Admin_AlbumControllerAddAlbumToAjaxPostNoVisibleTest extends Admin_AlbumCo
class
Admin_AlbumControllerAddAlbumToAjaxWithErrorsTest
extends
Admin_AlbumControllerTestCase
{
/** @test */
public
function
withoutTitleShouldDisplayError
()
{
$this
->
postDispatch
(
'/admin/album/link_album_to/id_notice/8'
,
[
'titre'
=>
''
,
'visible'
=>
'0'
,
'status'
=>
Class_Album
::
STATUS_VALIDATED
,
'type_doc_id'
=>
100
,
'frbr_type'
=>
[
'1:source'
],
'frbr_url'
=>
[
Class_Url
::
siteUrl
()
.
'/admin/recherche/viewnotice/id_notice/8/clef/DIAMANTSEMPOISONNES--HENRYA--PAYOT-2007-1/id/8'
]],
true
);
$this
->
assertXPathContentContains
(
'//ul[@class="errors"]/li'
,
'Une valeur est requise'
,
$this
->
_response
->
getBody
());
}
/** @test */
public
function
withoutFrbrTypeShouldDisplayError
()
{
$this
->
postDispatch
(
'/admin/album/link_album_to/id_notice/8'
,
[
'titre'
=>
'Dark chocolate'
,
'visible'
=>
'0'
,
'status'
=>
Class_Album
::
STATUS_VALIDATED
,
'type_doc_id'
=>
100
,
'frbr_type'
=>
[
''
],
'frbr_url'
=>
[
Class_Url
::
siteUrl
()
.
'/admin/recherche/viewnotice/id_notice/8/clef/DIAMANTSEMPOISONNES--HENRYA--PAYOT-2007-1/id/8'
]],
true
);
$this
->
assertXPathContentContains
(
'//script'
,
'Un champ de cette ligne ne peut \\u00eatre vide'
,
$this
->
_response
->
getBody
());
}
}
class
Admin_AlbumControllerConfigActionTest
extends
Admin_AbstractControllerTestCase
{
protected
$_storm_default_to_volatile
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment