| '.$langs->trans('Zip').' / '.$langs->trans('Town').' | ';
-print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
-print ' / ';
-print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
-print ' |
';
-// Country
-print '| '.$langs->trans('Country').' | ';
-print img_picto('', 'country', 'class="pictofixedwidth"');
-$country_id = GETPOST('country_id', 'int');
-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->geoipmaxmind->enabled)) {
- $country_code = dol_user_country();
- //print $country_code;
- if ($country_code) {
- $new_country_id = getCountry($country_code, 3, $db, $langs);
- //print 'xxx'.$country_code.' - '.$new_country_id;
- if ($new_country_id) {
- $country_id = $new_country_id;
- }
- }
-}
-$country_code = getCountry($country_id, 2, $db, $langs);
-print $form->select_country($country_id, 'country_id');
-print ' |
';
-// State
-if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
- print ''."\n";
- // Clean the amount
- $amount = price2num($amount);
- $adht = new AdherentType($db);
- $adht->fetch($typeid);
- $caneditamount = $adht->caneditamount;
- $showedamount = $amount>0? $amount: 0;
- // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
- print '| '.$langs->trans("Subscription");
- if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) {
- print ' - '.$langs->trans("SeeHere").'';
- }
- print ' | ';
-
- if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
- $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
- }
-
- if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $caneditamount) {
- print '';
- print ' '.$langs->trans("Currency".$conf->currency).' – ';
- print $amount>0? $langs->trans("AnyAmountWithAdvisedAmount", $amount, $langs->trans("Currency".$conf->currency)): $langs->trans("AnyAmountWithoutAdvisedAmount");
- print '';
+ // Type
+ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) {
+ $listoftype = $adht->liste_array();
+ $tmp = array_keys($listoftype);
+ $defaulttype = '';
+ $isempty = 1;
+ if (count($listoftype) == 1) {
+ $defaulttype = $tmp[0];
+ $isempty = 0;
+ }
+ print ' |
| '.$langs->trans("Type").' * | ';
+ print $form->selectarray("typeid", $adht->liste_array(1), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty);
+ print ' |
'."\n";
} else {
- print '';
- print '';
- print ' '.$langs->trans("Currency".$conf->currency);
+ $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE);
+ print '';
}
+
+ // Moral/Physic attribute
+ $morphys["phy"] = $langs->trans("Physical");
+ $morphys["mor"] = $langs->trans("Moral");
+ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
+ print '| '.$langs->trans('MemberNature').' * | '."\n";
+ print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
+ print ' |
'."\n";
+ } else {
+ print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY];
+ print '';
+ }
+
+ // Company
+ print '| '.$langs->trans("Company").' | ';
+ print img_picto('', 'company', 'class="pictofixedwidth"');
+ print ' |
'."\n";
+ // Title
+ print '| '.$langs->trans('UserTitle').' | ';
+ print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').' |
'."\n";
+ // Lastname
+ print '| '.$langs->trans("Lastname").' * | |
'."\n";
+ // Firstname
+ print '| '.$langs->trans("Firstname").' * | |
'."\n";
+ // EMail
+ print '| '.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' *' : '').' | ';
+ //print img_picto('', 'email', 'class="pictofixedwidth"');
+ print ' |
'."\n";
+ // Login
+ if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
+ print '| '.$langs->trans("Login").' * | |
'."\n";
+ print '| '.$langs->trans("Password").' * | |
'."\n";
+ print '| '.$langs->trans("PasswordAgain").' * | |
'."\n";
+ }
+ // Gender
+ print '| '.$langs->trans("Gender").' | ';
+ print '';
+ $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
+ print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
print ' |
';
+ // Address
+ print '| '.$langs->trans("Address").' | '."\n";
+ print ' |
'."\n";
+ // Zip / Town
+ print '| '.$langs->trans('Zip').' / '.$langs->trans('Town').' | ';
+ print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 1, '', 'width75');
+ print ' / ';
+ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1);
+ print ' |
';
+ // Country
+ print '| '.$langs->trans('Country').' | ';
+ print img_picto('', 'country', 'class="pictofixedwidth"');
+ $country_id = GETPOST('country_id', 'int');
+ 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->geoipmaxmind->enabled)) {
+ $country_code = dol_user_country();
+ //print $country_code;
+ if ($country_code) {
+ $new_country_id = getCountry($country_code, 3, $db, $langs);
+ //print 'xxx'.$country_code.' - '.$new_country_id;
+ if ($new_country_id) {
+ $country_id = $new_country_id;
+ }
+ }
+ }
+ $country_code = getCountry($country_id, 2, $db, $langs);
+ print $form->select_country($country_id, 'country_id');
+ print ' |
';
+ // State
+ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
+ print '| '.$langs->trans('State').' | ';
+ if ($country_code) {
+ print $formcompany->select_state(GETPOST("state_id"), $country_code);
+ }
+ print ' |
';
+ }
+ // Birthday
+ print '| '.$langs->trans("DateOfBirth").' | ';
+ print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0);
+ print ' |
'."\n";
+ // Photo
+ print '| '.$langs->trans("URLPhoto").' | |
'."\n";
+ // Public
+ print '| '.$langs->trans("Public").' | |
'."\n";
+ // Other attributes
+ $tpl_context = 'public'; // define template context to public
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
+ // Comments
+ print '';
+ print '| '.$langs->trans("Comments").' | ';
+ print ' | ';
+ print '
'."\n";
+
+ // Add specific fields used by Dolibarr foundation for example
+ // TODO Move this into generic feature.
+ 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+');
+ print '| '.$langs->trans("TurnoverOrBudget").' * | ';
+ print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1);
+ print ' € or $';
+
+ print '';
+ print ' |
'."\n";
+ }
+
+ if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
+ $amount = 0;
+ $typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE : GETPOST('typeid', 'int');
+
+ // Set amount for the subscription:
+ // - First check the amount of the member type.
+ $amountbytype = $adht->amountByType(1); // Load the array of amount per type
+ $amount = empty($amountbytype[$typeid]) ? (isset($amount) ? $amount : 0) : $amountbytype[$typeid];
+ // - If not found, take the default amount
+ if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
+ $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
+ }
+ // - If not set, we accept ot have amount defined as parameter (for backward compatibility).
+ if (empty($amount)) {
+ $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : '');
+ }
+
+ // Clean the amount
+ $amount = price2num($amount);
+ $adht = new AdherentType($db);
+ $adht->fetch($typeid);
+ $caneditamount = $adht->caneditamount;
+ $showedamount = $amount>0? $amount: 0;
+ // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe'
+ print '| '.$langs->trans("Subscription");
+ if (!empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) {
+ print ' - '.$langs->trans("SeeHere").'';
+ }
+ print ' | ';
+
+ if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) {
+ $amount = $conf->global->MEMBER_NEWFORM_AMOUNT;
+ }
+
+ if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT) || $caneditamount) {
+ print '';
+ print ' '.$langs->trans("Currency".$conf->currency).' – ';
+ print $amount>0? $langs->trans("AnyAmountWithAdvisedAmount", $amount, $langs->trans("Currency".$conf->currency)): $langs->trans("AnyAmountWithoutAdvisedAmount");
+ print '';
+ } else {
+ print '';
+ print '';
+ print ' '.$langs->trans("Currency".$conf->currency);
+ }
+ print ' |
';
+ }
+
+ print "
\n";
+
+ print dol_get_fiche_end();
+
+ // Save
+ print '