Commit 4521e5ba authored by Laurent's avatar Laurent
Browse files

hotline #104563 : mass edit of albums : force index to record

parent 1a8571c0
Pipeline #9368 passed with stage
in 59 minutes and 49 seconds
- ticket #104562 : bibliothèque numérique, traitement par lot sur les collections : les albums modifiés sont indexés après validation si nécessaire
\ No newline at end of file
......@@ -439,7 +439,7 @@ class ZendAfi_Controller_Plugin_Manager_Album extends ZendAfi_Controller_Plugin_
unset($values['droits_precision']);
$values['droits'] = $form->isPublicDomain()
? $form->getPublicDomain()
? $album->getPublicDomain()
: $droits_precision;
$frbr_multi = $values['frbr_multi'];
......
......@@ -38,4 +38,12 @@ class ZendAfi_Controller_Plugin_MultiSelection_Album extends ZendAfi_Controller_
return [];
}
protected function _doAfterSave($model) {
if (Class_Album::class !== get_class($model))
return;
$model->index();
}
}
\ No newline at end of file
......@@ -356,7 +356,7 @@ class ZendAfi_Form_Album extends ZendAfi_Form {
public function isPublicDomain() {
return Class_Album::getPublicDomain() == $this->droits->getValue();
return Class_Album::RIGHT_PUBLIC_DOMAIN_KEY == $this->droits->getValue();
}
......
......@@ -1229,6 +1229,7 @@ abstract class Admin_AlbumControllerEditAlbumMesBDTestCase extends Admin_AlbumCo
->addEditor('Glo')
->addCollection('Ratm')
->setDistributor('Geffen Records')
->setDroits(Class_Album::getPublicDomain())
->save();
}
}
......@@ -1357,6 +1358,13 @@ class Admin_AlbumControllerEditAlbumMesBDTest extends Admin_AlbumControllerEditA
}
/** @test */
public function inputRadioDroitsValueOneShouldBeChecked() {
$this->assertXpath('//input[@name="droits"][@value="1"][@checked]',
$this->_response->getBody());
}
/** @test */
public function actionShouldBeEditAlbum() {
$this->assertAction('edit_album');
......
......@@ -895,6 +895,7 @@ class MultiSelectionAlbumPostDatasTest extends MultiSelectionAlbumTestCase {
parent::setUp();
Zend_Registry::get('session')->selected_items['album'] = ['1', 2];
$_SERVER['HTTP_REFERER'] = 'admin/album/edit-multiple';
$this->postDispatch('admin/album/edit-multiple', ['titre' => '',
'keepValueOf_titre' => 1,
......@@ -905,8 +906,16 @@ class MultiSelectionAlbumPostDatasTest extends MultiSelectionAlbumTestCase {
'keepValueOf_authors' => 0,
'editor' => ['Glénat'],
'keepValueOf_editors' => 1,
'visible' => 0,
'keepValueOf_visible' => 0]);
'visible' => 1,
'keepValueOf_visible' => 0,
'status' => Class_Album::STATUS_VALIDATED,
'keepValueOf_status' => 0]);
}
public function tearDown() {
unset($_SERVER['HTTP_REFERER']);
parent::tearDown();
}
......@@ -917,8 +926,14 @@ class MultiSelectionAlbumPostDatasTest extends MultiSelectionAlbumTestCase {
/** @test */
public function shoudlRedirectToAlbumIndex() {
$this->assertRedirect('/admin/album');
public function firstAlbumRecordMainAuthorShouldBeSuiIshida() {
$this->assertEquals('Sui Ishida', Class_Album::find(1)->getNotice()->getAuteurPrincipal());
}
/** @test */
public function shoudlRedirectToReferer() {
$this->assertRedirectTo('/admin/album/edit-multiple');
}
......@@ -960,8 +975,8 @@ class MultiSelectionAlbumPostDatasTest extends MultiSelectionAlbumTestCase {
/** @test */
public function firstAlbumShouldNotBeIndexed() {
$this->assertEquals('0', Class_Album::find(1)->getVisible());
public function firstAlbumShouldBeIndexed() {
$this->assertEquals('1', Class_Album::find(1)->getVisible());
}
......
Markdown is supported
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