From 1e64a9c067f2806dbda9186301528471b576fdd0 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Mon, 18 Sep 2023 22:36:32 +0200 Subject: [PATCH 01/16] Fix #25860 not allow encrypt data if key and instance_unique_id are empty --- htdocs/core/lib/security.lib.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index b1853b4e123..b242360730f 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -144,6 +144,10 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = $newchain = $chain; if (function_exists('openssl_encrypt') && empty($dolibarr_disable_dolcrypt_for_debug)) { + if (empty($key)) { + return 'Error dolEncrypt encrypt key is empty'; + } + $ivlen = 16; if (function_exists('openssl_cipher_iv_length')) { $ivlen = openssl_cipher_iv_length($ciphering); From 42c457a6a5462f30bbb0de5f0a3ec52e781f1944 Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Wed, 20 Sep 2023 11:36:43 +0200 Subject: [PATCH 02/16] Return uncrypted chain if key is empty --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index b242360730f..64a275651f2 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -145,7 +145,7 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = if (function_exists('openssl_encrypt') && empty($dolibarr_disable_dolcrypt_for_debug)) { if (empty($key)) { - return 'Error dolEncrypt encrypt key is empty'; + return $chain; } $ivlen = 16; From c40bb198caee0ea349035e4766ec8de635b8030f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:16:07 +0200 Subject: [PATCH 03/16] Add log info to help debug trouble with object changing entity --- .../core/triggers/interface_50_modAgenda_ActionsAuto.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 5290b2eb085..8235be12fb3 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -965,6 +965,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $tmp = explode('_', $action); $object->actionmsg = $langs->transnoentities($tmp[count($tmp) - 1]."InDolibarr", (empty($object->newref) ? $object->ref : $object->newref)); } + if (isModEnabled('multicompany') && property_exists($object, 'entity') && $object->entity > 1) { + $object->actionmsg .= ' ('.$langs->trans("Entity").' '.$object->entity.')'; + } } if (!isset($object->sendtoid) || !is_array($object->sendtoid)) { From 09c7fc8e284ce447b80362c9e47e6bbde6875071 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:34:30 +0200 Subject: [PATCH 04/16] Fix css --- htdocs/hrm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index a661758dfad..615c0f2c120 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -260,7 +260,7 @@ if (isModEnabled('holiday') && $user->hasRight('holiday', 'read')) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; print ''; From e6a539ae0d0b9c4e1c2d1a9b5b94a43d79f6eb54 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:35:44 +0200 Subject: [PATCH 05/16] CSS --- htdocs/hrm/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/hrm/index.php b/htdocs/hrm/index.php index 615c0f2c120..c4bc55bd067 100644 --- a/htdocs/hrm/index.php +++ b/htdocs/hrm/index.php @@ -332,7 +332,7 @@ if (isModEnabled('expensereport') && $user->hasRight('expensereport', 'read')) { $i++; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ''; print ''; From a758eaa0863e402d8857bd3843c8031f2367097d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:43:16 +0200 Subject: [PATCH 06/16] FIX Expense report is created on the wrong entity --- htdocs/admin/agenda_other.php | 4 ++-- htdocs/holiday/card.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 18797312ad8..0b172c4e36e 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -356,7 +356,7 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").''."\n"; print ' '."\n"; print ''."\n"; - $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); + $formactions->select_type_actions(getDolGlobalString('AGENDA_USE_EVENT_TYPE_DEFAULT'), "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print ''."\n"; } @@ -386,7 +386,7 @@ if (!empty($conf->global->MAIN_ENABLE_MULTISELECT_TYPE)) { // We use an option here because it adds bugs when used on agenda page "peruser" and "list" $multiselect = (!empty($conf->global->AGENDA_USE_EVENT_TYPE)); } -$formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1, $multiselect); +$formactions->select_type_actions(getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE'), "AGENDA_DEFAULT_FILTER_TYPE", '', (getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? -1 : 1), 1, $multiselect); print ''."\n"; // AGENDA_DEFAULT_FILTER_STATUS diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 71f8e620286..2f101b1bdf6 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -279,6 +279,7 @@ if (empty($reshook)) { $object->date_debut = $date_debut; $object->date_fin = $date_fin; $object->halfday = $halfday; + $object->entity = $conf->entity; $result = $object->create($user); if ($result <= 0) { From 9cad02760188b8f7395a70815e070eadb00d5faf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 22 Sep 2023 13:50:52 +0200 Subject: [PATCH 07/16] Fix look and feel v18 --- htdocs/compta/index.php | 8 ++++---- htdocs/core/lib/invoice.lib.php | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index ddc48e264c4..a340d7ef7c3 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -270,7 +270,7 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); @@ -397,7 +397,7 @@ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) { $colspan++; } - print ''.$langs->trans("NoInvoice").''; + print ''.$langs->trans("NoInvoice").''; } print '
'; } else { @@ -488,7 +488,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) { print "\n"; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print '
'; } else { @@ -578,7 +578,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) { print ' '; print ''; } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print "
"; $db->free($resql); diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index 9414e692fa2..c9cd52bce73 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -580,7 +580,7 @@ function getCustomerInvoiceDraftTable($maxCount = 500, $socid = 0) $result .= ''.price($tot_ttc).''; $result .= ''; } else { - $result .= ''.$langs->trans("NoInvoice").''; + $result .= ''.$langs->trans("NoInvoice").''; } $result .= ""; $db->free($resql); @@ -712,7 +712,7 @@ function getDraftSupplierTable($maxCount = 500, $socid = 0) $result .= ''.price($tot_ttc).''; $result .= ''; } else { - $result .= ''.$langs->trans("NoInvoice").''; + $result .= ''.$langs->trans("NoInvoice").''; } $result .= ""; $db->free($resql); From 1100d8b418d340995ebf5d6efd86005b1b934bc6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 23 Sep 2023 08:42:08 +0200 Subject: [PATCH 08/16] FIX missing entity filter to customize by entity --- htdocs/core/modules/modTicket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index a165a4acd2e..e5c72e747d5 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,10 +147,10 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f' + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), From 5fccbcb9ae5f019daaa93292048d5f532c77402a Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 23 Sep 2023 10:05:36 +0200 Subject: [PATCH 09/16] FIX add field "entity" only in $tabfieldinsert --- htdocs/admin/dict.php | 12 ++++++------ htdocs/core/modules/modTicket.class.php | 10 +++++----- htdocs/ticket/class/ticket.class.php | 6 ++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index c08deb66074..99ad67187bf 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -304,8 +304,8 @@ $tabfield[8] = "code,libelle,country_id,country".(!empty($conf->global->SOCIETE_ $tabfield[9] = "code,label,unicode"; $tabfield[10] = "country_id,country,code,taux,localtax1_type,localtax1,localtax2_type,localtax2,recuperableonly,accountancy_code_sell,accountancy_code_buy,note"; $tabfield[11] = "element,source,code,libelle,position"; -$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder,entity"; -$tabfield[13] = "code,libelle,type,entity"; +$tabfield[12] = "code,libelle,libelle_facture,deposit_percent,nbjour,type_cdr,decalage,sortorder"; +$tabfield[13] = "code,libelle,type"; $tabfield[14] = "code,label,price,organization,country"; $tabfield[15] = "code,libelle,width,height,unit"; $tabfield[16] = "code,libelle,sortorder"; @@ -330,7 +330,7 @@ $tabfield[34] = "code,label"; $tabfield[35] = "label"; $tabfield[36] = "range_ik,fk_c_exp_tax_cat"; $tabfield[37] = "code,label,short_label,unit_type,scale,sortorder"; -$tabfield[38] = "code,label,url,icon,entity"; +$tabfield[38] = "code,label,url,icon"; $tabfield[39] = "code,libelle,sortorder"; $tabfield[40] = "code,libelle,picto"; $tabfield[41] = "code,label"; @@ -385,7 +385,7 @@ $tabfieldvalue[42] = "code,label"; $tabfieldvalue[43] = "code,label"; $tabfieldvalue[44] = "code,label"; -// Field names in the table for inserting a record +// Field names in the table for inserting a record (add field "entity" only here when dictionary is ready to personalized by entity) $tabfieldinsert = array(); $tabfieldinsert[1] = "code,libelle,fk_pays"; $tabfieldinsert[2] = "code_departement,nom,fk_region"; @@ -411,7 +411,7 @@ $tabfieldinsert[21] = "code,label,qty,type_duration,position"; $tabfieldinsert[22] = "code,label"; $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note"; $tabfieldinsert[24] = "code,label"; -$tabfieldinsert[25] = "code,label"; +$tabfieldinsert[25] = "code,label,entity"; //$tabfieldinsert[26]= "code,label,short_label"; $tabfieldinsert[27] = "code,libelle,picto"; $tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country,block_if_negative,sortorder"; @@ -882,7 +882,7 @@ if (empty($reshook)) { } $i = 0; foreach ($listfieldinsert as $f => $value) { - $keycode = $listfieldvalue[$i]; + $keycode = (isset($listfieldvalue[$i]) ? $listfieldvalue[$i] : ''); if (empty($keycode)) { $keycode = $value; } diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index e5c72e747d5..acbf5bedee6 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,15 +147,15 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), 'tabfieldvalue' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), - 'tabfieldinsert' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), + 'tabfieldinsert' => array("code,label,pos,use_default,entity", "code,label,pos,use_default,entity", "code,label,pos,use_default,public,fk_parent,entity", "code,label,pos,use_default,entity"), 'tabrowid' => array("rowid", "rowid", "rowid", "rowid"), 'tabcond' => array(isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket"), isModEnabled("ticket") && getDolGlobalString('TICKET_ENABLE_RESOLUTION')), 'tabhelp' => array( diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 3dc4d8a3088..7fc8ebd3fed 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1242,7 +1242,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity = ".getEntity('c_ticket_type'); + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::load_cache_type_tickets", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1334,7 +1335,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE active > 0"; + $sql .= " WHERE entity = ".getEntity('c_ticket_severity'); + $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::loadCacheSeveritiesTickets", LOG_DEBUG); $resql = $this->db->query($sql); From 5e8c793b544d7d7c6e5c7fb29a8a7cf79e750907 Mon Sep 17 00:00:00 2001 From: priojk Date: Sat, 23 Sep 2023 13:34:30 +0200 Subject: [PATCH 10/16] Fix #26008 - translation reference keys for ProductRef --- htdocs/product/card.php | 4 ++-- htdocs/product/list.php | 2 +- htdocs/product/stock/replenish.php | 2 +- htdocs/product/stock/stockatdate.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index e0bc8b3b4e4..08d86258150 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -490,7 +490,7 @@ if (empty($reshook)) { } if (empty($ref)) { if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Ref')), null, 'errors'); + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors'); $action = "create"; $error++; } @@ -1363,7 +1363,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { if (!empty($modCodeProduct->code_auto)) { $tmpcode = $modCodeProduct->getNextValue($object, $type); } - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("ProductRef").''; if ($refalreadyexists) { print $langs->trans("RefAlreadyExists"); } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index ffded66d8e8..67d71fc5633 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -218,7 +218,7 @@ $alias_product_perentity = empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) ? // Definition of array of fields for columns $arrayfields = array( 'p.rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id', 'css'=>'left'), - 'p.ref'=>array('label'=>"Ref", 'checked'=>1, 'position'=>10), + 'p.ref'=>array('label'=>'ProductRef', 'checked'=>1, 'position'=>10), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), 'thumbnail'=>array('label'=>'Photo', 'checked'=>0, 'position'=>10), 'p.label'=>array('label'=>"Label", 'checked'=>1, 'position'=>10), diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 9447187e16c..275e08373e2 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -773,7 +773,7 @@ print ''; // Lines of title print ''; print_liste_field_titre('', $_SERVER["PHP_SELF"], ''); -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if (isModEnabled("service") && $type == 1) { print_liste_field_titre('Duration', $_SERVER["PHP_SELF"], 'p.duration', $param, '', '', $sortfield, $sortorder, 'center '); diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php index 0e16bf8d68b..12574b150c0 100644 --- a/htdocs/product/stock/stockatdate.php +++ b/htdocs/product/stock/stockatdate.php @@ -487,7 +487,7 @@ if (!empty($search_fk_warehouse)) { // Lines of title print ''; -print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); +print_liste_field_titre('ProductRef', $_SERVER["PHP_SELF"], 'p.ref', $param, '', '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', $param, '', '', $sortfield, $sortorder); if ($mode == 'future') { From 34b6d05bad5f9f6d3bc60cd6f5cc47f1f93a8234 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Sat, 23 Sep 2023 15:57:23 +0200 Subject: [PATCH 11/16] =?UTF-8?q?Fix=20G=C3=A9n=C3=A9rer=20intervention=20?= =?UTF-8?q?#26000.=20date=20and=20datehour=20already=20converted=20by=20se?= =?UTF-8?q?tVarsFromFetchObj?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/projet/class/task.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 51b4d3e68e1..100d334ba86 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1598,8 +1598,8 @@ class Task extends CommonObjectLine if ($timespent->id > 0) { $this->timespent_id = $timespent->id; $this->id = $timespent->fk_element; - $this->timespent_date = $this->db->jdate($timespent->element_date); - $this->timespent_datehour = $this->db->jdate($timespent->element_datehour); + $this->timespent_date = $timespent->element_date; + $this->timespent_datehour = $timespent->element_datehour; $this->timespent_withhour = $timespent->element_date_withhour; $this->timespent_duration = $timespent->element_duration; $this->timespent_fk_user = $timespent->fk_user; From 7a0a15dd17d33f60415b1d0f07a0a1e7d587ecef Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Sep 2023 01:00:25 +0200 Subject: [PATCH 12/16] FIX Look and feel v18 --- htdocs/accountancy/admin/account.php | 103 +++++--- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/categories.php | 8 +- htdocs/accountancy/admin/categories_list.php | 245 +++++++++++------- .../core/class/html.formaccounting.class.php | 10 +- 5 files changed, 243 insertions(+), 125 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 9db51eb136c..9c15535d0c8 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -90,8 +90,8 @@ $arrayfields = array( 'aa.pcg_type'=>array('label'=>"Pcgtype", 'checked'=>1, 'help'=>'PcgtypeDesc'), 'categories'=>array('label'=>"AccountingCategories", 'checked'=>-1, 'help'=>'AccountingCategoriesDesc'), 'aa.reconcilable'=>array('label'=>"Reconcilable", 'checked'=>1), - 'aa.active'=>array('label'=>"Activated", 'checked'=>1), - 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1) + 'aa.import_key'=>array('label'=>"ImportId", 'checked'=>-1), + 'aa.active'=>array('label'=>"Activated", 'checked'=>1) ); if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -413,7 +413,7 @@ if ($resql) { print '
'; $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + $selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); $moreforfilter = ''; @@ -428,6 +428,13 @@ if ($resql) { // Line for search fields print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } if (!empty($arrayfields['aa.account_number']['checked'])) { print ''; } @@ -462,12 +469,19 @@ if ($resql) { if (!empty($arrayfields['aa.active']['checked'])) { print ' '; } - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print ''; + } print ''; print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + } if (!empty($arrayfields['aa.account_number']['checked'])) { print_liste_field_titre($arrayfields['aa.account_number']['label'], $_SERVER["PHP_SELF"], "aa.account_number", "", $param, '', $sortfield, $sortorder); } @@ -497,7 +511,10 @@ if ($resql) { if (!empty($arrayfields['aa.active']['checked'])) { print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); + } print "\n"; $i = 0; @@ -510,6 +527,32 @@ if ($resql) { print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + } + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Account number if (!empty($arrayfields['aa.account_number']['checked'])) { print ""; @@ -522,7 +565,7 @@ if ($resql) { // Account label if (!empty($arrayfields['aa.label']['checked'])) { - print ""; + print ''; print dol_escape_htmltag($obj->label); print "\n"; if (!$i) { @@ -635,28 +678,30 @@ if ($resql) { } } - // Action - print ''; - if ($user->hasRight('accounting', 'chartofaccount')) { - print ''; - print img_edit(); - print ''; - print ' '; - print ''; - print img_delete(); - print ''; - print ' '; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->hasRight('accounting', 'chartofaccount')) { + print ''; + print img_edit(); + print ''; + print ' '; + print ''; + print img_delete(); + print ''; + print ' '; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; } - print ''; } - } - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 26287a5bbb8..7f2bf439c09 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -381,7 +381,7 @@ if ($action == 'create') { print '
'; print '
'; - print ''; + print '
'; // Label print ''; diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 7b660419daf..4ef7fe78726 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -131,8 +131,12 @@ print '
'.$langs->trans("Label").'
'; // Select the category print ''; print ''; print '
'.$langs->trans("AccountingCategory").''; -print $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); -print ''; +$s = $formaccounting->select_accounting_category($cat_id, 'account_category', 1, 0, 0, 0); +if ($formaccounting->nbaccounts_category <= 0) { + print ''.$s.''; +} else { + print ''; +} print '
'; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 7b7148f89ce..59d9f219ee4 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -58,9 +58,10 @@ $listlimit = GETPOST('listlimit', 'int') > 0 ?GETPOST('listlimit', 'int') : 1000 $sortfield = GETPOST("sortfield", 'aZ09comma'); $sortorder = GETPOST("sortorder", 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $listlimit * $page; $pageprev = $page - 1; $pagenext = $page + 1; @@ -450,7 +451,7 @@ if (empty($sortfield)) { $sql .= $db->order($sortfield, $sortorder); $sql .= $db->plimit($listlimit + 1, $offset); -//print $sql; + $fieldlist = explode(',', $tabfield[$id]); @@ -468,7 +469,9 @@ if ($sortfield) { if (GETPOST('from', 'alpha')) { $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); } - +if ($listlimit) { + $paramwithsearch .= '&listlimit='.urlencode(GETPOST('listlimit', 'int')); +} print '
'; print ''; print ''; @@ -476,7 +479,7 @@ print ''; -print '
'; +print '
'; print ''; // Form to add a new line @@ -485,6 +488,10 @@ if ($tabname[$id]) { // Line for title print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees @@ -524,6 +531,7 @@ if ($tabname[$id]) { } if ($fieldlist[$field] == 'range_account') { $valuetoshow = $langs->trans("Comment"); + $class = 'width75'; } if ($fieldlist[$field] == 'category_type') { $valuetoshow = $langs->trans("Calculated"); @@ -546,13 +554,20 @@ if ($tabname[$id]) { print ''; print ''; print ''; - print ''; - print ''; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } print ''; // Line to enter new values print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $obj = new stdClass(); // If data was already input, we define them in obj to populate input fields. if (GETPOST('actionadd', 'alpha')) { @@ -572,19 +587,29 @@ if ($tabname[$id]) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'add'); } - print ''; + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ""; $colspan = count($fieldlist) + 3; if ($id == 32) { $colspan++; } - - print ''; // Keep   to have a line with enough height } +print '
'; + print ''; print ''; print '
 
