conference or booth card and list ok

This commit is contained in:
Florian HENRY 2021-03-15 20:20:53 +01:00
parent cdf5d2399a
commit 177a6bfe4f
9 changed files with 53 additions and 22 deletions

View File

@ -7232,12 +7232,13 @@ abstract class CommonObject
$classname = $InfoFieldList[0];
$classpath = $InfoFieldList[1];
$getnomurlparam = (empty($InfoFieldList[2]) ? 3 : $InfoFieldList[2]);
$getnomurlparam2 = (empty($InfoFieldList[4]) ? '' : $InfoFieldList[4]);
if (!empty($classpath)) {
dol_include_once($InfoFieldList[1]);
if ($classname && class_exists($classname)) {
$object = new $classname($this->db);
$object->fetch($value);
$value = $object->getNomUrl($getnomurlparam);
$value = $object->getNomUrl($getnomurlparam, $getnomurlparam2);
}
} else {
dol_syslog('Error bad setup of extrafield', LOG_WARNING);

View File

@ -393,7 +393,7 @@ class modEventOrganization extends DolibarrModules
'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganizationconforbooth', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'List',
'url'=>'htdocs/eventorganization/conferenceorbooth_list.php?mainmenu=project',
'url'=>'/eventorganization/conferenceorbooth_list.php?mainmenu=project',
'langs'=>'eventorganization', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1000+$r,
'enabled'=>'$conf->eventorganization->enabled', // Define condition to show or hide menu entry. Use '$conf->eventorganization->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.

View File

@ -107,9 +107,11 @@ class ConferenceOrBooth extends ActionComm
'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',),
'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty",),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,),
'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1::eventorganization', 'label'=>'Project', 'enabled'=>'1', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1,),
'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,),
'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,),
'datep' => array('type'=>'datetime', 'label'=>'DateStart', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'datep2' => array('type'=>'datetime', 'label'=>'DateEnd', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>1, 'showoncombobox'=>'1',),
'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'fk_user_author' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
@ -185,9 +187,7 @@ class ConferenceOrBooth extends ActionComm
public function create(User $user, $notrigger = false)
{
$this->setPercentageFromStatus();
$this->userownerid=$user->id;
$this->type_code=$this->fk_action;
$this->socid=$this->fk_soc;
$this->setActionCommFields($user);
return parent::create($user, $notrigger);
}
@ -196,7 +196,7 @@ class ConferenceOrBooth extends ActionComm
*
* @return void
*/
public function setPercentageFromStatus()
protected function setPercentageFromStatus()
{
if ($this->status==self::STATUS_DONE) {
$this->percentage=100;
@ -206,6 +206,32 @@ class ConferenceOrBooth extends ActionComm
}
}
/**
* Set action comm fields
*
* @param User $user User
* @return void
*/
protected function setActionCommFields(User $user)
{
$this->userownerid=$user->id;
$this->type_id=$this->fk_action;
$this->socid=$this->fk_soc;
$this->datef=$this->datep2;
}
/**
* Get action comm fields
*
* @return void
*/
protected function getActionCommFields()
{
$this->fk_action=$this->type_id;
$this->fk_soc=$this->socid;
$this->datep2=$this->datef;
}
/**
* Load object in memory from the database
*
@ -218,6 +244,7 @@ class ConferenceOrBooth extends ActionComm
public function fetch($id, $ref = null, $ref_ext = '', $email_msgid = '')
{
$result = parent::fetch($id, $ref, $ref_ext, $email_msgid);
$this->getActionCommFields();
return $result;
}
@ -313,6 +340,7 @@ class ConferenceOrBooth extends ActionComm
public function update(User $user, $notrigger = false)
{
$this->setPercentageFromStatus();
$this->setActionCommFields($user);
return parent::update($user, $notrigger);
}

View File

@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/class/conferenceorbooth.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/eventorganization/lib/eventorganization_conferenceorbooth.lib.php';
// Load translation files required by the page
$langs->loadLangs(array("eventorganization", "projects"));
@ -452,7 +453,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
}
// Back to draft
if ($object->status == $object::STATUS_VALIDATED) {
if ($object->status == $object::STATUS_CONFIRMED) {
print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes', '', $permissiontoadd);
}

View File

@ -408,14 +408,16 @@ if ($object->ismultientitymanaged == 1) {
} else {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if (in_array($key, $object->fields)) {
if (array_key_exists($key, $object->fields)) {
//var_dump($key,$object->fields);
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') {
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = '';
}
$mode_search = 2;
@ -424,6 +426,7 @@ foreach ($search as $key => $val) {
$sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
}
} else {
//var_dump($key,$object->fields);
if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
$columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key);
if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
@ -437,6 +440,7 @@ foreach ($search as $key => $val) {
}
}
}
if ($search_all) {
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
@ -618,7 +622,7 @@ foreach ($object->fields as $key => $val) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -54,11 +54,6 @@ function conferenceorboothPrepareHead($object)
$head[$h][2] = 'document';
$h++;
$head[$h][0] = dol_buildpath("/eventorganization/conferenceorbooth_agenda.php", 1).'?id='.$object->id;
$head[$h][1] = $langs->trans("Events");
$head[$h][2] = 'agenda';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
//$this->tabs = array(

View File

@ -284,13 +284,13 @@ if ($object->ismultientitymanaged == 1) {
$sql .= " WHERE 1 = 1";
}
foreach ($search as $key => $val) {
if (in_array($key, $object->fields)) {
if (array_key_exists($key, $object->fields)) {
if ($key == 'status' && $search[$key] == -1) {
continue;
}
$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
if (strpos($object->fields[$key]['type'], 'integer:') === 0) {
if ($search[$key] == '-1') {
if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0)) {
if ($search[$key] == '-1' || $search[$key] === '0') {
$search[$key] = '';
}
$mode_search = 2;
@ -514,7 +514,7 @@ foreach ($object->fields as $key => $val) {
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
} elseif (strpos($val['type'], 'integer:') === 0) {
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';

View File

@ -1168,6 +1168,8 @@ class Project extends CommonObject
$url = DOL_URL_ROOT.'/projet/tasks.php?id='.$this->id;
} elseif ($option == 'preview') {
$url = DOL_URL_ROOT.'/projet/element.php?id='.$this->id;
} elseif ($option == 'eventorganization') {
$url = DOL_URL_ROOT.'/eventorganization/conferenceorbooth_list.php?projectid='.$this->id;
} else {
$url = DOL_URL_ROOT.'/projet/card.php?id='.$this->id;
}

View File

@ -987,7 +987,7 @@ while ($i < min($num, $limit)) {
// Project url
if (!empty($arrayfields['p.ref']['checked'])) {
print '<td class="nowraponall">';
print $object->getNomUrl(1);
print $object->getNomUrl(1, (!empty(GETPOST('search_usage_event_organization', 'int'))?'eventorganization':''));
if ($object->hasDelay()) {
print img_warning($langs->trans('Late'));
}