Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sucs-site
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Laurence Sebastian Bowes
sucs-site
Commits
c3e2e30d
Commit
c3e2e30d
authored
16 years ago
by
Graham Cole
Browse files
Options
Downloads
Patches
Plain Diff
stop things exploding when there's no junk to list
parent
30916180
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/junk.php
+20
-18
20 additions, 18 deletions
components/junk.php
with
20 additions
and
18 deletions
components/junk.php
+
20
−
18
View file @
c3e2e30d
...
@@ -136,28 +136,30 @@ if ($mode == 'list'){
...
@@ -136,28 +136,30 @@ if ($mode == 'list'){
else
{
else
{
$junk
=
$DB
->
GetAll
(
"SELECT * FROM inventory WHERE status = 'junk' ORDER BY category, title, id"
);
$junk
=
$DB
->
GetAll
(
"SELECT * FROM inventory WHERE status = 'junk' ORDER BY category, title, id"
);
}
}
//
// group the junk by status then by category
foreach
(
$junk
as
$junkitem
)
{
if
(
$junkitem
[
'status'
]
!=
'junk'
)
{
$status
=
"unknown"
;
}
else
if
(
$junkitem
[
'requested_by'
]
==
null
)
{
$status
=
"available"
;
}
else
if
(
$junkitem
[
'taken_on'
]
==
null
)
{
$status
=
"requested"
;
}
else
{
$status
=
"taken"
;
}
$sortedjunk
[
$status
][
$junkitem
[
'category'
]][]
=
$junkitem
;
}
$smarty
->
assign
(
"junk"
,
$sortedjunk
);
// Check there is some junk
// Check there is some junk
if
(
sizeof
(
$junk
)
<
1
)
{
if
(
sizeof
(
$junk
)
<
1
)
{
$mode
=
"nojunk"
;
$mode
=
"nojunk"
;
}
else
{
// group the junk by status then by category
foreach
(
$junk
as
$junkitem
)
{
if
(
$junkitem
[
'status'
]
!=
'junk'
)
{
$status
=
"unknown"
;
}
else
if
(
$junkitem
[
'requested_by'
]
==
null
)
{
$status
=
"available"
;
}
else
if
(
$junkitem
[
'taken_on'
]
==
null
)
{
$status
=
"requested"
;
}
else
{
$status
=
"taken"
;
}
$sortedjunk
[
$status
][
$junkitem
[
'category'
]][]
=
$junkitem
;
}
$smarty
->
assign
(
"junk"
,
$sortedjunk
);
}
}
}
else
{
}
else
{
$categories
=
$DB
->
GetCol
(
"SELECT DISTINCT category FROM inventory ORDER BY category ASC"
);
$categories
=
$DB
->
GetCol
(
"SELECT DISTINCT category FROM inventory ORDER BY category ASC"
);
$smarty
->
assign
(
"categories"
,
$categories
);
$smarty
->
assign
(
"categories"
,
$categories
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment