Skip to content
Snippets Groups Projects
Commit f5daa75d authored by Henri-Damien LAURENT's avatar Henri-Damien LAURENT
Browse files

dev#163639 Ajout de la configuration accès direct par Set

parent a8daf2f7
Branches
2 merge requests!4721Dev#163369 connecteur cvs,!4710Dev#163369 connecteur cvs
......@@ -22,13 +22,19 @@
class Cvs_Config extends Class_DigitalResource_Config {
const CATALOGUE= 'id',
TYPE_DOC_LABEL = 'type_doc_label';
TYPE_DOC_LABEL = 'type_doc_label',
ACCES_DIRECT_ENABLED = 'acces_direct_enabled';
protected function _getConfig() {
$options = ['fields' => [['name' => static::CATALOGUE,
'label' => $this->_('Identifiant catalogue')],
['name' => static::TYPE_DOC_LABEL,
'label' => $this->_('Type Doc')]],
'label' => $this->_('Type Doc')],
['name' => static::ACCES_DIRECT_ENABLED,
'label' => $this->_('Acces direct'),
'type' => 'checkbox',
'value' => '1'
]],
'trim' => true];
$document_types_aftersave = function($var) { return $this->_onDocumentTypesSaved($var); };
......
......@@ -88,6 +88,8 @@ class Cvs_Service_Catalogue extends Cvs_Service {
public function hasRecordsToHarvest() :bool {
return (! empty($this->_response))
&& preg_match('#<success>1</success>#', $this->_response)
&& !preg_match('#<messageId>API:#', $this->_response)
&& !preg_match('#<albumspagesize>0</albumspagesize>#', $this->_response)
&& !preg_match('#<totalalbums>0</totalalbums>#', $this->_response);
}
......
......@@ -1363,7 +1363,8 @@ class CvsDocumentTypesVariableEditTest extends CvsActivatedTestCase {
parent::setUp();
Class_AdminVar::set('Cvs_CATALOGUES',
json_encode(['id' => ['cinema'],
'type_doc_label' => ['Ressources Numeriques Cinema']]));
'type_doc_label' => ['Ressources Numeriques Cinema'],
'acces_direct_enabled' => ['']]));
$this->dispatch('/admin/index/adminvaredit/cle/Cvs_CATALOGUES');
}
......@@ -1372,7 +1373,7 @@ class CvsDocumentTypesVariableEditTest extends CvsActivatedTestCase {
/** @test */
public function scriptShouldContains2Fields() {
$this->assertXPathContentContains('//script',
'"fields":[{"name":"id","label":"Identifiant catalogue"},{"name":"type_doc_label","label":"Type Doc"}],"values":{"id":["cinema"],"type_doc_label":["Ressources Numeriques Cinema"]}');
'"fields":[{"name":"id","label":"Identifiant catalogue"},{"name":"type_doc_label","label":"Type Doc"},{"name":"acces_direct_enabled","label":"Acces direct","type":"checkbox","value":"1"}],"values":{"id":["cinema"],"type_doc_label":["Ressources Numeriques Cinema"],"acces_direct_enabled":[""]}');
}
}
......@@ -1469,7 +1470,7 @@ class CvsDocumentTypesVariablePostWithValidationSuccessTest extends CvsActivated
/** @test */
public function cvsCatalogueShouldContains() {
Class_AdminVar::clearCache();
$this->assertEquals('{"id":["tout"],"type_doc_label":["Ressource Numerique"]}', Class_AdminVar::get('Cvs_CATALOGUES'));
$this->assertEquals('{"id":["tout"],"type_doc_label":["Ressource Numerique"],"acces_direct_enabled":[]}', Class_AdminVar::get('Cvs_CATALOGUES'));
}
......
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