From: Kurund Jalmi Date: Tue, 16 Jul 2013 18:20:27 +0000 (+0530) Subject: more cleanup and preview fixes CRM-12963 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=1a502055954a7da2c30c7cb5baeffb62d0dbe68a;p=civicrm-core.git more cleanup and preview fixes CRM-12963 --- diff --git a/CRM/Badge/BAO/Badge.php b/CRM/Badge/BAO/Badge.php index 70ba84216f..04ef2c42b7 100644 --- a/CRM/Badge/BAO/Badge.php +++ b/CRM/Badge/BAO/Badge.php @@ -91,7 +91,7 @@ class CRM_Badge_BAO_Badge { $value = $row[$element]; // hack to fix date field display format if (strpos($element, '_date')) { - $value = CRM_Utils_Date::customFormat($value, "%e %b"); + $value = CRM_Utils_Date::customFormat($value, "%B %E%f"); } } diff --git a/CRM/Badge/Form/Layout.php b/CRM/Badge/Form/Layout.php index 5c9931a99a..4d4f2d435c 100644 --- a/CRM/Badge/Form/Layout.php +++ b/CRM/Badge/Form/Layout.php @@ -221,6 +221,7 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form { $badgeInfo = CRM_Badge_BAO_Layout::create($params); if (isset($params['_qf_Layout_refresh'])) { + $this->set('id', $badgeInfo->id); $params['badge_id'] = $badgeInfo->id; self::buildPreview($params); } @@ -235,6 +236,12 @@ class CRM_Badge_Form_Layout extends CRM_Admin_Form { // get a max participant id $participantID = CRM_Core_DAO::singleValueQuery('select max(id) from civicrm_participant'); + if (!$participantID) { + CRM_Core_Session::setStatus(ts('Preview requires at least one event and one participant record. + If you are just getting started, you can add a test participant record.'), ts('Preview Requirements'), 'alert'); + return; + } + $this->_single = TRUE; $this->_participantIds = array($participantID); $this->_componentClause = " civicrm_participant.id = $participantID ";