From 377c73036381d27b3197a0c5615724fe37d59397 Mon Sep 17 00:00:00 2001 From: Pierre Payet Date: Wed, 14 Apr 2021 21:27:53 +0200 Subject: [PATCH 01/97] add missing group by hook in fichinter list --- htdocs/fichinter/list.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index d054f5e5bcc..b142613f051 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -259,6 +259,10 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; +// Add GroupBy from hooks +$parameters = array('all' => $all, 'fieldstosearchall' => $fieldstosearchall); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); // Count total nb of records From 38f54d058267d9b69f31c8ec2fd814388c3930c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Apr 2021 10:26:35 +0200 Subject: [PATCH 02/97] FIX Missing extrafields into export of agenda record --- htdocs/core/extrafieldsinexport.inc.php | 4 ++++ htdocs/core/modules/modAgenda.class.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index cef5f74d172..8b7cf3c81cc 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -1,5 +1,9 @@ 'project', ); + $keyforselect = 'actioncomm'; $keyforelement = 'action'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_extrafields as extra ON ac.id = extra.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; if (!empty($user) && empty($user->rights->agenda->allactions->read)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; From 0cd567f256cf5bb98610457fd014556e29522d02 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 16 Apr 2021 10:37:42 +0200 Subject: [PATCH 03/97] fix double test --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 559260a77c2..d3a78d01d90 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -413,7 +413,7 @@ class modAgenda extends DolibarrModules 'langs' => 'agenda', 'position' => 170, 'perms' => '$user->rights->agenda->allactions->read', - 'enabled' => '$conf->categorie->enabled&&$conf->categorie->enabled', + 'enabled' => '$conf->categorie->enabled', 'target' => '', 'user' => 2 ); From b9f0bc454be5899c9dbcaa7009faf70ae5f0c063 Mon Sep 17 00:00:00 2001 From: UT from dolibit <45215329+dolibit-ut@users.noreply.github.com> Date: Fri, 16 Apr 2021 17:00:10 +0200 Subject: [PATCH 04/97] Update llx_20_c_departements.sql Tunisia --- .../mysql/data/llx_20_c_departements.sql | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql index c00b0e009f3..1f3de968346 100644 --- a/htdocs/install/mysql/data/llx_20_c_departements.sql +++ b/htdocs/install/mysql/data/llx_20_c_departements.sql @@ -55,7 +55,8 @@ -- Luxembourg -- Netherlands -- (Moroco) --- Romania +-- Romania +-- Tunisia @@ -803,31 +804,33 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (18801, 'VN', '', 0, '', 'Vrancea'); --- Provinces Tunisia (id country=10) -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN01', 1001, '', 0, '', 'Ariana', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN02', 1001, '', 0, '', 'Béja', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN03', 1001, '', 0, '', 'Ben Arous', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN04', 1001, '', 0, '', 'Bizerte', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN05', 1001, '', 0, '', 'Gabès', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN06', 1001, '', 0, '', 'Gafsa', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN07', 1001, '', 0, '', 'Jendouba', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN08', 1001, '', 0, '', 'Kairouan', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN09', 1001, '', 0, '', 'Kasserine', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN10', 1001, '', 0, '', 'Kébili', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN11', 1001, '', 0, '', 'La Manouba', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN12', 1001, '', 0, '', 'Le Kef', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN13', 1001, '', 0, '', 'Mahdia', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN14', 1001, '', 0, '', 'Médenine', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN15', 1001, '', 0, '', 'Monastir', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN16', 1001, '', 0, '', 'Nabeul', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN17', 1001, '', 0, '', 'Sfax', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN18', 1001, '', 0, '', 'Sidi Bouzid', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN19', 1001, '', 0, '', 'Siliana', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN20', 1001, '', 0, '', 'Sousse', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN21', 1001, '', 0, '', 'Tataouine', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN22', 1001, '', 0, '', 'Tozeur', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN23', 1001, '', 0, '', 'Tunis', 1); -INSERT INTO llx_c_departements ( code_departement, fk_region, cheflieu, tncc, ncc, nom, active) VALUES('TN24', 1001, '', 0, '', 'Zaghouan', 1); +-- Tunisia Governorates / Provinces / Wilaya (id country=10) +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN01', '', 0, '', 'Ariana'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN02', '', 0, '', 'Béja'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN03', '', 0, '', 'Ben Arous'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN04', '', 0, '', 'Bizerte'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN05', '', 0, '', 'Gabès'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN06', '', 0, '', 'Gafsa'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN07', '', 0, '', 'Jendouba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN08', '', 0, '', 'Kairouan'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN09', '', 0, '', 'Kasserine'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN10', '', 0, '', 'Kébili'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN11', '', 0, '', 'La Manouba'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN12', '', 0, '', 'Le Kef'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN13', '', 0, '', 'Mahdia'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN14', '', 0, '', 'Médenine'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN15', '', 0, '', 'Monastir'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN16', '', 0, '', 'Nabeul'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN17', '', 0, '', 'Sfax'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN18', '', 0, '', 'Sidi Bouzid'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN19', '', 0, '', 'Siliana'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN20', '', 0, '', 'Sousse'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN21', '', 0, '', 'Tataouine'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN22', '', 0, '', 'Tozeur'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN23', '', 0, '', 'Tunis'); +INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES (1001, 'TN24', '', 0, '', 'Zaghouan'); + + -- Provinces Bolivia (id country=52) From af9c2384ef3832e837fefffcbedad8833df6e254 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 16 Apr 2021 19:14:01 +0200 Subject: [PATCH 05/97] Add warning --- htdocs/comm/mailing/cibles.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index bcf1e9c1e3b..fe3f4a76d96 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -689,6 +689,7 @@ if ($object->fetch($id) >= 0) // Search Icon print ''; + print ''; if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { From 17f84c4edc1e4b98b524190c4e5265bb8a1fbd04 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 17 Apr 2021 14:18:42 +0200 Subject: [PATCH 06/97] Fix new member form use getpost instead FORCEXXX ## Fix use FORCETYPE, FORCECOUNTRYCODE, FORCEMORPHY even if GETPOST bas value ## Fix code style : typeid is note type ## Fix reset amount when $amount is set by script or by hook ## Fix some code style --- htdocs/public/members/new.php | 82 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index e6b7a3e7a38..19fa23af080 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -201,12 +201,12 @@ if (empty($reshook) && $action == 'add') { $langs->load("errors"); $errmsg .= $langs->trans("ErrorPasswordsMustMatch")."
\n"; } - if (!GETPOST("email")) { + if (!GETPOST('email')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."
\n"; } } - if (GETPOST('type') <= 0) { + if (GETPOST('typeid') <= 0) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."
\n"; } @@ -214,21 +214,21 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."
\n"; } - if (!GETPOST("lastname")) { + if (!GETPOST('lastname')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; } - if (!GETPOST("firstname")) { + if (!GETPOST('firstname') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; } - if (GETPOST("email") && !isValidEmail(GETPOST("email"))) { + if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { $error++; $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."
\n"; + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; } - $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); - if (GETPOSTISSET("birthmonth") && empty($birthday)) { + $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); + if GETPOSTISSET('birthmonth') && empty($birthday)) { $error++; $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadDateFormat")."
\n"; @@ -240,36 +240,32 @@ if (empty($reshook) && $action == 'add') { } } - if (GETPOSTISSET('public')) { - $public = 1; - } else { - $public = 0; - } + $public = GETPOSTISSET('public') ? 1 : 0; if (!$error) { // email a peu pres correct et le login n'existe pas $adh = new Adherent($db); $adh->statut = -1; $adh->public = $public; - $adh->firstname = GETPOST("firstname"); - $adh->lastname = GETPOST("lastname"); - $adh->gender = GETPOST("gender"); - $adh->civility_id = GETPOST("civility_id"); - $adh->societe = GETPOST("societe"); - $adh->address = GETPOST("address"); - $adh->zip = GETPOST("zipcode"); - $adh->town = GETPOST("town"); - $adh->email = GETPOST("email"); + $adh->firstname = GETPOST('firstname'); + $adh->lastname = GETPOST('lastname'); + $adh->gender = GETPOST('gender'); + $adh->civility_id = GETPOST('civility_id'); + $adh->societe = GETPOST('societe'); + $adh->address = GETPOST('address'); + $adh->zip = GETPOST('zipcode'); + $adh->town = GETPOST('town'); + $adh->email = GETPOST('email'); if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - $adh->login = GETPOST("login"); - $adh->pass = GETPOST("pass1"); + $adh->login = GETPOST('login'); + $adh->pass = GETPOST('pass1'); } - $adh->photo = GETPOST("photo"); - $adh->country_id = GETPOST("country_id", 'int'); - $adh->state_id = GETPOST("state_id", 'int'); - $adh->typeid = GETPOST("type", 'int'); - $adh->note_private = GETPOST("note_private"); - $adh->morphy = GETPOST("morphy"); + $adh->photo = GETPOST('photo'); + $adh->country_id = $conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE ? $conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE : GETPOST('country_id', 'int'); + $adh->state_id = GETPOST('state_id', 'int'); + $adh->typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE : GETPOST('typeid', 'int'); + $adh->note_private = GETPOST('note_private'); + $adh->morphy = $conf->global->MEMBER_NEWFORM_FORCEMORPHY ? $conf->global->MEMBER_NEWFORM_FORCEMORPHY : GETPOST('morphy'); $adh->birth = $birthday; @@ -562,11 +558,11 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $isempty = 0; } print ''.$langs->trans("Type").' *'; - print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); + print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); print ''."\n"; } else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); - print ''; + print ''; } // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); @@ -628,8 +624,6 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''.$langs->trans('State').''; if ($country_code) { print $formcompany->select_state(GETPOST("state_id"), $country_code); - } else { - print ''; } print ''; } @@ -650,7 +644,7 @@ print ''.$langs->trans("URLPhoto").''."\n"; // Other attributes -$tpl_context = 'public'; // define templae context to public +$tpl_context = 'public'; // define template context to public include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; // Comments print ''; @@ -675,11 +669,11 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { if (jQuery("#budget").val() > 0) { jQuery(".amount").val(jQuery("#budget").val()); } else { jQuery("#budget").val(\'\'); } }); - /*jQuery("#type").change(function() { - if (jQuery("#type").val()==1) { jQuery("#morphy").val(\'mor\'); } - if (jQuery("#type").val()==2) { jQuery("#morphy").val(\'phy\'); } - if (jQuery("#type").val()==3) { jQuery("#morphy").val(\'mor\'); } - if (jQuery("#type").val()==4) { jQuery("#morphy").val(\'mor\'); } + /*jQuery("#typeid").change(function() { + if (jQuery("#typeid").val()==1) { jQuery("#morphy").val(\'mor\'); } + if (jQuery("#typeid").val()==2) { jQuery("#morphy").val(\'phy\'); } + if (jQuery("#typeid").val()==3) { jQuery("#morphy").val(\'mor\'); } + if (jQuery("#typeid").val()==4) { jQuery("#morphy").val(\'mor\'); } initturnover(); });*/ function initturnover() { @@ -702,14 +696,18 @@ if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { print ''."\n"; } if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount - $amount = 0; + + // Set amount for the subscription + $amount = isset($amount) ? $amount : 0; + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount = GETPOST('amount') ?GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT; + $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' print ''.$langs->trans("Subscription").''; From fcbea36605cc16f51715a9bb8036f2b4164d48d0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 17 Apr 2021 12:21:40 +0000 Subject: [PATCH 07/97] Fixing style errors. --- htdocs/public/members/new.php | 305 +++++++++++++++++----------------- 1 file changed, 152 insertions(+), 153 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 19fa23af080..0920e5976b1 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -221,12 +221,12 @@ if (empty($reshook) && $action == 'add') { if (!GETPOST('firstname') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; - } - if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; - } +} +if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; +} $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); if GETPOSTISSET('birthmonth') && empty($birthday)) { $error++; @@ -545,121 +545,121 @@ jQuery(document).ready(function () { '; -print ''."\n"; + print '
'."\n"; -// Type -if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { - $listoftype = $adht->liste_array(); - $tmp = array_keys($listoftype); - $defaulttype = ''; - $isempty = 1; - if (count($listoftype) == 1) { - $defaulttype = $tmp[0]; - $isempty = 0; + // Type + if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { + $listoftype = $adht->liste_array(); + $tmp = array_keys($listoftype); + $defaulttype = ''; + $isempty = 1; + if (count($listoftype) == 1) { + $defaulttype = $tmp[0]; + $isempty = 0; + } + print ''."\n"; + } else { + $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); + print ''; } - print ''."\n"; -} else { - $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); - print ''; -} -// Moral/Physic attribute -$morphys["phy"] = $langs->trans("Physical"); -$morphys["mor"] = $langs->trans("Moral"); -if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''."\n"; -} else { - print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; - print ''; -} -// Civility -print ''."\n"; -// Lastname -print ''."\n"; -// Firstname -print ''."\n"; -// Gender -print ''; -print ''; -// Company -print ''."\n"; -// Address -print ''."\n"; -// Zip / Town -print ''; -// Country -print ''."\n"; + } else { + print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; + print ''; + } + // Civility + print ''."\n"; + // Lastname + print ''."\n"; + // Firstname + print ''."\n"; + // Gender + print ''; + print ''; + // Company + print ''."\n"; + // Address + print ''."\n"; + // Zip / Town + print ''; + // Country + print ''; -// State -if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; -} -// EMail -print ''."\n"; -// Login -if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; -} -// Birthday -print ''."\n"; -// Photo -print ''."\n"; -// Public -print ''."\n"; -// Other attributes -$tpl_context = 'public'; // define template context to public -include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; -// Comments -print ''; -print ''; -print ''; -print ''."\n"; + // State + if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + print ''; + } + // EMail + print ''."\n"; + // Login + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print ''."\n"; + print ''."\n"; + print ''."\n"; + } + // Birthday + print ''."\n"; + // Photo + print ''."\n"; + // Public + print ''."\n"; + // Other attributes + $tpl_context = 'public'; // define template context to public + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + // Comments + print ''; + print ''; + print ''; + print ''."\n"; -// Add specific fields used by Dolibarr foundation for example -if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { - $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); - print ''."\n"; -} -if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - - // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount - - // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; - - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + print ''."\n"; } + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount - if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); + // Set amount for the subscription + $amount = isset($amount) ? $amount : 0; + + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + + if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); + } + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' + print ''; } - // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' - print '
'.$langs->trans("Type").' *'; + print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print '
'.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); - print '
'.$langs->trans('MemberNature').' *'."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); - print '
'.$langs->trans('UserTitle').''; -print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Gender").''; -$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); -print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); -print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''."\n"; -print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; -print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); -print ' / '; -print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); -print '
'.$langs->trans('Country').''; -$country_id = GETPOST('country_id'); -if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { - $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); -} -if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { - $country_code = dol_user_country(); - //print $country_code; - if ($country_code) { - $new_country_id = getCountry($country_code, 3, $db, $langs); - //print 'xxx'.$country_code.' - '.$new_country_id; - if ($new_country_id) { - $country_id = $new_country_id; + // Moral/Physic attribute + $morphys["phy"] = $langs->trans("Physical"); + $morphys["mor"] = $langs->trans("Moral"); + if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { + print '
'.$langs->trans('MemberNature').' *'."\n"; + print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); + print '
'.$langs->trans('UserTitle').''; + print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Gender").''; + $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); + print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); + print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''."\n"; + print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; + print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); + print ' / '; + print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); + print '
'.$langs->trans('Country').''; + $country_id = GETPOST('country_id'); + if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); + } + if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) { + $country_id = $new_country_id; + } } } -} -$country_code = getCountry($country_id, 2, $db, $langs); -print $form->select_country($country_id, 'country_id'); -print '
'.$langs->trans('State').''; - if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); - } + $country_code = getCountry($country_id, 2, $db, $langs); + print $form->select_country($country_id, 'country_id'); print '
'.$langs->trans("Email").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("DateOfBirth").''; -print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); -print '
'.$langs->trans("URLPhoto").'
'.$langs->trans("Public").'
'.$langs->trans("Comments").'
'.$langs->trans('State').''; + if ($country_code) { + print $formcompany->select_state(GETPOST("state_id"), $country_code); + } + print '
'.$langs->trans("Email").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("DateOfBirth").''; + print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); + print '
'.$langs->trans("URLPhoto").'
'.$langs->trans("Public").'
'.$langs->trans("Comments").'
'.$langs->trans("TurnoverOrBudget").' *'; - print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); - print ' € or $'; + // Add specific fields used by Dolibarr foundation for example + if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { + $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); + print '
'.$langs->trans("TurnoverOrBudget").' *'; + print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); + print ' € or $'; - print ''; - print '
'.$langs->trans("Subscription").''; + if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + print ''; + } else { + print ''; + print ''; + } + print ' '.$langs->trans("Currency".$conf->currency); + print '
'.$langs->trans("Subscription").''; - if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { - print ''; - } else { - print ''; - print ''; + print "
\n"; + + print dol_get_fiche_end(); + + // Save + print '
'; + print ''; + if (!empty($backtopage)) { + print '     '; } - print ' '.$langs->trans("Currency".$conf->currency); - print ''; -} -print "\n"; - -print dol_get_fiche_end(); - -// Save -print '
'; -print ''; -if (!empty($backtopage)) { - print '     '; -} -print '
'; + print '
'; -print "\n"; -print "
"; -print ''; + print "\n"; + print "
"; + print ''; -llxFooterVierge(); + llxFooterVierge(); -$db->close(); + $db->close(); From d6085fb68a1214dcfd116fe8bbf8bcb80dc0f99b Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 17 Apr 2021 14:29:02 +0200 Subject: [PATCH 08/97] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 0920e5976b1..dcf64ed7634 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -218,7 +218,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; } - if (!GETPOST('firstname') { + if (!GETPOST('firstname')) ä{ $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; } From d23e74660912b0b712f249d6eadc8c5089ba2e08 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sat, 17 Apr 2021 12:29:23 +0000 Subject: [PATCH 09/97] Fixing style errors. --- htdocs/public/members/new.php | 172 +++++++++++++++++----------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index dcf64ed7634..13705796ad5 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -218,17 +218,17 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; } - if (!GETPOST('firstname')) ä{ + if (!GETPOST('firstname')) { ä $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; -} -if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { - $error++; - $langs->load("errors"); - $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; -} + } + if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { + $error++; + $langs->load("errors"); + $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; + } $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); - if GETPOSTISSET('birthmonth') && empty($birthday)) { + if GETPOSTISSET('birthmonth') { && empty($birthday)) $error++; $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadDateFormat")."
\n"; @@ -548,33 +548,33 @@ jQuery(document).ready(function () { print ''."\n"; // Type - if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { - $listoftype = $adht->liste_array(); - $tmp = array_keys($listoftype); - $defaulttype = ''; - $isempty = 1; - if (count($listoftype) == 1) { - $defaulttype = $tmp[0]; - $isempty = 0; - } - print ''."\n"; - } else { - $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); - print ''; +if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { + $listoftype = $adht->liste_array(); + $tmp = array_keys($listoftype); + $defaulttype = ''; + $isempty = 1; + if (count($listoftype) == 1) { + $defaulttype = $tmp[0]; + $isempty = 0; } + print ''."\n"; +} else { + $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); + print ''; +} // Moral/Physic attribute $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); - if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { - print ''."\n"; - } else { - print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; - print ''; - } +if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { + print ''."\n"; +} else { + print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; + print ''; +} // Civility print ''."\n"; @@ -602,39 +602,39 @@ jQuery(document).ready(function () { // Country print ''; // State - if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - print ''; +if (empty($conf->global->SOCIETE_DISABLE_STATE)) { + print ''; +} // EMail print ''."\n"; // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''."\n"; - print ''."\n"; - print ''."\n"; - } +if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + print ''."\n"; + print ''."\n"; + print ''."\n"; +} // Birthday print ''."\n"; // Add specific fields used by Dolibarr foundation for example - if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { - $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); - print ''."\n"; + print ''."\n"; +} +if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount + + // Set amount for the subscription + $amount = isset($amount) ? $amount : 0; + + if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - // $conf->global->MEMBER_NEWFORM_SHOWAMOUNT is an amount - // Set amount for the subscription - $amount = isset($amount) ? $amount : 0; - - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; - } - - if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); - } - // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' - print ''; + if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + $amount = $amount ? $amount : (GETPOST('amount') ? GETPOST('amount') : $conf->global->MEMBER_NEWFORM_AMOUNT); } + // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' + print ''; +} print "
'.$langs->trans("Type").' *'; - print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); - print '
'.$langs->trans("Type").' *'; + print $form->selectarray("typeid", $adht->liste_array(), GETPOST('typeid') ? GETPOST('typeid') : $defaulttype, $isempty); + print '
'.$langs->trans('MemberNature').' *'."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); - print '
'.$langs->trans('MemberNature').' *'."\n"; + print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); + print '
'.$langs->trans('UserTitle').''; print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans('Country').''; $country_id = GETPOST('country_id'); - if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { - $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); - } - if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { - $country_code = dol_user_country(); - //print $country_code; - if ($country_code) { - $new_country_id = getCountry($country_code, 3, $db, $langs); - //print 'xxx'.$country_code.' - '.$new_country_id; - if ($new_country_id) { - $country_id = $new_country_id; - } +if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { + $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); +} +if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { + $country_code = dol_user_country(); + //print $country_code; + if ($country_code) { + $new_country_id = getCountry($country_code, 3, $db, $langs); + //print 'xxx'.$country_code.' - '.$new_country_id; + if ($new_country_id) { + $country_id = $new_country_id; } } +} $country_code = getCountry($country_id, 2, $db, $langs); print $form->select_country($country_id, 'country_id'); print '
'.$langs->trans('State').''; - if ($country_code) { - print $formcompany->select_state(GETPOST("state_id"), $country_code); - } - print '
'.$langs->trans('State').''; + if ($country_code) { + print $formcompany->select_state(GETPOST("state_id"), $country_code); } + print '
'.$langs->trans("Email").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("DateOfBirth").''; print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); @@ -653,13 +653,13 @@ jQuery(document).ready(function () { print '
'.$langs->trans("TurnoverOrBudget").' *'; - print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); - print ' € or $'; +if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { + $arraybudget = array('50'=>'<= 100 000', '100'=>'<= 200 000', '200'=>'<= 500 000', '300'=>'<= 1 500 000', '600'=>'<= 3 000 000', '1000'=>'<= 5 000 000', '2000'=>'5 000 000+'); + print '
'.$langs->trans("TurnoverOrBudget").' *'; + print $form->selectarray('budget', $arraybudget, GETPOST('budget'), 1); + print ' € or $'; - print ''; - print '
'.$langs->trans("Subscription").''; - if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { - print ''; - } else { - print ''; - print ''; - } - print ' '.$langs->trans("Currency".$conf->currency); - print '
'.$langs->trans("Subscription").''; + if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + print ''; + } else { + print ''; + print ''; + } + print ' '.$langs->trans("Currency".$conf->currency); + print '
\n"; print dol_get_fiche_end(); @@ -726,9 +726,9 @@ jQuery(document).ready(function () { // Save print '
'; print ''; - if (!empty($backtopage)) { - print '     '; - } +if (!empty($backtopage)) { + print '     '; +} print '
'; From 16dfde112806d813c9c5718d2a63bb0756fa88fa Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 17 Apr 2021 14:39:14 +0200 Subject: [PATCH 10/97] Update new.php --- htdocs/public/members/new.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 13705796ad5..fa9c844288f 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -218,7 +218,7 @@ if (empty($reshook) && $action == 'add') { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."
\n"; } - if (!GETPOST('firstname')) { ä + if (!GETPOST('firstname')) { $error++; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."
\n"; } From b96d3cebda23f09b1581a56ca17143ccf01df672 Mon Sep 17 00:00:00 2001 From: daraelmin Date: Sat, 17 Apr 2021 14:51:05 +0200 Subject: [PATCH 11/97] Update new.php --- htdocs/public/members/new.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index fa9c844288f..677e1e1b906 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -227,8 +227,8 @@ if (empty($reshook) && $action == 'add') { $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."
\n"; } - $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); - if GETPOSTISSET('birthmonth') { && empty($birthday)) + $birthday = dol_mktime(GETPOST('birthhour', 'int'), GETPOST('birthmin', 'int'), GETPOST('birthsec', 'int'), GETPOST('birthmonth', 'int'), GETPOST('birthday', 'int'), GETPOST('birthyear', 'int')); + if (GETPOSTISSET('birthmonth') && empty($birthday)) { $error++; $langs->load("errors"); $errmsg .= $langs->trans("ErrorBadDateFormat")."
\n"; From fbc28795bc2bc84166448682ca1011870e5a289f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 12:51:37 +0200 Subject: [PATCH 12/97] Debug sitemap generation --- htdocs/website/index.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 93a2aebc346..7075bd770c9 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2251,6 +2251,7 @@ $tempdir = $conf->website->dir_output.'/'.$websitekey.'/'; if ($action == 'generatesitemaps' && $usercanedit) { $domtree = new DOMDocument('1.0', 'UTF-8'); $root = $domtree->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'); + $domtree->createAttributeNS("http://www.w3.org/1999/xhtml", 'xmlns:xhtml'); $domtree->formatOutput = true; $xmlname = 'sitemap.'.$websitekey.'.xml'; @@ -2258,6 +2259,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w"; $sql .= " WHERE wp.type_container IN ('page', 'blogpost')"; $sql .= " AND wp.fk_website = w.rowid"; + $sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')"; $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; $resql = $db->query($sql); if ($resql) { @@ -2274,7 +2276,12 @@ if ($action == 'generatesitemaps' && $usercanedit) { if ($objp->virtualhost) { $domainname = $objp->virtualhost; } - $loc = $domtree->createElement('loc', 'http://'.$domainname.'/'.$pageurl); + if (! preg_match('/^http/i', $domainname)) { + $domainname .= 'https://'.$domainname; + } + //$pathofpage = $dolibarr_main_url_root.'/'.$pageurl.'.php'; + + $loc = $domtree->createElement('loc', $domainname.'/'.$pageurl.'.php'); $lastmod = $domtree->createElement('lastmod', $db->jdate($objp->tms)); $url->appendChild($loc); @@ -2295,6 +2302,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { } else { dol_print_error($db); } + + // Add the entry Sitemap: into the robot file. $robotcontent = @file_get_contents($filerobot); $result = preg_replace('/\n/ims', '', $robotcontent); if ($result) { From 3502c4c269a9dad909c33d0170173e156028c9e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 13:45:46 +0200 Subject: [PATCH 13/97] Debug sitemap generation --- htdocs/core/lib/website2.lib.php | 10 ++-- htdocs/website/index.php | 95 ++++++++++++++++++++++++++++++-- 2 files changed, 96 insertions(+), 9 deletions(-) diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 6510d5fff8d..8824d9cc06d 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -203,10 +203,6 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, } // Add translation reference (main language) if ($object->isMultiLang()) { - // Add myself - $tplcontent .= 'fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n"; - $tplcontent .= ''."\n"; - // Add page "translation of" $translationof = $objectpage->fk_page; if ($translationof) { @@ -225,6 +221,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, } } } + // Add "has translation pages" $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objectpage->id.($translationof ? ', '.$translationof : '')).")"; $resql = $db->query($sql); @@ -244,6 +241,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage, } else { dol_print_error($db); } + + // Add myself + $tplcontent .= 'fk_default_home == $objectpage->id) ? '/' : (($shortlangcode != substr($object->lang, 0, 2)) ? '/'.$shortlangcode : '')).'/'.$objectpage->pageurl.'.php") { ?>'."\n"; + $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } // Add manifest.json. Do we have to add it only on home page ? diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7075bd770c9..510f9b278dc 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2250,12 +2250,16 @@ $tempdir = $conf->website->dir_output.'/'.$websitekey.'/'; // Generate web site sitemaps if ($action == 'generatesitemaps' && $usercanedit) { $domtree = new DOMDocument('1.0', 'UTF-8'); + $root = $domtree->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'); - $domtree->createAttributeNS("http://www.w3.org/1999/xhtml", 'xmlns:xhtml'); + $root->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); + $domtree->formatOutput = true; + $xmlname = 'sitemap.'.$websitekey.'.xml'; - $sql = "SELECT wp.type_container , wp.pageurl, wp.lang, wp.tms as tms, w.virtualhost"; + $sql = "SELECT wp.rowid, wp.type_container , wp.pageurl, wp.lang, wp.fk_page, wp.tms as tms,"; + $sql .= " w.virtualhost, w.fk_default_home"; $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w"; $sql .= " WHERE wp.type_container IN ('page', 'blogpost')"; $sql .= " AND wp.fk_website = w.rowid"; @@ -2269,10 +2273,25 @@ if ($action == 'generatesitemaps' && $usercanedit) { while ($i < $num_rows) { $objp = $db->fetch_object($resql); $url = $domtree->createElement('url'); - $pageurl = $objp->pageurl; + + $shortlangcode = ''; if ($objp->lang) { - $pageurl = $objp->lang.'/'.$pageurl; + $shortlangcode = substr($objp->lang, 0, 2); // en_US or en-US -> en } + if (empty($shortlangcode)) { + $shortlangcode = substr($object->lang, 0, 2); // en_US or en-US -> en + } + + // Forge $pageurl, adding language prefix if it is an alternative language + $pageurl = $objp->pageurl; + if ($objp->fk_default_home == $objp->rowid) { + $pageurl = ''; + } else { + if ($shortlangcode != substr($object->lang, 0, 2)) { + $pageurl = $shortlangcode.'/'.$pageurl.'.php'; + } + } + if ($objp->virtualhost) { $domainname = $objp->virtualhost; } @@ -2281,11 +2300,77 @@ if ($action == 'generatesitemaps' && $usercanedit) { } //$pathofpage = $dolibarr_main_url_root.'/'.$pageurl.'.php'; - $loc = $domtree->createElement('loc', $domainname.'/'.$pageurl.'.php'); + // URL of sitemaps must end with trailing slash if page is '' + $loc = $domtree->createElement('loc', $domainname.'/'.$pageurl); $lastmod = $domtree->createElement('lastmod', $db->jdate($objp->tms)); + $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values + $priority = $domtree->createElement('priority', '1'); $url->appendChild($loc); $url->appendChild($lastmod); + // Add suggested frequency for refresh + if (!empty($conf->global->WEBSITE_SITEMAPS_ADD_WEEKLY_FREQ)) { + $url->appendChild($changefreq); + } + // Add higher priority for home page + if ($objp->fk_default_home == $objp->rowid) { + $url->appendChild($priority); + } + + // Now add alternate language entries + if ($object->isMultiLang()) { + // Add page "translation of" + $translationof = $objp->fk_page; + if ($translationof) { + $tmppage = new WebsitePage($db); + $tmppage->fetch($translationof); + if ($tmppage->id > 0) { + $tmpshortlangcode = ''; + if ($tmppage->lang) { + $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en + } + if (empty($tmpshortlangcode)) { + $tmpshortlangcode = preg_replace('/[_-].*$/', '', $object->lang); // en_US or en-US -> en + } + if ($tmpshortlangcode != $shortlangcode) { + $xhtmllink = $domtree->createElement('xhtml:link', ''); + $xhtmllink->setAttribute("rel", "alternante"); + $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); + $xhtmllink->setAttribute("href", "'.$pageurl.'"); + } + } + } + + // Add "has translation pages" + $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")"; + $resql = $db->query($sql); + if ($resql) { + $num_rows = $db->num_rows($resql); + if ($num_rows > 0) { + while ($objhastrans = $db->fetch_object($resql)) { + $tmpshortlangcode = ''; + if ($objhastrans->lang) { + $tmpshortlangcode = preg_replace('/[_-].*$/', '', $objhastrans->lang); // en_US or en-US -> en + } + if ($tmpshortlangcode != $shortlangcode) { + $xhtmllink = $domtree->createElement('xhtml:link', ''); + $xhtmllink->setAttribute("rel", "alternante"); + $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); + $xhtmllink->setAttribute("href", "'.$pageurl.'"); + } + } + } + } else { + dol_print_error($db); + } + + // Add myself + $xhtmllink = $domtree->createElement('xhtml:link', ''); + $xhtmllink->setAttribute("rel", "alternante"); + $xhtmllink->setAttribute("hreflang", "'.$shortlang.'"); + $xhtmllink->setAttribute("href", "'.$pageurl.'"); + } + $root->appendChild($url); $i++; } From 54c90059ff56cbc1cfedf98f68b56600bdfe7e09 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:11:22 +0200 Subject: [PATCH 14/97] Fix sitemaps --- htdocs/website/index.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 510f9b278dc..3e705ad33d0 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2337,17 +2337,18 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $url->appendChild($xhtmllink); } } } // Add "has translation pages" $sql = 'SELECT rowid as id, lang, pageurl from '.MAIN_DB_PREFIX.'website_page where fk_page IN ('.$db->sanitize($objp->rowid.($translationof ? ', '.$translationof : '')).")"; - $resql = $db->query($sql); - if ($resql) { - $num_rows = $db->num_rows($resql); - if ($num_rows > 0) { - while ($objhastrans = $db->fetch_object($resql)) { + $resqlhastrans = $db->query($sql); + if ($resqlhastrans) { + $num_rows_hastrans = $db->num_rows($resqlhastrans); + if ($num_rows_hastrans > 0) { + while ($objhastrans = $db->fetch_object($resqlhastrans)) { $tmpshortlangcode = ''; if ($objhastrans->lang) { $tmpshortlangcode = preg_replace('/[_-].*$/', '', $objhastrans->lang); // en_US or en-US -> en @@ -2357,6 +2358,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $url->appendChild($xhtmllink); } } } @@ -2369,6 +2371,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", "'.$shortlang.'"); $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $url->appendChild($xhtmllink); } $root->appendChild($url); From ae595d85451284ea623cee37f82bfeeb741156ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:18:05 +0200 Subject: [PATCH 15/97] Fix sitemap --- htdocs/website/index.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3e705ad33d0..0c59d582872 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2335,8 +2335,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { if ($tmpshortlangcode != $shortlangcode) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); - $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); - $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); + $xhtmllink->setAttribute("href", $domainname.'/'.$tmppage->pageurl); $url->appendChild($xhtmllink); } } @@ -2356,8 +2356,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { if ($tmpshortlangcode != $shortlangcode) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); - $xhtmllink->setAttribute("hreflang", "'.$tmpshortlangcode.'"); - $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); + $xhtmllink->setAttribute("href", $domainname.'/'.$objhastrans->pageurl); $url->appendChild($xhtmllink); } } @@ -2369,8 +2369,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { // Add myself $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); - $xhtmllink->setAttribute("hreflang", "'.$shortlang.'"); - $xhtmllink->setAttribute("href", "'.$pageurl.'"); + $xhtmllink->setAttribute("hreflang", $shortlang); + $xhtmllink->setAttribute("href", $domainname.'/'.$pageurl); $url->appendChild($xhtmllink); } From ecadc03b7525c194c633486a64e60bd77b77c7a6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:32:17 +0200 Subject: [PATCH 16/97] Fix sitemaps for multilang --- htdocs/website/index.php | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0c59d582872..7001e6d0499 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2283,12 +2283,12 @@ if ($action == 'generatesitemaps' && $usercanedit) { } // Forge $pageurl, adding language prefix if it is an alternative language - $pageurl = $objp->pageurl; + $pageurl = $objp->pageurl.'.php'; if ($objp->fk_default_home == $objp->rowid) { $pageurl = ''; } else { if ($shortlangcode != substr($object->lang, 0, 2)) { - $pageurl = $shortlangcode.'/'.$pageurl.'.php'; + $pageurl = $shortlangcode.'/'.$pageurl; } } @@ -2319,6 +2319,8 @@ if ($action == 'generatesitemaps' && $usercanedit) { // Now add alternate language entries if ($object->isMultiLang()) { + $alternatefound = 0; + // Add page "translation of" $translationof = $objp->fk_page; if ($translationof) { @@ -2336,8 +2338,10 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.'/'.$tmppage->pageurl); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php'); $url->appendChild($xhtmllink); + + $alternatefound++; } } } @@ -2355,10 +2359,12 @@ if ($action == 'generatesitemaps' && $usercanedit) { } if ($tmpshortlangcode != $shortlangcode) { $xhtmllink = $domtree->createElement('xhtml:link', ''); - $xhtmllink->setAttribute("rel", "alternante"); + $xhtmllink->setAttribute("rel", "alternate"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.'/'.$objhastrans->pageurl); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php'); $url->appendChild($xhtmllink); + + $alternatefound++; } } } @@ -2366,12 +2372,14 @@ if ($action == 'generatesitemaps' && $usercanedit) { dol_print_error($db); } - // Add myself - $xhtmllink = $domtree->createElement('xhtml:link', ''); - $xhtmllink->setAttribute("rel", "alternante"); - $xhtmllink->setAttribute("hreflang", $shortlang); - $xhtmllink->setAttribute("href", $domainname.'/'.$pageurl); - $url->appendChild($xhtmllink); + if ($alternatefound) { + // Add myself + $xhtmllink = $domtree->createElement('xhtml:link', ''); + $xhtmllink->setAttribute("rel", "alternate"); + $xhtmllink->setAttribute("hreflang", $shortlangcode); + $xhtmllink->setAttribute("href", $domainname.'/'.$pageurl); + $url->appendChild($xhtmllink); + } } $root->appendChild($url); From 20fb70d493fffbdd6a66fd063fbed26cdd1b1980 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:34:08 +0200 Subject: [PATCH 17/97] Fix syntax error --- htdocs/website/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 7001e6d0499..0385c4d7c57 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2338,7 +2338,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternante"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php'); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php')); $url->appendChild($xhtmllink); $alternatefound++; @@ -2361,7 +2361,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $xhtmllink = $domtree->createElement('xhtml:link', ''); $xhtmllink->setAttribute("rel", "alternate"); $xhtmllink->setAttribute("hreflang", $tmpshortlangcode); - $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php'); + $xhtmllink->setAttribute("href", $domainname.($objp->fk_default_home == $objhastrans->id ? '/' : (($tmpshortlangcode != substr($objp->lang, 0, 2) ? '/'.$tmpshortlangcode : '')).'/'.$objhastrans->pageurl.'.php')); $url->appendChild($xhtmllink); $alternatefound++; From 08deb3c0e9a721e81858597ee8716764476f1674 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:41:05 +0200 Subject: [PATCH 18/97] Fix selection of files to report into sitemap --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0385c4d7c57..10f6dc8c041 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2263,6 +2263,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w"; $sql .= " WHERE wp.type_container IN ('page', 'blogpost')"; $sql .= " AND wp.fk_website = w.rowid"; + $sql .= " AND status = ".WebsitePage::STATUS_VALIDATED; $sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')"; $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; $resql = $db->query($sql); From 038b005e6a87cfede323e0a6b2b86a6208947bfb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:44:33 +0200 Subject: [PATCH 19/97] Fix sql error --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 10f6dc8c041..5b8495a6091 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2263,7 +2263,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w"; $sql .= " WHERE wp.type_container IN ('page', 'blogpost')"; $sql .= " AND wp.fk_website = w.rowid"; - $sql .= " AND status = ".WebsitePage::STATUS_VALIDATED; + $sql .= " AND wp.status = ".WebsitePage::STATUS_VALIDATED; $sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')"; $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; $resql = $db->query($sql); From fd3f2f4e27ca4d808c7560affa695962bd06c039 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:46:14 +0200 Subject: [PATCH 20/97] Set order in sitemap --- htdocs/website/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 5b8495a6091..1512ae038cd 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2266,6 +2266,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $sql .= " AND wp.status = ".WebsitePage::STATUS_VALIDATED; $sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')"; $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; + $sql .= " ORDER BY wp.fk_default_home DESC, wp.rowid DESC"; $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); From 8067e1d70ad8ae6dea249a03fd7c3a141236ffd5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 14:48:38 +0200 Subject: [PATCH 21/97] Fix order --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 1512ae038cd..2df1c6151a3 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2266,7 +2266,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { $sql .= " AND wp.status = ".WebsitePage::STATUS_VALIDATED; $sql .= " AND wp.pageurl NOT IN ('404', '500', '501', '503')"; $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; - $sql .= " ORDER BY wp.fk_default_home DESC, wp.rowid DESC"; + $sql .= " ORDER BY wp.tms DESC, wp.rowid DESC"; $resql = $db->query($sql); if ($resql) { $num_rows = $db->num_rows($resql); From 03f7ec13cff96458d6378c21a9a996ed2c2de7fb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 15:00:23 +0200 Subject: [PATCH 22/97] Can sort on language on list of website pages --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 2df1c6151a3..ce6990ab29f 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -4220,7 +4220,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print getTitleFieldOfList("Type", 0, $_SERVER['PHP_SELF'], 'type_container', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF']); - print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); + print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); From cad7ea0b920e85cb866f1082720d0d8e3d0abc5d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 15:07:22 +0200 Subject: [PATCH 23/97] css --- htdocs/core/class/translate.class.php | 4 ++-- htdocs/core/lib/functions.lib.php | 2 +- htdocs/website/index.php | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index f06bb32b62b..2a25652761d 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -735,7 +735,7 @@ class Translate * @param string $str string root to translate * @param string $countrycode country code (FR, ...) * @return string translated string - * @see transcountrynoentities() + * @see transcountrynoentities(), picto_from_langcode() */ public function transcountry($str, $countrycode) { @@ -753,7 +753,7 @@ class Translate * @param string $str string root to translate * @param string $countrycode country code (FR, ...) * @return string translated string - * @see transcountry() + * @see transcountry(), picto_from_langcode() */ public function transcountrynoentities($str, $countrycode) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 2b981530834..ce3b89d7805 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7996,7 +7996,7 @@ function dol_validElement($element) } /** - * Return img flag of country for a language code or country code + * Return img flag of country for a language code or country code. * * @param string $codelang Language code ('en_IN', 'fr_CA', ...) or ISO Country code on 2 characters in uppercase ('IN', 'FR') * @param string $moreatt Add more attribute on img tag (For example 'style="float: right"' or 'class="saturatemedium"') diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce6990ab29f..b3f46270c46 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -4220,7 +4220,7 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = print getTitleFieldOfList("Type", 0, $_SERVER['PHP_SELF'], 'type_container', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("Page", 0, $_SERVER['PHP_SELF'], 'pageurl', '', $param, '', $sortfield, $sortorder, '')."\n"; print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF']); - print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, '')."\n"; + print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']); @@ -4278,8 +4278,8 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction = $param .= '&searchstring='.urlencode($searchkey); // Language - print ''; - print $answerrecord->lang; + print ''; + print picto_from_langcode($answerrecord->lang, $answerrecord->lang); print ''; // Number of words From 10f1443d4a82976ec8622b68bbdaaba0d5a1de15 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 15:27:45 +0200 Subject: [PATCH 24/97] Debug sitemap generation. Bad format of date --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b3f46270c46..464a389836d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2304,7 +2304,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { // URL of sitemaps must end with trailing slash if page is '' $loc = $domtree->createElement('loc', $domainname.'/'.$pageurl); - $lastmod = $domtree->createElement('lastmod', $db->jdate($objp->tms)); + $lastmod = $domtree->createElement('lastmod', dol_print_date($db->jdate($objp->tms), 'dayrfc', 'gmt'); $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values $priority = $domtree->createElement('priority', '1'); From 69aa5553f58f2f28fffca11036bf233394210961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 15:28:52 +0200 Subject: [PATCH 25/97] Fix syntax error --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 464a389836d..f2ce403ef17 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2304,7 +2304,7 @@ if ($action == 'generatesitemaps' && $usercanedit) { // URL of sitemaps must end with trailing slash if page is '' $loc = $domtree->createElement('loc', $domainname.'/'.$pageurl); - $lastmod = $domtree->createElement('lastmod', dol_print_date($db->jdate($objp->tms), 'dayrfc', 'gmt'); + $lastmod = $domtree->createElement('lastmod', dol_print_date($db->jdate($objp->tms), 'dayrfc', 'gmt')); $changefreq = $domtree->createElement('changefreq', 'weekly'); // TODO Manage other values $priority = $domtree->createElement('priority', '1'); From f4fa16797b6b7c28bf45a4c20fee13b0325259f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:00:48 +0200 Subject: [PATCH 26/97] Complete information on tab for files on salary --- htdocs/salaries/document.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index fddb5259da9..4c88cefb8de 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -123,8 +123,23 @@ if ($object->id) { print '
'; print ''; - print ''; - print ''; + + print ""; + print ''; + + print ""; + print ''; + + print ''; + + print ''; + + print ''; + print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
' . $langs->trans("DateStartPeriod") . ''; + print dol_print_date($object->datesp, 'day'); + print '
' . $langs->trans("DateEndPeriod") . ''; + print dol_print_date($object->dateep, 'day'); + print '
' . $langs->trans("Amount") . '' . price($object->amount, 0, $langs, 1, -1, -1, $conf->currency) . '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.dol_print_size($totalsize, 1, 1).'
'; print ''; From c4f27cc29f1376d90d0c73bdd1f334ccb8649fd8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:43:09 +0200 Subject: [PATCH 27/97] Debug module salary --- htdocs/salaries/card.php | 13 +++++----- htdocs/salaries/class/salary.class.php | 10 ++++++-- htdocs/salaries/list.php | 4 +++ htdocs/user/bank.php | 35 ++++++++++++++++++-------- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ad28bcca999..5b6134d192d 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -213,10 +213,11 @@ if ($action == 'add' && empty($cancel)) { } if (!$error) { + $db->begin(); + $ret = $object->create($user); if ($ret < 0) $error++; if (!empty($auto_create_paiement) && !$error) { - $db->begin(); // Create a line of payments $paiement = new PaymentSalary($db); $paiement->chid = $object->id; @@ -243,15 +244,11 @@ if ($action == 'add' && empty($cancel)) { setEventMessages($paiement->error, null, 'errors'); } } - - if (!$error) { - $db->commit(); - } else { - $db->rollback(); - } } if (empty($error)) { + $db->commit(); + if (GETPOST('saveandnew', 'alpha')) { setEventMessages($langs->trans("RecordSaved"), '', 'mesgs'); header("Location: card.php?action=create&fk_project=" . urlencode($projectid) . "&accountid=" . urlencode($accountid) . '&paymenttype=' . urlencode(GETPOST('paymenttype', 'az09')) . '&datepday=' . GETPOST("datepday", 'int') . '&datepmonth=' . GETPOST("datepmonth", 'int') . '&datepyear=' . GETPOST("datepyear", 'int')); @@ -260,6 +257,8 @@ if ($action == 'add' && empty($cancel)) { header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $object->id); exit; } + } else { + $db->rollback(); } } diff --git a/htdocs/salaries/class/salary.class.php b/htdocs/salaries/class/salary.class.php index 85ccfc0a1db..94ede5d7a4d 100644 --- a/htdocs/salaries/class/salary.class.php +++ b/htdocs/salaries/class/salary.class.php @@ -498,6 +498,12 @@ class Salary extends CommonObject $label = ''.$langs->trans("Salary").''; $label .= '
'; $label .= ''.$langs->trans('Ref').': '.$this->ref; + if ($this->label) { + $label .= '
'.$langs->trans('Label').': '.$this->label; + } + if ($this->datesp && $this->dateep) { + $label .= '
'.$langs->trans('Period').': '.dol_print_date($this->datesp, 'day').' - '.dol_print_date($this->dateep, 'day'); + } $url = DOL_URL_ROOT.'/salaries/card.php?id='.$this->id; @@ -647,9 +653,9 @@ class Salary extends CommonObject /** * Retourne le libelle du statut d'une facture (brouillon, validee, abandonnee, payee) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) - * @return string Libelle + * @return string Label */ public function getLibStatut($mode = 0, $alreadypaid = -1) { diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index b35b890b994..382e05e4f0d 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -532,6 +532,10 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $salstatic->id = $obj->rowid; $salstatic->ref = $obj->rowid; + $salstatic->label = $obj->label; + $salstatic->paye = $obj->paye; + $salstatic->datesp = $db->jdate($obj->datesp); + $salstatic->dateep = $db->jdate($obj->dateep); // Show here line of result print ''; diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index df5757992f0..356e23a5de0 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -40,6 +40,7 @@ if (!empty($conf->expensereport->enabled)) { require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; } if (!empty($conf->salaries->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php'; require_once DOL_DOCUMENT_ROOT.'/salaries/class/paymentsalary.class.php'; } @@ -354,16 +355,18 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac // Latest payments of salaries if (!empty($conf->salaries->enabled) && - $user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id) + (($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall))) ) { $payment_salary = new PaymentSalary($db); + $salary = new Salary($db); - $sql = "SELECT ps.rowid, s.datesp, s.dateep, ps.amount"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as ps"; - $sql .= " INNER JOIN ".MAIN_DB_PREFIX."salary as s ON (s.rowid = ps.fk_salary)"; + $sql = "SELECT s.rowid as sid, s.ref as sref, s.label, s.datesp, s.dateep, s.paye, SUM(ps.amount) as alreadypaid"; + $sql .= " FROM ".MAIN_DB_PREFIX."salary as s"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."payment_salary as ps ON (s.rowid = ps.fk_salary)"; $sql .= " WHERE s.fk_user = ".$object->id; - $sql .= " AND ps.entity = ".$conf->entity; - $sql .= " ORDER BY ps.rowid DESC"; + $sql .= " AND s.entity IN (".getEntity('salary').")"; + $sql .= " GROUP BY s.rowid, s.ref, s.label, s.datesp, s.dateep, s.paye"; + $sql .= " ORDER BY s.dateep DESC"; $resql = $db->query($sql); if ($resql) { @@ -372,7 +375,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac print ''; print ''; - print '
'; + print ''; print ''; @@ -380,16 +383,26 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac while ($i < $num && $i < $MAXLIST) { $objp = $db->fetch_object($resql); + $payment_salary->id = $objp->rowid; + $payment_salary->ref = $objp->ref; + $payment_salary->datep = $db->jdate($objp->datep); + + $salary->id = $objp->sid; + $salary->ref = $objp->sref ? $objp->sref : $objp->sid; + $salary->label = $objp->label; + $salary->datesp = $db->jdate($objp->datesp); + $salary->dateep = $db->jdate($objp->dateep); + $salary->paye = $objp->paye; + print ''; print ''; print '\n"; print '\n"; - print ''; + //print ''; + print ''; print ''; $i++; From 55f114511cdaa166afe7da2fdd958e298b06821d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 16:56:55 +0200 Subject: [PATCH 28/97] Debug v14 --- htdocs/user/list.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 1eecf26664c..fe05c551945 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -595,7 +595,7 @@ $moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { $moreforfilter .= '
'; - $moreforfilter .= $langs->trans('Categories').': '; + $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="paddingright"'); $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); $moreforfilter .= '
'; } @@ -724,7 +724,7 @@ if (!empty($arrayfields['u.gender']['checked'])) { print_liste_field_titre("Gender", $_SERVER['PHP_SELF'], "u.gender", $param, "", "", $sortfield, $sortorder); } if (!empty($arrayfields['u.employee']['checked'])) { - print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['u.fk_user']['checked'])) { print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder); @@ -822,6 +822,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $li = $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); print '
'; + if (!empty($arrayfields['u.login']['checked'])) { print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } } if (!empty($arrayfields['u.firstname']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } @@ -858,7 +859,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } if (!empty($arrayfields['u.employee']['checked'])) { - print ''; + print ''; if (!$i) { $totalarray['nbfield']++; } From 7794927a64218d67849f0738557b4a6a6bec345d Mon Sep 17 00:00:00 2001 From: ATM john Date: Sun, 18 Apr 2021 20:12:24 +0200 Subject: [PATCH 29/97] New check update for modules --- htdocs/admin/modules.php | 33 ++++++----- htdocs/core/lib/functions.lib.php | 17 +++++- htdocs/core/modules/DolibarrModules.class.php | 58 ++++++++++++++++++- htdocs/langs/en_US/admin.lang | 5 +- htdocs/langs/en_US/errors.lang | 1 + htdocs/theme/eldy/btn.inc.php | 5 ++ htdocs/theme/eldy/info-box.inc.php | 8 ++- htdocs/theme/md/info-box.inc.php | 4 +- 8 files changed, 106 insertions(+), 25 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index fbe1ae98619..8380756bee5 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -518,11 +518,13 @@ if ($mode == 'common' || $mode == 'commonkanban') { print $deschelp; - $moreforfilter = '
'; + $moreforfilter = '
'; - $moreforfilter .= '
'."\n"; if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) { @@ -894,15 +898,14 @@ if ($mode == 'common' || $mode == 'commonkanban') { // Version print '\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ce3b89d7805..1b12dd75d4d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9710,6 +9710,16 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = return '
<'.$tag.' '.$compiledAttributes.'>'.$html.'
'; } +/** + * Add space between dolGetButtonTitle + * + * @return string html of title separator + */ +function dolGetButtonTitleSeparator($moreClass = "") +{ + return ''; +} + /** * Function dolGetButtonTitle : this kind of buttons are used in title in list * @@ -9718,7 +9728,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url = * @param string $iconClass class for icon element (Example: 'fa fa-file') * @param string $url the url for link * @param string $id attribute id of button - * @param int $status 0 no user rights, 1 active, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip + * @param int $status 0 no user rights, 1 active, 2 current action or selected, -1 Feature Disabled, -2 disable Other reason use helpText as tooltip * @param array $params various params for future : recommended rather than adding more function arguments * @return string html button */ @@ -9753,7 +9763,10 @@ function dolGetButtonTitle($label, $helpText = '', $iconClass = 'fa fa-file', $u $useclassfortooltip = 0; } - if ($status <= 0) { + if ($status == 2) { + $attr['class'] .= ' btnTitleSelected'; + } + elseif ($status <= 0) { $attr['class'] .= ' refused'; $attr['href'] = ''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index b92937cdada..44fc64e0fd8 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -192,6 +192,18 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it */ public $version; + /** + * Module last version + * @var string $lastVersion + */ + public $lastVersion = ''; + + /** + * true indicate this module need update + * @var bool $needUpdate + */ + public $needUpdate = false; + /** * @var string Module description (short text) * @@ -2215,10 +2227,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * @param string $codetoconfig HTML code to go to config page * @return string HTML code of Kanban view */ - public function getKanbanView($codeenabledisable = '', $codetoconfig = '') + public function getKanbanView($codeenabledisable = '', $codetoconfig = '', $checkUpdate = false) { global $conf, $langs; + if ($this->isCoreOrExternalModule() == 'external' && $checkUpdate) { + $this->checkForUpdate(); + } + // Define imginfo $imginfo = "info"; if ($this->isCoreOrExternalModule() == 'external') { @@ -2239,8 +2255,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $versiontrans .= 'warning'; } + $versiontrans .= ' --need-update classfortooltip'; print ' -
+
'; @@ -2258,7 +2279,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } if ($this->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) { - print 'getVersion(1).'">'; + + $versionTitle = $langs->trans("Version").' '.$this->getVersion(1); + if ($this->needUpdate){ + $versionTitle.= '
'.$langs->trans('ModuleUpdateAvailable').' : '.$this->lastVersion; + } + + print ''; print $this->getVersion(1); print ''; } @@ -2287,4 +2314,29 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
'; } + + /** + * check for module update + * @return int <0 if Error, 0 == no update needed, >0 if need update + */ + function checkForUpdate(){ + require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (!empty($this->url_last_version)) { + $lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only + if (isset($lastVersion['content'])) { + $this->lastVersion = $lastVersion['content']; + if (version_compare($lastVersion['content'], $this->version) > 0) { + $this->needUpdate = true; + return 1; + }else{ + $this->needUpdate = false; + return 0; + } + } + else{ + return -1; + } + } + return 0; + } } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b103d0082ba..7f37655012c 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2121,4 +2121,7 @@ YouShouldDisablePHPFunctions=You should disable PHP functions IfCLINotRequiredYouShouldDisablePHPFunctions=Except if you need to run system commands (for the module Scheduled job, or to run the external command line Anti-virus for example), you shoud disable PHP functions NoWritableFilesFoundIntoRootDir=No writable files or directories of the common programs were found into your root directory (Good) RecommendedValueIs=Recommended: %s -ARestrictedPath=A restricted path \ No newline at end of file +ARestrictedPath=A restricted path +CheckForModuleUpdate=Check for modules updates +CheckForModuleUpdateHelp=Check for modules updates.
This action will connect to modules editors to check if a new version is available. +ModuleUpdateAvailable=An update is available for this module diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 002aa63fa62..89aa9b77662 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -296,3 +296,4 @@ WarningAvailableOnlyForHTTPSServers=Available only if using HTTPS secured connec WarningModuleXDisabledSoYouMayMissEventHere=Module %s has not been enabled. So you may miss a lot of event here. ErrorActionCommPropertyUserowneridNotDefined=User's owner is required ErrorActionCommBadType=Selected event type (id: %n, code: %s) do not exist in Event Type dictionary +CheckVersionFail=Version check fail diff --git a/htdocs/theme/eldy/btn.inc.php b/htdocs/theme/eldy/btn.inc.php index 3e3ab1d3b01..92715b774ce 100644 --- a/htdocs/theme/eldy/btn.inc.php +++ b/htdocs/theme/eldy/btn.inc.php @@ -279,6 +279,11 @@ div.pagination li:first-child a.btnTitle{ margin-left: 10px; } +.button-title-separator{ + display: inline-block; + clear: both; + width: 20px; +} .imgforviewmode { color: #aaa; diff --git a/htdocs/theme/eldy/info-box.inc.php b/htdocs/theme/eldy/info-box.inc.php index 3eda0c40ee7..dc2dbb3f4d3 100644 --- a/htdocs/theme/eldy/info-box.inc.php +++ b/htdocs/theme/eldy/info-box.inc.php @@ -9,10 +9,14 @@ if (!defined('ISLOADEDBYSTEELSHEET')) { * ------------------- */ -.info-box-module-external span.info-box-icon-version { +.info-box-module.--external span.info-box-icon-version { background: #bbb; } +.info-box-module.--external.--need-update span.info-box-icon-version{ + background: #bc9525; +} + .info-box { display: block; position: relative; @@ -153,7 +157,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { -webkit-transition: opacity 0.5s, visibility 0s 0.5s; transition: opacity 0.5s, visibility 0s 0.5s; } -.box-flex-item.info-box-module.info-box-module-disabled { +.box-flex-item.info-box-module.--disabled { /* opacity: 0.6; */ } diff --git a/htdocs/theme/md/info-box.inc.php b/htdocs/theme/md/info-box.inc.php index 0946315391a..a363475c409 100644 --- a/htdocs/theme/md/info-box.inc.php +++ b/htdocs/theme/md/info-box.inc.php @@ -119,7 +119,7 @@ if (GETPOSTISSET('THEME_SATURATE_RATIO')) { } -.info-box-module-external span.info-box-icon-version { +.info-box-module.--external span.info-box-icon-version { background: #bbb; } @@ -250,7 +250,7 @@ a.info-box-text-a i.fa.fa-exclamation-triangle { transition: opacity 0.5s, visibility 0s 0.5s; } -.box-flex-item.info-box-module.info-box-module-disabled { +.box-flex-item.info-box-module.--disabled { /* opacity: 0.6; */ } From 2b894e8ab3378fa4c0a300e461a360413bd05477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 20:13:18 +0200 Subject: [PATCH 30/97] css --- htdocs/install/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index eaefd6d5b2b..5363d9530e1 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -362,7 +362,7 @@ tr.choiceselected td .button { } a.button:link,a.button:visited,a.button:active { - color: #888; + color: #555; } .button { From 0c531984957095464f42d61904159ddc4b755773 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 18 Apr 2021 20:18:38 +0200 Subject: [PATCH 31/97] Easier to click --- htdocs/install/step2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index d9321656355..2841ae8bdfe 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -572,7 +572,7 @@ dolibarr_install_syslog("- step2: end"); $out = ' '; -$out .= $langs->trans("MakeAnonymousPing"); +$out .= ''; $out .= ''; $out .= ''; - print '
'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSalaries").''.$num.''; print '
'.$langs->trans("LastSalaries", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllSalaries").''.$num.'
'; - $payment_salary->id = $objp->rowid; - $payment_salary->ref = $objp->rowid; - print $payment_salary->getNomUrl(1); + print $salary->getNomUrl(1); print ''.dol_print_date($db->jdate($objp->datesp), 'day')."'.dol_print_date($db->jdate($objp->dateep), 'day')."'.price($objp->amount).''.price($objp->amount).''.$salary->getLibStatut(5, $objp->alreadypaid).'
'; print $li; @@ -836,13 +837,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) { } } if (!empty($arrayfields['u.lastname']['checked'])) { - print ''.$obj->lastname.''.dol_escape_htmltag($obj->lastname).''.$obj->firstname.''.dol_escape_htmltag($obj->firstname).''.yn($obj->employee).''.yn($obj->employee).'
'; print $versiontrans; - if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)) { // This is a bad practice to activate a synch external access during building of a page. 1 external module can hang the application. - require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; - if (!empty($objMod->url_last_version)) { - $newversion = getURLContent($objMod->url_last_version, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only - if (isset($newversion['content'])) { - if (version_compare($newversion['content'], $versiontrans) > 0) { - print " ".$newversion['content'].""; - } - } + if (!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE) || $action == 'checklastversion') { // This is a bad practice to activate a synch external access during building of a page. 1 external module can hang the application. + $checkRes = $objMod->checkForUpdate(); + if ($checkRes > 0) { + setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion); + print ' '.$objMod->lastVersion.''; + } + elseif ($checkRes < 0) { + setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings'); } } print "
'."\n"; +print '
'."\n"; // Type if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { @@ -564,9 +564,10 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); print ''; } - // Moral/Physic attribute - $morphys["phy"] = $langs->trans("Physical"); - $morphys["mor"] = $langs->trans("Moral"); + +// Moral/Physic attribute +$morphys["phy"] = $langs->trans("Physical"); +$morphys["mor"] = $langs->trans("Moral"); if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print ''."\n"; - // Lastname - print ''."\n"; - // Firstname - print ''."\n"; - // Gender - print ''; - print ''; - // Company - print ''."\n"; - // Address - print ''."\n"; - // Zip / Town - print ''; - // Country - print ''."\n"; +// Lastname +print ''."\n"; +// Firstname +print ''."\n"; +// Gender +print ''; +print ''; +// Company +print ''."\n"; +// Address +print ''."\n"; +// Zip / Town +print ''; +// Country +print ''; - // State +$country_code = getCountry($country_id, 2, $db, $langs); +print $form->select_country($country_id, 'country_id'); +print ''; +// State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { print ''; } - // EMail - print ''."\n"; - // Login +// EMail +print ''."\n"; +// Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { print ''."\n"; print ''."\n"; print ''."\n"; } - // Birthday - print ''."\n"; - // Photo - print ''."\n"; - // Public - print ''."\n"; - // Other attributes - $tpl_context = 'public'; // define template context to public - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - // Comments - print ''; - print ''; - print ''; - print ''."\n"; +// Birthday +print ''."\n"; +// Photo +print ''."\n"; +// Public +print ''."\n"; +// Other attributes +$tpl_context = 'public'; // define template context to public +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; +// Comments +print ''; +print ''; +print ''; +print ''."\n"; // Add specific fields used by Dolibarr foundation for example if (!empty($conf->global->MEMBER_NEWFORM_DOLIBARRTURNOVER)) { @@ -719,24 +721,24 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER print ' '.$langs->trans("Currency".$conf->currency); print ''; } - print "
'.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); @@ -575,33 +576,34 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) { print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; print ''; } - // Civility - print '
'.$langs->trans('UserTitle').''; - print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Gender").''; - $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); - print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''."\n"; - print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; - print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); - print ' / '; - print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); - print '
'.$langs->trans('Country').''; - $country_id = GETPOST('country_id'); + +// Civility +print '
'.$langs->trans('UserTitle').''; +print $formcompany->select_civility(GETPOST('civility_id'), 'civility_id').'
'.$langs->trans("Lastname").' *
'.$langs->trans("Firstname").' *
'.$langs->trans("Gender").''; +$arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); +print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); +print '
'.$langs->trans("Company").'
'.$langs->trans("Address").''."\n"; +print '
'.$langs->trans('Zip').' / '.$langs->trans('Town').''; +print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1); +print ' / '; +print $formcompany->select_ziptown(GETPOST('town'), 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 1); +print '
'.$langs->trans('Country').''; +$country_id = GETPOST('country_id'); if (!$country_id && !empty($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE)) { $country_id = getCountry($conf->global->MEMBER_NEWFORM_FORCECOUNTRYCODE, 2, $db, $langs); } @@ -616,10 +618,10 @@ if (!$country_id && !empty($conf->geoipmaxmind->enabled)) { } } } - $country_code = getCountry($country_id, 2, $db, $langs); - print $form->select_country($country_id, 'country_id'); - print '
'.$langs->trans('State').''; if ($country_code) { @@ -627,30 +629,30 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) { } print '
'.$langs->trans("Email").' *
'.$langs->trans("Email").' *
'.$langs->trans("Login").' *
'.$langs->trans("Password").' *
'.$langs->trans("PasswordAgain").' *
'.$langs->trans("DateOfBirth").''; - print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); - print '
'.$langs->trans("URLPhoto").'
'.$langs->trans("Public").'
'.$langs->trans("Comments").'
'.$langs->trans("DateOfBirth").''; +print $form->selectDate($birthday, 'birth', 0, 0, 1, "newmember", 1, 0); +print '
'.$langs->trans("URLPhoto").'
'.$langs->trans("Public").'
'.$langs->trans("Comments").'
\n"; +print "
\n"; - print dol_get_fiche_end(); +print dol_get_fiche_end(); - // Save - print '
'; - print ''; +// Save +print '
'; +print ''; if (!empty($backtopage)) { print '     '; } - print '
'; +print '
'; - print "\n"; - print "
"; - print ''; +print "\n"; +print "
"; +print ''; - llxFooterVierge(); +llxFooterVierge(); - $db->close(); +$db->close();