From 47675d28d79f4e6ac03b12122cf9d2ed6430899e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Mar 2021 19:47:48 +0100 Subject: [PATCH 1/4] add filter for select list attendees --- htdocs/admin/eventorganization.php | 36 +++++++++++-------- htdocs/langs/en_US/eventorganization.lang | 2 ++ htdocs/modulebuilder/template/admin/setup.php | 15 ++++++++ 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 23fc463f3b5..743da034060 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -52,6 +52,8 @@ $arrayofparameters = array( 'EVENTORGANIZATION_TASK_LABEL'=>array('type'=>'textarea','enabled'=>1), 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), 'EVENTORGANIZATION_CATEG_THIRDPARTY_BOOTH'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), + 'EVENTORGANIZATION_FILTERATTENDEES_CAT'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), + 'EVENTORGANIZATION_FILTERATTENDEES_TYPE'=>array('type'=>'thirdparty_type:', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), 'EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH'=>array('type'=>'emailtemplate:eventorganization_send', 'enabled'=>1), @@ -144,7 +146,7 @@ if ($action == 'updateMask') { } } } -} elseif ($action == 'setdoc') { +}/* elseif ($action == 'setdoc') { // Set or unset default model $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { @@ -167,7 +169,7 @@ if ($action == 'updateMask') { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; dolibarr_del_const($db, $constforval, $conf->entity); } -} +}*/ @@ -177,7 +179,7 @@ if ($action == 'updateMask') { $form = new Form($db); -$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); +//$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); $page_name = "EventOrganizationSetup"; llxHeader('', $langs->trans($page_name)); @@ -249,6 +251,10 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + } elseif (preg_match('/thirdparty_type/', $val['type'])) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + $formcompany = new FormCompany($db); + print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); } else { print ''; } @@ -309,6 +315,16 @@ if ($action == 'edit') { } print '
'; } + } elseif (preg_match('/thirdparty_type/', $val['type'])) { + if ($conf->global->{$constname}==2) { + print $langs->trans("Prospect"); + } elseif ($conf->global->{$constname}==3) { + print $langs->trans("ProspectCustomer"); + } elseif ($conf->global->{$constname}==1) { + print $langs->trans("Customer"); + } elseif ($conf->global->{$constname}==0) { + print $langs->trans("NorProspectNorCustomer"); + } } else { print $conf->global->{$constname}; } @@ -327,7 +343,7 @@ if ($action == 'edit') { } -$moduledir = 'eventorganization'; +/*$moduledir = 'eventorganization'; $myTmpObjects = array(); $myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0); @@ -337,9 +353,6 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { continue; } if ($myTmpObjectArray['includerefgeneration']) { - /* - * Orders Numbering model - */ $setupnotempty++; print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', ''); @@ -444,9 +457,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { } if ($myTmpObjectArray['includedocgeneration']) { - /* - * Document templates generators - */ + $setupnotempty++; $type = strtolower($myTmpObjectKey); @@ -588,10 +599,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print ''; } } - -if (empty($setupnotempty)) { - print '
'.$langs->trans("NothingToSetup"); -} +*/ // Page end print dol_get_fiche_end(); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 33d74affd3e..c242904b074 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -42,6 +42,8 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send aft EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Template of email to send after a subscription to an event has been paid. EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email of massaction to attendes EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction to speakers +EVENTORGANIZATION_FILTERATTENDEES_CAT=Categories to filter thirdpartie's select list in attendees creation card/form +EVENTORGANIZATION_FILTERATTENDEES_TYPE=Thirdparty type to filter thirdpartie's select list in attendees creation card/form # # Object diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 06b169863f5..2e00c5c7cf9 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -80,6 +80,7 @@ $arrayofparameters = array( //'MYMODULE_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1), //'MYMODULE_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1), //'MYMODULE_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1), + //'MYMODULE_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1), ); $error = 0; @@ -271,6 +272,10 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + } elseif (preg_match('/thirdparty_type/', $val['type'])) { + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; + $formcompany = new FormCompany($db); + print $formcompany->selectProspectCustomerType($conf->global->{$constname}, $constname); } else { print ''; } @@ -327,6 +332,16 @@ if ($action == 'edit') { $toprint[] = '
  • color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '
  • '; } print '
    '; + } elseif (preg_match('/thirdparty_type/', $val['type'])) { + if ($conf->global->{$constname}==2) { + print $langs->trans("Prospect"); + } elseif ($conf->global->{$constname}==3) { + print $langs->trans("ProspectCustomer"); + } elseif ($conf->global->{$constname}==1) { + print $langs->trans("Customer"); + } elseif ($conf->global->{$constname}==0) { + print $langs->trans("NorProspectNorCustomer"); + } } else { print $conf->global->{$constname}; } From 639942352629ee538cb1de2e0601750fa2e38630 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Mar 2021 19:56:06 +0100 Subject: [PATCH 2/4] fix translation --- htdocs/langs/en_US/eventorganization.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index c242904b074..180e04e6ccd 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -42,8 +42,8 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send aft EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Template of email to send after a subscription to an event has been paid. EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email of massaction to attendes EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction to speakers -EVENTORGANIZATION_FILTERATTENDEES_CAT=Categories to filter thirdpartie's select list in attendees creation card/form -EVENTORGANIZATION_FILTERATTENDEES_TYPE=Thirdparty type to filter thirdpartie's select list in attendees creation card/form +EVENTORGANIZATION_FILTERATTENDEES_CAT = Filter thirdpartie's select list in attendees creation card/form with catagories +EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filter thirdpartie's select list in attendees creation card/form with customer type # # Object From 7a6cc742a6981c31e8bac70b9277e0f8934ddc98 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Mar 2021 19:57:20 +0100 Subject: [PATCH 3/4] fix translation --- htdocs/langs/en_US/eventorganization.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 180e04e6ccd..57106492f12 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -42,7 +42,7 @@ EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_BOOTH = Template of email to send aft EVENTORGANIZATION_TEMPLATE_EMAIL_AFT_SUBS_EVENT = Template of email to send after a subscription to an event has been paid. EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_SPEAKER = Template of email of massaction to attendes EVENTORGANIZATION_TEMPLATE_EMAIL_BULK_ATTENDES = Template of email of massaction to speakers -EVENTORGANIZATION_FILTERATTENDEES_CAT = Filter thirdpartie's select list in attendees creation card/form with catagories +EVENTORGANIZATION_FILTERATTENDEES_CAT = Filter thirdpartie's select list in attendees creation card/form with category EVENTORGANIZATION_FILTERATTENDEES_TYPE = Filter thirdpartie's select list in attendees creation card/form with customer type # From aa9d4342cd5088920e77166f9f43b1f2fb82ed86 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 26 Mar 2021 20:18:22 +0100 Subject: [PATCH 4/4] fix translation --- .../class/conferenceorboothattendee.class.php | 7 +++++++ htdocs/langs/en_US/eventorganization.lang | 1 + 2 files changed, 8 insertions(+) diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 4def01d2c7f..c8cec4172c7 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -194,6 +194,13 @@ class ConferenceOrBoothAttendee extends CommonObject $this->fields['entity']['enabled'] = 0; } + if (!empty($conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT)) { + $this->fields['fk_soc']['type'] .= ' AND rowid IN (SELECT DISTINCT c.fk_soc FROM '.MAIN_DB_PREFIX.'categorie_societe as c WHERE c.fk_categorie='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_CAT.')'; + } + if ($conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE!=='') { + $this->fields['fk_soc']['type'] .= ' AND client='.(int) $conf->global->EVENTORGANIZATION_FILTERATTENDEES_TYPE; + } + // Example to show how to set values of fields definition dynamically /*if ($user->rights->eventorganization->conferenceorboothattendee->read) { $this->fields['myfield']['visible'] = 1; diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 57106492f12..8dadf5fdb97 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -54,6 +54,7 @@ ConferenceOrBooth = Conference Or Booth ConferenceOrBoothTab = Conference Or Booth AmountOfSubscriptionPaid = Amount of subscription paid DateSubscription = Date of subscription +ConferenceOrBoothAttendee = Conference Or Booth Attendee # # Template Mail