git://git.iain.cx/iain
/
readifood.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show dates in the past.
[readifood.git]
/
lib
/
functions.php
diff --git
a/lib/functions.php
b/lib/functions.php
index
3727a65
..
801ed78
100644
(file)
--- a/
lib/functions.php
+++ b/
lib/functions.php
@@
-246,6
+246,11
@@
return get_area_city($area);
}
return get_area_city($area);
}
+ /* Parcel strings are the same so this can work. */
+ function get_contact_parcel_string($contact) {
+ return get_order_parcel_string($contact);
+ }
+
/* Hub and Contact are similar enough that this can work. */
function get_hub_address($hub) {
return get_contact_address($hub);
/* Hub and Contact are similar enough that this can work. */
function get_hub_address($hub) {
return get_contact_address($hub);
@@
-384,15
+389,22
@@
}
function show_date_form($name, $date = null) {
}
function show_date_form($name, $date = null) {
+ $past = 60;
+ $future = 60;
echo "<select name=\"$name\">\n";
echo "<select name=\"$name\">\n";
- $now = time();
+ $now = date('Y-m-d', time());
+ list($y, $m, $d) = explode('-', $now);
+ $today = mktime(0, 0, 0, $m, $d, $y);
if (isset($date)) {
list($y, $m, $d) = explode('-', $date);
$then = mktime(0, 0, 0, $m, $d, $y);
if (isset($date)) {
list($y, $m, $d) = explode('-', $date);
$then = mktime(0, 0, 0, $m, $d, $y);
- option($name, $date, date('l j F Y', $then), $date);
+ if ($then < $today - 86400 * $past || $then > $today + 86400 * $future) {
+ option($name, $date, date('l j F Y', $then), $date);
+ }
}
}
- for ($i = 0; $i < 60; $i++) {
- $then = $now + 86400 * $i;
+ else $date = $now;
+ for ($i = -$past; $i < $future; $i++) {
+ $then = $today + 86400 * $i;
option($name, date('Y-m-d', $then), date('l j F Y', $then), $date);
}
echo "</select>\n";
option($name, date('Y-m-d', $then), date('l j F Y', $then), $date);
}
echo "</select>\n";