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 ''; - print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), ''); + print $form->textwithpicto($langs->trans("MAIN_PDF_ADD_TERMSOFSALE_PROPAL"), $langs->trans("PdfAddTermOfSaleHelp")); print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_PDF_ADD_TERMSOFSALE_PROPAL'); @@ -259,7 +259,7 @@ print ''; print ''; print ''; print ''; 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 ''; diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 553bebec44177..ec492d679363d 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -621,7 +621,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);
'.$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 .= '
  • '; + $out .= '
  • '; //$timelineicon = getTimelineIcon($actionstatic, $histo, $key); $typeicon = $actionstatic->getTypePicto('pictofixedwidth timeline-icon-not-applicble', $labeltype); @@ -14696,9 +14696,9 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null, } $libelle = ''; - if (preg_match('/^TICKET_MSG/', $actionstatic->code)) { + if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage'); - } elseif (preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { + } elseif (!empty($actionstatic->code) && preg_match('/^TICKET_MSG_PRIVATE/', $actionstatic->code)) { $out .= $langs->trans('TicketNewMessage').' ('.$langs->trans('Private').')'; } elseif (isset($histo[$key]['type'])) { if ($histo[$key]['type'] == 'action') { diff --git a/htdocs/core/lib/member.lib.php b/htdocs/core/lib/member.lib.php index ce5294d3ff93a..3826c28e7e3f2 100644 --- a/htdocs/core/lib/member.lib.php +++ b/htdocs/core/lib/member.lib.php @@ -43,7 +43,7 @@ function member_prepare_head(Adherent $object) $head[$h][2] = 'general'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_MEMBER_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_MEMBER_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); @@ -193,7 +193,7 @@ function member_type_prepare_head(AdherentType $object) $h++; } - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_MEMBER_TYPE_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 3ef1aec799793..eff2df330a2c7 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -348,6 +348,8 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $type = 'double'; // html modulebuilder type is a text type in database } elseif (in_array($type, array('link', 'sellist', 'duration'))) { $type = 'integer'; + } elseif ($type == 'chkbxlst') { + $type = 'varchar(128)'; } elseif ($type == 'mail') { $type = 'varchar(128)'; } elseif (strpos($type, 'stars(') === 0) { diff --git a/htdocs/core/lib/propal.lib.php b/htdocs/core/lib/propal.lib.php index 153d8e7029259..40d98c78ec8c3 100644 --- a/htdocs/core/lib/propal.lib.php +++ b/htdocs/core/lib/propal.lib.php @@ -43,7 +43,7 @@ function propal_prepare_head($object) $head[$h][2] = 'comm'; $h++; - if ((empty($conf->commande->enabled) && ((isModEnabled("shipping") && getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) + if ((!isModEnabled('order') && ((isModEnabled("shipping") && getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) || (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'lire'))))) { $langs->load("sendings"); $text = ''; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index ba1064ec249f7..1604ee7cc7006 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -53,7 +53,7 @@ function user_prepare_head(User $object) $head[$h][2] = 'user'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/ldap.php?id='.$object->id; @@ -254,7 +254,7 @@ function group_prepare_head($object) $head[$h][2] = 'group'; $h++; - if ((!empty($conf->ldap->enabled) && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) + if ((isModEnabled('ldap') && getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) && (!getDolGlobalString('MAIN_DISABLE_LDAP_TAB') || !empty($user->admin))) { $langs->load("ldap"); $head[$h][0] = DOL_URL_ROOT.'/user/group/ldap.php?id='.$object->id; diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index b96ad5f8bdd9c..c44bb31b429d5 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -597,9 +597,10 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri * It outputs content of file sanitized from html and body part. * * @param string $containerref Path to file to include (must be a page from website root. Example: 'mypage.php' means 'mywebsite/mypage.php') + * @param int $once If set to 1, we use include_once. * @return void */ -function includeContainer($containerref) +function includeContainer($containerref, $once = 0) { global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running included containers. global $includehtmlcontentopened; @@ -630,7 +631,11 @@ function includeContainer($containerref) //print preg_replace(array('/^.*]*>/ims','/<\/body>.*$/ims'), array('', ''), $content);*/ ob_start(); - $res = @include $fullpathfile; // Include because we want to execute code content + if ($once) { + $res = @include_once $fullpathfile; + } else { + $res = @include $fullpathfile; + } $tmpoutput = ob_get_contents(); ob_end_clean(); diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 0e190d1a31ed8..8864a4dc0bf3c 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -167,7 +167,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) // Note: Test on date validity is done later natively with isNotIntoValidityDateRange() by core after calling checkLoginPassEntity() that call this method // ldap2dolibarr synchronisation - if ($login && !empty($conf->ldap->enabled) && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization + if ($login && isModEnabled('ldap') && getDolGlobalInt('LDAP_SYNCHRO_ACTIVE') == Ldap::SYNCHRO_LDAP_TO_DOLIBARR) { // ldap2dolibarr synchronization dol_syslog("functions_ldap::check_user_password_ldap Sync ldap2dolibarr"); // On charge les attributes du user ldap diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 53cbce641f2bd..d0c2e8a41b1fa 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -575,7 +575,8 @@ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentitiesnoconv("Signature"), 0, 'L', 1); $pdf->SetXY($posx, $tab_top + $tab_hl); - $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + //$pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + $pdf->RoundedRect($posx, $tab_top + $tab_hl + 3, $largcol, $tab_hl * 3, $this->corner_radius, '1234', 'D'); return ($tab_hl * 7); } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index c63dd61e9f54c..62d50a2989bef 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -114,7 +114,7 @@ public function __construct($db) ); - if (!isset($conf->asset) || !isset($conf->asset->enabled)) { + if (!isModEnabled('asset')) { $conf->asset = new stdClass(); $conf->asset->enabled = 0; } diff --git a/htdocs/core/modules/modCollab.class.php b/htdocs/core/modules/modCollab.class.php index 69599413fcc64..a1cc97699c0a2 100644 --- a/htdocs/core/modules/modCollab.class.php +++ b/htdocs/core/modules/modCollab.class.php @@ -118,7 +118,7 @@ public function __construct($db) 'url' => '/collab/index.php', 'langs' => 'collab', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory. 'position' => 100, - 'enabled' => '$conf->collab->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. + 'enabled' => 'isModEnabled("collab")', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected. 'perms' => '1', // Use 'perms'=>'$user->hasRight("mymodule","level1","level2")' if you want your menu with a permission rules 'target' => '', 'user' => 2 // 0=Menu for internal users, 1=external users, 2=both diff --git a/htdocs/core/modules/modDataPolicy.class.php b/htdocs/core/modules/modDataPolicy.class.php index 82e88f067922a..d147af6d037f1 100644 --- a/htdocs/core/modules/modDataPolicy.class.php +++ b/htdocs/core/modules/modDataPolicy.class.php @@ -129,7 +129,7 @@ public function __construct($db) 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' ) */ - if (!isset($conf->datapolicy) || !isset($conf->datapolicy->enabled)) { + if (!isModEnabled('datapolicy')) { $conf->datapolicy = new stdClass(); $conf->datapolicy->enabled = 0; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 40f4951487c45..ca8522c6d9919 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -1849,7 +1849,8 @@ protected function _signature_area(&$pdf, $object, $posy, $outputlangs) $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); $pdf->SetXY($posx, $tab_top + $tab_hl + 3); - $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + //$pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + $pdf->RoundedRect($posx, $tab_top + $tab_hl + 3, $largcol, $tab_hl * 3, $this->corner_radius, '1234', 'D'); if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { // Can be retrieve with getSignatureAppearanceArray() // Can be also detected by putting the mouse over the area when using evince pdf reader diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 158a63f7e12cc..3e363c3be54f2 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1919,7 +1919,9 @@ protected function drawSignatureArea(&$pdf, $object, $posy, $outputlangs) $pdf->MultiCell($largcol, $tab_hl, $outputlangs->transnoentities("ProposalCustomerSignature"), 0, 'L', 1); $pdf->SetXY($posx, $tab_top + $tab_hl + 3); - $pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + //$pdf->MultiCell($largcol, $tab_hl * 3, '', 1, 'R'); + $pdf->RoundedRect($posx, $tab_top + $tab_hl + 3, $largcol, $tab_hl * 3, $this->corner_radius, '1234', 'D'); + if (getDolGlobalString('MAIN_PDF_PROPAL_USE_ELECTRONIC_SIGNING')) { // Can be retrieve with getSignatureAppearanceArray() diff --git a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php index 6b22ec7c1dae9..0efb00838b0d3 100644 --- a/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php +++ b/htdocs/core/modules/security/captcha/modCaptchaStandard.class.php @@ -53,7 +53,7 @@ class modCaptchaStandard extends ModeleCaptcha */ public function __construct($db, $conf, $langs, $user) { - $this->id = strtolower(preg_replace('/^modCaptcha/i', '', get_class())); + $this->id = strtolower(preg_replace('/^modCaptcha/i', '', get_class($this))); $this->db = $db; $this->conf = $conf; diff --git a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php index 1ae1e322ea044..2d16d54ed99aa 100644 --- a/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php +++ b/htdocs/core/triggers/interface_95_modWebhook_WebhookTriggers.class.php @@ -76,6 +76,9 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf $errors = 0; $static_object = new Target($this->db); $target_url = $static_object->fetchAll(); + if (!is_array($target_url)) { + return 0; + } foreach ($target_url as $key => $tmpobject) { $actionarray = explode(",", $tmpobject->trigger_codes); if ($tmpobject->status == Target::STATUS_VALIDATED && is_array($actionarray) && in_array($action, $actionarray)) { diff --git a/htdocs/eventorganization/conferenceorbooth_card.php b/htdocs/eventorganization/conferenceorbooth_card.php index e010dd13c5106..6df364470880e 100644 --- a/htdocs/eventorganization/conferenceorbooth_card.php +++ b/htdocs/eventorganization/conferenceorbooth_card.php @@ -228,7 +228,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', '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); diff --git a/htdocs/eventorganization/conferenceorbooth_contact.php b/htdocs/eventorganization/conferenceorbooth_contact.php index 2bbab85b0c247..a393c813f6f26 100644 --- a/htdocs/eventorganization/conferenceorbooth_contact.php +++ b/htdocs/eventorganization/conferenceorbooth_contact.php @@ -204,7 +204,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', '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); diff --git a/htdocs/eventorganization/conferenceorbooth_document.php b/htdocs/eventorganization/conferenceorbooth_document.php index dc67d1be0fa35..da723512b4f47 100644 --- a/htdocs/eventorganization/conferenceorbooth_document.php +++ b/htdocs/eventorganization/conferenceorbooth_document.php @@ -178,7 +178,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', '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); diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 9924283caa6c5..d03ffe9ed1bea 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -342,7 +342,7 @@ // Define a complementary filter for search of next/prev ref. if (!$user->hasRight('project', 'all', 'lire')) { $objectsListId = $project->getProjectsAuthorizedForUser($user, 0, 0); - $project->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; + $project->next_prev_filter = "rowid:IN:(".$db->sanitize(count($objectsListId) ? implode(',', array_keys($objectsListId)) : '0').")"; } dol_banner_tab($project, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/eventorganization/conferenceorboothattendee_card.php b/htdocs/eventorganization/conferenceorboothattendee_card.php index 9fdbda08ce00f..b754f6c25d099 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_card.php +++ b/htdocs/eventorganization/conferenceorboothattendee_card.php @@ -254,7 +254,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); diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index c16c8314765af..e4678534f1dac 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -441,7 +441,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); diff --git a/htdocs/expedition/class/expeditionlinebatch.class.php b/htdocs/expedition/class/expeditionlinebatch.class.php index 7bce8575ff886..10be8fb91a130 100644 --- a/htdocs/expedition/class/expeditionlinebatch.class.php +++ b/htdocs/expedition/class/expeditionlinebatch.class.php @@ -160,7 +160,7 @@ public function create($id_line_expdet, $f_user = null, $notrigger = 0) $sql .= $id_line_expdet; $sql .= ", ".(!isset($this->sellby) || dol_strlen($this->sellby) == 0 ? 'NULL' : ("'".$this->db->idate($this->sellby))."'"); $sql .= ", ".(!isset($this->eatby) || dol_strlen($this->eatby) == 0 ? 'NULL' : ("'".$this->db->idate($this->eatby))."'"); - $sql .= ", ".(!empty($this->batch) ? 'NULL' : ("'".$this->db->escape($this->batch)."'")); + $sql .= ", ".($this->batch == '' ? 'NULL' : ("'".$this->db->escape($this->batch)."'")); $sql .= ", ".(!isset($this->qty) ? ((!isset($this->dluo_qty)) ? 'NULL' : $this->dluo_qty) : $this->qty); // dluo_qty deprecated, use qty $sql .= ", ".((int) $this->fk_origin_stock); $sql .= ", ".(empty($this->fk_warehouse) ? 'NULL' : $this->fk_warehouse); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 5c45360b47593..b074e7dbb2d1d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -907,7 +907,7 @@ $res = $soc->fetch($socid); } - if (GETPOSTINT('origin') && GETPOSTINT('originid')) { + if (GETPOST('origin') && GETPOSTINT('originid')) { // Parse element/subelement (ex: project_task) $regs = array(); $element = $subelement = GETPOST('origin', 'alphanohtml'); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index fc741b9950917..238d6185f1593 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2593,3 +2593,4 @@ Decrypt=Decrypt FilesIntegrityDesc=If you want to check the integrity of files instead of database, you can do it by using this tool. AttributeCodeHelp=A code of your choice (without special char and space) to identify the property.
    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/societe/price.php b/htdocs/societe/price.php index 60a3a5dc9717e..5ae56bdd3d59a 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -762,9 +762,11 @@ print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n"; } } - foreach ($extralabels as $key => $val) { - if (!empty($arrayfields['ef.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['ef.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n"; + if (!empty($extralabels) && is_array($extralabels)) { + foreach ($extralabels as $key => $val) { + if (!empty($arrayfields['ef.'.$key]['checked'])) { + print getTitleFieldOfList($arrayfields['ef.'.$key]['label'], 0, $_SERVER['PHP_SELF'], $key, '', $param, '', $sortfield, $sortorder)."\n"; + } } } print '