tab event ok

This commit is contained in:
Florian HENRY 2021-02-21 12:32:16 +01:00
parent 556ba2b369
commit be34fb4541
8 changed files with 500 additions and 11 deletions

View File

@ -125,7 +125,7 @@ function project_prepare_head(Project $project)
$langs->load('eventorganization');
//TODO : Count
$nbConfOrBooth = 1;
$head[$h][0] = DOL_URL_ROOT . '/eventorganisation/conferenceorbooth_card.php?id=' . $project->id;
$head[$h][0] = DOL_URL_ROOT . '/projet/event.php?id=' . $project->id;
$head[$h][1] = $langs->trans("ConferenceOrBoothTab");
if ($nbContact > 0) $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbConfOrBooth . '</span>';
$head[$h][2] = 'eventorganisation';

View File

@ -174,5 +174,10 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private,
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailAttendes', 50, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailAttendes)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToAttendees)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, tms, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'eventorganization_send', '', 0, null, null, '2021-02-14 14:42:41', 'EventOrganizationMassEmailSpeakers', 60, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationMassEmailSpeakers)__', '__(Hello)__ __THIRDPARTY_NAME__,<br /><br />__(ThisIsContentOfYourOrganizationEventBulkMailToSpeakers)__<br /><br />__(Sincerely)__<br />__USER_SIGNATURE__', null, '1', null);
ALTER TABLE llx_projet ADD COLUMN allow_unknown_people_conf integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN allow_unknown_people_booth integer DEFAULT 0;
ALTER TABLE llx_projet ADD COLUMN price_registration double(24,8);
ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8);
-- Uniformize field total_ht, total_tva, total_ttc
ALTER TABLE llx_propal CHANGE COLUMN tva total_tva double(24,8) default 0;

View File

@ -48,6 +48,10 @@ create table llx_projet
usage_task integer DEFAULT 1, -- Set to 1 if project is used to manage tasks and/or record timesheet
usage_bill_time integer DEFAULT 0, -- Set to 1 if time spent must be converted into invoices
usage_organize_event integer DEFAULT 0, -- Set to 1 if you want to use project to organize an event, receive attendees subscription
allow_unknown_people_conf integer DEFAULT 0, -- Set to 1 if you want to allow unknown people to suggest conferences
allow_unknown_people_booth integer DEFAULT 0, -- Set to 1 if you want to Allow unknown people to suggest booth
price_registration double(24,8),
price_booth double(24,8),
model_pdf varchar(255),
last_main_doc varchar(255), -- relative filepath+filename of last main generated document
import_key varchar(14) -- Import key

View File

@ -57,3 +57,16 @@ EventOrganizationEmailSubsBooth = Subscription for booth
EventOrganizationEmailSubsEvent = Subscription for an event
EventOrganizationMassEmailAttendees = Communication to attendes
EventOrganizationMassEmailSpeakers = Communication to speakers
#
# Event
#
AllowUnknownPeopleSuggestConf=Allow unknown people to suggest conferences
AllowUnknownPeopleSuggestConfHelp=Allow unknown people to suggest conferences
AllowUnknownPeopleSuggestBooth=Allow unknown people to suggest booth
AllowUnknownPeopleSuggestBoothHelp=Allow unknown people to suggest booth
PriceOfRegistration=Price of registration
PriceOfRegistrationHelp=Price of registration
PriceOfBooth=Price of subscription
PriceOfBoothHelp=Price of subscription
EventOrganizationICSLink=Link ICS for events

View File

