Larian77 / Openbiblio

Other
7 stars 6 forks source link

Feldname eine benutzerdefinierten MARC Field wird in Biblio_view nicht ausgegeben #5

Closed LeAchim59 closed 8 months ago

LeAchim59 commented 8 months ago

Dafür ist es nötig MaterialFieldQuery.php sum eine zusätzliche Abfrage nach den benutzerdefinierten Feldern zu erweitern, die die Liste aber im Format eines Arrays aus UsmarcsubfieldDm liefert. Nach Vereinigung der beiden Listen, werden dann alle Namen angegeben.

LeAchim59 commented 8 months ago

@Larian77 Bitte meinen Code (auch hinsichtlich PHP8) prüfen.

Larian77 commented 8 months ago

Das ist ne Funktion, die ich noch gar nicht kannte :-) - wieder was gelernt

Die Funktion $marcSubflds += $matSubflds; funktioniert nicht mehr in PHP 8 - dafür gibts jetzt ne Arraymerge-Funktion.

Leider hatte diese aber den Nachteil dass diese die Indizes des marcsubfield-Array geschrottet hat wenn diese 4stellige Zahlen waren (wenn sie mit 0 begannen oder einen Buchstaben haben dann haben diese ein "" drum und blieben)

Da ich hier auf Anhieb keine gute Lösung fand habe ich jetzt nicht beide Arrays gemerged, sondern bei der Ausgabe an der Stelle einmal den Wert mit marcsubfield und dahinter mit matSubflds ausgebe, da sich beide nicht überschneiden (in matSubflds stehen keine Werte aus marcsubfield) funktioniert das auch, auch wenn es nicht besonders elegant ist.

Habe die neue Version in die main-branch hochgeladen

Wenn jemand mit viel Ahnung hier nochmal schaut, kann er das gerne machen :-)

In english (automatic translation with deepl): That's a function I didn't even know about :-) - learned something again

The function $marcSubflds += $matSubflds; no longer works in PHP 8 - instead there is now an arraymerge function.

Unfortunately this had the disadvantage that it corrupted the indices of the marcsubfield array if they were 4-digit numbers (if they started with 0 or had a letter then they had a "" around them and stayed).

Since I couldn't find a good solution right away, I didn't merge both arrays, but instead output the value with marcsubfield and then with matSubflds, since the two don't overlap (matSubflds doesn't contain any values from marcsubfield), this also works, even if it's not particularly elegant.

If someone with a lot of knowledge looks here again, they are welcome to do so :-)

I have uploaded the new version to the main-branch