Changeset 704 for trunk/phpbms/modules/bms/clients_email.php
- Timestamp:
- 01/01/10 23:10:02 (2 years ago)
- Files:
-
- 1 modified
-
trunk/phpbms/modules/bms/clients_email.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpbms/modules/bms/clients_email.php
r702 r704 1 <?php 1 <?php 2 2 /* 3 3 $Rev$ | $LastChangedBy$ … … 41 41 42 42 include("./include/clients_email_include.php"); 43 44 43 44 45 45 $thecommand="showoptions"; 46 46 if(isset($_POST["command"])) $thecommand=$_POST["command"]; 47 47 48 48 switch($thecommand){ 49 49 case "send email": … … 54 54 foreach($_SESSION["emailids"] as $id) 55 55 $whereclause.="clients.id=".$id." or "; 56 $whereclause=substr($whereclause,0,strlen($whereclause)-3); 56 $whereclause=substr($whereclause,0,strlen($whereclause)-3); 57 57 break; 58 58 case "savedsearch": … … 64 64 case "all": 65 65 $whereclause=""; 66 break; 66 break; 67 67 }//end switch 68 68 //next the from: 69 $_SESSION["massemail"]["from"]=str_replace("]",">",str_replace("[","<",$_POST["ds-email"])); 69 $_SESSION["massemail"]["from"]=str_replace("]",">",str_replace("[","<",$_POST["ds-email"])); 70 70 $_SESSION["massemail"]["whereclause"]=$whereclause; 71 71 $_SESSION["massemail"]["subject"]=$_POST["subject"]; 72 72 $_SESSION["massemail"]["body"]=$_POST["body"]; 73 73 $_SESSION["massemail"]["savedproject"]=$_POST["pid"]; 74 74 75 75 $querystatement="SELECT id,email, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) AS name FROM clients ".$whereclause; 76 76 $sendqueryresult=$db->query($querystatement); 77 77 if(!$sendqueryresult) $error = new appError(300,"Error with: ".$querystatement); 78 78 79 79 break; 80 80 case "delete project": … … 100 100 $thecommand="showoptions"; 101 101 break; 102 102 103 103 case "done": 104 104 case "cancel": 105 105 goURL(APP_PATH."search.php?id=2"); 106 106 107 107 break; 108 108 } 109 110 109 110 111 111 $pageTitle="Client/Prospect E-Mail"; 112 112 113 113 $phpbms->cssIncludes[] = "pages/clientemail.css"; 114 114 $phpbms->jsIncludes[] = "modules/bms/javascript/clientemail.js"; … … 117 117 //============================================================== 118 118 $theform = new phpbmsForm(); 119 119 120 120 if(is_numeric($therecord["emailfrom"])) 121 121 $theid=$therecord["emailfrom"]; 122 122 else 123 123 $theid=0; 124 124 125 125 $theinput = new inputSmartSearch($db, "email", "Pick Active User Email", $theid, "from"); 126 126 $theform->addField($theinput); 127 127 128 128 $theform->jsMerge(); 129 129 //============================================================== 130 130 //End Form Elements 131 131 132 132 if($therecord["emailto"]!="selected" AND $therecord["emailto"]!="all") 133 133 $phpbms->bottomJS[] ='thediv=getObjectFromID("showsavedsearches");thediv.style.display="block"'; … … 135 135 if(!is_numeric($therecord["emailfrom"])) 136 136 $phpbms->bottomJS[] ='thefield=getObjectFromID("ds-email");thefield.value="'.$therecord["emailfrom"].'"'; 137 137 138 138 if($thecommand=="send email"){ 139 140 $phpbms->topJS[]=' 141 ids=new Array(); 139 140 $phpbms->topJS[]=' 141 ids=new Array(); 142 142 emails=new Array(); 143 143 names= new Array();'; 144 144 145 145 while($therecord = $db->fetchArray($sendqueryresult)){ 146 146 $phpbms->topJS[]="ids[ids.length]=".$therecord["id"].";"; 147 147 $phpbms->topJS[]="names[names.length]=\"".$therecord["name"]."\";"; 148 148 $phpbms->topJS[]="emails[emails.length]=\"".$therecord["email"]."\";"; 149 } 149 } 150 150 }//end if 151 151 152 152 include("header.php") 153 153 … … 156 156 <div class="bodyline" id="mainBG"> 157 157 <h1 id="topTitle"><span><?php echo $pageTitle?></span></h1> 158 159 <form action="<?php echo $_SERVER["PHP_SELF"]?>" method="post" name="theform" id="theform">158 159 <form action="<?php echo htmlentities($_SERVER["PHP_SELF"]) ?>" method="post" name="theform" id="theform"> 160 160 <?php if($thecommand=="showoptions") { ?> 161 161 162 162 <input type="hidden" name="pid" id="pid" value="<?php echo $therecord["id"]?>" /> 163 163 <div class="box"> 164 164 165 165 <p id="toP"> 166 <label for="therecords">to</label><br /> 166 <label for="therecords">to</label><br /> 167 167 <select id="therecords" name="therecords" onchange="showSavedSearches(this);"> 168 168 <option value="selected" <?php if ($therecord["emailto"]=="selected") echo "selected=\"selected\""?>>e-mail addresses from selected records (<?php echo count($_SESSION["emailids"]) ?> record<?php if(count($_SESSION["emailids"])>1) echo "s"?>)</option> 169 169 <option value="savedsearch" <?php if ($therecord["emailto"]!="selected" AND $therecord["emailto"]!="all") echo "selected=\"selected\""?>>e-mail addresses from saved search...</option> 170 </select> 170 </select> 171 171 </p> 172 172 <p id="showsavedsearches" > 173 173 <label for="savedsearches">load e-mail addresses from saved search...</label><br /> 174 <?php showSavedSearches($db,$therecord["emailto"]); ?> 175 </p> 176 174 <?php showSavedSearches($db,$therecord["emailto"]); ?> 175 </p> 176 177 177 <div class="fauxP" id="fromDiv"><?php $theform->showField("email")?></div> 178 178 179 179 <p> 180 180 <label for="subject">subject</label><br /> 181 <input type="text" name="subject" id="subject" maxlength="128" value="<?php echo htmlQuotes($therecord["subject"])?>"/> 182 </p> 183 </div> 184 181 <input type="text" name="subject" id="subject" maxlength="128" value="<?php echo htmlQuotes($therecord["subject"])?>"/> 182 </p> 183 </div> 184 185 185 <div class="box"> 186 186 <p> … … 194 194 </p> 195 195 </div> 196 196 197 197 <div class="box"> 198 198 <div id="projectButtons"> … … 205 205 <input type="submit" name="command" id="sendemail" value="send email" class="Buttons" /> 206 206 <input type="submit" name="command" id="cancel" value="cancel" class="Buttons" /> 207 <input type="submit" name="command" id="othercommand" value="" class="Buttons" /> 208 </div> 209 </div> 210 207 <input type="submit" name="command" id="othercommand" value="" class="Buttons" /> 208 </div> 209 </div> 210 211 211 <div id="loadedprojects"> 212 212 <p><?php showSavedProjects($db)?></p> … … 218 218 </div> 219 219 <?php } elseif($thecommand=="send email"){?> 220 220 221 221 <div id="processingWrap"> 222 222 <div class="box">