function getCopied($cccorrid, $corrid){
	global $DB;
	global $fp;
	
	if($cccorrid > 0){
		
		$sql = "SELECT torepid FROM corr 
						WHERE cccorrid = ".$cccorrid;
		$sqlto = "SELECT torepid FROM corr WHERE id = ".$cccorrid;
		
	}else{
		$sql = "SELECT torepid FROM corr 
						WHERE cccorrid = ".$corrid; 
		$sqlto = "SELECT torepid FROM corr WHERE id = ".$corrid;
	}
	
	$res = $DB->query($sql);
	$resto = $DB->queryUniqueValue($sqlto);
	$ret['to'] = getRep($resto, true);
	
	while($r = $DB->fetchNextObject($res)){
		$ret['cc'][]= "CC ".getRep($r->torepid, true);
	}
	
	if(count($ret['cc']) > 0){
		asort($ret['cc']);
	}
	return $ret;
}
function getLeadInfo(){
	
	global $DB;
	
	// mark as read
	$r = $DB->queryUniqueObject("SELECT * FROM leads WHERE id = ".$_REQUEST['leadid']);
	$ret = '{			 
								"jobname":"'.$r->jobname.'",
								"company":"'.$r->company.'",
								"customer":"'.$r->customer.'",
								"repid":"'.$r->rep.'",
								"rep":"'.getRep($r->rep).'",
								"created by":"'.getRep($r->createdby_repid).'",
								"est. $":"$'.$r->estimated.'",
								"joanlead":"'.$r->joanload.'",
								"comments":"'.nonl($r->comments).'",
								"targetdate":"'.dateFix($r->targetdate).'",
								"dateclosed":"'.dateFix($r->dateclosed).'",
								"status":"'.$r->status.'",
								"reason":"'.nonl($r->reason).'",
								"reason given by":"'.getRep($r->reason_repid).'",
								"createdon":"'.dateFix($r->createdon).'",
								"lastupdated":"'.dateFix($r->lastupdated).'",
								"last updated by":"'.getRep($r->lastupdatedby_repid).'",
								"quotefilestr":"'.checkQuoteFile($r->quotefile).'",
								"quotefile":"'.checkQuoteFile($r->quotefile, true).'",
								"id":"'.$r->id.'"
					}';
									 
	
	print $ret;
}
Exemple #3
0
function who($repid){
	if($repid == $_SESSION['loggedin']){
		return "You";
	}else{
		return getRep($repid, true);
	}
}
function sendEmails($torepid, $cccorrid){

	global $mail;	
	global $version;
	
	$server = ($_SERVER['REMOTE_ADDR'] == '::1')
							?'http://localhost/riot/jobtracker/'
							:'http://rcone.net46.net/riot/jobtracker/'; 
	
	$body = '<body topmargin="5%">';
	
	$body .= '<table width="440" align="center" cellpadding="14" cellspacing="0">';
	$body .= '<tr><td align="left">';
	$body .= '<font color="#ef3f24" size="5" face="Arial, Helvetica, sans-serif">
						<b>'.$version['name'].'</b>
						</font>';
	$body .= '</td></tr>';
	$body .= '</table>';	
	
	$body .= '<table width="440" align="center" cellpadding="14" cellspacing="0"">';
	$body .= '<tr><td align="left" style="border: 4px solid #f1f1f1;">';
	$body .= '<font color="#80c779" size="3" face="Arial, Helvetica, sans-serif">
						<b>You have a new message from 
						'.getRep($_SESSION['loggedin'], true).'</b><br /> 
						</font>
						<font color="#000000" size="3" face="Arial, Helvetica, sans-serif">
						<br />"'.stripslashes(getCorrField('message', $cccorrid)).'"
						</font>
						<font color="#000000" size="2" face="Arial, Helvetica, sans-serif">
						<br /><br />
						Click the link below to view and respond to your message from 
						'.getRep($_SESSION['loggedin'], true).'. 
						All correspondance reguarding this job should take place within the '.$version['name'].'</font>';
	$body .= '<br /><br /><br />';
	$body .= '<font face="Arial, Helvetica, sans-serif" size="1">';
	$body .= '<a href="'.$server.'index.php
						?bypassid='.$torepid.'
						&leadid='.$_REQUEST['leadid'].'
						&repcorr='.$_SESSION['loggedin'].'
						&remoteentry=1" style="color: #FFFFFF; 
																	 background-color: #ef3f24; 
																	 padding:10px 30px; 
																	 text-decoration: none">Click here to respond</a>';
	$body .= '</font>';
	$body .= '<br /><br />';
	$body .= '</td></tr>';
	$body .= '<tr><td>';
	$body .= '<font size="1" color="#dedede"  face="Arial, Helvetica, sans-serif">
						NOTICE: This e-mail and any attachment contain confidential information that may be legally privileged. If you are not the intended recipient, you must not review, retransmit, print, copy use or disseminate it. Please immediately notify us by return e-mail and delete it. Riot Creative Imaging is a division of ARC
						</font>';
	$body .= '</td></tr>';
	$body .= '</table>';
	$body .= '</body>';
	
	$mail->Body = $body;
	

	attachQuoteFile();
	
	//debug
	//$mail->AddAddress("*****@*****.**","Robert Cox");	
	$mail->AddAddress(getRepField($torepid, "email"),getRep($torepid));
	
	if(!$mail->Send()){
		print '0:Could not send email to '.$torepid;
	}else{
		print '1:Email sent to '.getRep($torepid, true).' ('.getRepField($torepid, "email").')';
	}
	
	$mail->ClearAddresses();
}
Exemple #5
0
            $xmlRoot->appendChild(checkForUserVote($dbconn, $xmlDoc, $_REQUEST['post_id'], $_REQUEST['user_id']));
            break;
        case "addComment":
            $xmlRoot->appendChild(addComment($dbconn, $xmlDoc, $_REQUEST['user_id'], $_REQUEST['post_id'], $_REQUEST['comment']));
            break;
        case "getComments":
            $xmlRoot->appendChild(getComments($dbconn, $xmlDoc, $_REQUEST['post_id']));
            break;
        case "addNewUser":
            $xmlRoot->appendChild(addNewUser($dbconn, $xmlDoc, $_REQUEST['username'], $_REQUEST['password']));
            break;
        case "signIn":
            $xmlRoot->appendChild(signIn($dbconn, $xmlDoc, $_REQUEST['username'], $_REQUEST['password']));
            break;
        case "getRep":
            $xmlRoot->appendChild(getRep($dbconn, $xmlDoc, $_REQUEST['username']));
            break;
        default:
            break;
    }
}
function sendxhtmlheader($usexml)
{
    if ($usexml == 1) {
        //header("Content-Type: application/xhtml+xml; charset=utf-8");
        header("Content-type: text/xml; charset=utf-8");
    } else {
        header("Content-type: text/html; charset=utf-8");
    }
}
function sendpage($page, $usexml)
Exemple #6
0
function getTbody(){

global $DB;
global $numCols;
global $rightsfilter;

$where = (strlen(getCriteria()))
					?getCriteria()
					:' status = "pending" ';

$where .= ' AND '.$rightsfilter;			

$sql = "SELECT *, 
				CONCAT('$',estimated) as estimated
				FROM leads WHERE ".$where." 
				ORDER BY company, customer";

//print $sql;

$res = $DB->query($sql); 	
$ret = '<tbody id="mtb">'."\n";

while($r = $DB->fetchNextObject($res)){
	
	$ret .= "\t";
	$ret .= '<tr id="row'.$r->id.'">';

	$ret .= '<td align="center">';
	$ret .= stripslashes(ws($r->id));
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= stripslashes(ws($r->jobname));
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= stripslashes(ws($r->company));
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= stripslashes(ws($r->customer));
	$ret .= '</td>';
	
	$ret .= '<td>';
	$ret .= ws(dateFix($r->targetdate));
	$ret .= '</td>';

	
	// the date closed field
	if($r->status == 'closed'){
		
		$statushtml = dateFix($r->dateclosed);
		$hideclass = 'class="hideclosed"';
	
	}else{
		
		if(strlen($r->reason) > 0){
			
			$repreason = ($r->reason_repid)
			?'<i><small><br /><br />-'.getRep($r->reason_repid).'-</small></i>'
			:'';
			
			$reason = $r->reason."\n\n";
			$statushtml = '<a href="#" rel="'.$reason.'" class="moreinfo" title="'.$reason.$repreason.'">'.$r->status.'</a>';
		
		}else{
			$statushtml = $r->status;
		}
		$hideclass = '';
	}


	$ret .= '<td '.$hideclass.'>';
	$ret .= ws($statushtml);
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= ws(dateFix($r->createdon));
	$ret .= '</td>';

	$ret .= '<td align="center">';
	$ret .= ws(getRepField($r->quotedby_repid, 'LOWER(CONCAT(SUBSTRING(firstname, 1, 1),
																							SUBSTRING(lastname, 1, 1)))'));
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= ($r->rep == 0)?'n/a':getRep($r->rep);
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= $r->estimated;
	$ret .= '</td>';

	$ret .= '<td>';
	$ret .= (strlen($r->quotefile) > 0)
			?'<a href="_lib/php/forcedownload.php?filename='.stripslashes($r->quotefile).'">
			  <img src="images/quote_icon.png" width="16" height="16" border="0" title="view attachment" />
			  </a>'
			:ws('');
			
	$ret .= '</td>';

	$ret .= '<td id="'.$r->id.'" class="actionbt">action';
	$ret .= '<input id="comments_'.$r->id.'" type="hidden" value="'.$r->comments.'" />'; // get the comments
	
	// get the project info
	$info = '';
	$info .= 'created by: '.getRep($r->createdby_repid)."\n";
	$info .= 'created on: '.dateFix($r->createdon)."\n\n";
	$info .= 'last updated by: '.getRep($r->lastupdatedby_repid)."\n";
	$info .= 'last updated on: '.dateFix($r->lastupdated)."\n\n";
	
	$ret .= '<input id="info_'.$r->id.'" type="hidden" value="'.$info.'" />'; // get the prospect info		 
	$ret .=	'</td>';
	$ret .= '</tr>'."\n";

}
	
	// show a row with no results
	if(($DB->numRows($res) < 1)){
		$ret .= '<tr id="nores">';
		$ret.='<td colspan="'.$numCols.'" >No results found</td>';	
		$ret .='</tr>';
	}

	$ret .= '</tbody>';
	return $ret;
}