From 9d234a854158f979f88b4e5119569dc8ca6c9ff3 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:32:22 +0200 Subject: [PATCH 01/94] FIX: multicurrency: fields in discount unitialized when creating deposit --- htdocs/compta/facture/card.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index fe5d5c3ab0a..9501d34277e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1668,6 +1668,11 @@ if (empty($reshook)) $discount->tva_tx = $lines[$i]->tva_tx; $discount->fk_user = $user->id; $discount->description = $desc; + $discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice); + $discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht); + $discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva); + $discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc); + $discountid = $discount->create($user); if ($discountid > 0) { $result = $object->insert_discount($discountid); // This include link_to_invoice From 58b28d3d7db0bfcaf3652f4182d5c9555114739e Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 23 Oct 2021 22:32:03 +0200 Subject: [PATCH 02/94] Fix: fix php 8.0 warnings project --- htdocs/core/tpl/list_print_total.tpl.php | 2 +- htdocs/eventorganization/conferenceorbooth_list.php | 11 ++++++----- htdocs/projet/activity/perday.php | 9 +++++++-- htdocs/projet/activity/perweek.php | 7 ++++++- htdocs/projet/tasks/list.php | 8 +++++--- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 543bb939850..ec60dc36679 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,7 +13,7 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + print ''.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?:0).''; } else { if ($i == 1) { if (is_null($limit) || $num < $limit) { diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 0deb1707cfc..a82b39c1a76 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -494,7 +494,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)"; } $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'"; @@ -710,11 +710,11 @@ foreach ($object->fields as $key => $val) { if (!empty($arrayfields['t.'.$key]['checked'])) { print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], !empty($search[$key])?:'', $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) { - print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1); + print $object->showInputField($val, $key, !empty($search[$key])?:'', '', '', 'search_', 'maxwidth125', 1); } elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - print ''; + print ''; } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
'; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -772,7 +772,7 @@ print ''."\n"; // Detect if we need a fetch on each output line $needToFetchEachLine = 0; -if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { +if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { if (preg_match('/\$object/', $val)) { $needToFetchEachLine++; // There is at least one compute field that use $object @@ -796,6 +796,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { // Show here line of result print ''; + $totalarray['nbfield'] = 0; foreach ($object->fields as $key => $val) { $cssforfield = (empty($val['css']) ? '' : $val['css']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 29a3c40209c..06ae3a018a6 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -77,6 +77,9 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); $search_declared_progress = GETPOST('search_declared_progress', 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); + $monthofday = GETPOST('addtimemonth'); $dayofday = GETPOST('addtimeday'); $yearofday = GETPOST('addtimeyear'); @@ -127,7 +130,7 @@ $arrayfields['timeconsumed'] = array('label'=>'TimeConsumed', 'checked'=>1, 'ena ); */ // Extra fields -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); @@ -612,6 +615,8 @@ print ''.$langs->trans("HourStart").''; // By default, we can edit only tasks we are assigned to $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED); +$numendworkingday = 0; +$numstartworkingday = 0; // Get if user is available or not for each day $isavailable = array(); if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) { @@ -776,7 +781,7 @@ print '
'; print ''."\n"; print '
'; -print ''; +print ''; print '
'; print ''; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 08304cecaab..d529cadeb02 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -77,6 +77,9 @@ $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_thirdparty = GETPOST('search_thirdparty', 'alpha'); $search_declared_progress = GETPOST('search_declared_progress', 'alpha'); +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); + $startdayarray = dol_get_first_day_week($day, $month, $year); $prev = $startdayarray; @@ -135,7 +138,7 @@ $arrayfields['timeconsumed'] = array('label'=>'TimeConsumed', 'checked'=>1, 'ena }*/ // Definition of fields for list // Extra fields -if (is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) { +if (!empty($extrafields->attributes['projet_task']['label']) && is_array($extrafields->attributes['projet_task']['label']) && count($extrafields->attributes['projet_task']['label']) > 0) { foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) { if (!empty($extrafields->attributes['projet_task']['list'][$key])) { $arrayfields["efpt.".$key] = array('label'=>$extrafields->attributes['projet_task']['label'][$key], 'checked'=>(($extrafields->attributes['projet_task']['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes['projet_task']['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes['projet_task']['list'][$key]) != 3 && $extrafields->attributes['projet_task']['perms'][$key])); @@ -501,6 +504,8 @@ print '
'; $startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']); +$numendworkingday = 0; +$numstartworkingday = 0; // Get if user is available or not for each day $isavailable = array(); if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS)) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index e1ed162f9c2..6e44b8352ad 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -67,11 +67,13 @@ $search_task_user = GETPOST('search_task_user', 'int'); $search_task_progress = GETPOST('search_task_progress'); $search_task_budget_amount = GETPOST('search_task_budget_amount'); $search_societe = GETPOST('search_societe'); +$search_opp_status = GETPOST('$search_projectstatus'); -$mine = $_REQUEST['mode'] == 'mine' ? 1 : 0; +$mine = (!empty($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0; if ($mine) { $search_task_user = $user->id; $mine = 0; } +$type = GETPOST('type'); $search_date_startday = GETPOST('search_date_startday', 'int'); $search_date_startmonth = GETPOST('search_date_startmonth', 'int'); @@ -346,7 +348,7 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } if ($search_project_user > 0) { @@ -634,7 +636,7 @@ if ($search_all) { print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } -$morehtmlfilter = ''; +$moreforfilter = ''; // Filter on categories if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { From 051f6ca7170ce0886570740b8486934a5445777d Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 23 Oct 2021 23:12:42 +0200 Subject: [PATCH 03/94] Fix: php 8.0 warning commercial part --- htdocs/comm/propal/card.php | 9 +++++---- htdocs/comm/propal/index.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/contrat/list.php | 3 ++- htdocs/contrat/services_list.php | 3 ++- htdocs/fourn/commande/list.php | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 222f6ab8a87..7aa4ac02e00 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1442,7 +1442,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = $conf->propal->multidir_output[$object->entity]; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -1584,6 +1584,7 @@ if ($action == 'create') { // Third party print ''; print ''.$langs->trans('Customer').''; + $shipping_method_id = 0; if ($socid > 0) { print ''; print $soc->getNomUrl(1); @@ -1700,7 +1701,7 @@ if ($action == 'create') { // Delivery date (or manufacturing) print ''.$langs->trans("DeliveryDate").''; print ''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { + if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); @@ -1737,7 +1738,7 @@ if ($action == 'create') { print ''; print img_picto('', 'pdf').' '; $liste = ModelePDFPropales::liste_modeles($db); - $preselected = ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF); + $preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF")); print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); print ""; @@ -1754,7 +1755,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans('NotePublic').''; print ''; - $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null)); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index e170f873961..9f020bc1613 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -100,8 +100,8 @@ if (!empty($conf->propal->enabled)) { $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num); + $total = 0; if ($num) { - $total = 0; $i = 0; while ($i < $nbofloop) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3535ae0cde1..347954cc711 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -534,7 +534,7 @@ if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cb62cf0094f..23a32e5796e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1355,7 +1355,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = $conf->commande->multidir_output[$object->entity]; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 503c125b59c..6c14b57ef35 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -452,7 +452,7 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index cee0faf95aa..08c85bc620a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -229,6 +229,7 @@ $formother = new FormOther($db); $socstatic = new Societe($db); $formcompany = new FormCompany($db); $contracttmp = new Contrat($db); +$title = ""; $sql = 'SELECT'; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; @@ -259,7 +260,7 @@ if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 5bd98ded8c4..07cad07d2dd 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -37,6 +37,7 @@ $langs->loadLangs(array('products', 'contracts', 'companies')); $optioncss = GETPOST('optioncss', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -248,7 +249,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; } $sql .= " ".MAIN_DB_PREFIX."contratdet as cd"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 419e75b55aa..c96de8c2aec 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -765,7 +765,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; -if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { +if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cf.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { From 3bcafb548a4379ce56a2872eeea22d2b682fe008 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 19 Nov 2021 14:01:37 +0100 Subject: [PATCH 04/94] fix errors --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7aa4ac02e00..36ebc1e1246 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1442,7 +1442,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 23a32e5796e..89e671c7784 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1355,7 +1355,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; From be44e5b0ca7c455b7887872bb201357f4e5e91fe Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 19 Nov 2021 14:27:29 +0100 Subject: [PATCH 05/94] NEW: for developper select_dictionnry can now deal with label translated --- htdocs/core/class/html.formother.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 99ee1b6af9b..8a77367bc25 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1382,12 +1382,12 @@ class FormOther while ($i < $num) { $obj = $this->db->fetch_object($result); - if ($selected == $obj->rowid || $selected == $obj->$keyfield) { - print ''; $i++; } From c90082925cae2b5ab07d5649c6eb262a4b7bfe72 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Fri, 19 Nov 2021 14:30:33 +0100 Subject: [PATCH 06/94] fix --- htdocs/core/class/html.formother.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index cef9795ef9b..a93d744cbaf 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1387,6 +1387,7 @@ class FormOther print ''; $i++; } From 00369a5269956303f6fa656bec47039952deed76 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 19 Nov 2021 14:32:40 +0100 Subject: [PATCH 07/94] fix errors --- htdocs/core/tpl/list_print_total.tpl.php | 2 +- htdocs/projet/tasks/list.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index ec60dc36679..929ea2df50f 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -13,7 +13,7 @@ if (isset($totalarray['pos'])) { while ($i < $totalarray['nbfield']) { $i++; if (!empty($totalarray['pos'][$i])) { - print ''.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?:0).''; + print ''.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).''; } else { if ($i == 1) { if (is_null($limit) || $num < $limit) { diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 4e94eb37990..1553c58683f 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -349,7 +349,6 @@ $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if (!empty($arrayfields['t.tobill']['checked']) || !empty($arrayfields['t.billed']['checked'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } - if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; } From 4fcac5b53c61c966830553140cd6fcd2faf9e2fc Mon Sep 17 00:00:00 2001 From: Martin Neubauer Date: Fri, 19 Nov 2021 16:38:41 +0100 Subject: [PATCH 08/94] Fix check for non-custom modules The check turned out to be true even for custom modules, causing the copying of the language file to fail. This attempts to bring the code behaviour in line with the code explaining it. --- htdocs/modulebuilder/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 1ab03743747..f490788f291 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -742,9 +742,9 @@ if ($dirins && $action == 'addlanguage' && !empty($module)) { // Dir for module $diroflang = dol_buildpath($modulelowercase, 0); - if ($diroflang == $dirread.'/'.$modulelowercase) { + if ($diroflang == $dolibarr_main_document_root.'/'.$modulelowercase) { // This is not a custom module, we force diroflang to htdocs root - $diroflang = $dirread; + $diroflang = $dolibarr_main_document_root; $srcfile = $diroflang.'/langs/en_US/'.$modulelowercase.'.lang'; $destfile = $diroflang.'/langs/'.$newlangcode.'/'.$modulelowercase.'.lang'; From bf8008a320c44a379c3ed781f3963f60299fc42e Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 20 Nov 2021 09:55:04 +0100 Subject: [PATCH 09/94] TakePOS Direct Payment (Cash) Button doesn't work --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 8bd1c4dbca9..e5dda0110f2 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -789,7 +789,7 @@ function ModalBox(ModalID) function DirectPayment(){ console.log("DirectPayment"); - $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=trans("cash"); ?>", function() { + $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=LIQ", function() { }); } From bc6f38c556b43c167239e60da90ef4a4adcf22f8 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sat, 20 Nov 2021 15:25:51 +0100 Subject: [PATCH 10/94] TakePOS Direct Payment (Cash) Button doesn't work --- htdocs/takepos/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dc6a0cd82e9..1956166cf60 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -768,7 +768,7 @@ function ModalBox(ModalID) function DirectPayment(){ console.log("DirectPayment"); - $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=trans("cash"); ?>", function() { + $("#poslines").load("invoice.php?place="+place+"&action=valid&pay=LIQ", function() { }); } From eb76ff75052d9184ba1aaa7b4c7e0cb1acae2287 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 22 Nov 2021 11:52:25 +0100 Subject: [PATCH 11/94] NEW hidden configuration to modify the link to return on dolibarr. Used for externalaccess --- htdocs/user/class/user.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 18cfb950619..318c50d70a7 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2264,6 +2264,8 @@ class User extends CommonObject if (!$changelater) { $url = $urlwithroot.'/'; + if(!empty($conf->global->URL_REDIRECTION_AFTER_CHANGEPASSWORD)) + $url = $conf->global->URL_REDIRECTION_AFTER_CHANGEPASSWORD; $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; From 690466506ec9ad98d06ec5f927cff1f6d2b127e6 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 22 Nov 2021 12:01:20 +0100 Subject: [PATCH 12/94] NEW new hidden option to change the link of authentication in the mail after changing password --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 318c50d70a7..1fad896633b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -11,7 +11,7 @@ * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2018 charlene Benke - * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018-2021 Nicolas ZABOURI * Copyright (C) 2019-2020 Frédéric France * Copyright (C) 2019 Abbes Bahfir * From 0388a12a4bbf7b0a95447e95f02d9b33ce3af84d Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 22 Nov 2021 13:07:05 +0100 Subject: [PATCH 13/94] Stickler --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1fad896633b..1780c73fc69 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2264,7 +2264,7 @@ class User extends CommonObject if (!$changelater) { $url = $urlwithroot.'/'; - if(!empty($conf->global->URL_REDIRECTION_AFTER_CHANGEPASSWORD)) + if (!empty($conf->global->URL_REDIRECTION_AFTER_CHANGEPASSWORD)) $url = $conf->global->URL_REDIRECTION_AFTER_CHANGEPASSWORD; $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; From a3315e8e160b4a94b9187d0518ebc8fb0b2fbfc4 Mon Sep 17 00:00:00 2001 From: bomuux Date: Mon, 22 Nov 2021 16:17:49 +0100 Subject: [PATCH 14/94] contact/note.php always restricted for external users Case of external user : 1- restrictedArea always block the access, 2- if this weren't the case, the following code is obviously wrong : fetching a Contact from a Societe id... --- htdocs/contact/note.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/contact/note.php b/htdocs/contact/note.php index 1cb76b5336e..6ced85a5735 100644 --- a/htdocs/contact/note.php +++ b/htdocs/contact/note.php @@ -36,9 +36,9 @@ $langs->load("companies"); // Security check $id = GETPOST('id', 'int'); -if ($user->socid) { - $id = $user->socid; -} +//if ($user->socid) { +// $id = $user->socid; +//} $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); $object = new Contact($db); From b28b12f93af7dfe16ef2787fcc191b2029631b7a Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 22 Nov 2021 16:19:01 +0100 Subject: [PATCH 15/94] FIX Accountancy - SQL error on subledger account search in journal --- htdocs/accountancy/bookkeeping/list.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ec01d9c697c..52ac288856b 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -333,10 +333,6 @@ if (empty($reshook)) { $filter['t.numero_compte<='] = $search_accountancy_code_end; $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); } - if (!empty($search_accountancy_aux_code)) { - $filter['t.subledger_account'] = $search_accountancy_aux_code; - $param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code); - } if (!empty($search_accountancy_aux_code_start)) { $filter['t.subledger_account>='] = $search_accountancy_aux_code_start; $param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start); @@ -533,14 +529,12 @@ if (count($filter) > 0) { $sqlwhere[] = $key.'=\''.$db->idate($value).'\''; } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; - } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') { + } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') { $sqlwhere[] = $key.'\''.$db->escape($value).'\''; } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { $sqlwhere[] = $key.'='.$value; - } elseif ($key == 't.numero_compte') { + } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') { $sqlwhere[] = $key.' LIKE \''.$db->escape($value).'%\''; - } elseif ($key == 't.subledger_account') { - $sqlwhere[] = natural_search($key, $value, 0, 1); } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') { $sqlwhere[] = $key.'\''.$db->idate($value).'\''; } elseif ($key == 't.tms>=' || $key == 't.tms<=') { From 955eb9bc4a4b6b54d12700f5cfb1ce7b91cd2479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 00:22:43 +0100 Subject: [PATCH 16/94] fix #19374 --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f141d684b7..c14298d0142 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -944,7 +944,7 @@ class FormFile $out .= '">'.img_picto($langs->trans("Delete"), 'delete').''; } if ($printer) { - $out .= ''.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').''; } From bc4ce6725a6d67f21187e32182106a70b7ba46ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:14:25 +0100 Subject: [PATCH 17/94] fix undefined variable $result --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 9c84e2c2e89..f609befc076 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -13,7 +13,7 @@ * Copyright (C) 2014 Marcos García * Copyright (C) 2016 Ferran Marcet * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2019-2020 Frédéric France + * Copyright (C) 2019-2021 Frédéric France * Copyright (C) 2020 Tobias Sekan * * This program is free software; you can redistribute it and/or modify @@ -3200,7 +3200,8 @@ class SupplierProposalLine extends CommonObjectLine // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0) { - if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { + $result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product); + if ($result < 0) { return $result; } else { $this->pa_ht = $result; From 5e2dcf322cf0b2a0a59c4c810b0e4303449bd013 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 22:17:05 +0100 Subject: [PATCH 18/94] Update supplier_proposal.class.php --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index f609befc076..ea10b4d7137 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2998,7 +2998,8 @@ class SupplierProposalLine extends CommonObjectLine // if buy price not defined, define buyprice as configured in margin admin if ($this->pa_ht == 0) { - if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { + $result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product); + if ($result < 0) { return $result; } else { $this->pa_ht = $result; From e6af0facdd6c50d766ebd8ea3b91edaaba1d4389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 23 Nov 2021 23:27:07 +0100 Subject: [PATCH 19/94] keep info on latest activation version of module --- htdocs/admin/modulehelp.php | 5 +++++ htdocs/core/modules/DolibarrModules.class.php | 15 +++++++++++++-- htdocs/langs/en_US/admin.lang | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index a3c7c3d5c08..4ef01ab29af 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -262,6 +262,11 @@ if ($ip) { $text .= '
'.$langs->trans("LastActivationIP").': '; $text .= $ip; } +$lastactivationversion = $tmp['lastactivationversion']; +if ($lastactivationversion) { + $text .= '
'.$langs->trans("LastActivationVersion").': '; + $text .= $lastactivationversion; +} $moreinfo = $text; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 50171253938..9ecb73234de 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -957,7 +957,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $tmp = json_decode($obj->note, true); } if ($obj) { - return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms)); + return array( + 'authorid' => $tmp['authorid'], + 'ip' => $tmp['ip'], + 'lastactivationdate' => $this->db->jdate($obj->tms), + 'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'), + ); } } @@ -991,7 +996,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err++; } - $note = json_encode(array('authorid'=>(is_object($user) ? $user->id : 0), 'ip'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']))); + $note = json_encode( + array( + 'authorid' => (is_object($user) ? $user->id : 0), + 'ip' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']), + 'lastactivationversion' => $this->version, + ) + ); $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES"; $sql .= " (".$this->db->encrypt($this->const_name); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 4601f2c15b9..5b936c49291 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -353,6 +353,7 @@ LastStableVersion=Latest stable version LastActivationDate=Latest activation date LastActivationAuthor=Latest activation author LastActivationIP=Latest activation IP +LastActivationVersion=Latest activation version UpdateServerOffline=Update server offline WithCounter=Manage a counter GenericMaskCodes=You may enter any numbering mask. In this mask, the following tags can be used:
{000000} corresponds to a number which will be incremented on each %s. Enter as many zeros as the desired length of the counter. The counter will be completed by zeros from the left in order to have as many zeros as the mask.
{000000+000} same as the previous one but an offset corresponding to the number to the right of the + sign is applied starting on the first %s.
{000000@x} same as the previous one but the counter is reset to zero when month x is reached (x between 1 and 12, or 0 to use the early months of fiscal year defined in your configuration, or 99 to reset to zero every month). If this option is used and x is 2 or higher, then the sequence {yy}{mm} or {yyyy}{mm} is also required.
{dd} day (01 to 31).
{mm} month (01 to 12).
{yy}, {yyyy} or {y} year over 2, 4 or 1 numbers.
From 0b871ea0fb463890f5142c2d958a128736c8c178 Mon Sep 17 00:00:00 2001 From: Klaas Oldenburger Date: Wed, 24 Nov 2021 08:06:56 +0100 Subject: [PATCH 20/94] Update main.lang Changing date format the Dutch way --- htdocs/langs/nl_NL/main.lang | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index 3043bba6410..ab495070879 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -8,12 +8,12 @@ FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=, SeparatorThousand=Space -FormatDateShort=%m/%d/%Y -FormatDateShortInput=%m/%d/%Y -FormatDateShortJava=MM/dd/yyyy -FormatDateShortJavaInput=MM/dd/yyyy -FormatDateShortJQuery=mm/dd/yy -FormatDateShortJQueryInput=mm/dd/yy +FormatDateShort=%d-%m-%Y +FormatDateShortInput=%d-%m-%Y +FormatDateShortJava=dd-MM-yyyy +FormatDateShortJavaInput=dd-MM-yyyy +FormatDateShortJQuery=dd-mm-yy +FormatDateShortJQueryInput=dd-mm-yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M From c97083f596a9e4baf2f01664e2b2834bce19c55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Hahn?= Date: Wed, 24 Nov 2021 09:43:46 +0100 Subject: [PATCH 21/94] Better wording Use "Modify" instead of "Update" "Modify" is more like "I want to change something" "Update" is more like "I want to confirm my changes" --- htdocs/product/traduction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 2bd92f40e78..cff6ee0dd09 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -233,7 +233,7 @@ if (empty($reshook)) { if ($user->rights->produit->creer || $user->rights->service->creer) { print '' . $langs->trans("Add") . ''; if ($cnt_trans > 0) { - print '' . $langs->trans("Update") . ''; + print '' . $langs->trans("Modify") . ''; } } } From 632147ad889c2ea7c73eec0c90e2cf8e781b2310 Mon Sep 17 00:00:00 2001 From: Quentin VIAL-GOUTEYRON Date: Wed, 24 Nov 2021 12:04:18 +0100 Subject: [PATCH 22/94] object->id is always empty --- htdocs/compta/facture/contact.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 60fdeaf3e64..c340d68242e 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -118,14 +118,6 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer) * View */ -if (empty($object->id)) { - llxHeader(); - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} - $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; llxHeader('', $title, $helpurl); From c33205d564061f72d93fce964517d86b07fdcb9a Mon Sep 17 00:00:00 2001 From: Maximilian Stein Date: Tue, 16 Nov 2021 19:09:14 +0100 Subject: [PATCH 23/94] NEW: Show sum of holidays in holiday list Show a footer in the holidays list with the sum of all holidays currently visible. --- htdocs/holiday/list.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 953f5eabb2f..c49d1f4b600 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -736,6 +736,7 @@ if ($resql) { $i = 0; $totalarray = array(); $totalarray['nbfield'] = 0; + $totalduration = 0; while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); @@ -805,6 +806,7 @@ if ($resql) { if (!empty($arrayfields['duration']['checked'])) { print ''; $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; print $nbopenedday.' '.$langs->trans('DurationDays'); print ''; if (!$i) { @@ -887,6 +889,20 @@ if ($resql) { $i++; } + + if (!empty($arrayfields['duration']['checked'])) { + print ''; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + if($key == 'duration') { + print ''.$totalduration.' '.$langs->trans('DurationDays').''; + } else { + print ''; + } + } + } + print ''; + } } // Si il n'y a pas d'enregistrement suite à une recherche From b212778da0f72f370f0170a9f4d1d47eacdca67f Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 24 Nov 2021 17:09:11 +0000 Subject: [PATCH 24/94] Fixing style errors. --- htdocs/holiday/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index c49d1f4b600..0ecdcb2dd69 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -894,7 +894,7 @@ if ($resql) { print ''; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - if($key == 'duration') { + if ($key == 'duration') { print ''.$totalduration.' '.$langs->trans('DurationDays').''; } else { print ''; From 124e7f9b8823e4c509b7d11bd69b9e9294a119f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 24 Nov 2021 23:07:06 +0100 Subject: [PATCH 25/94] enable societe.class.php in coding test --- htdocs/societe/class/societe.class.php | 12 ++++++------ test/phpunit/CodingPhpTest.php | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 22276cc7bee..84f551bbd93 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4752,12 +4752,12 @@ class Societe extends CommonObject * Function used to replace a thirdparty id with another one. * It must be used within a transaction to avoid trouble * - * @param DoliDB $db Database handler + * @param DoliDB $dbs Database handler, because function is static we name it $dbs not $db to avoid breaking coding test * @param int $origin_id Old thirdparty id (will be removed) * @param int $dest_id New thirdparty id * @return bool True if success, False if error */ - public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + public static function replaceThirdparty(DoliDB $dbs, $origin_id, $dest_id) { if ($origin_id == $dest_id) { dol_syslog('Error: Try to merge a thirdparty into itself'); @@ -4774,9 +4774,9 @@ class Societe extends CommonObject $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_commerciaux '; $sql .= ' WHERE fk_soc = '.(int) $origin_id.') '; - $resql = $db->query($sql); - while ($obj = $db->fetch_object($resql)) { - $db->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.((int) $obj->rowid)); + $resql = $dbs->query($sql); + while ($obj = $dbs->fetch_object($resql)) { + $dbs->query('DELETE FROM '.MAIN_DB_PREFIX.'societe_commerciaux WHERE rowid = '.((int) $obj->rowid)); } /** @@ -4792,7 +4792,7 @@ class Societe extends CommonObject 'societe_rib' ); - return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + return CommonObject::commonReplaceThirdparty($dbs, $origin_id, $dest_id, $tables); } /** diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 383c37e95e5..b069140f420 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -213,12 +213,11 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase 'multicurrency.class.php', 'productbatch.class.php', 'reception.class.php', - 'societe.class.php' ))) { - // Must not found $db-> + // Must not find $db-> $ok=true; $matches=array(); - // Check string $db-> inside a class.php file (it should be $this->db-> insto such classes) + // Check string $db-> inside a class.php file (it should be $this->db-> into such classes) preg_match_all('/'.preg_quote('$db->', '/').'/', $filecontent, $matches, PREG_SET_ORDER); foreach ($matches as $key => $val) { $ok=false; From f66f3e73554f8678adc1a80981e42ee7aa3c019d Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 25 Nov 2021 15:25:17 +0100 Subject: [PATCH 26/94] FIX #19476 --- htdocs/ticket/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 16fdaf315f1..ab2c2794e38 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -568,7 +568,7 @@ if (empty($reshook)) { if ($ret > 0) { $log_action = $langs->trans('TicketInitialMessageModified')." \n"; // include the Diff class - dol_include_once('/ticket/class/utils_diff.class.php'); + dol_include_once('/core/class/utils_diff.class.php'); // output the result of comparing two files as plain text $log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message))); From 9d2fb782fafb8207f56204f0dda5efbf3ead0ceb Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 25 Nov 2021 15:41:28 +0100 Subject: [PATCH 27/94] FIX Option MAIN_DIRECT_STATUS_UPDATE broken. Ajax on/off not saving value in DB after updating to version >=12 --- htdocs/core/ajax/objectonoff.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index f7bf1d6299c..20256da94d7 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -80,5 +80,9 @@ if (($action == 'set') && !empty($id)) { $format = 'int'; + $object->table_element = $tablename; + $object->id = $id; + $object->fields[$field] = array('type' => $format, 'enabled' => 1); + $object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey); } From 6e68eaaef4e7e6bb1062dede5e46f60ca789c882 Mon Sep 17 00:00:00 2001 From: "moreauf@theobald-groupe.com" Date: Thu, 25 Nov 2021 16:36:18 +0100 Subject: [PATCH 28/94] card Modif --- htdocs/product/stock/movement_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index ebf655c77e5..b46eb9e0112 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -459,7 +459,7 @@ if ($action == "transfert_stock" && !$cancel) { } } } -}m.lalanne +} /* From 1361abffe515722631dafbfba68ff0c20f553a10 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 26 Nov 2021 18:22:31 +0100 Subject: [PATCH 29/94] FIX: holiday list: only mass delete if leave request is not in draft, canceled or refused, like in card --- htdocs/core/actions_massactions.inc.php | 6 ++++++ htdocs/langs/en_US/holiday.lang | 1 + 2 files changed, 7 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index abcdd690d5c..0c84b2d3781 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1280,6 +1280,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' continue; } + if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) { + $nbignored++; + setEventMessage($langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref)); + continue; + } + if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; diff --git a/htdocs/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang index eb2cd89adf1..ef96e72cc9d 100644 --- a/htdocs/langs/en_US/holiday.lang +++ b/htdocs/langs/en_US/holiday.lang @@ -132,3 +132,4 @@ FreeLegalTextOnHolidays=Free text on PDF WatermarkOnDraftHolidayCards=Watermarks on draft leave requests HolidaysToApprove=Holidays to approve NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays +ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted From f5343c55c39791f4351afedc6669bf7483db6957 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 26 Nov 2021 18:23:31 +0100 Subject: [PATCH 30/94] FIX: holiday mass deletion: correct return of record deleted --- htdocs/core/actions_massactions.inc.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 0c84b2d3781..2ce94cad8ed 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1320,7 +1320,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if (!$error) { if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + elseif ($nbok > 0) setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs'); $db->commit(); } else From 72493a5663cc6011395d694fbc59abbbd8b29342 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 15:13:36 +0100 Subject: [PATCH 31/94] Fix typo --- test/phpunit/SecurityTest.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index 81eff830b49..6bece069cc9 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -594,7 +594,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase print __METHOD__." login=".$login."\n"; $this->assertEquals($login, 'admin', 'The test to check if pass of user "admin" is "admin" has failed'); - $login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authetntication method + $login=checkLoginPassEntity('admin', 'admin', 1, array('http','dolibarr')); // Should work because of second authentication method print __METHOD__." login=".$login."\n"; $this->assertEquals($login, 'admin'); @@ -749,42 +749,42 @@ class SecurityTest extends PHPUnit\Framework\TestCase $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page $tmp = getURLContent($url, 'GET', '', 0); // We do NOT follow print __METHOD__." url=".$url."\n"; - $this->assertEquals(301, $tmp['http_code'], 'GET url 301 without following -> 301'); + $this->assertEquals(301, $tmp['http_code'], 'Should GET url 301 without following -> 301'); $url = 'https://www.dolibarr.fr'; // This is a redirect 301 page - $tmp = getURLContent($url); // We DO follow + $tmp = getURLContent($url); // We DO follow a page with return 300 so result should be 200 print __METHOD__." url=".$url."\n"; - $this->assertEquals(200, $tmp['http_code'], 'GET url 301 with following -> 200'); // Test error if return does not contains 'not supported' + $this->assertEquals(200, $tmp['http_code'], 'Should GET url 301 with following -> 200 but we get '.$tmp['http_code']); $url = 'http://localhost'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL $url = 'http://127.0.0.1'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.0.1 is not an external URL $url = 'http://127.0.2.1'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 127.0.2.1 is not an external URL $url = 'https://169.254.0.1'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because 169.254.0.1 is not an external URL $url = 'http://[::1]'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that is a local URL'); // Test we receive an error because [::1] is not an external URL /*$url = 'localtest.me'; $tmp = getURLContent($url, 'GET', '', 0, array(), array('http', 'https'), 0); // Only external URL print __METHOD__." url=".$url."\n"; - $this->assertEquals(400, $tmp['http_code'], 'GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL + $this->assertEquals(400, $tmp['http_code'], 'Should GET url to '.$url.' that resolves to a local URL'); // Test we receive an error because localtest.me is not an external URL */ return 0; From 66d9964861d2109bbc25b1f66836022d9f3bcbd3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 16:19:12 +0100 Subject: [PATCH 32/94] Clean code --- .../adherents/class/adherent_type.class.php | 6 ++--- htdocs/public/members/new.php | 24 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index cdf021cfa68..90f160e7932 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -543,14 +543,13 @@ class AdherentType extends CommonObject } /** - * Return list of amount by type id + * Return the array of all amounts per membership type id * * @param int $status Filter on status of type - * @return array List of types of members + * @return array Array of membership type */ public function amountByType($status = null) { - global $conf, $langs; $amountbytype = array(); @@ -578,6 +577,7 @@ class AdherentType extends CommonObject } else { print $this->db->error(); } + return $amountbytype; } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 04ae85041aa..caab1a0bbe3 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -730,21 +730,24 @@ 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 +if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { + $amount = 0; + $typeid = $conf->global->MEMBER_NEWFORM_FORCETYPE ? $conf->global->MEMBER_NEWFORM_FORCETYPE : GETPOST('typeid', 'int'); - // Set amount for the subscription - $amountbytype = $adht->amountByType(1); - $amount = !empty($amountbytype[GETPOST('typeid', 'int')]) ? $amountbytype[GETPOST('typeid', 'int')] : (isset($amount) ? $amount : 0); - - if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + // Set amount for the subscription: + // - First check the amount of the member type. + $amountbytype = $adht->amountByType(1); // Load the array of amount per type + $amount = empty($amountbytype[$typeid]) ? (isset($amount) ? $amount : 0) : $amountbytype[$typeid]; + // - If not found, take the default amount + if (empty($amount) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } - - if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE)) { - $amount = $amount ? $amount : (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : $conf->global->MEMBER_NEWFORM_AMOUNT); + // - If not set, we accept ot have amount defined as parameter (for backward compatibility). + if (empty($amount)) { + $amount = (GETPOST('amount') ? price2num(GETPOST('amount', 'alpha'), 'MT', 2) : ''); } + // Clean the amount $amount = price2num($amount); // $conf->global->MEMBER_NEWFORM_PAYONLINE is 'paypal', 'paybox' or 'stripe' @@ -758,6 +761,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) || !empty($conf->global->MEMBER print ' '.$langs->trans("Currency".$conf->currency); print ''; } + print "\n"; print dol_get_fiche_end(); From 2030d55c67b68144e9844c27aded4a899ba4726e Mon Sep 17 00:00:00 2001 From: Klaas Oldenburger Date: Sat, 27 Nov 2021 16:42:53 +0100 Subject: [PATCH 33/94] Update main.lang Did not complete earlier work. --- htdocs/langs/nl_NL/main.lang | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/langs/nl_NL/main.lang b/htdocs/langs/nl_NL/main.lang index 3043bba6410..1afc7f49fb7 100644 --- a/htdocs/langs/nl_NL/main.lang +++ b/htdocs/langs/nl_NL/main.lang @@ -17,12 +17,12 @@ FormatDateShortJQueryInput=mm/dd/yy FormatHourShortJQuery=HH:MI FormatHourShort=%I:%M %p FormatHourShortDuration=%H:%M -FormatDateTextShort=%b %d, %Y -FormatDateText=%B %d, %Y -FormatDateHourShort=%m/%d/%Y %I:%M %p -FormatDateHourSecShort=%m/%d/%Y %I:%M:%S %p -FormatDateHourTextShort=%b %d, %Y, %I:%M %p -FormatDateHourText=%B %d, %Y, %I:%M %p +FormatDateTextShort=%d %b %Y +FormatDateText=%d %B %Y +FormatDateHourShort=%d-%m-%Y %I:%M %p +FormatDateHourSecShort=%d-%m-%Y %I:%M:%S %p +FormatDateHourTextShort=%d %b %Y, %I:%M %p +FormatDateHourText=%d %B %Y, %I:%M %p DatabaseConnection=Databaseverbinding NoTemplateDefined=Geen sjabloon beschikbaar voor dit e-mailtype AvailableVariables=Beschikbare substitutievariabelen From 6e27abaed905cf511a1bafb65e42f6811eba03bf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 17:19:16 +0100 Subject: [PATCH 34/94] FIX redirect to payment page when membership payment mode forced --- htdocs/adherents/class/adherent.class.php | 1 + htdocs/public/members/new.php | 88 ++++++----------------- htdocs/public/payment/newpayment.php | 7 +- htdocs/public/payment/paymentok.php | 59 ++++++++++----- 4 files changed, 68 insertions(+), 87 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index a0d542bd79e..324e3cdc491 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1398,6 +1398,7 @@ class Adherent extends CommonObject $this->photo = $obj->photo; $this->statut = $obj->statut; + $this->status = $obj->statut; $this->public = $obj->public; $this->datec = $this->db->jdate($obj->datec); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index caab1a0bbe3..39b905acc8e 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -386,77 +386,29 @@ if (empty($reshook) && $action == 'add') { } if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { - if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'all') { - // The default behaviour - $urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); + $urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed - // TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT - // It is not so important because a test is done on return of payment validation. - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } elseif (price2num(GETPOST('amount', 'alpha'))) { - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed + // TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT + // It is not so important because a test is done on return of payment validation. + $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + } elseif (price2num(GETPOST('amount', 'alpha'))) { + $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); + } - if (GETPOST('email')) { - $urlback .= '&email='.urlencode(GETPOST('email')); + if (GETPOST('email')) { + $urlback .= '&email='.urlencode(GETPOST('email')); + } + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); + } else { + $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - /*} elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') { - $urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (price2num(GETPOST('amount', 'alpha'))) { - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } - if (GETPOST('email')) { - $urlback .= '&email='.urlencode(GETPOST('email')); - } - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { - $urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (price2num(GETPOST('amount', 'alpha'))) { - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } - if (GETPOST('email')) { - $urlback .= '&email='.urlencode(GETPOST('email')); - } - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') { - $urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; - if (price2num(GETPOST('amount', 'alpha'))) { - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } - if (GETPOST('email')) { - $urlback .= '&email='.urlencode(GETPOST('email')); - } - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - */ - } else { - dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment"); - exit; + } + + if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') { + $urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE); } } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 8eefd77e746..c63cf3b6624 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -184,11 +184,12 @@ if ($source == 'organizedeventregistration') { } -$paymentmethod = GETPOST('paymentmethod', 'alphanohtml') ?GETPOST('paymentmethod', 'alphanohtml') : ''; // Empty in most cases. Defined when a payment mode is forced +$paymentmethod = GETPOST('paymentmethod', 'alphanohtml') ? GETPOST('paymentmethod', 'alphanohtml') : ''; // Empty in most cases. Defined when a payment mode is forced $validpaymentmethod = array(); // Detect $paymentmethod foreach ($_POST as $key => $val) { + $reg = array(); if (preg_match('/^dopayment_(.*)$/', $key, $reg)) { $paymentmethod = $reg[1]; break; @@ -480,7 +481,7 @@ if ($action == 'dopayment') { // Called when choosing Stripe mode. // When using the Charge API architecture, this code is called after clicking the 'dopayment' with the Charge API architecture. -// When using the PaymentIntent API architecture, the Stripe customer is already created when creating PaymentIntent when showing payment page and the payment is already ok. +// When using the PaymentIntent API architecture, the Stripe customer was already created when creating PaymentIntent when showing payment page, and the payment is already ok when action=charge. if ($action == 'charge' && !empty($conf->stripe->enabled)) { $amountstripe = $amount; @@ -1325,7 +1326,7 @@ if ($source == 'contractline') { $qty = 1; if (GETPOST('qty')) { - $qty = GETPOST('qty'); + $qty = price2num(GETPOST('qty', 'alpha'), 'MS'); } // Creditor diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 18d6a2987c8..c46542ed3c4 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -386,7 +386,7 @@ if ($ispaymentok) { $adht = new AdherentType($db); $object = new Adherent($db); - $result1 = $object->fetch($tmptag['MEM']); + $result1 = $object->fetch((int) $tmptag['MEM']); $result2 = $adht->fetch($object->typeid); dol_syslog("We have to process member with id=".$tmptag['MEM']." result1=".$result1." result2=".$result2, LOG_DEBUG, 0, '_payment'); @@ -416,14 +416,41 @@ if ($ispaymentok) { // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { - $result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible - if ($result < 0 || empty($object->datevalid)) { - $error++; - $errmsg = $object->error; - $postactionmessages[] = $errmsg; - $postactionmessages = array_merge($postactionmessages, $object->errors); - $ispostactionok = -1; - dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment'); + // Security protection: + if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If we didn't allow members to choose their membership amount + if ($object->status == $object::STATUS_DRAFT) { // If the member is not yet validated, we check that the amount is the same as expected. + $typeid = $object->typeid; + + // Set amount for the subscription: + // - First check the amount of the member type. + $amountbytype = $adht->amountByType(1); // Load the array of amount per type + $amountexpected = empty($amountbytype[$typeid]) ? 0 : $amountbytype[$typeid]; + // - If not found, take the default amount + if (empty($amountexpected) && !empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amountexpected = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + + if ($amountexpected && $amountexpected != $FinalPaymentAmt) { + $error++; + $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') differs from value expected for membership ('.$amountexpected.'). May be a hack to try to pay a different amount ?'; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment'); + } + } + } + + if (! $error) { + // We validate the member (no effect if it is already validated) + $result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible + if ($result < 0 || empty($object->datevalid)) { + $error++; + $errmsg = $object->error; + $postactionmessages[] = $errmsg; + $postactionmessages = array_merge($postactionmessages, $object->errors); + $ispostactionok = -1; + dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment'); + } } // Subscription informations @@ -721,7 +748,7 @@ if ($ispaymentok) { // Record payment include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object = new Facture($db); - $result = $object->fetch($tmptag['INV']); + $result = $object->fetch((int) $tmptag['INV']); if ($result) { $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; @@ -827,7 +854,7 @@ if ($ispaymentok) { } elseif (array_key_exists('ORD', $tmptag) && $tmptag['ORD'] > 0) { include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php'; $object = new Commande($db); - $result = $object->fetch($tmptag['ORD']); + $result = $object->fetch((int) $tmptag['ORD']); if ($result) { $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; @@ -932,7 +959,7 @@ if ($ispaymentok) { } elseif (array_key_exists('DON', $tmptag) && $tmptag['DON'] > 0) { include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; $don = new Don($db); - $result = $don->fetch($tmptag['DON']); + $result = $don->fetch((int) $tmptag['DON']); if ($result) { $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; @@ -1141,7 +1168,7 @@ if ($ispaymentok) { if (!$error) { // Validating the attendee $attendeetovalidate = new ConferenceOrBoothAttendee($db); - $resultattendee = $attendeetovalidate->fetch($tmptag['ATT']); + $resultattendee = $attendeetovalidate->fetch((int) $tmptag['ATT']); if ($resultattendee < 0) { $error++; setEventMessages(null, $attendeetovalidate->errors, "errors"); @@ -1325,7 +1352,7 @@ if ($ispaymentok) { if (!$error) { // Putting the booth to "suggested" state $booth = new ConferenceOrBooth($db); - $resultbooth = $booth->fetch($tmptag['BOO']); + $resultbooth = $booth->fetch((int) $tmptag['BOO']); if ($resultbooth < 0) { $error++; setEventMessages(null, $booth->errors, "errors"); @@ -1490,12 +1517,12 @@ if ($ispaymentok) { $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); $content = ""; if (array_key_exists('MEM', $tmptag)) { - $url = $urlwithroot."/adherents/subscription.php?rowid=".$tmptag['MEM']; + $url = $urlwithroot."/adherents/subscription.php?rowid=".((int) $tmptag['MEM']); $content .= ''.$companylangs->trans("PaymentSubscription")."

\n"; $content .= $companylangs->trans("MemberId").': '.$tmptag['MEM']."
\n"; $content .= $companylangs->trans("Link").': '.$url.''."
\n"; } elseif (array_key_exists('INV', $tmptag)) { - $url = $urlwithroot."/compta/facture/card.php?id=".$tmptag['INV']; + $url = $urlwithroot."/compta/facture/card.php?id=".((int) $tmptag['INV']); $content .= ''.$companylangs->trans("Payment")."

\n"; $content .= $companylangs->trans("InvoiceId").': '.$tmptag['INV']."
\n"; //$content.=$companylangs->trans("ThirdPartyId").': '.$tmptag['CUS']."
\n"; From 54e335937f4568aa9a40766588319ed5894251f2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 18:05:41 +0100 Subject: [PATCH 35/94] FIX Bad redirect url for payment of members after public registration --- htdocs/public/members/new.php | 22 ++++++---------------- htdocs/public/payment/newpayment.php | 10 ++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 39b905acc8e..6589f2a17d0 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -386,35 +386,25 @@ if (empty($reshook) && $action == 'add') { } if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { - $urlback = DOL_MAIN_URL_ROOT.'/public/payment/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); - if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed // TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT // It is not so important because a test is done on return of payment validation. - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); - } elseif (price2num(GETPOST('amount', 'alpha'))) { - $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); } + $urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0); + if (GETPOST('email')) { $urlback .= '&email='.urlencode(GETPOST('email')); } - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { - if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { - $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } else { - $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); - } - } - if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') { $urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE); } + } else { + if (!empty($entity)) { + $urlback .= '&entity='.((int) $entity); + } } - if (!empty($entity)) { - $urlback .= '&entity='.((int) $entity); - } dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); } else { $error++; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c63cf3b6624..bb58936d78d 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1461,9 +1461,12 @@ if ($source == 'member' || $source == 'membersubscription') { $langs->load("members"); require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $member = new Adherent($db); + $adht = new AdherentType($db); + $result = $member->fetch('', $ref); if ($result <= 0) { $mesg = $member->error; @@ -1471,6 +1474,8 @@ if ($source == 'member' || $source == 'membersubscription') { } else { $member->fetch_thirdparty(); $subscription = new Subscription($db); + + $adht->fetch($member->typeid); } $object = $member; @@ -1479,6 +1484,11 @@ if ($source == 'member' || $source == 'membersubscription') { if (GETPOST("amount", 'alpha')) { $amount = GETPOST("amount", 'alpha'); } + // If amount still not defined, we take amount of the type of member + if (empty($amount)) { + $amount = $adht->amount; + } + $amount = price2num($amount, 'MT'); } From 5bb21a93a1fba9ac222b9062c471ac51751ca750 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 27 Nov 2021 18:25:38 +0100 Subject: [PATCH 36/94] FIX fatal error on cron list. --- htdocs/core/lib/functions.lib.php | 2 +- htdocs/cron/list.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 03366e9bae1..9a5ab68f898 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -8082,7 +8082,7 @@ function verifCond($strRights) //print $strRights."
\n"; $rights = true; - if ($strRights !== '') { + if (isset($strRights) && $strRights !== '') { $str = 'if(!('.$strRights.')) { $rights = false; }'; dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 4d829258b2b..686bb8a52a9 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -478,7 +478,7 @@ if ($num > 0) { if (empty($obj)) { break; } - if (!verifCond($obj->test)) { + if (isset($obj->test) && !verifCond($obj->test)) { continue; // Discard line with test = false } From 309f7da7ba6e35f92513611ed0d3852faef34cea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 18:29:31 +0100 Subject: [PATCH 37/94] Add log hidden into result page --- htdocs/public/payment/paymentok.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index c46542ed3c4..c8222c4c4aa 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -412,7 +412,7 @@ if ($ispaymentok) { $currencyCodeType = $_SESSION['currencyCodeType']; - dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId, LOG_DEBUG, 0, '_payment'); + dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { @@ -440,6 +440,9 @@ if ($ispaymentok) { } } + // Security protection: + // TODO check that currency is same ? + if (! $error) { // We validate the member (no effect if it is already validated) $result = ($object->status == $object::STATUS_EXCLUDED) ? -1 : $object->validate($user); // if membre is excluded (status == -2) the new validation is not possible @@ -1684,6 +1687,8 @@ if ($ispaymentok) { print "\n\n"; +print "\n"; + htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); From 27ae8f61bd28c463c9fb75c68a04206d31c216ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 27 Nov 2021 19:04:39 +0100 Subject: [PATCH 38/94] FIX Check on Stripe REAL amount currency before validating membership --- htdocs/public/payment/newpayment.php | 16 +++++++++++- htdocs/public/payment/paymentok.php | 37 +++++++++------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index bb58936d78d..27bf780de62 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -768,9 +768,23 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { setEventMessages($paymentintent->status, null, 'errors'); $action = ''; } else { - // TODO We can alse record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method + // TODO We can also record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); + + // Get here amount and currency used for payment and force value into $amount and $currency so the real amount is saved into session instead + // of the amount and currency retreived from the POST. + if (!empty($paymentintent->currency) && !empty($paymentintent->amount)) { + $currency = strtoupper($paymentintent->currency); + $amount = $paymentintent->amount; + + // Correct the amount according to unit of currency + // See https://support.stripe.com/questions/which-zero-decimal-currencies-does-stripe-support + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (!in_array($currency, $arrayzerounitcurrency)) { + $amount = $amount / 100; + } + } } } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index c8222c4c4aa..c822bfcdf96 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -343,6 +343,9 @@ if (empty($FinalPaymentAmt)) { if (empty($paymentType)) { $paymentType = $_SESSION["paymentType"]; } +if (empty($currencyCodeType)) { + $currencyCodeType = $_SESSION['currencyCodeType']; +} $fulltag = $FULLTAG; $tmptag = dolExplodeIntoArray($fulltag, '.', '='); @@ -403,15 +406,12 @@ if ($ispaymentok) { $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; } if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) { $paymentType = 'CB'; } $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - dol_syslog("FinalPaymentAmt=".$FinalPaymentAmt." paymentTypeId=".$paymentTypeId." currencyCodeType=".$currencyCodeType, LOG_DEBUG, 0, '_payment'); // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) @@ -435,13 +435,19 @@ if ($ispaymentok) { $errmsg = 'Value of FinalPayment ('.$FinalPaymentAmt.') differs from value expected for membership ('.$amountexpected.'). May be a hack to try to pay a different amount ?'; $postactionmessages[] = $errmsg; $ispostactionok = -1; - dol_syslog("Failed to validate member: ".$errmsg, LOG_ERR, 0, '_payment'); + dol_syslog("Failed to validate member (bad amount check): ".$errmsg, LOG_ERR, 0, '_payment'); } } } // Security protection: - // TODO check that currency is same ? + if ($currencyCodeType && $currencyCodeType != $conf->currency) { // Check that currency is the good one + $error++; + $errmsg = 'Value of currencyCodeType ('.$currencyCodeType.') differs from value expected for membership ('.$conf->currency.'). May be a hack to try to pay a different amount ?'; + $postactionmessages[] = $errmsg; + $ispostactionok = -1; + dol_syslog("Failed to validate member (bad currency check): ".$errmsg, LOG_ERR, 0, '_payment'); + } if (! $error) { // We validate the member (no effect if it is already validated) @@ -766,15 +772,12 @@ if ($ispaymentok) { $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; } if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) { $paymentType = 'CB'; } $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { $db->begin(); @@ -866,13 +869,10 @@ if ($ispaymentok) { if ($paymentmethod == 'paypal') $paymentTypeId = $conf->global->PAYPAL_PAYMENT_MODE_FOR_PAYMENTS; if ($paymentmethod == 'stripe') $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) $paymentType = 'CB'; $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($conf->facture->enabled)) { if (!empty($FinalPaymentAmt) && $paymentTypeId > 0 ) { @@ -964,8 +964,6 @@ if ($ispaymentok) { $don = new Don($db); $result = $don->fetch((int) $tmptag['DON']); if ($result) { - $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; - $paymentTypeId = 0; if ($paymentmethod == 'paybox') { $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; @@ -977,15 +975,12 @@ if ($ispaymentok) { $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; } if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) { $paymentType = 'CB'; } $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { $db->begin(); @@ -1074,8 +1069,6 @@ if ($ispaymentok) { $object = new Facture($db); $result = $object->fetch($ref); if ($result) { - $FinalPaymentAmt = $_SESSION["FinalPaymentAmt"]; - $paymentTypeId = 0; if ($paymentmethod == 'paybox') { $paymentTypeId = $conf->global->PAYBOX_PAYMENT_MODE_FOR_PAYMENTS; @@ -1087,15 +1080,12 @@ if ($ispaymentok) { $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; } if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) { $paymentType = 'CB'; } $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { $resultvalidate = $object->validate($user); @@ -1271,15 +1261,12 @@ if ($ispaymentok) { $paymentTypeId = $conf->global->STRIPE_PAYMENT_MODE_FOR_PAYMENTS; } if (empty($paymentTypeId)) { - $paymentType = $_SESSION["paymentType"]; if (empty($paymentType)) { $paymentType = 'CB'; } $paymentTypeId = dol_getIdFromCode($db, $paymentType, 'c_paiement', 'code', 'id', 1); } - $currencyCodeType = $_SESSION['currencyCodeType']; - // Do action only if $FinalPaymentAmt is set (session variable is cleaned after this page to avoid duplicate actions when page is POST a second time) if (!empty($FinalPaymentAmt) && $paymentTypeId > 0) { $resultvalidate = $object->validate($user); @@ -1687,7 +1674,7 @@ if ($ispaymentok) { print "\n\n"; -print "\n"; +print "\n"; htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix); From af1baf057b099b97cf7cf28986e17726671f4c19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 12:01:42 +0100 Subject: [PATCH 39/94] FIX #yogosha7789 --- htdocs/core/lib/functions.lib.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5d495e52c60..36e6f300819 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -835,7 +835,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options = $out = dol_string_onlythesehtmltags($out, 0, 1, 1); - // We should also exclude non expected attributes + // We should also exclude non expected HTML attributes and clean content of some attributes. if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) { // Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop. $out = trim(dol_string_onlythesehtmlattributes($out)); @@ -6476,9 +6476,27 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes if (is_object($dom)) { for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) { for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) { - // Delete attribute if not into allowed_attributes - if (! empty($attrs->item($ii)->name) && ! in_array($attrs->item($ii)->name, $allowed_attributes)) { - $els->item($i)->removeAttribute($attrs->item($ii)->name); + //var_dump($attrs->item($ii)); + if (! empty($attrs->item($ii)->name)) { + // Delete attribute if not into allowed_attributes + if (! in_array($attrs->item($ii)->name, $allowed_attributes)) { + $els->item($i)->removeAttribute($attrs->item($ii)->name); + } elseif (in_array($attrs->item($ii)->name, array('style'))) { + $valuetoclean = $attrs->item($ii)->value; + + do { + $oldvaluetoclean = $valuetoclean; + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments + $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); + if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. + $valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean); + $valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean); + } + } while ($oldvaluetoclean != $valuetoclean); + + $attrs->item($ii)->value = $valuetoclean; + } } } } From f08adef1e8d6eef6910eb8cd7803e3537216c138 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 28 Nov 2021 12:12:16 +0100 Subject: [PATCH 40/94] Fix ExpenseReport define template Can use template for expense report notification but not define it :/ --- htdocs/admin/mails_templates.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 7d8bc2f22b1..0adc526d69e 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -225,6 +225,9 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) { if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) { $elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket')); } +if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) { + $elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport')); +} if (!empty($conf->agenda->enabled)) { $elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); } From 5a165ae2bfd5d66e6b895120de4bb7acb1b1a3e8 Mon Sep 17 00:00:00 2001 From: fr69400 <82267780+fr69400@users.noreply.github.com> Date: Sun, 28 Nov 2021 14:40:15 +0100 Subject: [PATCH 41/94] FIX PDF_NOLD_PRODUCT_LABEL --- htdocs/admin/pdf.php | 23 +++++++++++++++++++++++ htdocs/core/lib/pdf.lib.php | 19 ++++++++++++++----- htdocs/langs/en_US/admin.lang | 2 ++ htdocs/langs/fr_FR/admin.lang | 2 ++ 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index c22d365d932..c4ae5d59225 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -170,6 +170,13 @@ if ($action == 'update') { dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity); } + if (GETPOSTISSET('PDF_BOLD_PRODUCT_LABEL')) { + dolibarr_set_const($db, "PDF_BOLD_PRODUCT_LABEL", GETPOST('PDF_BOLD_PRODUCT_LABEL', 'alpha'), 'chaine', 0, '', $conf->entity); + } + if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')){ + dolibarr_set_const($db, "PDF_BOLD_PRODUCT_REF_AND_PERIOD", GETPOST('PDF_BOLD_PRODUCT_REF_AND_PERIOD', 'alpha'), 'chaine', 0, '', $conf->entity); + } + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); @@ -499,6 +506,22 @@ if ($conf->use_javascript_ajax) { } print ''; +print ''.$langs->trans("BoldLabelOnPDF").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL'); +} else { + print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1); +} +print ''; + +print ''.$langs->trans("BoldRefAndPeriodOnPDF").''; +if ($conf->use_javascript_ajax) { + print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD'); +} else { + print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) ? $conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD : 0, 1); +} +print ''; + // Desc print ''.$langs->trans("HideDescOnPDF").''; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 5121506087c..7a78db5a14e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1363,7 +1363,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // Description short of product line $libelleproduitservice = $label; if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) { - // This part of code is bugged. It introduces a HTML tag making the label a html string but without converting \n into br if it was a full text non html string before. + if (!dol_textishtml($libelleproduitservice)){ + $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); + } $libelleproduitservice = ''.$libelleproduitservice.''; } } @@ -1375,7 +1377,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) { $tmparrayofsubproducts = reset($prodser->sousprods); foreach ($tmparrayofsubproducts as $subprodval) { - $libelleproduitservice .= "\n * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')'; + $libelleproduitservice .= "__N__ * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')'; } } } @@ -1419,7 +1421,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } if (empty($hidedesc)) { if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) { - $libelleproduitservice = $desc."\n".$libelleproduitservice; + $libelleproduitservice = $desc."__N__".$libelleproduitservice; } else { if (!empty($conf->global->HIDE_LABEL_VARIANT_PDF) && $prodser->isVariant()) { $libelleproduitservice = $desc; @@ -1493,10 +1495,14 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } if (!empty($ref_prodserv) && !empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) { + if (!dol_textishtml($libelleproduitservice)){ + $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); + } $ref_prodserv = ''.$ref_prodserv.''; - } + // $prefix_prodserv and $ref_prodser are not HTML var + } $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice; - + // Add an additional description for the category products if (!empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && !empty($conf->categorie->enabled)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -1527,6 +1533,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } //print '>'.$outputlangs->charset_output.','.$period; if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) { + if (!dol_textishtml($libelleproduitservice)){ + $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); + } $libelleproduitservice .= ''."__N__ ".$period.''; } else { $libelleproduitservice .= "__N__".$period; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index c258df38441..c36f29fa0d7 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - admin +BoldRefAndPeriodOnPDF=Bold reference and period in PDF +BoldLabelOnPDF=Bold label in PDF Foundation=Foundation Version=Version Publisher=Publisher diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 0b4d7aa4f10..9d2de4d5ca8 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1,4 +1,6 @@ # Dolibarr language file - Source file is en_US - admin +BoldRefAndPeriodOnPDF=Mettre en gras la référence et la période dans les PDF +BoldLabelOnPDF=Mettre en gras le label des produits dans les PDF Foundation=Association Version=Version Publisher=Editeur From a933793b8a43903fb6c514ae89da9df96690f9af Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 28 Nov 2021 13:42:25 +0000 Subject: [PATCH 42/94] Fixing style errors. --- htdocs/admin/pdf.php | 2 +- htdocs/core/lib/pdf.lib.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index c4ae5d59225..18a4ca0825f 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -173,7 +173,7 @@ if ($action == 'update') { if (GETPOSTISSET('PDF_BOLD_PRODUCT_LABEL')) { dolibarr_set_const($db, "PDF_BOLD_PRODUCT_LABEL", GETPOST('PDF_BOLD_PRODUCT_LABEL', 'alpha'), 'chaine', 0, '', $conf->entity); } - if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')){ + if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')) { dolibarr_set_const($db, "PDF_BOLD_PRODUCT_REF_AND_PERIOD", GETPOST('PDF_BOLD_PRODUCT_REF_AND_PERIOD', 'alpha'), 'chaine', 0, '', $conf->entity); } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 7a78db5a14e..2d8ce3b2996 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1363,7 +1363,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, // Description short of product line $libelleproduitservice = $label; if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) { - if (!dol_textishtml($libelleproduitservice)){ + if (!dol_textishtml($libelleproduitservice)) { $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); } $libelleproduitservice = ''.$libelleproduitservice.''; @@ -1495,14 +1495,14 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } if (!empty($ref_prodserv) && !empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) { - if (!dol_textishtml($libelleproduitservice)){ + if (!dol_textishtml($libelleproduitservice)) { $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); } $ref_prodserv = ''.$ref_prodserv.''; // $prefix_prodserv and $ref_prodser are not HTML var - } + } $libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice; - + // Add an additional description for the category products if (!empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && !empty($conf->categorie->enabled)) { include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -1533,7 +1533,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, } //print '>'.$outputlangs->charset_output.','.$period; if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) { - if (!dol_textishtml($libelleproduitservice)){ + if (!dol_textishtml($libelleproduitservice)) { $libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice); } $libelleproduitservice .= ''."__N__ ".$period.''; From 5d31bd441eb5b094bcf1f91eb40d4039b4c41cda Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 15:34:08 +0100 Subject: [PATCH 43/94] Fix php compatibility --- htdocs/core/lib/memory.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 557bbe6dcf5..032d567d35b 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0) $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists $rescode = $dolmemcache->getResultCode(); if ($rescode == 0) { - return is_countable($data) ? count($data) : 0; + return is_array($data) ? count($data) : 0; } else { return -$rescode; } @@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0) //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists if ($result) { - return is_countable($data) ? count($data) : 0; + return is_array($data) ? count($data) : 0; } else { return -1; } From ce651fae587669831f88ca3ac64ba31d10800299 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 15:34:08 +0100 Subject: [PATCH 44/94] Fix php compatibility --- htdocs/core/lib/memory.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 1300c1b771f..b3fd7109343 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0) $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists $rescode = $dolmemcache->getResultCode(); if ($rescode == 0) { - return is_countable($data) ? count($data) : 0; + return is_array($data) ? count($data) : 0; } else { return -$rescode; } @@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0) //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists if ($result) { - return is_countable($data) ? count($data) : 0; + return is_array($data) ? count($data) : 0; } else { return -1; } From ca11dcae22ff60af1bed4464ba5ac22e6d1c1596 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 15:41:19 +0100 Subject: [PATCH 45/94] Fix php compatibility --- htdocs/core/lib/memory.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index b3fd7109343..94884ea302d 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0) $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists $rescode = $dolmemcache->getResultCode(); if ($rescode == 0) { - return is_array($data) ? count($data) : 0; + return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0); } else { return -$rescode; } @@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0) //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists if ($result) { - return is_array($data) ? count($data) : 0; + return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0); } else { return -1; } From c41578a3c360560b18f6af20d442306c03135ef8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 15:43:22 +0100 Subject: [PATCH 46/94] Fix php compatibility --- htdocs/categories/index.php | 2 +- htdocs/categories/viewcat.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 708fb3a3e83..c585217dfda 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -186,7 +186,7 @@ foreach ($fulltree as $key => $val) { ? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account" : $categstatic->getObjectsInCateg($type, 1); - $counter = "".(is_countable($elements) ? count($elements) : '0').""; + $counter = "".(is_array($elements) ? count($elements) : '0').""; } $color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index eeca990ef28..a1f63b997e8 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -378,7 +378,7 @@ if ($cats < 0) { ? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account" : $categstatic->getObjectsInCateg($type, 1); - $counter = "".(is_countable($elements) ? count($elements) : '0').""; + $counter = "".(is_array($elements) ? count($elements) : '0').""; } $color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index e8a8eb2843e..85987c8a3cf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -860,7 +860,7 @@ abstract class CommonObject if (!empty($conf->socialnetworks->enabled)) { $outsocialnetwork = ''; - if (!empty($this->socialnetworks) && is_countable($this->socialnetworks) && count($this->socialnetworks) > 0) { + if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) { $socialnetworksdict = getArrayOfSocialNetworks(); foreach ($this->socialnetworks as $key => $value) { if ($value) { From 2ba5f1369fe1e37a434835f055b6e0df4bfec229 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 15:53:55 +0100 Subject: [PATCH 47/94] Fix alternate --- 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 f40c21778f5..0e192ff0212 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2366,7 +2366,7 @@ 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.($objp->fk_default_home == $tmppage->id ? '/' : (($tmpshortlangcode != substr($object->lang, 0, 2)) ? '/'.$tmpshortlangcode : '').'/'.$tmppage->pageurl.'.php')); $url->appendChild($xhtmllink); From 36eb79c14d49469deb17fbc03b7bffc6557a599d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 16:49:13 +0100 Subject: [PATCH 48/94] Fix filter on "Refuse emailing" --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index dc8c77d0e1e..695d4ead3cc 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -76,7 +76,7 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha'); $search_fax = GETPOST("search_fax", 'alpha'); $search_email = GETPOST("search_email", 'alpha'); if (!empty($conf->mailing->enabled)) { - $search_no_email = GETPOST("search_no_email", 'int'); + $search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1; } else { $search_no_email = -1; } From 2d92130c1ebe8331f9f24a80f7af0b480def138f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 19:25:58 +0100 Subject: [PATCH 49/94] External backups can be downloaded from the "About info page". --- ChangeLog | 1 + htdocs/admin/modulehelp.php | 7 ++++ htdocs/admin/tools/export_files.php | 56 +++++++++++++++++++++++------ htdocs/compta/accounting-files.php | 2 +- htdocs/conf/conf.php.example | 6 ++++ htdocs/core/lib/files.lib.php | 25 +++++++++---- 6 files changed, 79 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 059fc0d145c..4ba65941254 100644 --- a/ChangeLog +++ b/ChangeLog @@ -105,6 +105,7 @@ NEW: Use an ajax call for the clicktodial feature instead of href link. NEW: when multiple order linked to facture, show list into note. NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted NEW: Editing a page in website module keep old page with name .back +NEW: External backups can be downloaded from the "About info page". For developers: diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index a3c7c3d5c08..4122e2b56ed 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -326,6 +326,13 @@ if ($mode == 'desc') { $textexternal = ''; if ($objMod->isCoreOrExternalModule() == 'external') { $textexternal .= '
'.$langs->trans("Origin").': '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule); + + global $dolibarr_allow_download_external_modules; + if (!empty($dolibarr_allow_download_external_modules) && preg_match('/\/custom\//', $dirofmodule)) { + // Add a link to download a zip of the module + $textexternal .= ' '.img_picto('', 'download').''; + } + if ($objMod->editor_name != 'dolibarr') { $textexternal .= '
'.$langs->trans("Publisher").': '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name); } diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index ff4b12efc9e..0b9272c2418 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -138,7 +138,23 @@ $dirtocompress = basename($fulldirtocompress); if ($compression == 'zip') { $file .= '.zip'; $excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i'; - $ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles); + + //var_dump($fulldirtocompress); + //var_dump($outputdir."/".$file);exit; + + $rootdirinzip = ''; + if ($export_type == 'externalmodule' && !empty($what)) { + $rootdirinzip = $what; + + global $dolibarr_allow_download_external_modules; + if (empty($dolibarr_allow_download_external_modules)) { + print 'Download of external modules is not allowed by $dolibarr_allow_download_external_modules in conf.php file'; + $db->close(); + exit(); + } + } + + $ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); if ($ret < 0) { if ($ret == -2) { $langs->load("errors"); @@ -183,17 +199,37 @@ if ($compression == 'zip') { unlink($outputdir."/".$file); } } -} - -if ($errormsg) { - setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); } else { - setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.
'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs'); + $errormsg = 'Bad value for compression method'; + print $errormsg; } -$db->close(); +if ($export_type != 'externalmodule' || empty($what)) { + if ($errormsg) { + setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors'); + } else { + setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.
'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs'); + } -// Redirect to calling page -$returnto = 'dolibarr_export.php'; + $db->close(); -header("Location: ".$returnto); + // Redirect to calling page + $returnto = 'dolibarr_export.php'; + + header("Location: ".$returnto); + exit(); +} else { + $zipname = $outputdir."/".$file; + + // Then download the zipped file. + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.basename($zipname)); + header('Content-Length: '.filesize($zipname)); + readfile($zipname); + + dol_delete_file($zipname); + + $db->close(); + + exit(); +} diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 855505a40ec..1f821bf733b 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) { $zip->addFromString('transactions.csv', $log); $zip->close(); - ///Then download the zipped file. + // Then download the zipped file. header('Content-Type: application/zip'); header('Content-disposition: attachment; filename='.basename($zipname)); header('Content-Length: '.filesize($zipname)); diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 71f0a82e32f..7bb58d6b701 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -331,6 +331,12 @@ $dolibarr_cron_allow_cli='0'; // Examples: // $dolibarr_strict_mode=0; +// dolibarr_allow_download_external_modules +// Provide a link to download the zip of an external modules installed into custom directory from the web admin. +// Default value: 0 +// Examples: +// $dolibarr_allow_download_external_modules=0; + //################################# diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 2bd4ada3ad0..7312faf6b5e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -2004,11 +2004,15 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring // Skip directories (they would be added automatically) if (!$file->isDir()) { // Get real and relative path for current file - $filePath = $file->getRealPath(); - $relativePath = substr($filePath, strlen($rootPath) + 1); + $filePath = $file->getPath(); // the full path with filename using the $inputdir root. + $fileName = $file->getFilename(); + $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. + + //$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1); + $relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1); // Add current file to archive - $zip->addFile($filePath, $relativePath); + $zip->addFile($fileFullRealPath, $relativePath); } } @@ -2196,22 +2200,29 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles = } // Create recursive directory iterator + // This does not return symbolic links /** @var SplFileInfo[] $files */ $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($inputdir), RecursiveIteratorIterator::LEAVES_ONLY ); + //var_dump($inputdir); foreach ($files as $name => $file) { // Skip directories (they would be added automatically) if (!$file->isDir()) { // Get real and relative path for current file - $filePath = $file->getRealPath(); - $relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1); + $filePath = $file->getPath(); // the full path with filename using the $inputdir root. + $fileName = $file->getFilename(); + $fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory. - if (empty($excludefiles) || !preg_match($excludefiles, $filePath)) { + //$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1); + $relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1); + + //var_dump($filePath);var_dump($fileFullRealPath);var_dump($relativePath); + if (empty($excludefiles) || !preg_match($excludefiles, $fileFullRealPath)) { // Add current file to archive - $zip->addFile($filePath, $relativePath); + $zip->addFile($fileFullRealPath, $relativePath); } } } From 5473dbd3f055ea10e218d60b3dd3928912172b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 28 Nov 2021 20:55:17 +0100 Subject: [PATCH 50/94] add direct print for contracts --- htdocs/contrat/card.php | 2 ++ htdocs/core/class/html.formfile.class.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 31405545dbb..c52b57e305f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -916,6 +916,8 @@ if (empty($reshook)) { } } + // Actions when printing a doc from card + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc $upload_dir = $conf->contrat->multidir_output[$object->entity]; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7f141d684b7..e30f35758d1 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -442,7 +442,8 @@ class FormFile } $printer = 0; - if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { // The direct print feature is implemented only for such elements + // The direct print feature is implemented only for such elements + if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { $printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled)) ?true:false; } @@ -944,7 +945,7 @@ class FormFile $out .= '">'.img_picto($langs->trans("Delete"), 'delete').''; } if ($printer) { - $out .= ''.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').''; } From 81e74839113e5932e4040242d10936409c98ceb9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 28 Nov 2021 23:51:20 +0100 Subject: [PATCH 51/94] css --- htdocs/compta/bank/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index c543b9edd9b..c2cbc6de76b 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -429,7 +429,7 @@ if ($action == 'create') { print ''.$langs->trans("Web").''; print ''; print img_picto('', 'globe', 'class="pictofixedwidth"'); - print ''; + print ''; print ''; // Tags-Categories From bb38ea79f492a4aa88290f8587f7928ab25d094b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Nov 2021 00:05:42 +0100 Subject: [PATCH 52/94] css --- htdocs/theme/eldy/global.inc.php | 1 + htdocs/theme/md/style.css.php | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 1c8891202a7..37692f46c1e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1681,6 +1681,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select div.statusref { padding-right: 10px; + max-width: 55%; } div.statusref img { padding-right: 3px !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index cbd8b4bb7fb..3118b576e1e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1744,6 +1744,7 @@ select.widthcentpercentminusxx, span.widthcentpercentminusxx:not(.select2-select div.statusref { padding-right: 10px; + max-width: 55%; } div.statusref img { padding-right: 3px !important; From 186185267e7a0ee4c4f2dae7446a1606892bd26e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Nov 2021 00:49:18 +0100 Subject: [PATCH 53/94] Clean code for v15 --- htdocs/accountancy/admin/fiscalyear.php | 1 - htdocs/adherents/cartes/carte.php | 2 +- htdocs/core/class/commonobject.class.php | 2 +- htdocs/core/class/extrafields.class.php | 139 +----------------- .../core/tpl/admin_extrafields_view.tpl.php | 2 +- ...terface_50_modTicket_TicketEmail.class.php | 2 +- .../fourn/class/fournisseur.product.class.php | 2 +- htdocs/hrm/admin/admin_establishment.php | 1 - htdocs/product/fournisseurs.php | 2 +- htdocs/public/ticket/create_ticket.php | 2 +- htdocs/public/ticket/list.php | 2 +- 11 files changed, 14 insertions(+), 143 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 44c5309f531..2eb77815b60 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -127,7 +127,6 @@ if ($result) { $title = $langs->trans('AccountingPeriods'); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1); - // Load attribute_label print '
'; print ''; print ''; diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 271cb09fa81..93054dad234 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -119,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { } //if (!empty($objp->$key)) // $objp->array_options[$tmpkey] = $objp->$key; - //$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey; + //$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey; } } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5dd392ad065..040d3c519d9 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7862,7 +7862,7 @@ abstract class CommonObject switch ($mode) { case "view": - $out .= $extrafields->showOutputField($key, $value); + $out .= $extrafields->showOutputField($key, $value, '', $this->table_element); break; case "create": $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element); diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 057b1d9ace9..e73f83d1340 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -42,12 +42,6 @@ class ExtraFields */ public $db; - /** - * @var array Array with type of element (for what object is the extrafield) - * @deprecated - */ - public $attribute_elementtype; - /** * @var array Array with type of the extra field * @deprecated @@ -60,90 +54,12 @@ class ExtraFields */ public $attribute_label; - /** - * @var array Array with size of extra field - * @deprecated - */ - public $attribute_size; - /** * @var array Array with list of possible values for some types of extra fields * @deprecated */ public $attribute_choice; - /** - * @var array Array to store compute formula for computed fields - * @deprecated - */ - public $attribute_computed; - - /** - * @var array Array to store default value - * @deprecated - */ - public $attribute_default; - - /** - * @var array Array to store if attribute is unique or not - * @deprecated - */ - public $attribute_unique; - - /** - * @var array Array to store if attribute is required or not - * @deprecated - */ - public $attribute_required; - - /** - * @var array Array to store parameters of attribute (used in select type) - * @deprecated - */ - public $attribute_param; - - /** - * @var array Array to store position of attribute - * @deprecated - */ - public $attribute_pos; - - /** - * @var array Array to store if attribute is editable regardless of the document status - * @deprecated - */ - public $attribute_alwayseditable; - - /** - * @var array Array to store permission to check - * @deprecated - */ - public $attribute_perms; - - /** - * @var array Array to store language file to translate label of values - * @deprecated - */ - public $attribute_langfile; - - /** - * @var array Array to store if field is visible by default on list - * @deprecated - */ - public $attribute_list; - - /** - * @var array Array to store if field is summable - * @deprecated - */ - public $attribute_totalizable; - - /** - * @var array Array to store entity id of extrafield - * @deprecated - */ - public $attribute_entityid; - /** * @var array New array to store extrafields definition @@ -203,17 +119,8 @@ class ExtraFields $this->attributes = array(); // For old usage - $this->attribute_elementtype = array(); $this->attribute_type = array(); $this->attribute_label = array(); - $this->attribute_size = array(); - $this->attribute_computed = array(); - $this->attribute_default = array(); - $this->attribute_unique = array(); - $this->attribute_required = array(); - $this->attribute_perms = array(); - $this->attribute_langfile = array(); - $this->attribute_list = array(); } /** @@ -238,7 +145,7 @@ class ExtraFields * @param string $langfile Language file * @param string $enabled Condition to have the field enabled or not * @param int $totalizable Is a measure. Must show a total on lists - * @param int $printable Is extrafield displayed on PDF + * @param int $printable Is extrafield displayed on PDF * @return int <=0 if KO, >0 if OK */ public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0) @@ -873,7 +780,7 @@ class ExtraFields // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ... + * Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ... * * @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. @@ -932,20 +839,6 @@ class ExtraFields // Old usage $this->attribute_type[$tab->name] = $tab->type; $this->attribute_label[$tab->name] = $tab->label; - $this->attribute_size[$tab->name] = $tab->size; - $this->attribute_elementtype[$tab->name] = $tab->elementtype; - $this->attribute_default[$tab->name] = $tab->fielddefault; - $this->attribute_computed[$tab->name] = $tab->fieldcomputed; - $this->attribute_unique[$tab->name] = $tab->fieldunique; - $this->attribute_required[$tab->name] = $tab->fieldrequired; - $this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : ''); - $this->attribute_pos[$tab->name] = $tab->pos; - $this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable; - $this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms); - $this->attribute_langfile[$tab->name] = $tab->langs; - $this->attribute_list[$tab->name] = $tab->list; - $this->attribute_totalizable[$tab->name] = $tab->totalizable; - $this->attribute_entityid[$tab->name] = $tab->entity; // New usage $this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type; @@ -1028,20 +921,10 @@ class ExtraFields $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } else // Old usage - { + } else { + // Old usage $label = $this->attribute_label[$key]; $type = $this->attribute_type[$key]; - $size = $this->attribute_size[$key]; - $elementtype = $this->attribute_elementtype[$key]; // Seems not used - $default = $this->attribute_default[$key]; - $computed = $this->attribute_computed[$key]; - $unique = $this->attribute_unique[$key]; - $required = $this->attribute_required[$key]; - $param = $this->attribute_param[$key]; - $langfile = $this->attribute_langfile[$key]; - $list = $this->attribute_list[$key]; - $totalizable = $this->attribute_totalizable[$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } @@ -1626,20 +1509,10 @@ class ExtraFields $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } else // Old usage - { - //dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING); + } else { + // Old usage $label = $this->attribute_label[$key]; $type = $this->attribute_type[$key]; - $size = $this->attribute_size[$key]; - $default = $this->attribute_default[$key]; - $computed = $this->attribute_computed[$key]; - $unique = $this->attribute_unique[$key]; - $required = $this->attribute_required[$key]; - $param = $this->attribute_param[$key]; - $perms = dol_eval($this->attribute_perms[$key], 1); - $langfile = $this->attribute_langfile[$key]; - $list = dol_eval($this->attribute_list[$key], 1); $help = ''; // Not supported with old syntax $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) } diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 0c1d34efa08..d1145229db7 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -41,7 +41,7 @@ $langs->load("modulebuilder"); print ''.$langs->trans("DefineHereComplementaryAttributes", $textobject).'
'."\n"; print '
'; -// Load attribute_label +// Load $extrafields->attributes $extrafields->fetch_name_optionals_label($elementtype); print '
'; diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 12b688d9b61..cab6779bf8c 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -157,7 +157,7 @@ class InterfaceTicketEmail extends DolibarrTriggers if (is_array($object->array_options) && count($object->array_options) > 0) { foreach ($object->array_options as $key => $value) { $key = substr($key, 8); // remove "options_" - $message_admin .= '
  • '.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value).'
  • '; + $message_admin .= '
  • '.$langs->trans($extraFields->attributes[$object->element]['label'][$key]).' : '.$extraFields->showOutputField($key, $value, '', $object->table_element).'
  • '; } } $message_admin .= ''; diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 5b523d8d7e8..fc3054fdd51 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -635,7 +635,7 @@ class ProductFournisseur extends Product * @param int $limit Limit * @param int $offset Offset * @param int $socid Filter on a third party id - * @return array Array of Products with new properties to define supplier price + * @return array Array of ProductFournisseur with new properties to define supplier price */ public function list_product_fournisseur_price($prodid, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0, $socid = 0) { diff --git a/htdocs/hrm/admin/admin_establishment.php b/htdocs/hrm/admin/admin_establishment.php index dd17a2be4b0..11a34b939a2 100644 --- a/htdocs/hrm/admin/admin_establishment.php +++ b/htdocs/hrm/admin/admin_establishment.php @@ -99,7 +99,6 @@ if ($result) { $num = $db->num_rows($result); $i = 0; - // Load attribute_label print '
    '; print ''; print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "e.ref", "", "", "", $sortfield, $sortorder); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 02e0211c01d..b79fe5fb843 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -1211,7 +1211,7 @@ END; $obj = $db->fetch_object($resql); foreach ($extralabels as $key => $value) { if (!empty($arrayfields['ef.'.$key]['checked']) && !empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - print '"; + print '"; } } } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 00eff71da78..1a11b16d1ea 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -297,7 +297,7 @@ if (empty($reshook) && $action == 'create_ticket' && GETPOST('save', 'alpha')) { if (is_array($object->array_options) && count($object->array_options) > 0) { foreach ($object->array_options as $key => $value) { $key = substr($key, 8); // remove "options_" - $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value).'
  • '; + $message_admin .= '
  • '.$langs->trans($extrafields->attributes[$object->table_element]['label'][$key]).' : '.$extrafields->showOutputField($key, $value, '', $object->table_element).'
  • '; } } $message_admin .= ''; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index db5f5d8d754..4fbfd29106a 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -651,7 +651,7 @@ if ($action == "view_ticketlist") { } print '>'; $tmpkey = 'options_'.$key; - print $extrafields->showOutputField($key, $obj->$tmpkey, '', 1); + print $extrafields->showOutputField($key, $obj->$tmpkey, '', $object->table_element); print ''; } } From e3e4b154e7cddca44ad234642bdef9c2e2459657 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Nov 2021 01:04:32 +0100 Subject: [PATCH 54/94] Fix partnership --- htdocs/core/lib/company.lib.php | 1 + htdocs/langs/en_US/partnership.lang | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 313dd5d8fbe..2b8aad7453c 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -274,6 +274,7 @@ function societe_prepare_head(Societe $object) if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'thirdparty') { if (!empty($user->rights->partnership->read)) { + $langs->load("partnership"); $nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0; $head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id; $head[$h][1] = $langs->trans("Partnership"); diff --git a/htdocs/langs/en_US/partnership.lang b/htdocs/langs/en_US/partnership.lang index 0eb73c17920..f542bfab670 100644 --- a/htdocs/langs/en_US/partnership.lang +++ b/htdocs/langs/en_US/partnership.lang @@ -19,7 +19,7 @@ ModulePartnershipName=Partnership management PartnershipDescription=Module Partnership management PartnershipDescriptionLong= Module Partnership management - +Partnership=Partnership AddPartnership=Add partnership CancelPartnershipForExpiredMembers=Partnership: Cancel partnership of members with expired subscriptions PartnershipCheckBacklink=Partnership: Check referring backlink From 1fa3e9f37d1d971b4b00ed89533f8fa2ccaa4f18 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 29 Nov 2021 01:13:43 +0100 Subject: [PATCH 55/94] Look and feel v15 --- htdocs/compta/bank/various_payment/card.php | 7 +++---- htdocs/compta/bank/various_payment/list.php | 2 +- htdocs/theme/md/style.css.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index d4245594447..bd81a0433eb 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -415,7 +415,7 @@ if ($action == 'create') { if (!empty($conf->banque->enabled)) { print ''; } @@ -490,9 +490,8 @@ if ($action == 'create') { $langs->load("projects"); print ''; } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index dda68a096a1..fec2d025c7a 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -160,7 +160,7 @@ $arrayfields = array( 'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100), 'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110), 'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120), - 'datev' =>array('label'=>"DateValue", 'checked'=>1, 'position'=>130), + 'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130), 'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140), 'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->projet->enabled)), 'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>!empty($conf->banque->enabled)), diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 3118b576e1e..10768184b1b 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -3421,7 +3421,7 @@ tr.liste_titre.box_titre td table td, .bordernooddeven tr td { } table.border td, table.bordernooddeven td, div.border div div.tagtd { - padding: 2px 4px 2px 4px; + padding: 4px 4px 4px 4px; border: 1px solid #f0f0f0; border-collapse: collapse; } From 5bdaab8dcb6f35ee79f7f8e50f53d90f1536900e Mon Sep 17 00:00:00 2001 From: John BOTELLA Date: Mon, 29 Nov 2021 14:30:04 +0100 Subject: [PATCH 56/94] Fix duplicated code --- htdocs/core/class/commonobject.class.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 040d3c519d9..cc74c30c191 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4872,13 +4872,9 @@ abstract class CommonObject $reshook = 0; //if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { if (is_object($hookmanager)) { // Old code is commented on preceding line. - if (empty($line->fk_parent_line)) { - $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines); - $reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - } else { - $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line); - $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - } + $parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines); + if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; } + $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks } if (empty($reshook)) { $this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines); From 819a76e16a8dd33479a906cf674c4cadb1c111b5 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Fri, 27 Aug 2021 15:31:31 +0200 Subject: [PATCH 57/94] remove some deprecated html attributes https://developer.mozilla.org/en-US/docs/web/html/element/td#attr-align --- htdocs/bom/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/commande/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/reception/tpl/linkedobjectblock.tpl.php | 4 ++-- htdocs/theme/md/style.css.php | 4 ++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index c42da9bdb19..2737b425c9c 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -54,7 +54,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; echo ''; - echo ''; - echo ''; + echo ''; echo ''; echo ''; - echo ''; - echo ''; + echo ''; + echo ''; echo ' - - + +
    '.$extrafields->showOutputField($key, $obj->{$key})."'.$extrafields->showOutputField($key, $obj->{$key}, '', 'product_fournisseur_price')."
    '; print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).''; - $form->select_comptes($accountid, "accountid", 0, '', 2); // Affiche liste des comptes courant + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Affiche liste des comptes courant print '
    '.$langs->trans("Project").''; - - $numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1); - + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); + print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1); print '
    '.$objectlink->getNomUrl(1).''; + echo ''; $result = $product_static->fetch($objectlink->fk_product); if ($result < 0) { setEventMessage($product_static->error, 'errors'); @@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $product_static->getNomUrl(1); } print ''.dol_print_date($objectlink->date_creation, 'day').''.dol_print_date($objectlink->date_creation, 'day').''; if ($user->rights->commande->lire) { $total = $total + $objectlink->total_ht; diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index aba881a63c6..2a6140aaeed 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -52,8 +52,8 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } echo ''.$objectlink->getNomUrl(1).''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''.$objectlink->ref_client.''.dol_print_date($objectlink->date, 'day').''; if ($user->rights->commande->lire) { $total = $total + $objectlink->total_ht; diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index bb6777c0639..c8ff1196c0f 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -56,8 +56,8 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> getNomUrl(1); ?>date_delivery, 'day'); ?>date_delivery, 'day'); ?> rights->reception->lire) { $total = $total + $objectlink->total_ht; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 10768184b1b..f8ff67ae8ce 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1444,6 +1444,10 @@ table[summary="list_of_modules"] .fa-cog { min-width: 100px; } +.linkedcol-date { + text-align: center; +} + .img-skinthumb { width: 160px; height: 100px; From 6608f5f0d8f62ce290bf47a53b151c31699089f9 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Mon, 29 Nov 2021 15:09:18 +0100 Subject: [PATCH 58/94] update all script tags to be uniform. `language="javascript"` removed https://developer.mozilla.org/en-US/docs/web/html/element/script#attr-language --- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/admin/productaccount.php | 2 +- htdocs/accountancy/bookkeeping/balance.php | 2 +- htdocs/accountancy/customer/list.php | 2 +- htdocs/accountancy/expensereport/list.php | 2 +- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/supplier/list.php | 2 +- htdocs/adherents/admin/website.php | 2 +- .../canvas/actions_adherentcard_common.class.php | 2 +- htdocs/adherents/card.php | 4 ++-- htdocs/adherents/subscription.php | 2 +- htdocs/admin/accountant.php | 2 +- htdocs/admin/company.php | 2 +- htdocs/admin/fckeditor.php | 2 +- htdocs/admin/mails.php | 2 +- htdocs/admin/mails_emailing.php | 2 +- htdocs/admin/mails_ticket.php | 2 +- htdocs/admin/menus/edit.php | 2 +- htdocs/admin/proxy.php | 2 +- htdocs/admin/system/perf.php | 2 +- htdocs/barcode/codeinit.php | 2 +- htdocs/barcode/printsheet.php | 2 +- htdocs/comm/action/card.php | 4 ++-- htdocs/comm/action/pertype.php | 2 +- htdocs/comm/action/peruser.php | 2 +- htdocs/comm/mailing/card.php | 2 +- htdocs/compta/bank/card.php | 4 ++-- htdocs/compta/bank/various_payment/card.php | 2 +- htdocs/compta/facture/card.php | 10 +++++----- htdocs/compta/paiement.php | 2 +- htdocs/compta/paiement/cheque/card.php | 2 +- htdocs/compta/paiement_charge.php | 2 +- htdocs/compta/paiement_vat.php | 2 +- htdocs/compta/tva/card.php | 2 +- .../canvas/actions_contactcard_common.class.php | 2 +- htdocs/contact/card.php | 8 ++++---- htdocs/core/ajax/ajaxdirtree.php | 2 +- htdocs/core/boxes/box_graph_invoices_permonth.php | 2 +- .../boxes/box_graph_invoices_supplier_permonth.php | 2 +- htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 2 +- htdocs/core/boxes/box_graph_orders_permonth.php | 2 +- .../core/boxes/box_graph_orders_supplier_permonth.php | 2 +- htdocs/core/boxes/box_graph_product_distribution.php | 2 +- htdocs/core/boxes/box_graph_propales_permonth.php | 2 +- htdocs/core/boxes/box_task.php | 2 +- htdocs/core/class/doleditor.class.php | 4 ++-- htdocs/core/class/html.form.class.php | 2 +- htdocs/core/class/html.formbarcode.class.php | 2 +- htdocs/core/class/html.formmail.class.php | 4 ++-- htdocs/core/class/html.formother.class.php | 2 +- htdocs/core/class/html.formsms.class.php | 2 +- htdocs/core/class/html.formticket.class.php | 6 +++--- htdocs/core/class/openid.class.php | 2 +- htdocs/core/customreports.php | 2 +- htdocs/core/lib/admin.lib.php | 2 +- htdocs/core/lib/functions.lib.php | 4 ++-- htdocs/core/lib/treeview.lib.php | 2 +- htdocs/core/photos_resize.php | 2 +- htdocs/cron/card.php | 2 +- htdocs/don/payment/payment.php | 2 +- htdocs/expedition/card.php | 2 +- htdocs/expensereport/card.php | 4 ++-- htdocs/expensereport/payment/payment.php | 2 +- htdocs/fourn/facture/card.php | 6 +++--- htdocs/fourn/facture/paiement.php | 4 ++-- htdocs/imports/import.php | 2 +- htdocs/includes/nusoap/lib/class.wsdl.php | 2 +- htdocs/includes/nusoap/lib/nusoap.php | 2 +- htdocs/install/upgrade2.php | 2 +- htdocs/loan/schedule.php | 2 +- htdocs/modulebuilder/template/myobject_card.php | 2 +- htdocs/modulebuilder/template/myobject_list.php | 2 +- htdocs/paybox/lib/paybox.lib.php | 2 +- htdocs/product/inventory/inventory.php | 4 ++-- htdocs/product/stock/product.php | 2 +- htdocs/product/stock/tpl/stockcorrection.tpl.php | 2 +- htdocs/projet/card.php | 4 ++-- htdocs/public/payment/newpayment.php | 2 +- htdocs/public/test/test_arrays.php | 2 +- htdocs/reception/card.php | 2 +- htdocs/salaries/card.php | 2 +- htdocs/salaries/paiement_salary.php | 2 +- htdocs/societe/canvas/actions_card_common.class.php | 4 ++-- .../canvas/company/actions_card_company.class.php | 2 +- htdocs/societe/card.php | 6 +++--- htdocs/takepos/index.php | 2 +- htdocs/takepos/invoice.php | 4 ++-- htdocs/takepos/phone.php | 2 +- htdocs/ticket/index.php | 2 +- htdocs/user/hierarchy.php | 2 +- htdocs/user/param_ihm.php | 2 +- htdocs/website/index.php | 8 ++++---- htdocs/workstation/workstation_card.php | 2 +- 93 files changed, 121 insertions(+), 121 deletions(-) diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 9e393beeacd..8cef3a05cf4 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -142,7 +142,7 @@ $linkback = ''; print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy'); -print "\n".''; // This ajax service is called only when a directory $selecteddir is opened but not when closed. - //print ''; } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 65498ab6362..8179e134bcf 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -227,7 +227,7 @@ class box_graph_invoices_permonth extends ModeleBoxes if (!$mesg) { $stringtoshow = ''; - $stringtoshow .= ''; } else { // Default Header Redirect diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index b7f01de0aeb..1cede60f892 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -351,7 +351,7 @@ print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '' if (empty($conf->use_javascript_ajax)) { print ''; } else { - print ' -'; + $sectionwithinvoicelink .= ''; } } @@ -905,7 +905,7 @@ if ($action == "valid" || $action == "history" || $action == 'creditnote') { $form = new Form($db); ?> -