Revision: 1694
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1694&view=rev
Author:   cimorrison
Date:     2010-12-11 17:54:21 +0000 (Sat, 11 Dec 2010)

Log Message:
-----------
Replaced magic numbers for entry types with constants

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/del_entry.php
    mrbs/branches/ics_attachments/web/edit_entry.php
    mrbs/branches/ics_attachments/web/edit_entry_handler.php
    mrbs/branches/ics_attachments/web/functions_ical.inc
    mrbs/branches/ics_attachments/web/internalconfig.inc.php
    mrbs/branches/ics_attachments/web/mrbs_sql.inc
    mrbs/branches/ics_attachments/web/view_entry.php

Modified: mrbs/branches/ics_attachments/web/del_entry.php
===================================================================
--- mrbs/branches/ics_attachments/web/del_entry.php     2010-12-11 17:25:30 UTC 
(rev 1693)
+++ mrbs/branches/ics_attachments/web/del_entry.php     2010-12-11 17:54:21 UTC 
(rev 1694)
@@ -71,11 +71,11 @@
       // Gather all fields values for use in emails.
       $mail_previous = mrbsGetBookingInfo($id, FALSE);
       // If this is an individual entry of a series then force the entry_type
-      // to be 2, so that when we create the iCalendar object we know that
+      // to be a changed entry, so that when we create the iCalendar object we 
know that
       // we only want to delete the individual entry
       if (!$series && ($mail_previous['rep_type'] != REP_NONE))
       {
-        $mail_previous['entry_type'] = 2;
+        $mail_previous['entry_type'] = ENTRY_RPT_CHANGED;
       }
     }
     sql_begin();

Modified: mrbs/branches/ics_attachments/web/edit_entry.php
===================================================================
--- mrbs/branches/ics_attachments/web/edit_entry.php    2010-12-11 17:25:30 UTC 
(rev 1693)
+++ mrbs/branches/ics_attachments/web/edit_entry.php    2010-12-11 17:54:21 UTC 
(rev 1694)
@@ -265,7 +265,7 @@
   }
   
 
-  if($entry_type >= 1)
+  if(($entry_type == ENTRY_RPT_ORIGINAL) || ($entry_type == ENTRY_RPT_CHANGED))
   {
     $sql = "SELECT rep_type, start_time, end_time, end_date, rep_opt, 
rep_num_weeks
               FROM $tbl_repeat 

Modified: mrbs/branches/ics_attachments/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/ics_attachments/web/edit_entry_handler.php    2010-12-11 
17:25:30 UTC (rev 1693)
+++ mrbs/branches/ics_attachments/web/edit_entry_handler.php    2010-12-11 
17:54:21 UTC (rev 1694)
@@ -586,8 +586,8 @@
     }
     else
     {
-      // Mark changed entry in a series with entry_type 2:
-      $data['entry_type'] = ($repeat_id > 0) ? 2 : 0;
+      // Mark changed entry in a series with entry_type:
+      $data['entry_type'] = ($repeat_id > 0) ? ENTRY_RPT_CHANGED : 
ENTRY_SINGLE;
       $data['repeat_id'] = $repeat_id;
     }
     // The following elements are needed for email notifications

Modified: mrbs/branches/ics_attachments/web/functions_ical.inc
===================================================================
--- mrbs/branches/ics_attachments/web/functions_ical.inc        2010-12-11 
17:25:30 UTC (rev 1693)
+++ mrbs/branches/ics_attachments/web/functions_ical.inc        2010-12-11 
17:54:21 UTC (rev 1694)
@@ -165,7 +165,7 @@
   $results[] = "LOCATION:" . ical_escape_text($data['area_name'] . " - " . 
$data['room_name']);
   $results[] = "SEQUENCE:" . $data['ical_sequence'];
   // If this is an individual member of a series then set the recurrence id
-  if ($data['entry_type'] == 2)
+  if ($data['entry_type'] == ENTRY_RPT_CHANGED)
   {
     $results[] = "RECURRENCE-ID:" . gmdate(RFC5545_FORMAT . '\Z', 
$data['start_time']);
   }

