diff --git a/build/phpstan/phpstan-baseline.neon b/build/phpstan/phpstan-baseline.neon index e519fa251145e..7a97e63e9eec1 100644 --- a/build/phpstan/phpstan-baseline.neon +++ b/build/phpstan/phpstan-baseline.neon @@ -11106,12 +11106,6 @@ parameters: count: 4 path: ../../htdocs/core/class/ctyperesource.class.php - - - message: '#^Property CUnits\:\:\$scale \(string\) in isset\(\) is not nullable\.$#' - identifier: isset.property - count: 4 - path: ../../htdocs/core/class/cunits.class.php - - message: '#^Property CUnits\:\:\$short_label \(string\) in isset\(\) is not nullable\.$#' identifier: isset.property @@ -22308,12 +22302,6 @@ parameters: count: 1 path: ../../htdocs/fourn/commande/card.php - - - message: '#^Variable \$text might not be defined\.$#' - identifier: variable.undefined - count: 2 - path: ../../htdocs/fourn/commande/card.php - - message: '#^If condition is always false\.$#' identifier: if.alwaysFalse @@ -27252,12 +27240,6 @@ parameters: count: 1 path: ../../htdocs/partnership/partnership_card.php - - - message: '#^Variable \$upload_dir might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/partnership/partnership_document.php - - message: '#^Negated boolean expression is always true\.$#' identifier: booleanNot.alwaysTrue @@ -30432,18 +30414,6 @@ parameters: count: 1 path: ../../htdocs/projet/tasks/comment.php - - - message: '#^Variable \$mode might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/projet/tasks/comment.php - - - - message: '#^Variable \$socid might not be defined\.$#' - identifier: variable.undefined - count: 1 - path: ../../htdocs/projet/tasks/comment.php - - message: '#^Call to function method_exists\(\) with Project and ''fetchComments'' will always evaluate to true\.$#' identifier: function.alreadyNarrowedType diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 26fb38c05629e..e7b26e6a3d2c6 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -689,6 +689,12 @@ public function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $ throw new RestException(403); } + $member = new Adherent($this->db); + $result = $member->fetch($id); + if (0 === $result) { + throw new RestException(404, 'Member not found'); + } + $categories = new Categorie($this->db); $result = $categories->getListForItem($id, 'member', $sortfield, $sortorder, $limit, $page); diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index 21596154a0ecc..39e97b2ee70f6 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -227,7 +227,7 @@ */ print '
'.$langs->trans("Parameters").' | '.$langs->trans("Value").' | |
'; - print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), ''); + print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_ORDER"), $langs->trans("PdfAddTermOfSaleHelp")); print ' | '; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_ORDER'); @@ -373,7 +373,7 @@ print ' | |
'.$langs->trans("Parameters").' | '.$langs->trans("Value").' | |
'; - print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), ''); + print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_INVOICE"), $langs->trans("PdfAddTermOfSaleHelp")); print ' | ';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_INVOICE');
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index f0d3e729791aa..7ac727d576aa9 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1103,7 +1103,7 @@ public function getListForItem($id, $type = 'customer', $sortfield = "s.rowid",
return -1;
}
if (!count($categories)) {
- return 0;
+ return [];
}
return $categories;
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index d715c88626e96..fb94299c405c7 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1938,7 +1938,7 @@ public function getTypeLabel($mode = 0)
if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) {
$labeltype = 'AC_OTH';
}
- if (preg_match('/^TICKET_MSG/', $this->code)) {
+ if (!empty($this->code) && preg_match('/^TICKET_MSG/', $this->code)) {
$labeltype = $langs->trans("Message");
} else {
if (!empty($arraylist[$labeltype])) {
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index ce3c6f96804cf..c42b5b22c93a6 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -402,8 +402,8 @@ class Propal extends CommonObject
'fk_delivery_address' => array('type' => 'integer', 'label' => 'DeliveryAddress', 'enabled' => 1, 'visible' => 0, 'position' => 200), // deprecated
'fk_input_reason' => array('type' => 'integer', 'label' => 'InputReason', 'enabled' => 1, 'visible' => -1, 'position' => 205),
'extraparams' => array('type' => 'varchar(255)', 'label' => 'Extraparams', 'enabled' => 1, 'visible' => -1, 'position' => 215),
- 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 220),
- 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => '$conf->incoterm->enabled', 'visible' => -1, 'position' => 225),
+ 'fk_incoterms' => array('type' => 'integer', 'label' => 'IncotermCode', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 220),
+ 'location_incoterms' => array('type' => 'varchar(255)', 'label' => 'IncotermLabel', 'enabled' => 'isModEnabled("incoterm")', 'visible' => -1, 'position' => 225),
'fk_multicurrency' => array('type' => 'integer', 'label' => 'MulticurrencyID', 'enabled' => 1, 'visible' => -1, 'position' => 230),
'multicurrency_code' => array('type' => 'varchar(255)', 'label' => 'MulticurrencyCurrency', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 235),
'multicurrency_tx' => array('type' => 'double(24,8)', 'label' => 'MulticurrencyRate', 'enabled' => 'isModEnabled("multicurrency")', 'visible' => -1, 'position' => 240, 'isameasure' => 1),
diff --git a/htdocs/core/bookmarks_page.php b/htdocs/core/bookmarks_page.php
index e59b2ef2edb7c..e3fcdbc854594 100644
--- a/htdocs/core/bookmarks_page.php
+++ b/htdocs/core/bookmarks_page.php
@@ -97,7 +97,7 @@
$searchForm = '';
-if (empty($conf->bookmark->enabled)) {
+if (!isModEnabled('bookmark')) {
$langs->load("admin");
$bookmarkList .= ' '.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).''; $bookmarkList .= ' '; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index c574c2be541b5..0443099f9dd31 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -1565,6 +1565,14 @@ public function getExtrafieldContent($object, $extrafieldKey, $outputlangs = nul $extrafieldOutputContent = dol_string_nohtmltag($extrafieldOutputContent); } + // Display stars extrafield as simple string + if ($extrafields->attributes[$object->table_element]['type'][$extrafieldKey] == 'stars') { + $extrafieldOutputContent = ''; + for ($i = 0; $i < $object->array_options[$extrafieldOptionsKey]; $i++) { + $extrafieldOutputContent .= ' *'; + } + } + $parameters = array( 'object' => $object, 'extrafields' => $extrafields, diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 49a2f02f0040e..ca71e0df442d9 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -782,6 +782,9 @@ public function GetCeilMaxValue() { // phpcs:enable $max = $this->GetMaxValueInData(); + if (!isset($max)) { + $max = 0; + } if ($max != 0) { $max++; } @@ -792,9 +795,7 @@ public function GetCeilMaxValue() } $res = 0; - if (is_numeric($max)) { - $res = ceil($max / $factor) * $factor; - } + $res = ceil($max / $factor) * $factor; //print "max=".$max." res=".$res; return (int) $res; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d0e6cbe8d9d90..a5aae13bf7606 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -507,7 +507,7 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $printer = 0; // 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 = ($user->hasRight('printing', 'read') && !empty($conf->printing->enabled)); + $printer = ($user->hasRight('printing', 'read') && isModEnabled('printing')); } $hookmanager->initHooks(array('formfile')); diff --git a/htdocs/core/class/infobox.class.php b/htdocs/core/class/infobox.class.php index e7579678d18a5..cfec6d48773c0 100644 --- a/htdocs/core/class/infobox.class.php +++ b/htdocs/core/class/infobox.class.php @@ -231,7 +231,7 @@ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - dol_syslog(get_class()."::saveboxorder zone=".$zone." userid=".$userid); + dol_syslog(self::class."::saveboxorder zone=".$zone." userid=".$userid); if (!$userid || $userid == 0) { return 0; @@ -258,7 +258,7 @@ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) $sql .= " AND fk_user = ".((int) $userid); $sql .= " AND position = ".((int) $zone); - dol_syslog(get_class()."::saveboxorder", LOG_DEBUG); + dol_syslog(self::class."::saveboxorder", LOG_DEBUG); $result = $dbs->query($sql); if ($result) { $colonnes = explode('-', $boxorder); @@ -266,7 +266,7 @@ public static function saveboxorder($dbs, $zone, $boxorder, $userid = 0) $part = explode(':', $collist); $colonne = $part[0]; $list = $part[1]; - dol_syslog(get_class()."::saveboxorder column=".$colonne.' list='.$list); + dol_syslog(self::class."::saveboxorder column=".$colonne.' list='.$list); $i = 0; $listarray = explode(',', $list); diff --git a/htdocs/core/lib/contact.lib.php b/htdocs/core/lib/contact.lib.php index 747a5600735a2..24bb66763a50d 100644 --- a/htdocs/core/lib/contact.lib.php +++ b/htdocs/core/lib/contact.lib.php @@ -43,7 +43,7 @@ function contact_prepare_head(Contact $object) $head[$tab][2] = 'card'; $tab++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_CONTACT_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_CONTACT_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 5b42cbf54d91f..d2609495d490c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11323,7 +11323,7 @@ function printCommonFooter($zone = 'private') } let tmpvalueisempty = false; - if (tmpvalue === null || tmpvalue === undefined || tmpvalue === '') { + if (tmpvalue === null || tmpvalue === undefined || tmpvalue === '' || tmpvalue === -1) { tmpvalueisempty = true; } if (tmpvalue === '0' && tmptypefield == 'select') { @@ -14605,7 +14605,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, $out .= ''."\n"; - $out .= ' Note that if an object B is created from an existing object A that has a different type (for example creation of an invoice from an order), the value of the complementary attributes of A are also copied into the complementary attributes of B when the code of the attribute is the same. ThereIsMoreThanXAnswers=There is more than %s answers with your filter. Please add more filters... +PdfAddTermOfSaleHelp=Upload the condition of sales from file input at the bottom of this setup page \ No newline at end of file diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index f425aeb31813f..12e84a13214ff 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -80,9 +80,7 @@ // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->partnership->multidir_output[$object->entity ? $object->entity : $conf->entity]."/partnership/".get_exdir(0, 0, 0, 1, $object); -} +$upload_dir = $conf->partnership->multidir_output[$object->entity ?: $conf->entity]."/partnership/".get_exdir(0, 0, 0, 1, $object); $permissiontoread = $user->hasRight('partnership', 'read'); $permissiontoadd = $user->hasRight('partnership', 'write'); // Used by the include of actions_addupdatedelete.inc.php diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 03d81e8a42166..4ed003ed06f01 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -131,7 +131,7 @@ public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) $this->name = "product"; $this->definition = "Product canvas (default)"; $this->fieldListName = "product_default"; - $this->next_prev_filter = "canvas='product'"; + $this->next_prev_filter = "canvas:=:'product'"; } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index a0e41be87fbf4..1baf3537cc9cc 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -157,7 +157,7 @@ public function __construct($db, $dirmodule, $targetmodule, $canvas, $card) $this->name = "service"; $this->definition = "Services canvas"; $this->fieldListName = "product_service"; - $this->next_prev_filter = "canvas='service'"; + $this->next_prev_filter = "canvas:=:'service'"; } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 8176e2296628f..bc8a42046a27f 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -576,6 +576,7 @@ public function selectMeasuringUnits($name = 'measuring_units', $measuring_style $langs->load("other"); $return = ''; + $placeholderID = ($mode == 2 ? '99999999' : '-1'); // we don't want ajaxcombobox replace clearing option in mode 2 // TODO Use a cache require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; @@ -631,7 +632,7 @@ public function selectMeasuringUnits($name = 'measuring_units', $measuring_style $return .= ''; } - $return .= ajax_combobox($name); + $return .= ajax_combobox($name, [], 0, 0, 'resolve', $placeholderID); return $return; } diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index fdaa3dbad029b..dad98f949c6b3 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -255,7 +255,7 @@ } $sql .= " WHERE t.entity IN (".getEntity('stock').")"; foreach ($search as $key => $val) { - if (array_key_exists($key, $object->fields)) { + if (array_key_exists($key, $object->fields)||$key == 'status') { $class_key = $key; if ($class_key == 'status') { $class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php index 0b8d0b608d997..a5d73bab604da 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_agenda.php @@ -64,6 +64,7 @@ $limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); +$socid = GETPOSTINT('socid'); $page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page"); if (empty($page) || $page == -1) { $page = 0; @@ -89,7 +90,7 @@ // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'. Include fetch and fetch_thirdparty but not fetch_optionals if ($id > 0 || !empty($ref)) { - $upload_dir = $conf->stocktransfer->multidir_output[$object->entity]."/".$object->id; + $upload_dir = (!empty($conf->stocktransfer->multidir_output[$object->entity]) ? $conf->stocktransfer->multidir_output[$object->entity] : $conf->stocktransfer->dir_output)."/".$object->id; } $permissiontoread = $user->hasRight('stocktransfer', 'stocktransfer', 'read'); diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index a8f7d3991c4d5..5e17dbc626e27 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -69,6 +69,8 @@ $label = GETPOST('label', 'alpha'); $batch = GETPOST('batch', 'alpha'); $code_inv = GETPOST('inventorycode', 'alphanohtml'); +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); // Initialize a technical objects $object = new StockTransfer($db); diff --git a/htdocs/projet/agenda.php b/htdocs/projet/agenda.php index 65ffdfbdbf2e3..3aa654d4a65e9 100644 --- a/htdocs/projet/agenda.php +++ b/htdocs/projet/agenda.php @@ -157,7 +157,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 7456cc829e3a6..74f93c4505e66 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1365,7 +1365,7 @@ function set_usage_event() { // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index bcef52668b1aa..e02404f9838ab 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -128,7 +128,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index ac7bdaa51aca6..ce89643f8478a 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -380,7 +380,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index ad2afcc902a8d..83c5416ceea1d 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -161,7 +161,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 61c051de453d4..96d5b569677d3 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -267,7 +267,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "te.rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "te.rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 26d05849d1582..12c99a354dc56 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -139,7 +139,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 1b451ba2d4a3a..065985317fa4e 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -157,7 +157,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index ae9965e8b5ac2..e80fb0ff9a6eb 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -126,7 +126,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 627ea71977e8b..632aa18b6a442 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -616,7 +616,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $object->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 70bcc16d045ce..4359afad90fd9 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -56,6 +56,7 @@ $withproject = GETPOSTINT('withproject'); $project_ref = GETPOST('project_ref', 'alpha'); $planned_workload = ((GETPOSTINT('planned_workloadhour') != '' || GETPOSTINT('planned_workloadmin') != '') ? (GETPOSTINT('planned_workloadhour') > 0 ? GETPOSTINT('planned_workloadhour') * 3600 : 0) + (GETPOSTINT('planned_workloadmin') > 0 ? GETPOSTINT('planned_workloadmin') * 60 : 0) : ''); +$mode = GETPOST('mode', 'alpha'); // Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context $hookmanager->initHooks(array('projecttaskcommentcard', 'globalcard')); @@ -70,6 +71,8 @@ // include comment actions include DOL_DOCUMENT_ROOT.'/core/actions_comments.inc.php'; +// Security check +$socid = 0; // Retrieve First Task ID of Project if withprojet is on to allow project prev next to work if (!empty($project_ref) && !empty($withproject)) { if ($projectstatic->fetch(0, $project_ref) > 0) { @@ -87,9 +90,6 @@ $object->fetch($id, $ref); } -// Security check -$socid = 0; - restrictedArea($user, 'projet', $object->fk_project, 'projet&project'); @@ -155,7 +155,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -308,9 +308,9 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 3bc79705f8f9f..495d4bb57122d 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -212,7 +212,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -335,7 +335,7 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 4f04c2674cc69..c4cf270b6a732 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -169,7 +169,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -293,7 +293,7 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; } else { $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index f3704b749eab0..77861e2f681f4 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -159,7 +159,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -277,9 +277,9 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = " fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = " fk_projet:IN:(".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = " fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = " fk_projet:=:".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 29ddbe2b73149..68ff3707182a5 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -316,7 +316,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $projectstatic->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -597,9 +597,9 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet IN (".$db->sanitize($projectsListId).")"; + $object->next_prev_filter = "fk_projet:IN:(".$db->sanitize($projectsListId).")"; } else { - $object->next_prev_filter = "fk_projet = ".((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet:=:".((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index a982145f4021d..523f93e97e496 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -959,7 +959,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('projet', 'all', 'lire')) { $objectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 0); - $projectstatic->next_prev_filter = "rowid IN (" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0') . ")"; + $projectstatic->next_prev_filter = "rowid:IN:(" . $db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0') . ")"; } dol_banner_tab($projectstatic, 'project_ref', $linkback, 1, 'ref', 'ref', $morehtmlref, $param); @@ -1143,9 +1143,9 @@ if (!GETPOST('withproject') || empty($projectstatic->id)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); - $object->next_prev_filter = "fk_projet IN (" . $db->sanitize($projectsListId) . ")"; + $object->next_prev_filter = "fk_projet:IN:(" . $db->sanitize($projectsListId) . ")"; } else { - $object->next_prev_filter = "fk_projet = " . ((int) $projectstatic->id); + $object->next_prev_filter = "fk_projet:=:" . ((int) $projectstatic->id); } $morehtmlref = ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index df1f86eb272fd..04ab04f8332ad 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -399,7 +399,7 @@ //var_dump(GETPOST("productl".$i, 'int').' '.GETPOST('entl'.$i, 'int').' '.GETPOST($idl, 'int').' '.GETPOST($qty, 'int').' '.GETPOST($batch, 'alpha')); //if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS')) || (GETPOST($qty, 'int') < 0 && getDolGlobalString('RECEPTION_ALLOW_NEGATIVE_QTY'))) { - if (GETPOSTINT($qty) > 0 || (GETPOSTINT($qty) == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { + if (GETPOSTFLOAT($qty) > 0 || (GETPOSTFLOAT($qty) == 0 && getDolGlobalString('RECEPTION_GETS_ALL_ORDER_PRODUCTS'))) { $ent = "entl".$i; $idl = "idl".$i; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 090392efd7058..45e47ab21b267 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -34,7 +34,7 @@ class Client extends Societe /** * @var string Used to add a filter in Form::showrefnav method */ - public $next_prev_filter = "te.client in (1,2,3)"; + public $next_prev_filter = "te.client:in:(1,2,3)"; /** * @var array ';
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index e1a0a71f840ce..0aba526fa84c7 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -1310,7 +1310,7 @@ public function fetch($rowid, $ref = '')
$this->cond_reglement = $obj->cond_reglement;
$this->cond_reglement_doc = $obj->cond_reglement_libelle_doc;
- $this->extraparams = (array) json_decode($obj->extraparams, true);
+ $this->extraparams = (array) (!empty($obj->extraparams) ? json_decode($obj->extraparams, true) : array());
$this->user_author_id = $obj->fk_user_author;
$this->user_validation_id = $obj->fk_user_valid;
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 2f44c8fb5df92..54c65999286ad 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -855,7 +855,7 @@
// Define a complementary filter for search of next/prev ref.
if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
- $projectstat->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")";
+ $projectstat->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")";
}
print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', '');
print ' | |