function MovePlayer($PID, $RID) { $LID = getlocation($PID); $LID2 = getDestination($LID, $RID); setPlayerLoc($PID, $LID2); $name = getLocationName($LID2); AddtoLog($PID, "You traveled to {$name}!", 0, 1); }
function hotLink( $type, $id, $displayvalue='', $useimage=false, $functioncall='', $placement='reg_body', $showinvtype=false ) { global $db; global $lang; global $domain; global $usetemplate; global $RootPath; global $language; global $masterdatabase; //global $modeldatabase; global $UserID; include_once($RootPath."/language/".$language."/includes/general_functions.inc"); if ( $id == '' || $id == 0 ) return ''; $authorized = false; //set some var's based on $type switch( $type ) { //Invoice (lightbox) //08.23.2012 jss - ( 23166 ) changed case 1 to bring the invoice up in a lightbox. The old //case 1 is now case 9 and it takes you to the invoice section and pulls it up. case 1: if ( isAuth( 1,81,232,211 ) ) $authorized = true; $useimage = true; $displayvaluequery = 'select CustomInvoiceNumber as DisplayValue from invInvoice where InvoiceID = ' . $id; //TKS 11.13.2013 #43002 got rid of globalInvoiceID being set when loading in overlay //01.20.2014 naj - changed get_mv_view_invoice to get_mv_viewinvoice, since we have moved to //the new invoice format. $myfunctioncall .= ' get_menu_includes( 231,81 ); get_menu_includes( 628,98 ); get_menu_includes( 636,98 ); globalOverlayInvoiceID=' . $id . '; globalOverlayContactID = document.getElementById( \'global_contactid\' ).value; var tempmaster = readCookie( \'ssi_menumaster\' ); var tempmenu = readCookie( \'ssi_menuid\' ); createCookie( \'ssi_menuid\', tempmenu ); createCookie( \'ssi_menumaster\', tempmaster ); get_mv_viewinvoice( \'overlay2\' );'; //$title = $lang[ 'ViewInvoice' ]; $title = $lang[ 'hpl_ViewInvoice' ]; //04.25.2013 jss - for me, get the invoice location and add it to the image title if ( compareSecurityLevel($UserID) == 1 ) { include_once( "$RootPath/invoicing/general_invoice_functions.php" ); $invoicelocation = " (" . getLocationName(getInvoiceLocation($id)) . ")"; $title .= $invoicelocation; //05.21.2013 jss - add customer name to hint for compare user $query3 = "select ContactID from invInvoice where InvoiceID = $id"; if ( !$result3 = $db->sql_query( $query3 ) ) { LogError( 000, $query3 ."<br>".$db->sql_error() ); return false; } $row3 = $db->sql_fetchrow( $result3 ); ////08.16.2013 ghh - added var so we only call once $rn = contactRealName( $row3[ 'ContactID' ] ); $title .= ' - ' . $rn; $invoicelocation .= ' - ' . $rn; } $myfunctioncall2 .= 'globalInvoiceID=' . $id . '; get_menu_getpage( \'' . $placement . '\', 232, 81 );'; break; //PO case 2: if ( isAuth( 3,50,292,273 ) ) $authorized = true; //12.14.2012 jss - ( 27855 ) changed to run the query here instead so we can add the //consignment flag if needed //$displayvaluequery = 'select PONumber as DisplayValue from actPO where POID = ' . $id; $query = "select PONumber, ConsignmentPartsPO, LocationID from actPO where POID = $id"; if ( !$result = $db->sql_query( $query ) ) { LogError( 000, $query ."<br>".$db->sql_error() ); return false; } $row = $db->sql_fetchrow( $result ); $displayvalue = $row[PONumber]; if ( $row[ConsignmentPartsPO] ) $displayvalue .= "(C)"; $myfunctioncall .= "globalPOID=$id;"; //12.07.2011 jss - changed to take you to the accounting module first cuz the bin controls look at cookies to see what module you're in //and act accordingly when selecting a bin. Calling a po from the inventory section was causing the wrong "select" links to appear on it. //$myfunctioncall .= 'document.getElementById( \'header2\' ).innerHTML = \'Accounting\'; get_menu_master( \'reg_left1\', 3 );'; //06.04.2012 jss - no longer needed as tim and i have re-written the header //$myfunctioncall .= "document.getElementById( 'header2' ).innerHTML = '" . $lang[ 'accounting' ] . "';"; $myfunctioncall .= "get_menu_master( 'reg_left1', 3 );"; $myfunctioncall .= "try { get_menu_main( 'mnu_Payables', 50 ); } catch(err) {}"; $myfunctioncall .= "get_menu_getpage( '$placement', 292, 50 );"; $title = $lang[ 'hpl_ViewPO' ]; //04.25.2013 jss - for me, get the invoice location and add it to the image title if ( compareSecurityLevel($UserID) == 1 ) { $title .= " ( " . getLocationName($row['LocationID']) . " )"; } break; //Unit (vin) case 3: if ( isAuth( 16, 65, 181, 160 ) ) $authorized = true; $displayvaluequery = 'select VIN as DisplayValue from untUnitInfo where UnitID = ' . $id; //TKS 09.05.2012 added the closing of video_overlay since unit controls are loading in overlay //in new invoice flow. $myfunctioncall .= 'globalUnitID=' . $id . '; get_menu_getpage( \'' . $placement . '\', 181, 65 ); close_overlay( \'video_overlay\' );'; $title = $lang[ 'hpl_ViewUnit' ]; break; //Unit (stockno) case 4: if ( isAuth( 16, 65, 181, 160 ) ) $authorized = true; $displayvaluequery = 'select StockNo as DisplayValue from untUnitInfo where UnitID = ' . $id; //TKS 09.05.2012 added the closing of video_overlay since unit controls are loading in overlay //in new invoice flow. $myfunctioncall .= 'globalUnitID=' . $id . '; get_menu_getpage( \'' . $placement . '\', 181, 65 ); close_overlay( \'video_overlay\' );'; $title = $lang[ 'hpl_ViewUnit' ]; break; //Unit (model#) case 5: if ( isAuth( 16, 65, 181, 160 ) ) $authorized = true; //TKS 09.05.2012 added the closing of video_overlay since unit controls are loading in overlay //in new invoice flow. //11.26.2011 ghh - changed masterdatabase to modeldatabase to work with new database for model numbers //05.10.2013 jss - removed $modeldatabase var as it's old and the table is back to being local /* $displayvaluequery = 'select t2.ModelNumber as DisplayValue from ( untUnitInfo as t1, ' . $modeldatabase . '.untModels as t2 ) where t1.UnitID = ' . $id . ' and t1.ModelID = t2.ModelID'; */ $displayvaluequery = "select t2.ModelNumber as DisplayValue from ( untUnitInfo as t1, untModels as t2 ) where t1.UnitID = $id and t1.ModelID = t2.ModelID"; $myfunctioncall .= 'globalUnitID=' . $id . '; get_menu_getpage( \'' . $placement . '\', 181, 65 ); close_overlay( \'video_overlay\' );'; $title = $lang[ 'hpl_ViewUnit' ]; break; //Part # case 6: if ( isAuth( 9, 44, 208, 187 ) ) $authorized = true; //if ( ( $id ) < 5000000 ) $displayvaluequery = 'select ItemNumber as DisplayValue from itmItems where ItemID = ' . $id; $myfunctioncall .= 'global_item=' . $id . ';'; //06.26.2012 jss - recently changed to bring up the inventory module, but due to complaints //i added an if statement to only do it for me if ( compareSecurityLevel($UserID) == 1 ) $myfunctioncall .= "get_menu_master( 'reg_left1', 9 );"; $myfunctioncall .= 'get_menu_getpage( \'' . $placement . '\', 208, 44 );'; //TKS 08.23.2013 #39971 added the close_overlay call as there are cases where you //click on a part # link and in overlay and it needs to close $myfunctioncall .= 'close_overlay(\'video_overlay\' );'; $title = $lang[ 'hpl_ViewItem' ]; break; //ARID case 7: if ( isAuth( 3, 49, 290, 270 ) ) $authorized = true; $displayvaluequery = 'select ARID as DisplayValue, ContactID from actAR where ARID = ' . $id; //09.28.2011 jss - get contactid $query = $displayvaluequery; if ( !$result = $db->sql_query( $query ) ) { LogError( 8472, $query ."<br>".$db->sql_error() ); exit; } $row = $db->sql_fetchrow( $result ); $contactid = $row[ 'ContactID' ]; $myfunctioncall .= 'document.getElementById( \'global_contactid\' ).value = \'' . $contactid . '\'; get_menu_getpage(\'reg_body\',447,81); get_menu_master(\'reg_left1\',3); get_menu_main( \'mnu_Receivables\', 49); get_menu_getpage( \'reg_body\', 290,49 );'; $title = $lang[ 'hpl_ViewAR' ]; break; //CHECKID case 8: if ( isAuth( 3, 62, 168, 147 ) ) $authorized = true; $displayvaluequery = 'select CheckNumber as DisplayValue from chkChecks where CheckID = ' . $id; //04.11.2012 jss - get more checking info in order to create myfunctioncall $query = "select * from chkChecks where checkid = $id"; if ( !$result = $db->sql_query( $query ) ) { LogError( 000, $query ."<br>".$db->sql_error() ); exit; } $row = $db->sql_fetchrow( $result ); //$myfunctioncall .= 'chk_reg_datefrom = \'\';'; //$myfunctioncall .= 'chk_reg_dateto = \'\';'; $myfunctioncall .= 'chk_reg_account = ' . $row[ 'AccountID' ] . ';'; $myfunctioncall .= 'chk_reg_checknum = \'' . $row[CheckNumber] . '\';'; $myfunctioncall .= 'chk_reg_checkamount = \'\';'; //06.04.2012 jss - no longer needed as tim and i have re-written the header //$myfunctioncall .= 'document.getElementById( \'header2\' ).innerHTML = \'Accounting\';'; $myfunctioncall .= 'get_menu_master( \'reg_left1\', 3 );'; $myfunctioncall .= 'get_menu_main( \'mnu_Checking\', 62 );'; $myfunctioncall .= 'get_menu_getpage( \'reg_body\', 168, 62 );'; $title = $lang[ 'hpl_ViewCheck' ]; break; } //get displayvalue if it's not passed in ( ie. Invoice #, PO #, Check #, etc... ) if ( $displayvalue == '' ) { if ( !$result = $db->sql_query( $displayvaluequery ) ) { LogError( 8148, $displayvaluequery .$dblang[ "ErrorInSQL" ]."<br>".$db->sql_error() ); exit; } $row = $db->sql_fetchrow( $result ); $displayvalue = $row[ 'DisplayValue' ]; } ####################################################################################################################### if ( $authorized ) { //start building the anchor $link = '<a href="javascript:'; //build the link function if ( $functioncall == '' ) $link .= $myfunctioncall; else $link .= $functioncall; $link .= '"'; //IMAGE TITLE $link .= ' title="' . $title . ' ..."'; //05.15.2013 jss - $link .= ' tabindex="-1"'; $link .= '>'; //IMAGE if ( $useimage ) { switch( $type ) { case 1: $imagename = 'overlay_icon.png'; break; case 9: $imagename = 'overlay_icon.png'; break; default: $imagename = 'view.png'; break; } $link .= "<img src=\"$domain/templates/$usetemplate/images/$imagename\" border=\"0\">"; } else $link .= $displayvalue; //close the anchor $link .= '</a>'; //08.31.2012 jss - if doing an invoice link, we'll have something in $myfunctioncall2 which means //we will display both an icon ( used for lightbox ) and a link ( that takes you to the invoice section ) //04.25.2013 jss - added invoice location for me //05.15.2013 jss - added tabindex="-1" if ( $myfunctioncall2 != '' ) //$link .= ' <a href="javascript:' . $myfunctioncall2 . '"' . ' title="' . $lang[hpl_GoToInvoice] . '">' . $displayvalue; $link .= " <a href=\"javascript:$myfunctioncall2\" tabindex=\"-1\" title=\"$lang[hpl_GoToInvoice] $invoicelocation\">$displayvalue</a>"; } //TKS 08.23.2013 got rid of span class=data as the class is no longer used else $link = $displayvalue; //06.06.2013 jss - ( 35794 ) add invtype icon to end of invoice # link if ( $type == 1 && $showinvtype ) { $invtype = getInvType( $id ); include_once( "$RootPath/invoicing/general_invoice_functions.php" ); $link .= ' '.getInvoiceType( $invtype, false ); } return $link; }
function getPostings($user) { // $postings = []; // return json object: $ids = []; $titles = []; $urls = []; $locations = []; $companies = []; $sources = []; $mysqli = connectToDB(); $query = "select id,title,url,location,company,source from postings where user={$user} "; if ($statement = $mysqli->prepare($query)) { $statement->execute(); // bind results $statement->bind_result($id, $title, $url, $locationId, $companyId, $source); while ($statement->fetch()) { array_push($ids, $id); array_push($titles, $title); array_push($urls, $url); $locationName = getLocationName($locationId); array_push($locations, $locationName); $companyName = getCompanyName($companyId); array_push($companies, $companyName); # will need to edit this array_push($sources, $source); } } mysqli_close($mysqli); // associate arrays $postings = array("ids" => $ids, "titles" => $titles, "urls" => $urls, "locations" => $locations, "companies" => $companies, "sources" => $sources); echo json_encode($postings); }
function transferInventory($arr, $dbh) { $wine = new Wine($dbh); if (!is_null($arr['wine_id']) && $arr['wine_id'] != '') { $wine->fetchWineById($arr['wine_id']); } else { die('Wine Not Found'); } if (!is_null($arr['wine_id']) && !is_null($arr['quantity'])) { $args = array('location' => $arr['location']); if ($arr['quantity'] <= $wine->getCurrentInventory($args)) { $args = array('quantity' => $arr['quantity'], 'sell_price' => 0, 'notes' => 'Inventory Transfer To ' . getLocationName($arr['location-to'], $dbh) . ' :::: ' . $arr['notes'], 'location' => $arr['location']); $fromid = $wine->removeInventory($args); $args = array('quantity' => $arr['quantity'], 'cost' => 0, 'notes' => 'Inventory Transfer From ' . getLocationName($arr['location'], $dbh) . ' :::: ' . $arr['notes'], 'location' => $arr['location-to']); $toid = $wine->addInventory($args); if ($fromid != 0 && $toid != 0) { die('Inventory Transferred'); } else { die('Database Error'); } } else { die('You cannot remove more inventory than you have in stock. Current inventory for this item in this location is ' . $wine->getCurrentInventory($args) . '.'); } } }