Browse Source

Provides error correction for no current shop.

devel
Jonathan Rosenbaum 10 years ago
parent
commit
33b4d29417
  1. 16
      js/transaction.js
  2. 6
      json/transaction.php
  3. 14
      transaction_log.php

16
js/transaction.js

@ -10,6 +10,22 @@ $(function() {
$("select[name='transaction_type']").attr("tabindex",1);
$("select[name='transaction_type']").focus();
$("input[value='Create Transaction']").attr("tabindex",2);
$("#trans_date").mask("0000-00-00", {placeholder: "yyyy-mm-dd" });
// Does a current shop exist?
$.post("json/transaction.php", {shop_exist: 1}, function(data) {
if (data == "no_shop") {
$("input[name='Submit43']").click(function(){
$("#current_shop").html("&nbsp<a style='color:red' href='shop_log.php'>Start New Shop</a>");
event.preventDefault();
});
$('[href*="trans_id="]').click(function(){
$("#current_shop").html("&nbsp<a style='color:red' href='shop_log.php'>Start New Shop</a>");
event.preventDefault();
});
}
} );
// paid or not?
$(":checked").parent("td").prev().children().hide();

6
json/transaction.php

@ -1,9 +1,15 @@
<?php
require_once('../Connections/database_functions.php');
require_once('../Connections/YBDB.php');
mysql_select_db($database_YBDB, $YBDB);
// Is there a current shop?
if(isset($_POST['shop_exist'])) {
if(current_shop_by_ip()>=1) echo "current_shop"; else echo "no_shop";
}
// update whether paid or not
if(isset($_POST['paid'])) {
if ($_POST['paid'] == 1) {

14
transaction_log.php

@ -89,14 +89,7 @@ $Recordset1 = mysql_query($query_Recordset1, $YBDB) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
//Action on form update
if (isset($_GET[record_count])) {
//$editFormAction = $_SERVER['PHP_SELF'];
$editFormAction = "";
} else {
//$editFormAction = $_SERVER['PHP_SELF'];
$editFormAction = "";
}
$editFormAction = "";
//$editFormAction = $_SERVER['PHP_SELF'];
@ -447,7 +440,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<form method="post" name="FormNew" action="<?php echo $editFormAction; ?>">
<tr bordercolor="#CCCCCC" bgcolor="#CCCC33">
<td colspan="9"><p><strong>Start New Transaction:</strong><br />&nbsp;&nbsp;&nbsp;&nbsp;Select Type: <?php list_transaction_types('transaction_type',$default_transaction_type); ?>
<input type="submit" name="Submit43" value="Create Transaction" />
<input type="submit" name="Submit43" value="Create Transaction" /><span id="current_shop"></span>
</p> </td>
</tr>
<input type="hidden" name="MM_insert" value="FormNew">
@ -522,10 +515,9 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) {
<td height="40" valign="bottom"><form id="form1" name="form1" method="post" action="">
<p><br />
Show
<input name="record_count" type="text" value="<?php echo $number_of_transactions; ?>" size="3"
<input name="record_count" type="text" value="<?php echo $number_of_transactions; ?>" size="3">
transactions on or before:
<input name="trans_date" type="text" id="trans_date" value="<?php echo current_date(); ?>" size="10" maxlength="10" />
(date format YYYY-MM-DD) Day of week:
<select name="dayname">
<option value="alldays" selected="selected">All Days</option>
<option value="Monday">Monday</option>

Loading…
Cancel
Save