FIX Selection of type "people" for membership must hide the company

This commit is contained in:
Laurent Destailleur 2021-09-15 19:33:30 +02:00
parent 3f7a75b0a3
commit 4a2d3a55d4
2 changed files with 28 additions and 22 deletions

View File

@ -56,7 +56,7 @@ if ($action == 'setMEMBER_ENABLE_PUBLIC') {
if ($action == 'update') { if ($action == 'update') {
$public = GETPOST('MEMBER_ENABLE_PUBLIC'); $public = GETPOST('MEMBER_ENABLE_PUBLIC');
$amount = GETPOST('MEMBER_NEWFORM_AMOUNT'); $amount = price2num(GETPOST('MEMBER_NEWFORM_AMOUNT'), 'MT', 2);
$editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT'); $editamount = GETPOST('MEMBER_NEWFORM_EDITAMOUNT');
$payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE'); $payonline = GETPOST('MEMBER_NEWFORM_PAYONLINE');
$forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int'); $forcetype = GETPOST('MEMBER_NEWFORM_FORCETYPE', 'int');
@ -205,7 +205,7 @@ if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
print '<tr class="oddeven" id="tramount"><td>'; print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("DefaultAmount"); print $langs->trans("DefaultAmount");
print '</td><td class="right">'; print '</td><td class="right">';
print '<input type="text" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" size="5" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">'; print '<input type="text" class="right width75" id="MEMBER_NEWFORM_AMOUNT" name="MEMBER_NEWFORM_AMOUNT" value="'.(!empty($conf->global->MEMBER_NEWFORM_AMOUNT) ? $conf->global->MEMBER_NEWFORM_AMOUNT : '').'">';
print "</td></tr>\n"; print "</td></tr>\n";
// Can edit // Can edit

View File

@ -536,15 +536,16 @@ jQuery(document).ready(function () {
jQuery(document).ready(function () { jQuery(document).ready(function () {
function initmorphy() function initmorphy()
{ {
if (jQuery("#morphy").val()==\'phy\') { console.log("Call initmorphy");
jQuery("#trcompany").hide(); if (jQuery("#morphy").val() == \'phy\') {
} jQuery("#trcompany").hide();
if (jQuery("#morphy").val()==\'mor\') { }
jQuery("#trcompany").show(); if (jQuery("#morphy").val() == \'mor\') {
} jQuery("#trcompany").show();
}
}; };
initmorphy(); initmorphy();
jQuery("#morphy").click(function() { jQuery("#morphy").change(function() {
initmorphy(); initmorphy();
}); });
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
@ -592,21 +593,31 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) {
print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">'; print '<input type="hidden" id="morphy" name="morphy" value="'.$conf->global->MEMBER_NEWFORM_FORCEMORPHY.'">';
} }
// Civility // Company
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print '<input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Title
print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans('UserTitle').'</td><td>';
print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n"; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'</td></tr>'."\n";
// Lastname // Lastname
print '<tr><td>'.$langs->trans("Lastname").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Lastname").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
// Firstname // Firstname
print '<tr><td>'.$langs->trans("Firstname").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Firstname").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
// EMail
print '<tr><td>'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td><input type="text" name="email" maxlength="255" class="minwidth200" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Login
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("Password").' <FONT COLOR="red">*</FONT></td><td><input type="password" maxlength="128" name="pass1" class="minwidth100" value="'.GETPOST("pass1", "nohtml").'"></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", "nohtml").'"></td></tr>'."\n";
}
// Gender // Gender
print '<tr><td>'.$langs->trans("Gender").'</td>'; print '<tr><td>'.$langs->trans("Gender").'</td>';
print '<td>'; print '<td>';
$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"));
print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1);
print '</td></tr>'; print '</td></tr>';
// Company
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Address // Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n"; print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n"; print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
@ -618,7 +629,8 @@ print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'se
print '</td></tr>'; 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'); print img_picto('', 'country', 'class="pictofixedwidth"');
$country_id = GETPOST('country_id', 'int');
if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) {
$country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs);
} }
@ -644,14 +656,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
} }
print '</td></tr>'; print '</td></tr>';
} }
// EMail
print '<tr><td>'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Login
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("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";
}
// Birthday // Birthday
print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>'; print '<tr id="trbirth" class="trbirth"><td>'.$langs->trans("DateOfBirth").'</td><td>';
print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0);
@ -669,7 +673,8 @@ print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>'; print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Add specific fields used by Dolibarr foundation for example // Add specific fields used by Dolibarr foundation for example
// TODO Move this into generic feature.
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>';
@ -712,6 +717,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) {
</script>'; </script>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) {
// $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount