Permalink
Browse files

Merge branch 'master' of https://github.com/tbar0970/jethro-pmm

  • Loading branch information...
tbar0970 committed Jan 10, 2018
2 parents cfd75b6 + dde9789 commit 19e89cb49d08c853cfe0a7fd1e65a162bcc6260f
@@ -9,7 +9,7 @@ function run()
trigger_error('Template file does not seem to have been uploaded');
return;
}
$extension = strtolower(end(explode('.', $source_file['name'])));
$extension = @strtolower(end(explode('.', $source_file['name'])));
$source_file = $source_file['tmp_name'];
$merged_file = dirname($source_file).'/jethro_merged_'.time().session_id();
@@ -47,7 +47,7 @@ protected static function _getFields()
'default' => $GLOBALS['user_system']->getCurrentUser('id'),
'note' => 'Choose the user responsible for acting on this note',
'allow_empty' => true,
'filter' => create_function('$x', 'return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);'),
'filter' => function($x) {return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);},
),
'assignee_last_changed' => Array(
'type' => 'datetime',
@@ -755,7 +755,7 @@ static public function printCohortChooserRow($selectedValue)
$congregations = $GLOBALS['system']->getDBObjectData('congregation', Array('!attendance_recording_days' => 0), 'OR', 'meeting_time');
$groups = $GLOBALS['system']->getDBObjectData('person_group', Array('!attendance_recording_days' => 0, 'is_archived' => 0), 'AND', 'category, name');
// need to preserve category too
uasort($groups, create_function('$x,$y', '$r = strnatcmp($x["category"], $y["category"]); if ($r == 0) $r = strnatcmp($x["name"], $y["name"]); return $r;')); // to ensure natural sorting
uasort($groups, function($x,$y) {$r = strnatcmp($x["category"], $y["category"]); if ($r == 0) $r = strnatcmp($x["name"], $y["name"]); return $r;}); // to ensure natural sorting
}
$lastCategory = -1;
?>
@@ -182,7 +182,8 @@ public function getInstancesQueryComps($params, $logic, $order)
{
$res = parent::getInstancesQueryComps($params, $logic, $order);
$res['from'] .= ' LEFT JOIN custom_field_option cfo ON cfo.fieldid = custom_field.id';
$res['select'][] = 'GROUP_CONCAT(CONCAT(cfo.id, "__:__", cfo.value) ORDER BY cfo.rank SEPARATOR ";;;") as options';
$res['select'][] = 'GROUP_CONCAT(CONCAT(cfo.id, "__:__", cfo.value) ORDER BY cfo.rank ASC SEPARATOR ";;;") as options';
$res['select'][] = 'GROUP_CONCAT(CONCAT(cfo.id, "__:__", cfo.value) ORDER BY cfo.rank DESC SEPARATOR ";;;") as reverseoptions';
$res['select'][] = 'params';
$res['group_by'] = 'custom_field.id';
return $res;
@@ -200,17 +201,26 @@ public function getInstancesData($params, $logic='OR', $order='')
{
$res = parent::getInstancesData($params, $logic, $order);
foreach ($res as $k => $v) {
$opts = Array();
if ($v['type'] == 'select') {
$opts = Array();
$res[$k]['options'] = NULL;
$options = array_get($v, 'options', '');
if (strlen($options)) {
foreach (explode(';;;', $options) as $pair) {
list($id, $val) = explode('__:__', $pair);
$opts[$id] = $val;
$pairs = explode(';;;', $options);
$revPairs = explode(';;;', $v['reverseoptions']);
if (reset($pairs) == end($revPairs)) {
foreach ($pairs as $pair) {
list($id, $val) = explode('__:__', $pair);
$opts[$id] = $val;
}
$res[$k]['options'] = $opts;
} else {
// Too many options, it was truncated
// That's OK, the options can get loaded on demand later
}
}
}
$res[$k]['options'] = $opts;
unset($res[$k]['reverseoptions']);
$res[$k]['params'] = unserialize($v['params']);
}
return $res;
@@ -196,7 +196,9 @@ function printForm($prefix='', $fields=NULL)
<?php
if (empty($params['custom_fields'])) $params['custom_fields'] = Array();
$dummyField = new Custom_Field();
foreach ($this->_custom_fields as $fieldid => $fieldDetails) {
$dummyField->populate($fieldid, $fieldDetails);
?>
<tr>
<td>
@@ -284,7 +286,7 @@ class="select-rule-toggle"
print_widget('params_custom_field_'.$fieldid.'_criteria', $cparams, array_get($value, 'criteria'));
$vparams = Array(
'type' => 'select',
'options' => $fieldDetails['options'],
'options' => $dummyField->getOptions(),
'allow_multiple' => true,
'attrs' => Array(
'data-select-rule-type' => 'contains'
@@ -31,7 +31,7 @@ protected static function _getFields()
'show_id' => FALSE,
'order_by' => 'meeting_time',
'allow_empty' => TRUE,
'filter' => create_function('$x', '$y = $x->getValue("meeting_time"); return !empty($y);'),
'filter' => function($x) {$y = $x->getValue("meeting_time"); return !empty($y);},
'note' => 'Congregations must have a "code name" set to be available here',
),
'title' => Array(
@@ -51,15 +51,15 @@ public static function migrateEnabledFeatures()
{
$value = explode(',', ENABLED_FEATURES);
$value = array_diff($value, Array('DATES'));
self::saveSetting(ENABLED_FEATURES, $value);
self::saveSetting('ENABLED_FEATURES', $value);
}
public static function migrateLockLength()
{
// used to be in strtotime format; now in minutes
$secs = strtotime('+'.LOCK_LENGTH);
self::saveSetting(LOCK_LENGTH, $secs/60);
self::saveSetting('LOCK_LENGTH', $secs/60);
}
public static function migrateAgeBracketOptions()
@@ -331,7 +331,7 @@ public function save()
// Set any last-changed fields
foreach ($this->_old_values as $i => $v) {
if (array_key_exists($i.'_last_changed', $this->fields)) {
$this->values[$i.'_last_changed'] = date('c');
$this->values[$i.'_last_changed'] = date('Y-m-d H:i:s');
$this->_old_values[$i.'_last_changed'] = 1;
}
}
View
@@ -639,7 +639,7 @@ function hl_tag2(&$e, &$a, $t=1){
function hl_tidy($t, $w, $p){
// Tidy/compact HTM
if(strpos(' pre,script,textarea', "$p,")){return $t;}
$t = str_replace(' </', '</', preg_replace(array('`(<\w[^>]*(?<!/)>)\s+`', '`\s+`', '`(<\w[^>]*(?<!/)>) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea).*?>)(.+?)(</\2>)`sm'), create_function('$m', 'return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];'), $t)));
$t = str_replace(' </', '</', preg_replace(array('`(<\w[^>]*(?<!/)>)\s+`', '`\s+`', '`(<\w[^>]*(?<!/)>) `'), array(' $1', ' ', '$1'), preg_replace_callback(array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea).*?>)(.+?)(</\2>)`sm'), function($m) {return $m[1]. str_replace(array("<", ">", "\n", "\r", "\t", " "), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), $m[3]). $m[4];}, $t)));
if(($w = strtolower($w)) == -1){
return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t);
}
@@ -41,7 +41,7 @@ order by name;
ALTER TABLE date_type RENAME TO _disused_date_type;
SET @rank = (SELECT MAX(rank) FROM custom_field) + 1;
SET @rank = (SELECT IFNULL(MAX(rank), 0) FROM custom_field) + 1;
/* Some systems have date values with typeid=null */
INSERT INTO custom_field
@@ -52,7 +52,7 @@ function printView()
'references' => 'staff_member',
'allow_empty' => true,
'empty_text' => 'Anyone',
'filter' => create_function('$x', 'return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);'),
'filter' => function($x) {return $x->getValue("active") && (($x->getValue("permissions") & PERM_EDITNOTE) == PERM_EDITNOTE);},
),
array_get($_REQUEST, 'assignee')
);
@@ -135,7 +135,7 @@ public function printView()
'order_by' => 'meeting_time',
'allow_empty' => false,
'allow_multiple' => true,
'filter' => create_function('$x', '$y = $x->getValue("meeting_time"); return !empty($y);'),
'filter' => function($x) {$y = $x->getValue("meeting_time"); return !empty($y);},
), Array());
?>
</div>
@@ -57,7 +57,7 @@ function processView()
uasort($this->fields, create_function('$x,$y', 'return (int)$x->getValue("rank") > (int)$y->getValue("rank");'));
uasort($this->fields, function($x,$y) {return (int)$x->getValue("rank") > (int)$y->getValue("rank");});
if ($i > 0) {
add_message("Custom fields updated", 'success');
@@ -378,6 +378,7 @@ private function _printResultsTabular()
}
$all_dates = array_unique($all_dates);
?>
<form method="post" action="" class="bulk-person-action">
<table class="table table-hover table-condensed table-auto-width valign-middle table-bordered parallel-attendance-report">
<thead>
<tr>
@@ -582,7 +583,9 @@ private function _printResultsTabular()
</table>
<?php
include 'templates/bulk_actions.template.php';
?>
</form>
<?php
}
}
?>

0 comments on commit 19e89cb

Please sign in to comment.