Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update change select to button on/off #31443

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
47 changes: 23 additions & 24 deletions htdocs/user/virtualcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,18 @@

if ($action == 'update' && $permissiontoedit) {
$tmparray = array();
$tmparray['USER_PUBLIC_HIDE_PHOTO'] = (GETPOST('USER_PUBLIC_HIDE_PHOTO') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_EMAIL'] = (GETPOST('USER_PUBLIC_HIDE_EMAIL') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
$tmparray['USER_PUBLIC_SHOW_BIRTH'] = (GETPOST('USER_PUBLIC_SHOW_BIRTH') ? 1 : 0);
$tmparray['USER_PUBLIC_SHOW_ADDRESS'] = (GETPOST('USER_PUBLIC_SHOW_ADDRESS') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_COMPANY'] = (GETPOST('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_JOBPOSITION'] = (GETPOST('USER_PUBLIC_HIDE_JOBPOSITION') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_OFFICE_FAX'] = (GETPOST('USER_PUBLIC_HIDE_OFFICE_FAX') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (GETPOST('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS'] = (GETPOST('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS') ? 1 : 0);
$tmparray['USER_PUBLIC_MORE'] = (GETPOST('USER_PUBLIC_MORE') ? GETPOST('USER_PUBLIC_MORE') : '');

$tmparray['USER_PUBLIC_HIDE_PHOTO'] = (getDolGlobalString('USER_PUBLIC_HIDE_PHOTO') ? 1 : 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because all option ate now set by ajax, we don't need any more this part of cor. Except for the "note". For it, we can keep old code to have the note saved from the user choice (so using GETPOST).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok i fix it and i complete the process

$tmparray['USER_PUBLIC_HIDE_EMAIL'] = (getDolGlobalString('USER_PUBLIC_HIDE_EMAIL') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS'] = (getDolGlobalString('USER_PUBLIC_HIDE_SOCIALNETWORKS') ? 1 : 0);
$tmparray['USER_PUBLIC_SHOW_BIRTH'] = (getDolGlobalString('USER_PUBLIC_SHOW_BIRTH') ? 1 : 0);
$tmparray['USER_PUBLIC_SHOW_ADDRESS'] = (getDolGlobalString('USER_PUBLIC_SHOW_ADDRESS') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_COMPANY'] = (getDolGlobalString('USER_PUBLIC_HIDE_COMPANY') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_JOBPOSITION'] = (getDolGlobalString('USER_PUBLIC_HIDE_JOBPOSITION') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_OFFICE_PHONE'] = (getDolGlobalString('USER_PUBLIC_HIDE_OFFICE_PHONE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_OFFICE_FAX'] = (getDolGlobalString('USER_PUBLIC_HIDE_OFFICE_FAX') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_USER_MOBILE'] = (getDolGlobalString('USER_PUBLIC_HIDE_USER_MOBILE') ? 1 : 0);
$tmparray['USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS'] = (getDolGlobalString('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS') ? 1 : 0);
$tmparray['USER_PUBLIC_MORE'] = (getDolGlobalString('USER_PUBLIC_MORE') ? getDolGlobalString('USER_PUBLIC_MORE') : '');
dol_set_user_param($db, $conf, $object, $tmparray);
}

Expand Down Expand Up @@ -204,63 +203,63 @@ function hideoptions(domelem) {
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Photo"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_PHOTO", (getDolUserInt('USER_PUBLIC_HIDE_PHOTO', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_PHOTO', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_PHOTO", array(), null, 0, 0, 0);
print "</td></tr>\n";

// Job position
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PostOrFunction"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_JOBPOSITION", (getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_JOBPOSITION', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_JOBPOSITION");
print "</td></tr>\n";

// Email
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Email"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_EMAIL", (getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_EMAIL', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_EMAIL");
print "</td></tr>\n";

// Office phone
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhonePro"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_PHONE", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_PHONE', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_PHONE");
print "</td></tr>\n";

// Office fax
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("Fax"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_OFFICE_FAX", (getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_OFFICE_FAX', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_OFFICE_FAX");
print "</td></tr>\n";

// User mobile
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("PhoneMobile"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_USER_MOBILE", (getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_USER_MOBILE', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_USER_MOBILE");
print "</td></tr>\n";

// Social networks
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS");
print "</td></tr>\n";

// Birth date
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Birthdate"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_SHOW_BIRTH", (getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object) ? getDolUserInt('USER_PUBLIC_SHOW_BIRTH', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_SHOW_BIRTH");
print "</td></tr>\n";

// Address
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("ShowOnVCard", $langs->transnoentitiesnoconv("Address"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_SHOW_ADDRESS", (getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object) ? getDolUserInt('USER_PUBLIC_SHOW_ADDRESS', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_SHOW_ADDRESS");
print "</td></tr>\n";

print '<tr class="liste_titre">';
Expand All @@ -272,14 +271,14 @@ function hideoptions(domelem) {
print '<tr class="oddeven" id="tramount"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("CompanySection"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_COMPANY", (getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_COMPANY");
print "</td></tr>\n";

// Social networks
print '<tr class="oddeven" id="tredit"><td>';
print $langs->trans("HideOnVCard", $langs->transnoentitiesnoconv("SocialNetworksInformation"));
print '</td><td>';
print $form->selectyesno("USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS", (getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) ? getDolUserInt('USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS', 0, $object) : 0), 1);
print ajax_constantonoff("USER_PUBLIC_HIDE_SOCIALNETWORKS_BUSINESS");
print "</td></tr>\n";


Expand Down