add field on conf or booth tabs

This commit is contained in:
Florian HENRY 2021-03-23 21:04:38 +01:00
parent edf7c02dd6
commit cc78e7c685
4 changed files with 99 additions and 1 deletions

View File

@ -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 .= '<input type="text" id="'.$htmlname.'" name="'.$htmlname.'" value="'.($valuetoshow != '' ?price($valuetoshow) : '').'"'.($tmp[1] ? ' size="'.$tmp[1].'"' : '').' autofocus>';
} elseif (preg_match('/^(checkbox)/', $typeofdata)) {
$tmp = explode(':', $typeofdata);
$ret .= '<input type="checkbox" id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
} 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 .= '<input type="checkbox" disabled id="' . $htmlname . '" name="' . $htmlname . '" value="' . $value . '"' . ($tmp[1] ? $tmp[1] : '') . '/>';
} elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) {
$ret .= dol_htmlentitiesbr($value);
} elseif (preg_match('/^safehtmlstring/', $typeofdata)) {

View File

@ -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 "</td></tr>";
}
print '<tr><td>';
$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 '</td><td>';
print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td>';
$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 '</td><td>';
print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', '1', $project, $permissiontoadd, $typeofdata, '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td>';
print $form->editfieldkey('PriceOfRegistration', 'price_registration', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
print $form->editfieldval('PriceOfRegistration', 'price_registration', $project->price_registration, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td>';
print $form->editfieldkey('PriceOfBooth', 'price_booth', '', $project, $permissiontoadd, 'amount', '', 0, 0, 'projectid');
print '</td><td>';
print $form->editfieldval('PriceOfBooth', 'price_booth', $project->price_booth, $project, $permissiontoadd, 'amount', '', 0, 0, '', 0, '', 'projectid');
print "</td></tr>";
print '<tr><td valign="middle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
print '';
print "</td></tr>";
print '</table>';
print '</div>';

View File

@ -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

View File

@ -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;