@ -228,7 +228,7 @@ if (empty($reshook))
}
}
if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer)
if ($action == 'update' && empty(GETPOST('cancel')) && $user->rights->projet->creer)
{
$error = 0;
@ -1132,7 +1132,7 @@ if ($action == 'create' && $user->rights->projet->creer)
if ($action == 'edit' && $userWrite > 0)
{
print '<div class="center">';
print '<input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'">&nbsp; &nbsp; &nbsp;';
print '<input name="update" class="button" type="submit" value="'.$langs->trans("Save").'">&nbsp; &nbsp; &nbsp;';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
}
@ -1223,14 +1223,14 @@ if ($action == 'create' && $user->rights->projet->creer)
// Send
if (empty($user->socid)) {
if ($object->statut != 2)
if ($object->statut != Project::STATUS_CLOSED)
{
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>';
}
}
// Modify
if ($object->statut != 2 && $user->rights->projet->creer)
if ($object->statut != Project::STATUS_CLOSED && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
@ -1241,7 +1241,7 @@ if ($action == 'create' && $user->rights->projet->creer)
}
// Validate
if ($object->statut == 0 && $user->rights->projet->creer)
if ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
@ -1252,7 +1252,7 @@ if ($action == 'create' && $user->rights->projet->creer)
}
// Close
if ($object->statut == 1 && $user->rights->projet->creer)
if ($object->statut == Project::STATUS_VALIDATED && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
@ -1263,7 +1263,7 @@ if ($action == 'create' && $user->rights->projet->creer)
}
// Reopen
if ($object->statut == 2 && $user->rights->projet->creer)
if ($object->statut == Project::STATUS_CLOSED && $user->rights->projet->creer)
{
if ($userWrite > 0)
{
@ -1340,9 +1340,9 @@ if ($action == 'create' && $user->rights->projet->creer)
}
// Delete
if ($user->rights->projet->supprimer || ($object->statut == 0 && $user->rights->projet->creer))
if ($user->rights->projet->supprimer || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer))
{
if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer))
if ($userDelete > 0 || ($object->statut == Project::STATUS_DRAFT && $user->rights->projet->creer))
{
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans("Delete").'</a>';
} else {

View File

@ -201,6 +201,10 @@ class Project extends CommonObject
'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'=>'UsageOrganizeEvent', 'enabled'=>1, 'visible'=>-1, 'position'=>145),
'allow_unknown_people_conf' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestConf', 'enabled'=>1, 'visible'=>-1, 'position'=>146),
'allow_unknown_people_booth' =>array('type'=>'integer', 'label'=>'AllowUnknownPeopleSuggestBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>147),
'price_registration' =>array('type'=>'double(24,8)', 'label'=>'PriceOfRegistration', 'enabled'=>1, 'visible'=>-1, 'position'=>148),
'price_booth' =>array('type'=>'double(24,8)', 'label'=>'PriceOfBooth', 'enabled'=>1, 'visible'=>-1, 'position'=>149),
'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),
@ -257,6 +261,10 @@ class Project extends CommonObject
if (empty($conf->eventorganization->enabled)) {
$this->fields['usage_organize_event']['visible'] = 0;
$this->fields['allow_unknown_people_conf']['enabled'] = 0;
$this->fields['allow_unknown_people_booth']['enabled'] = 0;
$this->fields['price_registration']['enabled'] = 0;
$this->fields['price_booth']['enabled'] = 0;
}
}
@ -316,6 +324,10 @@ class Project extends CommonObject
$sql .= ", usage_task";
$sql .= ", usage_bill_time";
$sql .= ", usage_organize_event";
$sql .= ", allow_unknown_people_conf";
$sql .= ", allow_unknown_people_booth";
$sql .= ", price_registration";
$sql .= ", price_booth";
$sql .= ", email_msgid";
$sql .= ", note_private";
$sql .= ", note_public";
@ -339,6 +351,10 @@ class Project extends CommonObject
$sql .= ", ".($this->usage_task ? 1 : 0);
$sql .= ", ".($this->usage_bill_time ? 1 : 0);
$sql .= ", ".($this->usage_organize_event ? 1 : 0);
$sql .= ", ".($this->allow_unknown_people_conf ? 1 : 0);
$sql .= ", ".($this->allow_unknown_people_booth ? 1 : 0);
$sql .= ", ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : 'null');
$sql .= ", ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : 'null');
$sql .= ", ".($this->email_msgid ? "'".$this->db->escape($this->email_msgid)."'" : 'null');
$sql .= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null');
$sql .= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null');
@ -442,6 +458,10 @@ class Project extends CommonObject
$sql .= ", usage_task = ".($this->usage_task ? 1 : 0);
$sql .= ", usage_bill_time = ".($this->usage_bill_time ? 1 : 0);
$sql .= ", usage_organize_event = ".($this->usage_organize_event ? 1 : 0);
$sql .= ", allow_unknown_people_conf = ".($this->allow_unknown_people_conf ? 1 : 0);
$sql .= ", allow_unknown_people_booth = ".($this->allow_unknown_people_booth ? 1 : 0);
$sql .= ", price_registration = ".(strcmp($this->price_registration, '') ? price2num($this->price_registration) : "null");
$sql .= ", price_booth = ".(strcmp($this->price_booth, '') ? price2num($this->price_booth) : "null");
$sql .= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -531,7 +551,8 @@ class Project extends CommonObject
$sql = "SELECT rowid, entity, ref, title, description, public, datec, opp_amount, budget_amount,";
$sql .= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut as status, fk_opp_status, opp_percent,";
$sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, email_msgid";
$sql .= " note_private, note_public, model_pdf, usage_opportunity, usage_task, usage_bill_time, usage_organize_event, email_msgid,";
$sql .= " allow_unknown_people_conf, allow_unknown_people_booth, price_registration, price_booth";
$sql .= " FROM ".MAIN_DB_PREFIX."projet";
if (!empty($id))
{
@ -588,6 +609,10 @@ class Project extends CommonObject
$this->usage_task = (int) $obj->usage_task;
$this->usage_bill_time = (int) $obj->usage_bill_time;
$this->usage_organize_event = (int) $obj->usage_organize_event;
$this->allow_unknown_people_conf = (int) $obj->allow_unknown_people_conf;
$this->allow_unknown_people_booth = (int) $obj->allow_unknown_people_booth;
$this->price_registration = $obj->price_registration;
$this->price_booth = $obj->price_booth;
$this->email_msgid = $obj->email_msgid;
$this->db->free($resql);

346
htdocs/projet/event.php Normal file
View File

@ -0,0 +1,346 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 florian.henry@scopen.fr <florian.henry@scopen.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/projet/event.php
* \ingroup project
* \brief Tab event organization
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
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->load('projects','enevntorganization');
$action = GETPOST('action', 'aZ09');
$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
//if (! $user->rights->projet->all->lire) $mine=1; // Special for projects
$object = new Project($db);
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Security check
$socid = 0;
if ($user->socid > 0) $socid = $user->socid; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'eventorganization', $id);
$permissiontoread = $user->rights->eventorganization->read;
$permissiontoadd = $user->rights->eventorganization->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->rights->eventorganization->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
/*
* Actions
*/
if ($action == 'update' && empty(GETPOST('cancel')) && $permissiontoadd) {
$error = 0;
$object->oldcopy = clone $object;
$object->allow_unknown_people_conf=(GETPOST('allow_unknown_people_conf', 'alpha') == 'on' ? 1 : 0);
$object->allow_unknown_people_booth=(GETPOST('allow_unknown_people_booth', 'alpha') == 'on' ? 1 : 0);
$object->price_registration=price2num(GETPOST('price_registration', 'alphanohtml'));;
$object->price_booth=price2num(GETPOST('price_booth', 'alphanohtml'));;
$result = $object->update($user);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
$action = 'edit';
} else {
$db->commit();
if (GETPOST('socid', 'int') > 0) $object->fetch_thirdparty(GETPOST('socid', 'int'));
else unset($object->thirdparty);
$action='';
}
}
/*
* View
*/
$title = $langs->trans("Project").' - '.$langs->trans("ConferenceOrBoothTab").' - '.$object->ref.' '.$object->name;
if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note");
//TODO Make wiki docs
$help_url = '';
llxHeader("", $title, $help_url);
$form = new Form($db);
$userstatic = new User($db);
$now = dol_now();
if ($id > 0 || !empty($ref))
{
$head = project_prepare_head($object);
print dol_get_fiche_head($head, 'eventorganisation', $langs->trans('ConferenceOrBoothTab'), -1);
// Project card
$linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '<div class="refidno">';
// Title
$morehtmlref .= $object->title;
// Thirdparty
if ($object->thirdparty->id > 0)
{
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project');
}
$morehtmlref .= '</div>';
// Define a complementary filter for search of next/prev ref.
if (!$user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Usage
print '<tr><td class="tdtop">';
print $langs->trans("Usage");
print '</td>';
print '<td>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print '<input type="checkbox" disabled name="usage_opportunity"'.(GETPOSTISSET('usage_opportunity') ? (GETPOST('usage_opportunity', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_opportunity ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowOpportunity");
print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext);
print '<br>';
}
if (empty($conf->global->PROJECT_HIDE_TASKS))
{
print '<input type="checkbox" disabled name="usage_task"'.(GETPOSTISSET('usage_task') ? (GETPOST('usage_task', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_task ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectFollowTasks");
print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext);
print '<br>';
}
if (!empty($conf->global->PROJECT_BILL_TIME_SPENT))
{
print '<input type="checkbox" disabled name="usage_bill_time"'.(GETPOSTISSET('usage_bill_time') ? (GETPOST('usage_bill_time', 'alpha') != '' ? ' checked="checked"' : '') : ($object->usage_bill_time ? ' checked="checked"' : '')).'"> ';
$htmltext = $langs->trans("ProjectBillTimeDescription");
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
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject');
print '</td></tr>';
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity))
{
// Opportunity status
print '<tr><td>'.$langs->trans("OpportunityStatus").'</td><td>';
$code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code');
if ($code) print $langs->trans("OppStatus".$code);
print '</td></tr>';
// Opportunity percent
print '<tr><td>'.$langs->trans("OpportunityProbability").'</td><td>';
if (strcmp($object->opp_percent, '')) print price($object->opp_percent, 0, $langs, 1, 0).' %';
print '</td></tr>';
// Opportunity Amount
print '<tr><td>'.$langs->trans("OpportunityAmount").'</td><td>';
/*if ($object->opp_status)
{
print price($obj->opp_amount, 1, $langs, 1, 0, -1, $conf->currency);
}*/
if (strcmp($object->opp_amount, '')) print price($object->opp_amount, 0, $langs, 1, 0, -1, $conf->currency);
print '</td></tr>';
// Opportunity Weighted Amount
print '<tr><td>'.$langs->trans('OpportunityWeightedAmount').'</td><td>';
if (strcmp($object->opp_amount, '') && strcmp($object->opp_percent, '')) print price($object->opp_amount * $object->opp_percent / 100, 0, $langs, 1, 0, -1, $conf->currency);
print '</td></tr>';
}
// Date start - end
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
$start = dol_print_date($object->date_start, 'day');
print ($start ? $start : '?');
$end = dol_print_date($object->date_end, 'day');
print ' - ';
print ($end ? $end : '?');
if ($object->hasDelay()) print img_warning("Late");
print '</td></tr>';
// Budget
print '<tr><td>'.$langs->trans("Budget").'</td><td>';
if (strcmp($object->budget_amount, '')) print price($object->budget_amount, 0, $langs, 1, 0, 0, $conf->currency);
print '</td></tr>';
// Other attributes
$cols = 2;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
print '</table>';
print '</div>';
print '<div class="fichehalfright">';
print '<div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
if ($action == 'edit') {
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . newToken() . '">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
}
print '<table class="border tableforfield" width="100%">';
// Description
print '<td class="titlefield tdtop">'.$langs->trans("Description").'</td><td>';
print dol_htmlentitiesbr($object->description);
print '</td></tr>';
// Categories
if ($conf->categorie->enabled) {
print '<tr><td class="valignmiddle">'.$langs->trans("Categories").'</td><td>';
print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1);
print "</td></tr>";
}
if ($action == 'edit' && $permissiontoadd) {
//Allow unknown people to suggest conferences
print '<tr><td class="valignmiddle">' . $langs->trans("AllowUnknownPeopleSuggestConf") . $form->textwithpicto('', $langs->trans("AllowUnknownPeopleSuggestConfHelp")) . '</td><td>';
print '<input type="checkbox" name="allow_unknown_people_conf"' . (GETPOSTISSET('allow_unknown_people_conf') ? (GETPOST('allow_unknown_people_conf', 'alpha') != '' ? ' checked="checked"' : '') : ($object->allow_unknown_people_conf ? ' checked="checked"' : '')) . '"> ';
print "</td></tr>";
//Allow unknown people to suggest booth
print '<tr><td class="valignmiddle">' . $langs->trans("AllowUnknownPeopleSuggestBooth") . $form->textwithpicto('', $langs->trans("AllowUnknownPeopleSuggestBoothHelp")) . '</td><td>';
print '<input type="checkbox" name="allow_unknown_people_booth"' . (GETPOSTISSET('allow_unknown_people_booth') ? (GETPOST('allow_unknown_people_booth', 'alpha') != '' ? ' checked="checked"' : '') : ($object->allow_unknown_people_booth ? ' checked="checked"' : '')) . '"> ';
print "</td></tr>";
//Price of registration
print '<tr><td class="valignmiddle">' . $langs->trans("PriceOfRegistration") . '</td><td>';
print '<input size="5" type="text" name="price_registration" value="'.(GETPOSTISSET('price_registration') ? GETPOST('price_registration') : (strcmp($object->price_registration, '') ? price2num($object->price_registration) : '')).'">';
print "</td></tr>";
//Price of registration
print '<tr><td class="valignmiddle">' . $langs->trans("PriceOfBooth") . '</td><td>';
print '<input size="5" type="text" name="price_booth" value="'.(GETPOSTISSET('price_booth') ? GETPOST('price_booth') : (strcmp($object->price_booth, '') ? price2num($object->price_booth) : '')).'">';
print "</td></tr>";
} else {
//Allow unknown people to suggest conferences
print '<tr><td class="valignmiddle">' . $langs->trans("AllowUnknownPeopleSuggestConf") . $form->textwithpicto('', $langs->trans("AllowUnknownPeopleSuggestConfHelp")) . '</td><td>';
print '<input type="checkbox" disabled name="allow_unknown_people_conf"' . (GETPOSTISSET('allow_unknown_people_conf') ? (GETPOST('allow_unknown_people_conf', 'alpha') != '' ? ' checked="checked"' : '') : ($object->allow_unknown_people_conf ? ' checked="checked"' : '')) . '"> ';
print "</td></tr>";
//Allow unknown people to suggest booth
print '<tr><td class="valignmiddle">' . $langs->trans("AllowUnknownPeopleSuggestBooth") . $form->textwithpicto('', $langs->trans("AllowUnknownPeopleSuggestBoothHelp")) . '</td><td>';
print '<input type="checkbox" disabled name="allow_unknown_people_booth"' . (GETPOSTISSET('allow_unknown_people_booth') ? (GETPOST('allow_unknown_people_booth', 'alpha') != '' ? ' checked="checked"' : '') : ($object->allow_unknown_people_booth ? ' checked="checked"' : '')) . '"> ';
print "</td></tr>";
//Price of registration
print '<tr><td class="valignmiddle">' . $langs->trans("PriceOfRegistration") . '</td><td>';
if (strcmp($object->price_registration, '')) print price($object->price_registration, 0, $langs, 1, 0, 0, $conf->currency);
print "</td></tr>";
//Price of registration
print '<tr><td class="valignmiddle">' . $langs->trans("PriceOfBooth") . '</td><td>';
if (strcmp($object->price_booth, '')) print price($object->price_booth, 0, $langs, 1, 0, 0, $conf->currency);
print "</td></tr>";
}
//ICS Link
print '<tr><td class="valignmiddle">'.$langs->trans("EventOrganizationICSLink").'</td><td>';
//TODO ICS Link
//print '<a href="ICSLink">ICS</a>';
print "</td></tr>";
print '</table>';
print '</table>';
print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
}
print dol_get_fiche_end();
if ($action == 'edit' && $permissiontoadd > 0)
{
print '<div class="center">';
print '<input name="update" class="button" type="submit" value="'.$langs->trans("Save").'">&nbsp; &nbsp; &nbsp;';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</div>';
print '</form>';
}
/*
* Actions Buttons
*/
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if (empty($reshook))
{
// Modify
if ($object->statut != Project::STATUS_CLOSED && $action=='')
{
if ($permissiontoadd > 0)
{
print '<a class="butAction" href="event.php?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>';
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotOwnerOfProject").'">'.$langs->trans('Modify').'</a>';
}
}
}
// End of page
llxFooter();
$db->close();

View File

@ -43,6 +43,9 @@ if (!empty($conf->categorie->enabled))
// Load translation files required by the page
$langs->loadLangs(array('projects', 'companies', 'commercial'));
if ($conf->eventorganization->enabled) {
$langs->loadLangs(array('eventorganization'));
}
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
@ -93,6 +96,10 @@ $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');
$search_allow_unknown_people_conf = GETPOST('search_allow_unknown_people_conf', 'int');
$search_allow_unknown_people_booth = GETPOST('search_allow_unknown_people_booth', 'int');
$search_price_registration = GETPOST("search_price_registration", 'alpha');
$search_price_booth = GETPOST("search_price_booth", 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0;
@ -209,6 +216,10 @@ if (empty($reshook))
$search_usage_task = '';
$search_usage_bill_time = '';
$search_usage_event_organization = '';
$search_allow_unknown_people_conf = '';
$search_allow_unknown_people_booth = '';
$search_price_registration = '';
$search_price_booth = '';
$toselect = '';
$search_array_options = array();
$search_category_array = array();
@ -304,6 +315,7 @@ $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be
$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 ";
$sql .= ", p.usage_opportunity, p.usage_task, p.usage_bill_time, p.usage_organize_event";
$sql .= ", allow_unknown_people_conf, allow_unknown_people_booth, price_registration, price_booth";
$sql .= ", s.rowid as socid, s.nom as name, s.email";
$sql .= ", cls.code as opp_status_code";
// Add fields from extrafields
@ -373,6 +385,10 @@ if ($search_usage_opportunity != '' && $search_usage_opportunity >= 0) $sql .= n
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);
if ($search_allow_unknown_people_conf != '' && $search_allow_unknown_people_conf >= 0) $sql .= natural_search('p.allow_unknown_people_conf', $search_allow_unknown_people_conf, 2);
if ($search_allow_unknown_people_booth != '' && $search_allow_unknown_people_booth >= 0) $sql .= natural_search('p.allow_unknown_people_booth', $search_allow_unknown_people_booth, 2);
if ($search_price_registration != '') $sql .= natural_search('p.price_registration', $search_price_registration, 1);
if ($search_price_booth != '') $sql .= natural_search('p.price_booth', $search_price_booth, 1);
// Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
// Add where from hooks
@ -450,6 +466,10 @@ if ($search_budget_amount != '') $param .= '&search_budget_amount='.urlencode($s
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 ($search_allow_unknown_people_conf != '') $param .= '&search_allow_unknown_people_conf='.urlencode($search_allow_unknown_people_conf);
if ($search_allow_unknown_people_booth != '') $param .= '&search_allow_unknown_people_booth='.urlencode($search_allow_unknown_people_booth);
if ($search_price_registration != '') $param .= '&search_price_registration='.urlencode($search_price_registration);
if ($search_price_booth != '') $param .= '&search_price_booth='.urlencode($search_price_booth);
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
@ -663,6 +683,30 @@ if (!empty($arrayfields['p.usage_organize_event']['checked']))
print $form->selectyesno('search_usage_event_organization', $search_usage_event_organization, 1, false, 1);
print '</td>';
}
if (!empty($arrayfields['p.allow_unknown_people_conf']['checked']))
{
print '<td class="liste_titre nowrap right">';
print $form->selectyesno('search_allow_unknown_people_conf', $search_allow_unknown_people_conf, 1, false, 1);
print '</td>';
}
if (!empty($arrayfields['p.allow_unknown_people_booth']['checked']))
{
print '<td class="liste_titre nowrap right">';
print $form->selectyesno('search_allow_unknown_people_booth', $search_allow_unknown_people_booth, 1, false, 1);
print '</td>';
}
if (!empty($arrayfields['p.price_registration']['checked']))
{
print '<td class="liste_titre nowrap right">';
print '<input type="text" class="flat" name="search_price_registration" size="4" value="'.$search_price_registration.'">';
print '</td>';
}
if (!empty($arrayfields['p.price_booth']['checked']))
{
print '<td class="liste_titre nowrap right">';
print '<input type="text" class="flat" name="search_price_booth" size="4" value="'.$search_price_booth.'">';
print '</td>';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@ -717,6 +761,10 @@ if (!empty($arrayfields['p.usage_opportunity']['checked'])) print_liste_field_ti
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 ');
if (!empty($arrayfields['p.allow_unknown_people_conf']['checked'])) print_liste_field_titre($arrayfields['p.allow_unknown_people_conf']['label'], $_SERVER["PHP_SELF"], 'p.allow_unknown_people_conf', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.allow_unknown_people_booth']['checked'])) print_liste_field_titre($arrayfields['p.allow_unknown_people_booth']['label'], $_SERVER["PHP_SELF"], 'p.allow_unknown_people_booth', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.price_registration']['checked'])) print_liste_field_titre($arrayfields['p.price_registration']['label'], $_SERVER["PHP_SELF"], 'p.price_registration', "", $param, '', $sortfield, $sortorder, 'right ');
if (!empty($arrayfields['p.price_booth']['checked'])) print_liste_field_titre($arrayfields['p.price_booth']['label'], $_SERVER["PHP_SELF"], 'p.price_booth', "", $param, '', $sortfield, $sortorder, 'right ');
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -952,6 +1000,54 @@ while ($i < min($num, $limit))
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Allow unknown people to suggest conferences
if (!empty($arrayfields['p.allow_unknown_people_conf']['checked']))
{
print '<td class="right">';
if ($obj->allow_unknown_people_conf)
{
print yn($obj->allow_unknown_people_conf);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Allow unknown people to suggest booth
if (!empty($arrayfields['p.allow_unknown_people_booth']['checked']))
{
print '<td class="right">';
if ($obj->allow_unknown_people_booth)
{
print yn($obj->allow_unknown_people_booth);
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Price of registration
if (!empty($arrayfields['p.price_registration']['checked']))
{
print '<td class="right">';
if ($obj->price_registration != '')
{
print price($obj->price_registration, 1, $langs, 1, -1, -1);
$totalarray['val']['p.price_registration'] += $obj->price_registration;
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.price_registration';
}
// PriceOfBooth
if (!empty($arrayfields['p.price_booth']['checked']))
{
print '<td class="right">';
if ($obj->price_booth != '')
{
print price($obj->price_booth, 1, $langs, 1, -1, -1);
$totalarray['val']['p.price_booth'] += $obj->price_booth;
}
print '</td>';
if (!$i) $totalarray['nbfield']++;
if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'p.price_booth';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook