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; }
function getItemDesc(){ global $DB; $sql = "SELECT * FROM leads WHERE id = ".$_REQUEST['id']; $res = $DB->queryUniqueObject($sql); $ret = "Prospect info:\n\n"; $ret .= 'jobname: '.stripslashes($res->jobname)."\n"; $ret .= 'company: '.stripslashes($res->company)."\n"; $ret .= 'customer name: '.stripslashes($res->customer)."\n"; $ret .= 'target close date: '.dateFix($res->targetdate)."\n"; $ret .= 'date closed: '.dateFix($res->dateclosed)."\n"; $ret .= 'joan lead: '.$res->joanlead."\n"; $ret .= 'rep: '.getRepInfo('CONCAT(firstname, \' \', lastname)', $res->rep).'('.getRepInfo('email', $res->rep).')'."\n"; $ret .= 'estimated $: $'.round($res->estimated, 2)."\n"; return $ret; }
function getCorrAsJSON(){ global $DB; global $fp; // mark as read $DB->query("UPDATE corr SET hasbeenread = 1 WHERE torepid = ".$fp['loggedid']." AND fromrepid = ".$fp['torepid']." AND leadid=".$fp['leadid']); $ret = '{corr:['; $sql = "SELECT *, DATE(postdate) as postdate, DATE_FORMAT(postdate, '%l:%i %p') as posttime FROM corr WHERE leadid=".$fp['leadid']." AND (fromrepid = ".$fp['loggedid']." OR torepid = ".$fp['loggedid'].") AND (fromrepid = ".$fp['torepid']." OR torepid = ".$fp['torepid'].") ORDER BY DATE(postdate) DESC, TIME(postdate) DESC"; $res = $DB->query($sql); $e = mysql_error(); $retarr = array(); if(mysql_num_rows($res)){ while($r = $DB->fetchNextObject($res)){ $date = ($r->postdate == date('Y-m-d'))?'':dateFix($r->postdate); $class = ($r->fromrepid == $_SESSION['loggedin'])?"loggedinposts":""; $tofrom = getCopied($r->cccorrid, $r->id); $ccd = (count($tofrom['cc']))?", ".implode(", ",$tofrom['cc']):''; $retarr []= '{"id":"'.$r->id.'", "addclass":"'.$class.'", "message":"'.$r->message.'", "postdate":"'.$date.'", "posttime":"'.$r->posttime.'", "whotowho":"'.who($r->fromrepid).' said to '.$tofrom['to'].$ccd.'", "e":"'.$e.'" }'; } }else{ /**/ $retarr []= '{"id":"0", "addclass":"nomessages", "message":"no messages", "postdate":"", "posttime":"", "whotowho":"", "e":"" }'; } $ret .= implode(",",$retarr); $ret .= ']}'; print $ret; }
<input name="targetdate" id="targetdate" type="text" class="input" readonly="readonly" value="<?php print dateFix(getVal('targetdate'));?>" /> </label> </td> <td valign="top"> <label > rep<br /> <?php print getRepsDrop(); ?> </label> <td rowspan="2" valign="top"> <div class="hidestatusoption" id="option_closed"> <label >closed date<br /> <input name="dateclosed" id="dateclosed" type="text" class="input" readonly="readonly" value="<?php print dateFix(getVal('dateclosed'));?>" /> </label> </div> <div class="hidestatusoption" id="option_pending"> <label class="reasonholder">reason for pending status<br /> </label> </div> <div class="hidestatusoption" id="option_lost"> <label class="reasonholder">reason for lost status<br /> </label> </div>
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; }
AbstractDb::getObject(); //This is here so we get reliable SQL vs PHP profiling require_once 'classes/Locale.php'; require_once 'classes/Dependency.php'; if (EVENT_LOGGING == true) { require_once 'classes/EventLogging.php'; EventLogging::SetupErrorHandling("strict~/var:\\sDeprecated/(off)", array('print' => new PrintChannel(new HTMLFormatter(), 'warning,notice', null, true), 'debug' => new PrintChannel(new HTMLCommentsFormatter(), '=debug', null, false))); } /** * Filter super globals */ undo_magic_quotes(); /** * Set default timezone */ dateFix(); /** * Set the URL paths, but only if we are NOT called from the command line */ if (defined('SYSTEM_PATH')) { require_once 'path_defines_url_content.php'; } /* Constant shared with the gateway * NEVER edit these, as they mush match the C code of the gateway */ define('ACCOUNT_STATUS_ERROR', -1); define('ACCOUNT_STATUS_DENIED', 0); define('ACCOUNT_STATUS_ALLOWED', 1); define('ACCOUNT_STATUS_VALIDATION', 5); define('ACCOUNT_STATUS_VALIDATION_FAILED', 6); define('ACCOUNT_STATUS_LOCKED', 254); $account_status_to_text[ACCOUNT_STATUS_ERROR] = "Error";