// -------------------------------------------------------------------
// do diff history
- $fields = (array)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]");
- $log->add_data(false, $fields, array('bugid'), true, 'custom');
+ $fieldsnew = (array)$db->query_first("SELECT * FROM " . TABLE_PREFIX . "bugvaluefill WHERE bugid = $bug[bugid]");
+ $log->add_data(false, $fieldsnew, array('bugid'), true, 'custom');
$log->update_history();
- $notif->send_bug_changes_notice($, $bugapi->values);
+ $notif->send_bug_changes_notice($fields, $fieldsnew);
print_r($notif);
* with the differences.
*
* @access public
+ *
+ * @param array Original custom fields data
+ * @param array Modified custom fields data
*/
- function send_bug_changes_notice()
+ function send_bug_changes_notice($original, $modified)
{
if (!isset($this->modified['bugid']))
{
{
$this->notice_duplicates_change($this->original['duplicates'], $this->modified['duplicates']);
}
+
+ $dofields = array(
+ 'summary' => -1,
+ 'severity' => 'severityid',
+ 'dependency' => -1,
+ 'productid' => -1,
+ 'componentid' => -1,
+ 'versionid' => -1,
+ 'hidden' => -1,
+ 'priority' => 'priorityid'
+ );
+ foreach ($dofields AS $field => $lookup)
+ {
+ if ($this->original["$field"] != $this->modified["$field"])
+ {
+ $this->notice_other_change($field, $this->original["$field"], $this->modified["$field"]);
+ }
+ }
+
+ foreach ($modified AS $field => $value)
+ {
+ if ($field == 'bugid')
+ {
+ continue;
+ }
+ if ($original["$field"] != $modified["$field"])
+ {
+ $this->notice_other_change($field, $original["$field"], $modified["$field"]);
+ }
+ }
}
// ###################################################################
*/
function notice_duplicates_change($old, $new)
{
-
+ $userlist = $this->fetch_useres_with_on_bit('duplicates');
+ foreach ($userlist AS $userid => $user)
+ {
+ $this->notices["$user[userid]"][] = sprintf(
+$this->registry->lang->string('The duplicates list has changed from "%1$s" to %2$s".'),
+
+ $old,
+ $new
+ );
+ }
}
// ###################################################################
}
}
+ // ###################################################################
+ /**
+ * A notice for an individual field changing.
+ *
+ * @access private
+ *
+ * @param string Field name
+ * @param mixed Original value
+ * @param mixed Modified value
+ */
+ function notice_other_change($name, $old, $new)
+ {
+ $userlist = $this->fetch_users_with_on_bit('otherfield');
+ foreach ($userlist AS $userid => $user)
+ {
+ $this->notices["$user[userid]"][] = sprintf(
+$this->registry->lang->string('The %1$s field changed from "%2$s" to "%3$s".'),
+
+ $name,
+ $old,
+ $new
+ );
+ }
+ }
+
// ###################################################################
/**
* Generates an array of users who have a given email notification flag