From 82c27595e5e95303716c7d8ab814dd9db2388cc3 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared.hancock@cleco.com>
Date: Wed, 18 Jul 2018 09:01:50 -0500
Subject: [PATCH] lint: Fix warnings about incomaptible function signatures

---
 include/class.dynamic_forms.php              |  5 +++--
 include/class.forms.php                      | 16 ++++++++--------
 include/class.search.php                     |  4 ++--
 include/client/edit.inc.php                  |  2 +-
 include/client/open.inc.php                  |  2 +-
 include/client/profile.inc.php               |  2 +-
 include/client/register.inc.php              |  2 +-
 include/staff/templates/org-lookup.tmpl.php  |  2 +-
 include/staff/templates/user-lookup.tmpl.php |  2 +-
 include/staff/ticket-edit.inc.php            |  2 +-
 10 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index c867531d9..a63a8cc67 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -1176,8 +1176,9 @@ class DynamicFormEntry extends VerySimpleModel {
             ->filter(array('object_id'=>$object_id, 'object_type'=>$object_type));
     }
 
-    function render($staff=true, $title=false, $options=array()) {
-        return $this->getForm()->render($staff, $title, $options);
+    function render($options=array()) {
+        $options += array('staff' => true);
+        return $this->getForm()->render($options);
     }
 
     function getChanges() {
diff --git a/include/class.forms.php b/include/class.forms.php
index 6f28d71f9..e97ea6358 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -165,14 +165,14 @@ class Form {
         $this->validators[] = $function;
     }
 
-    function render($staff=true, $title=false, $options=array()) {
-        if ($title)
-            $this->title = $title;
+    function render($options=array()) {
+        if (isset($options['title']))
+            $this->title = $options['title'];
         if (isset($options['instructions']))
             $this->instructions = $options['instructions'];
         $form = $this;
         $template = $options['template'] ?: 'dynamic-form.tmpl.php';
-        if ($staff)
+        if (isset($options['staff']) && $options['staff'])
             include(STAFFINC_DIR . 'templates/' . $template);
         else
             include(CLIENTINC_DIR . 'templates/' . $template);
@@ -4364,7 +4364,7 @@ class FileUploadWidget extends Widget {
         ),
     );
 
-    function render($options) {
+    function render($options=array()) {
         $config = $this->field->getConfiguration();
         $name = $this->field->getFormName();
         $id = substr(md5(spl_object_hash($this)), 10);
@@ -4849,7 +4849,7 @@ class AssignmentForm extends Form {
         return !$this->errors();
     }
 
-    function render($options) {
+    function render($options=array()) {
 
         switch(strtolower($options['template'])) {
         case 'simple':
@@ -5093,7 +5093,7 @@ class ReferralForm extends Form {
         return !$this->errors();
     }
 
-    function render($options) {
+    function render($options=array()) {
 
         switch(strtolower($options['template'])) {
         case 'simple':
@@ -5201,7 +5201,7 @@ class TransferForm extends Form {
         return !$this->errors();
     }
 
-    function render($options) {
+    function render($options=array()) {
 
         switch(strtolower($options['template'])) {
         case 'simple':
diff --git a/include/class.search.php b/include/class.search.php
index 6ad68f283..7d9fb691a 100644
--- a/include/class.search.php
+++ b/include/class.search.php
@@ -912,7 +912,7 @@ extends SavedSearch {
         return false;
     }
 
-    function checkAccess($staff) {
+    function checkAccess(Staff $staff) {
         return true;
     }
 
@@ -1278,7 +1278,7 @@ class TeamSelectionField extends AdvancedSearchSelectionField {
         return parent::getSearchQ($method, $value, $name);
     }
 
-    function getSortKeys() {
+    function getSortKeys($path) {
         return array('team__name');
     }
 
diff --git a/include/client/edit.inc.php b/include/client/edit.inc.php
index 6f364db39..27ae212ee 100644
--- a/include/client/edit.inc.php
+++ b/include/client/edit.inc.php
@@ -16,7 +16,7 @@ if(!defined('OSTCLIENTINC') || !$thisclient || !$ticket || !$ticket->checkUserAc
     <tbody id="dynamic-form">
     <?php if ($forms)
         foreach ($forms as $form) {
-            $form->render(false);
+            $form->render(['staff' => false]);
     } ?>
     </tbody>
 </table>
diff --git a/include/client/open.inc.php b/include/client/open.inc.php
index 4011d1403..111c34bb9 100644
--- a/include/client/open.inc.php
+++ b/include/client/open.inc.php
@@ -42,7 +42,7 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) {
         if (!$thisclient) {
             $uform = UserForm::getUserForm()->getForm($_POST);
             if ($_POST) $uform->isValid();
-            $uform->render(false);
+            $uform->render(array('staff' => false));
         }
         else { ?>
             <tr><td colspan="2"><hr /></td></tr>
diff --git a/include/client/profile.inc.php b/include/client/profile.inc.php
index 5a72f5710..c86becf95 100644
--- a/include/client/profile.inc.php
+++ b/include/client/profile.inc.php
@@ -8,7 +8,7 @@
 <table width="800" class="padded">
 <?php
 foreach ($user->getForms() as $f) {
-    $f->render(false);
+    $f->render(['staff' => false]);
 }
 if ($acct = $thisclient->getAccount()) {
     $info=$acct->getInfo();
diff --git a/include/client/register.inc.php b/include/client/register.inc.php
index 4f683c718..a08e35fc9 100644
--- a/include/client/register.inc.php
+++ b/include/client/register.inc.php
@@ -27,7 +27,7 @@ $info = Format::htmlchars(($errors && $_POST)?$_POST:$info);
 <tbody>
 <?php
     $cf = $user_form ?: UserForm::getInstance();
-    $cf->render(false, false, array('mode' => 'create'));
+    $cf->render(array('staff' => false, 'mode' => 'create'));
 ?>
 <tr>
     <td colspan="2">
diff --git a/include/staff/templates/org-lookup.tmpl.php b/include/staff/templates/org-lookup.tmpl.php
index 07d6c7687..21a3f55fc 100644
--- a/include/staff/templates/org-lookup.tmpl.php
+++ b/include/staff/templates/org-lookup.tmpl.php
@@ -70,7 +70,7 @@ if ($info['error']) {
     <table width="100%" class="fixed">
     <?php
         if (!$form) $form = OrganizationForm::getInstance();
-        $form->render(true, __('Create New Organization')); ?>
+        $form->render(array('staff' => true, 'title' => __('Create New Organization'))); ?>
     </table>
     <hr>
     <p class="full-width">
diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php
index cfeeaddf6..62547c99b 100644
--- a/include/staff/templates/user-lookup.tmpl.php
+++ b/include/staff/templates/user-lookup.tmpl.php
@@ -84,7 +84,7 @@ if ($user) { ?>
     <table width="100%" class="fixed">
     <?php
         if(!$form) $form = UserForm::getInstance();
-        $form->render(true, __('Create New User')); ?>
+        $form->render(['staff' => true, 'title' => __('Create New User')]); ?>
     </table>
     <hr>
     <p class="full-width">
diff --git a/include/staff/ticket-edit.inc.php b/include/staff/ticket-edit.inc.php
index 71d8871e6..0fc656a8a 100644
--- a/include/staff/ticket-edit.inc.php
+++ b/include/staff/ticket-edit.inc.php
@@ -154,7 +154,7 @@ if ($_POST)
 <table class="form_table dynamic-forms" width="940" border="0" cellspacing="0" cellpadding="2">
         <?php if ($forms)
             foreach ($forms as $form) {
-                $form->render(true, false, array('mode'=>'edit','width'=>160,'entry'=>$form));
+                $form->render(array('staff'=>true,'mode'=>'edit','width'=>160,'entry'=>$form));
         } ?>
 </table>
 <table class="form_table" width="940" border="0" cellspacing="0" cellpadding="2">
-- 
GitLab