Skip to content

Commit

Permalink
Merge pull request #244 from vanoudt/php7changes_new
Browse files Browse the repository at this point in the history
Syntax changes to support PHP strict mode and PHP7
  • Loading branch information
tbar0970 authored Aug 24, 2016
2 parents 074443c + 6c414e9 commit 8b644f3
Show file tree
Hide file tree
Showing 50 changed files with 97 additions and 96 deletions.
6 changes: 3 additions & 3 deletions calls/call_envelopes.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function run()
$env = new Envelope_List();
$GLOBALS['system']->includeDBClass('family');
if (!empty($_REQUEST['familyid'])) {
$family =& $GLOBALS['system']->getDBObject('family', (int)$_REQUEST['familyid']);
$family = $GLOBALS['system']->getDBObject('family', (int)$_REQUEST['familyid']);
$env->addAddress($family->getAdultMemberNames()."\n".$family->getPostalAddress());
}
if (!empty($_REQUEST['personid'])) {
Expand Down Expand Up @@ -53,8 +53,8 @@ function run()
$env->addAddress($to."\n".$dummy->getPostalAddress());
}
} else {
$person =& $GLOBALS['system']->getDBObject('person', (int)$_REQUEST['personid']);
$family =& $GLOBALS['system']->getDBObject('family', $person->getValue('familyid'));
$person = $GLOBALS['system']->getDBObject('person', (int)$_REQUEST['personid']);
$family = $GLOBALS['system']->getDBObject('family', $person->getValue('familyid'));
$env->addAddress($person->toString()."\n".$family->getPostalAddress());
}
}
Expand Down
2 changes: 1 addition & 1 deletion calls/call_family_mailout_csv.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Call_Family_Mailout_CSV extends Call
function run()
{
header('Content-type: text/plain');
$group =& $GLOBALS['system']->getDBObject('person_group', (int)$_REQUEST['groupid']);
$group = $GLOBALS['system']->getDBObject('person_group', (int)$_REQUEST['groupid']);
header('Content-disposition: attachment; filename="'.str_replace('"', '\\"', $group->getValue('name')).'.csv"');
if (!empty($_REQUEST['groupid'])) {
$families = $GLOBALS['system']->getDBObjectData('family', Array('(family.id' => 'SELECT familyid FROM person JOIN person_group_membership pgm ON person.id = pgm.personid WHERE pgm.groupid = '.(int)$_REQUEST['groupid'], '!status' => 'archived'), 'AND', 'address_street');
Expand Down
2 changes: 1 addition & 1 deletion calls/call_report_csv.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function run()
$queryid = $_REQUEST['queryid'];
$queryid = ($queryid == 'TEMP') ? $queryid : (int)$queryid;
if ($queryid) {
$report =& $GLOBALS['system']->getDBObject('person_query', $queryid);
$report = $GLOBALS['system']->getDBObject('person_query', $queryid);
$reportname = $report->getValue('name');
if (empty($reportname)) $reportname = 'Jethro-Report-'.date('Y-m-d_H:i');
header('Content-type: application/force-download');
Expand Down
4 changes: 2 additions & 2 deletions db_objects/abstract_note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected static function _getFields()

function toString()
{
$creator =& $GLOBALS['system']->getDBObject('person', $this->values['creator']);
$creator = $GLOBALS['system']->getDBObject('person', $this->values['creator']);
return $this->values['subject'].' ('.$creator->toString().', '.format_date( strtotime($this->values['created'])).')';
}

Expand Down Expand Up @@ -152,7 +152,7 @@ function getInstancesQueryComps($params, $logic, $order)



function getInstancesData($params, $logic='OR', $order)
function getInstancesData($params, $logic='OR', $order='')
{
$res = parent::getInstancesData($params, $logic, $order);

Expand Down
10 changes: 5 additions & 5 deletions db_objects/action_plan.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include_once 'db_objects/action_plan_note.class.php';
class Action_Plan extends DB_Object
{
function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE action_plan (
Expand Down Expand Up @@ -83,7 +83,7 @@ function _processNoteForm($i) {
return null;
}

function printForm()
function printForm($prefix = '', $fields = NULL)
{
$GLOBALS['system']->includeDBClass('person_group');
$actions = $this->getValue('actions');
Expand Down Expand Up @@ -218,7 +218,7 @@ function printForm()
<tr>
<th>Options</th>
<td>

<input type="hidden" name="default_on_create_family" value="0" />
<label class="checkbox">
<input type="checkbox" id="default_on_create_family" name="default_on_create_family" value="1" <?php if ($this->getValue('default_on_create_family')) echo 'checked="checked"'; ?>>
Expand Down Expand Up @@ -257,7 +257,7 @@ function printForm()
<?php
}

function processForm()
function processForm($prefix = '', $fields = NULL)
{
parent::processForm();
$actions = Array(
Expand Down Expand Up @@ -297,7 +297,7 @@ function processForm()
$val = '-1==='.$_POST['custom_'.$fieldID.'_note'];
} else {
$val = $field->processWidget();
$val = reset($val); // it comes wrapped in an array
$val = reset($val); // it comes wrapped in an array
}
} else {
$val = $_POST[$k];
Expand Down
6 changes: 3 additions & 3 deletions db_objects/action_plan_note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static function getAbstractNoteData($action_note_data, $reference_date)
return $action_note_data;
}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
return '';
}
Expand Down Expand Up @@ -62,7 +62,7 @@ function printFieldInterface($name, $prefix='')
<input type="radio" name="<?php echo $prefix; ?>action_date_type" value="relative"
<?php if ($this->getValue('action_date_type') == 'relative') echo 'checked="checked"'; ?>
>
<?php $this->printFieldInterface('action_date_offset', $prefix); ?> days
<?php $this->printFieldInterface('action_date_offset', $prefix); ?> days
<?php $this->printFieldInterface('action_date_operator', $prefix); ?>
the reference date
</span>
Expand All @@ -73,7 +73,7 @@ function printFieldInterface($name, $prefix='')
}
}

function processForm($prefix) {
function processForm($prefix='', $fields=NULL) {
parent::processForm($prefix);
if ($this->values['subject']) {
$this->processFieldInterface('action_date_type', $prefix);
Expand Down
4 changes: 2 additions & 2 deletions db_objects/attendance_record_set.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function create()
}


function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `attendance_record` (
Expand Down Expand Up @@ -170,7 +170,7 @@ function load($date, $cohort, $age_brackets, $statuses)
$conds['congregationid'] = $this->congregationid;
$this->_persons = $GLOBALS['system']->getDBObjectData('person', $conds, 'AND', $order);
} else {
$group =& $GLOBALS['system']->getDBObject('person_group', $this->groupid);
$group = $GLOBALS['system']->getDBObject('person_group', $this->groupid);
$this->_persons = $group->getMembers($conds, $order);
}
}
Expand Down
4 changes: 2 additions & 2 deletions db_objects/custom_field_option.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getForeignKeys()
'fieldid' => 'custom_field(id) ON DELETE CASCADE',
);
}

function delete()
{
$GLOBALS['system']->doTransaction('BEGIN');
Expand All @@ -47,7 +47,7 @@ function delete()
$GLOBALS['system']->doTransaction('COMMIT');
}

function printFieldInterface($fieldname, $prefix)
function printFieldInterface($fieldname, $prefix='')
{
return parent::printFieldInterface($fieldname, $prefix);
}
Expand Down
2 changes: 1 addition & 1 deletion db_objects/custom_field_value.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
include_once 'include/db_object.class.php';
class Custom_Field_Value extends db_object
{
function getInitSQL() {
function getInitSQL($table_name=NULL) {
return '
CREATE TABLE custom_field_value (
id int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
Expand Down
4 changes: 2 additions & 2 deletions db_objects/family.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function __construct($id=NULL) {
}


function getInitSQL()
function getInitSQL($table_name=NULL)
{
return Array(
"
Expand Down Expand Up @@ -240,7 +240,7 @@ function printMemberList($abbreviated=NULL)
}
}

function printFieldInterface($name)
function printFieldInterface($name, $prefix='')
{
if ($name == 'photo') {
?>
Expand Down
4 changes: 2 additions & 2 deletions db_objects/family_note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected static function _getFields()

}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `family_note` (
Expand Down Expand Up @@ -47,7 +47,7 @@ function printFieldValue($name, $value=NULL)
if (is_null($value)) $value = $this->values[$name];
if ($name == 'familyid') {
if (!empty($value)) {
$family =& $GLOBALS['system']->getDBObject('family', $value);
$family = $GLOBALS['system']->getDBObject('family', $value);
?>
<a href="?view=families&familyid=<?php echo $value; ?>"><?php echo $family->toString(); ?></a> (#<?php echo $value; ?>)
<?php
Expand Down
2 changes: 1 addition & 1 deletion db_objects/headcount.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
class Headcount
{
public function getInitSQL()
public function getInitSQL($table_name=NULL)
{
return Array(
'CREATE TABLE congregation_headcount (
Expand Down
2 changes: 1 addition & 1 deletion db_objects/note_comment.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected static function _getFields()
);
}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `note_comment` (
Expand Down
10 changes: 5 additions & 5 deletions db_objects/note_template.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected static function _getFields()
* @see DB_Object::printForm()
* @param string $prefix
*/
function printForm($prefix='')
function printForm($prefix='', $fields=NULL)
{
$this->fields['fields'] = Array();
parent::printForm();
Expand Down Expand Up @@ -97,7 +97,7 @@ private function _printFieldsConfiguration()
<small>When a note is added to a person using this template, the user will be prompted for the
following fields. Values that the user supplies for "independent" fields will be saved
only within the note. Values for "person" fields are will be saved within the note and will also
update the corresponding
update the corresponding
<a href="<?php build_url(Array('view' => 'admin__custom_fields')); ?>">custom field</a>
in the person record.</small>

Expand All @@ -116,10 +116,10 @@ private function _printFieldsConfiguration()
<?php
$i = 0;
$dummyField = new Note_Template_Field();

// Hack this field because we don't want 'empty' in the dropdown.
$dummyField->fields['customfieldid']['allow_empty'] = FALSE;

$fields += Array(0 => Array());
foreach ($fields as $id => $field) {
$prefix = 'fields_'.$i.'_';
Expand Down Expand Up @@ -406,4 +406,4 @@ public static function printTemplateChooserRow($selectedID)
<?php
}
}
}
}
6 changes: 3 additions & 3 deletions db_objects/note_template_field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function delete()
$GLOBALS['system']->doTransaction('COMMIT');
}

function printFieldInterface($fieldname, $prefix)
function printFieldInterface($fieldname, $prefix='')
{
switch ($fieldname) {
case 'params':
Expand All @@ -98,7 +98,7 @@ function printFieldInterface($fieldname, $prefix)
}
}

public function processFieldInterface($fieldname, $prefix)
public function processFieldInterface($fieldname, $prefix='')
{
switch ($fieldname) {
case 'params':
Expand All @@ -121,4 +121,4 @@ public function processFieldInterface($fieldname, $prefix)
}


}
}
6 changes: 3 additions & 3 deletions db_objects/person.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected static function _getFields()
return $res;
}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
return Array(
"CREATE TABLE `_person` (
Expand Down Expand Up @@ -218,7 +218,7 @@ function toString()
}


function printFieldValue($name, $value=null)
function printFieldValue($name, $value=NULL)
{
if (is_null($value)) $value = $this->getValue($name);
$person_name = ents($this->getValue('first_name')).'&nbsp;'.ents($this->getValue('last_name'));
Expand Down Expand Up @@ -444,7 +444,7 @@ function save($update_family=TRUE)
// be updating themselves but saving the family will fail

if (!empty($this->_old_values['status']) || !empty($this->_old_values['last_name'])) {
$family =& $GLOBALS['system']->getDBObject('family', $this->getValue('familyid'));
$family = $GLOBALS['system']->getDBObject('family', $this->getValue('familyid'));
$members = $family->getMemberData();

if (!empty($this->_old_values['status']) && ($this->getValue('status') == 'archived')) {
Expand Down
2 changes: 1 addition & 1 deletion db_objects/person_group.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function __construct($id=NULL) {
}
}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
// Need to create the group-membership table as well as the group table
return Array(
Expand Down
2 changes: 1 addition & 1 deletion db_objects/person_group_category.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function delete()
$GLOBALS['system']->doTransaction('COMMIT');
}

function printFieldInterface($fieldname, $prefix)
function printFieldInterface($fieldname, $prefix='')
{
if ($fieldname == 'parent_category') {
self::printChooser($prefix.$fieldname, $this->getValue('parent_category'), $this->id);
Expand Down
4 changes: 2 additions & 2 deletions db_objects/person_note.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected static function _getFields()
}


function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `person_note` (
Expand All @@ -35,7 +35,7 @@ function printFieldValue($name, $value=NULL)
if (is_null($value)) $value = $this->values[$name];
if ($name == 'personid') {
if (!empty($value)) {
$person =& $GLOBALS['system']->getDBObject('person', $value);
$person = $GLOBALS['system']->getDBObject('person', $value);
?>
<a href="?view=persons&personid=<?php echo $value; ?>"><?php echo $person->toString(); ?></a> (#<?php echo $value; ?>)
<?php
Expand Down
6 changes: 3 additions & 3 deletions db_objects/person_query.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function __construct($id=0)
return parent::__construct($id);
}

function getInitSQL()
function getInitSQL($table_name=NULL)
{
return "
CREATE TABLE `person_query` (
Expand Down Expand Up @@ -126,7 +126,7 @@ function toString()
}


function printForm()
function printForm($prefix='', $fields=NULL)
{
$GLOBALS['system']->includeDBClass('person_group');
$params = $this->_convertParams($this->getValue('params'));
Expand Down Expand Up @@ -610,7 +610,7 @@ class="select-rule-toggle"
}
}

function processForm()
function processForm($prefix='', $fields=NULL)
{
if ($GLOBALS['user_system']->havePerm('PERM_MANAGEREPORTS')) {
switch ($_POST['save_option']) {
Expand Down
2 changes: 1 addition & 1 deletion db_objects/roster_role_assignment.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class roster_role_assignment extends db_object
{
// NB This class only exists for the following SQL
// It has no ID
function getInitSql()
function getInitSql($table_name = NULL)
{
return 'create table roster_role_assignment (
assignment_date date not null,
Expand Down
Loading

0 comments on commit 8b644f3

Please sign in to comment.