From cc78e7c6851688e7f9b67db03d088c396b1d1f11 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 23 Mar 2021 21:04:38 +0100 Subject: [PATCH] add field on conf or booth tabs --- htdocs/core/class/html.form.class.php | 8 ++- .../conferenceorbooth_list.php | 58 +++++++++++++++++++ htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/projet/class/project.class.php | 33 +++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 848b07bd450..3a36950608a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -96,7 +96,7 @@ class Form * @param string $preselected Value to show/edit (not used in this function) * @param object $object Object * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field. - * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) + * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), '+:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...) * @param string $moreparam More param to add on a href URL. * @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS. * @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' ' @@ -237,6 +237,9 @@ class Form $tmp = explode(':', $typeofdata); $valuetoshow = price2num($editvalue ? $editvalue : $value); $ret .= ''; + } elseif (preg_match('/^(checkbox)/', $typeofdata)) { + $tmp = explode(':', $typeofdata); + $ret .= ''; } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { // if wysiwyg is enabled $typeofdata = 'ckeditor' $tmp = explode(':', $typeofdata); $cols = $tmp[2]; @@ -298,6 +301,9 @@ class Form $ret .= dol_print_email($value, 0, 0, 0, 0, 1); } elseif (preg_match('/^(amount|numeric)/', $typeofdata)) { $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); + } elseif (preg_match('/^(checkbox)/', $typeofdata)) { + $tmp = explode(':', $typeofdata); + $ret .= ''; } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) { $ret .= dol_htmlentitiesbr($value); } elseif (preg_match('/^safehtmlstring/', $typeofdata)) { diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 89e614cc3ba..eaf45a4e801 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -144,6 +144,28 @@ $result = restrictedArea($user, 'eventorganization'); * Actions */ + +if (preg_match('/^set/', $action) && $projectid > 0) { + $project = new Project($db); + //If "set" fields keys is in projects fields + $project_attr=preg_replace('/^set/', '', $action); + if (array_key_exists($project_attr, $project->fields)) { + $result = $project->fetch($projectid); + if ($result < 0) { + setEventMessages(null, $project->errors, 'errors'); + } else { + $project->{$project_attr}=GETPOST($project_attr); + $result=$project->update($user); + if ($result < 0) { + setEventMessages(null, $project->errors, 'errors'); + } + } + } +} +/*if ($action=='setaccept_conference_suggestions' && !empty(GETPOST('cancel', 'alpha'))) { + +}*/ +//setaccept_booth_suggestions if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; @@ -152,6 +174,9 @@ if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massa $massaction = ''; } + + + $parameters = array(); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { @@ -362,6 +387,39 @@ if ($projectid > 0) { print ""; } + print ''; + $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : ''); + $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); + print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print ''; + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print ""; + + print ''; + $typeofdata = 'checkbox:'.($project->accept_booth_suggestions ? ' checked="checked"' : ''); + $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); + print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '', $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print ''; + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid'); + print ""; + + print ''; + print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); + print ''; + print $form->editfieldval('PriceOfRegistration', 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print ""; + + print ''; + print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid'); + print ''; + print $form->editfieldval('PriceOfBooth', 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid'); + print ""; + + print ''.$langs->trans("EventOrganizationICSLink").''; + print ''; + print ""; + + print ''; print ''; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index cfa2d63196e..148b2762e0b 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -77,6 +77,7 @@ PriceOfRegistrationHelp=Price of registration PriceOfBooth=Price of subscription PriceOfBoothHelp=Price of subscription EventOrganizationICSLink=Link ICS for events +ConferenceOrBoothInformation=Conference Or Booth informations # # Status diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8bf9c727f4e..acfa92d6804 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -104,9 +104,42 @@ class Project extends CommonObject */ public $user_close_id; public $public; //!< Tell if this is a public or private project + + /** + * @var float budget Amount + */ public $budget_amount; + + /** + * @var boolean Use to bill task spend time + */ public $usage_bill_time; // Is the time spent on project must be invoiced or not + /** + * @var boolean Event organization: Use Event Organization + */ + public $usage_organize_event; + + /** + * @var boolean Event organization: Allow unknown people to suggest conferences + */ + public $accept_conference_suggestions; + + /** + * @var boolean Event organization: Allow unknown people to suggest booth + */ + public $accept_booth_suggestions; + + /** + * @var float Event organization: registration price + */ + public $price_registration; + + /** + * @var float Event organization: booth price + */ + public $price_booth; + public $statuts_short; public $statuts_long;