Seulement dans glpi-test/glpi/backups/dump: 2004-02-04-11-21.sql
diff -r glpi-test/glpi/glpi/common/classes.php glpi/glpi/glpi/common/classes.php
276,486d275
<
< class Mailing
< {
< var $type=NULL;
< var $job=NULL;
< // User who change the status of the job
< var $user=NULL;
<
< function Mailing ($type="",$job=NULL,$user=NULL)
< {
< $this->type=$type;
< $this->job=$job;
< $this->user=$user;
< $this->test_type();
< }
< function is_valid_email($email="")
< {
< if( !eregi( "^" .
< "[a-z0-9]+([_\\.-][a-z0-9]+)*" . //user
< "@" .
< "([a-z0-9]+([\.-][a-z0-9]+)*)+" . //domain
< "\\.[a-z]{2,}" . //sld, tld
< "$", $email)
< )
< {
< //echo "Erreur: '$email' n'est pas une adresse mail valide!
";
< return false;
< }
< else return true;
< }
< function test_type()
< {
< if (!is_a($this->job,"Job"))
< $this->job=NULL;
< if (!is_a($this->user,"User"))
< $this->user=NULL;
< }
< // Return array of emails of people to send mail
< function get_users_to_send_mail()
< {
< GLOBAL $cfg_mailing;
<
< $emails=array();
< $nb=0;
< $db = new DB;
<
< if ($cfg_mailing[$this->type]["admin"]&&$this->is_valid_email($cfg_mailing["admin_email"])&&!in_array($cfg_mailing["admin_email"],$emails))
< {
< $emails[$nb]=$cfg_mailing["admin_email"];
< $nb++;
< }
<
< if ($cfg_mailing[$this->type]["all_admin"])
< {
< $query = "SELECT email FROM users WHERE (type = 'admin')";
< if ($result = $db->query($query))
< {
< while ($row = $db->fetch_row($result))
< {
< // Test du format du mail et de sa non existance dans la table
< if ($this->is_valid_email($row[0])&&!in_array($row[0],$emails))
< {
< $emails[$nb]=$row[0];
< $nb++;
< }
< }
< }
< }
<
< if ($cfg_mailing[$this->type]["all_normal"])
< {
< $query = "SELECT email FROM users WHERE (type = 'normal')";
< if ($result = $db->query($query))
< {
< while ($row = $db->fetch_row($result))
< {
< // Test du format du mail et de sa non existance dans la table
< if ($this->is_valid_email($row[0])&&!in_array($row[0],$emails))
< {
< $emails[$nb]=$row[0];
< $nb++;
< }
< }
< }
< }
<
< if ($cfg_mailing[$this->type]["attrib"]&&$this->job->assign)
< {
< $query2 = "SELECT email FROM users WHERE (name = '".$this->job->assign."')";
< if ($result2 = $db->query($query2))
< {
< if ($db->numrows($result2)==1)
< {
< $row2 = $db->fetch_row($result2);
< if ($this->is_valid_email($row2[0])&&!in_array($row2[0],$emails))
< {
< $emails[$nb]=$row2[0];
< $nb++;
< }
< }
< }
< }
<
< if ($cfg_mailing[$this->type]["user"]&&$this->job->emailupdates=="yes")
< {
< if ($this->is_valid_email($this->job->uemail)&&!in_array($this->job->uemail,$emails))
< {
< $emails[$nb]=$this->job->uemail;
< $nb++;
< }
< }
< return $emails;
< }
<
< // Format the mail body to send
< function get_mail_body()
< {
< // Create message body from Job and type
< $body="";
<
< $body.=$this->job->textDescription();
< if ($this->type!="new") $body.=$this->job->textFollowups();
<
< return $body;
< }
< // Format the mail subject to send
< function get_mail_subject()
< {
< GLOBAL $lang;
<
< // Create the message subject
< $subject="";
< switch ($this->type){
< case "new":
< $subject.=$lang["mailing"][9];
< break;
< case "attrib":
< $subject.=$lang["mailing"][12];
< break;
< case "followup":
< $subject.=$lang["mailing"][10];
< break;
< case "finish":
< $subject.=$lang["mailing"][11].$this->job->closedate;
< break;
< default :
< $subject.=$lang["mailing"][13];
< break;
< }
<
< if ($this->type!="new") $subject .= " (ref ".$this->job->ID.")";
<
< return $subject;
< }
<
< function get_reply_to_address ()
< {
< GLOBAL $cfg_mailing;
< $replyto="";
<
< switch ($this->type){
< case "new":
< if ($this->is_valid_email($this->job->uemail)) $replyto=$this->job->uemail;
< else $replyto=$cfg_mailing["admin_email"];
< break;
< case "followup":
< if ($this->is_valid_email($user->user->fields["email"])) $replyto=$this->user->fields["email"];
< else $replyto=$cfg_mailing["admin_email"];
< break;
< default :
< $replyto=$cfg_mailing["admin_email"];
< break;
< }
< return $replyto;
< }
< // Send email
< function send()
< {
< GLOBAL $cfg_features,$cfg_mailing;;
< if ($cfg_features["mailing"]&&$this->is_valid_email($cfg_mailing["admin_email"]))
< {
< $this->test_type();
< if (!is_null($this->job)&&!is_null($this->user)&&(strcmp($type,"new")||strcmp($type,"attrib")||strcmp($type,"followup")||strcmp($type,"finish")))
< {
< // get users to send mail
< $users=$this->get_users_to_send_mail();
< // get body + signature OK
< $body=ereg_replace("
","",$this->get_mail_body()."\n".$cfg_mailing["signature"]);
< // get subject OK
< $subject=$this->get_mail_subject();
< // get sender : OK
< $sender= $cfg_mailing[admin_email];
< // get reply-to address : user->email ou job_email if not set OK
< $replyto=$this->get_reply_to_address ();
< // Send all mails
< for ($i=0;$i // Address to send new posted jobs, status changes and assignments,
> // e.g. an admin-mailinglist, leave empty to disable notification.
> // Laissez ce champ vide (Non supporté par GLPI)
> $cfg_features["job_email"] = "";
>
> // Address to send new followups to, e. g. an admin mailinglist,
> // leave empty to disable notification.
> // laisser ce champs vide
> $cfg_features["newfup_email"] = "";
>
> // Send mail if a new job gets assigned to someone, notify him that
> // he has work to do. :)
> // laisser ce champs à 0 (non supporté par GLPI v0.2)
> $cfg_features["notify_assign"] = 0;
>
> // Also send mail to job_email, that the job has been assigned
> // to someone.
> // laisser ce champs a 0 (non supporté par GLPI v0.2)
> $cfg_features["notify_ass_all"] = 0;
>
> // Send mail to whom the job belongs, notify him that it has been updated.
> // laisser ce champs a 0 (non supporté par GLPI v0.2)
> $cfg_features["notify_fups"] = 0;
>
> // Send mail to the user who send the job to the tracking system through
> // the help-desk.
> // laisser ce champs a 0 (non supporté par GLPI v0.2)
> $cfg_features["notify_users"] = 0;
240a230,233
> // Signature for automatic generated E-Mails
> // laisser ce champs a "" (non supporté par GLPI v0.2)
> $cfg_layout["signature"] = "";
>
diff -r glpi-test/glpi/glpi/dicts/deutsch.php glpi/glpi/glpi/dicts/deutsch.php
498,511c498
< $lang["mailing"][0]="-----------------------";
< $lang["mailing"][1]="--------------------------------------";
< $lang["mailing"][2]="Auteur : ";
< $lang["mailing"][3]="Contenu : ";
< $lang["mailing"][4]="Intervention(s) déjà effectuée(s)";
< $lang["mailing"][5]="Description de l'intervention";
< $lang["mailing"][6]="Date de début : ";
< $lang["mailing"][7]="Ordinateur concerné : ";
< $lang["mailing"][8]="Attribué à : ";
< $lang["mailing"][9]="Nouvelle demande d'intervention";
< $lang["mailing"][10]="Nouveau suivi d'intervention";
< $lang["mailing"][11]="Intervention terminée le ";
< $lang["mailing"][12]="Attribution de l'intervention";
< $lang["mailing"][13]="Erreur dans la génération de l'email automatique";
---
>
diff -r glpi-test/glpi/glpi/dicts/english.php glpi/glpi/glpi/dicts/english.php
509,522d508
< $lang["mailing"][0]="-----------------------";
< $lang["mailing"][1]="--------------------------------------";
< $lang["mailing"][2]="Auteur : ";
< $lang["mailing"][3]="Contenu : ";
< $lang["mailing"][4]="Intervention(s) déjà effectuée(s)";
< $lang["mailing"][5]="Description de l'intervention";
< $lang["mailing"][6]="Date de début : ";
< $lang["mailing"][7]="Ordinateur concerné : ";
< $lang["mailing"][8]="Attribué à : ";
< $lang["mailing"][9]="Nouvelle demande d'intervention";
< $lang["mailing"][10]="Nouveau suivi d'intervention";
< $lang["mailing"][11]="Intervention terminée le ";
< $lang["mailing"][12]="Attribution de l'intervention";
< $lang["mailing"][13]="Erreur dans la génération de l'email automatique";
diff -r glpi-test/glpi/glpi/dicts/french.php glpi/glpi/glpi/dicts/french.php
163c163
< $lang["joblist"][5] = "Ordinateur";
---
> $lang["joblist"][5] = "Postés";
226c226
< $lang["computers"][28] = "Serveur";
---
> $lang["computers"][28] = "Host";
510,524d509
< $lang["mailing"][0]="-----------------------";
< $lang["mailing"][1]="--------------------------------------";
< $lang["mailing"][2]="Auteur : ";
< $lang["mailing"][3]="Contenu : ";
< $lang["mailing"][4]="Intervention(s) déjà effectuée(s)";
< $lang["mailing"][5]="Description de l'intervention";
< $lang["mailing"][6]="Date de début : ";
< $lang["mailing"][7]="Ordinateur concerné : ";
< $lang["mailing"][8]="Attribué à : ";
< $lang["mailing"][9]="Nouvelle demande d'intervention";
< $lang["mailing"][10]="Nouveau suivi d'intervention";
< $lang["mailing"][11]="Intervention terminée le ";
< $lang["mailing"][12]="Attribution de l'intervention";
< $lang["mailing"][13]="Erreur dans la génération de l'email automatique";
<
diff -r glpi-test/glpi/glpi/includes.php glpi/glpi/glpi/includes.php
36,42c36
< if (!eregi("http",$_SERVER["SCRIPT_URI"]))
< echo "Adresse de demande la page invalide";
<
< if (!eregi("https",$_SERVER["SCRIPT_URI"]))
< {
< echo "";
< }
---
>
diff -r glpi-test/glpi/glpi/tracking/classes.php glpi/glpi/glpi/tracking/classes.php
56c56
<
---
>
98c98
<
---
>
157c157,158
< function textFollowups() {
---
>
> function textFollowups(&$emailmessage) {
159d159
< GLOBAL $lang;
161c161
< $message = $lang["mailing"][1]."\n".$lang["mailing"][4]." (".$this->num_of_followups.")"."\n".$lang["mailing"][1]."\n";
---
> $message .= "\nFollowups:\n\n";
166,183c166,169
< $message .= "[ ".$fup->date." ]\n";
< $message .= $lang["mailing"][2].$fup->author."\n";
< $message .= $lang["mailing"][3]."\n".$fup->contents."\n".$lang["mailing"][0]."\n";
< }
< return $message;
< }
<
< function textDescription(){
< GLOBAL $lang;
<
< $message = $lang["mailing"][1]."\n".$lang["mailing"][5]."\n".$lang["mailing"][1]."\n";
< $message.= $lang["mailing"][2].$this->author."\n";
< $message.= $lang["mailing"][6].$this->date."\n";
< $message.= $lang["mailing"][7].$this->computername."\n";
< $message.= $lang["mailing"][8].$this->assign."\n";
< $message.= $lang["mailing"][3]."\n".$this->contents."\n";
< $message.="\n\n";
< return $message;
---
> $emailmessage .= "[ ".$fup->date." ]\n";
> $emailmessage .= "Author: ".$fup->author."\n";
> $emailmessage .= $fup->contents."\n\n";
> }
diff -r glpi-test/glpi/glpi/tracking/functions.php glpi/glpi/glpi/tracking/functions.php
40d39
<
414,421c413,417
<
< // Processing Email
< if ($cfg_features["mailing"])
< {
< $user=new User;
< $user->getfromDB($author);
< $mail = new Mailing("new",$job,$user);
< $mail->send();
---
>
> // Notify about new followup
> if ($cfg_features["job_email"]) {
> $signature = $cfg_layout["signature"];
> mail($cfg_features["job_email"], "glpi: New Job added by $job->author", "Tracking Job for computer $ID has been added:\n\n$contents\n\nAuthor: $author\n\n-- \n".$signature."", "From: glpi \nReply-To: ".$cfg_features["job_email"]."");
422a419
>
432d428
< GLOBAL $IRMName,$cfg_features;
436,444c432,433
< $job->updateStatus($status);
< // Processing Email
< if ($status=="old"&&$cfg_features["mailing"])
< {
< $user=new User;
< $user->getfromDB($IRMName);
< $mail = new Mailing("finish",$job,$user);
< $mail->send();
< }
---
>
> if ($job->updateStatus($status)) {
445a435,449
> // Notify about status change
> if ($cfg_features["job_email"]) {
> $emailmessage = "Job Number: $job->ID\n";
> $emailmessage .= "Status: $job->status\n";
> $emailmessage .= "Author: $job->author ($job->uemail)\n";
> $emailmessage .= "Computer: $job->computername\n";
> $emailmessage .= "Assigned to: $job->assign\n";
> $emailmessage .= "Problem Description:\n$job->contents\n";
> $emailmessage .= "Number of Followups: \n$job->num_of_followups\n";
> textFollowups($emailmessage);
> $signature = $cfg_layout["signature"];
> mail($cfg_features["job_email"], "glpi: Status changed of Job $job->ID.", $emailmessage."\n\n-- \n".$signature."", "From: glpi\n\n");
> }
>
> }
451c455
< GLOBAL $cfg_features, $cfg_layout,$IRMName;
---
> GLOBAL $cfg_features, $cfg_layout;
456c460
< $job->assignTo($user);
---
> if ($job->assignTo($user)) {
458,464c462,485
< // Processing Email
< if ($cfg_features["mailing"])
< {
< $user=new User;
< $user->getfromDB($IRMName);
< $mail = new Mailing("attrib",$job,$user);
< $mail->send();
---
> // Notify about assignment change
>
> // First, notify all that the job has been assigned, if configured to do so
> if ($cfg_features["notify_ass_all"]) {
> // Check if we have a "all"-address
> if ($cfg_features["job_email"]) {
> $signature = $cfg_layout["signature"];
> mail($cfg_features["job_email"], "glpi: Job $job->ID has been assigned to $user", "The Job with ID $job->ID has been assigned to $user by $admin.\n\n-- \n".$signature."", "From: glpi \nReply-To: ".$cfg_features["job_email"]."");
> }
> }
>
> // Next, notify the user who got the assignment if configured
> if ($cfg_features["notify_assign"]) {
> // Get his address
> $db = new DB;
> $query = "SELECT * FROM users WHERE (name = '$user')";
> if ($result = $db->query($query)) {
> $query2 = "SELECT email FROM users WHERE (name = '$job->author')";
> $result2 = $db->query($query2);
> $replyto = $db->result($result2, 0, "email");
> $email = $db->result($result, 0, "email");
> $signature = $cfg_layout["signature"];
> mail($email, "glpi: Job $job->ID has been assigned to you", "Tracking Job for computer $job->computer has been assigned to you by $admin:\n\n$job->contents\n\nAuthor: $job->author\n\n-- \n".$signature."", "From: glpi \nReply-To: $replyto");
> }
465a487
> }
525,533c547,583
< // Processing Email
< if ($cfg_features["mailing"])
< {
< $job= new Job;
< $job->getfromDB($ID,0);
< $user=new User;
< $user->getfromDB($author);
< $mail = new Mailing("followup",$job,$user);
< $mail->send();
---
>
> // Notify about new followup
> if ($cfg_features["newfup_email"]) {
> $signature = $cfg_layout["signature"];
> mail($cfg_features["newfup_email"], "glpi: New followup to Job $ID.", "Tracking Job $ID had this followup added:\n\n$contents\n\nAuthor: $author\n\n-- \n".$signature."", "From: glpi \nReply-To: ".$cfg_features["newfup_email"]."");
> }
>
> // Notify the Job owner, that his job has been updated
> if ($cfg_features["notify_fups"]) {
>
> $db = new DB;
> $query = "SELECT * FROM tracking WHERE (ID = $ID)";
> $result = $db->query("$query");
> $owner = $db->result($result, 0, "assign");
>
> if ($author!=$owner && $owner!="") {
> $signature = $cfg_layout["signature"];
> $query = "SELECT * FROM users WHERE (name = '$owner')";
> $result = $db->query("$query");
> $email = $db->result($result, 0, "email");
> mail("$email", "glpi: New followup to Job $ID.", "Tracking Job $ID had this followup added:\n\n$contents\n\nAuthor: $author\n\n-- \n".$signature."", "From: glpi \nReply-To: ".$cfg_features["newfup_email"]."");
> }
> }
>
> // Notify the user who posted the Job, that it has been updated
> if($cfg_features["notify_users"]) {
> $signature = $cfg_layout["signature"];
> $query = "SELECT * FROM tracking WHERE (ID = $ID)";
> $result = $db->query("$query");
> $emailupdates = $db->result($result, 0, "emailupdates");
> $uemail = $db->result($result, 0, "uemail");
> $query2 = "SELECT email FROM users WHERE (name = '$author')";
> $result2 = $db->query($query2);
> $replyto = $db->result($result2, 0, "email");
> if($emailupdates && $uemail) {
> mail("$uemail", "glpi: Your problem $ID has been updated", "Tracking Job $ID had this followup added:\n\n$contents\n\nAuthor: $author\n\n-- \n".$signature."", "From: glpi \nReply-To: $replyto");
> }
534a585
>
diff -r glpi-test/glpi/login.php glpi/glpi/login.php
164a165
>
166c167
< if ($identificat->user->fields['type'] == "post-only")
---
> if ($identificat->user->field['type'] == "post-only")
diff -r glpi-test/glpi/tracking/tracking-assign-form.php glpi/glpi/tracking/tracking-assign-form.php
42d41
< include ($phproot . "/glpi/includes_setup.php");
diff -r glpi-test/glpi/tracking/tracking-followups.php glpi/glpi/tracking/tracking-followups.php
42d41
< include ($phproot . "/glpi/includes_setup.php");
diff -r glpi-test/glpi/tracking/tracking-injector.php glpi/glpi/tracking/tracking-injector.php
42d41
< include ($phproot . "/glpi/includes_setup.php");
diff -r glpi-test/glpi/tracking/tracking-mark.php glpi/glpi/tracking/tracking-mark.php
42d41
< include ($phproot . "/glpi/includes_setup.php");
47c46
< $status = "old";
---
> $status = "OLD";
51a51,55
> // Notify about marking
> if ($cfg_features["job_email"]) {
> $signature = $cfg_layout["signature"];
> mail($cfg_features["job_email"], "glpi: Job $ID has been marked old", "Tracking Job $ID has been closed and marked old by $IRMName.\n\n-- \n".$signature."", "From: glpi \nReply-To: ".$cfg_features["job_email"]."");
> }