From ae70dc11c6930fb53bb69198a7429a33a9f3b456 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Mon, 25 Jul 2022 22:28:07 +0200 Subject: [PATCH 01/13] Fixed labels --- htdocs/eventorganization/class/conferenceorbooth.class.php | 4 ++-- htdocs/langs/en_US/eventorganization.lang | 1 + htdocs/modulebuilder/template/class/myobject.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 3df55ff48f3..a2eb140c789 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -105,8 +105,8 @@ 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'=>'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', 'csslist'=>'tdoverflowmax125', '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'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"LinkToThirparty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1',), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'css'=>'tdoverflowmax150 maxwidth500'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:t.usage_organize_event=1', 'label'=>'Project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), '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, 'css'=>'width300'), diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 858e0937788..4b05b4e312e 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -139,6 +139,7 @@ OrganizationEventPaymentOfRegistrationWasReceived=Your payment for your event re OrganizationEventBulkMailToAttendees=This is a remind about your participation in the event as an attendee OrganizationEventBulkMailToSpeakers=This is a reminder on your participation in the event as a speaker OrganizationEventLinkToThirdParty=Link to third party (customer, supplier or partner) +OrganizationEvenLabelName=Public name of the conference or booth NewSuggestionOfBooth=Application for a booth NewSuggestionOfConference=Application for a conference diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index eedb4de0b13..b755d956342 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -108,7 +108,7 @@ class MyObject extends CommonObject 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>'Help text', 'showoncombobox'=>2, 'validate'=>1), 'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount', 'validate'=>1), 'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp', 'validate'=>1), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'picto'=>'company', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'OrganizationEventLinkToThirdParty', 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'validate'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60, 'validate'=>1), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61, 'validate'=>1, 'cssview'=>'wordbreak'), diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5fae77938e8..7f9715d0580 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -265,7 +265,7 @@ class Ticket extends CommonObject 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'), 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketCategory', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100 tdoverflowmax200'), 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), //'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), // what is this ? From 195b9f5ebc10c5a1e3a54bc8d26750cf4418ea2d Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Tue, 26 Jul 2022 00:02:14 +0200 Subject: [PATCH 02/13] Propagate all errors messages --- htdocs/public/eventorganization/attendee_new.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/public/eventorganization/attendee_new.php b/htdocs/public/eventorganization/attendee_new.php index 661ae6accfe..8bb85022b2e 100644 --- a/htdocs/public/eventorganization/attendee_new.php +++ b/htdocs/public/eventorganization/attendee_new.php @@ -60,6 +60,7 @@ global $dolibarr_main_url_root; // Init vars $errmsg = ''; +$errors = array(); $error = 0; $backtopage = GETPOST('backtopage', 'alpha'); $action = GETPOST('action', 'aZ09'); @@ -90,6 +91,7 @@ if ($type == 'conf') { if ($resultproject < 0) { $error++; $errmsg .= $project->error; + $errors = array_merge($errors, $project->errors); } } @@ -99,6 +101,7 @@ if ($type == 'global') { if ($resultproject < 0) { $error++; $errmsg .= $project->error; + $errors = array_merge($errors, $project->errors); } else { $sql = "SELECT COUNT(*) as nb FROM ".MAIN_DB_PREFIX."projet"; $sql .= " WHERE ".MAIN_DB_PREFIX."eventorganization_conferenceorboothattendee = ".((int) $project->id); @@ -279,6 +282,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if ($resultconfattendee < 0) { $error++; $errmsg .= $confattendee->error; + $errors = array_merge($errors, $confattendee->errors); } } @@ -403,6 +407,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen // If an error was found $error++; $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); } elseif ($resultfetchthirdparty == 0) { // No thirdparty found + a payment is expected // Creation of a new thirdparty if (!empty($societe)) { @@ -441,6 +446,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if ($readythirdparty < 0) { $error++; $errmsg .= $thirdparty->error; + $errors = array_merge($errors, $thirdparty->errors); } else { $thirdparty->country_code = getCountry($thirdparty->country_id, 2, $db, $langs); $thirdparty->country = getCountry($thirdparty->country_code, 0, $db, $langs); @@ -472,6 +478,7 @@ if (empty($reshook) && $action == 'add' && (!empty($conference->id) && $conferen if ($resultprod < 0) { $error++; $errmsg .= $productforinvoicerow->error; + $errors = array_merge($errors, $productforinvoicerow->errors); } else { $facture = new Facture($db); if (empty($confattendee->fk_invoice)) { @@ -668,7 +675,7 @@ if ($maxattendees && $currentnbofattendees >= $maxattendees) { print '
'; -dol_htmloutput_errors($errmsg); +dol_htmloutput_errors($errmsg, $errors); if ((!empty($conference->id) && $conference->status == ConferenceOrBooth::STATUS_CONFIRMED) || (!empty($project->id) && $project->status == Project::STATUS_VALIDATED)) { if (empty($maxattendees) || $currentnbofattendees < $maxattendees) { From d8fa7d84cc23e5e15d80bdb15e00655e542853e8 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Tue, 26 Jul 2022 14:40:17 +0200 Subject: [PATCH 03/13] Allow "smallint" values to store 0 in MySQL db without conversion to NULL It was an issue with ConferenceOrBoothAttendee instances --- htdocs/core/class/commonobject.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9cfe5b47de5..13e7cb333b8 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8675,7 +8675,7 @@ abstract class CommonObject public function isInt($info) { if (is_array($info)) { - if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) { + if (isset($info['type']) && (preg_match('/(^int|int$)/i', $info['type']))) { return true; } else { return false; @@ -8934,6 +8934,8 @@ abstract class CommonObject return 'NULL'; } elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) { return price2num("$value"); + } else if (preg_match('/int$/i', $fieldsentry['type'])) { + return (int)$value; } elseif ($fieldsentry['type'] == 'boolean') { if ($value) { return 'true'; From 6519edabc5c12831c171fce308330b3339bec4a2 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 27 Jul 2022 21:34:36 +0200 Subject: [PATCH 04/13] Error messages for category --- htdocs/categories/class/categorie.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index dad25199566..f860023ed4f 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -332,6 +332,7 @@ class Categorie extends CommonObject // Check parameters if (empty($id) && empty($label) && empty($ref_ext)) { + $this->error = "No category to search for"; return -1; } if (!is_null($type) && !is_numeric($type)) { @@ -389,6 +390,7 @@ class Categorie extends CommonObject return 1; } else { + $this->error = "No category found"; return 0; } } else { From 244f3913b075f4f4faf9f21e56f3e24a14c37342 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 27 Jul 2022 21:35:52 +0200 Subject: [PATCH 05/13] Qualify cactionevents for eventorganization --- htdocs/comm/action/class/cactioncomm.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index d2b089491a7..db62dfe6a9f 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -216,6 +216,9 @@ class CActionComm if ($obj->module == 'shipping' && !empty($conf->expedition->enabled) && !empty($user->rights->expedition->lire)) { $qualified = 1; } + if (preg_split("/@/", $obj->module, -1)[1] == 'eventorganization' && !empty($conf->eventorganization->enabled)) { + $qualified = 1; + } // For the generic case with type = 'module...' and module = 'myobject@mymodule' $regs = array(); if (preg_match('/^module/', $obj->type)) { From 5600fd63df04a657e834946fee04bfffc64243f7 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 27 Jul 2022 21:36:57 +0200 Subject: [PATCH 06/13] Retrieve category and insert default const at init of eventorganization module --- .../core/modules/modEventOrganization.class.php | 17 ++++++++++++++++- htdocs/langs/en_US/eventorganization.lang | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 93318bb952e..ad62dca3f3c 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -24,6 +24,7 @@ * \brief Description and activation file for the EventOrganization */ include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; /** * Description and activation class for module EventOrganization @@ -367,7 +368,21 @@ class modEventOrganization extends DolibarrModules } } - return $this->_init($sql, $options); + $langs->load("eventorganization"); + $cat = new Categorie($this->db); + $sql[] = "INSERT IGNORE INTO ".MAIN_DB_PREFIX.$cat->table_element."(label, type, entity, description, visible) VALUES('".$langs->trans('ApplicantOrVisitor')."', 2, 1, '".$langs->trans('EVENTORGANIZATION_CATEG_THIRDPARTY_CONF')."', 1)"; + + $init = $this->_init($sql, $options); + + if(empty($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF)) { + $langs->load('eventorganization'); + $res = $cat->fetch(null, $langs->trans('ApplicantOrVisitor')); + if($cat->id) { + dolibarr_set_const($this->db, 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF', $res); + } + } + + return $init; } /** diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 4b05b4e312e..7966c6712ad 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -60,6 +60,7 @@ ConferenceOrBoothTab = Conference Or Booth AmountPaid = Amount paid DateOfRegistration = Date of registration ConferenceOrBoothAttendee = Conference Or Booth Attendee +ApplicantOrVisitor=Applicant or visitor # # Template Mail From e271175de6c9f0cb6c91865b3472a7708d0e5330 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 27 Jul 2022 21:37:06 +0200 Subject: [PATCH 07/13] Display all errors --- htdocs/public/project/suggestconference.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 22589c941d2..ca34a05253d 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -463,8 +463,7 @@ print '
'; print '
'; print '
'; - -dol_htmloutput_errors($errmsg); +dol_htmloutput_errors($errmsg, $errors); // Print form print '
'."\n"; From e9528443b26fbcff5733c5a846e281e1fc4800d1 Mon Sep 17 00:00:00 2001 From: Yoan Mollard Date: Wed, 27 Jul 2022 22:12:36 +0200 Subject: [PATCH 08/13] Insert speaker contact type into db --- htdocs/core/modules/modEventOrganization.class.php | 1 + htdocs/langs/en_US/eventorganization.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index ad62dca3f3c..57b05131025 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -371,6 +371,7 @@ class modEventOrganization extends DolibarrModules $langs->load("eventorganization"); $cat = new Categorie($this->db); $sql[] = "INSERT IGNORE INTO ".MAIN_DB_PREFIX.$cat->table_element."(label, type, entity, description, visible) VALUES('".$langs->trans('ApplicantOrVisitor')."', 2, 1, '".$langs->trans('EVENTORGANIZATION_CATEG_THIRDPARTY_CONF')."', 1)"; + $sql[] = "INSERT IGNORE INTO ".MAIN_DB_PREFIX."c_type_contact(rowid, element, source, code, libelle, active) VALUES(300, 'conferenceorbooth', 'external', 'SPEAKER', '".$langs->trans('Speaker')."', 1)"; $init = $this->_init($sql, $options); diff --git a/htdocs/langs/en_US/eventorganization.lang b/htdocs/langs/en_US/eventorganization.lang index 7966c6712ad..b4179b04be6 100644 --- a/htdocs/langs/en_US/eventorganization.lang +++ b/htdocs/langs/en_US/eventorganization.lang @@ -61,6 +61,7 @@ AmountPaid = Amount paid DateOfRegistration = Date of registration ConferenceOrBoothAttendee = Conference Or Booth Attendee ApplicantOrVisitor=Applicant or visitor +Speaker=Speaker # # Template Mail From 6d2219e00c37aa8ad8074dea86bca311c18e65cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2022 15:26:34 +0200 Subject: [PATCH 09/13] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 13e7cb333b8..ab61d1f3381 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8189,7 +8189,7 @@ abstract class CommonObject $("select[name=\""+child_list+"\"] option[parent]").remove(); $("select[name=\""+child_list+"\"]").append(options); } - } else if(val > 0) { + } elseif(val > 0) { var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone(); $("select[name=\""+child_list+"\"] option[parent]").remove(); $("select[name=\""+child_list+"\"]").append(options); @@ -8212,7 +8212,7 @@ abstract class CommonObject if ($("#"+child_list).val() == 0 && $("#"+parent_list).val() == 0){ $("#"+child_list).hide(); //Show mother lists - } else if ($("#"+parent_list).val() != 0){ + } elseif ($("#"+parent_list).val() != 0){ $("#"+parent_list).show(); } //Show the child list if the parent list value is selected @@ -8320,8 +8320,8 @@ abstract class CommonObject /** * Get buy price to use for margin calculation. This function is called when buy price is unknown. * Set buy price = sell price if ForceBuyingPriceIfNull configured, - * else if calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice - * else if calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice + * elseif calculation MARGIN_TYPE = 'costprice' and costprice is defined, use costprice as buyprice + * elseif calculation MARGIN_TYPE = 'pmp' and pmp is calculated, use pmp as buyprice * else set min buy price as buy price * * @param float $unitPrice Product unit price @@ -8934,7 +8934,7 @@ abstract class CommonObject return 'NULL'; } elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) { return price2num("$value"); - } else if (preg_match('/int$/i', $fieldsentry['type'])) { + } elseif (preg_match('/int$/i', $fieldsentry['type'])) { return (int)$value; } elseif ($fieldsentry['type'] == 'boolean') { if ($value) { From c181b0bff4d480162efc139e6cbabc5b0112df26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2022 15:27:20 +0200 Subject: [PATCH 10/13] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ab61d1f3381..60c986b5531 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8935,7 +8935,7 @@ abstract class CommonObject } elseif (preg_match('/^(int|double|real|price)/i', $fieldsentry['type'])) { return price2num("$value"); } elseif (preg_match('/int$/i', $fieldsentry['type'])) { - return (int)$value; + return (int) $value; } elseif ($fieldsentry['type'] == 'boolean') { if ($value) { return 'true'; From 5e4ed0dea0940a795cd8a418e8e5d9ca622530d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2022 15:28:33 +0200 Subject: [PATCH 11/13] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 60c986b5531..ea58d599100 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8189,7 +8189,7 @@ abstract class CommonObject $("select[name=\""+child_list+"\"] option[parent]").remove(); $("select[name=\""+child_list+"\"]").append(options); } - } elseif(val > 0) { + } else if(val > 0) { var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone(); $("select[name=\""+child_list+"\"] option[parent]").remove(); $("select[name=\""+child_list+"\"]").append(options); @@ -8212,7 +8212,7 @@ abstract class CommonObject if ($("#"+child_list).val() == 0 && $("#"+parent_list).val() == 0){ $("#"+child_list).hide(); //Show mother lists - } elseif ($("#"+parent_list).val() != 0){ + } else if ($("#"+parent_list).val() != 0){ $("#"+parent_list).show(); } //Show the child list if the parent list value is selected From 75a8fdce111730bb1fbdd0ab3b445da93780db76 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 29 Jul 2022 13:33:16 +0000 Subject: [PATCH 12/13] Fixing style errors. --- htdocs/core/modules/modEventOrganization.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 57b05131025..c70897ae9df 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -375,10 +375,10 @@ class modEventOrganization extends DolibarrModules $init = $this->_init($sql, $options); - if(empty($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF)) { + if (empty($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF)) { $langs->load('eventorganization'); $res = $cat->fetch(null, $langs->trans('ApplicantOrVisitor')); - if($cat->id) { + if ($cat->id) { dolibarr_set_const($this->db, 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF', $res); } } From 9cc9b841387e8339786e8f7607d03275436e8621 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 29 Jul 2022 15:39:37 +0200 Subject: [PATCH 13/13] Update modEventOrganization.class.php --- htdocs/core/modules/modEventOrganization.class.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index c70897ae9df..5dd212b355d 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -368,21 +368,8 @@ class modEventOrganization extends DolibarrModules } } - $langs->load("eventorganization"); - $cat = new Categorie($this->db); - $sql[] = "INSERT IGNORE INTO ".MAIN_DB_PREFIX.$cat->table_element."(label, type, entity, description, visible) VALUES('".$langs->trans('ApplicantOrVisitor')."', 2, 1, '".$langs->trans('EVENTORGANIZATION_CATEG_THIRDPARTY_CONF')."', 1)"; - $sql[] = "INSERT IGNORE INTO ".MAIN_DB_PREFIX."c_type_contact(rowid, element, source, code, libelle, active) VALUES(300, 'conferenceorbooth', 'external', 'SPEAKER', '".$langs->trans('Speaker')."', 1)"; - $init = $this->_init($sql, $options); - if (empty($conf->global->EVENTORGANIZATION_CATEG_THIRDPARTY_CONF)) { - $langs->load('eventorganization'); - $res = $cat->fetch(null, $langs->trans('ApplicantOrVisitor')); - if ($cat->id) { - dolibarr_set_const($this->db, 'EVENTORGANIZATION_CATEG_THIRDPARTY_CONF', $res); - } - } - return $init; }