Merge pull request #16297 from FHenry/dev_EventOrganisation_ProjectCardAndList

wip :  Event Organization module - PR-2 - project page #FoundationFunding
This commit is contained in:
Laurent Destailleur 2021-02-19 13:37:17 +01:00 committed by GitHub
commit 4f8a03b6d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 61 additions and 11 deletions

View File

@ -18,7 +18,7 @@
#
ModuleEventOrganizationName = Event Organization
EventOrganizationDescription = Event Organization
EventOrganizationDescription = Event Organization through Module Project
EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page
#
@ -42,7 +42,7 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction
# Object
#
EventOrganizationConfOrBooth= Conference Or Booth
ManageOrganizeEvent = Manage event organisation
#
# Template Mail

View File

@ -269,5 +269,6 @@ OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task
ProfitIsCalculatedWith=Profit is calculated using
AddPersonToTask=Add also to tasks
UsageOrganizeEvent=Usage: Event Organization
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE=Classify project as closed when all its tasks are completed (100%% progress)
PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE_help=Note: existing projects with all tasks at 100%% progress won't be affected: you will have to close them manually. This option only affects open projects.

View File

@ -35,7 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies'));
$langsLoad=array('projects', 'companies');
if (!empty($conf->eventorganization->enabled)) {
$langsLoad[]='eventorganization';
}
$langs->loadLangs($langsLoad);
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
@ -569,10 +574,14 @@ if ($action == 'create' && $user->rights->projet->creer)
print '<label for="usage_bill_time">'.$form->textwithpicto($langs->trans("BillTime"), $htmltext).'</label>';
print '<br>';
}
/*
print '<input type="checkbox" name="usage_organize_event"'.(GETPOST('usage_organize_event', 'alpha')!=''?' checked="checked"':'').'"> ';
$htmltext = $langs->trans("OrganizeEvent");
print $form->textwithpicto($langs->trans("OrganizeEvent"), $htmltext);*/
if (!empty($conf->eventorganization->enabled))
{
print '<input type="checkbox" name="usage_organize_event"'.(GETPOST('usage_organize_event', 'alpha')!=''?' checked="checked"':'').'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td>';
print '</tr>';
@ -855,6 +864,12 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
if (!empty($conf->eventorganization->enabled))
{
print '<input type="checkbox" name="usage_organize_event"'.(GETPOST('usage_organize_event', 'alpha')!=''?' checked="checked"':'').'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td></tr>';
// Thirdparty
@ -1020,6 +1035,13 @@ if ($action == 'create' && $user->rights->projet->creer)
print $form->textwithpicto($langs->trans("BillTime"), $htmltext);
print '<br>';
}
if (!empty($conf->eventorganization->enabled))
{
print '<input type="checkbox" disabled name="usage_organize_event"'.(GETPOSTISSET('usage_organize_event') ? (GETPOST('usage_organize_event', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_organize_event ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("EventOrganizationDescriptionLong");
print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext);
}
print '</td></tr>';
// Visibility

View File

@ -200,7 +200,7 @@ class Project extends CommonObject
'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135),
'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>-1, 'position'=>140),
'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
'usage_organize_event' =>array('type'=>'integer', 'label'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>-2, 'position'=>200),
'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>205),
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserCreation', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>210),
@ -232,6 +232,8 @@ class Project extends CommonObject
*/
public function __construct($db)
{
global $conf;
$this->db = $db;
$this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed');
@ -248,12 +250,12 @@ class Project extends CommonObject
$this->fields['usage_opportunity']['enabled'] = 0;
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) {
if (!empty($conf->global->PROJECT_HIDE_TASKS)) {
$this->fields['usage_bill_time']['visible'] = 0;
$this->fields['usage_task']['visible'] = 0;
}
if (empty($conf->global->PROJECT_ORGANIZE_EVENTS)) {
if (empty($conf->eventorganization->enabled)) {
$this->fields['usage_organize_event']['visible'] = 0;
}
}

View File

@ -92,6 +92,7 @@ $search_sale = GETPOST('search_sale', 'int');
$search_usage_opportunity = GETPOST('search_usage_opportunity', 'int');
$search_usage_task = GETPOST('search_usage_task', 'int');
$search_usage_bill_time = GETPOST('search_usage_bill_time', 'int');
$search_usage_event_organization = GETPOST('search_usage_event_organization', 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
@ -207,6 +208,7 @@ if (empty($reshook))
$search_usage_opportunity = '';
$search_usage_task = '';
$search_usage_bill_time = '';
$search_usage_event_organization = '';
$toselect = '';
$search_array_options = array();
$search_category_array = array();
@ -300,7 +302,8 @@ if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; /
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat";
$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount, p.usage_opportunity, p.usage_task, p.usage_bill_time";
$sql .= ", p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount ";
$sql .= ", p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code";
// Add fields from extrafields
@ -369,6 +372,7 @@ if ($search_budget_amount != '') $sql .= natural_search('p.budget_amount', $sear
if ($search_usage_opportunity != '' && $search_usage_opportunity >= 0) $sql .= natural_search('p.usage_opportunity', $search_usage_opportunity, 2);
if ($search_usage_task != '' && $search_usage_task >= 0) $sql .= natural_search('p.usage_task', $search_usage_task, 2);
if ($search_usage_bill_time != '' && $search_usage_bill_time >= 0) $sql .= natural_search('p.usage_bill_time', $search_usage_bill_time, 2);
if ($search_usage_event_organization != '' && $search_usage_event_organization >= 0) $sql .= natural_search('p.usage_organize_event', $search_usage_event_organization, 2);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -443,6 +447,9 @@ if ($search_project_user != '') $param .= '&search_project_user='.urlencode($s
if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
if ($search_opp_amount != '') $param .= '&search_opp_amount='.urlencode($search_opp_amount);
if ($search_budget_amount != '') $param .= '&search_budget_amount='.urlencode($search_budget_amount);
if ($search_usage_task != '') $param .= '&search_usage_task='.urlencode($search_usage_task);
if ($search_usage_bill_time != '') $param .= '&search_usage_opportunity='.urlencode($search_usage_bill_time);
if ($search_usage_event_organization != '') $param .= '&search_usage_event_organization='.urlencode($search_usage_event_organization);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -650,6 +657,12 @@ if (!empty($arrayfields['p.usage_bill_time']['checked']))
print $form->selectyesno('search_usage_bill_time', $search_usage_bill_time, 1, false, 1);
print '</td>';
}
if (!empty($arrayfields['p.usage_organize_event']['checked']))
{
print '<td class="liste_titre nowrap right">';
print $form->selectyesno('search_usage_event_organization', $search_usage_event_organization, 1, false, 1);
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -703,6 +716,7 @@ if (!empty($arrayfields['p.budget_amount']['checked'])) print_liste_field_titre(
if (!empty($arrayfields['p.usage_opportunity']['checked'])) print_liste_field_titre($arrayfields['p.usage_opportunity']['label'], $_SERVER["PHP_SELF"], 'p.usage_opportunity', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.usage_task']['checked'])) print_liste_field_titre($arrayfields['p.usage_task']['label'], $_SERVER["PHP_SELF"], 'p.usage_task', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.usage_bill_time']['checked'])) print_liste_field_titre($arrayfields['p.usage_bill_time']['label'], $_SERVER["PHP_SELF"], 'p.usage_bill_time', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.usage_organize_event']['checked'])) print_liste_field_titre($arrayfields['p.usage_organize_event']['label'], $_SERVER["PHP_SELF"], 'p.usage_organize_event', "", $param, '', $sortfield, $sortorder, 'right ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -927,6 +941,17 @@ while ($i < min($num, $limit))
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Event Organization
if (!empty($arrayfields['p.usage_organize_event']['checked']))
{
print '<td class="right">';
if ($obj->usage_event_organization)
{
print yn($obj->usage_event_organization);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook