Пример #1
0
/** @ignore */
require_once 'includes/galette.inc.php';
if (!$login->isLogged()) {
    header('location: index.php');
    die;
}
$deps = array('picture' => true, 'groups' => true, 'dues' => true, 'parent' => true, 'children' => true);
$member = new Adherent(null, $deps);
//TODO: dynamic fields should be handled by Adherent object
$dyn_fields = new DynamicFields();
// new or edit
$adherent['id_adh'] = get_numeric_form_value('id_adh', '');
if ($login->isAdmin() || $login->isStaff() || $login->isGroupManager()) {
    $adherent['id_adh'] = get_numeric_form_value('id_adh', '');
    if ($adherent['id_adh']) {
        $member->load($adherent['id_adh']);
        if (!$login->isAdmin() && !$login->isStaff() && $login->isGroupManager()) {
            //check if current logged in user can manage loaded member
            $groups = $member->groups;
            $can_manage = false;
            foreach ($groups as $group) {
                if ($login->isGroupManager($group->getId())) {
                    $can_manage = true;
                    break;
                }
            }
            if ($can_manage !== true) {
                Analog::log('Logged in member ' . $login->login . ' has tried to load member #' . $member->id . ' but do not manage any groups he belongs to.', Analog::WARNING);
                $member->load($login->id);
            }
        }
Пример #2
0
                             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));
                 $mail->setMessage($texts->getBody());
                 $sent = $mail->send();
                 if ($sent) {
Пример #3
0
$fc = new FieldsConfig(Adherent::TABLE, $members_fields, $members_fields_cats);
$visibles = $fc->getVisibilities();
if ($login->id != $id_adh && !$login->isAdmin() && !$login->isStaff()) {
    //check if requested member is part of managed groups
    $groups = $member->groups;
    $is_managed = false;
    foreach ($groups as $g) {
        if ($login->isGroupManager($g->getId())) {
            $is_managed = true;
            break;
        }
    }
    if ($is_managed !== true) {
        //requested member is not part of managed groups, fall back to logged
        //in member
        $member->load($login->id);
    }
}
$navigate = array();
if (isset($session['filters']['members'])) {
    $filters = unserialize($session['filters']['members']);
} else {
    $filters = new MembersList();
}
if ($login->isAdmin() || $login->isStaff()) {
    $m = new Members($filters);
    $ids = $m->getList(false, array(Adherent::PK, 'nom_adh', 'prenom_adh'));
    $ids = $ids->toArray();
    foreach ($ids as $k => $m) {
        if ($m['id_adh'] == $member->id) {
            $navigate = array('cur' => $m['id_adh'], 'count' => count($ids), 'pos' => $k + 1);