Revision: 1568
http://mrbs.svn.sourceforge.net/mrbs/?rev=1568&view=rev
Author: cimorrison
Date: 2010-11-02 12:25:37 +0000 (Tue, 02 Nov 2010)
Log Message:
-----------
Fixed problems which caused PostgreSQL to generate "argument of AND must be
type boolean, not type integer" and similar errors
Modified Paths:
--------------
mrbs/branches/provisional_bookings_new_style/web/Themes/default/header.inc
mrbs/branches/provisional_bookings_new_style/web/functions.inc
mrbs/branches/provisional_bookings_new_style/web/pending.php
mrbs/branches/provisional_bookings_new_style/web/report.php
mrbs/branches/provisional_bookings_new_style/web/search.php
Modified:
mrbs/branches/provisional_bookings_new_style/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/Themes/default/header.inc
2010-11-02 11:32:42 UTC (rev 1567)
+++ mrbs/branches/provisional_bookings_new_style/web/Themes/default/header.inc
2010-11-02 12:25:37 UTC (rev 1568)
@@ -475,7 +475,7 @@
// (but only for areas where approval is required)
$sql = "SELECT COUNT(*)
FROM $tbl_entry E, $tbl_room R, $tbl_area A
- WHERE status&" . STATUS_AWAITING_APPROVAL . "
+ WHERE (status&" . STATUS_AWAITING_APPROVAL . " != 0)
AND E.room_id = R.id
AND R.area_id = A.id
AND $sql_approval_enabled";
Modified: mrbs/branches/provisional_bookings_new_style/web/functions.inc
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/functions.inc
2010-11-02 11:32:42 UTC (rev 1567)
+++ mrbs/branches/provisional_bookings_new_style/web/functions.inc
2010-11-02 12:25:37 UTC (rev 1568)
@@ -619,7 +619,7 @@
{
global $area_defaults;
- $predicate = "($field IS NOT NULL AND $field > 0)";
+ $predicate = "(($field IS NOT NULL) AND ($field > 0))";
if ($area_defaults[$field])
{
$predicate = "(" . $predicate . " OR ($field IS NULL))";
Modified: mrbs/branches/provisional_bookings_new_style/web/pending.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/pending.php
2010-11-02 11:32:42 UTC (rev 1567)
+++ mrbs/branches/provisional_bookings_new_style/web/pending.php
2010-11-02 12:25:37 UTC (rev 1568)
@@ -175,7 +175,7 @@
WHERE E.room_id = M.id
AND M.area_id = A.id
AND $sql_approval_enabled
- AND E.status&" . STATUS_AWAITING_APPROVAL;
+ AND (E.status&" . STATUS_AWAITING_APPROVAL . " != 0)";
// Ordinary users can only see their own bookings
if (!$is_admin)
Modified: mrbs/branches/provisional_bookings_new_style/web/report.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/report.php 2010-11-02
11:32:42 UTC (rev 1567)
+++ mrbs/branches/provisional_bookings_new_style/web/report.php 2010-11-02
12:25:37 UTC (rev 1568)
@@ -1106,27 +1106,29 @@
// (In the next three cases, you will get the empty string if that part
// of the form was not displayed - which means that you need all bookings)
+ // Note that although you can say eg "status&STATUS_PRIVATE" in MySQL, you
get
+ // an error in PostgreSQL as the expression is of the wrong type.
// Match the privacy status
if (($match_private != PRIVATE_BOTH) && ($match_private != ''))
{
$sql .= " AND ";
- $sql .= ($match_private) ? '' : '!'; // Note that private works the other
way round to the next two
- $sql .= "(status&" . STATUS_PRIVATE . ")";
+ $sql .= "(status&" . STATUS_PRIVATE;
+ $sql .= ($match_private) ? "!=0)" : "=0)"; // Note that private works the
other way round to the next two
}
// Match the confirmation status
if (($match_confirmed != CONFIRMED_BOTH) && ($match_confirmed != ''))
{
$sql .= " AND ";
- $sql .= ($match_confirmed) ? '!' : '';
- $sql .= "(status&" . STATUS_TENTATIVE . ")";
+ $sql .= "(status&" . STATUS_TENTATIVE;
+ $sql .= ($match_confirmed) ? "=0)" : "!=0)";
}
// Match the approval status
if (($match_approved != APPROVED_BOTH) && ($match_approved != ''))
{
$sql .= " AND ";
- $sql .= ($match_approved) ? '!' : '';
- $sql .= "(status&" . STATUS_AWAITING_APPROVAL . ")";
+ $sql .= "(status&" . STATUS_AWAITING_APPROVAL;
+ $sql .= ($match_approved) ? "=0)" : "!=0)";
}
// Now do the custom fields
@@ -1173,7 +1175,7 @@
// - their own bookings, and others' public bookings if
private_override is set to 'none'
// - just their own bookings, if private_override is set to 'private'
$sql .= " AND ((A.private_override='public') OR
- (A.private_override='none' AND (!(E.status&" .
STATUS_PRIVATE . ") OR E.create_by = '" . addslashes($user) . "')) OR
+ (A.private_override='none' AND ((E.status&" .
STATUS_PRIVATE . "=0) OR E.create_by = '" . addslashes($user) . "')) OR
(A.private_override='private' AND E.create_by = '" .
addslashes($user) . "'))";
}
else
@@ -1182,7 +1184,7 @@
// - all bookings, if private_override is set to 'public'
// - public bookings if private_override is set to 'none'
$sql .= " AND ((A.private_override='public') OR
- (A.private_override='none' AND !(E.status&" .
STATUS_PRIVATE . ")))";
+ (A.private_override='none' AND (E.status&" .
STATUS_PRIVATE . "=0)))";
}
}
Modified: mrbs/branches/provisional_bookings_new_style/web/search.php
===================================================================
--- mrbs/branches/provisional_bookings_new_style/web/search.php 2010-11-02
11:32:42 UTC (rev 1567)
+++ mrbs/branches/provisional_bookings_new_style/web/search.php 2010-11-02
12:25:37 UTC (rev 1568)
@@ -111,7 +111,7 @@
// - their own bookings, and others' public bookings if private_override
is set to 'none'
// - just their own bookings, if private_override is set to 'private'
$sql_pred .= " AND ((A.private_override='public') OR
- (A.private_override='none' AND (!(E.status&" .
STATUS_PRIVATE . ") OR E.create_by = '" . addslashes($user) . "')) OR
+ (A.private_override='none' AND ((E.status&" .
STATUS_PRIVATE . "=0) OR E.create_by = '" . addslashes($user) . "')) OR
(A.private_override='private' AND E.create_by = '" .
addslashes($user) . "'))";
}
else
@@ -120,7 +120,7 @@
// - all bookings, if private_override is set to 'public'
// - public bookings if private_override is set to 'none'
$sql_pred .= " AND ((A.private_override='public') OR
- (A.private_override='none' AND !(E.status&" .
STATUS_PRIVATE . ")))";
+ (A.private_override='none' AND (E.status&" .
STATUS_PRIVATE . "=0)))";
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits