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

NEW #25044 new option visibility parameter #25578

Merged
merged 2 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion htdocs/langs/en_US/website.lang
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,7 @@ SetWebsiteOnlineBefore=When website is offline, all pages are offline. Change st
Booking=Booking
Reservation=Reservation
PagesViewedPreviousMonth=Pages viewed (previous month)
PagesViewedTotal=Pages viewed (total)
PagesViewedTotal=Pages viewed (total)
Visibility=Visibility
Everyone=Everyone
AssignedContacts=Assigned contacts
3 changes: 3 additions & 0 deletions htdocs/langs/fr_FR/website.lang
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,6 @@ Booking=Réservation
Reservation=Réservation
PagesViewedPreviousMonth=Pages vues (mois précédent)
PagesViewedTotal=Pages vues (total)
Visibility=Visibilité
Everyone=Tout le monde
AssignedContacts=Contacts assignés
12 changes: 12 additions & 0 deletions htdocs/projet/admin/website.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

$defaultoppstatus = getDolGlobalInt('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');

$visibility = GETPOST('PROJET_VISIBILITY', 'alpha');

if (!$user->admin) {
accessforbidden();
}
Expand All @@ -61,6 +63,7 @@
if ($action == 'update') {
$public = GETPOST('PROJECT_ENABLE_PUBLIC');
$defaultoppstatus = GETPOST('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', 'int');
$res = dolibarr_set_const($db, "PROJET_VISIBILITY", $visibility, 'chaine', 0, '', $conf->entity);

$res = dolibarr_set_const($db, "PROJECT_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD", $defaultoppstatus, 'chaine', 0, '', $conf->entity);
Expand Down Expand Up @@ -142,6 +145,15 @@
print $formproject->selectOpportunityStatus('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', GETPOSTISSET('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD') ? GETPOST('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', 'int') : $defaultoppstatus, 1, 0, 0, 0, '', 0, 1);
print "</td></tr>\n";


// project visibility
$arrayofchoices = array('0' => $langs->trans("AssignedContacts"), '1' => $langs->trans("Everyone"));
print '<tr class="oddeven drag"><td>';
print $langs->trans("Visibility");
print '</td><td class="right">';
print $form->selectarray('PROJET_VISIBILITY', $arrayofchoices, getDolGlobalInt('PROJET_VISIBILITY'), 0);
print "</td></tr>\n";

print '</table>';
print '</div>';

Expand Down
11 changes: 10 additions & 1 deletion htdocs/public/project/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ function llxFooterVierge()
$errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
}

$visibility = getDolGlobalString('PROJET_VISIBILITY');

$proj = new Project($db);
$thirdparty = new Societe($db);

Expand Down Expand Up @@ -285,10 +287,17 @@ function llxFooterVierge()
$defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
}

if ($visibility === "1") {
$proj->public = 1;
} elseif ($visibility === "0") {
$proj->public = 0;
} elseif (empty($visibility)) {
$proj->public = 1;
}

$proj->ref = $defaultref;
$proj->statut = $proj::STATUS_DRAFT;
$proj->status = $proj::STATUS_DRAFT;
$proj->public = 1;
$proj->usage_opportunity = 1;
$proj->title = $langs->trans("LeadFromPublicForm");
$proj->description = GETPOST("description", "alphanohtml");
Expand Down