/[drupal]/contributions/modules/donation/donation.module
ViewVC logotype

Diff of /contributions/modules/donation/donation.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.1.2.6, Fri Jan 16 17:37:37 2009 UTC revision 1.1.2.7, Sat Jan 17 00:27:08 2009 UTC
# Line 189  function donation_settings() { Line 189  function donation_settings() {
189    $form[DONATION_EMAIL] = array(    $form[DONATION_EMAIL] = array(
190      '#type' => 'textfield',      '#type' => 'textfield',
191      '#title' => t('Donations email address'),      '#title' => t('Donations email address'),
192      '#default_value' => variable_get(DONATION_EMAIL, DONATION_EMAIL_DEFAULT),      '#default_value' => variable_get(DONATION_EMAIL, donation_email()),
193      '#description' => t('Only donations to this email address are considered by this module.'),      '#description' => t('Only donations to this email address are considered by this module.'),
194    );    );
195    
# Line 420  function donation_import_submit($form_id Line 420  function donation_import_submit($form_id
420        $insurance_amount, $sales_tax, $opt_1_name, $opt_1_value, $opt_2_name, $opt_2_value, $auction_site,        $insurance_amount, $sales_tax, $opt_1_name, $opt_1_value, $opt_2_name, $opt_2_value, $auction_site,
421        $buyer_id, $item_url, $closing_date, $escrow_id, $invoice_id, $ref_txn_id, $invoice_number,        $buyer_id, $item_url, $closing_date, $escrow_id, $invoice_id, $ref_txn_id, $invoice_number,
422        $custom_number, $receipt_id, $contact_phone_number ) = explode('","', $line);        $custom_number, $receipt_id, $contact_phone_number ) = explode('","', $line);
423      if ($to_email == variable_get(DONATION_EMAIL, DONATION_EMAIL_DEFAULT) && $name && $net) {      if ($to_email == variable_get(DONATION_EMAIL, donation_email()) && $name && $net) {
424        // We need to swap the day and month in Paypal's date format:        // We need to swap the day and month in Paypal's date format:
425        list($month, $day, $year) = explode('/', substr($date, 1), 3);        list($month, $day, $year) = explode('/', substr($date, 1), 3);
426    
# Line 516  function donation_ipn() { Line 516  function donation_ipn() {
516      return;      return;
517    }    }
518    
519    if ($_POST['business'] != variable_get(DONATION_EMAIL, DONATION_EMAIL_DEFAULT)) {    if ($_POST['business'] != variable_get(DONATION_EMAIL, donation_email())) {
520      // Payment is not for the email address configured      // Payment is not for the email address configured
521      return;      return;
522    }    }
# Line 570  function donation_form_build() { Line 570  function donation_form_build() {
570    $form['business'] = array(    $form['business'] = array(
571      '#type' => 'hidden',      '#type' => 'hidden',
572      '#name' => 'business',      '#name' => 'business',
573      '#value' => variable_get(DONATION_EMAIL, DONATION_EMAIL_DEFAULT));      '#value' => variable_get(DONATION_EMAIL, donation_email()));
574    $form['cmd'] = array(    $form['cmd'] = array(
575      '#type' => 'hidden',      '#type' => 'hidden',
576      '#value' => '_xclick',      '#value' => '_xclick',
# Line 682  function _donation_currency_options() { Line 682  function _donation_currency_options() {
682    
683    return $options;    return $options;
684  }  }
685    
686    /**
687     * Donation email default
688     */
689    function donation_email() {
690      // First check if the variable is set
691      $mail = variable_get(DONATION_EMAIL, '');
692      if ($mail) {
693        // It is, so use that
694        return $mail;
695      }
696    
697      // Check if user 1 has an email address set
698      $account = user_load(array('uid' => 1));
699      if ($account->mail) {
700        // It is, so return that
701        return $account->mail;
702      }
703    
704      // Otherwise, see if the site email is set
705      $mail = variable_get('site_mail', '');
706      if ($mail) {
707        // It is, so use that
708        return $mail;
709      }
710    
711      // Last resort is to use the hard coded default
712      return DONATION_EMAIL_DEFAULT;
713    }

Legend:
Removed from v.1.1.2.6  
changed lines
  Added in v.1.1.2.7

  ViewVC Help
Powered by ViewVC 1.1.2