From 17c49e6ce96a99040b1f805c134b7a4e5f074359 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Mar 2021 18:06:23 +0100 Subject: [PATCH 1/4] ongoinf card and list --- .../modules/modEventOrganization.class.php | 77 ++++++++++++++++++- .../class/conferenceorbooth.class.php | 11 ++- .../conferenceorbooth_list.php | 8 +- htdocs/langs/en_US/eventorganization.lang | 17 +++- htdocs/projet/list.php | 4 +- 5 files changed, 105 insertions(+), 12 deletions(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 77d0cc0c81f..2204955ad5e 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -337,7 +337,82 @@ class modEventOrganization extends DolibarrModules 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); */ - + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=project', // '' 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'=>'EventOrganizationMenuLeft', + 'mainmenu'=>'project', + 'leftmenu'=>'eventorganization', + 'url'=>'', + '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. + 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' 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'=>'/projet/list.php?search_usage_event_organization=1&mainmenu=project', + 'langs'=>'eventorganization@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. + 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=project,fk_leftmenu=eventorganization', // '' 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'=>'New', + 'url'=>'/projet/card.php?leftmenu=projects&action=create&usage_organize_event=1', + 'langs'=>'eventorganization@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. + 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + 'fk_menu'=>'fk_mainmenu=project', // '' 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'=>'EventOrganizationMenuLeft', + 'mainmenu'=>'project', + 'leftmenu'=>'eventorganizationconforbooth', + 'url'=>'', + '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. + 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + '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', + '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. + 'perms'=>'$user->rights->eventorganization->read', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); + $this->menu[$r++]=array( + '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'=>'New', + 'url'=>'/eventorganization/conferenceorbooth_card.php?leftmenu=projects&action=create', + '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. + 'perms'=>'$user->rights->eventorganization->write', // Use 'perms'=>'$user->rights->eventorganization->level1->level2' if you want your menu with a permission rules + 'target'=>'', + 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both + ); /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */ // Exports profiles provided by this module $r = 1; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 186bd57811b..7defb51f415 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -69,7 +69,7 @@ class ConferenceOrBooth extends ActionComm const STATUS_CONFIRMED = 2; const STATUS_NOT_QUALIFIED = 3; const STATUS_DONE = 4; - const STATUS_CANCELED = -1; + const STATUS_CANCELED = 9; /** @@ -104,18 +104,18 @@ class ConferenceOrBooth extends ActionComm */ public $fields=array( 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), + '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,), 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), - 'fk_action' => array('type'=>'sellist:c_actioncomm:label:rowid::module LIKE (\'conference\',\'booth\'))', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,), + 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>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',), 'fk_user_mod' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), - 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'),), + 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'EvntOrgDraft', '1'=>'EvntOrgSuggested', '2'=> 'EvntOrgConfirmed', '3' =>'EvntOrgNotQualified', '4' =>'EvntOrgDone', '9'=>'EvntOrgCancelled'),), ); public $rowid; public $id; @@ -185,6 +185,9 @@ 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; return parent::create($user, $notrigger); } diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 374ea25f68c..73b32abfa7d 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -205,11 +205,11 @@ $title = $langs->trans('ListOf', $langs->transnoentitiesnoconv("ConferenceOrBoot if ($projectid > 0) { $project = new Project($db); - $result=$project->fetch($projectid); + $result = $project->fetch($projectid); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } - $result=$project->fetch_thirdparty(); + $result = $project->fetch_thirdparty(); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } @@ -305,7 +305,7 @@ if ($projectid > 0) { print '
'; } if (!empty($conf->eventorganization->enabled)) { - print 'usage_organize_event ? ' checked="checked"' : '')).'"> '; + print 'usage_organize_event ? ' checked="checked"' : '').'"> '; $htmltext = $langs->trans("EventOrganizationDescriptionLong"); print $form->textwithpicto($langs->trans("ManageOrganizeEvent"), $htmltext); } @@ -555,7 +555,7 @@ print ''; print ''; print ''; -$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?action=create'.(!empty($projectid)?'&fk_project='.$projectid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); +$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?action=create'.(!empty($project->id)?'&fk_project='.$project->id:'').(!empty($project->socid)?'&fk_soc='.$project->socid:'').'&backtopage='.urlencode($_SERVER['PHP_SELF']).(!empty($project->id)?'?projectid='.$project->id:''), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 0c7e4f047ce..5444ed59e3d 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -16,11 +16,16 @@ # # Generic # - ModuleEventOrganizationName = Event Organization EventOrganizationDescription = Event Organization through Module Project EventOrganizationDescriptionLong= Manage Event organization for conference, attendees, speaker, and attendees, with public subcription page +# +# Menu +# +EventOrganizationMenuLeft = Organized events +EventOrganizationConferenceOrBoothMenuLeft = Conference Or Booth + # # Admin page # @@ -70,3 +75,13 @@ PriceOfRegistrationHelp=Price of registration PriceOfBooth=Price of subscription PriceOfBoothHelp=Price of subscription EventOrganizationICSLink=Link ICS for events + +# +# Status +# +EvntOrgDraft = Draft +EvntOrgSuggested = Suggested +EvntOrgConfirmed = Confirmed +EvntOrgNotQualified = Not Qualified +EvntOrgDone = Done +EvntOrgCancelled = Cancelled diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 933abd53692..f34c33097ec 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -1198,8 +1198,8 @@ while ($i < min($num, $limit)) { // Event Organization if (!empty($arrayfields['p.usage_organize_event']['checked'])) { print ''; - if ($obj->usage_event_organization) { - print yn($obj->usage_event_organization); + if ($obj->usage_organize_event) { + print yn($obj->usage_organize_event); } print ''; if (!$i) { From cdf5d2399a526182d1afd85f7397462dda479d8c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Mar 2021 19:07:40 +0100 Subject: [PATCH 2/4] fix warning --- htdocs/commande/class/commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 0975bfbd7ef..9cc01c83ef7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3686,7 +3686,7 @@ class Commande extends CommonOrder $label .= ' '.$this->getLibStatut(5); } $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this-ref_client) : $this->ref_customer); + $label .= '
'.$langs->trans('RefCustomer').': '.(empty($this->ref_customer) ? (empty($this->ref_client) ? '' : $this->ref_client) : $this->ref_customer); if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); } From 177a6bfe4f62f766aeb681d0a2933f2186518efd Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 15 Mar 2021 20:20:53 +0100 Subject: [PATCH 3/4] conference or booth card and list ok --- htdocs/core/class/commonobject.class.php | 3 +- .../modules/modEventOrganization.class.php | 2 +- .../class/conferenceorbooth.class.php | 38 ++++++++++++++++--- .../conferenceorbooth_card.php | 3 +- .../conferenceorbooth_list.php | 12 ++++-- ...ventorganization_conferenceorbooth.lib.php | 5 --- .../modulebuilder/template/myobject_list.php | 8 ++-- htdocs/projet/class/project.class.php | 2 + htdocs/projet/list.php | 2 +- 9 files changed, 53 insertions(+), 22 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b86ea4fb650..758a1ba0e8f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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); diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 2204955ad5e..4f25993d9a1 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -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. diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 7defb51f415..7f28d40dd29 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -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); } diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index 2fb59bbcbc7..817be70ab79 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -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); } diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 73b32abfa7d..81607e704b4 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -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 ''; 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 ''; diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 31f07493829..541915fc953 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -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( diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 21662682b09..aa616709a7d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -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 ''; 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 ''; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index c85ebddadc1..137757eae1a 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -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; } diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index f34c33097ec..e6b381a6650 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -987,7 +987,7 @@ while ($i < min($num, $limit)) { // Project url if (!empty($arrayfields['p.ref']['checked'])) { print ''; - 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')); } From 9d8254eff44c1a5a93174387c198da2ef8056df7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 16 Mar 2021 09:59:45 +0100 Subject: [PATCH 4/4] fix price output in commoncard --- htdocs/core/tpl/commonfields_add.tpl.php | 2 ++ htdocs/core/tpl/commonfields_edit.tpl.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/htdocs/core/tpl/commonfields_add.tpl.php b/htdocs/core/tpl/commonfields_add.tpl.php index 407859037d7..639be537dba 100644 --- a/htdocs/core/tpl/commonfields_add.tpl.php +++ b/htdocs/core/tpl/commonfields_add.tpl.php @@ -77,6 +77,8 @@ foreach ($object->fields as $key => $val) { $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), 0, GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int')); } elseif ($val['type'] == 'boolean') { $value = (GETPOST($key) == 'on' ? 1 : 0); + } elseif ($val['type'] == 'price') { + $value = price2num(GETPOST($key)); } else { $value = GETPOST($key, 'alphanohtml'); } diff --git a/htdocs/core/tpl/commonfields_edit.tpl.php b/htdocs/core/tpl/commonfields_edit.tpl.php index a2c6868472f..65b8b566180 100644 --- a/htdocs/core/tpl/commonfields_edit.tpl.php +++ b/htdocs/core/tpl/commonfields_edit.tpl.php @@ -77,6 +77,8 @@ foreach ($object->fields as $key => $val) { $check = 'restricthtml'; } $value = GETPOSTISSET($key) ? GETPOST($key, $check) : $object->$key; + } elseif ($val['type'] == 'price') { + $value = price2num(GETPOST($key)); } else { $value = GETPOSTISSET($key) ? GETPOST($key, 'alpha') : $object->$key; }