Modified: mrbs/branches/ics_attachments/web/internalconfig.inc.php
===================================================================
--- mrbs/branches/ics_attachments/web/internalconfig.inc.php    2010-12-11 
17:25:30 UTC (rev 1693)
+++ mrbs/branches/ics_attachments/web/internalconfig.inc.php    2010-12-11 
17:54:21 UTC (rev 1694)
@@ -81,7 +81,20 @@
  // that is used;  it is merely used when the code needs to know the DOCTYPE, 
for example
  // in calls to nl2br.   TRUE means XHTML, FALSE means HTML.
  define('IS_XHTML', FALSE);
+ 
+ 
+ /*************************************************
+ * ENTRY TYPES - internal use, do not change
+ *************************************************/
+ 
+ // The entry_type field in the entry table records the type of
+ // booking as follows:
+ 
+ define('ENTRY_SINGLE',       0);  // A single entry that is not part of a 
series
+ define('ENTRY_RPT_ORIGINAL', 1);  // An entry that is part of a series and 
has not been modified
+ define('ENTRY_RPT_CHANGED',  2);  // An entry that is part of a series and 
has been modified
 
+ 
 /*************************************************
  * ENTRY STATUS CODES - internal use, do not change
  *************************************************/

Modified: mrbs/branches/ics_attachments/web/mrbs_sql.inc
===================================================================
--- mrbs/branches/ics_attachments/web/mrbs_sql.inc      2010-12-11 17:25:30 UTC 
(rev 1693)
+++ mrbs/branches/ics_attachments/web/mrbs_sql.inc      2010-12-11 17:54:21 UTC 
(rev 1694)
@@ -189,7 +189,7 @@
       continue;
     }
    
-    if ($series && $row['entry_type'] == 2 && !$all)
+    if ($series && $row['entry_type'] == ENTRY_RPT_CHANGED && !$all)
     {
       continue;
     }
@@ -591,7 +591,7 @@
 
   if (empty($reps))
   {
-    $data['entry_type'] = 0;
+    $data['entry_type'] = ENTRY_SINGLE;
     $data['repeat_id'] = 0;
     $id = mrbsCreateSingleEntry($data);
     $result['id'] = $id;
@@ -603,7 +603,7 @@
     
   if ($id)
   {
-    $data['entry_type'] = 1;
+    $data['entry_type'] = ENTRY_RPT_ORIGINAL;
     $data['repeat_id'] = $id;
     $starttime = $data['start_time'];
     $endtime = $data['end_time'];

Modified: mrbs/branches/ics_attachments/web/view_entry.php
===================================================================
--- mrbs/branches/ics_attachments/web/view_entry.php    2010-12-11 17:25:30 UTC 
(rev 1693)
+++ mrbs/branches/ics_attachments/web/view_entry.php    2010-12-11 17:54:21 UTC 
(rev 1694)
@@ -313,7 +313,7 @@
   // as per the original series settings
   $sql = "SELECT id
           FROM $tbl_entry
-          WHERE repeat_id=\"$id\" AND entry_type=\"1\"
+          WHERE repeat_id=\"$id\" AND entry_type=" . ENTRY_RPT_ORIGINAL . "
           ORDER BY start_time
           LIMIT 1";
   $id = sql_query1($sql);
@@ -367,7 +367,7 @@
     // and include them in the iCalendar object
     if ($series)
     {
-      $sql = "SELECT id FROM $tbl_entry WHERE repeat_id=$repeat_id AND 
entry_type=2";
+      $sql = "SELECT id FROM $tbl_entry WHERE repeat_id=$repeat_id AND 
entry_type=" . ENTRY_RPT_CHANGED;
       $res = sql_query($sql);
       if ($res && (sql_count($res) > 0))
       {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Oracle to DB2 Conversion Guide: Learn learn about native support for PL/SQL,
new data types, scalar functions, improved concurrency, built-in packages, 
OCI, SQL*Plus, data movement tools, best practices and more.
http://p.sf.net/sfu/oracle-sfdev2dev 
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to