Commit f9c00d70 authored by Sebastien ANDRE's avatar Sebastien ANDRE
Browse files

Merge remote-tracking branch 'origin/hotline'

parents 0e64bca3 afd13248
- ticket #132723 : Administration : Une entrée de menu vers l'explorateur de fichiers a été ajouté dans la boite d'administration de l'interface publique.
\ No newline at end of file
- ticket #133782 : Cosmogramme : Les facettes dynamiques ne se créaient pas lorsqu'elles avaient le même champs de libellé et de filtre
\ No newline at end of file
- ticket #136506 : Administration : Mise à jour de l'URL de publication automatique du rapport système
\ No newline at end of file
- ticket #137828 : Notice : Suppression d'une colonne personnalisée vide restante après remise à 0 des colonnes personnalisées dans la configuration du tableau des exemplaires
\ No newline at end of file
- ticket #138162 : Administration : Correction du lien de configuration de la liste des prêts de l'espace abonné
\ No newline at end of file
......@@ -63,9 +63,11 @@ class AbonneController extends ZendAfi_Controller_Action {
return;
}
$this->view->_current_module['controller'] = 'abonne';
$this->view->_current_module['action'] = 'fiche';
$this->view->_current_module['action2'] = '';
if (!Class_Template::current()->isLegacy()) {
$this->view->_current_module['controller'] = 'abonne';
$this->view->_current_module['action'] = 'fiche';
$this->view->_current_module['action2'] = '';
}
}
......
......@@ -28,9 +28,11 @@ class AuthorController extends ZendAfi_Controller_Action {
if (!$this->_author = $this->view->author = $this->_findAuthor())
throw new Zend_Controller_Action_Exception($this->view->_('Désolé, cette page n\'existe pas'), 404);
$this->view->_current_module['controller'] = 'author';
$this->view->_current_module['action'] = 'view';
$this->view->_current_module['action2'] = '';
if (!Class_Template::current()->isLegacy()) {
$this->view->_current_module['controller'] = 'author';
$this->view->_current_module['action'] = 'view';
$this->view->_current_module['action2'] = '';
}
}
......
......@@ -25,9 +25,11 @@ class BibController extends ZendAfi_Controller_Action {
parent::preDispatch();
$this->_helper->librarySelection();
$this->view->_current_module['controller'] = 'bib';
$this->view->_current_module['action'] = 'en-lire-plus';
$this->view->_current_module['action2'] = '';
if (!Class_Template::current()->isLegacy()) {
$this->view->_current_module['controller'] = 'bib';
$this->view->_current_module['action'] = 'en-lire-plus';
$this->view->_current_module['action2'] = '';
}
}
......
<?php
$adapter = Zend_Db_Table::getDefaultAdapter();
try {
$adapter->query('update bib_admin_var set valeur="https://pola.afi-sa.net/smile.php" where clef="STATUS_REPORT_PUSH_URL" and valeur="http://pola.afi-sa.net/smile.php"');
} catch(Exception $e) {
}
......@@ -423,7 +423,8 @@ Pour vous désabonner de la lettre d\'information, merci de cliquer sur le lien
'URL_COSMOGRAMME' => Class_AdminVar_Meta::newDefault('')->bePrivate(),
'PACK_MOBILE' => Class_AdminVar_Meta::newOnOff($this->_('Activation des fonctions avancées du téléphone'))->bePrivate(),
'BUID' => Class_AdminVar_Meta::newRawText($this->_('Identifiant unique (attention: la modification de cette variable impactera les outils de suivi de cette installation)'))->bePrivate(),
'STATUS_REPORT_PUSH_URL' => Class_AdminVar_Meta::newRawText($this->_('URL destinataire du rapport d\'état du système (0 pour désactiver)'), ['value' => 'http://pola.afi-sa.net/smile.php'])->bePrivate(),
'STATUS_REPORT_PUSH_URL' => Class_AdminVar_Meta::newRawText($this->_('URL destinataire du rapport d\'état du système (0 pour désactiver)'),
['value' => 'https://pola.afi-sa.net/smile.php'])->bePrivate(),
'STATUS_REPORT_TAGS' => Class_AdminVar_Meta::newMultiInput($this->_('Liste des tags à ajouter au rapport d\'état du système'))->bePrivate(),
'FEATURES_TRACKING_ENABLE' => Class_AdminVar_Meta::newOnOff('Affiche les dernières modifications apportés au logiciel Bokeh', ['value' => 1]),
'INSPECTOR_GADGET_MARC_XML' => Class_AdminVar_Meta::newOnOff('Affiche le MARC XML de la notice dans Inspector Gadget')->enable(),
......
......@@ -689,11 +689,6 @@ class Class_CodifThesaurus extends Storm_Model_Abstract {
}
public function rulesTruncateLabels($labels) {
return $this->_getListRules()->truncateLabels($labels);
}
public function getRulesAsArray() {
return ['rule_list_zone' => $this->getRuleListZone(),
'rule_list_label_field' => $this->getRuleListLabelField(),
......
......@@ -116,68 +116,7 @@ class Class_CodifThesaurus_Rules extends Class_Entity {
* @param $reader cosmogramme notice_unimarc
*/
public function extractIdAndFields($reader) {
if (!$label_field = trim($this->getLabelField()))
return [];
$id_field = trim($this->getIdField());
$filter_field = $this->getFilterField();
$fields = $reader->cutBlockBySubfields($this->getZonePadded(),
[$label_field => 'label',
$id_field => 'id',
$filter_field => 'filter'],
[$this, 'filterSubfieldIn']);
return array_filter(array_map([$this, 'buildAuthorityStructure'],
$fields));
}
public function filterSubfieldIn($block) {
$label = $this->truncateLabel($block->get('label'));
if (!$this->isValidLabel($label))
return false;
$filter_zone = $this->getZone();
$filter_field = $this->getFilterField();
$filter_value = $this->getFilterValue();
if (!$filter_zone || (null === $filter_field) | !$filter_value)
return true;
return $block->get('filter') == $filter_value;
}
public function buildAuthorityStructure($block){
$label = $this->truncateLabel($block->get('label'));
return ['id' => ($block->get('id')
? strtoupper($block->get('id'))
: ''),
'label' => $label];
}
public function truncateLabels($labels) {
return array_filter(
array_map([$this, 'truncateLabel'], $labels),
[$this, 'isValidLabel']);
}
public function truncateLabel($label) {
if (!$this->getLabelLength())
return $label;
return $this->isValidLabel($label)
? substr($label,
max(0, $this->getLabelStartPos()-1),
$this->getLabelLength())
: '';
}
public function isValidLabel($label) {
return is_string($label) && $label > '';
return (new Class_NoticeUnimarc_ExtractFields($reader, $this))->getListFields();
}
......@@ -190,4 +129,4 @@ class Class_CodifThesaurus_Rules extends Class_Entity {
public function getZonePadded() {
return sprintf('%03d', trim($this->getZone()));
}
}
\ No newline at end of file
}
......@@ -231,59 +231,15 @@ class Class_NoticeUnimarc {
),...
]
*/
public function cutBlockBySubfields($zone, $subfields_mapping, $closure_valid = null) {
$this->blocks=[];
foreach ($this->get_subfield($zone) as $line) {
$this->_cutLineBySubfields($line, $subfields_mapping,$closure_valid);
}
return $this->blocks;
public function cutBlockBySubfields($zone, $subfields_mapping) {
return (new Class_NoticeUnimarc_ExtractFields($this, $subfields_mapping, $zone))
->getListFields();
}
protected function _cutLineBySubfields($line, $subfields_mapping, $closure_valid) {
$block = $this->_newBlock();
$fields = $this->_bloc_to_array($line);
$bloc_values = array_values($subfields_mapping);
foreach($fields as $field) {
$code = substr($field, 0, 1);
$value = trim(substr($field, 1));
if (!in_array($code,array_keys($subfields_mapping)))
continue;
if ($block->get($subfields_mapping[$code])) {
$block = $this->_addBlock($block,$closure_valid);
}
$block->set($subfields_mapping[$code], $value);
}
$this->_addBlock($block,$closure_valid);
return $this;
}
protected function _newBlock() {
return new Class_Entity();
}
protected function _addBlock($block, $closure_valid) {
if (!$closure_valid || call_user_func($closure_valid,$block))
$this->blocks[] = $block;
return $this->_newBlock();
}
protected function _bloc_to_array($bloc) {
$bloc = substr($bloc, 3);
return explode($this->subfield_begin, $bloc);
public function lineToArray($line) {
$line = substr($line, 3);
return explode($this->subfield_begin, $line);
}
......@@ -383,7 +339,7 @@ class Class_NoticeUnimarc {
public function get_field($zone) {
$instance = new Class_NoticeUnimarc_Field;
$instance = new Class_Entity();
$bloc = substr($zone, 3);
$fields = explode($this->subfield_begin, $bloc);
......
<?php
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_NoticeUnimarc_ExtractFields {
protected
$_reader,
$_list_fields;
public function __construct($reader, $rules_or_array, $zone = null) {
$this->_reader = $reader;
$this->_list_fields = Class_NoticeUnimarc_ListFields::newFor($rules_or_array,
$zone);
}
public function getListFields() {
if (!$this->_list_fields->isValid())
return [];
foreach ($this->_reader->get_subfield($this->_list_fields->getZone()) as $line)
$this->_cutLineBySubfields($line);
return $this->_list_fields->getListResult();
}
protected function _cutLineBySubfields($line) {
$fields = $this->_reader->lineToArray($line);
foreach ($fields as $field) {
$code = substr($field, 0, 1);
$value = trim(substr($field, 1));
$this->_list_fields->addCodeValue($code, $value);
}
$this->_list_fields->addInResultAndReset();
return $this;
}
}
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
......@@ -20,4 +20,41 @@
*/
class Class_NoticeUnimarc_Field extends Class_Entity {}
class Class_NoticeUnimarc_Field {
protected
$_code,
$_value,
$_label;
public function __construct($code, $label) {
$this->_code = $code;
$this->_label = $label;
}
public function getCode() {
return $this->_code;
}
public function isSameCode($code) {
return $code && $code == $this->getCode();
}
public function getLabel() {
return $this->_label;
}
public function getValue() {
return $this->_value;
}
public function setValue($value) {
$this->_value = $value;
return $this;
}
}
<?php
/**
* Copyright (c) 2012-2021, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_NoticeUnimarc_ListFields {
protected
$_list_fields,
$_list_result,
$_zone,
$_valid = false;
public function __construct($rules_or_array, $zone = null) {
$this->_list_fields = new Storm_Collection();
$this->_list_result = [];
$this->_zone = $zone;
$this->_init($rules_or_array);
}
public static function newFor($rules_or_array, $zone = null) {
if (is_a($rules_or_array, Class_CodifThesaurus_Rules::class))
return new Class_NoticeUnimarc_ListFieldsRules($rules_or_array, $zone);
return new static($rules_or_array, $zone);
}
public function isValid() {
return $this->_valid;
}
public function getListResult() {
return $this->_list_result;
}
public function getZone() {
return $this->_zone;
}
public function addCodeValue($code, $value) {
if (!($working_list = $this->_getWorkingList($code)))
return $this;
$with_value = $working_list->detect(function ($field) {
return $field->getValue();
});
if ($with_value)
return $this->addInResultAndReset($code, $value);
$working_list->eachDo(function ($field) use ($value) {
$field->setValue($value);
});
return $this;
}
public function addInResultAndReset($code = null, $value = null) {
if ($this->_canAddResult())
$this->_list_result [] = $this->_buildOneResult();
$this->_reset();
$this->_addAfterReset($code, $value);
return $this;
}
protected function _init($array) {
if (!($this->_valid = is_array($array)))
return $this;
foreach ($array as $code => $label)
$this->_list_fields->add(new Class_NoticeUnimarc_Field($code, $label));
return $this;
}
protected function _getWorkingList($code) {
if (!$this->isValid() || !$code)
return null;
$working_list = $this->_list_fields->select(function ($field) use ($code) {
return $field->isSameCode($code);
});
return $working_list->isEmpty()
? null
: $working_list;
}
protected function _reset() {
$this->_list_fields->eachDo(function ($field) {
$field->setValue(null);
});
return $this;
}
protected function _addAfterReset($code, $value) {
if (!($working_list = $this->_getWorkingList($code)))
return $this;
$working_list->eachDo(function ($field) use ($value) {
$field->setValue($value);
});
return $this;
}
protected function _canAddResult() {
return true;
}
protected function _buildOneResult() {
$array = [];
$this->_list_fields->eachDo(function ($field) use (&$array) {
$array [$field->getLabel()] = $field->getValue();
});
return $array;
}
}
class Class_NoticeUnimarc_ListFieldsRules extends Class_NoticeUnimarc_ListFields {
const
ID = 'id',
LABEL = 'label',
FILTER = 'filter';
protected $_rules;
protected function _init($rules) {
$label_field = new Class_NoticeUnimarc_Field(trim($rules->getLabelField()),
static::LABEL);
if (!$label_field->getCode())
return $this;
$this->_zone = $rules->getZonePadded();
$this->_valid = true;
$this->_rules = $rules;
$this->_list_fields->add($label_field);
$this->_list_fields->add(new Class_NoticeUnimarc_Field(trim($rules->getIdField()),
static::ID));
$this->_list_fields
->add(new Class_NoticeUnimarc_Field($rules->getFilterField(),
static::FILTER));
return $this;
}
protected function _getFieldLabel() {
return $this->_detectByLabel(static::LABEL);
}
protected function _getFieldId() {
return $this->_detectByLabel(static::ID);
}
protected function _getFieldFilter() {
return $this->_detectByLabel(static::FILTER);
}
protected function _detectByLabel($label) {
return $this->_list_fields->detect(function ($field) use ($label) {
return $label === $field->getLabel();
});
}
protected function _canAddResult() {
$field_label = $this->_getFieldLabel();
$label = $this->_truncateLabel($field_label->getValue());
$field_label->setValue($label);
if (!$label)
return false;
$filter_zone = $this->_rules->getZone();
$filter_field = $this->_rules->getFilterField();
$filter_value = $this->_rules->getFilterValue();
if (!$filter_zone || (null === $filter_field) | !$filter_value)
return true;
return $this->_getFieldFilter()->getValue() == $filter_value;
}
protected function _buildOneResult() {
return [static::ID => (($id = $this->_getFieldId()->getValue())
? strtoupper($id)
: ''),
static::LABEL => $this->_getFieldLabel()->getValue()];
}
protected function _truncateLabel($label) {
$valid = is_string($label) && $label > '';
if (!$this->_rules->getLabelLength())
return $valid ? $label : '';
return $valid
? substr($label,
max(0, $this->_rules->getLabelStartPos() - 1),
$this->_rules->getLabelLength())
: '';
}
}