From a1e7a58f8b9e806a9a393785eac9436fd5838475 Mon Sep 17 00:00:00 2001
From: Peter Rotich <peter@osticket.com>
Date: Thu, 27 Sep 2012 01:33:30 -0400
Subject: [PATCH] Remove unused functions - replaced by variable replacer

---
 include/class.dept.php  | 17 -----------------
 include/class.staff.php | 21 ---------------------
 include/class.team.php  | 15 ---------------
 3 files changed, 53 deletions(-)

diff --git a/include/class.dept.php b/include/class.dept.php
index f11727ba4..0eae779c9 100644
--- a/include/class.dept.php
+++ b/include/class.dept.php
@@ -281,23 +281,6 @@ class Dept {
         return $num;
     }
 
-    //Replace staff's variables
-    function replaceVariables($text, $prefix='dept') {
-
-        $manager = $this->getManager();
-
-        $prefix = rtrim($prefix, '.');
-        $search = array("/%$prefix.name/", "/%$prefix.manager/", "/%$prefix.signature/");
-        $replace = array($this->getName(),
-                         ($manager?$manager->getName():''),
-                         $this->getSignature());
-        while ($text != ($T = preg_replace($search, $replace, $text))) {
-            $text = $T;
-        }
-
-        return $text;
-    }
-
     /*----Static functions-------*/
 	function getIdByName($name) {
         $id=0;
diff --git a/include/class.staff.php b/include/class.staff.php
index e83a40307..ace8f2a0b 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -506,28 +506,7 @@ class Staff {
         return $num;
     }
 
-    //Replace staff's variables
-    function replaceVariables($text, $prefix='staff') {
-
-        $prefix = rtrim($prefix, '.');
-        $search = array("/%$prefix.username/", "/%$prefix.firstname/", "/%$prefix.lastname/", 
-                        "/%$prefix.name/", "/%$prefix.email/", "/%$prefix.signature/");
-        $replace = array($this->getUserName(),
-                         $this->getFirstName(),
-                         $this->getLastName(),
-                         $this->getName(),
-                         $this->getEmail(),
-                         $this->getSignature());
-
-        while ($text != ($T = preg_replace($search,$replace,$text))) {
-            $text = $T;
-        }
-
-        return $text;
-    }
-
     /**** Static functions ********/
-
     function getStaffMembers($availableonly=false) {
 
         $sql='SELECT s.staff_id,CONCAT_WS(", ",s.lastname, s.firstname) as name '
diff --git a/include/class.team.php b/include/class.team.php
index 7c9ac03f9..367815b96 100644
--- a/include/class.team.php
+++ b/include/class.team.php
@@ -173,21 +173,6 @@ class Team {
         return true;
     }
 
-    //Replace staff's variables
-    function replaceVariables($text, $prefix='team') {
-
-        $lead = $this->getLead();
-
-        $prefix = rtrim($prefix, '.');
-        $search = array("/%$prefix.name/", "/%$prefix.lead/");
-        $replace = array($this->getName(), ($lead?$lead->getName():''));
-        while ($text != ($T = preg_replace($search, $replace, $text))) {
-            $text = $T;
-        }
-
-        return $text;
-    }
-
     /* ----------- Static function ------------------*/
     function lookup($id) {
         return ($id && is_numeric($id) && ($team= new Team($id)) && $team->getId()==$id)?$team:null;
-- 
GitLab