Commit 6cb48d31 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'dev#74958_demo_barcelone_import_marc21' into 'master'

Dev#74958 demo barcelone import marc21

See merge request afi/opacce!2658
parents e7e5f845 c8f20173
- ticket #74958 : Amélioration de l'intégration de fichiers MARC21
\ No newline at end of file
......@@ -28,6 +28,8 @@ abstract class Cosmo_DataProfileControllerTestCase extends CosmoControllerTestCa
Class_IntProfilDonnees::forKoha()
->setId(56)
->setItemField(Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE, ['zone' => '999',
'champ' => 'c'])
->save();
Class_IntProfilDonnees::forNanook()
......@@ -52,16 +54,6 @@ abstract class Cosmo_DataProfileControllerTestCase extends CosmoControllerTestCa
['id' => 'id_article_periodique',
'valeur' => null,
'liste' => "0:aucun\r\n1:pergame\r\n2:opsys indexpresse\r\n3:Koha\r\n4:Orphée"]);
$this->fixture('Class_CosmoVar',
['id' => 'champ_code_barres',
'valeur' => null,
'liste' => "f:995$f\r\nh:995$h\r\nb:995$b\r\n997:997$a\r\n852:852$g\r\na:995$a\r\n999:999$i\r\n996:996$f\r\n949:949$6"]);
$this->fixture('Class_CosmoVar',
['id' => 'champ_cote',
'valeur' => null,
'liste' => "k:995$k\r\nf:995$f"]);
}
......@@ -223,7 +215,8 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo
/** @test */
public function selectTypeFichierShouldContainsRecordsSelected() {
$this->assertXPathContentContains('//form//select[@name="type_fichier"]/option[@value="0"][@selected]', 'Notices');
$this->assertXPathContentContains('//form//select[@name="type_fichier"]/option[@value="0"][@selected]',
'Notices');
}
......@@ -275,6 +268,12 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo
}
/** @test */
public function itemZoneValueShouldBe995() {
$this->assertXPath('//form//input[@name="item_zone"][@value="995"]');
}
/** @test */
public function itemCodebarreShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_code_barres"]/option[@value="f"][@selected]');
......@@ -283,7 +282,7 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo
/** @test */
public function itemCodebarreIn949Dollar6ShouldBePresent() {
$this->assertXPath('//form//select[@id="champ_code_barres"]/option[@value="949"][@label="949$6"]');
$this->assertXPath('//form//select[@id="champ_code_barres"]/option[@value="949"][contains(@label,"949$6")]');
}
......@@ -335,6 +334,18 @@ class Cosmo_DataProfileControllerEditUnimarcKohaTest extends Cosmo_DataProfileCo
}
/** @test */
public function multiInputItemIdOrigineShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_item_id_origine"]');
}
/** @test */
public function scriptShouldSetMutiInputsItemIdOrigineTo999dollarC() {
$this->assertXPathContentContains('//script', 'values:{"id_origine_zone":["999"],"id_origine_champ":["c"]}');
}
/** @test */
public function multiInputInteretZoneShouldBePresent() {
$this->assertXPath('//form//div[@id="multi_inputs_interests"]');
......@@ -392,6 +403,7 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo
'format' => Class_IntProfilDonnees::FORMAT_UNIMARC,
'xml_balise_abonne' => 'subscribers',
'xml_abonne_IDABON' => 'id',
'item_zone'=> '996',
'champ_code_barres'=> 'f',
'champ_cote' => 'k',
'champ_type_doc' => 'x',
......@@ -402,6 +414,8 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo
'champ_availability' => 't',
'url_zone' => [0 => '932'],
'url_champ' => [0 => 'n'],
'id_origine_zone' => [0 => '999'],
'id_origine_champ' => [0 => 'c'],
'rejet_periodiques' => 1,
'id_article_periodique' => 1,
'nouveaute_format' => 4,
......@@ -442,6 +456,12 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo
}
/** @test */
public function itemZoneShouldBe996() {
$this->assertEquals('996', $this->_koha->getItemZone());
}
/** @test */
public function champsCodeBarresShouldBeF() {
$this->assertEquals('f', $this->_koha->getBarCode());
......@@ -466,6 +486,18 @@ class Cosmo_DataProfileControllerPostEditUnimarcKohaFileFormatTest extends Cosmo
}
/** @test */
public function idOrigineZoneShouldBe999() {
$this->assertEquals('999', $this->_koha->getIdOrigineZone());
}
/** @test */
public function idOrigineFieldShouldBeC() {
$this->assertEquals('c', $this->_koha->getIdOrigineField());
}
/** @test */
public function serialsRejectShouldBeOne() {
$this->assertEquals(1, $this->_koha->getRejetPeriodiques());
......@@ -1094,6 +1126,12 @@ class Cosmo_DataProfileControllerMultiValuesTest extends Cosmo_DataProfileContro
}
/** @test */
public function scriptShouldSetMutiInputsItemIdOrigineTo001() {
$this->assertXPathContentContains('//script', 'values:{"id_origine_zone":["001"],"id_origine_champ":[null]}');
}
/** @test */
public function docTypeWithLabelSkipsShouldHaveAllItsValues() {
$this->assertXPathContentContains('//script', 'values:{"1_label":["am","bm","","em","mm","","","","","","",""],"1_zone":["BDA","BDJ","LFA","LFJ","LDA","LDJ","LCDA","LCDJ","PATIMP","PATMS","PERIP","PATINC"]}',
......
......@@ -71,7 +71,7 @@ class notice_marc21 extends notice_unimarc {
$this->map["600"]["d"]="y";
$this->map["600"]["e"]="z";
foreach(["601","602","604","605","606","607","610","615","620","626"] as $zone)
foreach(["601","602","604","605","606","607","610","615","620","626","686"] as $zone)
$this->map[$zone]="*";
$this->map["700"]="*";
......@@ -87,6 +87,8 @@ class notice_marc21 extends notice_unimarc {
$this->map["741"]="*";
$this->map["801"]["a"]="b";
$this->map["995"]="*";
$this->map["952"]="*";
$this->map["999"]="*";
parent::__construct();
}
......@@ -188,6 +190,7 @@ class notice_marc21 extends notice_unimarc {
$this->traiteZone("028","071"); // publisher number pour les sonores
$this->traiteZone("041","101"); // langues
$this->traiteZone("044","102"); // pays
$this->traiteZone("080","686"); // thesauri
$this->traiteZone("260","210"); //editeur
$this->traiteZone("440","225"); //collection
$this->traiteZone("490","225"); //collection
......@@ -245,6 +248,8 @@ class notice_marc21 extends notice_unimarc {
$this->_handleItems();
$this->traiteZone("999","999");
return $this->marc21_decode($this->notice_unimarc->update());
}
......@@ -254,6 +259,7 @@ class notice_marc21 extends notice_unimarc {
if ('949' == $champ_code_barres)
return $this->traiteZone('949', '996');
$this->traiteZone("952","952");
$this->traiteZone("995","995");
return $this->traiteZone('999', '996');
}
......
......@@ -97,7 +97,7 @@ class notice_unimarc extends iso2709_record {
public function updateItemsWithUrl(&$exemplaires) {
if (!$champ_url = $this->profil['attributs'][Class_IntProfilDonnees::FT_RECORDS]['champ_url'])
if (!$champ_url = $this->profil['attributs'][Class_IntProfilDonnees::FT_RECORDS][Class_IntProfilDonnees::FIELD_ITEM_URL])
return $this;
$url = (10 > (int)$champ_url['zone'])
......@@ -348,6 +348,10 @@ class notice_unimarc extends iso2709_record {
if (!$champ_cote)
$champ_cote = 'k';
$item_zone = $this->getProfilNumericAttribute('item_zone');
if (!$item_zone)
$item_zone = '995';
$champ_section = $this->getProfilNumericAttribute('champ_section');
$champ_genre = $this->getProfilNumericAttribute('champ_genre');
$champ_emplacement = $this->getProfilNumericAttribute('champ_emplacement');
......@@ -368,7 +372,7 @@ class notice_unimarc extends iso2709_record {
$codes_barres = false;
$cotes = false;
$nb_ex_detruits = 0;
$exemplaires = $this->get_subfield('995');
$exemplaires = $this->get_subfield($item_zone);
$nb_ex = 0;
for ($i=0; $i < count($exemplaires); $i++) {
$ex = $this->withExemplaireDo(
......@@ -377,7 +381,7 @@ class notice_unimarc extends iso2709_record {
$cotes, $nb_ex_detruits, $champs_nouveaute,
$champ_genre, $champ_emplacement,
$champ_annexe, $champ_section, $champ_cote,
$champ_availability) {
$champ_availability, $item_zone) {
if ($champ['code'] == $champ_code_barres) {
$this->setCodeBarre($champ['valeur'], $ex, $ret, $codes_barres);
......@@ -415,16 +419,16 @@ class notice_unimarc extends iso2709_record {
// Champs parametres
if ($champ_genre and $champ['code'] == $champ_genre)
$ex['genre'] = $this->getIdCodeExemplaire('genre', '995', $champ_genre, $champ['valeur']);
$ex['genre'] = $this->getIdCodeExemplaire('genre', $item_zone, $champ_genre, $champ['valeur']);
if ($champ_section and $champ['code'] == $champ_section) {
$ex['section'] = $this->getIdCodeExemplaire('section', '995', $champ_section, $champ['valeur']);
$ex['section'] = $this->getIdCodeExemplaire('section', $item_zone, $champ_section, $champ['valeur']);
if ($this->isSectionInvisible($ex['section']))
$ex['ignore_exemplaire'] = true;
}
if ($champ_emplacement and $champ['code'] == $champ_emplacement) {
$ex['emplacement'] = $this->getIdCodeExemplaire('emplacement', '995', $champ_emplacement, $champ['valeur']);
$ex['emplacement'] = $this->getIdCodeExemplaire('emplacement', $item_zone, $champ_emplacement, $champ['valeur']);
if (trim($ex['emplacement'])
&& $this->isEmplacementInvisible($ex['emplacement'])) {
......@@ -439,7 +443,7 @@ class notice_unimarc extends iso2709_record {
$ex['annexe'] = ($annexe) ? $annexe->getCode() : $champ['valeur'];
}
if ($champs_nouveaute['zone'] == '995'
if ($champs_nouveaute['zone'] == $item_zone
&& $champ['code'] == $champs_nouveaute['champ']) {
$ex['date_nouveaute'] = $this->calculDateNouveaute($champ['valeur']);
}
......@@ -825,12 +829,32 @@ class notice_unimarc extends iso2709_record {
public function getIdOrigine() {
if ($id_origine = $this->_getIdOrigineInItemField())
return $id_origine;
if (!$data = $this->get_subfield('001'))
return '';
return substr(trim($data[0]), 0, 20);
}
protected function _getIdOrigineInItemField() {
if (!isset($this->profil['attributs'][Class_IntProfilDonnees::FT_RECORDS][Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE]['zone']))
return null;
$item_id_origine = $this->profil['attributs'][Class_IntProfilDonnees::FT_RECORDS][Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE];
$id_origine = (10 > (int)$item_id_origine['zone'])
? $this->get_subfield($item_id_origine['zone'])
: $this->get_subfield($item_id_origine['zone'], $item_id_origine['champ']);
return isset($id_origine[0])
? $id_origine[0]
: null;
}
public function getIsbn() {
$datas = $this->get_subfield('010', 'a');
if ($isbn = $this->_detectIsbn($datas)) {
......
......@@ -99,8 +99,11 @@ class NanookRecordsIntegrationAvailabilityFacetTest extends NanookRecordsIntegra
/** @see http://forge.afi-sa.fr/issues/16358 */
class NanookRecordsIntegrationSymphonieTest extends NanookRecordsIntegrationTestCase {
public function getProfilDonnees() {
$profil = Class_IntProfilDonnees::forNanook()->setIdProfil(110);
return $profil->getRawAttributes();
return Class_IntProfilDonnees::forNanook()
->setItemField(Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE,
['zone' => '001', 'champ' => 'zz'])
->setIdProfil(110)
->getRawAttributes();
}
......@@ -161,6 +164,13 @@ class NanookRecordsIntegrationSymphonieTest extends NanookRecordsIntegrationTest
public function degreeShouldStayUTF8Degree() {
$this->assertContains('n°', Class_Notice::find(1)->get_subfield(464, 't')[0]);
}
/** @test */
public function firstItemIdOrigineShouldBe196508() {
$this->assertEquals('196508',
Class_Exemplaire::find(1)->getIdOrigine());
}
}
......
......@@ -71,4 +71,11 @@ class NoticeIntegrationLibermediaTest extends NoticeIntegrationTestCase {
$this->assertEquals('HE255931',
$this->_record->getExemplaires()[0]->getCodeBarres());
}
/** @test */
public function firstItemIdOrigineShouldBeVtls000031488() {
$this->assertEquals('vtls000031488',
$this->_record->getExemplaires()[0]->getIdOrigine());
}
}
\ No newline at end of file
......@@ -292,11 +292,11 @@ class NoticeIntegrationMarc21CoupCavalierToUnimarcTest
$all = $this->notice_marc21->getAll();
$this->assertEquals('Le coup du cavalier', $all['titre_princ']);
$this->assertEquals([ ['Longueur de la notice', 804],
$this->assertEquals([ ['Longueur de la notice', 920],
['Statut de la notice', 'n'],
['Type de document', 'am'],
['Niveau hiérarchique', 0],
['Adresse des données', 181],
['Adresse des données', 193],
['Niveau de catalogage' , '1']
],
......@@ -322,6 +322,75 @@ class NoticeIntegrationMarc21BorisToUnimarcTest extends NoticeIntegrationMarc21D
}
class NoticeIntegrationMarc21WithItemsIn952Test extends NoticeIntegrationMarc21DynixTestCase {
public function getProfilDonnees() {
return Class_IntProfilDonnees
::newInstance(
['libelle' => 'Marc21 Dynix',
'accents' => Class_IntProfilDonnees::ENCODING_UTF8,
'rejet_periodiques' => 1,
'id_article_periodique' => 0,
'type_fichier' => Class_IntProfilDonnees::FT_RECORDS,
'format' => Class_IntProfilDonnees::FORMAT_MARC21,
'attributs' => [['type_doc' => $type_doc,
Class_IntProfilDonnees::FIELD_ITEM_ZONE => '952',
Class_IntProfilDonnees::FIELD_ITEM_BARCODE => 'p',
Class_IntProfilDonnees::FIELD_ITEM_COTE => '',
Class_IntProfilDonnees::FIELD_ITEM_TYPE_DOC => '',
Class_IntProfilDonnees::FIELD_ITEM_GENRE => '',
Class_IntProfilDonnees::FIELD_ITEM_SECTION => '',
Class_IntProfilDonnees::FIELD_ITEM_EMPLACEMENT => 'c',
Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE => ['zone' => '999',
'champ' => 'c'],
Class_IntProfilDonnees::FIELD_ITEM_ANNEXE => 'a'],
['zone' => '996',
'champ' => 'u',
'format' => Class_IntProfilDonnees::NOVELTY_DATE_FORMAT_AAAA_MM_JJ,
'jours' => '90',
'valeurs' => '']]])
->setIdProfil(23)
->getRawAttributes();
}
public function setUp() {
parent::setUp();
$this->loadNotice('marc21_952_items');
$this->loadNotice('marc21_cruzados');
}
/** @test */
public function firstRecordTitleShouldBeAguaMedioAmbiente() {
$this->assertContains('Agua, medio ambiente y desarrollo en el siglo XXI : México desde una perspectiva global y regional',
Class_Notice::find(1)->getTitrePrincipal());
}
/** @test */
public function firstRecordShouldHaveTwoItems() {
$this->assertCount(2, Class_Notice::find(1)->getExemplaires());
}
/** @test */
public function firstItemIdOrigineShouldBe567() {
$this->assertEquals(567, Class_Exemplaire::find(1)->getIdOrigine());
}
/** @test */
public function secondRecordShouldHaveSubfield686() {
$this->assertEquals(['940.18', '355"10/12"'],
Class_Notice::find(2)->get_subfield(686, 'a'));
}
}
class NoticeIntegrationBourdieuWithElectreGeneratedNoticeRecordTest extends NoticeIntegrationTestCase {
public function setUp() {
parent::setUp();
......
03168nas a2200541 a 4500001000700000003000400007005001700011008004100028010000600069020001500075040001300090043001200103100000700115245019700122260009500319300002100414300003300435490001200468504005300480600006500533610005500598651007300653700002500726700002700751773011400778830004100892856010200933856010301035942001501138955006101153999001301214952017101227952007501398952007501473952007501548952007501623952007501698952007501773952007501848952007501923952007601998952007602074952007602150952007602226952009302302952008402395952014702479681614Ost20180430102806.0950727s1993 sp bc s001 0 spa  a  a8477533865 aDLCcDLC ae-sp--- axx00aArchivo de Joaquín Costabinventario de los documentos conservados en el Archivo Histórico Provincial de Huescacautores, María Rivas Palá (dirección), Jesús Paraíso Gros, ... [et al.]. a[Zaragoza] :bDiputación General de Aragón, Departamento de Cultura y Educación,c1993. a199 p. ;c24 cm. a106 p.bil. col. y n.c32 cm1 aUNEDv5 aIncludes bibliographical references and indexes. 4aCosta y Martínez, Joaquín,d1846-1911xArchivesxCatalogs.20aArchivo Histórico Provincial de HuescaxCatalogs, 0aHuesca (Spain : Province)xHistoryxSourcesxBibliographyxCatalogs.1 aRivas Palá, María.1 aParaíso Gros, Jesús. aAgua, medio ambiente y desarrollo en el siglo XXI : México desde una perspectiva global y regionalw14052955 0aColección Archivos de Aragón ;v5. uhttp://demo-kobli.bage.es:8080/intranet-tmpl/prog/local_repository/documents/1.pngyVer documento uhttp://demo-kobli.bage.es:8080/intranet-tmpl/prog/local_repository/documents/1.pngyVer Documento2 2udccBKs1 axh01 to hlcd 7-27-95; lk19 04-29-96; lk03 to sl 04-30-96 c567d567 00102udc407091aorexborexcSTAFFd2011-05-20l3p121215r2015-04-07s2015-04-07t1v54.00w2011-05-20yBKzEl libro se encuentra perdido desde hace años. Prueba 00102lcc407092aorexborexd2011-05-24r2011-05-24w2011-05-24yBK 00102udc407093aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407094aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407095aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407096aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407097aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407098aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc407099aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc4070910aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc4070911aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc4070912aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc4070913aorexborexd2012-02-29r2012-02-29w2012-02-29yBK 00102udc40686070914aorexborexcCHILDd2012-04-10o860r2012-04-10w2012-04-10yBK 00102udc4070915aorexborexd2013-02-11r2013-02-11w2013-02-11yBKzPrueba 00102lcc406SG03801453384791 A S811 M70916aOrexbOrexcCHILDd2013-02-20oSG 380.1453384791 As811mp2013-9999r2013-02-20w2013-02-20yBK
\ No newline at end of file
00933namaa2200277 a 4500001001100000005001700011008004100028017001600069020001500085040002700100041001400127080001100141080001500152084000900167100002500176245003400201260005000235300002800285490005900313500003000372650001900402830005300421942000700474999001100481952016300492.b4613271520170428135215.0101215s1995 sp a 000 0 spa c aM 4923-1995 a8478385290 aDHUBb catc COMPARTIA1 aspah eng a940.18 a355"10/12" aM3181 aHook, Richard93409314aLos cruzadosc / Richard Hook a[Madrid]b : Ediciones del Pradoc, cop. 1995 a64 p.b : il.c ; 25 cm1 aEjércitos y batallasv ; 56.aTropas de élitev ; 29 aTít. orig.: The crusades 4aCroades934094 0aEjércitos y batallasp. Tropas de élite933884 cLL c12d12 0010406M_318_000000000000000_HOO70912adhubbdhubcSGMd2039-06-06eDonacióm0oM318 Hoop10600000008257r2014-04-14w2014-04-14yLLzDonació Enric Roig
\ No newline at end of file
......@@ -34,7 +34,8 @@ class IntProfilDonneesLoader extends Storm_Model_Loader {
public function getItemFields() {
return [Class_IntProfilDonnees::FIELD_ITEM_BARCODE => '',
return [Class_IntProfilDonnees::FIELD_ITEM_ZONE => 995,
Class_IntProfilDonnees::FIELD_ITEM_BARCODE => '',
Class_IntProfilDonnees::FIELD_ITEM_COTE => '',
Class_IntProfilDonnees::FIELD_ITEM_TYPE_DOC => '',
Class_IntProfilDonnees::FIELD_ITEM_GENRE => '',
......@@ -200,12 +201,13 @@ class IntProfilDonneesLoader extends Storm_Model_Loader {
public function getItemBarCodes() {
return Class_CosmoVar::getList('champ_code_barres');
}
public function getItemCotes() {
return Class_CosmoVar::getList('champ_cote');
$values = $this->getAllZoneAndFields();
$values['997'] = '997$a (' . $this->_('obsolète') .')';
$values['852'] = '852$g (' . $this->_('obsolète') .')';
$values['999'] = '999$i (' . $this->_('obsolète') .')';
$values['996'] = '996$f (' . $this->_('obsolète') .')';
$values['949'] = '949$6 (' . $this->_('obsolète') .')';
return $values;
}
......@@ -215,16 +217,10 @@ class IntProfilDonneesLoader extends Storm_Model_Loader {
public function getAllZoneAndFields() {
$values = ['' => '',
'#' => '995$0'];
for($i=1; $i<10; $i++)
$values[$i] = '995$' . $i;
for($i=65; $i<91; $i++) {
$key = strtolower(chr($i));
$values[$key] = '995$' . $key;
}
return $values;
$values = $keys = array_merge(range(1,9), range('a', 'z'));
array_walk($values, function(&$value) { $value = '$' . $value; });
return ['' => '', '#' => '$0'] + array_combine($keys, $values);
}
}
......@@ -268,6 +264,7 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
NOVELTY_DATE_FORMAT_JJ_MM_AAAA = 4,
NOVELTY_DATE_FORMAT_SLASHED_JMAAAA = 5,
FIELD_TYPE_DOC_RECOGNITION = 'type_doc',
FIELD_ITEM_ZONE = 'item_zone',
FIELD_ITEM_TYPE_DOC = 'champ_type_doc',
FIELD_ITEM_BARCODE = 'champ_code_barres',
FIELD_ITEM_COTE = 'champ_cote',
......@@ -277,6 +274,7 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
FIELD_ITEM_ANNEXE = 'champ_annexe',
FIELD_ITEM_AVAILABILITY = 'champ_availability',
FIELD_ITEM_URL = 'champ_url',
FIELD_ITEM_ID_ORIGINE = 'champ_id_origine',
PROFILE_FIELDS = 'champs',
PROFILE_DOC_TYPES = 'type_doc',
PROFILE_NOVELTY = 'jours',
......@@ -920,6 +918,11 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
}
public function getItemZone() {
return $this->getProfilePrefs()->getItemZone();
}
public function getAvailability() {
return $this->getProfilePrefs()->getItemAvailability();
}
......@@ -935,6 +938,16 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
}
public function getIdOrigineZone() {
return $this->getProfilePrefs()->getItemIdOrigine()['id_origine_zone'][0];
}
public function getIdOrigineField() {
return $this->getProfilePrefs()->getItemIdOrigine()['id_origine_champ'][0];
}
public function getNoveltyFormat() {
return $this->getProfilePrefs()->getItemNoveltyFormat();
}
......
......@@ -22,6 +22,13 @@
class Class_ProfilePrefs extends Class_Entity {
public function getItemZone() {
$prefs = $this->getItemPrefs();
return isset($prefs[Class_IntProfilDonnees::FIELD_ITEM_ZONE])
? $prefs[Class_IntProfilDonnees::FIELD_ITEM_ZONE]
: '995';
}
public function getItemBarCode() {
return $this->getItemPrefs()[Class_IntProfilDonnees::FIELD_ITEM_BARCODE];
}
......@@ -144,6 +151,33 @@ class Class_ProfilePrefs extends Class_Entity {
}
public function getItemIdOrigine() {
$id_origine_zone = $this->getItemIdOrigineZone()
? $this->getItemIdOrigineZone()
: '001';
$id_origine_champ = $this->getItemIdOrigineChamp();
return ['id_origine_zone' => [$id_origine_zone],
'id_origine_champ' => [$id_origine_champ]];
}
public function getItemIdOrigineZone() {
return $this->getItemIdOriginePrefs()['zone'];
}
public function getItemIdOrigineChamp() {
return $this->getItemIdOriginePrefs()['champ'];
}
public function getItemIdOriginePrefs() {
return $this->getItemPrefs()[Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE];
}
public function getItemNoveltyFormat() {
return $this->getItemNoveltyPrefs()[Class_IntProfilDonnees::NOVELTY_FORMAT];
}
......
......@@ -39,6 +39,7 @@ class Class_ProfileSerializer_UnimarcRecord extends Class_ProfileSerializer_Abst
public function populateForm($form) {
return $form
->populateItemZone()
->populateItemBarCode()
->populateItemCote()
->populateItemDocType()
......@@ -52,6 +53,7 @@ class Class_ProfileSerializer_UnimarcRecord extends Class_ProfileSerializer_Abst
->populateItemNoveltyDays()
->populateItemNoveltyValeurs()
->populateItemDocTypes(['label' => 'label', 'zone' => 'zone_995'])
->populateItemIdOrigine()
->populateItemUrl()
->populateInterests();
}
......@@ -64,7 +66,10 @@ class Class_ProfileSerializer_UnimarcRecord extends Class_ProfileSerializer_Abst
protected function _extractRecords() {
return array_merge($this->_extractDocTypes(), $this->_extractItemFields(), $this->_extractItemUrl());
return array_merge($this->_extractDocTypes(),
$this->_extractItemFields(),
$this->_extractItemIdOrigine(),
$this->_extractItemUrl());
}
......@@ -109,6 +114,12 @@ class Class_ProfileSerializer_UnimarcRecord extends Class_ProfileSerializer_Abst
}
protected function _extractItemIdOrigine() {
return [Class_IntProfilDonnees::FIELD_ITEM_ID_ORIGINE => ['zone' => $this->_datas['id_origine_zone'][0],
'champ' => $this->_datas['id_origine_champ'][0]]];
}