I just migrated from the OMP 3.1.2.2 to the OMP 3.3.0.13.
In the old version I implemented some changes on the frontend (templates) and would like to do the same also on the latest version.
In the past I used in the template $monograph->getSeriesTitle() to get the name of the series the monograph belongs to. Unfortunately this method/call is not available in the latest version.
Can you please help me what changes are required to get the same functionality also on the latest OMP version? That is the series name of the monograph, used in a frontent template.
He added the following to the submission class classes/submission/Submission.inc.php:
function getSeriesTitle() {
$publication = $this->getCurrentPublication();
if (!$publication) {
return '';
}
$seriesId = $publication->getData('seriesId');
if (!$seriesId) {
return '';
}
$seriesDao = DAORegistry::getDAO('SeriesDAO');
$series = $seriesDao->getById($seriesId, $this->getData('contextId'));
if (!$series) {
return '';
}
return $series->getLocalizedTitle();
}
Apparently it’s a quick solution that may be improved, but it’s working fine for us here https://books.lub.lu.se/.
Maybe this could work for you as well?
Hi @mannemark
how would that code look like in OMP 3.4 without direct access to the DAO? Have you already tested that? I’d be curious?
best regards
Klaus
Hello @klausru, no that’s not something that we are aware of. I personally don’t know how this code works at all unfortunately, and the upgrade to 3.4 is some time away for us (next year hopefully).
Are you saying this code will not be valid in 3.4?
Dear Magnus
I was just interested in your code snippet and in customising OMP. At the same time I realised that v3.4 is now published and brings some changes: https://docs.pkp.sfu.ca/dev/release-notebooks/en/3.4-release-notebook
E.g., where it says “Direct access to the DAO is discouraged”, and other things that should be individually tested before upgrading production sites.
Best
Klaus
OK, then I understand. Thank you for letting me know about this, we will have to have a closer look at all modifications where we use this type of access before upgrading.