Commit 46cb63bc authored by Patrick Barroca's avatar Patrick Barroca 😠

version 7.9.32

Merge remote-tracking branch 'refs/remotes/afi/stable' into afi-hotline-master

# Conflicts:
#	VERSIONS
#	application/modules/admin/views/scripts/album/import-ead.phtml
#	library/Class/PanierNotice.php
#	library/Class/Systeme/Report.php
#	library/startup.php
#	tests/application/modules/admin/controllers/AlbumControllerTest.php
#	tests/db/UpgradeDBTest.php
parents f671ffdb 7979067e
20/07/2017 - v7.9.32
- ticket #61844 : ArteVOD : ajout d'un script de récupération des enrichissements
- ticket #62667 : Administration : correction de l'impossibilité d'attribuer un panier à un domaine pour les administrateurs bibliothèque
- ticket #62569 : Assimil: ajout d'une option pour utiliser l'URL de SSO assimil.online au lieu de biblio.assimil.com
- ticket #61953 : Administration : lorsqu'une bibliothèque est supprimée, supprime les intégrations programmées associées
- ticket #62020 : Administration : correction du glisser / déposer de plusieurs modules du même type dans la configuration de la page d'accueil côté pro
- ticket #57464 : Bibliothèque numérique : Ajout de la sélection d'une catégorie d'albums à exporter dans l'export EAD
- ticket #62950 : Administration : Rapport d'état du système en JSON: tags avec accents et espaces correctement envoyés
- ticket #63022 : ArteVOD : suite à la migration de plateforme, désactivation du script de suppression en masse déjà exécuté à la précédente version
17/07/2017 - v7.9.30 - v7.9.31
- ticket #17839 : Administration : Accès aux avis et paniers d'un utilisateur depuis le menu utilisateurs
......
- ticket #61844 : ArteVOD, script de récupération des enrichissements
\ No newline at end of file
- ticket #61953 : lorsqu'une bibliothèque est supprimée, supprime les intégrations programmées associées
\ No newline at end of file
- ticket #62020 : correction du glisser / déposer de plusieurs modules du même type dans la configuration de la page d'accueil côté pro
\ No newline at end of file
- ticket #62569 : Assimil: ajout d'une option pour utiliser l'URL de SSO assimil.online au lieu de biblio.assimil.com
\ No newline at end of file
- ticket #62667 : correction de l'impossibilité d'attribuer un panier à un domaine pour les administrateurs bibliothèque
\ No newline at end of file
......@@ -106,6 +106,7 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
$form = $this->_formImportEAD();
$this->view->form_import_ead = $form;
$this->view->form_export_ead = $this->_formExportEad();
if (!$this->_request->isPost())
return;
......@@ -145,19 +146,42 @@ class Admin_AlbumController extends ZendAfi_Controller_Action {
}
protected function _formExportEAD() {
return $this->view
->newForm(['id' => 'export_ead', 'class' => 'form'])
->setMethod('post')
->setAttrib('enctype', 'multipart/form-data')
->setAction($this->view->url(['action' => 'export-ead']))
->addElement('select',
'cat_id',
['style' => 'max-width:445px;',
'allowEmpty' => false,
'required' => true,
'multiOptions' => ['' => $this->_('Choisissez une catégorie')]
+ Class_AlbumCategorie::getAllLibelles()])
->addElement('submit', 'submit', ['label' => 'Exporter en EAD']);
}
public function exportEadAction() {
$this->getHelper('ViewRenderer')->setNoRender();
$response = $this->_response;
$response->clearAllHeaders();
$response->setHeader('Content-Type', 'application/xml; name="export_ead.xml"', true);
$response->setHeader('Content-Disposition', 'attachment; filename="export_ead.xml"', true);
$response->setHeader('Content-Transfer-Encoding', 'base64', false);
$response->setHeader('Expires', '0');
$response->setHeader('Cache-Control', 'no-cache, must-revalidate');
$response->setHeader('Pragma', 'no-cache');
$response->setHeader('Access-Control-Allow-Origin', '*');
$response->setBody($this->view->album_ExportEadVisitor());
$form = $this->_formExportEAD();
if ($form->isValid($this->_request->getPost())) {
$this->getHelper('ViewRenderer')->setNoRender();
$response = $this->_response;
$response->clearAllHeaders();
$response->setHeader('Content-Type', 'application/xml; name="export_ead.xml"', true);
$response->setHeader('Content-Disposition', 'attachment; filename="export_ead.xml"', true);
$response->setHeader('Content-Transfer-Encoding', 'base64', false);
$response->setHeader('Expires', '0');
$response->setHeader('Cache-Control', 'no-cache, must-revalidate');
$response->setHeader('Pragma', 'no-cache');
$response->setHeader('Access-Control-Allow-Origin', '*');
$response->setBody($this->view->album_ExportEadVisitor((int)$this->_getParam('cat_id')));
return;
}
$this->_helper->notify($this->_('Vous devez spécifier une catégorie à exporter'));
$this->_redirect('/admin/album/import_ead');
}
......
<?php
echo $this->form_import_ead;
echo $this->button((new Class_Entity())
->setText($this->_('Exporter en EAD'))
->setUrl($this->url(['action' => 'export-ead'])));
echo $this->tag('h2', $this->_('Import'));
echo $this->renderForm($this->form_import_ead);
echo $this->tag('h2', $this->_('Export'));
echo $this->renderForm($this->form_export_ead);
?>
......@@ -31,7 +31,9 @@ class Class_Migration_ArteVODSecondPlateform {
public function run() {
if (!$lines = $this->fetchAll('select id, notice_id from album where type_doc_id=104'))
return; // already run on all artevod subscribers, kept for historical purpose
if (!$lines = $this->fetchAll('select id, notice_id from album where type_doc_id=104'))
return;
$this
......
......@@ -110,7 +110,7 @@ class Class_Systeme_Report_Portal extends Class_Systeme_Report_Abstract {
array_filter(
array_map('trim',
preg_split(
'/[^0-9a-zA-Z_]+/', $tags))));
'/[|;,"\']+/', $tags))));
}
}
......
......@@ -22,11 +22,11 @@
class ZendAfi_View_Helper_Album_ExportEadVisitor extends Zend_View_Helper_Abstract {
protected $_builder;
public function album_exportEadVisitor() {
public function album_exportEadVisitor($cat_id) {
$this->_builder = new Class_Xml_Builder();
$top_level_categories = Class_AlbumCategorie::findAllBy(['parent_id' => 0]);
$xml_categories = $this->_constructXmlCategories($top_level_categories);
$categories = [Class_AlbumCategorie::find($cat_id)];
$xml_categories = $this->_constructXmlCategories($categories);
$xml_content = $this->_constructXml($xml_categories);
$dom = new DOMDocument();
......
......@@ -82,7 +82,7 @@ class Bokeh_Engine {
function setupConstants() {
defineConstant('BOKEH_MAJOR_VERSION','7.9');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.31');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.32');
defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/');
......
storm @ 5d921fba
Subproject commit d83b2b98b21e7248cc418f2b43dfb6c38eca8430
Subproject commit 5d921fbadd09b2c3e52a2d4c835580efcfb2adff
......@@ -2613,8 +2613,15 @@ class Admin_AlbumControllerImportEADTest extends Admin_AlbumControllerTestCase {
/** @test */
public function pageShouldHaveLinkToExportEAD() {
$this->assertXPathContentContains('//button[contains(@onclick, "/admin/album/export-ead")]',"Exporter en EAD");
public function pageShouldHaveFormToExportEAD() {
$this->assertXPath('//form[contains(@action, "/admin/album/export-ead")]//input[@type="submit"][@value="Exporter en EAD"]');
}
/** @test */
public function formExportEadShouldHaveSelectorForAlbumCategories() {
$this->assertXPathContentContains('//form[contains(@action, "export-ead")]//select[@name="cat_id"]/option',
'Favoris');
}
}
......@@ -2835,22 +2842,27 @@ class Admin_AlbumControllerMassRessourceDeleteActionTest extends Admin_AlbumCont
}
abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTestCase {
protected $_xpath;
abstract class ControllerAlbumMultiMediasTestCase extends Admin_AlbumControllerTestCase {
protected
$_xpath;
public function setUp() {
parent::setUp();
$this->_xpath = new Storm_Test_XPathXML();
$album = Class_Album::newInstanceWithId(999)
$album = $this->fixture('Class_Album', ['id' => 999,
'titre' => 'Plein de medias',
'description' => '<p>pour passer la soirée</p>']);
$album
->beDiaporama()
->setTitre('Plein de medias')
->setNoticeId(500)
->setIdOrigine("A888")
->setCote('50')
->setDateMaj('2012-02-17 10:00:00')
->setDescription('<p>pour passer la soirée</p>')
->setNotes(['305$a' => 'XXe siècle',
'200$b' => 'Parchemin',
'316$a' => 'Reliure restaurée en 1980 par la BN.'])
......@@ -2880,34 +2892,27 @@ abstract class ControllerAlbumMultiMediasTestCase extends AbstractControllerTest
->setFichier('Monsieur l\'escargot.mp3')
->setTitre('Monsieur l\'escargot')
->setOrdre(4)
->setPoster('l\'escargot.jpg')]);
->setPoster('l\'escargot.jpg')])
->assertSave();
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_AlbumCategorie')
->whenCalled('findAllBy')
->answers([])
->whenCalled('findAllBy')
->with(['parent_id' => 0])
->answers([ Class_AlbumCategorie::newInstanceWithId('33')
->setAlbums([$album])
->setLibelle('Comics')]);
Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Album')
->whenCalled('findAll')
->answers([$album])
->whenCalled('findAllBy')
->with(['cat_id'=>'33'])
->answers([$album]);
$this->fixture('Class_AlbumCategorie',
['id' => '33',
'libelle' => 'Comics',
'albums' => [$album]]);
}
}
class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTestCase {
public function setUp() {
parent::setUp();
$this->_xpath->registerNameSpace('ead', 'urn:isbn:1-931666-22-9');
$this->dispatch('/admin/album/export-ead', true);
$this->postDispatch('/admin/album/export-ead',
['cat_id' => 33],
true);
}
......@@ -2935,11 +2940,20 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest
}
/** @test */
public function collectionPatrimoineShouldNotBePresent() {
$this->_xpath->assertNotXPathContentContains($this->_response->getBody(),
'//ead:unittitle',
'Patrimoine',
$this->_response->getBody());
}
/** @test */
public function NumeroDeNoticeShouldBe50() {
$this->_xpath->assertXPathContentContains($this->_response->getBody(),
'//ead:archdesc/ead:dsc/ead:c01/ead:did/ead:unitid[contains(@type, "numéro_de_notice")]',
'50',$this->_response->getBody());
'50');
}
......@@ -2993,6 +3007,29 @@ class AlbumControllerMultiMediasExportEAD extends ControllerAlbumMultiMediasTest
class AlbumControllerMultiMediasExportEADErrors extends ControllerAlbumMultiMediasTestCase {
public function setUp() {
parent::setUp();
$this->postDispatch('/admin/album/export-ead',
['cat_id' => ''],
true);
}
/** @test */
public function withoutCatIdShouldDisplayErrorCatIdRequired() {
$this->assertFlashMessengerContentContains('Vous devez spécifier une catégorie à exporter');
}
/** @test */
public function responseShouldRedirectToImportEad() {
$this->assertRedirectTo('/admin/album/import_ead');
}
}
class Admin_AlbumControllerAddAlbumToAjaxTest extends Admin_AlbumControllerTestCase {
protected
......
......@@ -1588,49 +1588,16 @@ class UpgradeDB_330_Test extends UpgradeDBTestCase {
/** obsolete */
class UpgradeDB_331_Test extends UpgradeDBTestCase {
protected
$_id_notice,
$_album_id;
public function prepare() {
try {
$this->query('insert into notices (type_doc) values (104)');
$this->_id_notice = $this->lastInsertId();
$this->query('insert into exemplaires (id_notice) values (' . $this->_id_notice . ')');
$this->query('insert into album (type_doc_id, notice_id) values (104, ' . $this->_id_notice . ')');
$this->_album_id = $this->lastInsertId();
$path = (new Class_Album())->setId($this->_album_id)->getBasePath();
mkdir($path);
touch($path . 'testing.txt');
} catch (Exception $e) {}
}
/** @test */
public function albumShouldBeDeleted() {
$data = $this->query('select * from album where id='.$this->_album_id)->fetch();
$this->assertNull($data);
}
/** @test */
public function linkedRecordShouldBeDeleted() {
$data = $this->query('select * from notices where id_notice=' . $this->_id_notice)->fetch();
$this->assertNull($data);
}
/** @test */
public function linkedItemShouldBeDeleted() {
$data = $this->query('select * from exemplaires where id_notice=' . $this->_id_notice)->fetch();
$this->assertNull($data);
}
/** @test */
public function albumDirectoryShouldBeDeleted() {
$path = (new Class_Album())->setId($this->_album_id)->getBasePath();
$this->assertFalse(file_exists($path), $path);
public function isObsolete() {
}
}
\ No newline at end of file
......@@ -46,7 +46,7 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes
/** @test */
public function portalTagsShouldContainsTestingIgnoreInProdAndDedicatedServer() {
$this->assertEquals(['TESTING', 'IGNORE', 'IN_PROD', 'DEDICATED_SERVER'],
$this->assertEquals(['TESTING', 'IGNORE', 'IN_PROD', 'Personnalisé', 'Par défaut', 'DEDICATED_SERVER'],
$this->_report['portal']['tags']);
}
......
......@@ -150,8 +150,8 @@ abstract class ZendAfi_View_Helper_Status_TestCase extends ViewHelperTestCase {
protected function _setupReportTags() {
defineConstant('STATUS_REPORT_TAGS', '@,TESTING IGNORE"');
Class_AdminVar::set('STATUS_REPORT_TAGS', 'IN_PROD; DEDICATED_SERVER,');
defineConstant('STATUS_REPORT_TAGS', 'TESTING, IGNORE"');
Class_AdminVar::set('STATUS_REPORT_TAGS', 'IN_PROD; Personnalisé| \'Par défaut" ; DEDICATED_SERVER,');
}
......
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