Commit b716410d authored by efalcy's avatar efalcy

Merge branch 'master' into 'dev#106075_explo_france_connect_avec_identifiant_gpsea'

Master

See merge request !3422
parents 80bba130 c3134f6f
Pipeline #9647 passed with stage
in 67 minutes and 12 seconds
02/03/2020 - v8.0.43
- ticket #106074 : Vue notice : Bokeh permet de désactiver l'affichage de la biographie d'un homonyme
- ticket #105149 : SIGB Koha : Ne pas afficher le bouton "Réserver" dans le portail Bokeh si le status Koha est "notforloan"
- ticket #106684 : Administration : Ajout d'un message sur la journée Bokeh du 2 avril 2020 à Talence
- ticket #104950 : Administration : Ajout du critère d'ầge pour la recherche d'utilisateurs et les groupes dynamiques
- ticket #106079 : Intégration : Correction de l'import de l'indexation des facettes exemplaires lorsqu'une notice a plus de 1000 exemplaires
- ticket #102219 : Migration : Prise en charge des données albums cartes postales Ussel
18/02/2020 - v8.0.42
- ticket #92615 : Intégration des périodiques : meilleure prise en charge des périodiques issus des SIGB Koha et PMB
......
- ticket #104950 : Groupes recherche d'utilisateurs : ajout du critère âge
\ No newline at end of file
......@@ -104,6 +104,30 @@ class Admin_RecordsController extends ZendAfi_Controller_Action {
}
public function disableBiographyAction() {
$record = Class_Notice::find($this->_getParam('record_id'));
$author = Class_CodifAuteur::find($this->_getParam('author_id'));
$language = $this->_getParam('language');
(new Class_WebService_AllServices())->disableBiographyForRecord($author, $record, $language);
$this->_helper->notify($this->_('La biographie a été désactivée pour %s',
$author->getLibelle()));
$this->_redirectToReferer();
}
public function enableBiographyAction() {
$record = Class_Notice::find($this->_getParam('record_id'));
$author = Class_CodifAuteur::find($this->_getParam('author_id'));
$language = $this->_getParam('language');
(new Class_WebService_AllServices())->enableBiographyForRecord($author, $record, $language);
$this->_helper->notify($this->_('La biographie a été activée pour %s',
$author->getLibelle()));
$this->_redirectToReferer();
}
public function trailerAction() {
$this->view->titre = $this->_('Modifier la bande-annonce');
......
<table>
<tr>
<td><img src="<?php echo URL_ADMIN_IMG;?>iconfinder_megaphone_1296371.png"></td>
<td style="font-size:1.2em">
La journée professionnelle autour de Bokeh aura lieu le Jeudi 2 Avril 2020 en région bordelaise (Talence - 33)<br>
Programme et inscription : <a href="https://www.bokeh-library-portal.org/cms/articleview/id/101">https://www.bokeh-library-portal.org/cms/articleview/id/101</a>
</td>
</tr>
</table>
<?php echo $this->renderBokehVersion();?>
<?php
echo $this->renderBokehVersion();
if ($this->is_request_secure)
echo $this->myBibAppTeaser();
?>
......@@ -13,9 +21,9 @@ if ($this->is_request_secure)
echo $this->_('Démonstrations vidéos');
?>
</h2>
<div><iframe width="750" height="450" src="https://www.youtube.com/embed/videoseries?list=PLL40cYmJt-b9YSCI0rvnxl8xjptuvgiZC" allowfullscreen></iframe></div>
<div><iframe width="750" height="450" src="https://www.youtube.com/embed/videoseries?list=PLL40cYmJt-b9YSCI0rvnxl8xjptuvgiZC" allowfullscreen></iframe></div>
<h2><?php echo $this->_('Paramètres du site');?>&nbsp;:</h2>
<h2><?php echo $this->_('Paramètres du site');?>&nbsp;:</h2>
<?php
$lien = $edit_domain_name = '';
if ($this->user->isAdmin()) {
......
......@@ -287,9 +287,17 @@ class RssController extends ZendAfi_Controller_Action {
public function renderItemsAction() {
if (!$this->view->rss = Class_Rss::find($this->_getParam('id', null)))
if (!$rss = Class_Rss::find($this->_getParam('id', null)))
return $this->getHelper('ViewRenderer')->setNoRender();
$this->getHelper('ViewRenderer')->setLayoutScript('subModal.phtml');
$content = $this->view->rss_RenderItems($rss);
$script_loader = Class_ScriptLoader::getInstance();
$scripts = $script_loader
->addAdminScript('onload_utils')
->addJQueryReady('setupAnchorsTarget();')
->html();
return $this->_helper->HTMLAjaxResponse($scripts . $content);
}
}
'92615' =>
['Label' => $this->_('Intégration des périodiques issus des SIGB Koha et PMB'),
'Desc' => $this->_('Bokeh gère trois niveaux de notices de périodiques: titre de périodique, fascicule et dépouillement. Pour chaque niveau de notice, Bokeh affichera des liens pour aller au niveau supérieur ou inférieur'),
'Image' => '',
'Video' => 'https://youtu.be/tbdQufZij_k',
'Category' => $this->_('Intégration du catalogue'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Import_des_p%C3%A9riodiques_Koha_dans_Bokeh',
'Test' => '',
'Date' => '2020-02-06'],
\ No newline at end of file
......@@ -21,27 +21,34 @@
class CodifAnnexeCache {
static $_instance;
use Trait_Singleton;
protected $_cache = [];
protected
$_cache_by_code,
$_cache_by_id_origine;
public static function getInstance() {
if (!isset(static::$_instance))
static::$_instance = new static();
return static::$_instance;
protected function _generateCache() {
$this->_cache_by_code = [];
$this->_cache_by_id_origine = [];
foreach (Class_CodifAnnexe::findAll() as $annex) {
$this->_cache_by_code[$annex->getCode()] = $annex;
$this->_cache_by_id_origine[$annex->getIdOrigine()] = $annex;
}
}
public function find($key) {
if (isset($this->_cache[$key]))
return $this->_cache[$key];
if (!isset($_cache_by_code))
$this->_generateCache();
if (isset($this->_cache_by_code[$key]))
return $this->_cache_by_code[$key];
if ($model = Class_CodifAnnexe::findFirstBy(['code' => $key]))
return $this->_cache[$key] = $model;
if (isset($this->_cache_by_id_origine[$key]))
return $this->_cache_by_id_origine[$key];
return $this->_cache[$key] = Class_CodifAnnexe::findFirstBy(['id_origine' => $key]);
return null;
}
}
?>
\ No newline at end of file
......@@ -420,7 +420,10 @@ class notice_integration {
$this->notice['exemplaires'] = [ ['code_barres' => sprintf('%s-%s',
$this->id_int_bib,
$this->notice["id_origine"])] ];
$this->notice['id_origine'] = $this->analyseur->getIssn();
if ($issn = $this->analyseur->getIssn())
$this->notice['id_origine'] = $issn;
return $this;
}
......
......@@ -564,7 +564,7 @@ class notice_unimarc extends iso2709_record {
if ($champ_annexe and $champ['code'] == $champ_annexe) {
$annexe = CodifAnnexeCache::getInstance()->find($champ['valeur']);
if ($champ['valeur'] && $this->isAnnexeInvisible($champ['valeur']))
if ($annexe && !$annexe->isVisible())
$ex['ignore_exemplaire'] = true;
$ex['annexe'] = ($annexe) ? $annexe->getCode() : $champ['valeur'];
}
......
......@@ -441,6 +441,7 @@ abstract class KohaPeriodiquesWithArticlesTestCase extends KohaPeriodiquesTestCa
->setTypeDocRecognition(Class_TypeDoc::PERIODIQUE, '', 'PER')
->setTypeDocRecognition(Class_TypeDoc::PERIODIQUE_TITLE, 'as', '')
->setTypeDocField('h')
->setAnnexField('b')
->getRawAttributes();
}
}
......@@ -451,15 +452,46 @@ abstract class KohaPeriodiquesWithArticlesTestCase extends KohaPeriodiquesTestCa
class KohaPeriodiquesMatriculeAngesTest extends KohaPeriodiquesWithArticlesTestCase {
public function setUp() {
parent::setUp();
$this->fixture('Class_CodifAnnexe',
['id' => 3,
'id_origine' => 'CHY-JR',
'code' => 'CHYJR',
'libelle' => 'Bibliothèque Jean-Jacques Rousseau']);
$this->loadRecordsFromFile('unimarc_lettre_spectacle');
$this->loadRecordsFromFile('unimarc_article_matricule_ange');
$this->loadRecordsFromFile('unimarc_article_matricule_ange2');
$this->loadRecordsFromFile('unimarc_serial_matricule_ange');
foreach(Class_Notice::findAll() as $record)
$record->updateFacetsFromExemplaires();
}
/** @test */
public function numberOfRecordsShouldBe54() {
$this->assertEquals(54, count(Class_Notice::findAll()));
}
/** @test */
public function numberOfRecordsShouldBe52() {
$this->assertEquals(52, count(Class_Notice::findAll()));
public function secondItemIdOrigineShouldBe519682fromRecord001() {
$item = Class_Exemplaire::find(2);
$this->assertEquals('519682', $item->getIdOrigine());
}
/** @test */
public function numberOfItemsShouldBe57() {
$this->assertCount(57, Class_Exemplaire::findAll());
}
/** @test */
public function lettreSpectacleTitleShouldHaveOneItem() {
$this->assertEquals(1,
Class_Notice::findFirstBy(['clef_chapeau' => 'LETTRE DU SPECTACLE'])->numberOfExemplaires());
}
......@@ -510,8 +542,8 @@ class KohaPeriodiquesMatriculeAngesTest extends KohaPeriodiquesWithArticlesTestC
/** @test */
public function twoRecordsShouldHaveTypeDocPERIODIQUE_TITLE() {
$this->assertCount(2,
public function threeRecordsShouldHaveTypeDocPERIODIQUE_TITLE() {
$this->assertCount(3,
Class_Notice::findAllBy(['type_doc' => Class_TypeDoc::PERIODIQUE_TITLE]));
}
......@@ -588,6 +620,16 @@ class KohaPeriodiquesMatriculeAngesTest extends KohaPeriodiquesWithArticlesTestC
$this->assertEquals('111511 Matricule des Anges (Le) 179',
$record->getAllStringsInFields([['461', '9'], ['461', 't'], ['461', 'v'],]));
}
/** @test */
public function allMatriculeAngesSerialFacettesShouldContainsYCHYJR() {
$records = Class_Notice::findAllBy(['type_doc' => Class_TypeDoc::PERIODIQUE,
'clef_chapeau' => 'MATRICULE DES ANGES LE']);
foreach($records as $index => $record)
$this->assertContains('YCHYJR', $record->getFacettes(),
'at position: ' . $index . ', title: ' . $record->getTitrePrincipal());
}
}
......
......@@ -21,6 +21,7 @@
require_once 'classe_notice_integration.php';
require_once 'classe_notice_marc21.php';
require_once 'classe_codif_cache.php';
require_once 'ModelTestCase.php';
......@@ -68,6 +69,8 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase {
$sql = $this->_mock_sql = $this->mock();
profil_donnees::clearCache();
CodifAnnexeCache::resetInstance();
$this->_mock_sql
->whenCalled('execute')->answers(true)
->whenCalled('fetchAll')->answers(null)
......
00618nas 22001693 4500001000700000090001100007100004100018101000800059102000700067200012200074210003100196215001500227326001600242676000800258801004900266995013300315519682 a519682 a20190717a1999 u||u0frey50 ba afre aFR aLa Lettre du spectaclebPériodiqueeL'information des professionnels du spectacle vivantf[dir. publ. Nicolas Marc] aNantesc M Médiasd1999- an°d30 cm aBimensuelle eBDP aFRbCité des Arts - Chambéryc2019/07/17 10203052019-07-179549426bCHY-CAcCHY-CAe905fCHY-CA19070271hPERi2019-07-17o0rPRETNORMALvn°454, juil. 2019y2019-07-17
\ No newline at end of file
......@@ -451,6 +451,17 @@ class Class_AlbumRessource extends Storm_Model_Abstract {
}
/**
* @param $name string input file name
* @param $mover Class_UploadMover_Abstract
* @return Class_AlbumRessource
*/
public function setUploadMover($name, $mover) {
$this->getUploadHandler($name)->setUploadMover($mover);
return $this;
}
/**
* @return Class_Folder_Manager
*/
......
......@@ -36,6 +36,13 @@ class Class_CodifAuteur_Description {
}
public function restrictToRecord($record) {
$this->_all_records = [$record];
$this->_associated_authors = [];
return $this;
}
public function getAuthor() {
return $this->_author;
}
......@@ -102,12 +109,28 @@ class Class_CodifAuteur_Description {
}
public function hasBiography() {
return !empty($this->_fetchBiographyFromCacheServer()['wikidata_id']);
}
public function isBiographyDisabled() {
$biography = $this->_fetchBiographyFromCacheServer();
if (!isset($biography['biography_disabled']))
return false;
return 1 === (int)$biography['biography_disabled'];
}
public function renderBiographieOn($view) {
if (!count($this->getRecords()))
return '';
$data = $this->fetchBiography();
if ($this->isBiographyDisabled())
return $this->renderEditButtonOn($view);
$data = $this->fetchBiography();
if ($biography = $data->getbiographie()) {
$biography = $this->_enrichBiographyWithRecords($biography,
$this->getRecords(),
......@@ -126,14 +149,13 @@ class Class_CodifAuteur_Description {
'alt' => $this->getLabel() . '. ' . $this->_('Source: Wikipedia')]);
$update_button = $view->biographie_UpdateButton($this->getRecords()[0],
$this->getLabel());
$update_buttons = $this->renderEditButtonOn($view);
$licence = $view->biographie_Licence($this->getLabel(),
$data->getsource(),
$data->geturl_source());
$licence = $view->biography_Licence($this->getLabel(),
$data->getsource(),
$data->geturl_source());
return $update_button . $thumbnail . $biography . $licence;
return $update_buttons . $thumbnail . $biography . $licence;
}
......@@ -198,14 +220,14 @@ class Class_CodifAuteur_Description {
}
protected function _fetchBiography($author, $all_records, $associated_authors) {
protected function _fetchBiographyFromCacheServer() {
if ($this->_biography)
return $this->_biography;
if (!$all_records)
if (!$all_records = $this->getRecords())
return [];
$args = ['auteur' => $author->getLibelle(),
$args = ['auteur' => $this->_author->getLibelle(),
'clef_oeuvre' => $all_records[0]->getClefOeuvre(),
'language' => Class_Profil::getCurrentProfil()->getLocale()];
......@@ -214,9 +236,7 @@ class Class_CodifAuteur_Description {
public function fetchBiography() {
$bio = new Class_Entity($this->_fetchBiography($this->_author,
$this->getRecords(),
$this->getAssociatedAuthors()));
$bio = new Class_Entity($this->_fetchBiographyFromCacheServer());
$author_attribs = array_intersect_key($bio->toArray(),
['wikidata_id' => '',
......@@ -306,17 +326,15 @@ class Class_CodifAuteur_Description {
public function renderEditButtonOn($view) {
if (!$records = $this->getRecords())
return '';
return $view->biographie_UpdateButton($this->getRecords()[0],
$this->getLabel());
return $view->biography_UpdateButtons($this);
}
public function renderThumbnailOn($view) {
$this->fetchBiography();
if ($this->isBiographyDisabled())
return '';
$this->fetchBiography();
return $this->_author->getThumbnailUrl()
? $view->tag('img',
null,
......@@ -327,8 +345,10 @@ class Class_CodifAuteur_Description {
public function renderWikipediaOn($view) {
$data = $this->fetchBiography();
if ($this->isBiographyDisabled())
return '';
$data = $this->fetchBiography();
if (!$biography = $data->getbiographie())
return '';
......@@ -338,6 +358,9 @@ class Class_CodifAuteur_Description {
return $this->_enrichBiographyWithAuthorLinks($biography,
$this->getAssociatedAuthors(),
$view);
$view)
. $view->biography_Licence($this->getLabel(),
$data->getsource(),
$data->geturl_source());
}
}
\ No newline at end of file
......@@ -57,7 +57,7 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
$this->_cleanMemory();
}
Class_CosmoVar::setValueOf('date_maj_facettes', $this->_last_update_date);
Class_CosmoVar::setValueOf('date_maj_facettes', $this->getCurrentDateTime());
$this->_log->log('<span class="vert">'.
'Toutes les exemplaires ont été mis à jour :' .
......@@ -80,8 +80,17 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
return $this->_resetDbConnection()
->_phase;
if (static::MAX_ITEMS < Class_Exemplaire::countBy(['id_notice' => $record->getId()]))
return;
if (static::MAX_ITEMS < Class_Exemplaire::countBy(['id_notice' => $record->getId()])) {
$this->_log->error('<span class="rouge">'
. $this->_('La notice "%s" (id: %s) a plus de %s exemplaires: facettes non mises à jour',
$record->getTitrePrincipal(),
$record->getId(),
static::MAX_ITEMS)
. '</span>');
$this->_setData('pointeur_notice', $record->getId());
$this->_incrementData('nombre');
continue;
}
$this->_runOne($record);
}
......@@ -96,7 +105,6 @@ class Class_Cosmogramme_Integration_PhaseItemFacets
$this->_setData('pointeur_notice', $record->getId());
$this->_incrementData('nombre');
$this->_last_update_date = $record->getDateMaj();
}
......
......@@ -775,6 +775,27 @@ class Class_Feature_List {
'Test' => '',
'Date' => '2020-02-06'],
'106074' =>
['Label' => $this->_('Désactiver une biographie'),
'Desc' => $this->_('Bokeh permet de désactiver l\'affichage de la biographie d\'un homonyme'),
'Image' => '',
'Video' => '',
'Category' => $this->_('Administration'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Modifier_la_biographie_issue_de_Wikip%C3%A9dia',
'Test' => '',
'Date' => '2020-02-20'],
'92615' =>
['Label' => $this->_('Intégration des périodiques issus des SIGB Koha et PMB'),
'Desc' => $this->_('Bokeh gère trois niveaux de notices de périodiques: titre de périodique, fascicule et dépouillement. Pour chaque niveau de notice, Bokeh affichera des liens pour aller au niveau supérieur ou inférieur'),
'Image' => '',
'Video' => 'https://youtu.be/tbdQufZij_k',
'Category' => $this->_('Intégration du catalogue'),
'Right' => function($feature_description, $user) {return true;},
'Wiki' => 'http://wiki.bokeh-library-portal.org/index.php?title=Import_des_p%C3%A9riodiques_Koha_dans_Bokeh',
'Test' => '',
'Date' => '2020-02-06'],
];
}
}
\ No newline at end of file
......@@ -969,6 +969,10 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
return $this->setItemField(self::FIELD_ITEM_TYPE_DOC, $value);
}
public function setAnnexField($value) {
return $this->setItemField(self::FIELD_ITEM_ANNEXE, $value);
}
public function setAvailabilityField($value) {
return $this->setItemField(self::FIELD_ITEM_AVAILABILITY, $value);
......
......@@ -16,10 +16,12 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
abstract class Class_UploadMover_Abstract {
use Trait_Translator;
/** @var string */
protected $_error;
......@@ -30,7 +32,23 @@ abstract class Class_UploadMover_Abstract {
* @param string $destination
* @return bool
*/
abstract public function moveTo($source, $destination);
public function moveTo($source, $destination) {
if ($this->_realMoveTo($source, $destination))
return true;
$this->setError($this->_('Impossible d\'écrire le fichier sur le serveur au chemin [%s]',
$destination));
return false;
}
/**
* @codeCoverageIgnore
* @param string $source
* @param string $destination
* @return bool
*/
abstract protected function _realMoveTo($source, $destination);
/**
......@@ -52,5 +70,3 @@ abstract class Class_UploadMover_Abstract {
return $this->_error;
}
}
?>
\ No newline at end of file
......@@ -20,22 +20,15 @@
*/
class Class_UploadMover_HttpPost extends Class_UploadMover_Abstract {
use Trait_Translator,
Trait_StaticFileWriter;
use Trait_StaticFileWriter;
/**
* @codeCoverageIgnore
* @param string $source
* @param string $destination
* @return bool
*/
public function moveTo($source, $destination) {
if (!$this->getFileWriter()->moveUploadedFile($source, $destination)) {
$this->setError(sprintf($this->_('Impossible d\'écrire le fichier sur le serveur au chemin [%s]'), $destination));
return false;
}
return true;
protected function _realMoveTo($source, $destination) {
return $this->getFileWriter()->moveUploadedFile($source, $destination);
}
}
?>
\ No newline at end of file
......@@ -16,26 +16,18 @@
*
* 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
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_UploadMover_LocalFile extends Class_UploadMover_Abstract {
use Trait_Translator;
/**
* @codeCoverageIgnore
* @param string $source
* @param string $destination
* @return bool
*/
public function moveTo($source, $destination) {
protected function _realMoveTo($source, $destination) {
@rename($source, $destination);
if (!file_exists($destination)) {
$this->setError(sprintf($this->_('Impossible d\'écrire le fichier sur le serveur au chemin [%s]'), $destination));
return false;
}
return true;
return file_exists($destination);
}
}
?>
\ No newline at end of file
......@@ -161,6 +161,17 @@ class Class_User_Cards extends Storm_Model_Collection {
}
public function getPNBLoans() {
$loans = $this->getLoans()
->select(function($loan)
{
return $loan->isPNB();
});
return $loans;
}
public function getLoansHistory() {
return $this->_decorateOperationFrom(
function($card) {
......
......@@ -22,9 +22,18 @@
class Class_WebService_AllServices {
use Trait_Translator;
const RETOUR_SERVICE_OK = 2;
const SVC_API = '2.0';
const
RETOUR_SERVICE_OK = 2,
SVC_API = '2.0',
SVC_GET_BIOGRAPHY = 8,
SVC_GET_VIDEO = 9,
SVC_GET_INTERVIEW = 7,
SVC_UPLOAD_THUMBNAIL = 12,
SVC_SET_BIOGRAPHY = 13,
SVC_SET_TRAILER = 14,
SVC_GET_THUMBNAIL = 10,
BIO_ENABLED = 'enabled',
BIO_DISABLED = 'disabled';
private static $_http_client;
......@@ -75,37 +84,36 @@ class Class_WebService_AllServices {
public static function runServiceAfiBiographie($args) {
return self::runServiceAfi(8, $args);
return self::runServiceAfi(static::SVC_GET_BIOGRAPHY, $args);
}