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 (10)
Showing
with 211 additions and 31 deletions
'191240' =>
['Label' => $this->_('Import Cosmogramme de notices : filtrage sur 995$9==h'),
'Desc' => $this->_('Filtrage des exemplaires sur présence de 995$9 == h'),
'Image' => '',
'Video' => '',
'Category' => '',
'Right' => function($feature_description, $user) {return true;},
'Wiki' => '',
'Test' => '',
'Date' => '2023-12-15'],
\ No newline at end of file
- correctif #181663 : Notices Bacon : Indexation des notices Bacon, tenir compte des différents format d'images pour les vignettes.
\ No newline at end of file
- correctif #188180 : SIGB Koha : la liste des bibliothèques de retrait est obtenue auprès du SIGB (seules les bibliothèques dans lesquelles l'ouvrage est disponible sont affichées).
- correctif #191593 : ArteVOD : Les notices ArteVOD qui ne sont pas moissonnées ou mises à jour sont conservées dans le catalogue.
\ No newline at end of file
- correctif #191709 : Administration : PNB Dilicom critères de recherche non accéssible.
\ No newline at end of file
- fonctionnalité #176783 : Connecteur Decalog : tache #191240 Filtrage des exemplaires sur 995$9==h
\ No newline at end of file
......@@ -515,7 +515,8 @@ class RechercheController extends ZendAfi_Controller_Action {
return $this->renderPopupResult($this->view->_('Réservation'),
$this->_('Document introuvable'));
if (Class_CosmoVar::isSiteRetraitResaItemLibrary())
$code_annexe = $item->getAnnexe();
if ($item->requiresCalendarHold())
return $this->_redirect(sprintf('/recherche/reservation-calendar-ajax/id_bib/%s/copy_id/%s/code_annexe/%s',
......
......@@ -515,7 +515,9 @@ class notice_unimarc extends iso2709_record {
return;
}
if($champ['code'] == 'o' && $champ['valeur'] == 'd') {
if (($champ['code'] == 'o' && $champ['valeur'] == 'd')
|| ($champ['code'] == '9' && $champ['valeur'] == 'h')
){
$nb_ex_detruits++;
$ex['activite'] = 'd';
return;
......
......@@ -102,4 +102,57 @@ class NoticeUnimarcMultipleIsbnTest extends NoticeIntegrationTestCase {
public function withTwoIsbnsShouldKeepIsbn13() {
$this->assertEquals('978-2-8401-1742-1', Class_Notice::find(1)->getIsbn());
}
}
\ No newline at end of file
}
/** @see http://forge.afi-sa.fr/issues/191240 */
class NoticeUnimarcDecalogPiloneeTest extends NoticeIntegrationTestCase {
public function getProfilDonnees() {
$type_doc = [['code' => '0', 'label' => '', 'zone_995' => '' ],
['code' => '1', 'label' => 'am;na', 'zone_995' => 'LIVR' ]];
return $this
->fixture(Class_IntProfilDonnees::class,
['id' => '408',
'libelle' => 'Unimarc Koha',
'accents' => Class_IntProfilDonnees::ENCODING_UTF8,
'rejet_periodiques' => 0,
'id_article_periodique' => Class_IntProfilDonnees::SERIAL_FORMAT_NONE,
'type_fichier' => Class_IntProfilDonnees::FT_RECORDS,
'format' => Class_IntProfilDonnees::FORMAT_UNIMARC,
'attributs' =>
[
['type_doc' => $type_doc,
Class_IntProfilDonnees::FIELD_ITEM_BARCODE => 'f',
Class_IntProfilDonnees::FIELD_ITEM_COTE => 'k',
Class_IntProfilDonnees::FIELD_ITEM_TYPE_DOC => 'r',
Class_IntProfilDonnees::FIELD_ITEM_GENRE => 'l',
Class_IntProfilDonnees::FIELD_ITEM_SECTION => 'q',
Class_IntProfilDonnees::FIELD_ITEM_EMPLACEMENT => 'c',
Class_IntProfilDonnees::FIELD_ITEM_ANNEXE => 'b'
],
['zone' => '099',
'champ' => 'n',
'format' => Class_IntProfilDonnees::NOVELTY_DATE_FORMAT_VALUES,
'jours' => '15',
'valeurs' => '1']
]])
->getRawAttributes();
}
public function setUp() {
parent::setUp();
$this->loadNotice('unimarc_tolkien_pilone');
}
/** @test */
public function exemplaireShouldNotBeCreated() {
$this->assertEquals(Class_Exemplaire::count(),0);
}
}
......@@ -26,7 +26,7 @@ class Class_ExemplaireLoader extends Storm_Model_Loader {
public function getCachedCodifAnnexeByCode($code) {
// For cosmogramme integration performance.
if (!isset($this->_annexes_by_code[$code]))
$this->_annexes_by_code[$code] = Class_CodifAnnexe::findFirstBy(['code' => $code]);
$this->_annexes_by_code[$code] = Class_CodifAnnexe::findByCode($code);
return $this->_annexes_by_code[$code];
}
......
......@@ -22,47 +22,45 @@
class Class_SearchCriteria_NumRange extends Class_SearchCriteria_Range {
public function __construct($params) {
public function __construct(array $params) {
parent::__construct($params);
$this->_element->setCompositeInputValues($params);
}
public function buildElement() {
public function buildElement() : ?Zend_Form_Element {
return new ZendAfi_Form_Element_Range($this->getName(),
['label' => $this->getName() . $this->_(' de '),
'separator' => $this->_(' jusque ')]);
}
public function isValidNumber($value) {
public function isValidNumber($value) : bool {
return is_int($value);
}
protected function _filterValue($value) {
protected function _filterValue(string $value) : string {
if ($value === null || $value === '')
return $value;
if (!(new Zend_Validate_Int())->isValid($value)) {
if ( ! (new Zend_Validate_Int)->isValid($value)) {
$this->_element->addError($this->_('%s n\'est pas un nombre valide', $value));
return;
return '';
}
return $value;
}
public function modelMatch($model) :bool {
public function modelMatch(Storm_Model_Abstract $model) : bool {
if ($this->_isAllValues())
return true;
if ((!$value = $model->callGetterByAttributeName($this->_name))
|| !$this->isValidNumber($value))
if (( ! $value = $model->callGetterByAttributeName($this->_name))
|| ! $this->isValidNumber($value))
return false;
if ($this->_value_start && $this->_value_start > $value)
......
......@@ -137,23 +137,23 @@ abstract class Class_WebService_SIGB_AbstractService {
}
public function providesAuthentication() :bool {
public function providesPickupLocations() {
return false;
}
public function providesPickupLocations() :bool {
return false;
public function pickupLocationsFor(Class_Users $user, Class_Exemplaire $item) : array {
return [];
}
public function providesChangePasswordService() :bool {
public function providesAuthentication() :bool {
return false;
}
public function pickupLocationsFor($user, $item) :array {
return [];
public function providesChangePasswordService() :bool {
return false;
}
......
......@@ -72,7 +72,7 @@ class Class_WebService_SIGB_Carthame_Service extends Class_WebService_SIGB_Abstr
}
public function pickupLocationsFor($user, $item) :array {
public function pickupLocationsFor(Class_Users $user, Class_Exemplaire $item) : array {
if (!$user || !$item)
return [];
......
......@@ -253,6 +253,32 @@ class Class_WebService_SIGB_Koha_CommunityService
}
public function providesPickupLocations() {
return true;
}
public function pickupLocationsFor(Class_Users $user, Class_Exemplaire $item) : array {
$url = $this->_buildUrlForEndpointWithParams('items/' . $item->getSubfield(9) . '/pickup_locations',
['_match' => 'exact',
'patron_id' => $user->getEmprunteurId()]);
$json = $this->httpGetWithParams($url, $this->_getAuth());
if (null === ($locations = json_decode($json)))
return ['statut' => false, 'erreur' => 'Echec de connexion au webservice'];
if (isset($locations->errors) || isset($locations->error))
return ['statut' => false, 'erreur' => 'Erreurs du webservice'];
$pickup_locations = [];
foreach($locations as $bib)
$pickup_locations[$bib->library_id] = $bib->name;
return $pickup_locations;
}
public function suggestionsOf($user) {
if (!$patron_id = $user->getEmprunteurId())
return $this->_error($this->_('Échec de l\'authentification par le webservice'));
......
......@@ -383,7 +383,7 @@ class Class_WebService_SIGB_Koha_Service extends Class_WebService_SIGB_AbstractR
protected function _setPickupLocation($args, $code) {
if (trim($code) && $annexe = Class_CodifAnnexe::findFirstBy(['code' => $code]))
if (trim($code) && $annexe = Class_CodifAnnexe::findByCode($code))
$args['pickup_location'] = $annexe->getIdOrigine();
return $args;
}
......@@ -461,6 +461,11 @@ class Class_WebService_SIGB_Koha_Service extends Class_WebService_SIGB_AbstractR
}
public function providesPickupLocations() :bool {
return $this->_hasUserAndPassword();
}
public function providePreRegistration() :bool {
return
$this->preregistration_category
......@@ -494,6 +499,15 @@ class Class_WebService_SIGB_Koha_Service extends Class_WebService_SIGB_AbstractR
}
public function pickupLocationsFor(Class_Users $user, Class_Exemplaire $item) : array {
if (!$this->providesPickupLocations())
return parent::pickupLocationsFor($user, $item);
return ($community_service = $this->getNewCommunityService() )
? $community_service->pickupLocationsFor($user, $item)
: parent::pickupLocationsFor($user, $item);
}
public function loansHistory(Class_WebService_SIGB_Emprunteur $borrower, int $page = 1) :Class_WebService_SIGB_LoansHistory {
if (!$this->providesLoansHistory())
return parent::loansHistory($borrower, $page);
......
......@@ -532,7 +532,7 @@ class Class_Webservice_SIGB_Nanook_Service
}
public function pickupLocationsFor($user, $item) :array {
public function pickupLocationsFor(Class_Users $user, Class_Exemplaire $item) :array {
if (!$this->providesPickupLocations()
|| !$user
|| !$item
......
......@@ -81,8 +81,12 @@ trait Trait_AlbumDelegator {
}
protected function getFirstLabelFromAlbumCodif($codif_class, $ids) {
$labels = $codif_class::labelsOfIds(explode(';', $ids));
protected function getFirstLabelFromAlbumCodif(string $codif_class, ?string $ids) : string {
if ( ! $ids)
return '';
$labels = $codif_class::labelsOfIds(explode(Class_Album::separator($ids), $ids));
return $labels->isEmpty()
? ''
: $labels->first();
......
......@@ -70,10 +70,11 @@ class ArteVod_Service extends Class_DigitalResource_Service {
protected function _deleteNonHarvested(){
Class_Album::deleteQuery()
->start('type_doc_id', self::CATEGORY_LABEL)
->lt('date_maj',$this->addDaysToCurrentDate(-1))
->deleteAll();
if ($this->_config->getAdminVar('BATCH_UPDATE_NOTICE'))
Class_Album::deleteQuery()
->start('type_doc_id', static::CATEGORY_LABEL)
->lt('date_maj', $this->addDaysToCurrentDate(-1))
->deleteAll();
return $this;
}
......
......@@ -343,6 +343,72 @@ class ArteVodHarverstingNewApiUpdateTest extends ArteVodHarverstingTestCase {
class ArteVodHarverstingNewApiUsualModeTest extends ArteVodHarverstingTestCase {
public function setUp() {
parent::setUp();
ArteVod_Service::setTimeSource(new TimeSourceForTest('2022-01-07'));
$this->fixture(Class_Album::class,
['id' => 20,
'type_doc_id' => 'ArteVod',
'titre' => 'Héros',
'id_origine' => '7040',
'matiere' => '1',
'url_origine' =>'https://mednumv3-backapi.lab.arte.tv/api/v1/',
'fichier' =>'596525_b88c86285df723b8e5c0f819b132f39f.jpeg',
'external_uri' => 'https://vod.mediatheque-numerique.com/films/heroines']);
$this->fixture(Class_Album::class,
['id' => 601,
'type_doc_id' => 'ArteVod',
'titre' => 'Un autre album',
'id_origine' => '704123',
'matiere' => '1',
'date_maj' => '2022-01-05']);
foreach(['1' => ArteVodFixtures::newapiPage(),
'2' => ArteVodFixtures::emptyPage()]
as $page => $answer) {
$this->_web_client
->whenCalled('open_url')
->with('https://mednumv3-backapi.lab.arte.tv/api/v1/films?page_nb=' . $page . '&q_country=FR')
->answers($answer);
}
$this->_web_client
->whenCalled('setConfig')->with(['timeout' => 10])->answers($this->_web_client)
->beStrict();
Class_AdminVar::set('ArteVod_BATCH_UPDATE_NOTICE','0');
$this->_service->harvest();
}
public function tearDown() {
ArteVod_Service::setTimeSource(null);
parent::tearDown();
}
/** @test */
public function albumHeroinesShouldNotBeNull() {
$this->assertNotNull(Class_Album::find(20));
}
/** @test */
public function albumCountShouldBe2() {
$this->assertEquals(Class_Album::count(), 2);
}
}
class ArteVodHarvestingWithoutPasswordTest extends ArteVodHarverstingTestCase {
public function setUp() {
......
......@@ -31,7 +31,7 @@ class Cyberlibris_Service_Parser
if (preg_match('|^([0-9]+)$|i', $data, $matches))
$this->_record['ean'] = $matches[1];
if (preg_match('|^(https://static2.cyberlibris.com/.*.jpg)$|i', trim($data), $matches))
if (preg_match('~^(https?://.*.(png|jpg|jpeg|gif|webp))$~i', trim($data), $matches))
$this->_record['posters'][] = $matches[1];
}
......