From 2f93945ffe7f2750f20eb3abfdb55ce2bfaf9967 Mon Sep 17 00:00:00 2001 From: Tim Clark <eclipse@sucs,org> Date: Fri, 13 Jun 2008 16:01:24 +0000 Subject: [PATCH] Adds auto remove on junk items a week after they are taken, and some minor ui changes --- components/junk.php | 3 +++ templates/junk.tpl | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/components/junk.php b/components/junk.php index ac78033..2de0bf6 100644 --- a/components/junk.php +++ b/components/junk.php @@ -116,6 +116,9 @@ if ($session->loggedin && $admin && (isset($_REQUEST['update']) || isset($_REQUE } } +// Remove old taken junk +$DB->Query("DELETE FROM inventory WHERE (taken_on + interval'7 days') < now()"); + if ($mode == 'list'){ // Get junk from database, and give admin the full list diff --git a/templates/junk.tpl b/templates/junk.tpl index f3cedb9..1c2b782 100644 --- a/templates/junk.tpl +++ b/templates/junk.tpl @@ -8,15 +8,15 @@ <ul> {foreach from=$category item=item} <li> - {$item.title}: {$item.description} + <strong>{$item.title}:</strong> {$item.description} + {if $item.donated_by != null} + <br /><strong>Donated by:</strong> {$item.donated_by} + {/if} {if $status == 'requested'} <br /><small>Requested by {$item.requested_by} on {$item.requested_on|date_format:"%e %b %Y"}</small> {elseif $status == "taken"} <br /><small>Taken by {$item.requested_by} on {$item.taken_on|date_format:"%e %b %Y"}</small> {/if} - {if $item.donated_by != null} - <br /><strong>Donated by:</strong>{$item.donated_by} - {/if} {if $session->loggedin} {if $admin || $item.status=='junk'} <form action="{$url}" method="POST"> @@ -42,13 +42,13 @@ </form> {/if} {/if} - </li> {if $admin && $item.requested_by==null} <div class="edit"> <a href="{$componentpath}/Edit/{$item.id}">Edit</a> <div class="clear"></div> </div> {/if} + </li> {/foreach} </ul> {/foreach} -- GitLab