fix empty array
This commit is contained in:
parent
76a0eba1a0
commit
8e77ac4eb0
@ -67,8 +67,7 @@ $langs->loadLangs(array("main", "members", "companies", "install", "other"));
|
|||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
|
if (empty($conf->adherent->enabled)) accessforbidden('', 0, 0, 1);
|
||||||
|
|
||||||
if (empty($conf->global->MEMBER_ENABLE_PUBLIC))
|
if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||||
{
|
|
||||||
print $langs->trans("Auto subscription form for public visitors has not been enabled");
|
print $langs->trans("Auto subscription form for public visitors has not been enabled");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -105,21 +104,17 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
|
|||||||
// Define urllogo
|
// Define urllogo
|
||||||
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
|
$urllogo = DOL_URL_ROOT.'/theme/common/login_logo.png';
|
||||||
|
|
||||||
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
|
if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||||
{
|
|
||||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
|
||||||
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
|
} elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||||
{
|
|
||||||
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo);
|
$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo);
|
||||||
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg'))
|
} elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) {
|
||||||
{
|
|
||||||
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
|
$urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
// Output html code for logo
|
// Output html code for logo
|
||||||
if ($urllogo)
|
if ($urllogo) {
|
||||||
{
|
|
||||||
print '<div class="backgreypublicpayment">';
|
print '<div class="backgreypublicpayment">';
|
||||||
print '<div class="logopublicpayment">';
|
print '<div class="logopublicpayment">';
|
||||||
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
|
||||||
@ -155,7 +150,7 @@ function llxFooterVierge()
|
|||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
$parameters = array('');
|
$parameters = array();
|
||||||
// Note that $action and $object may have been modified by some hooks
|
// Note that $action and $object may have been modified by some hooks
|
||||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
||||||
if ($reshook < 0) {
|
if ($reshook < 0) {
|
||||||
@ -170,74 +165,60 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
// test if login already exists
|
// test if login already exists
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
{
|
if (!GETPOST('login')) {
|
||||||
if (!GETPOST('login'))
|
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
|
||||||
}
|
}
|
||||||
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
|
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
}
|
}
|
||||||
if ($num != 0)
|
if ($num != 0) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
|
$errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
|
||||||
}
|
}
|
||||||
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"] != $_POST["pass2"])
|
if (!isset($_POST["pass1"]) || !isset($_POST["pass2"]) || $_POST["pass1"] == '' || $_POST["pass2"] == '' || $_POST["pass1"] != $_POST["pass2"]) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
|
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
|
||||||
}
|
}
|
||||||
if (!GETPOST("email"))
|
if (!GETPOST("email")) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (GETPOST('type') <= 0)
|
if (GETPOST('type') <= 0) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
|
||||||
}
|
}
|
||||||
if (!in_array(GETPOST('morphy'), array('mor', 'phy')))
|
if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
|
||||||
}
|
}
|
||||||
if (empty($_POST["lastname"]))
|
if (empty($_POST["lastname"])) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
|
||||||
}
|
}
|
||||||
if (empty($_POST["firstname"]))
|
if (empty($_POST["firstname"])) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
|
||||||
}
|
}
|
||||||
if (GETPOST("email") && !isValidEmail(GETPOST("email")))
|
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
|
||||||
}
|
}
|
||||||
$birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
|
$birthday = dol_mktime($_POST["birthhour"], $_POST["birthmin"], $_POST["birthsec"], $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]);
|
||||||
if ($_POST["birthmonth"] && empty($birthday))
|
if ($_POST["birthmonth"] && empty($birthday)) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
|
$errmsg .= $langs->trans("ErrorBadDateFormat")."<br>\n";
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER))
|
if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
|
||||||
{
|
if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0) {
|
||||||
if (GETPOST("morphy") == 'mor' && GETPOST('budget') <= 0)
|
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."<br>\n";
|
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("TurnoverOrBudget"))."<br>\n";
|
||||||
}
|
}
|
||||||
@ -246,8 +227,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
if (isset($public)) $public = 1;
|
if (isset($public)) $public = 1;
|
||||||
else $public = 0;
|
else $public = 0;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
// email a peu pres correct et le login n'existe pas
|
// email a peu pres correct et le login n'existe pas
|
||||||
$adh = new Adherent($db);
|
$adh = new Adherent($db);
|
||||||
$adh->statut = -1;
|
$adh->statut = -1;
|
||||||
@ -261,8 +241,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$adh->zip = $_POST["zipcode"];
|
$adh->zip = $_POST["zipcode"];
|
||||||
$adh->town = $_POST["town"];
|
$adh->town = $_POST["town"];
|
||||||
$adh->email = $_POST["email"];
|
$adh->email = $_POST["email"];
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
{
|
|
||||||
$adh->login = $_POST["login"];
|
$adh->login = $_POST["login"];
|
||||||
$adh->pass = $_POST["pass1"];
|
$adh->pass = $_POST["pass1"];
|
||||||
}
|
}
|
||||||
@ -281,16 +260,14 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result = $adh->create($user);
|
$result = $adh->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0) {
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||||
$object = $adh;
|
$object = $adh;
|
||||||
|
|
||||||
$adht = new AdherentType($db);
|
$adht = new AdherentType($db);
|
||||||
$adht->fetch($object->typeid);
|
$adht->fetch($object->typeid);
|
||||||
|
|
||||||
if ($object->email)
|
if ($object->email) {
|
||||||
{
|
|
||||||
$subject = '';
|
$subject = '';
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
@ -308,8 +285,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
|
|
||||||
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
|
||||||
|
|
||||||
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||||
{
|
|
||||||
$subject = $arraydefaultmessage->topic;
|
$subject = $arraydefaultmessage->topic;
|
||||||
$msg = $arraydefaultmessage->content;
|
$msg = $arraydefaultmessage->content;
|
||||||
}
|
}
|
||||||
@ -319,14 +295,12 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
|
||||||
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
|
||||||
|
|
||||||
if ($subjecttosend && $texttosend)
|
if ($subjecttosend && $texttosend) {
|
||||||
{
|
|
||||||
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
|
||||||
|
|
||||||
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
|
||||||
}
|
}
|
||||||
/*if ($result < 0)
|
/*if ($result < 0) {
|
||||||
{
|
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}*/
|
}*/
|
||||||
@ -334,18 +308,17 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
|
|
||||||
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
// Send email to the foundation to say a new member subscribed with autosubscribe form
|
||||||
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
|
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
|
||||||
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL))
|
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
|
||||||
{
|
|
||||||
// Define link to login card
|
// Define link to login card
|
||||||
$appli = constant('DOL_APPLICATION_TITLE');
|
$appli = constant('DOL_APPLICATION_TITLE');
|
||||||
if (!empty($conf->global->MAIN_APPLICATION_TITLE))
|
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
|
||||||
{
|
|
||||||
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
$appli = $conf->global->MAIN_APPLICATION_TITLE;
|
||||||
if (preg_match('/\d\.\d/', $appli))
|
if (preg_match('/\d\.\d/', $appli)) {
|
||||||
{
|
|
||||||
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
|
||||||
} else $appli .= " ".DOL_VERSION;
|
} else $appli .= " ".DOL_VERSION;
|
||||||
} else $appli .= " ".DOL_VERSION;
|
} else {
|
||||||
|
$appli .= " ".DOL_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
|
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
|
||||||
$from = $conf->global->ADHERENT_MAIL_FROM;
|
$from = $conf->global->ADHERENT_MAIL_FROM;
|
||||||
@ -363,72 +336,60 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
-1
|
-1
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$mailfile->sendfile())
|
if (!$mailfile->sendfile()) {
|
||||||
{
|
|
||||||
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
|
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($backtopage)) $urlback = $backtopage;
|
if (!empty($backtopage)) {
|
||||||
elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION))
|
$urlback = $backtopage;
|
||||||
{
|
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
|
||||||
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
|
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
|
||||||
// TODO Make replacement of __AMOUNT__, etc...
|
// TODO Make replacement of __AMOUNT__, etc...
|
||||||
} else $urlback = $_SERVER["PHP_SELF"]."?action=added";
|
} else {
|
||||||
|
$urlback = $_SERVER["PHP_SELF"]."?action=added";
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1')
|
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
|
||||||
{
|
if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') {
|
||||||
if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all')
|
|
||||||
{
|
|
||||||
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
$urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||||
{
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
|
|
||||||
{
|
|
||||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||||
} else {
|
} else {
|
||||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox')
|
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') {
|
||||||
{
|
|
||||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
$urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||||
{
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
|
|
||||||
{
|
|
||||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||||
} else {
|
} else {
|
||||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
|
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') {
|
||||||
{
|
|
||||||
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
$urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref);
|
||||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||||
{
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
|
|
||||||
{
|
|
||||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||||
} else {
|
} else {
|
||||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe')
|
} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') {
|
||||||
{
|
|
||||||
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
$urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||||
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha'));
|
||||||
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback .= '&email='.urlencode(GETPOST('email'));
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN))
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) {
|
||||||
{
|
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) {
|
||||||
if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE))
|
|
||||||
{
|
|
||||||
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
$urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2));
|
||||||
} else {
|
} else {
|
||||||
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
$urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN);
|
||||||
@ -448,8 +409,7 @@ if (empty($reshook) && $action == 'add') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error)
|
if (!$error) {
|
||||||
{
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
Header("Location: ".$urlback);
|
Header("Location: ".$urlback);
|
||||||
@ -497,8 +457,11 @@ print '<div align="center">';
|
|||||||
print '<div id="divsubscribe">';
|
print '<div id="divsubscribe">';
|
||||||
|
|
||||||
print '<div class="center subscriptionformhelptext justify">';
|
print '<div class="center subscriptionformhelptext justify">';
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."<br>\n";
|
if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) {
|
||||||
else print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."<br>\n";
|
print $langs->trans($conf->global->MEMBER_NEWFORM_TEXT)."<br>\n";
|
||||||
|
} else {
|
||||||
|
print $langs->trans("NewSubscriptionDesc", $conf->global->MAIN_INFO_SOCIETE_MAIL)."<br>\n";
|
||||||
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
dol_htmloutput_errors($errmsg);
|
dol_htmloutput_errors($errmsg);
|
||||||
@ -544,13 +507,15 @@ jQuery(document).ready(function () {
|
|||||||
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
|
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
|
||||||
|
|
||||||
// Type
|
// Type
|
||||||
if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE))
|
if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
|
||||||
{
|
|
||||||
$listoftype = $adht->liste_array();
|
$listoftype = $adht->liste_array();
|
||||||
$tmp = array_keys($listoftype);
|
$tmp = array_keys($listoftype);
|
||||||
$defaulttype = '';
|
$defaulttype = '';
|
||||||
$isempty = 1;
|
$isempty = 1;
|
||||||
if (count($listoftype) == 1) { $defaulttype = $tmp[0]; $isempty = 0; }
|
if (count($listoftype) == 1) {
|
||||||
|
$defaulttype = $tmp[0];
|
||||||
|
$isempty = 0;
|
||||||
|
}
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Type").' <FONT COLOR="red">*</FONT></td><td>';
|
print '<tr><td class="titlefield">'.$langs->trans("Type").' <FONT COLOR="red">*</FONT></td><td>';
|
||||||
print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty);
|
print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -561,8 +526,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE))
|
|||||||
// Moral/Physic attribute
|
// Moral/Physic attribute
|
||||||
$morphys["phy"] = $langs->trans("Physical");
|
$morphys["phy"] = $langs->trans("Physical");
|
||||||
$morphys["mor"] = $langs->trans("Moral");
|
$morphys["mor"] = $langs->trans("Moral");
|
||||||
if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY))
|
if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
|
||||||
{
|
|
||||||
print '<tr class="morphy"><td class="titlefield">'.$langs->trans('MemberNature').' <FONT COLOR="red">*</FONT></td><td>'."\n";
|
print '<tr class="morphy"><td class="titlefield">'.$langs->trans('MemberNature').' <FONT COLOR="red">*</FONT></td><td>'."\n";
|
||||||
print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
|
print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
@ -597,13 +561,13 @@ print '</td></tr>';
|
|||||||
// Country
|
// Country
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
print '<tr><td>'.$langs->trans('Country').'</td><td>';
|
||||||
$country_id = GETPOST('country_id');
|
$country_id = GETPOST('country_id');
|
||||||
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
|
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
|
||||||
if (!$country_id && !empty($conf->geoipmaxmind->enabled))
|
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
|
||||||
{
|
}
|
||||||
|
if (!$country_id && !empty($conf->geoipmaxmind->enabled)) {
|
||||||
$country_code = dol_user_country();
|
$country_code = dol_user_country();
|
||||||
//print $country_code;
|
//print $country_code;
|
||||||
if ($country_code)
|
if ($country_code) {
|
||||||
{
|
|
||||||
$new_country_id = getCountry($country_code, 3, $db, $langs);
|
$new_country_id = getCountry($country_code, 3, $db, $langs);
|
||||||
//print 'xxx'.$country_code.' - '.$new_country_id;
|
//print 'xxx'.$country_code.' - '.$new_country_id;
|
||||||
if ($new_country_id) $country_id = $new_country_id;
|
if ($new_country_id) $country_id = $new_country_id;
|
||||||
@ -613,8 +577,7 @@ $country_code = getCountry($country_id, 2, $db, $langs);
|
|||||||
print $form->select_country($country_id, 'country_id');
|
print $form->select_country($country_id, 'country_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
// State
|
// State
|
||||||
if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
print '<tr><td>'.$langs->trans('State').'</td><td>';
|
||||||
if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
if ($country_code) print $formcompany->select_state(GETPOST("state_id"), $country_code);
|
||||||
else print '';
|
else print '';
|
||||||
@ -623,8 +586,7 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE))
|
|||||||
// EMail
|
// EMail
|
||||||
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
|
||||||
// Login
|
// Login
|
||||||
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
|
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";
|
||||||
print '<tr><td>'.$langs->trans("Password").' <FONT COLOR="red">*</FONT></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.GETPOST("pass1").'"></td></tr>'."\n";
|
print '<tr><td>'.$langs->trans("Password").' <FONT COLOR="red">*</FONT></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.GETPOST("pass1").'"></td></tr>'."\n";
|
||||||
print '<tr><td>'.$langs->trans("PasswordAgain").' <FONT COLOR="red">*</FONT></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.GETPOST("pass2").'"></td></tr>'."\n";
|
print '<tr><td>'.$langs->trans("PasswordAgain").' <FONT COLOR="red">*</FONT></td><td><input type="password" maxlength="128" name="pass2" class="minwidth100" value="'.GETPOST("pass2").'"></td></tr>'."\n";
|
||||||
@ -647,8 +609,7 @@ print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="s
|
|||||||
print '</tr>'."\n";
|
print '</tr>'."\n";
|
||||||
|
|
||||||
// Add specific fields used by Dolibarr foundation for example
|
// Add specific fields used by Dolibarr foundation for example
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER))
|
if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
|
||||||
{
|
|
||||||
$arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+');
|
$arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+');
|
||||||
print '<tr id="trbudget" class="trcompany"><td>'.$langs->trans("TurnoverOrBudget").' <FONT COLOR="red">*</FONT></td><td>';
|
print '<tr id="trbudget" class="trcompany"><td>'.$langs->trans("TurnoverOrBudget").' <FONT COLOR="red">*</FONT></td><td>';
|
||||||
print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1);
|
print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1);
|
||||||
@ -690,23 +651,19 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER))
|
|||||||
</script>';
|
</script>';
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)
|
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
|
||||||
|| !empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
|
|
||||||
{
|
|
||||||
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount
|
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount
|
||||||
$amount = 0;
|
$amount = 0;
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
|
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
|
||||||
$amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
|
$amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE))
|
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
|
||||||
{
|
|
||||||
$amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT;
|
$amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT;
|
||||||
}
|
}
|
||||||
// $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
|
// $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
|
||||||
print '<tr><td>'.$langs->trans("Subscription").'</td><td class="nowrap">';
|
print '<tr><td>'.$langs->trans("Subscription").'</td><td class="nowrap">';
|
||||||
if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT))
|
if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) {
|
||||||
{
|
|
||||||
print '<input type="text" name="amount" id="amount" class="flat amount" size="6" value="'.$amount.'">';
|
print '<input type="text" name="amount" id="amount" class="flat amount" size="6" value="'.$amount.'">';
|
||||||
} else {
|
} else {
|
||||||
print '<input type="text" name="amount" id="amounthidden" class="flat amount" disabled size="6" value="'.$amount.'">';
|
print '<input type="text" name="amount" id="amounthidden" class="flat amount" disabled size="6" value="'.$amount.'">';
|
||||||
@ -722,8 +679,7 @@ dol_fiche_end();
|
|||||||
// Save
|
// Save
|
||||||
print '<div class="center">';
|
print '<div class="center">';
|
||||||
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
|
print '<input type="submit" value="'.$langs->trans("Submit").'" id="submitsave" class="button">';
|
||||||
if (!empty($backtopage))
|
if (!empty($backtopage)) {
|
||||||
{
|
|
||||||
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button">';
|
print ' <input type="submit" value="'.$langs->trans("Cancel").'" id="submitcancel" class="button">';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user