+
+ function new_notification($objectid, $issue, $remark)
+ {
+ $notif_id = 0;
+
+ // Find the id of the issue
+
+ $qry = "SELECT type_of_issueid, suggested_priority
+ FROM type_of_issue WHERE name='$issue'";
+
+ $this->query($qry);
+ if ($this->num_rows() == 1)
+ {
+ $issueid = $this->Field($this->Result(), 0, 'type_of_issueid');
+ $insertion = "insert into notification (objectid, type_of_issueid, timestamp, ";
+ $insertion .= " statuscode, priority) values ('";
+ $insertion .= $objectid . "', '";
+ $insertion .= $issueid . "', '" . date('Y-m-d H:i:s') . "', 'new', '";
+ $insertion .= $this->Field($this->Result(), 0, "suggested_priority") . "')";
+
+ $this->query($insertion);
+
+ $this->query("select currval('notification_notificationid_seq')");
+
+ if ($this->num_rows() == 1)
+ {
+ $notif_id = $this->Field($this->Result(), 0, "currval");
+ $insertion = "insert into action_user (actionid, username, notificationid,";
+ $insertion .= " timestamp, statuscode, remarks) values ('1', 'gnucomo', '";
+ $insertion .= $notif_id . "', '" . date('Y-m-d H:i:s') . "', 'new', '";
+ $insertion .= $remark . "')";
+
+ $this->query($insertion);
+ }
+ else
+ {
+ echo "Error inserting notification.\n";
+ }
+ }
+ else
+ {
+ echo "DATABASE ERROR: Type of issue '$issue' not found.\n";
+ }
+ return $notif_id;