diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index 1d1c1a69cc5484bb338f32ec2d45c35f2b1980d4..c3201f48def0e02ffae1034d5082c082d701447c 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -111,7 +111,6 @@ class NoticeAjaxController extends Zend_Controller_Action { $exemplaires = $this->_loadExemplaire(["id_notice" => $notice_ids]); - foreach($exemplaires as $exemplaire) $exemplaire->updateAvailabilityFromSIGB() ->save(); diff --git a/cosmogramme/php/_init.php b/cosmogramme/php/_init.php index 19dae8187bafcdd1736c8d3db7db0d157f8960b5..945aa9fd64dc8e70f2d71222a52998e6821a4e51 100644 --- a/cosmogramme/php/_init.php +++ b/cosmogramme/php/_init.php @@ -18,6 +18,7 @@ define('COM_ORPHEE', 8); define('COM_MICROBIB', 9); define('COM_BIBLIXNET', 10); define('COM_DYNIX', 11); +define('COM_CDSCRIPT', 12); $basePath = dirname(realpath(__FILE__)); set_include_path(get_include_path() diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 8535dd79fd62ca2d9a64fdace65811279c4af7cb..7ce41cdba91567afb318b47983431cded5ad9840 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -110,7 +110,6 @@ class notice_integration { } $this->format=$format; unset($this->analyseur); - switch($format) { // Unimarc diff --git a/cosmogramme/php/fonctions/objets_saisie.php b/cosmogramme/php/fonctions/objets_saisie.php index 6566004dd600db17a3a66f0ad319e81e71affb90..dbf0bba28aaf0a54642cf97fcd05dd282a6c3f16 100644 --- a/cosmogramme/php/fonctions/objets_saisie.php +++ b/cosmogramme/php/fonctions/objets_saisie.php @@ -97,6 +97,11 @@ function getBlocsParams($id_bib, $type, $valeurs) { return getOuiNon($id, $valeur); }]]; + if(in_array($clef, [COM_CDSCRIPT])) + $champs_params[0] = ['server_url', + 'remote_library_id']; + + if (in_array($clef, [COM_VSMART, COM_MICROBIB, COM_BIBLIXNET])) $champs_params[0] = ['url_serveur']; diff --git a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php index aaefcd3fada761502d1713f8aac3872dbd90382b..8955bd800ef71086a7356ece3691457c6d204ce2 100644 --- a/cosmogramme/tests/php/classes/NoticeIntegrationTest.php +++ b/cosmogramme/tests/php/classes/NoticeIntegrationTest.php @@ -136,10 +136,8 @@ abstract class NoticeIntegrationTestCase extends ModelTestCase { public function loadNoticeFromString($unimarc) { Codif_langue::getInstance()->setCodif(['fre' => ['id_langue' => 'fre', 'libelle' => 'français']]); - $this->notice_integration = new notice_integration(); $this->notice_integration->setParamsIntegration(1, 0, isset($this->_profil_donnees['id_profil']) ? $this->_profil_donnees['id_profil'] : 1); - xdebug_break(); $this->notice_integration->traiteNotice($unimarc); $this->notice_integration->traiteFacettes(); $this->notice_data = $this->notice_integration->getNotice(); diff --git a/library/Class/Exemplaire.php b/library/Class/Exemplaire.php index f21c0f981cc5a0fd6cbe99334a5bafa52359f9ee..21be5d23d2d69039e37515c4930ecab1faa3d716 100644 --- a/library/Class/Exemplaire.php +++ b/library/Class/Exemplaire.php @@ -46,7 +46,8 @@ class Class_Exemplaire extends Storm_Model_Abstract { 'genre' => null, 'url' => null, 'emplacement' => '', - 'date_nouveaute' => '']; + 'date_nouveaute' => '', + 'cote' => '']; protected $_sigb_exemplaire; diff --git a/library/Class/IntBib.php b/library/Class/IntBib.php index 62a5606ac1edd5d4c2d6c3c2dff2272aaaa87c7a..5ab61c81eebd4ac7754f731f283319c79c62a3c5 100644 --- a/library/Class/IntBib.php +++ b/library/Class/IntBib.php @@ -50,7 +50,7 @@ class Class_IntBib extends Storm_Model_Abstract { self::COM_MICROBIB => 'Class_WebService_SIGB_Microbib', self::COM_BIBLIXNET => 'Class_WebService_SIGB_BiblixNet', self::COM_DYNIX => 'Class_WebService_SIGB_Dynix', - self::COM_CDSCRIPT => 'Class_WebService_CdScript']; + self::COM_CDSCRIPT => 'Class_WebService_SIGB_CdScript']; protected $_table_name = 'int_bib'; protected $_table_primary = 'id_bib'; diff --git a/library/Class/IntProfilDonnees.php b/library/Class/IntProfilDonnees.php index 8422ad817727390ec8698fdadc5c07e3cadeabdc..b7393013d5a023d0f87ac0444493d9c37fa0c129 100644 --- a/library/Class/IntProfilDonnees.php +++ b/library/Class/IntProfilDonnees.php @@ -421,8 +421,6 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { public static function forCdScript() { - xdebug_break(); - return self:: newInstance(['libelle' => 'Unimarc Cd-Script', 'accents' => self::ENCODING_UTF8, diff --git a/library/Class/Notice.php b/library/Class/Notice.php index 0fd4e6916f4bc2d3137b579222c3915ae06cded0..0e43db0f502e19c4523a972c504681a396bad997 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -1468,14 +1468,10 @@ class Class_Notice extends Storm_Model_Abstract { if ($album = $this->getAlbum()) return $album->getDescription(); - $resumes = ''; - $datas = $this->get_subfield('330', 'a'); + $data = $this->get_subfield('330', 'a'); - foreach($datas as $data) - $resumes.= (($resume = $this->_getHtmlSummary([$data])) ? - $resume : $this->_getTextSummary([$data])) . BR; - - return $this->_resume = $resumes; + return $this->_resume = (($resume = $this->_getHtmlSummary($data)) ? + $resume : $this->_getTextSummary($data)); } diff --git a/library/Class/Users.php b/library/Class/Users.php index e6359993850377dc15b289f60cf736acd3f9385a..28495ad3955b536ce5ef4ba39e1572b2dbd6b57f 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -103,7 +103,6 @@ class UsersLoader extends Storm_Model_Loader { * @return Class_Users */ public function getIdentity() { - xdebug_break(); try { if (!$user = ZendAfi_Auth::getInstance()->getIdentity()) return null; diff --git a/library/Class/WebService/SIGB/CdScript.php b/library/Class/WebService/SIGB/CdScript.php index 341be17b6239f7ac6ed12d84c35e63bd81502de2..371a4b8eae34f7de9f21327939031f24fb230135 100644 --- a/library/Class/WebService/SIGB/CdScript.php +++ b/library/Class/WebService/SIGB/CdScript.php @@ -29,7 +29,7 @@ class Class_WebService_SIGB_CdScript { $instance = new static(); $classname = get_called_class().'_Service'; static::$service = $classname::getService($params['server_url'], - $params['bib']); + $params['remote_library_id']); } return static::$service; diff --git a/library/Class/WebService/SIGB/CdScript/Service.php b/library/Class/WebService/SIGB/CdScript/Service.php index b62c9299efcc3338c54d8f5c223726aaa0004fd6..e19f6c34af7aea60490363f5aea13b235fc67cd7 100644 --- a/library/Class/WebService/SIGB/CdScript/Service.php +++ b/library/Class/WebService/SIGB/CdScript/Service.php @@ -81,5 +81,29 @@ class Class_Webservice_SIGB_CdScript_Service { 'empty@email', $user->getDateFin()]); } + + + public function getNotice($id) { + $sigb_record = new Class_WebService_SIGB_Notice($id); + $item = Class_Exemplaire::findFirstBy(['code_barres' => $id]); + $sigb_item = new Class_WebService_SIGB_Exemplaire($id); + $sigb_item->setCodeBarre($id); + $sigb_item->setBibliotheque($item->getBib()); + $item->setUrl($this->getRessourceUrl($item))->save(); + return $sigb_record->addExemplaire($sigb_item); + } + + + public function getNoticeCache() { + if (!isset($this->_notice_cache)) + $this->_notice_cache = new Class_WebService_SIGB_NoticeCache($this); + return $this->_notice_cache; + } + + + public function getExemplaire($notice_id, $code_barre){ + $item = $this->getNoticeCache()->getExemplaire($notice_id, $code_barre); + return $item; + } } ?> \ No newline at end of file diff --git a/library/Class/WebService/SIGB/NoticeCache.php b/library/Class/WebService/SIGB/NoticeCache.php index ff1211d3f0dd696ce369414e95088a80e4c94263..b038912ef04942d294fa8ada360a9be68816124c 100644 --- a/library/Class/WebService/SIGB/NoticeCache.php +++ b/library/Class/WebService/SIGB/NoticeCache.php @@ -16,7 +16,7 @@ * * 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 */ /* diff --git a/library/ZendAfi/View/Helper/Notice/Exemplaires.php b/library/ZendAfi/View/Helper/Notice/Exemplaires.php index 0718501ce063dd83e27d4cc5151c9a4217ef8605..1372421bd8974e51711eeee9c26825bc3a2a0c9a 100644 --- a/library/ZendAfi/View/Helper/Notice/Exemplaires.php +++ b/library/ZendAfi/View/Helper/Notice/Exemplaires.php @@ -23,6 +23,7 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends ZendAfi_View_Helper_BaseHel protected $renderers = []; public function Notice_Exemplaires($exemplaires, $nb_notices_oeuvre=0, $aff="normal") { + xdebug_break(); $preferences = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray()['exemplaires']; if (!$exemplaires) return false; @@ -151,7 +152,6 @@ class ZendAfi_View_Helper_Notice_Exemplaires extends ZendAfi_View_Helper_BaseHel class ZendAfi_View_Helper_Notice_Exemplaires_RenderByGroup extends ZendAfi_View_Helper_Notice_Exemplaires { public function Notice_Exemplaires_RenderByGroup($exemplaires, $preferences, $nb_notices_oeuvre=0, $aff="normal") { - $group_exemplaires = []; foreach($this->exemplairesToRows($exemplaires) as $ex) { $group_key = $ex['id_notice'].'_'.$ex['id_bib'].'_'.$ex['cote']; @@ -171,7 +171,6 @@ class ZendAfi_View_Helper_Notice_Exemplaires_RenderByGroup extends ZendAfi_View_ class ZendAfi_View_Helper_Notice_Exemplaires_RenderByItem extends ZendAfi_View_Helper_Notice_Exemplaires { public function Notice_Exemplaires_RenderByItem($exemplaires, $preferences, $nb_notices_oeuvre=0, $aff='normal') { $exemplaires = $this->_getSortedItems($exemplaires, $preferences); - return $this->render((new Class_CommSigb())->getDispoExemplaires($exemplaires), $preferences, $nb_notices_oeuvre, diff --git a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php index 75d321eba59d5482aabadc5812bc3267d2f9b283..1c1a64d4a10443c447893607b7a8f148dc759ce6 100644 --- a/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php +++ b/tests/application/modules/opac/controllers/NoticeAjaxControllerCdScriptTest.php @@ -23,28 +23,55 @@ class NoticeAjaxControllerCdScriptRecordTest extends AbstractControllerTestCase { protected $_record_le_kiosque, - $_item_le_kiosque; + $_item_le_kiosque, + $_service, + $_sigb_le_kiosque; public function setUp() { parent::setUp(); + + $config = Class_Profil::getCurrentProfil()->getCfgNoticeAsArray(); + $config['exemplaires']['grouper'] = '1'; + Class_Profil::getCurrentProfil()->setCfgNotice($config); + + $this->fixture('Class_IntBib', + ['id' => 3, + 'comm_sigb' => Class_IntBib::COM_CDSCRIPT]); + + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Le kiosque library']); + $this->_item_le_kiosque = $this->fixture('Class_Exemplaire', ['id' => 1, 'code_barres' => '456789', 'id_origine' => '456789', + 'id_notice' => 2, 'id_int_bib' => '3', 'id_bib' => '3', 'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']); $this->_record_le_kiosque = $this->fixture('Class_Notice', ['id' => 2, - 'exemplaire' => $this->_item_le_kiosque]); + 'exemplaires' => [$this->_item_le_kiosque]]); + + $this->_service = Class_WebService_SIGB_CdScript::getService(['server_url' => 'www.jumel39.fr/docnum.php', + 'bib' => 2]); + $this->_service->setTimeSource(new TimeSourceForTest('2015-10-28 09:00:00')); - $this->dispatch('/opac/noticeajax/id_notice/197143', true); + $this->dispatch('/opac/noticeajax/exemplaires/id_notice/2', true); + $this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789'); } /** @test */ public function linkToJumelShouldBePresent() { - $this->assertXPathContentContains('//table//a[contains(@href, "jumel.fr")]', 'Accès à la ressource'); + $this->assertXPathContentContains('//table//a[contains(@href, "www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200")]', 'Description en ligne'); + } + + + /** @test */ + public function libraryLabelShouldBeLeKiosqueLibrary() { + $this->assertXPathContentContains('//table//td', 'Le kiosque library'); } } ?> \ No newline at end of file diff --git a/tests/library/Class/WebService/SIGB/CdScriptTest.php b/tests/library/Class/WebService/SIGB/CdScriptTest.php index 3fcb0b1ec0817b6568b6245c1ff20aee5b7567da..ccbfcbb60ec29143ef47919b8c4e368ce0fe3488 100644 --- a/tests/library/Class/WebService/SIGB/CdScriptTest.php +++ b/tests/library/Class/WebService/SIGB/CdScriptTest.php @@ -36,10 +36,16 @@ abstract class CdScriptTestCase extends Storm_Test_ModelTestCase { class CdScriptServiceTest extends CdScriptTestCase { protected $_paul, - $_le_kiosque; + $_le_kiosque, + $_sigb_le_kiosque; public function setUp() { parent::setUp(); + + $this->fixture('Class_Bib', + ['id' => 3, + 'libelle' => 'Le kiosque library']); + $this->_paul = $this->fixture('Class_Users', ['id' => 15, 'login' => 'paul', @@ -60,6 +66,8 @@ class CdScriptServiceTest extends CdScriptTestCase { 'id_int_bib' => '3', 'id_bib' => '3', 'zone995' => 'a:3:{i:0;a:2:{s:4:"code";s:1:"a";s:6:"valeur";s:10:"Le Kiosque";}i:1;a:2:{s:4:"code";s:1:"b";s:6:"valeur";s:3:"kio";}i:2;a:2:{s:4:"code";s:1:"f";s:6:"valeur";s:3:"319";}}']); + + $this->_sigb_le_kiosque = $this->_service->getNotice('456789')->getExemplaireByCodeBarre('456789'); } @@ -79,4 +87,22 @@ class CdScriptServiceTest extends CdScriptTestCase { public function ressourceUrlShouldBeJumelBib2UserPaulAnd12oclok() { $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14:empty@email:2015-12-14', $this->_service->getRessourceUrl($this->_le_kiosque)); } + + + /** @test */ + public function leKiosqueItemIdShouldBe456789() { + $this->assertEquals('456789', $this->_sigb_le_kiosque->getId()); + } + + + /** @test */ + public function leKiosqueItemDispoShouldBeJumelLink() { + $this->assertEquals('www.jumel39.fr/docnum.php?bib=2&res=kio&lien=456789&time=1446019200&user=654987:Le Pollux:Paul:2002-12-14:empty@email:2015-12-14', $this->_sigb_le_kiosque->getDisponibilite()); + } + + + /** @test */ + public function leKiosqueBibShouldBeLeKiosqueLibrary() { + $this->assertEquals('Le kiosque library', $this->_sigb_le_kiosque->getBibliotheque()->getLibelle()); + } }