Index: modules/ecommerce/file/file.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/ecommerce/file/file.module,v
retrieving revision 1.37.2.7
diff -u -r1.37.2.7 file.module
--- modules/ecommerce/file/file.module	2 Oct 2006 00:33:20 -0000	1.37.2.7
+++ modules/ecommerce/file/file.module	20 Nov 2006 12:55:16 -0000
@@ -149,12 +200,12 @@
         }
         else {
           $description = t('Enter the filesystem path to this file (not the URL). This path will be prefixed with <b>%file_path</b> Here is a <a href="%file_quicklist" onclick="window.open(this.href, \'%file_quicklist\', \'width=480,height=480,scrollbars=yes,status=yes\'); return false">list of files</a> in this directory. You may need to FTP your file to this directory before you can create the file product.', array('%file_quicklist' => url('admin/store/products/files'), '%file_path' => ec_file_create_path()));
-          $attribues = NULL;
+          $attributes = NULL;
         }
         $form['f_settings']['fpath'] = array(
           '#type' => 'textfield',
           '#title' => t('File path'),
-          '#default_value' => $node->fpath,
+          '#default_value' => isset($node->fpath) ? $node->fpath : NULL,
           '#size' => 50,
           '#maxlength' => 200,
           '#autocomplete_path' => 'ec_file/autocomplete',
@@ -342,6 +393,8 @@
   }
 
   // Check 2: Check for multi products that contain file downloads.
+ // Parcel module is optional: we shouldn't do this if it is not enabled
+ if (module_exist('parcel')) {
   $result = db_query('SELECT st.created, st.expires, stp.title, pp.mnid, p.nid FROM {ec_transaction} AS st, {users} AS u, {ec_product} AS p, {ec_product_parcel} AS pp, {ec_transaction_product} AS stp WHERE u.uid = st.uid AND st.uid = %d AND p.nid = stp.nid AND st.txnid = stp.txnid AND pp.nid = p.nid AND st.payment_status = 2'. tablesort_sql($header), $uid);
   while ($data = db_fetch_object($result)) {
     // Load each individual product and determine if it's a file download.
@@ -371,7 +424,10 @@
       }
     }
   }
-  $output .= ($rows) ? theme('table', $header, $rows) : t('You have no files to download.');
+ } // End [if parcel module enabled]
+
+  // Create a table of the rows, or a suitable message if none
+  $output .= !empty($rows) ? theme('table', $header, $rows) : t('You have no files to download.');
 
   return $output;
 }
@@ -435,7 +491,8 @@
     return $dest;
   }
   // check if the destination is instead inside the Drupal temporary files directory.
-  else if (file_check_location($dest, variable_get('file_directory_temp', FILE_DIRECTORY_TEMP))) {
+  // Following used to use FILE_DIRECTORY_TEMP, but that is not defined  (in Drupal 4.7, at least)
+  else if (file_check_location($dest, file_directory_temp())) {
     return $dest;
   }
   // Not found, try again with prefixed dirctory path.
