From f13ef507683788d5bee5cd387bba3611da2cd649 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 13:13:42 +0100 Subject: [PATCH 01/29] set good agenda type event --- .../class/conferenceorbooth.class.php | 24 +++++++------------ ...ventorganization_conferenceorbooth.lib.php | 12 ---------- .../install/mysql/data/llx_c_actioncomm.sql | 4 ++++ .../install/mysql/migration/13.0.0-14.0.0.sql | 7 ++++++ .../install/mysql/tables/llx_c_actioncomm.sql | 4 ++-- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index d87ad431b7c..7720618a525 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -65,8 +65,9 @@ class ConferenceOrBooth extends CommonObject const STATUS_DRAFT = 0; - const STATUS_VALIDATED = 1; - const STATUS_CANCELED = 9; + const STATUS_SUGGESTED = 1; + const STATUS_CONFIRMED = 1; + const STATUS_NOTSELECTED = 9; /** @@ -103,30 +104,23 @@ class ConferenceOrBooth extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'help'=>"Help text", 'showoncombobox'=>'1',), - //'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"Help text for amount",), - //'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>45, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'help'=>"Help text for quantity",), '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,), - 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3,), - 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), - 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,), - 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), + 'note' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>1,), + 'format' => array('type'=>'sellist:c_eventorganization_fcob:label:rowid::type IN (\'conference\',\'booth\')', '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_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), - 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), - 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), + '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,), - 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'),), ); public $rowid; public $ref; public $label; - public $amount; - public $qty; public $fk_soc; public $fk_project; - public $description; + public $note; public $note_public; public $note_private; public $date_creation; diff --git a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php index 792fa77d087..f689749e3e6 100644 --- a/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php +++ b/htdocs/eventorganization/lib/eventorganization_conferenceorbooth.lib.php @@ -41,18 +41,6 @@ function conferenceorboothPrepareHead($object) $head[$h][2] = 'card'; $h++; - if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) - { - $nbNote = 0; - if (!empty($object->note_private)) $nbNote++; - if (!empty($object->note_public)) $nbNote++; - $head[$h][0] = dol_buildpath('/eventorganization/conferenceorbooth_note.php', 1).'?id='.$object->id; - $head[$h][1] = $langs->trans('Notes'); - if ($nbNote > 0) $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); - $head[$h][2] = 'note'; - $h++; - } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $upload_dir = $conf->eventorganization->dir_output."/conferenceorbooth/".dol_sanitizeFileName($object->ref); diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index cb22ee70ce3..f40c358e61f 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -48,3 +48,7 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) -- Code used from 3.3+ when type of event is not used insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index eaad793b47f..46e2981a059 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -179,6 +179,13 @@ ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions 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); +ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; +ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; + +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63); -- Code enhanced - Standardize field name ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_c_actioncomm.sql b/htdocs/install/mysql/tables/llx_c_actioncomm.sql index 695aabbe6e4..a2b2dffe8a7 100644 --- a/htdocs/install/mysql/tables/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_c_actioncomm.sql @@ -21,10 +21,10 @@ create table llx_c_actioncomm ( id integer PRIMARY KEY, - code varchar(12) NOT NULL, + code varchar(50) NOT NULL, type varchar(50) DEFAULT 'system' NOT NULL, libelle varchar(48) NOT NULL, - module varchar(16) DEFAULT NULL, + module varchar(50) DEFAULT NULL, active tinyint DEFAULT 1 NOT NULL, todo tinyint, -- deprecated color varchar(9), From bf04a8cf1b1bdf7cd9ef652510e365978966833f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 13:35:16 +0100 Subject: [PATCH 02/29] ongoing --- htdocs/comm/action/class/cactioncomm.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 3b759db4098..6299c2f5e18 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -210,6 +210,12 @@ class CActionComm if ($obj->module == 'shipping' && !$conf->expedition->enabled) { $qualified = 0; } + if ($obj->module == 'eventorganization' && !$conf->eventorganization->enabled) { + $qualified = 0; + } + if (!empty($obj->module) && preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && isset($conf->{$obj->module}->enabled) && !$conf->{$obj->module}->enabled) { + $qualified = 0; + } } if ($qualified) { From eb17ae5fe273dade1c59e464c694d025f61e444d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 14:13:42 +0100 Subject: [PATCH 03/29] fix event type select --- .../comm/action/class/cactioncomm.class.php | 29 ++++++++++++------- .../install/mysql/data/llx_c_actioncomm.sql | 10 ++++--- .../install/mysql/migration/13.0.0-14.0.0.sql | 9 +++--- htdocs/langs/en_US/commercial.lang | 1 + 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 6299c2f5e18..e82e46d47db 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -153,7 +153,7 @@ class CActionComm public function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) { // phpcs:enable - global $langs, $conf; + global $langs, $conf, $user; $langs->load("commercial"); $repid = array(); @@ -191,29 +191,29 @@ class CActionComm $qualified = 0; // We discard detailed system events. We keep only the 2 generic lines (AC_OTH and AC_OTH_AUTO) } - if ($qualified && $obj->module) { - if ($obj->module == 'invoice' && !$conf->facture->enabled) { + if ($qualified && !empty($obj->module)) { + if ($obj->module == 'invoice' && empty($conf->facture->enabled) && empty($user->facture->lire)) { $qualified = 0; } - if ($obj->module == 'order' && !$conf->commande->enabled) { + if ($obj->module == 'order' && empty($conf->commande->enabled) && empty($user->commande->lire)) { $qualified = 0; } - if ($obj->module == 'propal' && !$conf->propal->enabled) { + if ($obj->module == 'propal' && empty($conf->propal->enabled) && empty($user->propale->lire)) { $qualified = 0; } - if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_invoice->enabled)) { + if ($obj->module == 'invoice_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled)) && empty($user->fournisseur->facture->lire)) { $qualified = 0; } - if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !$conf->supplier_order->enabled)) { + if ($obj->module == 'order_supplier' && ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled)) && empty($user->fournisseur->commande->lire)) { $qualified = 0; } - if ($obj->module == 'shipping' && !$conf->expedition->enabled) { + if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) { $qualified = 0; } - if ($obj->module == 'eventorganization' && !$conf->eventorganization->enabled) { + if ($obj->module == 'eventorganization' && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) { $qualified = 0; } - if (!empty($obj->module) && preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && isset($conf->{$obj->module}->enabled) && !$conf->{$obj->module}->enabled) { + if (!preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && empty($conf->{$obj->module}->enabled)) { $qualified = 0; } } @@ -252,6 +252,14 @@ class CActionComm $repid[-98] = $langs->trans("ActionAC_AUTO"); $repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO"); } + if (preg_match('/^system@/', $typecalendar)) { + $label = '   '.$label; + if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module + $idforallfornewmodule--; + } + $repid[$idforallfornewmodule] = $langs->trans("ActionAC_".strtoupper($obj->module)); + $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); + } if ($typecalendar == 'module') { $label = '   '.$label; if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module @@ -260,6 +268,7 @@ class CActionComm $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module)); $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); } + } $repid[$obj->id] = $label; $repcode[$obj->code] = $label; diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index f40c358e61f..2a9483e5f8a 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -48,7 +48,9 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) -- Code used from 3.3+ when type of event is not used insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63); + +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63); + diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index a2fca43d1af..988e3140665 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -188,11 +188,10 @@ ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8); ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','conference','Online/Virtual conference','eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','conference','Indoor conference','eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','booth','Online/Virtual booth','eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','booth','Indoor booth','eventorganization', 1, 63); - +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63); -- Code enhanced - Standardize field name ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0; ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0; diff --git a/htdocs/langs/en_US/commercial.lang b/htdocs/langs/en_US/commercial.lang index 2181b48ecb4..21d282cd794 100644 --- a/htdocs/langs/en_US/commercial.lang +++ b/htdocs/langs/en_US/commercial.lang @@ -68,6 +68,7 @@ ActionAC_OTH_AUTO=Other auto ActionAC_MANUAL=Manually inserted events ActionAC_AUTO=Automatically inserted events ActionAC_OTH_AUTOShort=Other +ActionAC_EVENTORGANIZATION=Event organization events Stats=Sales statistics StatusProsp=Prospect status DraftPropals=Draft commercial proposals From 8bb0ff065aeafe2427b042d5a8f17ca5741480a6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 14:19:02 +0100 Subject: [PATCH 04/29] add missing column on actioncomm --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_actioncomm.sql | 3 +++ 2 files changed, 6 insertions(+) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 988e3140665..0420ffe721c 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -185,6 +185,9 @@ ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions 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); +ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer; +ALTER TABLE llx_actioncomm ADD COLUMN is_booth_paid smallint NOT NULL DEFAULT 0; + ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 82d97d3ec98..a3aa4218161 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -71,6 +71,9 @@ create table llx_actioncomm recurid varchar(128), -- used to store event id to link each other all the repeating event record. It can be the 'iCalUID' as in RFC5545 (an id similar for all the same serie) recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date + + num_vote integer, -- use for Event Organization module + is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) From 1041291bda9be570d3ab6fc8626887665d936924 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 14:24:41 +0100 Subject: [PATCH 05/29] manage status --- .../class/conferenceorbooth.class.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 7720618a525..e2248e7d91a 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -66,8 +66,10 @@ class ConferenceOrBooth extends CommonObject const STATUS_DRAFT = 0; const STATUS_SUGGESTED = 1; - const STATUS_CONFIRMED = 1; - const STATUS_NOTSELECTED = 9; + const STATUS_CONFIRMED = 2; + const STATUS_NOTSELECTED = 3; + const STATUS_DONE = 4; + const STATUS_CANCELED = 5; /** @@ -793,14 +795,21 @@ class ConferenceOrBooth extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { + global $langs; //$langs->load("eventorganization@eventorganization"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelStatus[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Disabled'); + $this->labelStatus[self::STATUS_SUGGESTED] = $langs->trans('Suggested'); + $this->labelStatus[self::STATUS_CONFIRMED] = $langs->trans('Confirmed'); + $this->labelStatus[self::STATUS_NOTSELECTED] = $langs->trans('NotSelected'); + $this->labelStatus[self::STATUS_DONE] = $langs->trans('Done'); + $this->labelStatus[self::STATUS_CANCELED] = $langs->trans('Canceled'); $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('Draft'); - $this->labelStatusShort[self::STATUS_VALIDATED] = $langs->trans('Enabled'); - $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Disabled'); + $this->labelStatusShort[self::STATUS_SUGGESTED] = $langs->trans('Suggested'); + $this->labelStatusShort[self::STATUS_CONFIRMED] = $langs->trans('Confirmed'); + $this->labelStatusShort[self::STATUS_NOTSELECTED] = $langs->trans('NotSelected'); + $this->labelStatusShort[self::STATUS_DONE] = $langs->trans('Done'); + $this->labelStatusShort[self::STATUS_CANCELED] = $langs->trans('Canceled'); } $statusType = 'status'.$status; From eca98237f083362c6142eaf12a071380fc1c43a1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 27 Feb 2021 13:57:52 +0000 Subject: [PATCH 06/29] Fixing style errors. --- htdocs/comm/action/class/cactioncomm.class.php | 1 - htdocs/eventorganization/class/conferenceorbooth.class.php | 1 - 2 files changed, 2 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index e82e46d47db..c40be6c1d33 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -268,7 +268,6 @@ class CActionComm $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module)); $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); } - } $repid[$obj->id] = $label; $repcode[$obj->code] = $label; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index e2248e7d91a..667040ddc8a 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -795,7 +795,6 @@ class ConferenceOrBooth extends CommonObject // phpcs:enable if (empty($this->labelStatus) || empty($this->labelStatusShort)) { - global $langs; //$langs->load("eventorganization@eventorganization"); $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('Draft'); From 5221b5953944baf43fa98de4d9e18e1f23aa7ace Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 15:34:28 +0100 Subject: [PATCH 07/29] set correct field name as conference or booth are in actioncomm table --- htdocs/core/class/commonobject.class.php | 15 +- .../class/conferenceorbooth.class.php | 225 ++++-------------- .../install/mysql/tables/llx_actioncomm.sql | 5 +- .../template/class/myobject.class.php | 2 +- 4 files changed, 65 insertions(+), 182 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 008a1b21e40..c822c925d97 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8388,9 +8388,10 @@ abstract class CommonObject * @param int $id Id object * @param string $ref Ref * @param string $morewhere More SQL filters (' AND ...') + * @param string $idFieldName Should always be rowid * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetchCommon($id, $ref = null, $morewhere = '') + public function fetchCommon($id, $ref = null, $morewhere = '', $idFieldName='rowid') { if (empty($id) && empty($ref) && empty($morewhere)) { return -1; @@ -8405,7 +8406,7 @@ abstract class CommonObject $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; if (!empty($id)) { - $sql .= ' WHERE rowid = '.$id; + $sql .= ' WHERE '.$idFieldName.' = '.$id; } elseif (!empty($ref)) { $sql .= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); } else { @@ -8494,9 +8495,10 @@ abstract class CommonObject * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers + * @param string $idFieldName Should always be rowid * @return int <0 if KO, >0 if OK */ - public function updateCommon(User $user, $notrigger = false) + public function updateCommon(User $user, $notrigger = false, $idFieldName='rowid') { global $conf, $langs; dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG); @@ -8547,7 +8549,7 @@ abstract class CommonObject }*/ } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE '.$idFieldName.'='.$this->id; $this->db->begin(); if (!$error) { @@ -8592,9 +8594,10 @@ abstract class CommonObject * @param User $user User that deletes * @param bool $notrigger false=launch triggers after, true=disable triggers * @param int $forcechilddeletion 0=no, 1=Force deletion of children + * @param string $idFieldName Should always be rowid * @return int <=0 if KO, >0 if OK */ - public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) + public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0, $idFieldName='rowid') { dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG); @@ -8693,7 +8696,7 @@ abstract class CommonObject } if (!$error) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE '.$idFieldName.'='.$this->id; $res = $this->db->query($sql); if ($res === false) { diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index e2248e7d91a..c33d902e637 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -103,13 +103,12 @@ class ConferenceOrBooth extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), + 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, '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,), - 'format' => array('type'=>'sellist:c_eventorganization_fcob:label:rowid::type IN (\'conference\',\'booth\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1,), + 'fk_action' => array('type'=>'sellist:c_eventorganization_fcob:label:rowid::type IN (\'conference\',\'booth\')', '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',), @@ -118,20 +117,17 @@ class ConferenceOrBooth extends CommonObject 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Brouillon', '1'=>'Validé', '9'=>'Annulé'),), ); public $rowid; - public $ref; + public $id; public $label; public $fk_soc; public $fk_project; public $note; - public $note_public; - public $note_private; - public $date_creation; + public $fk_action; + public $datec; public $tms; - public $fk_user_creat; - public $fk_user_modif; - public $last_main_doc; + public $fk_user_author; + public $fk_user_mod; public $import_key; - public $model_pdf; public $status; // END MODULEBUILDER PROPERTIES @@ -226,6 +222,16 @@ class ConferenceOrBooth extends CommonObject */ public function create(User $user, $notrigger = false) { + if (empty($this->datec)) { + $this->datec = $this->db->idate(dol_now()); + } + if (! (int) $this->fk_user_author > 0) { + $this->fk_user_author = $user->id; + } + if (! (int) $this->fk_user_mod > 0) { + $this->fk_user_mod = $user->id; + } + return $this->createCommon($user, $notrigger); } @@ -261,11 +267,9 @@ class ConferenceOrBooth extends CommonObject unset($object->import_key); // Clear fields - if (property_exists($object, 'ref')) $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; if (property_exists($object, 'label')) $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; if (property_exists($object, 'status')) { $object->status = self::STATUS_DRAFT; } - if (property_exists($object, 'date_creation')) { $object->date_creation = dol_now(); } - if (property_exists($object, 'date_modification')) { $object->date_modification = null; } + if (property_exists($object, 'datec')) { $object->date_creation = dol_now(); } // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) @@ -303,7 +307,7 @@ class ConferenceOrBooth extends CommonObject if (!$error) { // copy external contacts if same company - if (property_exists($this, 'socid') && $this->socid == $object->socid) + if (property_exists($this, 'fk_soc') && $this->fk_soc == $object->socid) { if ($this->copy_linked_contact($object, 'external') < 0) $error++; @@ -331,7 +335,7 @@ class ConferenceOrBooth extends CommonObject */ public function fetch($id, $ref = null) { - $result = $this->fetchCommon($id, $ref); + $result = $this->fetchCommon($id, $ref, '', 'id'); if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); return $result; } @@ -378,7 +382,7 @@ class ConferenceOrBooth extends CommonObject $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - if ($key == 't.rowid') { + if ($key == 't.id') { $sqlwhere[] = $key.'='.$value; } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; @@ -437,7 +441,11 @@ class ConferenceOrBooth extends CommonObject */ public function update(User $user, $notrigger = false) { - return $this->updateCommon($user, $notrigger); + if (! (int) $this->fk_user_mod > 0) { + $this->fk_user_mod = $user->id; + } + + return $this->updateCommon($user, $notrigger,'id'); } /** @@ -449,7 +457,7 @@ class ConferenceOrBooth extends CommonObject */ public function delete(User $user, $notrigger = false) { - return $this->deleteCommon($user, $notrigger); + return $this->deleteCommon($user, $notrigger,0,'id'); //return $this->deleteCommon($user, $notrigger, 1); } @@ -489,9 +497,9 @@ class ConferenceOrBooth extends CommonObject $error = 0; // Protection - if ($this->status == self::STATUS_VALIDATED) + if ($this->status == self::STATUS_CONFIRMED) { - dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING); + dol_syslog(get_class($this)."::validate action abandonned: already confirmed", LOG_WARNING); return 0; } @@ -507,87 +515,32 @@ class ConferenceOrBooth extends CommonObject $this->db->begin(); - // Define new ref - if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + // Validate + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; + $sql .= " status = ".self::STATUS_CONFIRMED; + $sql .= " WHERE id = ".$this->id; + + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { - $num = $this->getNextNumRef(); - } else { - $num = $this->ref; - } - $this->newref = $num; - - if (!empty($num)) { - // Validate - $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " SET ref = '".$this->db->escape($num)."',"; - $sql .= " status = ".self::STATUS_VALIDATED; - if (!empty($this->fields['date_validation'])) $sql .= ", date_validation = '".$this->db->idate($now)."'"; - if (!empty($this->fields['fk_user_valid'])) $sql .= ", fk_user_valid = ".$user->id; - $sql .= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::validate()", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - dol_print_error($this->db); - $this->error = $this->db->lasterror(); - $error++; - } - - if (!$error && !$notrigger) - { - // Call trigger - $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user); - if ($result < 0) $error++; - // End call triggers - } + dol_print_error($this->db); + $this->error = $this->db->lasterror(); + $error++; } - if (!$error) + if (!$error && !$notrigger) { - $this->oldref = $this->ref; - - // Rename directory if dir was a temporary ref - if (preg_match('/^[\(]?PROV/i', $this->ref)) - { - // Now we rename also files into index - $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'conferenceorbooth/".$this->db->escape($this->newref)."'"; - $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'conferenceorbooth/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; - $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->error = $this->db->lasterror(); } - - // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments - $oldref = dol_sanitizeFileName($this->ref); - $newref = dol_sanitizeFileName($num); - $dirsource = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$oldref; - $dirdest = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref; - if (!$error && file_exists($dirsource)) - { - dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); - - if (@rename($dirsource, $dirdest)) - { - dol_syslog("Rename ok"); - // Rename docs starting with $oldref with $newref - $listoffiles = dol_dir_list($conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); - foreach ($listoffiles as $fileentry) - { - $dirsource = $fileentry['name']; - $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); - $dirsource = $fileentry['path'].'/'.$dirsource; - $dirdest = $fileentry['path'].'/'.$dirdest; - @rename($dirsource, $dirdest); - } - } - } - } + // Call trigger + $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user); + if ($result < 0) $error++; + // End call triggers } // Set new ref and current status if (!$error) { - $this->ref = $num; - $this->status = self::STATUS_VALIDATED; + $this->status = self::STATUS_CONFIRMED; } if (!$error) @@ -636,7 +589,7 @@ class ConferenceOrBooth extends CommonObject public function cancel($user, $notrigger = 0) { // Protection - if ($this->status != self::STATUS_VALIDATED) + if ($this->status != self::STATUS_CONFIRMED) { return 0; } @@ -673,7 +626,7 @@ class ConferenceOrBooth extends CommonObject return -1; }*/ - return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'CONFERENCEORBOOTH_REOPEN'); + return $this->setStatusCommon($user, self::STATUS_CONFIRMED, $notrigger, 'CONFERENCEORBOOTH_REOPEN'); } /** @@ -699,7 +652,7 @@ class ConferenceOrBooth extends CommonObject $label .= ' '.$this->getLibStatut(5); } $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref; + $label .= ''.$langs->trans('Ref').': '.$this->id; $url = dol_buildpath('/eventorganization/conferenceorbooth_card.php', 1).'?id='.$this->id; @@ -827,10 +780,10 @@ class ConferenceOrBooth extends CommonObject */ public function info($id) { - $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql .= ' fk_user_creat, fk_user_modif'; + $sql = 'SELECT rowid, datec as datec, tms as datem,'; + $sql .= ' fk_user_author, fk_user_mod'; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql .= ' WHERE t.rowid = '.$id; + $sql .= ' WHERE t.id = '.$id; $result = $this->db->query($sql); if ($result) { @@ -845,23 +798,8 @@ class ConferenceOrBooth extends CommonObject $this->user_creation = $cuser; } - if ($obj->fk_user_valid) - { - $vuser = new User($this->db); - $vuser->fetch($obj->fk_user_valid); - $this->user_validation = $vuser; - } - - if ($obj->fk_user_cloture) - { - $cluser = new User($this->db); - $cluser->fetch($obj->fk_user_cloture); - $this->user_cloture = $cluser; - } - $this->date_creation = $this->db->jdate($obj->datec); $this->date_modification = $this->db->jdate($obj->datem); - $this->date_validation = $this->db->jdate($obj->datev); } $this->db->free($result); @@ -904,65 +842,6 @@ class ConferenceOrBooth extends CommonObject } } - /** - * Returns the reference to the following non used object depending on the active numbering module. - * - * @return string Object free reference - */ - public function getNextNumRef() - { - global $langs, $conf; - $langs->load("eventorganization@eventorganization"); - - if (empty($conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON)) { - $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON = 'mod_conferenceorbooth_standard'; - } - - if (!empty($conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON)) - { - $mybool = false; - - $file = $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON.".php"; - $classname = $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON; - - // Include file with class - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) - { - $dir = dol_buildpath($reldir."core/modules/eventorganization/"); - - // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; - } - - if ($mybool === false) - { - dol_print_error('', "Failed to include file ".$file); - return ''; - } - - if (class_exists($classname)) { - $obj = new $classname(); - $numref = $obj->getNextValue($this); - - if ($numref != '' && $numref != '-1') - { - return $numref; - } else { - $this->error = $obj->error; - //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); - return ""; - } - } else { - print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; - return ""; - } - } else { - print $langs->trans("ErrorNumberingModuleNotSetup", $this->element); - return ""; - } - } - /** * Create a document onto disk according to template module. * diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index a3aa4218161..f57b7885e3d 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -31,7 +31,7 @@ create table llx_actioncomm fk_action integer, -- type of action (optional link with id in llx_c_actioncomm or null) code varchar(50) NULL, -- code of action for automatic action ('AC_OTH_AUTO' for automatic actions, 'AC_EMAILIN_AUTO' for email input, 'AC_xxx' for manual action...) - + datec datetime, -- date creation tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- last modification date fk_user_author integer, -- user id of user that has created record @@ -74,7 +74,8 @@ create table llx_actioncomm num_vote integer, -- use for Event Organization module is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module - + status smallint NOT NULL DEFAULT 0, -- use for Event Organization module + fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2b17b0f84f8..b4428312018 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -356,7 +356,7 @@ class MyObject extends CommonObject if (!$error) { // copy external contacts if same company - if (property_exists($this, 'socid') && $this->socid == $object->socid) { + if (property_exists($this, 'fk_soc') && $this->fk_soc == $object->socid) { if ($this->copy_linked_contact($object, 'external') < 0) { $error++; } From d5dc95d99e3bf981848b62a77d6583768adff37b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Sat, 27 Feb 2021 15:36:36 +0100 Subject: [PATCH 08/29] add status column --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 0420ffe721c..f62f9771bed 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -187,6 +187,7 @@ ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8); ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer; ALTER TABLE llx_actioncomm ADD COLUMN is_booth_paid smallint NOT NULL DEFAULT 0; +ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0; ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; From e101ff0d6d3a1a837d7a369d8bdc11027f08e2f2 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 1 Mar 2021 15:34:02 +0100 Subject: [PATCH 09/29] change comlumn name --- htdocs/eventorganization/class/conferenceorbooth.class.php | 4 ++-- htdocs/install/mysql/tables/llx_actioncomm.sql | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index bb4992bf512..471758a1f69 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -24,13 +24,13 @@ // Put here all includes required by your class file require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; -//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; /** * Class for ConferenceOrBooth */ -class ConferenceOrBooth extends CommonObject +class ConferenceOrBooth extends ActionComm { /** * @var string ID of module. diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index f57b7885e3d..167afca56c5 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -72,9 +72,9 @@ create table llx_actioncomm recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date - num_vote integer, -- use for Event Organization module - is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module - status smallint NOT NULL DEFAULT 0, -- use for Event Organization module + eventorg_num_vote integer, -- use for Event Organization module + eventorg_is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module + statut smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) From 036d1d5802f829dd3ac46584755625e623c6efeb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 1 Mar 2021 15:36:22 +0100 Subject: [PATCH 10/29] change comlumn name --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 4 ++-- htdocs/install/mysql/tables/llx_actioncomm.sql | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 471758a1f69..8de75d173b2 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -67,7 +67,7 @@ class ConferenceOrBooth extends ActionComm const STATUS_DRAFT = 0; const STATUS_SUGGESTED = 1; const STATUS_CONFIRMED = 2; - const STATUS_NOTSELECTED = 3; + const STATUS_NOT_QUALIFIED = 3; const STATUS_DONE = 4; const STATUS_CANCELED = 5; diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index f62f9771bed..b2a26f51c24 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -185,8 +185,8 @@ ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions 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); -ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer; -ALTER TABLE llx_actioncomm ADD COLUMN is_booth_paid smallint NOT NULL DEFAULT 0; +ALTER TABLE llx_actioncomm ADD COLUMN eventorg_num_vote integer; +ALTER TABLE llx_actioncomm ADD COLUMN eventorg_is_booth_paid smallint NOT NULL DEFAULT 0; ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0; ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 167afca56c5..c845b269dd8 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -74,7 +74,7 @@ create table llx_actioncomm eventorg_num_vote integer, -- use for Event Organization module eventorg_is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module - statut smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now + status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) From 5ba9ffeb09efe3f4efed123e26956a789b4cbf33 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 1 Mar 2021 15:36:50 +0100 Subject: [PATCH 11/29] change comlumn name --- htdocs/eventorganization/class/conferenceorbooth.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 8de75d173b2..8a344835a55 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 = 5; + const STATUS_CANCELED = -1; /** From b5fd3e49849dccb79bf6dc4f1ce3ff9028dc278c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 1 Mar 2021 17:06:03 +0100 Subject: [PATCH 12/29] on going --- .../comm/action/class/cactioncomm.class.php | 22 +++++++++---------- .../class/conferenceorbooth.class.php | 8 +++++-- .../install/mysql/data/llx_c_actioncomm.sql | 9 ++++---- .../install/mysql/migration/13.0.0-14.0.0.sql | 11 ++++++---- .../install/mysql/tables/llx_actioncomm.sql | 7 +++--- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index c40be6c1d33..af7ab32f7de 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -210,7 +210,7 @@ class CActionComm if ($obj->module == 'shipping' && empty($conf->expedition->enabled) && empty($user->expedition->lire)) { $qualified = 0; } - if ($obj->module == 'eventorganization' && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) { + if (preg_match('/@eventorganization/', $obj->module) && empty($conf->eventorganization->enabled) && empty($user->eventorganization->read)) { $qualified = 0; } if (!preg_match('/^system/', $obj->type) && isset($conf->{$obj->module}) && empty($conf->{$obj->module}->enabled)) { @@ -252,21 +252,19 @@ class CActionComm $repid[-98] = $langs->trans("ActionAC_AUTO"); $repcode['AC_ALL_AUTO'] = '-- '.$langs->trans("ActionAC_AUTO"); } - if (preg_match('/^system@/', $typecalendar)) { - $label = '   '.$label; - if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module - $idforallfornewmodule--; - } - $repid[$idforallfornewmodule] = $langs->trans("ActionAC_".strtoupper($obj->module)); - $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); - } if ($typecalendar == 'module') { + //TODO check if possible to push it between system and systemauto + if (preg_match('/@/', $obj->module)) { + $module = explode('@',$obj->module)[1]; + } else { + $module = $obj->module; + } $label = '   '.$label; - if (!isset($repcode['AC_ALL_'.strtoupper($obj->module)])) { // If first time for this module + if (!isset($repcode['AC_ALL_'.strtoupper($module)])) { // If first time for this module $idforallfornewmodule--; } - $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($obj->module)); - $repcode['AC_ALL_'.strtoupper($obj->module)] = '-- '.$langs->trans("Module").' '.ucfirst($obj->module); + $repid[$idforallfornewmodule] = $langs->trans("ActionAC_ALL_".strtoupper($module)); + $repcode['AC_ALL_'.strtoupper($module)] = '-- '.$langs->trans("Module").' '.ucfirst($module); } } $repid[$obj->id] = $label; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 8a344835a55..b1f98694165 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -104,11 +104,12 @@ 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"), '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_eventorganization_fcob:label:rowid::type IN (\'conference\',\'booth\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, '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,), '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',), @@ -231,8 +232,9 @@ class ConferenceOrBooth extends ActionComm if (! (int) $this->fk_user_mod > 0) { $this->fk_user_mod = $user->id; } + //TODO set percent according status - return $this->createCommon($user, $notrigger); + return parent::create($user, $notrigger); } /** @@ -367,6 +369,8 @@ class ConferenceOrBooth extends ActionComm */ public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { + + //TODO set percent according status global $conf; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 2a9483e5f8a..17c1fd42f9f 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -49,8 +49,7 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63); - +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index b2a26f51c24..6ed78d2637e 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -189,13 +189,16 @@ ALTER TABLE llx_actioncomm ADD COLUMN eventorg_num_vote integer; ALTER TABLE llx_actioncomm ADD COLUMN eventorg_is_booth_paid smallint NOT NULL DEFAULT 0; ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0; +# TODO manage ref into cationcomm class +ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255); + ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','system@conference','Online/Virtual conference','eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','system@conference','Indoor conference','eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','system@booth','Online/Virtual booth','eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','system@booth','Indoor booth','eventorganization', 1, 63); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); +insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); -- Code enhanced - Standardize field name ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0; ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index c845b269dd8..b7cc062368a 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -24,6 +24,7 @@ create table llx_actioncomm ( id integer AUTO_INCREMENT PRIMARY KEY, + ref varchar(255), ref_ext varchar(255), -- reference into an external system (not used by dolibarr). Example: An id coming from google calendar has length between 5 and 1024 chars. An event id must follow rule: chars used in base32hex encoding (i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in RFC2938) entity integer DEFAULT 1 NOT NULL, -- multi company id datep datetime, -- date start @@ -72,9 +73,9 @@ create table llx_actioncomm recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date - eventorg_num_vote integer, -- use for Event Organization module - eventorg_is_booth_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module - status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now + num_vote integer, -- use for Event Organization module + event_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module + status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) From e5e3abd6853903fb0806ac080cbb1fc11fb7f693 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Mar 2021 22:23:54 +0100 Subject: [PATCH 13/29] class conference or booth or and table actioncomm ok --- htdocs/comm/action/class/actioncomm.class.php | 56 +++- .../class/conferenceorbooth.class.php | 286 +----------------- .../install/mysql/data/llx_c_actioncomm.sql | 8 +- .../install/mysql/migration/13.0.0-14.0.0.sql | 13 +- .../install/mysql/tables/llx_actioncomm.sql | 6 +- 5 files changed, 79 insertions(+), 290 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f381351f818..3b0273f2831 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -349,6 +349,21 @@ class ActionComm extends CommonObject */ public $errors_to; + /** + * @var int number of vote for an event + */ + public $num_vote; + + /** + * @var int if event is paid + */ + public $event_paid; + + /** + * @var int status use but Event organisation module + */ + public $status; + /** * Typical value for a event that is in a todo state */ @@ -509,7 +524,10 @@ class ActionComm extends CommonObject $sql .= "email_tocc,"; $sql .= "email_tobcc,"; $sql .= "email_subject,"; - $sql .= "errors_to"; + $sql .= "errors_to,"; + $sql .= "num_vote,"; + $sql .= "event_paid,"; + $sql .= "status"; $sql .= ") VALUES ("; $sql .= "'".$this->db->idate($now)."', "; $sql .= (strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : "null").", "; @@ -539,14 +557,23 @@ class ActionComm extends CommonObject $sql .= (!empty($this->email_tocc) ? "'".$this->db->escape($this->email_tocc)."'" : "null").", "; $sql .= (!empty($this->email_tobcc) ? "'".$this->db->escape($this->email_tobcc)."'" : "null").", "; $sql .= (!empty($this->email_subject) ? "'".$this->db->escape($this->email_subject)."'" : "null").", "; - $sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null"); + $sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null").", "; + $sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", "; + $sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", "; + $sql .= (!empty($this->status) ? (int) $this->status : "null"); $sql .= ")"; dol_syslog(get_class($this)."::add", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $this->ref = $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); - + $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ref='".$this->ref."' WHERE id=".$this->id ; + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + dol_syslog('Error to process ref: '.$this->db->lasterror(), LOG_ERR); + $this->errors[] = $this->db->lasterror(); + } // Now insert assigned users if (!$error) { //dol_syslog(var_export($this->userassigned, true)); @@ -697,7 +724,7 @@ class ActionComm extends CommonObject global $langs; $sql = "SELECT a.id,"; - $sql .= " a.id as ref,"; + $sql .= " a.ref as ref,"; $sql .= " a.entity,"; $sql .= " a.ref_ext,"; $sql .= " a.datep,"; @@ -717,13 +744,14 @@ class ActionComm extends CommonObject $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " s.nom as socname,"; $sql .= " u.firstname, u.lastname as lastname"; + $sql .= " num_vote, event_paid, status"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; $sql .= " WHERE "; if ($ref) { - $sql .= " a.id = ".((int) $ref); // No field ref, we use id + $sql .= " a.ref = '".$this->db->escape($ref)."'"; } elseif ($ref_ext) { $sql .= " a.ref_ext = '".$this->db->escape($ref_ext)."'"; } elseif ($email_msgid) { @@ -798,6 +826,10 @@ class ActionComm extends CommonObject $this->elementid = $obj->elementid; $this->elementtype = $obj->elementtype; + $this->num_vote = $obj->num_vote; + $this->event_paid = $obj->event_paid; + $this->status = $obj->status; + $this->fetchResources(); } $this->db->free($resql); @@ -1080,6 +1112,15 @@ class ActionComm extends CommonObject if (!empty($this->elementtype)) { $sql .= ", elementtype=".($this->elementtype ? "'".$this->db->escape($this->elementtype)."'" : "null"); } + if (!empty($this->num_vote)) { + $sql .= ", num_vote=".($this->num_vote ? (int) $this->num_vote : null); + } + if (!empty($this->event_paid)) { + $sql .= ", event_paid=".($this->event_paid ? (int) $this->event_paid : 0); + } + if (!empty($this->status)) { + $sql .= ", status=".($this->status ? (int) $this->status : 0); + } $sql .= " WHERE id=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -1760,6 +1801,7 @@ class ActionComm extends CommonObject $sql .= " u.firstname, u.lastname, u.email,"; $sql .= " s.nom as socname,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label"; + $sql .= " num_vote, event_paid, status"; $sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; @@ -1889,6 +1931,9 @@ class ActionComm extends CommonObject $event['url'] = $url; $event['created'] = $this->db->jdate($obj->datec) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); $event['modified'] = $this->db->jdate($obj->datem) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $event['num_vote'] = $this->num_vote; + $event['event_paid'] = $this->event_paid; + $event['status'] = $this->status; // TODO: find a way to call "$this->fetch_userassigned();" without override "$this" properties $this->id = $obj->id; @@ -2079,6 +2124,7 @@ class ActionComm extends CommonObject $this->datef = $now; $this->fulldayevent = 0; $this->percentage = 0; + $this->status = 0; $this->location = 'Location'; $this->transparency = 1; // 1 means opaque $this->priority = 1; diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 87e40f59872..5239b5e0134 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -132,43 +132,6 @@ class ConferenceOrBooth extends ActionComm public $status; // END MODULEBUILDER PROPERTIES - - // If this object has a subtable with lines - - // /** - // * @var string Name of subtable line - // */ - // public $table_element_line = 'eventorganization_conferenceorboothline'; - - // /** - // * @var string Field with ID of parent key if this object has a parent - // */ - // public $fk_element = 'fk_conferenceorbooth'; - - // /** - // * @var string Name of subtable class that manage subtable lines - // */ - // public $class_element_line = 'ConferenceOrBoothline'; - - // /** - // * @var array List of child tables. To test if we can delete object. - // */ - // protected $childtables = array(); - - // /** - // * @var array List of child tables. To know object to delete on cascade. - // * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will - // * call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object - // */ - // protected $childtablesoncascade = array('eventorganization_conferenceorboothdet'); - - // /** - // * @var ConferenceOrBoothLine[] Array of subtable lines - // */ - // public $lines = array(); - - - /** * Constructor * @@ -181,7 +144,7 @@ class ConferenceOrBooth extends ActionComm $this->db = $db; if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { - $this->fields['rowid']['visible'] = 0; + $this->fields['id']['visible'] = 0; } if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) { $this->fields['entity']['enabled'] = 0; @@ -221,111 +184,19 @@ class ConferenceOrBooth extends ActionComm */ public function create(User $user, $notrigger = false) { - if (empty($this->datec)) { - $this->datec = $this->db->idate(dol_now()); - } - if (! (int) $this->fk_user_author > 0) { - $this->fk_user_author = $user->id; - } - if (! (int) $this->fk_user_mod > 0) { - $this->fk_user_mod = $user->id; - } - //TODO set percent according status - + $this->setPercentageFromStatus(); return parent::create($user, $notrigger); } /** - * Clone an object into another one - * - * @param User $user User that creates - * @param int $fromid Id of object to clone - * @return mixed New object created, <0 if KO + * Set Percentage from status */ - public function createFromClone(User $user, $fromid) - { - global $langs, $extrafields; - $error = 0; - - dol_syslog(__METHOD__, LOG_DEBUG); - - $object = new self($this->db); - - $this->db->begin(); - - // Load source object - $result = $object->fetchCommon($fromid); - if ($result > 0 && !empty($object->table_element_line)) { - $object->fetchLines(); + public function setPercentageFromStatus() { + if ($this->status==self::STATUS_DONE) { + $this->percentage=100; } - - // get lines so they will be clone - //foreach($this->lines as $line) - // $line->fetch_optionals(); - - // Reset some properties - unset($object->id); - unset($object->fk_user_creat); - unset($object->import_key); - - // Clear fields - if (property_exists($object, 'label')) { - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; - } - if (property_exists($object, 'status')) { - $object->status = self::STATUS_DRAFT; - } - if (property_exists($object, 'datec')) { - $object->date_creation = dol_now(); - } - // ... - // Clear extrafields that are unique - if (is_array($object->array_options) && count($object->array_options) > 0) { - $extrafields->fetch_name_optionals_label($this->table_element); - foreach ($object->array_options as $key => $option) { - $shortkey = preg_replace('/options_/', '', $key); - if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) { - //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; - unset($object->array_options[$key]); - } - } - } - - // Create clone - $object->context['createfromclone'] = 'createfromclone'; - $result = $object->createCommon($user); - if ($result < 0) { - $error++; - $this->error = $object->error; - $this->errors = $object->errors; - } - - if (!$error) { - // copy internal contacts - if ($this->copy_linked_contact($object, 'internal') < 0) { - $error++; - } - } - - if (!$error) { - // copy external contacts if same company - if (property_exists($this, 'fk_soc') && $this->fk_soc == $object->socid) - { - if ($this->copy_linked_contact($object, 'external') < 0) - $error++; - } - } - } - - unset($object->context['createfromclone']); - - // End - if (!$error) { - $this->db->commit(); - return $object; - } else { - $this->db->rollback(); - return -1; + if ($this->status==self::STATUS_DRAFT) { + $this->percentage=0; } } @@ -338,27 +209,10 @@ class ConferenceOrBooth extends ActionComm */ public function fetch($id, $ref = null) { - $result = $this->fetchCommon($id, $ref); - if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); - } + $result = parent::fetch($id, $ref); return $result; } - /** - * Load object lines in memory from the database - * - * @return int <0 if KO, 0 if not found, >0 if OK - */ - public function fetchLines() - { - $this->lines = array(); - - $result = $this->fetchLinesCommon(); - return $result; - } - - /** * Load list of objects in memory from the database. * @@ -450,11 +304,8 @@ class ConferenceOrBooth extends ActionComm */ public function update(User $user, $notrigger = false) { - if (! (int) $this->fk_user_mod > 0) { - $this->fk_user_mod = $user->id; - } - - return $this->updateCommon($user, $notrigger,'id'); + $this->setPercentageFromStatus(); + return parent::update($user, $notrigger); } /** @@ -466,29 +317,10 @@ class ConferenceOrBooth extends ActionComm */ public function delete(User $user, $notrigger = false) { - return $this->deleteCommon($user, $notrigger,0,'id'); - //return $this->deleteCommon($user, $notrigger, 1); + //TODO delete attendees and subscription + return parent::delete($notrigger); } - /** - * Delete a line of object in database - * - * @param User $user User that delete - * @param int $idline Id of line to delete - * @param bool $notrigger false=launch triggers after, true=disable triggers - * @return int >0 if OK, <0 if KO - */ - public function deleteLine(User $user, $idline, $notrigger = false) - { - if ($this->status < 0) { - $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; - return -2; - } - - return $this->deleteLineCommon($user, $idline, $notrigger); - } - - /** * Validate object * @@ -510,14 +342,6 @@ class ConferenceOrBooth extends ActionComm return 0; } - /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->conferenceorbooth->write)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->eventorganization->conferenceorbooth->conferenceorbooth_advance->validate)))) - { - $this->error='NotEnoughPermissions'; - dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); - return -1; - }*/ - $now = dol_now(); $this->db->begin(); @@ -587,7 +411,7 @@ class ConferenceOrBooth extends ActionComm // Set new ref and current status if (!$error) { $this->ref = $num; - $this->status = self::STATUS_VALIDATED; + $this->status = self::STATUS_CONFIRMED; } if (!$error) { @@ -893,61 +717,6 @@ class ConferenceOrBooth extends ActionComm } } - /** - * Returns the reference to the following non used object depending on the active numbering module. - * - * @return string Object free reference - */ - public function getNextNumRef() - { - global $langs, $conf; - $langs->load("eventorganization@eventorganization"); - - if (empty($conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON)) { - $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON = 'mod_conferenceorbooth_standard'; - } - - if (!empty($conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON)) { - $mybool = false; - - $file = $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON.".php"; - $classname = $conf->global->EVENTORGANIZATION_CONFERENCEORBOOTH_ADDON; - - // Include file with class - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/eventorganization/"); - - // Load file with numbering class (if found) - $mybool |= @include_once $dir.$file; - } - - if ($mybool === false) { - dol_print_error('', "Failed to include file ".$file); - return ''; - } - - if (class_exists($classname)) { - $obj = new $classname(); - $numref = $obj->getNextValue($this); - - if ($numref != '' && $numref != '-1') { - return $numref; - } else { - $this->error = $obj->error; - //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); - return ""; - } - } else { - print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; - return ""; - } - } else { - print $langs->trans("ErrorNumberingModuleNotSetup", $this->element); - return ""; - } - } - /** * Create a document onto disk according to template module. * @@ -1017,30 +786,3 @@ class ConferenceOrBooth extends ActionComm return $error; } } - - -require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; - -/** - * Class ConferenceOrBoothLine. You can also remove this and generate a CRUD class for lines objects. - */ -class ConferenceOrBoothLine extends CommonObjectLine -{ - // To complete with content of an object ConferenceOrBoothLine - // We should have a field rowid, fk_conferenceorbooth and position - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct(DoliDB $db) - { - $this->db = $db; - } -} diff --git a/htdocs/install/mysql/data/llx_c_actioncomm.sql b/htdocs/install/mysql/data/llx_c_actioncomm.sql index 17c1fd42f9f..47197af644d 100644 --- a/htdocs/install/mysql/data/llx_c_actioncomm.sql +++ b/htdocs/install/mysql/data/llx_c_actioncomm.sql @@ -49,7 +49,7 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 40,'AC_OTH_AUTO','systemauto','Other (automatically inserted events)',NULL, 1, 20); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 50,'AC_OTH','system','Other (manually inserted events)',NULL, 1, 5); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 3ffe304835c..01028b3e680 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -188,8 +188,9 @@ ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions 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); -ALTER TABLE llx_actioncomm ADD COLUMN eventorg_num_vote integer; -ALTER TABLE llx_actioncomm ADD COLUMN eventorg_is_booth_paid smallint NOT NULL DEFAULT 0; +ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(30); +ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer; +ALTER TABLE llx_actioncomm ADD COLUMN event_paid smallint NOT NULL DEFAULT 0; ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0; # TODO manage ref into cationcomm class @@ -198,10 +199,10 @@ ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255); ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); -insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 60,'AC_EO_ONLINECONF','module','Online/Virtual conference','conference@eventorganization', 1, 60); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 61,'AC_EO_INDOORCONF','module','Indoor conference','conference@eventorganization', 1, 61); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 62,'AC_EO_ONLINEBOOTH','module','Online/Virtual booth','booth@eventorganization', 1, 62); +INSERT INTO llx_c_actioncomm (id, code, type, libelle, module, active, position) VALUES ( 63,'AC_EO_INDOORBOOTH','module','Indoor booth','booth@eventorganization', 1, 63); -- Code enhanced - Standardize field name ALTER TABLE llx_commande CHANGE COLUMN tva total_tva double(24,8) default 0; ALTER TABLE llx_supplier_proposal CHANGE COLUMN tva total_tva double(24,8) default 0; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index b7cc062368a..a29d50646bc 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -24,7 +24,7 @@ create table llx_actioncomm ( id integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(255), + ref varchar(30), ref_ext varchar(255), -- reference into an external system (not used by dolibarr). Example: An id coming from google calendar has length between 5 and 1024 chars. An event id must follow rule: chars used in base32hex encoding (i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in RFC2938) entity integer DEFAULT 1 NOT NULL, -- multi company id datep datetime, -- date start @@ -73,9 +73,9 @@ create table llx_actioncomm recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date - num_vote integer, -- use for Event Organization module + num_vote integer , -- use for Event Organization module event_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module - status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now + status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now, but could be use after for event global status fk_element integer DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) elementtype varchar(255) DEFAULT NULL, -- For link to an element (proposal, invoice, order, ...) From e28f844d5482a2eeb327e939b4905c80422a76c0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 2 Mar 2021 21:31:48 +0000 Subject: [PATCH 14/29] Fixing style errors. --- htdocs/comm/action/class/cactioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index af7ab32f7de..8483839b944 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -255,7 +255,7 @@ class CActionComm if ($typecalendar == 'module') { //TODO check if possible to push it between system and systemauto if (preg_match('/@/', $obj->module)) { - $module = explode('@',$obj->module)[1]; + $module = explode('@', $obj->module)[1]; } else { $module = $obj->module; } From 5dcbea4cc5326a4602df5d0db6d58704ad101287 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 2 Mar 2021 22:32:12 +0100 Subject: [PATCH 15/29] revome dev hack --- htdocs/core/class/commonobject.class.php | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 22a89190ef9..8a8ca6a6e09 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8433,10 +8433,9 @@ abstract class CommonObject * @param int $id Id object * @param string $ref Ref * @param string $morewhere More SQL filters (' AND ...') - * @param string $idFieldName Should always be rowid * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetchCommon($id, $ref = null, $morewhere = '', $idFieldName='rowid') + public function fetchCommon($id, $ref = null, $morewhere = '') { if (empty($id) && empty($ref) && empty($morewhere)) { return -1; @@ -8451,7 +8450,7 @@ abstract class CommonObject $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; if (!empty($id)) { - $sql .= ' WHERE '.$idFieldName.' = '.$id; + $sql .= ' WHERE rowid = '.$id; } elseif (!empty($ref)) { $sql .= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); } else { @@ -8540,10 +8539,9 @@ abstract class CommonObject * * @param User $user User that modifies * @param bool $notrigger false=launch triggers after, true=disable triggers - * @param string $idFieldName Should always be rowid * @return int <0 if KO, >0 if OK */ - public function updateCommon(User $user, $notrigger = false, $idFieldName='rowid') + public function updateCommon(User $user, $notrigger = false) { global $conf, $langs; dol_syslog(get_class($this)."::updateCommon update", LOG_DEBUG); @@ -8594,7 +8592,7 @@ abstract class CommonObject }*/ } - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE '.$idFieldName.'='.$this->id; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET '.implode(', ', $tmp).' WHERE rowid='.$this->id; $this->db->begin(); if (!$error) { @@ -8639,10 +8637,9 @@ abstract class CommonObject * @param User $user User that deletes * @param bool $notrigger false=launch triggers after, true=disable triggers * @param int $forcechilddeletion 0=no, 1=Force deletion of children - * @param string $idFieldName Should always be rowid * @return int <=0 if KO, >0 if OK */ - public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0, $idFieldName='rowid') + public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) { dol_syslog(get_class($this)."::deleteCommon delete", LOG_DEBUG); From 95d7380317354288abb38bfda98e18f3a5370217 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 2 Mar 2021 21:34:19 +0000 Subject: [PATCH 16/29] Fixing style errors. --- .../class/conferenceorbooth.class.php | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 5239b5e0134..9fc4668d900 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -191,7 +191,8 @@ class ConferenceOrBooth extends ActionComm /** * Set Percentage from status */ - public function setPercentageFromStatus() { + public function setPercentageFromStatus() + { if ($this->status==self::STATUS_DONE) { $this->percentage=100; } @@ -353,28 +354,24 @@ class ConferenceOrBooth extends ActionComm dol_syslog(get_class($this)."::validate()", LOG_DEBUG); $resql = $this->db->query($sql); - if (!$resql) - { + if (!$resql) { dol_print_error($this->db); $this->error = $this->db->lasterror(); $error++; } - if (!$error && !$notrigger) - { + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('CONFERENCEORBOOTH_VALIDATE', $user); if ($result < 0) $error++; // End call triggers } - if (!$error) - { + if (!$error) { $this->oldref = $this->ref; // Rename directory if dir was a temporary ref - if (preg_match('/^[\(]?PROV/i', $this->ref)) - { + if (preg_match('/^[\(]?PROV/i', $this->ref)) { // Now we rename also files into index $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'conferenceorbooth/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'conferenceorbooth/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; @@ -386,17 +383,14 @@ class ConferenceOrBooth extends ActionComm $newref = dol_sanitizeFileName($num); $dirsource = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$oldref; $dirdest = $conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref; - if (!$error && file_exists($dirsource)) - { + if (!$error && file_exists($dirsource)) { dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); - if (@rename($dirsource, $dirdest)) - { + if (@rename($dirsource, $dirdest)) { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref $listoffiles = dol_dir_list($conf->eventorganization->dir_output.'/conferenceorbooth/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); - foreach ($listoffiles as $fileentry) - { + foreach ($listoffiles as $fileentry) { $dirsource = $fileentry['name']; $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); $dirsource = $fileentry['path'].'/'.$dirsource; From 1913564b38d8ba84daa2accf13953acf37305da7 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 16:28:14 +0100 Subject: [PATCH 17/29] fix travis --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 3b0273f2831..858deb7a827 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -567,7 +567,7 @@ class ActionComm extends CommonObject $resql = $this->db->query($sql); if ($resql) { $this->ref = $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."actioncomm", "id"); - $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ref='".$this->ref."' WHERE id=".$this->id ; + $sql = "UPDATE ".MAIN_DB_PREFIX."actioncomm SET ref='".$this->db->escape($this->ref)."' WHERE id=".$this->id; $resql = $this->db->query($sql); if (!$resql) { $error++; From 55e9a6596b408062945971c68da73a0a0c5bbf33 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 21:10:50 +0100 Subject: [PATCH 18/29] test --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 858deb7a827..895c8d3417f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -592,7 +592,7 @@ class ActionComm extends CommonObject dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR); $this->errors[] = $this->db->lasterror(); } - //var_dump($sql);exit; + var_dump($sql);exit; } } } From 4e2f929460bf3783a7e395784c285707ec881c28 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 21:11:04 +0100 Subject: [PATCH 19/29] test --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 895c8d3417f..858deb7a827 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -592,7 +592,7 @@ class ActionComm extends CommonObject dol_syslog('Error to process userassigned: '.$this->db->lasterror(), LOG_ERR); $this->errors[] = $this->db->lasterror(); } - var_dump($sql);exit; + //var_dump($sql);exit; } } } From 5233ad74246cee7d754bece114718756992b1588 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 21:38:43 +0100 Subject: [PATCH 20/29] revert wrong code in commonobject --- 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 470f793f5a6..59892da0c88 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8738,7 +8738,7 @@ abstract class CommonObject } if (!$error) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE '.$idFieldName.'='.$this->id; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE rowid='.$this->id; $res = $this->db->query($sql); if ($res === false) { From 9c256ab8a8743dbbd78228aed038656a89aab45d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 21:40:37 +0100 Subject: [PATCH 21/29] fix review --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 858deb7a827..61ce4b04b17 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -743,7 +743,7 @@ class ActionComm extends CommonObject $sql .= " a.email_msgid, a.email_subject, a.email_from, a.email_to, a.email_tocc, a.email_tobcc, a.errors_to,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " s.nom as socname,"; - $sql .= " u.firstname, u.lastname as lastname"; + $sql .= " u.firstname, u.lastname as lastname,"; $sql .= " num_vote, event_paid, status"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; From 91b93ac7cefba5a89dc35465b53340fd27c52778 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 22:10:17 +0100 Subject: [PATCH 22/29] fix sql --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 61ce4b04b17..96eff904c30 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1800,7 +1800,7 @@ class ActionComm extends CommonObject $sql .= " a.priority, a.fulldayevent, a.location, a.transparency,"; $sql .= " u.firstname, u.lastname, u.email,"; $sql .= " s.nom as socname,"; - $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label"; + $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label,"; $sql .= " num_vote, event_paid, status"; $sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export From 04c6d5dd8fa494576ce49435c538b11976f64f6b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 22:16:35 +0100 Subject: [PATCH 23/29] fix sql --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 96eff904c30..ee9c55e26ad 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -560,7 +560,7 @@ class ActionComm extends CommonObject $sql .= (!empty($this->errors_to) ? "'".$this->db->escape($this->errors_to)."'" : "null").", "; $sql .= (!empty($this->num_vote) ? (int) $this->num_vote : "null").", "; $sql .= (!empty($this->event_paid) ? (int) $this->event_paid : 0).", "; - $sql .= (!empty($this->status) ? (int) $this->status : "null"); + $sql .= (!empty($this->status) ? (int) $this->status : "0"); $sql .= ")"; dol_syslog(get_class($this)."::add", LOG_DEBUG); From ec52ed445c0c9f0a5148a3c81dcc6aa6fd7a3e1b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 3 Mar 2021 22:18:42 +0100 Subject: [PATCH 24/29] fix ambigous --- htdocs/comm/action/class/actioncomm.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index ee9c55e26ad..8c760b1adf1 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -744,7 +744,7 @@ class ActionComm extends CommonObject $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label, c.color as type_color, c.picto as type_picto,"; $sql .= " s.nom as socname,"; $sql .= " u.firstname, u.lastname as lastname,"; - $sql .= " num_vote, event_paid, status"; + $sql .= " num_vote, event_paid, a.status"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action=c.id "; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; @@ -1801,7 +1801,7 @@ class ActionComm extends CommonObject $sql .= " u.firstname, u.lastname, u.email,"; $sql .= " s.nom as socname,"; $sql .= " c.id as type_id, c.code as type_code, c.libelle as type_label,"; - $sql .= " num_vote, event_paid, status"; + $sql .= " num_vote, event_paid, a.status"; $sql .= " FROM (".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."actioncomm as a)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_author"; // Link to get author of event for export $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on s.rowid = a.fk_soc"; From 879e8fe5f620593d5dfbdcc179d3fae9507926e4 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Mar 2021 07:44:00 +0100 Subject: [PATCH 25/29] fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 12 +++++++----- htdocs/install/mysql/tables/llx_actioncomm.key.sql | 4 ++-- htdocs/install/mysql/tables/llx_actioncomm.sql | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 01028b3e680..462e6c000ba 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -188,13 +188,15 @@ ALTER TABLE llx_projet ADD COLUMN accept_booth_suggestions 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); -ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(30); -ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer; -ALTER TABLE llx_actioncomm ADD COLUMN event_paid smallint NOT NULL DEFAULT 0; -ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0; +ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer DEFAULT NULL AFTER reply_to; +ALTER TABLE llx_actioncomm ADD COLUMN event_paid smallint NOT NULL DEFAULT 0 AFTER num_vote; +ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0 AFTER event_paid; # TODO manage ref into cationcomm class -ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255); +ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255) AFTER id; +UPDATE llx_actioncomm SET ref = id WHERE ref = '' OR ref IS NULL; +ALTER TABLE llx_actioncomm MODIFY COLUMN ref varchar(30) NOT NULL; +ALTER TABLE llx_actioncomm ADD UNIQUE INDEX uk_actioncomm_ref (ref, entity); ALTER TABLE llx_c_actioncomm MODIFY code varchar(50) NOT NULL; ALTER TABLE llx_c_actioncomm MODIFY module varchar(50) DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_actioncomm.key.sql b/htdocs/install/mysql/tables/llx_actioncomm.key.sql index 64fbe874fc2..ee16386c7c4 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.key.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.key.sql @@ -17,7 +17,6 @@ -- -- =========================================================================== - ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_soc (fk_soc); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_contact (fk_contact); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_code (code); @@ -27,5 +26,6 @@ ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_fk_project (fk_project); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep (datep); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_datep2 (datep2); ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_recurid (recurid); - ALTER TABLE llx_actioncomm ADD INDEX idx_actioncomm_ref_ext (ref_ext); + +ALTER TABLE llx_actioncomm ADD UNIQUE INDEX uk_actioncomm_ref (ref, entity); diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index a29d50646bc..0dbb4e1d1a7 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -73,7 +73,7 @@ create table llx_actioncomm recurrule varchar(128), -- contains string with ical format recurring rule like 'FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=19' or 'FREQ=WEEKLY;BYDAY=MO' recurdateend datetime, -- no more recurring event after this date - num_vote integer , -- use for Event Organization module + num_vote integer DEFAULT NULL, -- use for Event Organization module event_paid smallint NOT NULL DEFAULT 0, -- use for Event Organization module status smallint NOT NULL DEFAULT 0, -- use for Event Organization module for now, but could be use after for event global status From 89bd9c4e05938e4e2e7cfc3f12e47d711d378c0b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Mar 2021 07:44:31 +0100 Subject: [PATCH 26/29] fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 462e6c000ba..64c7a453c8e 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -191,8 +191,6 @@ ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8); ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer DEFAULT NULL AFTER reply_to; ALTER TABLE llx_actioncomm ADD COLUMN event_paid smallint NOT NULL DEFAULT 0 AFTER num_vote; ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0 AFTER event_paid; - -# TODO manage ref into cationcomm class ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255) AFTER id; UPDATE llx_actioncomm SET ref = id WHERE ref = '' OR ref IS NULL; ALTER TABLE llx_actioncomm MODIFY COLUMN ref varchar(30) NOT NULL; From c362a16df141e2b472543332ea4abb165ef551d8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Mar 2021 07:45:02 +0100 Subject: [PATCH 27/29] fix sql --- htdocs/install/mysql/migration/13.0.0-14.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index 64c7a453c8e..a72f145207b 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -191,7 +191,7 @@ ALTER TABLE llx_projet ADD COLUMN price_booth double(24,8); ALTER TABLE llx_actioncomm ADD COLUMN num_vote integer DEFAULT NULL AFTER reply_to; ALTER TABLE llx_actioncomm ADD COLUMN event_paid smallint NOT NULL DEFAULT 0 AFTER num_vote; ALTER TABLE llx_actioncomm ADD COLUMN status smallint NOT NULL DEFAULT 0 AFTER event_paid; -ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(255) AFTER id; +ALTER TABLE llx_actioncomm ADD COLUMN ref varchar(30) AFTER id; UPDATE llx_actioncomm SET ref = id WHERE ref = '' OR ref IS NULL; ALTER TABLE llx_actioncomm MODIFY COLUMN ref varchar(30) NOT NULL; ALTER TABLE llx_actioncomm ADD UNIQUE INDEX uk_actioncomm_ref (ref, entity); From ecd1915c0a22be7d7a8c56db4183cb4b6ea1b5d8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Mar 2021 07:45:27 +0100 Subject: [PATCH 28/29] fix sql --- htdocs/install/mysql/tables/llx_actioncomm.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_actioncomm.sql b/htdocs/install/mysql/tables/llx_actioncomm.sql index 0dbb4e1d1a7..9012f6b3a66 100644 --- a/htdocs/install/mysql/tables/llx_actioncomm.sql +++ b/htdocs/install/mysql/tables/llx_actioncomm.sql @@ -24,7 +24,7 @@ create table llx_actioncomm ( id integer AUTO_INCREMENT PRIMARY KEY, - ref varchar(30), + ref varchar(30) NOT NULL, ref_ext varchar(255), -- reference into an external system (not used by dolibarr). Example: An id coming from google calendar has length between 5 and 1024 chars. An event id must follow rule: chars used in base32hex encoding (i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in RFC2938) entity integer DEFAULT 1 NOT NULL, -- multi company id datep datetime, -- date start From 6844c57413aed80c0fccf50fcbd6cb791880c2a3 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 4 Mar 2021 07:53:32 +0100 Subject: [PATCH 29/29] fix sql --- htdocs/comm/action/class/actioncomm.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8c760b1adf1..4470310e4d0 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -496,7 +496,8 @@ class ActionComm extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm"; - $sql .= "(datec,"; + $sql .= "(ref,"; + $sql .= "datec,"; $sql .= "datep,"; $sql .= "datep2,"; $sql .= "durationp,"; // deprecated @@ -529,6 +530,7 @@ class ActionComm extends CommonObject $sql .= "event_paid,"; $sql .= "status"; $sql .= ") VALUES ("; + $sql .= "'(PROV)', "; $sql .= "'".$this->db->idate($now)."', "; $sql .= (strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : "null").", "; $sql .= (strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : "null").", ";