示例#1
0
}
// Action desactivation d'un sous module du module adherent
if ($action == 'unset') {
    $result = dolibarr_del_const($db, $_GET["name"], $conf->entity);
    if ($result < 0) {
        dol_print_error($db);
    }
}
if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf->global->ADHERENT_USE_MAILMAN)) {
    $email = GETPOST($action . 'email');
    if (!isValidEmail($email)) {
        $langs->load("errors");
        setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors');
    } else {
        include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
        $mailmanspip = new MailmanSpip($db);
        $object = new stdClass();
        $object->email = $email;
        $object->pass = $email;
        /*$object->element='member';
          $object->type='Preferred Partners'; */
        if ($action == 'testsubscribe') {
            $result = $mailmanspip->add_to_mailman($object);
            if ($result < 0) {
                $error++;
                setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors');
            } else {
                setEventMessages($langs->trans("MailmanCreationSuccess"), null);
            }
        }
        if ($action == 'testunsubscribe') {
 /**
  *  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;
     }
 }
示例#3
0
         if ($user->rights->adherent->supprimer) {
             print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $rowid . '&action=resign">' . $langs->trans("Resiliate") . "</a>\n";
         } else {
             print "<font class=\"butActionRefused\" href=\"#\" title=\"" . dol_escape_htmltag($langs->trans("NotEnoughPermissions")) . "\">" . $langs->trans("Resiliate") . "</font>";
         }
     }
     // Delete
     if ($user->rights->adherent->supprimer) {
         print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete">' . $langs->trans("Delete") . "</a>\n";
     } else {
         print "<font class=\"butActionRefused\" href=\"#\" title=\"" . dol_escape_htmltag($langs->trans("NotEnoughPermissions")) . "\">" . $langs->trans("Delete") . "</font>";
     }
     // Action SPIP
     if ($conf->mailmanspip->enabled && $conf->global->ADHERENT_USE_SPIP) {
         include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
         $mailmanspip = new MailmanSpip($db);
         $isinspip = $mailmanspip->is_in_spip($object);
         if ($isinspip == 1) {
             print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=$object->id&action=del_spip">' . $langs->trans("DeleteIntoSpip") . "</a>\n";
         }
         if ($isinspip == 0) {
             print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=$object->id&action=add_spip\\">' . $langs->trans("AddIntoSpip") . "</a>\n";
         }
         if ($isinspip == -1) {
             print '<br><br><font class="error">Failed to connect to SPIP: ' . $object->error . '</font>';
         }
     }
 }
 print '</div>';
 print end_box();
 print "</div>";
示例#4
0
$langs->load("bills");
$langs->load("members");
$langs->load("users");
$langs->load('other');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel');
$backtopage = GETPOST('backtopage', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$rowid = GETPOST('rowid', 'int');
$typeid = GETPOST('typeid', 'int');
$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
if (!empty($conf->mailmanspip->enabled)) {
    include_once DOL_DOCUMENT_ROOT . '/mailmanspip/class/mailmanspip.class.php';
    $langs->load('mailmanspip');
    $mailmanspip = new MailmanSpip($db);
}
$object = new Adherent($db);
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$object->getCanvas($rowid);
$canvas = $object->canvas ? $object->canvas : GETPOST("canvas");
$objcanvas = null;
if (!empty($canvas)) {
    require_once DOL_DOCUMENT_ROOT . '/core/class/canvas.class.php';
    $objcanvas = new Canvas($db, $action);
    $objcanvas->getCanvas('adherent', 'membercard', $canvas);
}
// Security check
示例#5
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;
     }
 }