'; +print '
'; + +print '
'; +print ''; + // List of available record in database dol_syslog("htdocs/accountancy/admin/categories_list.php", LOG_DEBUG); @@ -595,13 +620,37 @@ if ($resql) { // There is several pages if ($num > $listlimit) { - print ''; } + $filterfound = 0; + foreach ($fieldlist as $field => $value) { + $showfield = 1; // By defaut + if ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { + $showfield = 0; + } + if ($showfield) { + if ($value == 'country') { + $filterfound++; + } + } + } + // Title line with search boxes print ''; + + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + $filterfound = 0; foreach ($fieldlist as $field => $value) { $showfield = 1; // By defaut @@ -623,17 +672,23 @@ if ($resql) { } print ''; print ''; - print ''; - print ''; } - print ''; print ''; // Title of lines print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } foreach ($fieldlist as $field => $value) { // Determines the name of the field in relation to the possible names // in data dictionaries @@ -707,16 +762,22 @@ if ($resql) { print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "", $sortfield, $sortorder, $class.' '); } } + print getTitleFieldOfList($langs->trans("ListOfAccounts"), 0, $_SERVER["PHP_SELF"], "", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, ''); print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, '', $sortfield, $sortorder, 'center '); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); - print getTitleFieldOfList(''); + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(''); + } print ''; + if ($num) { + $imaxinloop = ($listlimit ? min($num, $listlimit) : $num); + // Lines with values - while ($i < $num) { + while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); + //print_r($obj); print ''; if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { @@ -725,12 +786,16 @@ if ($resql) { $reshook = $hookmanager->executeHooks('editDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + // Show fields if (empty($reshook)) { fieldListAccountingCategories($fieldlist, $obj, $tabname[$id], 'edit'); } - print ''; print ''; print ''; - print ''; + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } } else { + // Can an entry be erased or disabled ? + $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default + if (isset($obj->code)) { + if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { + $iserasable = 0; $canbedisabled = 0; + } + } + $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); + if ($param) { + $url .= '&'.$param; + } + $url .= '&'; + + $canbemodified = $iserasable; + $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $error = $hookmanager->error; $errors = $hookmanager->errors; + // Actions + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + if (empty($reshook)) { foreach ($fieldlist as $field => $value) { $showfield = 1; - $class = "left"; + $title = ''; + $class = 'tddict'; + $tmpvar = $fieldlist[$field]; $valuetoshow = $obj->$tmpvar; if ($value == 'category_type') { @@ -764,43 +863,35 @@ if ($resql) { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } - } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_country') { - $key = $langs->trans("Country".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Country".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_availability') { - $langs->loadLangs(array("propal")); - $key = $langs->trans("AvailabilityType".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "AvailabilityType".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } elseif ($fieldlist[$field] == 'libelle' && $tabname[$id] == MAIN_DB_PREFIX.'c_actioncomm') { - $key = $langs->trans("Action".strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != "Action".strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); + } elseif (in_array($fieldlist[$field], array('label', 'range_account', 'formula'))) { + $class = "tdoverflowmax250"; + $title = $valuetoshow; } elseif ($fieldlist[$field] == 'region_id' || $fieldlist[$field] == 'country_id') { $showfield = 0; } - $class = 'tddict'; // Show value for field if ($showfield) { - print ''; + print ''; } } } - // Can an entry be erased or disabled ? - $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default - if (isset($obj->code)) { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i', $obj->code))) { - $iserasable = 0; $canbedisabled = 0; - } - } + // Link to setup the group + print ''; // Active print '"; - // Modify link - if ($canbemodified) { - print ''; - } else { - print ''; - } - - // Delete link - if ($iserasable) { + // Actions + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; - } else { - print ''; } - - // Link to setup the group - print ''; } print "\n"; $i++; } } else { - $colspan = 11; + $colspan = 10; print ''; } } else { @@ -920,20 +987,14 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co print ''; } else { print ''; } } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 9c72c98721c..b1917f42ee8 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -48,6 +48,10 @@ class FormAccounting extends Form * @var int Nb of accounts found */ public $nbaccounts; + /** + * @var int Nb of accounts category found + */ + public $nbaccounts_category; /** @@ -235,7 +239,7 @@ class FormAccounting extends Form public function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) { // phpcs:enable - global $db, $langs, $mysoc; + global $langs, $mysoc; if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) { dol_print_error('', 'Call to select_accounting_account with mysoc country not yet defined'); @@ -263,11 +267,15 @@ class FormAccounting extends Form $sql .= " ORDER BY c.label ASC"; } + $this->nbaccounts_category = 0; + dol_syslog(get_class($this).'::'.__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); if ($num) { + $this->nbaccounts_category = $num; + $out = '\n"; $totalbuyingprice = 0; @@ -643,14 +644,14 @@ while ($i < ($limit ? min($num, $limit) : $num)) { $totalcurrentstock += $currentstock; } - // Action - print ''; - // Fields from hook $parameters = array('objp'=>$objp); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + // Action + print ''; + print ''."\n"; } $i++; From 1ce5963f833e4cee75fc21c28d53e909282a2690 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 25 Sep 2023 17:44:33 +0200 Subject: [PATCH 14/16] FIX Bad choice of filter on product/service --- htdocs/product/list.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 67d71fc5633..7191a15b607 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -847,16 +847,15 @@ if ($type === "") { if ($type === "") { $params['forcenohideoftext'] = 1; } -if ($type === "") { - $newcardbutton .= dolGetButtonTitle($langs->trans('NewProduct'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); - $type = Product::TYPE_SERVICE; -} - $label = 'NewProduct'; -if ($type == Product::TYPE_SERVICE) { - $label = 'NewService'; -} - $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type='.$type, '', $perm, $params); +if ($type === "" || $type == Product::TYPE_PRODUCT) { + $label = 'NewProduct'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params); +} +if ($type === "" || $type == Product::TYPE_SERVICE) { + $label = 'NewService'; + $newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params); +} print ''; if ($optioncss != '') { From e1217a891155bde0a8beae205f15402755ee42ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 26 Sep 2023 21:11:23 +0200 Subject: [PATCH 15/16] Fix phpcs --- htdocs/core/lib/security.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 64a275651f2..b0b5bbfc3cf 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -144,9 +144,9 @@ function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = $newchain = $chain; if (function_exists('openssl_encrypt') && empty($dolibarr_disable_dolcrypt_for_debug)) { - if (empty($key)) { - return $chain; - } + if (empty($key)) { + return $chain; + } $ivlen = 16; if (function_exists('openssl_cipher_iv_length')) { From be9adbec417121a43bd38b299ff33cbdfff03288 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 27 Sep 2023 00:05:36 +0200 Subject: [PATCH 16/16] FIX uniformize getEntity sql request --- htdocs/admin/dict.php | 8 ++++---- htdocs/core/modules/modTicket.class.php | 8 ++++---- htdocs/societe/class/societe.class.php | 2 +- htdocs/ticket/class/ticket.class.php | 7 ++++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 99ad67187bf..9d265d0240d 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -210,8 +210,8 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country as $tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c"; $tabsql[10] = "SELECT t.rowid, t.code, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays = c.rowid"; $tabsql[11] = "SELECT t.rowid as rowid, t.element, t.source, t.code, t.libelle, t.position, t.active FROM ".MAIN_DB_PREFIX."c_type_contact AS t"; -$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity = ".getEntity($tabname[12]); -$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity = ".getEntity($tabname[13]); +$tabsql[12] = "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.deposit_percent, c.nbjour, c.type_cdr, c.decalage, c.active, c.sortorder, c.entity FROM ".MAIN_DB_PREFIX."c_payment_term AS c WHERE c.entity IN (".getEntity($tabname[12]).")"; +$tabsql[13] = "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_paiement AS c WHERE c.entity IN (".getEntity($tabname[13]).")"; $tabsql[14] = "SELECT e.rowid as rowid, e.code as code, e.label, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1"; $tabsql[15] = "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format"; $tabsql[16] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectlevel"; @@ -223,7 +223,7 @@ $tabsql[21] = "SELECT c.rowid as rowid, c.code, c.label, c.type_duration, c.qty, $tabsql[22] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason"; $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid"; $tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource"; -$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity = ".getEntity($tabname[25]); +$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity($tabname[25]).")"; //$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units"; $tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm"; $tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.block_if_negative, h.sortorder, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid"; @@ -236,7 +236,7 @@ $tabsql[34] = "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PR $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c"; $tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r"; $tabsql[37] = "SELECT r.rowid, r.code, r.sortorder, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r"; -$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity = ".getEntity($tabname[38]); +$tabsql[38] = "SELECT s.rowid, s.entity, s.code, s.label, s.url, s.icon, s.active FROM ".MAIN_DB_PREFIX."c_socialnetworks as s WHERE s.entity IN (".getEntity($tabname[38]).")"; $tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel"; $tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact"; $tabsql[41] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_transport_mode"; diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index acbf5bedee6..f0380fb6410 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -147,10 +147,10 @@ class modTicket extends DolibarrModules "TicketDictResolution" ), 'tabsql' => array( - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity = '.getEntity('c_ticket_type'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity = '.getEntity('c_ticket_severity'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity = '.getEntity('c_ticket_category'), - 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity = '.getEntity('c_ticket_resolution') + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_type as f WHERE f.entity IN ('.getEntity('c_ticket_type').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f WHERE f.entity IN ('.getEntity('c_ticket_severity').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.public, f.fk_parent, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_category as f WHERE f.entity IN ('.getEntity('c_ticket_category').')', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default, f.entity FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f WHERE f.entity IN ('.getEntity('c_ticket_resolution').')' ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("code,label,pos,use_default", "code,label,pos,use_default", "code,label,pos,use_default,public,fk_parent", "code,label,pos,use_default"), diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9457788899c..cfd23c5e791 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -5284,7 +5284,7 @@ class Societe extends CommonObject if ($code) { $sql .= " AND tc.code = '".$this->db->escape($code)."'"; } - $sql .= " AND sc.entity = ".getEntity($this->element); + $sql .= " AND sc.entity IN (".getEntity($this->element).")"; $sql .= " AND tc.source = 'external'"; $sql .= " AND tc.active=1"; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 7fc8ebd3fed..4e6e4b5b63d 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1242,7 +1242,7 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE entity = ".getEntity('c_ticket_type'); + $sql .= " WHERE entity IN (".getEntity('c_ticket_type').")"; $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::load_cache_type_tickets", LOG_DEBUG); @@ -1283,7 +1283,8 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description, public, active, force_severity, fk_parent"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; - $sql .= " WHERE active > 0 AND entity = ".((int) $conf->entity); + $sql .= " WHERE entity IN (".getEntity('c_ticket_category').")"; + $sql .= " WHERE active > 0"; if ($publicgroup > -1) { $sql .= " AND public = ".((int) $publicgroup); } @@ -1335,7 +1336,7 @@ class Ticket extends CommonObject $sql = "SELECT rowid, code, label, use_default, pos, description"; $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE entity = ".getEntity('c_ticket_severity'); + $sql .= " WHERE entity IN (".getEntity('c_ticket_severity').")"; $sql .= " AND active > 0"; $sql .= " ORDER BY pos"; dol_syslog(get_class($this)."::loadCacheSeveritiesTickets", LOG_DEBUG);
'; + print '
'; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print '
'; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print ''; - if ($filterfound) { - $searchpicto = $form->showFilterAndCheckAddButtons(0); - print $searchpicto; + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($filterfound) { + $searchpicto = $form->showFilterAndCheckAddButtons(0); + print $searchpicto; + } + print '
'; print '
'; @@ -739,18 +804,52 @@ if ($resql) { print ''; print ''; print '
'; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } + } + print ''.dol_escape_htmltag($valuetoshow).''.dol_escape_htmltag($valuetoshow).''; + if (empty($obj->formula)) { + // Count number of accounts into group + $nbofaccountintogroup = 0; + $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid); + $nbofaccountintogroup = count($listofaccountintogroup); - $canbemodified = $iserasable; - - $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : ''); - if ($param) { - $url .= '&'.$param; + print ''; + print $langs->trans("NAccounts", $nbofaccountintogroup); + print ''; + } else { + print ''.$langs->trans("Formula").''; } - $url .= '&'; + print ''; @@ -811,49 +902,25 @@ if ($resql) { } print "'.img_edit().' '; - if ($user->admin) { - print ''.img_delete().''; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + if ($user->admin) { + print ''.img_delete().''; + } } - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ' '; - if (empty($obj->formula)) { - print ''; - print $langs->trans("ListOfAccounts"); - print ''; - - // Count number of accounts into group - $nbofaccountintogroup = 0; - $listofaccountintogroup = $accountingcategory->getCptsCat($obj->rowid); - $nbofaccountintogroup = count($listofaccountintogroup); - //if ($nbofaccountintogroup > 0) { - print ' ('.$langs->trans("NAccounts", $nbofaccountintogroup).')'; - //} else { - // print ' (0)'; - //} - } - print '
'.$langs->trans("None").'
'; - $size = ''; $class = ''; - if ($fieldlist[$field] == 'code') { + $class = ''; + if (in_array($fieldlist[$field], array('code', 'range_account', 'label', 'formula'))) { $class = 'maxwidth100'; } if ($fieldlist[$field] == 'position') { $class = 'maxwidth50'; } - if ($fieldlist[$field] == 'libelle') { - $class = 'quatrevingtpercent'; - } - if ($fieldlist[$field] == 'sortorder' || $fieldlist[$field] == 'category_type') { - $size = 'size="2" '; - } - print ''; + print ''; print '