if ($store === true) {
            //transaction has been stored :)
            if ($new) {
                $transaction['trans_id'] = $trans->id;
            }
        } else {
            //something went wrong :'(
            $error_detected[] = _T("An error occured while storing the transaction.");
        }
    } else {
        //hum... there are errors :'(
        $error_detected = $valid;
    }
    if (count($error_detected) == 0) {
        // dynamic fields
        $dyn_fields->setAllFields('trans', $transaction['trans_id'], $transaction['dyn']);
        if ($trans->getMissingAmount() > 0) {
            $url = 'ajouter_contribution.php?trans_id=' . $trans->id;
            if (isset($trans->memebr)) {
                $url .= '&id_adh=' . $trans->member;
            }
        } else {
            $url = 'gestion_transactions.php';
        }
        header('location: ' . $url);
        die;
    }
} else {
    //$_POST['valid']
    if ($trans->id != '') {
        // dynamic fields
                             }
                         } else {
                             //Mails are disabled... We log (not safe, but)...
                             Analog::log('Post contribution script has failed. Here was the data: ' . "\n" . print_r($res, true), Analog::ERROR);
                         }
                     }
                 }
             }
         } else {
             //something went wrong :'(
             $error_detected[] = _T("An error occured while storing the contribution.");
         }
     }
 }
 if (count($error_detected) == 0) {
     $dyn_fields->setAllFields('contrib', $contrib->id, $contribution['dyn']);
     // Get member informations
     $adh = new Adherent();
     $adh->load($contrib->member);
     if ($preferences->pref_mail_method > GaletteMail::METHOD_DISABLED) {
         $texts = new Texts($texts_fields, $preferences, array('name_adh' => custom_html_entity_decode($adh->sname), 'firstname_adh' => custom_html_entity_decode($adh->surname), 'lastname_adh' => custom_html_entity_decode($adh->name), 'mail_adh' => custom_html_entity_decode($adh->email), 'login_adh' => custom_html_entity_decode($adh->login), 'deadline' => custom_html_entity_decode($contrib->end_date), 'contrib_info' => custom_html_entity_decode($contrib->info), 'contrib_amount' => custom_html_entity_decode($contrib->amount), 'contrib_type' => custom_html_entity_decode($contrib->type->libelle)));
         if ($new && isset($_POST['mail_confirm']) && $_POST['mail_confirm'] == '1') {
             if (GaletteMail::isValidEmail($adh->email)) {
                 $text = 'contrib';
                 if (!$contrib->isCotis()) {
                     $text = 'donation';
                 }
                 $mtxt = $texts->getTexts($text, $adh->language);
                 $mail = new GaletteMail();
                 $mail->setSubject($texts->getSubject());
                 $mail->setRecipients(array($adh->email => $adh->sname));
Beispiel #3
0
                $sent = $mail->send();
                if ($sent == GaletteMail::MAIL_SENT) {
                    $hist->add(str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("New account mail sent to '%s'.")));
                } else {
                    $str = str_replace('%s', $member->sname . ' (' . $member->email . ')', _T("A problem happened while sending new account mail to '%s'"));
                    $hist->add($str);
                    $error_detected[] = $str;
                }
            }
            /** FIXME: query was previously passed as second argument,
             * but it not no longer available from here :/ */
            $hist->add(_T("Self_subscription as a member: ") . strtoupper($adherent['nom_adh']) . ' ' . $adherent['prenom_adh']);
            $head_redirect = array('timeout' => 10, 'url' => 'index.php');
            $has_register = true;
            // dynamic fields
            $dyn_fields->setAllFields('adh', $member->id, $adherent['dyn']);
        } else {
            //something went wrong :'(
            $error_detected[] = _T("An error occured while storing the member.");
        }
    }
} elseif (isset($_POST["update_lang"]) && $_POST["update_lang"] == 1) {
    while (list($key, $properties) = each($fields)) {
        $key = strtolower($key);
        if (isset($_POST[$key])) {
            $adherent[$key] = trim($_POST[$key]);
        } else {
            $adherent[$key] = '';
        }
    }
}