Esempio n. 1
0
                    setEventMessages($object->error, $object->errors, 'errors');
                } else {
                    setEventMessages($object->error, $object->errors, 'errors');
                }
                $action = '';
            }
        }
        if (!empty($backtopage) && !$error) {
            header("Location: " . $backtopage);
            exit;
        }
    }
    // SPIP Management
    if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') {
        if (!count($object->errors)) {
            if (!$mailmanspip->del_to_spip($object)) {
                setEventMessages($langs->trans('DeleteIntoSpipError') . ': ' . $mailmanspip->error, null, 'errors');
            }
        }
    }
    if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') {
        if (!count($object->errors)) {
            if (!$mailmanspip->add_to_spip($object)) {
                setEventMessages($langs->trans('AddIntoSpipError') . ': ' . $mailmanspip->error, null, 'errors');
            }
        }
    }
}
/*
 * View
 */
 /**
  *  Function to delete a member from external tools like mailing-list, spip, etc.
  *
  *  @return     int     <0 if KO, >0 if OK
  */
 function del_to_abo()
 {
     global $conf, $langs;
     include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
     $mailmanspip = new MailmanSpip($this->db);
     $err = 0;
     // mailman
     if (!empty($conf->global->ADHERENT_USE_MAILMAN)) {
         $result = $mailmanspip->del_to_mailman($this);
         if ($result < 0) {
             if (!empty($mailmanspip->error)) {
                 $this->errors[] = $mailmanspip->error;
             }
             $err += 1;
         }
         foreach ($mailmanspip->mlremoved_ko as $tmplist => $tmpemail) {
             $langs->load("errors");
             $this->errors[] = $langs->trans("ErrorFailedToRemoveToMailmanList", $tmpemail, $tmplist);
         }
         foreach ($mailmanspip->mlremoved_ok as $tmplist => $tmpemail) {
             $langs->load("mailmanspip");
             $this->mesgs[] = $langs->trans("SuccessToRemoveToMailmanList", $tmpemail, $tmplist);
         }
     }
     if ($conf->global->ADHERENT_USE_SPIP && !empty($conf->mailmanspip->enabled)) {
         $result = $mailmanspip->del_to_spip($this);
         if ($result < 0) {
             $this->errors[] = $mailmanspip->error;
             $err += 1;
         }
     }
     if ($err) {
         // error
         return -$err;
     } else {
         return 1;
     }
 }
Esempio n. 3
0
 /**
  *  Fonction qui supprime l'adherent des abonnements automatiques mailing-list, spip, etc.
  *  TODO Move this into member deletion trigger (trigger of mailmanspip module)
  *
  *  @return     int     <0 if KO, >0 if OK
  */
 function del_to_abo()
 {
     global $conf;
     include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
     $mailmanspip = new MailmanSpip($db);
     $err = 0;
     // mailman
     if (!empty($conf->global->ADHERENT_USE_MAILMAN)) {
         $result = $mailmanspip->del_to_mailman($this);
         if ($result < 0) {
             $err += 1;
         }
     }
     if ($conf->global->ADHERENT_USE_SPIP && $conf->mailmanspip->enabled) {
         $result = $mailmanspip->del_to_spip($this);
         if ($result < 0) {
             $err += 1;
         }
     }
     if ($err) {
         // error
         return -$err;
     } else {
         return 1;
     }
 }