add item creation timestamp

This commit is contained in:
Michael Erdely 2024-12-31 13:07:37 -05:00
parent f354c14dbd
commit 9100297724
Signed by: mike
SSH key fingerprint: SHA256:ukbnfrRMaRYlBZXENtBTyO2jLnql5AA5m+SzZCfYQe0
6 changed files with 45 additions and 36 deletions

View file

@ -190,7 +190,7 @@ else {
$sortby = "rankorder {$_SESSION['sortdir']}, i.name";
}
}
$stmt = $smarty->dbh()->prepare("SELECT itemid, name, description, i.category as catid, c.category, price, price as pricenum, source, url, i.ranking as rankid, rendered, comment, quantity, image_filename, public FROM {$opt["table_prefix"]}items i LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking WHERE userid = ? and i.archive = false ORDER BY " . $sortby);
$stmt = $smarty->dbh()->prepare("SELECT itemid, name, description, i.category as catid, c.category, price, price as pricenum, source, url, i.ranking as rankid, rendered, comment, quantity, created, image_filename, public FROM {$opt["table_prefix"]}items i LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking WHERE userid = ? and i.archive = false ORDER BY " . $sortby);
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
$stmt->execute();
$myitems_count = 0;

View file

@ -304,8 +304,8 @@ if (!empty($_REQUEST["action"])) {
}
else if ($action == "insert") {
if (!$haserror) {
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,name,description,price,source,category,url,ranking,comment,public,quantity,image_filename) " .
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt = $smarty->dbh()->prepare("INSERT INTO {$opt["table_prefix"]}items(userid,name,description,price,source,category,url,ranking,comment,public,quantity,created,image_filename) " .
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bindParam(1, $userid, PDO::PARAM_INT);
$stmt->bindParam(2, $name, PDO::PARAM_STR);
$stmt->bindParam(3, $description, PDO::PARAM_STR);
@ -317,10 +317,11 @@ if (!empty($_REQUEST["action"])) {
$stmt->bindParam(9, $comment, PDO::PARAM_STR);
$stmt->bindParam(10, $public, PDO::PARAM_BOOL);
$stmt->bindParam(11, $quantity, PDO::PARAM_INT);
$stmt->bindParam(12, date('Y-m-d H:i:s'));
if (!isset($image_base_filename) || $image_base_filename == "") {
$image_base_filename = NULL;
}
$stmt->bindParam(12, $image_base_filename, PDO::PARAM_STR);
$stmt->bindParam(13, $image_base_filename, PDO::PARAM_STR);
$stmt->execute();
stampUser($userid, $smarty->dbh(), $smarty->opt());

View file

@ -226,7 +226,7 @@ else {
$sql = "SELECT i.itemid, name, description, price, price as pricenum, source, i.category as catid, c.category, url, r.title as rank, i.ranking as rankid, image_filename, public, " .
"ub.fullname AS bfullname, ub.userid AS boughtid, " .
"ur.fullname AS rfullname, ur.userid AS reservedid, " .
"rendered, i.comment, i.quantity " .
"rendered, i.comment, i.quantity, created " .
"FROM {$opt["table_prefix"]}items i " .
"LEFT OUTER JOIN {$opt["table_prefix"]}categories c ON c.categoryid = i.category " .
"LEFT OUTER JOIN {$opt["table_prefix"]}ranks r ON r.ranking = i.ranking " .

View file

@ -80,6 +80,8 @@ CREATE TABLE `items` (
`image_filename` varchar(255) default NULL,
`public` tinyint(1) NOT NULL default '0',
`archive` tinyint(1) NOT NULL default '0',
`archive` tinyint(1) NOT NULL default '0',
`created` datetime default NULL,
PRIMARY KEY (`itemid`)
);

View file

@ -229,21 +229,24 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</div> <!-- col -->
</div> <!-- row -->
</div> <!-- modal-body -->
<div class="modal-footer">
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url}" target="_blank" title="{$row.url}"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
<a role="button" class="btn btn-secondary" href="receive.php?itemid={$row.itemid}" ><img alt="Mark Item Received" src="images/return-dark.png" title="Mark Item Received" border="0" /></a>
<a role="button" class="btn btn-secondary" rel="confirmitemarchive" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=archive&itemid={$row.itemid}"><img alt="Archive Item" title="Archive Item" src="images/archive-fill-dark.png" border="0" /></a>
<a role="button" class="btn btn-danger" rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}"><img alt="Delete Item" title="Delete Item" src="images/bin-dark.png" border="0" /></a>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save</button>
<div class="modal-footer d-flex justify-content-between">
<span>{if isset($row.created)}Added: {$row.created|date_format:"%F"}{/if}</span>
<div>
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url}" target="_blank" title="{$row.url}"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
<a role="button" class="btn btn-secondary" href="receive.php?itemid={$row.itemid}" ><img alt="Mark Item Received" src="images/return-dark.png" title="Mark Item Received" border="0" /></a>
<a role="button" class="btn btn-secondary" rel="confirmitemarchive" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=archive&itemid={$row.itemid}"><img alt="Archive Item" title="Archive Item" src="images/archive-fill-dark.png" border="0" /></a>
<a role="button" class="btn btn-danger" rel="confirmitemdelete" data-content="{$row.name|escape:'htmlall'}" href="item.php?action=delete&itemid={$row.itemid}"><img alt="Delete Item" title="Delete Item" src="images/bin-dark.png" border="0" /></a>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div> <!-- modal-footer -->
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
</form>
<a href="#" data-bs-toggle="modal" data-bs-target="#editmodal_{$row.itemid}">
<span title="{$row.description|escape:'htmlall'}">{$row.name|truncate:50|escape:'htmlall'}</span>
<span title="{$row.description|escape:'htmlall'}{if isset($row.created)} (Added: {$row.created|date_format:"%F"}){/if}">{$row.name|truncate:50|escape:'htmlall'}</span>
</a>
<span title="{$row.description|escape:'htmlall'}">
{if $row.public == 1} &nbsp; <img alt="Item is Public" class="theme-image" data-light-src="images/globe-light.png" data-dark-src="images/globe-dark.png" src="images/globe-light.png" border="0" title="Item is Public">{/if}

View file

@ -173,35 +173,38 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
</div> <!-- col -->
</div> <!-- row -->
</div> <!-- modal-body -->
<div class="modal-footer">
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url|escape:'htmlall'}" target="_blank"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
{if $row.quantity > 1}
{if $row.avail > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$reservetext|escape:'htmlall'}" title="{$reservetext|escape:'htmlall'}" src="images/locked-dark.png" border="0" /></a>{/if}
{if $row.avail > 0 || $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>{/if}
{if $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>{/if}
{if $row.ibought > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=return&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Return Item" title="Return Item" src="images/return-dark.png" border="0" /></a>{/if}
{else}
{if $row.rfullname == '' && $row.bfullname == ''}
<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Reserve Item" title="Reserve Item" src="images/locked-dark.png" border="0" /></a>
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
{elseif $row.rfullname != ''}
{if $row.reservedid == $userid}
<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
<div class="modal-footer d-flex justify-content-between">
<span>{if isset($row.created)}Added: {$row.created|date_format:"%F"}{/if}</span>
<div>
{if $row.url != ''}<a role="button" class="btn btn-secondary" href="{$row.url|escape:'htmlall'}" target="_blank"><img alt="Visit URL" title="Visit URL" src="images/link-dark.png" border="0" /></a>{/if}
{if isset($row.image_filename)}<a role="button" class="btn btn-secondary" href="{$opt.image_subdir}/{$row.image_filename}" title="{$row.name|escape:'htmlall'}" data-lightbox="image-1"><img alt="View Image" title="View Image" src="images/image-dark.png" border="0" /></a>{/if}
{if $row.quantity > 1}
{if $row.avail > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$reservetext|escape:'htmlall'}" title="{$reservetext|escape:'htmlall'}" src="images/locked-dark.png" border="0" /></a>{/if}
{if $row.avail > 0 || $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>{/if}
{if $row.ireserved > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>{/if}
{if $row.ibought > 0}<a role="button" class="btn btn-secondary" href="shop.php?action=return&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Return Item" title="Return Item" src="images/return-dark.png" border="0" /></a>{/if}
{else}
{if $row.rfullname == '' && $row.bfullname == ''}
<a role="button" class="btn btn-secondary" href="shop.php?action=reserve&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Reserve Item" title="Reserve Item" src="images/locked-dark.png" border="0" /></a>
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
{elseif $row.rfullname != ''}
{if $row.reservedid == $userid}
<a role="button" class="btn btn-secondary" href="shop.php?action=release&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="Release Item" title="Release Item" src="images/unlocked-dark.png" border="0" /></a>
<a role="button" class="btn btn-secondary" href="shop.php?action=purchase&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="{$purchasetext|escape:'htmlall'}" title="{$purchasetext|escape:'htmlall'}" src="images/credit-card-3-dark.png" border="0" /></a>
{/if}
{/if}
{/if}
{/if}
{if !$public_view}
<a role="button" class="btn btn-secondary" href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" src="images/split-2-dark.png" border="0" /></a>
{/if}
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
{if !$public_view}
<a role="button" class="btn btn-secondary" href="shop.php?action=copy&itemid={$row.itemid}&shopfor={$shopfor}"><img alt="I Want This Too" title="I Want This Too" src="images/split-2-dark.png" border="0" /></a>
{/if}
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div> <!-- modal-footer -->
</div> <!-- modal-content -->
</div> <!-- modal-dialog -->
</div> <!-- modal -->
<a href="#" data-bs-toggle="modal" data-bs-target="#modal_{$row.itemid}">
<span title="{$row.description|escape:'htmlall'}">{$row.name|truncate:50|escape:'htmlall'}</span>
<span title="{$row.description|escape:'htmlall'}{if isset($row.created)} (Added: {$row.created|date_format:"%F"}){/if}">{$row.name|truncate:50|escape:'htmlall'}</span>
</a>
</td>
<td nowrap class="text-center">{$row.rankid}</td>