Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (12)
Showing
with 188 additions and 76 deletions
- correctif #182545 : MATOMO : rendre les portails Bokeh opérationnels même si le serveur Matomo est indisponible
\ No newline at end of file
- correctif #193157 : Cosmogramme : lors de la phase de suppression des exemplaires, les notices sans exemplaires restants sont automatiquement supprimées.
\ No newline at end of file
- correctif #193340 : PNB : les liens télécharger ou consulter ne fonctionnent plus si on n'est pas connecté
\ No newline at end of file
- correctif #193922 : SIGB Koha : Lors de la récupération de la liste des bibliothèques auprès de Koha, les annexes avec le paramètre "Exclue du PEB" ne s'affichent pas dans la liste des sites de retrait des réservations. De la même façon, les bibliothèques dont le paramètre "public" est désactivté dans Koha n'apparaissent plus dans la liste des choix pour la pré-inscription des lecteurs.
\ No newline at end of file
- hotline #193173 : Affichage de notices de périodiques paginée : page blanche
\ No newline at end of file
...@@ -255,7 +255,6 @@ class BibNumeriqueController extends ZendAfi_Controller_Action { ...@@ -255,7 +255,6 @@ class BibNumeriqueController extends ZendAfi_Controller_Action {
protected function _userShouldBeRedirect() { protected function _userShouldBeRedirect() {
if (!$this->_user){ if (!$this->_user){
$this->getResponse()->setHeader('Location', $this->view->url());
$this->_forwardToLogin('', $this->view->url()); $this->_forwardToLogin('', $this->view->url());
return true; return true;
} }
......
...@@ -30,6 +30,7 @@ require_once 'classe_communication.php'; ...@@ -30,6 +30,7 @@ require_once 'classe_communication.php';
class notice_integration { class notice_integration {
use use
Trait_CodifProviderAware, Trait_CodifProviderAware,
Trait_Translator,
Trait_TimeSource; Trait_TimeSource;
const const
...@@ -900,21 +901,21 @@ class notice_integration { ...@@ -900,21 +901,21 @@ class notice_integration {
return false; return false;
} }
$exemplaires = Class_Exemplaire::findAllBy(['id_notice' => $id_notice, $deleted = Class_Exemplaire::deleteBy(['id_notice' => $id_notice,
'id_int_bib' => $this->id_int_bib, 'id_int_bib' => $this->id_int_bib,
'code_barres' => $ex['code_barres']]); 'code_barres' => $ex['code_barres']]);
if(!$exemplaires) {
if(!$deleted) {
$this->statut = static::RECORD_REJECT; $this->statut = static::RECORD_REJECT;
$this->erreur="code-barres à supprimer non trouvé"; $this->erreur = $this->_("code-barres %s à supprimer non trouvé", $ex['code_barres']);
return false; return false;
} }
foreach($exemplaires as $exemplaire) { if(Class_Exemplaire::countBy(['id_notice' => $id_notice]))
$notice->removeExemplaire($exemplaire); return $notice->setDateMaj(dateDuJour(2))
} ->save();
$notice->setDateMaj(dateDuJour(2)) $notice->delete();
->save();
} }
......
...@@ -431,7 +431,7 @@ class NoticeIntegrationAloesDimancheALaPiscineTest extends NoticeIntegrationAloe ...@@ -431,7 +431,7 @@ class NoticeIntegrationAloesDimancheALaPiscineTest extends NoticeIntegrationAloe
public function supprimerExemplaireWithUnknownCodeBarresShouldSetError() { public function supprimerExemplaireWithUnknownCodeBarresShouldSetError() {
$this->notice_integration->supprimerExemplaire(1, ['code_barres' => '666']); $this->notice_integration->supprimerExemplaire(1, ['code_barres' => '666']);
$this->assertEquals(['statut' => 0, $this->assertEquals(['statut' => 0,
'erreur' => 'code-barres à supprimer non trouvé', 'erreur' => 'code-barres 666 à supprimer non trouvé',
'warnings' => [], 'warnings' => [],
'identification' => 'non trouvée'], 'identification' => 'non trouvée'],
$this->notice_integration->getLastStatut()); $this->notice_integration->getLastStatut());
......
...@@ -591,17 +591,12 @@ class Class_Notice extends Storm_Model_Abstract { ...@@ -591,17 +591,12 @@ class Class_Notice extends Storm_Model_Abstract {
} }
/* deprecated */
public function getArticlesPeriodique() { public function getArticlesPeriodique() {
// lire dans la base // lire dans la base
$datas = Class_Notice_SerialArticles::findAllBy(['clef_chapeau' => $this->getClefChapeau(), $datas = $this->getSerialsArticles();
'clef_numero' => $this->getTomeAlpha(),
'order' => 'id_article asc']);
$articles = []; $articles = [];
foreach ($datas as $enreg) { foreach ($datas as $enreg) {
if (!$enreg->getUnimarc()) continue;
$serial_article = $enreg->getMarcRecord(); $serial_article = $enreg->getMarcRecord();
$article = ["titre" => $serial_article->getTitrePrincipal()]; $article = ["titre" => $serial_article->getTitrePrincipal()];
if ($complement = $serial_article->getComplementTitre()) if ($complement = $serial_article->getComplementTitre())
...@@ -621,6 +616,17 @@ class Class_Notice extends Storm_Model_Abstract { ...@@ -621,6 +616,17 @@ class Class_Notice extends Storm_Model_Abstract {
} }
public function getSerialsArticles(): array
{
return Class_Notice_SerialArticles::query()
->eq('clef_chapeau', $this->getClefChapeau())
->eq('clef_numero', $this->getTomeAlpha())
->gt('unimarc', '')
->order('id_article')
->fetchAll();
}
public function getCodeFacette($champ) { public function getCodeFacette($champ) {
foreach ($this->getFacetCodes() as $item) { foreach ($this->getFacetCodes() as $item) {
if ($item[0] == $champ) if ($item[0] == $champ)
......
...@@ -63,6 +63,7 @@ class Class_WebService_Analytics_MatomoTracker extends Class_WebService_Analytic ...@@ -63,6 +63,7 @@ class Class_WebService_Analytics_MatomoTracker extends Class_WebService_Analytic
->setCountry('') ->setCountry('')
->setRegion('') ->setRegion('')
->setCity('') ->setCity('')
->setRequestTimeout(2)
->setUserId(Class_Users::currentUserId()); ->setUserId(Class_Users::currentUserId());
return $this; return $this;
} }
......
...@@ -100,7 +100,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -100,7 +100,7 @@ class Class_WebService_SIGB_Koha_CommunityService
protected function _updateSigbUser(Class_WebService_SIGB_Emprunteur $emprunteur) : bool { protected function _updateSigbUser(Class_WebService_SIGB_Emprunteur $emprunteur) : bool {
$data = $this->_prepareData($emprunteur); $data = $this->_prepareData($emprunteur);
$url = $this->getServerRoot() . '/patrons/' . $emprunteur->getId(); $url = $this->_buildUrlForEndpointWithParams('patrons/' . $emprunteur->getId());
$response = $this->getWebClient() $response = $this->getWebClient()
->putRawData($url, ->putRawData($url,
json_encode($data), json_encode($data),
...@@ -128,8 +128,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -128,8 +128,7 @@ class Class_WebService_SIGB_Koha_CommunityService
if ( ! $emprunteur->getPreviousPassword()) if ( ! $emprunteur->getPreviousPassword())
return false; return false;
$url = $this->getServerRoot() . '/patrons/' . $url = $this->_buildUrlForEndpointWithParams('patrons/' . $emprunteur->getId() . '/password');
$emprunteur->getId() . '/password';
$password = $emprunteur->getPassword(); $password = $emprunteur->getPassword();
$datas = ['password' => $password, $datas = ['password' => $password,
...@@ -175,7 +174,8 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -175,7 +174,8 @@ class Class_WebService_SIGB_Koha_CommunityService
public function branches() : array { public function branches() : array {
$url = $this->getServerRoot() . '/public/libraries'; $url = $this->_buildUrlForEndpointWithParams('public/libraries',
['q' => $this->_buildFilterQuery(['public' => 1])]);
$json = $this->httpGetWithParams($url, []); $json = $this->httpGetWithParams($url, []);
if (null === ($branches = json_decode($json))) { if (null === ($branches = json_decode($json))) {
...@@ -273,7 +273,9 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -273,7 +273,9 @@ class Class_WebService_SIGB_Koha_CommunityService
$pickup_locations = []; $pickup_locations = [];
foreach($locations as $bib) foreach($locations as $bib)
$pickup_locations[$bib->library_id] = $bib->name; if (($annexe = Class_CodifAnnexe::findFirstBy(['id_origine' => $bib->library_id]))
&& !$annexe->getNoPickup())
$pickup_locations[$bib->library_id] = $bib->name;
return $pickup_locations; return $pickup_locations;
} }
...@@ -284,8 +286,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -284,8 +286,7 @@ class Class_WebService_SIGB_Koha_CommunityService
return $this->_error($this->_('Échec de l\'authentification par le webservice')); return $this->_error($this->_('Échec de l\'authentification par le webservice'));
$url = $this->_buildUrlForEndpointWithParams('suggestions', $url = $this->_buildUrlForEndpointWithParams('suggestions',
['q' => '{"suggested_by":' ['q' => $this->_buildFilterQuery(['suggested_by' => $patron_id])]);
. $patron_id . '}']);
$json = $this->httpGetWithParams($url, $this->_getAuth()); $json = $this->httpGetWithParams($url, $this->_getAuth());
...@@ -340,7 +341,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -340,7 +341,7 @@ class Class_WebService_SIGB_Koha_CommunityService
if(!$item_id) if(!$item_id)
return $this->addError($this->_('Échec de l\'authentification par le webservice')); return $this->addError($this->_('Échec de l\'authentification par le webservice'));
$url = $this->_buildUrlForEndpointWithParams('items/' . $item_id, []); $url = $this->_buildUrlForEndpointWithParams('items/' . $item_id);
$json = $this->httpGetWithParams($url, $this->_getAuth()); $json = $this->httpGetWithParams($url, $this->_getAuth());
if (null === ($item = json_decode($json))){ if (null === ($item = json_decode($json))){
$this->addError($this->_('Échec de la connexion au webservice')); $this->addError($this->_('Échec de la connexion au webservice'));
...@@ -360,7 +361,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -360,7 +361,7 @@ class Class_WebService_SIGB_Koha_CommunityService
$this->addError($this->_('Échec de l\'authentification par le webservice')); $this->addError($this->_('Échec de l\'authentification par le webservice'));
$url = $this->_buildUrlForEndpointWithParams('checkouts', $url = $this->_buildUrlForEndpointWithParams('checkouts',
['q'=> '{"item_id":{"-not_like":"null"}}', ['q'=> $this->_buildFilterQuery(['item_id' => ['-not_like' => 'null']]),
'_match' => 'exact', '_match' => 'exact',
'checked_in' => 1, 'checked_in' => 1,
'patron_id' => $patron_id]); 'patron_id' => $patron_id]);
...@@ -407,7 +408,7 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -407,7 +408,7 @@ class Class_WebService_SIGB_Koha_CommunityService
} }
protected function _buildUrlForEndpointWithParams($endpoint, $params) : string { protected function _buildUrlForEndpointWithParams(string $endpoint, array $params = []) : string {
$url = $params $url = $params
? sprintf('%s?%s', $this->getServerRoot() . '/' . $endpoint, ? sprintf('%s?%s', $this->getServerRoot() . '/' . $endpoint,
http_build_query($params)) http_build_query($params))
...@@ -416,6 +417,11 @@ class Class_WebService_SIGB_Koha_CommunityService ...@@ -416,6 +417,11 @@ class Class_WebService_SIGB_Koha_CommunityService
return $url; return $url;
} }
protected function _buildFilterQuery(array $params) : string {
return json_encode($params);
}
public function lookupPatronByLogin($login) { public function lookupPatronByLogin($login) {
return $this->_forwardToIlsdi(__FUNCTION__, func_get_args()); return $this->_forwardToIlsdi(__FUNCTION__, func_get_args());
} }
......
...@@ -20,11 +20,26 @@ ...@@ -20,11 +20,26 @@
*/ */
class Intonation_Library_View_Wrapper_SerialArticleFromArray class Intonation_Library_View_Wrapper_SerialArticleByRecord
extends Intonation_Library_View_Wrapper_Abstract { extends Intonation_Library_View_Wrapper_Abstract {
public function getMainTitle() { protected Class_Notice $_record;
return $this->_model['titre'];
public function __construct($model = null, $view = null) {
$this
->setView($view)
->setModel($model);
$this->setWidgetContext(new Intonation_Library_Widget_Carousel_NullContext);
}
function getMainTitle() {
$article = $this->_record()->getTitrePrincipal();
if ($complement = $this->_record()->getComplementTitre())
return $article .= " : " . $complement;
return $article;
} }
...@@ -54,7 +69,7 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray ...@@ -54,7 +69,7 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray
public function getSecondaryTitle() { public function getSecondaryTitle() {
return $this->_model['auteur']; return $this->_record()->getFirstAuthor();
} }
...@@ -75,12 +90,15 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray ...@@ -75,12 +90,15 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray
public function getDescription() { public function getDescription() {
$html = ''; $html = '';
$note = $this->_record()->get_subfield("300", "a");
$note = isset($note[0]) ? trim($note[0]) : '';
$summary = $this->_record()->getResume();
if ($note = $this->_model['note']) if ($note)
$html .= $this->_view->tag('p', $note); $html .= $this->_view->tag('p', $note);
if ($resume = $this->_model['resume']) if ($summary)
$html .= $this->_view->tag('p', $resume); $html .= $this->_view->tag('p', $summary);
return $html; return $html;
} }
...@@ -99,15 +117,15 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray ...@@ -99,15 +117,15 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray
public function getBadges() { public function getBadges() {
$badges = []; $badges = [];
if ( $collation = $this->_model['pagination']) if ( $collation = $this->_record()->getCollation())
$badges [] = (new Intonation_Library_Badge) $badges [] = (new Intonation_Library_Badge)
->setClass('badge_serial_article_collation') ->setClass('badge_serial_article_collation')
->setText($this->_('Collation : %s', $collation)); ->setText($this->_('Collation : %s', $collation));
foreach ($this->_model['matieres'] as $matiere) foreach ($this->_record()->getMatieresLabels() as $matiere)
$badges [] = (new Intonation_Library_Badge) $badges [] = (new Intonation_Library_Badge)
->setClass('badge_serial_article_matiere') ->setClass('badge_serial_article_matiere')
->setText($this->_('Matière : %s', $matiere)); ->setText($this->_('Matière : %s', $matiere));
return $this->_view->badgeGroup($badges); return $this->_view->badgeGroup($badges);
} }
...@@ -131,4 +149,10 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray ...@@ -131,4 +149,10 @@ class Intonation_Library_View_Wrapper_SerialArticleFromArray
public function getTimelineEventsDates() : Intonation_Library_TimelineEventsDates { public function getTimelineEventsDates() : Intonation_Library_TimelineEventsDates {
return new Intonation_Library_TimelineEventsDates; return new Intonation_Library_TimelineEventsDates;
} }
protected function _record(): Class_Notice
{
return $this->_record ??= $this->_model->getMarcRecord();
}
} }
...@@ -40,12 +40,12 @@ class Intonation_View_Notice_ArticlesPeriodiques extends ZendAfi_View_Helper_Bas ...@@ -40,12 +40,12 @@ class Intonation_View_Notice_ArticlesPeriodiques extends ZendAfi_View_Helper_Bas
protected function _renderSerialsArticles(Class_Notice $record) : string { protected function _renderSerialsArticles(Class_Notice $record) : string {
if ( ! $articles = $record->getArticlesPeriodique()) if ( ! $articles = $record->getSerialsArticles())
return ''; return '';
$articles = (new Storm_Collection($articles)) $articles = (new Storm_Collection($articles))
->collect(fn($article) ->collect(fn($serial_article)
=> new Intonation_Library_View_Wrapper_SerialArticleFromArray($article, => new Intonation_Library_View_Wrapper_SerialArticleByRecord($serial_article,
$this->view)); $this->view));
return return
......
...@@ -860,7 +860,7 @@ class AbonneControllerSuggestionAchatWithOneKohaSuggestionTest ...@@ -860,7 +860,7 @@ class AbonneControllerSuggestionAchatWithOneKohaSuggestionTest
$this->mock_web_client $this->mock_web_client
->whenCalled('open_url') ->whenCalled('open_url')
->with('http://plage.com/api/v1/suggestions?q=' . urlencode('{"suggested_by":2341}'), ->with('http://plage.com/api/v1/suggestions?q=' . urlencode('{"suggested_by":"2341"}'),
['auth' => ['user' => 'koha_admin', 'password' => 'koha_password']]) ['auth' => ['user' => 'koha_admin', 'password' => 'koha_password']])
->answers('[{ ->answers('[{
"date" : "2014-04-01T16:08:36+02:00", "date" : "2014-04-01T16:08:36+02:00",
...@@ -973,7 +973,7 @@ class AbonneControllerSuggestionAchatWithKohaErrorTest ...@@ -973,7 +973,7 @@ class AbonneControllerSuggestionAchatWithKohaErrorTest
$this->mock_web_client $this->mock_web_client
->whenCalled('open_url') ->whenCalled('open_url')
->with('http://plage.com/api/v1/suggestions?q=' . urlencode('{"suggested_by":2341}'), ->with('http://plage.com/api/v1/suggestions?q=' . urlencode('{"suggested_by":"2341"}'),
['auth' => ['user' => 'koha_admin', 'password' => 'koha_password']]) ['auth' => ['user' => 'koha_admin', 'password' => 'koha_password']])
->answers('{"errors":"Forbidden. 178.16.171.35 is not allowed to use this service. Are you sure configuration variable \'authorizedips\' is correctly configured?"}'); ->answers('{"errors":"Forbidden. 178.16.171.35 is not allowed to use this service. Are you sure configuration variable \'authorizedips\' is correctly configured?"}');
......
...@@ -767,7 +767,7 @@ class RechercheControllerViewNoticeMetasTest ...@@ -767,7 +767,7 @@ class RechercheControllerViewNoticeMetasTest
class RechercheControllerThumbnailTest extends RechercheControllerNoticeTestCase { class RechercheControllerVignetteThumbnailTest extends RechercheControllerNoticeTestCase {
/** @test */ /** @test */
public function rechercheVignetteActionShouldRedirectToRawThumbnailAction() { public function rechercheVignetteActionShouldRedirectToRawThumbnailAction() {
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
abstract class RechercheControllerThumbnailTestCase extends AbstractControllerTestCase { abstract class RechercheControllerThumbnailTestCase extends AbstractControllerTestCase {
protected
$_storm_default_to_volatile = true;
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
...@@ -111,17 +109,17 @@ class RechercheControllerThumbnailAlbumCmsWithImageTest ...@@ -111,17 +109,17 @@ class RechercheControllerThumbnailAlbumCmsWithImageTest
Class_Notice_Thumbnail_ProviderAbstract::setDefaultImageFactory($imagick); Class_Notice_Thumbnail_ProviderAbstract::setDefaultImageFactory($imagick);
$album = $this->fixture('Class_Album', $album = $this->fixture(Class_Album::class,
['id' => 777, ['id' => 777,
'titre' => 'Testing Album', 'titre' => 'Testing Album',
'visible' => 1, 'visible' => 1,
'status' => Class_Album::STATUS_VALIDATED, 'status' => Class_Album::STATUS_VALIDATED,
'ressources' => [$this->fixture('Class_AlbumRessource', 'ressources' => [$this->fixture(Class_AlbumRessource::class,
['id' => 12, ['id' => 12,
'fichier' => '12.png'])]]); 'fichier' => '12.png'])]]);
$album->index(); $album->index();
$this->dispatch('recherche/vignette/id_notice/1', true); $this->dispatch('recherche/vignette/id_notice/1');
} }
...@@ -134,25 +132,26 @@ class RechercheControllerThumbnailAlbumCmsWithImageTest ...@@ -134,25 +132,26 @@ class RechercheControllerThumbnailAlbumCmsWithImageTest
class RechercheControllerThumbnailAlbumSiteWithImageTest class RechercheControllerThumbnailAlbumSiteWithImageTest
extends RechercheControllerThumbnailTestCase { extends RechercheControllerThumbnailTestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$album = $this->fixture('Class_Album', $album = $this->fixture(Class_Album::class,
['id' => 777, ['id' => 777,
'titre' => 'Testing Album', 'titre' => 'Testing Album',
'visible' => 1, 'visible' => 1,
'status' => Class_Album::STATUS_VALIDATED, 'status' => Class_Album::STATUS_VALIDATED,
'ressources' => [$this->fixture('Class_AlbumRessource', 'ressources' => [$this->fixture(Class_AlbumRessource::class,
['id' => 12, ['id' => 12,
'poster' => 'linuxfr.jpg', 'poster' => 'linuxfr.jpg',
'url' => 'http://www.linuxfr.org', 'url' => 'http://www.linuxfr.org',
'fichier' => '12.png'])]]); 'fichier' => '12.png'])]]);
$album->index(); $album->index();
$this->dispatch('recherche/vignette/id_notice/1', true); $this->dispatch('recherche/vignette/id_notice/1');
} }
...@@ -165,6 +164,7 @@ class RechercheControllerThumbnailAlbumSiteWithImageTest ...@@ -165,6 +164,7 @@ class RechercheControllerThumbnailAlbumSiteWithImageTest
class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTest class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTest
extends RechercheControllerThumbnailTestCase { extends RechercheControllerThumbnailTestCase {
...@@ -173,19 +173,23 @@ class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTes ...@@ -173,19 +173,23 @@ class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTes
$fs = $this->mock() $fs = $this->mock()
->whenCalled('file_exists') ->whenCalled('file_exists')
->with('./userfiles/album/777/thumb_something_deleted.jpg')
->answers(false)
->whenCalled('file_exists')
->with('./userfiles/album/777/something_deleted.jpg')
->answers(false) ->answers(false)
->beStrict(); ->whenCalled('unlink')
->answers(false);
Class_Notice_Thumbnail_ProviderAlbum::setFileSystem($fs); Class_Notice_Thumbnail_ProviderAlbum::setFileSystem($fs);
Class_Album::setFileSystem($fs); Class_Album::setFileSystem($fs);
$album = $this->fixture('Class_Album', Class_WebService_Abstract::setHttpClient($this->mock()
->whenCalled('getResponse')
->with('http://jamendo.com/images/medium_XXXX.jpg')
->answers(new Class_Testing_HttpResponse(['Body' => 'a body']))
->beStrict());
$album = $this->fixture(Class_Album::class,
['id' => 777, ['id' => 777,
'titre' => 'Testing Album', 'titre' => 'Testing Album',
'visible' => 1, 'visible' => 1,
...@@ -203,14 +207,14 @@ class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTes ...@@ -203,14 +207,14 @@ class RechercheControllerThumbnailAlbumFromDigitalResourceWithBrokenThumbnailTes
->setUrlImage('') ->setUrlImage('')
->assertSave(); ->assertSave();
$this->dispatch('recherche/vignette/id_notice/' . $album->getNotice()->getId(), $this->dispatch('recherche/vignette/id_notice/' . $album->getNotice()->getId());
true);
} }
public function tearDown() { public function tearDown() {
Class_Notice_Thumbnail_ProviderAlbum::setFileSystem(null); Class_Notice_Thumbnail_ProviderAlbum::setFileSystem(null);
Class_Album::setFileSystem(null); Class_Album::setFileSystem(null);
Class_WebService_Abstract::resetHttpClient();
parent::tearDown(); parent::tearDown();
} }
......
...@@ -80,7 +80,8 @@ class KohaCommunityFixtures { ...@@ -80,7 +80,8 @@ class KohaCommunityFixtures {
->with('http://cat-aficg55.biblibre.com/api/v1/public/libraries/GRA') ->with('http://cat-aficg55.biblibre.com/api/v1/public/libraries/GRA')
->answers(static::successLibrariesGrans()) ->answers(static::successLibrariesGrans())
->whenCalled('open_url') ->whenCalled('open_url')
->with('http://cat-aficg55.biblibre.com/api/v1/public/libraries', []) ->with('http://cat-aficg55.biblibre.com/api/v1/public/libraries?q='
. urlencode('{"public":1}') , [])
->answers(static::branches()); ->answers(static::branches());
$params = ['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl', $params = ['url_serveur' => 'http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl',
...@@ -394,7 +395,7 @@ class KohaCommunityFixtures { ...@@ -394,7 +395,7 @@ class KohaCommunityFixtures {
public static function mockWebClientForSuggestionsOf($base_url,$web_client) { public static function mockWebClientForSuggestionsOf($base_url,$web_client) {
return $web_client->whenCalled('open_url') return $web_client->whenCalled('open_url')
->with($base_url . 'suggestions?q=' . urlencode('{"suggested_by":32007}'), ->with($base_url . 'suggestions?q=' . urlencode(json_encode(['suggested_by' => '32007'])),
['auth' => ['user' => 'koha_admin', 'password' => 'k0h@_P455']]) ['auth' => ['user' => 'koha_admin', 'password' => 'k0h@_P455']])
->answers(file_get_contents(__DIR__ . '/koha_suggestions_32007.json')); ->answers(file_get_contents(__DIR__ . '/koha_suggestions_32007.json'));
} }
...@@ -462,6 +463,30 @@ class KohaCommunityFixtures { ...@@ -462,6 +463,30 @@ class KohaCommunityFixtures {
"reply_to_email": null, "reply_to_email": null,
"return_path_email": null, "return_path_email": null,
"state": null, "state": null,
"url": null },
{
"address1": "1030 avenue centrale",
"address2": "BP48",
"address3": null,
"city": "Saint Martin d\'Heres",
"country": "France",
"email": "contact-koha-admin@sciencespo-grenoble.fr",
"fax": null,
"geolocation": null,
"illemail": null,
"ip": "195.221.53.*",
"library_id": "BIBLIOBUS",
"marc_org_code": null,
"name": "Bibliobus",
"needs_override": false,
"notes": null,
"phone": "04.76.82.61.13",
"pickup_location": true,
"postal_code": "38400",
"public": true,
"reply_to_email": null,
"return_path_email": null,
"state": null,
"url": null }]'; "url": null }]';
} }
} }
...@@ -32,7 +32,7 @@ abstract class PhaseDeleteItemsTestCase extends Class_Cosmogramme_Integration_Ph ...@@ -32,7 +32,7 @@ abstract class PhaseDeleteItemsTestCase extends Class_Cosmogramme_Integration_Ph
} }
protected function _prepareFixtures() { protected function _prepareFixtures() {
$this->fixture('Class_IntProfilDonnees', $this->fixture(Class_IntProfilDonnees::class,
['id' => 102, ['id' => 102,
'libelle' => 'Suppression exemplaires', 'libelle' => 'Suppression exemplaires',
'rejet_periodiques' => 1, 'rejet_periodiques' => 1,
...@@ -45,13 +45,13 @@ abstract class PhaseDeleteItemsTestCase extends Class_Cosmogramme_Integration_Ph ...@@ -45,13 +45,13 @@ abstract class PhaseDeleteItemsTestCase extends Class_Cosmogramme_Integration_Ph
[], [],
Class_IntProfilDonnees::FORMAT_SEMI_COLON_ASCII => ['champs' => 'code_barres']]]); Class_IntProfilDonnees::FORMAT_SEMI_COLON_ASCII => ['champs' => 'code_barres']]]);
$this->fixture('Class_IntBib', $this->fixture(Class_IntBib::class,
['id' => 2, ['id' => 2,
'nom_court' => 'petit', 'nom_court' => 'petit',
'sigb' => 1]); 'sigb' => 1]);
$this->fixture('Class_Cosmogramme_Integration', $this->fixture(Class_Cosmogramme_Integration::class,
['id' => 2, ['id' => 2,
'bib' => Class_IntBib::find(2), 'bib' => Class_IntBib::find(2),
'profil_donnees' => Class_IntProfilDonnees::find(102), 'profil_donnees' => Class_IntProfilDonnees::find(102),
...@@ -74,15 +74,15 @@ class PhaseDeleteItemsTest extends PhaseDeleteItemsTestCase { ...@@ -74,15 +74,15 @@ class PhaseDeleteItemsTest extends PhaseDeleteItemsTestCase {
protected function _prepareFixtures() { protected function _prepareFixtures() {
parent::_prepareFixtures(); parent::_prepareFixtures();
$this->fixture('Class_Notice', $this->fixture(Class_Notice::class,
['id' => 2, ['id' => 2,
'clef_alpha' => 'TINTIN', 'clef_alpha' => 'TINTIN',
'exemplaires' => [ 'exemplaires' => [
$this->fixture('Class_Exemplaire', $this->fixture(Class_Exemplaire::class,
['id' => 3, ['id' => 3,
'id_int_bib' => 2, 'id_int_bib' => 2,
'code_barres' => 'P123']), 'code_barres' => 'P123']),
$this->fixture('Class_Exemplaire', $this->fixture(Class_Exemplaire::class,
['id' => 4, ['id' => 4,
'id_int_bib' => 2, 'id_int_bib' => 2,
'code_barres' => 'X897']) 'code_barres' => 'X897'])
...@@ -121,15 +121,15 @@ class PhaseDeleteItemsFromANSIFileTest extends PhaseDeleteItemsTestCase { ...@@ -121,15 +121,15 @@ class PhaseDeleteItemsFromANSIFileTest extends PhaseDeleteItemsTestCase {
Class_Cosmogramme_Integration::find(2) Class_Cosmogramme_Integration::find(2)
->setFichier('barcodes_deleted_ansi.txt'); ->setFichier('barcodes_deleted_ansi.txt');
$this->fixture('Class_Notice', $this->fixture(Class_Notice::class,
['id' => 2, ['id' => 2,
'clef_alpha' => 'TINTIN', 'clef_alpha' => 'TINTIN',
'exemplaires' => [ 'exemplaires' => [
$this->fixture('Class_Exemplaire', $this->fixture(Class_Exemplaire::class,
['id' => 3, ['id' => 3,
'id_int_bib' => 2, 'id_int_bib' => 2,
'code_barres' => '02Ç9270194']), 'code_barres' => '02Ç9270194']),
$this->fixture('Class_Exemplaire', $this->fixture(Class_Exemplaire::class,
['id' => 4, ['id' => 4,
'id_int_bib' => 2, 'id_int_bib' => 2,
'code_barres' => 'X897']) 'code_barres' => 'X897'])
...@@ -143,4 +143,33 @@ class PhaseDeleteItemsFromANSIFileTest extends PhaseDeleteItemsTestCase { ...@@ -143,4 +143,33 @@ class PhaseDeleteItemsFromANSIFileTest extends PhaseDeleteItemsTestCase {
Class_Exemplaire::clearCache(); Class_Exemplaire::clearCache();
$this->assertNull(Class_Exemplaire::find(3)); $this->assertNull(Class_Exemplaire::find(3));
} }
} }
\ No newline at end of file
class PhaseDeleteItemsRecordWithSingleItemTest extends PhaseDeleteItemsTestCase {
protected function _prepareFixtures() {
parent::_prepareFixtures();
$this->fixture(Class_Notice::class,
['id' => 2,
'clef_alpha' => 'TINTIN',
'exemplaires' => [ $this->fixture(Class_Exemplaire::class,
['id' => 3,
'id_int_bib' => 2,
'code_barres' => 'P123'])]]);
}
/** @test */
public function itemP123ShouldBeDeleted() {
Class_Exemplaire::clearCache();
$this->assertNull(Class_Exemplaire::find(3));
}
/** @test */
public function recordTwoShouldBeDeleted() {
$this->assertNull(Class_Notice::find(2));
}
}
...@@ -644,6 +644,19 @@ class KohaCommunityPickupLocationsTest extends KohaCommunityTestCase { ...@@ -644,6 +644,19 @@ class KohaCommunityPickupLocationsTest extends KohaCommunityTestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
$this->fixture(Class_CodifAnnexe::class,
['id' => 15,
'libelle' => 'IEP Grenoble',
'id_origine' => 'IEPG',
'no_pickup' => false]);
$this->fixture(Class_CodifAnnexe::class,
['id' => 16,
'libelle' => 'Bibliobus',
'id_origine' => 'BIBLIOBUS',
'no_pickup' => true]);
$this->mock_web_client->whenCalled('open_url') $this->mock_web_client->whenCalled('open_url')
->with(static::BASE_URL . 'items/96630/pickup_locations?_match=exact&patron_id=32007', ->with(static::BASE_URL . 'items/96630/pickup_locations?_match=exact&patron_id=32007',
['auth'=> ['user' => 'koha_admin', 'password' => 'k0h@_P455']]) ['auth'=> ['user' => 'koha_admin', 'password' => 'k0h@_P455']])
......
...@@ -656,7 +656,6 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb ...@@ -656,7 +656,6 @@ class PnbDilicomDisplayBibNumeriqueControllerAjaxPopupBookActionTest extends Pnb
$local_xpath = new Storm_Test_XPath; $local_xpath = new Storm_Test_XPath;
$local_xpath->assertXPath($json->content, '//form//input[@name="username"]'); $local_xpath->assertXPath($json->content, '//form//input[@name="username"]');
$local_xpath->assertXPathContentContains($json->content, '//input[@type="hidden"][@name="redirect"]//@value', '/bib-numerique/download-loan-book-ajax/id/3', $json->content); $local_xpath->assertXPathContentContains($json->content, '//input[@type="hidden"][@name="redirect"]//@value', '/bib-numerique/download-loan-book-ajax/id/3', $json->content);
$this->assertHeaderContains('Location','/bib-numerique/download-loan-book-ajax/id/3');
} }
} }
......