function getInstancesQueryComps($params, $logic, $order) { $res = parent::getInstancesQueryComps($params, $logic, $order); $res['from'] .= ' JOIN service_component_tag sct ON sct.id = tagid '; $res['select'][] = 'sct.tag'; return $res; }
function getInstancesQueryComps($params, $logic, $order) { $res = parent::getInstancesQueryComps($params, $logic, $order); $res['select'][] = 'cong.*'; $res['from'] .= ' JOIN congregation cong ON cong.id = congregation_service_component.congregationid'; return $res; }
function printFieldInterface($fieldname, $prefix) { if ($fieldname == 'parent_category') { self::printChooser($prefix . $fieldname, $this->getValue('parent_category'), $this->id); } else { return parent::printFieldInterface($fieldname, $prefix); } }
function getInstancesQueryComps($params, $logic, $order) { $res = parent::getInstancesQueryComps($params, $logic, $order); $res['select'][] = 'g.name as volunteer_group_name, c.name as congregation_name'; $res['from'] = '(' . $res['from'] . ') LEFT OUTER JOIN person_group g ON roster_role.volunteer_group = g.id LEFT OUTER JOIN congregation c ON roster_role.congregationid = c.id'; return $res; }
function getInitSQL() { $res = (array) parent::getInitSQL(); $res[] = 'INSERT INTO service_component_category (category_name, runsheet_title_format, handout_title_format, length_mins_default) VALUES ("Songs", "Song: %title%", "Song: %title%", 3), ("Prayers", "%title%", "%title%", 2), ("Creeds", "The %title%", "The %title%", 2), ("Other", "%title%", "%title%", 1);'; return $res; }
function getInitSQL() { $res = (array) parent::getInitSQL(); $res[] = 'INSERT INTO service_component_category (category_name, runsheet_title_format, handout_title_format, length_mins_default, personnel_default) VALUES ("Songs", "Song: %title%", "Song: %title%", 3, "%SONG_LEADER_FIRSTNAME%"), ("Prayers", "%title%", "%title%", 2, "%SERVICE_LEADER_FIRSTNAME%"), ("Creeds", "The %title%", "The %title%", 2, "%SERVICE_LEADER_FIRSTNAME%"), ("Other", "%title%", "%title%", 1, "");'; return $res; }
public function getInstancesQueryComps($params, $logic, $order) { $res = parent::getInstancesQueryComps($params, $logic, $order); $res['select'][] = 'COUNT(p.id) AS member_count'; $res['from'] .= ' LEFT JOIN person p ON p.status <> "archived" AND p.congregationid = congregation.id '; $res['group_by'] = 'congregation.id'; $restrictions = array(); if (!empty($GLOBALS['user_system'])) { $restrictions = $GLOBALS['user_system']->getCurrentRestrictions(); } if (!empty($restrictions['congregation'])) { $oldwhere = $res['where']; $res['where'] = 'congregation.id IN (' . implode(',', array_map(array($GLOBALS['db'], 'quote'), $restrictions['congregation'])) . ') '; if ($oldwhere) { $res['where'] .= ' AND (' . $res['where'] . ')'; } } return $res; }
public function processFieldInterface($fieldname, $prefix) { switch ($fieldname) { case 'params': $options = array(); $toDelete = array_get($_REQUEST, $prefix . 'options_delete', array()); foreach ($_REQUEST[$prefix . 'option_ids'] as $i => $id) { if (!in_array($id, $toDelete)) { $o = trim($_REQUEST[$prefix . 'option_values'][$i]); if ($o !== '') { $options[] = $o; } } } $this->setValue('params', array('options' => $options)); break; default: return parent::processFieldInterface($fieldname, $prefix); } }
function printFieldInterface($fieldname, $prefix = '') { if ($fieldname == 'categoryid') { $GLOBALS['system']->includeDBClass('person_group_category'); Person_Group_Category::printChooser($prefix . $fieldname, $this->getValue('categoryid')); echo ' <small><a href="' . build_url(array('view' => 'groups__manage_categories')) . '">Manage categories</a></small>'; } else { return parent::printFieldInterface($fieldname, $prefix); } }
function getInstancesData($params, $logic = 'OR', $order = '') { $res = parent::getInstancesData($params, $logic, $order); foreach ($res as $i => $v) { $res[$i]['readings'] = array(); if (!empty($v['readings'])) { $readings = explode(';', $v['readings']); foreach ($readings as $r) { list($ref, $to_read, $to_preach) = explode('=', $r); $res[$i]['readings'][] = array('bible_ref' => $ref, 'to_read' => $to_read, 'to_preach' => $to_preach); } } } return $res; }
function save($update_members = TRUE) { $msg = ''; if ($update_members) { if (!empty($this->_old_values['status'])) { if ($this->getValue('status') == 'archived') { // Status has just been changed to 'archived' so archive members too $members = $this->getMemberData(); if (!empty($members)) { $GLOBALS['system']->includeDBClass('person'); $member = new Person(); $all_members_archived = TRUE; foreach ($members as $id => $details) { $member->populate($id, $details); if ($member->canAcquireLock()) { $member->acquireLock(); $member->setValue('status', 'archived'); $member->save(FALSE); $member->releaseLock(); } else { $all_members_archived = FALSE; } } if ($all_members_archived) { $msg = 'The ' . count($members) . ' members of the family have also been archived'; } else { $msg = 'Not all members of the family could be accordingly archived because another user holds the lock'; } } } else { if ($this->_old_values['status'] == 'archived') { // Status has just been changed from archived to something else $msg = 'NB Members of the family will need to be de-archived separately'; } } } if (!empty($this->_old_values['family_name'])) { // Family name has changed // We update all the members' last names to match if // (a) there is only one member, or // (b) all members' current last name = the old family name $members = $this->getMemberData(); if (count($members) == 1) { $member = $GLOBALS['system']->getDBObject('person', key($members)); if ($member->canAcquireLock()) { $member->acquireLock(); $member->setValue('last_name', $this->getValue('family_name')); $member->save(FALSE); $member->releaseLock(); $msg = 'The last name of the family\'s one member has also been set to "' . $this->getValue('family_name') . '"'; } else { $msg = 'The family\'s one member could not be updated accordingly because another user holds the lock'; } } else { if (!empty($members)) { $members_all_have_family_name = TRUE; foreach ($members as $id => $member) { if ($member['last_name'] != $this->_old_values['family_name']) { $members_all_have_family_name = FALSE; break; } } if ($members_all_have_family_name) { $all_members_updated = TRUE; $GLOBALS['system']->includeDBClass('person'); $member = new Person(); foreach ($members as $id => $details) { $member->populate($id, $details); if ($member->canAcquireLock()) { $member->acquireLock(); $member->setValue('last_name', $this->getValue('family_name')); $member->save(FALSE); $member->releaseLock(); } else { $all_members_updated = FALSE; } } if ($all_members_updated) { $msg = 'Each family member\'s last name has also been set to "' . $this->getValue('family_name') . '"'; } else { $msg = 'Not all family members could be updated with the new last name because another user holds the lock'; } } else { $msg = 'Family members have not been updated because they already have different last names'; } } } } } $res = parent::save(); if ($msg) { add_message($msg); } return $res; }
/** * Save changes to an existing note template to the DB * @return boolean */ public function save() { $GLOBALS['system']->doTransaction('BEGIN'); if (parent::save()) { $this->_saveFields(); $GLOBALS['system']->doTransaction('COMMIT'); return TRUE; } return FALSE; }
function printFieldInterface($fieldname, $prefix) { return parent::printFieldInterface($fieldname, $prefix); }
/** * Save changes to an existing custom field to the DB * @return boolean */ public function save() { $GLOBALS['system']->doTransaction('BEGIN'); parent::save(); $this->_saveOptions(); $GLOBALS['system']->doTransaction('COMMIT'); }
public function save() { $res = parent::save(); if ($res) { $this->_saveCongregations(TRUE); $this->_saveTags(TRUE); } return $res; }
function populate($id, $values) { $this->_members = array(); $this->_members_to_set = array(); return parent::populate($id, $values); }
<?php include './index.php'; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $dbObject = new db_object(); $dbObject->paymentDates('0000001', '2014-03-15'); print "<br>here";