diff --git a/classes/SectionView/SectionView.php b/classes/SectionView/SectionView.php index cbe569e770..b3054b9c94 100644 --- a/classes/SectionView/SectionView.php +++ b/classes/SectionView/SectionView.php @@ -241,13 +241,14 @@ protected function display_section_or_speech($args = array()) { $data = $this->setTitleAndAlertText($data, $subsection_title); - $data['debate_time_human'] = format_time($first_speech['htime'], TIMEFORMAT); - $data['debate_day_human'] = format_date($first_speech['hdate'], LONGDATEFORMAT); - - $URL = new \MySociety\TheyWorkForYou\Url($this->list->listpage); - $URL->insert(array('d' => $first_speech['hdate'])); - $URL->remove(array('id')); - $data['debate_day_link'] = $URL->generate(); + if ($first_speech) { + $data['debate_time_human'] = format_time($first_speech['htime'], TIMEFORMAT); + $data['debate_day_human'] = format_date($first_speech['hdate'], LONGDATEFORMAT); + $URL = new \MySociety\TheyWorkForYou\Url($this->list->listpage); + $URL->insert(array('d' => $first_speech['hdate'])); + $URL->remove(array('id')); + $data['debate_day_link'] = $URL->generate(); + } $data['nextprev'] = $DATA->page_metadata($this_page, 'nextprev'); @@ -261,8 +262,8 @@ protected function display_section_or_speech($args = array()) { "%s %s%s %s", $data['intro'], $this->location, - $data['debate_time_human'] ? " at $data[debate_time_human]" : '', - $data['debate_day_human'] + isset($data['debate_time_human']) ? " at $data[debate_time_human]" : '', + isset($data['debate_day_human']) ? $data['debate_day_human'] : '', )); return $data; diff --git a/www/includes/easyparliament/hansardlist.php b/www/includes/easyparliament/hansardlist.php index 247afefb82..71c3d905e7 100644 --- a/www/includes/easyparliament/hansardlist.php +++ b/www/includes/easyparliament/hansardlist.php @@ -2821,12 +2821,14 @@ public function _get_data_by_featured_gid($args=array()) { ':subsection_id' => $item_data['subsection_id'], ) )->first(); - $section_body = $r['sec_body']; - $subsection_body = $r['sub_body']; - if ( $section_body && $subsection_body ) { - $parentbody = "$section_body : $subsection_body"; - } else { - $parentbody = "$section_body$subsection_body"; + if ($r) { + $section_body = $r['sec_body']; + $subsection_body = $r['sub_body']; + if ( $section_body && $subsection_body ) { + $parentbody = "$section_body : $subsection_body"; + } else { + $parentbody = "$section_body$subsection_body"; + } } } else if ( $item_data['htype'] == 10 ) { $parentbody = $body; @@ -2847,8 +2849,10 @@ public function _get_data_by_featured_gid($args=array()) { ", array( ':object_id' => $item_data['epobject_id'] ) )->first(); - $childbody = $r['body']; - $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major ); + if ($r) { + $childbody = $r['body']; + $speaker = $this->_get_speaker($r['person_id'], $r['hdate'], $r['htime'], $this->major ); + } } $contentcount = 0; diff --git a/www/includes/easyparliament/templates/html/section/section.php b/www/includes/easyparliament/templates/html/section/section.php index 76a57ff5c2..ef3e6eb6fc 100644 --- a/www/includes/easyparliament/templates/html/section/section.php +++ b/www/includes/easyparliament/templates/html/section/section.php @@ -12,11 +12,13 @@
= $intro ?> = $location ?> - %s'), $debate_day_link, $debate_day_human); + if (isset($debate_day_human)) { + printf(gettext('on %s'), $debate_day_link, $debate_day_human); + } ?>.