From 76f3bf900706fedea75f59ede8494822c6f498a4 Mon Sep 17 00:00:00 2001
From: Trey <treydock@tamu.edu>
Date: Tue, 26 Jul 2011 18:20:51 -0500
Subject: [PATCH] - Allow anonymous followups to go to same ticket
 - Requires this command to be run on database,
 ALTER TABLE  `glpi_configs` ADD  `use_anonymous_followups` TINYINT( 1 ) NOT NULL DEFAULT  '0' AFTER  `use_anonymous_helpdesk` ;

---
 inc/config.class.php        |    6 ++++++
 inc/mailcollector.class.php |    8 +++++---
 locales/en_GB.php           |    1 +
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/inc/config.class.php b/inc/config.class.php
index 296edf0..612f95c 100644
--- a/inc/config.class.php
+++ b/inc/config.class.php
@@ -564,6 +564,12 @@ class Config extends CommonDBTM {
       echo "</td><td>" . $LANG['setup'][219] . "&nbsp;:</td><td>";
       Dropdown::showYesNo("use_anonymous_helpdesk", $CFG_GLPI["use_anonymous_helpdesk"]);
       echo "</td></tr>";
+
+      echo "<tr class='tab_bg_2'>";
+      echo "<td></td><td>";
+      echo "</td><td>" . $LANG['setup'][220] . "&nbsp;:</td><td>";
+      Dropdown::showYesNo("use_anonymous_followups", $CFG_GLPI["use_anonymous_followups"]);
+      echo "</td></tr>";
       echo "</table><br>";
 
       echo "<table class='tab_cadre_fixe'>";
diff --git a/inc/mailcollector.class.php b/inc/mailcollector.class.php
index 041f565..e0a2ebf 100644
--- a/inc/mailcollector.class.php
+++ b/inc/mailcollector.class.php
@@ -496,6 +496,7 @@ class MailCollector  extends CommonDBTM {
     * @return ticket fields array
     */
    function buildTicket($i,$options=array()) {
+		global $CFG_GLPI;
 
       $play_rules = (isset($options['play_rules']) && $options['play_rules']);
 
@@ -604,8 +605,9 @@ class MailCollector  extends CommonDBTM {
          /// TODO check if users_id have right to add a followup to the ticket
          if ($job->getFromDB($tkt['tickets_id'])
              && $job->fields['status'] != 'closed'
-             && ($tkt['_users_id_requester'] > 0 || !strcasecmp($job->fields['user_email'],
-                                                                $head['from']))) {
+             && ($CFG_GLPI['use_anonymous_followups'] == 1
+			|| $tkt['_users_id_requester'] > 0 
+			|| !strcasecmp($job->fields['user_email'],$head['from']))) {
 
             $content        = explode("\n", $tkt['content']);
             $tkt['content'] = "";
@@ -1341,4 +1343,4 @@ class MailCollector  extends CommonDBTM {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/locales/en_GB.php b/locales/en_GB.php
index 71249f1..69dfd89 100644
--- a/locales/en_GB.php
+++ b/locales/en_GB.php
@@ -1801,6 +1801,7 @@ $LANG['setup'][209]="Response name (if necessary)";
 $LANG['setup'][217]="The PHP mail function is unknown or is not activated on your system"; 
 $LANG['setup'][218]="The use of a SMTP is needed"; 
 $LANG['setup'][219]="Allow anonymous ticket creation (helpdesk.receiver)"; 
+$LANG['setup'][220]="Allow anonymous ticket follow-ups"; 
 $LANG['setup'][221]="Beginning of fiscal year"; 
 $LANG['setup'][223]="Limit of the schedules for planning"; 
 $LANG['setup'][227]="URL of the application"; 
-- 
1.7.4.1

