diff --git a/ChangeLog b/ChangeLog index ce8c34636f6..62ccda4bbb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -280,6 +280,7 @@ Following changes may create regressions for some external modules, but were nec * You must use "$objectoffield" to manipulate the current object inside the formulare of computed custom extrafields instead of $obj/$object. * Making a global search is sending the parameter using always the name search_all (instead of sometimes sall and search_all) * The property $url_last_version must be public if defined into module descriptor files; +* Filters in class field definitions must be a Dolibarr filter syntax string. ***** ChangeLog for 16.0.5 compared to 16.0.4 ***** diff --git a/build/debian/rules b/build/debian/rules index b63fcffde93..df6abfd1b89 100755 --- a/build/debian/rules +++ b/build/debian/rules @@ -19,6 +19,10 @@ override_dh_auto_clean: override_dh_auto_build: # Do nothing. Added to disable launchpad to use bugged dh_auto_build search for ant +# Force the compression format for control files +override_dh_builddeb: + dh_builddeb -- -Zxz + #override_dh_compress: # dh_compress --no-act -X.png @@ -124,4 +128,4 @@ override_dh_fixperms: # Give rights to the webserver on the upload directory chown www-data:www-data debian/dolibarr/var/lib/dolibarr/documents chmod 2775 debian/dolibarr/var/lib/dolibarr/documents - + diff --git a/build/debian/source/options b/build/debian/source/options index 8d8fd181896..49a59df5428 100644 --- a/build/debian/source/options +++ b/build/debian/source/options @@ -1,3 +1,5 @@ -# Force use of gzip compression by dpkg-buildpackage +# Force use of gzip compression by dpkg-buildpackage for the tarball *.debian.tar.gz +# See also option --compression from command line of dpkg-buildpackage +# Format for the control files are defined into the rules file in override_dh_builddeb section compression = "gzip" #compression-level = 9 diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index f0433da142b..b7586e3909f 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -1050,16 +1050,16 @@ if ($nboftargetok) { print "Go into directory $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build\n"; chdir("$BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"); #$cmd="dpkg-source -b $BUILDROOT/$PROJECT-$MAJOR.$MINOR.$build"; - $cmd="dpkg-buildpackage -us -uc"; + $cmd="dpkg-buildpackage -us -uc --compression=gzip"; print "Launch DEB build ($cmd)\n"; $ret=`$cmd 2>&1 3>&1`; print $ret."\n"; chdir("$olddir"); - + print "You can check bin package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}_all.deb\"\n"; print "You can check src package with lintian --pedantic -E -I \"$NEWDESTI/${FILENAMEDEB}.dsc\"\n"; - + # Move to final dir print "Move *_all.deb *.dsc *.orig.tar.gz *.changes to $NEWDESTI\n"; $ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 91b7673ab81..324f5d8d447 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -321,7 +321,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_account) { $param .= '&search_account='.urlencode($search_account); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 620e4158ceb..01bfa1da942 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -416,7 +416,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($searchCategoryProductOperator == 1) { $param .= "&search_category_product_operator=".urlencode($searchCategoryProductOperator); diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index 40055a4b75f..31b99be39a3 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -296,7 +296,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_subaccount) { $param .= '&search_subaccount='.urlencode($search_subaccount); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index fd8cd8ad688..c45a1202419 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -327,7 +327,7 @@ if ($action != 'export_csv') { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 217474db0c9..78106b1026e 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -970,7 +970,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // List of mass actions available diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 419369fe9d3..599e2360147 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -686,7 +686,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 888cc568cf8..a0488793ebf 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -317,7 +317,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= "&search_societe=".urlencode($search_societe); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 8834ad69cf8..753ad06a503 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -382,7 +382,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 1d0653fc5ac..f38b617509e 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -248,7 +248,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 4ad8c80a2c1..0eb84e6d77b 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -306,7 +306,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_login) { $param .= '&search_login='.urlencode($search_login); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ea9841d2fbb..1eef199894d 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -322,7 +322,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= "&search_societe=".urlencode($search_societe); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 3ec92f490bd..03b3fb8eeec 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -386,7 +386,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_societe) { $param .= '&search_societe='.urlencode($search_societe); diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index ef396c143a1..0c4a5aaccf1 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -566,7 +566,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall != "") { $param .= "&sall=".urlencode($sall); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index ea2796ae910..8296fd5591d 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -451,7 +451,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= '&id='.$rowid; if ($optioncss != '') { diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 4baddd8b29b..6b0b722b629 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 880589fb5b1..98a4eec28fb 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -603,7 +603,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Filters print '
'; - print ''; + print '
'; print ''; print ''; print ''; @@ -615,20 +615,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea 'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')), 'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')), 'bcc'=>array('label'=>'Bcc', 'data-placeholder'=>$langs->trans('SearchString')), + 'replyto'=>array('label'=>'ReplyTo', 'data-placeholder'=>$langs->trans('SearchString')), 'subject'=>array('label'=>'Subject', 'data-placeholder'=>$langs->trans('SearchString')), 'body'=>array('label'=>'Body', 'data-placeholder'=>$langs->trans('SearchString')), // disabled because PHP imap_search is not compatible IMAPv4, only IMAPv2 //'header'=>array('label'=>'Header', 'data-placeholder'=>'HeaderKey SearchString'), // HEADER key value //'X1'=>'---', - //'notinsubject'=>array('label'=>'SubjectNotIn', 'data-placeholder'=>'SearchString'), - //'notinbody'=>array('label'=>'BodyNotIn', 'data-placeholder'=>'SearchString'), 'X2'=>'---', 'seen'=>array('label'=>'AlreadyRead', 'data-noparam'=>1), 'unseen'=>array('label'=>'NotRead', 'data-noparam'=>1), 'unanswered'=>array('label'=>'Unanswered', 'data-noparam'=>1), 'answered'=>array('label'=>'Answered', 'data-noparam'=>1), - 'smaller'=>array('label'=>'SmallerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), - 'larger'=>array('label'=>'LargerThan', 'data-placeholder'=>$langs->trans('NumberOfBytes')), + 'smaller'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("SmallerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')), + 'larger'=>array('label'=>$langs->trans("Size").' ('.$langs->trans("LargerThan").")", 'data-placeholder'=>$langs->trans('NumberOfBytes')), 'X3'=>'---', 'withtrackingid'=>array('label'=>'WithDolTrackingID', 'data-noparam'=>1), 'withouttrackingid'=>array('label'=>'WithoutDolTrackingID', 'data-noparam'=>1), @@ -662,7 +661,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; - print ''; + print ''; print ''; // List filters foreach ($object->filters as $rulefilter) { @@ -690,7 +689,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'.img_picto('', 'filter', 'class="pictofixedwidth opacitymedium"').$form->textwithpicto($langs->trans("Filters"), $langs->trans("EmailCollectorFilterDesc")).'
'; print ''; print '
'; print ''; - print ''; + print ''; + print ''; + print ''; + print ''; print ''; $arrayoftypes = array( @@ -730,13 +735,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; - print ''; + print ''; print ''; // List operations $nboflines = count($object->actions); @@ -766,12 +769,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; // Move up/down diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index ccee1f604b2..20d9ddf4ac9 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -337,7 +337,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index dbf47365440..280a3b06247 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -334,7 +334,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { @@ -627,7 +627,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) { print ''; print ''; @@ -444,13 +458,22 @@ if ($action == 'edit') { print '> '.$langs->trans("UsePersonalValue").''; print ''; // Landing page for Agenda - AGENDA_DEFAULT_VIEW diff --git a/htdocs/webhook/target_list.php b/htdocs/webhook/target_list.php index d28221c0e3d..fac35b03190 100644 --- a/htdocs/webhook/target_list.php +++ b/htdocs/webhook/target_list.php @@ -409,7 +409,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index c5c73c3f668..a3036ad19c7 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -238,7 +238,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index 47e93d8294b..80c64ff303b 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -372,7 +372,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index b7e3b4c7555..e635e449379 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -1381,6 +1381,12 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase print __METHOD__." tmp=".json_encode($tmp)."\n"; $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG;"}', json_encode($tmp)); + + $stringtoexplode="AA=B/B;CC=\n\rEE=FF\nHH=GG;;;\nII=JJ\n"; + $tmp=dolExplodeIntoArray($stringtoexplode, "(\r\n|\n|\r|;)", '='); + + print __METHOD__." tmp=".json_encode($tmp)."\n"; + $this->assertEquals('{"AA":"B\/B","CC":"","EE":"FF","HH":"GG","II":"JJ"}', json_encode($tmp)); } /**
'.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).''.img_picto('', 'technic', 'class="pictofixedwidth"').$form->textwithpicto($langs->trans("EmailcollectorOperations"), $langs->trans("EmailcollectorOperationsDesc")).''; + $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); + print $form->textwithpicto($langs->trans("Parameters"), $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); + print '
'; print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'minwidth150 maxwidth300', 1); print ''; - //print ''; - $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); - print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'operationparamtt'); + print ''; print ''; print '
'; if ($action == 'editoperation' && $ruleaction['id'] == $operationid) { - print '
'; + //print '
'; + print ''; print ''; print ''; print ''; } else { - print dol_escape_htmltag($ruleaction['actionparam']); + print dol_nl2br(dol_escape_htmltag($ruleaction['actionparam'], 0, 1)); } print '
'; $url = $_SERVER["PHP_SELF"].'?id='.$obj->rowid; if ($limit) { - $url .= '&limit='.urlencode($limit); + $url .= '&limit='.((int) $limit); } if ($page) { $url .= '&page='.urlencode($page); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 47e4939ef82..167e851a6c2 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -623,7 +623,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (!empty($search) && is_array($search)) { foreach ($search as $key => $val) { diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 3e04243eb72..045ecda2cc7 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -259,7 +259,7 @@ if ($result) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index fcbc01abef1..6013ae41e94 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -226,7 +226,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (isset($optioncss) && $optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/asset/agenda.php b/htdocs/asset/agenda.php index 166eb12935c..ef9afa10458 100644 --- a/htdocs/asset/agenda.php +++ b/htdocs/asset/agenda.php @@ -197,7 +197,7 @@ if ($object->id > 0) { $param .= '&contextpage=' . urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit=' . urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index 4b3b530148d..8f8c551d66b 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -354,7 +354,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/asset/model/agenda.php b/htdocs/asset/model/agenda.php index 51a55e0e144..44a0fa504a3 100644 --- a/htdocs/asset/model/agenda.php +++ b/htdocs/asset/model/agenda.php @@ -199,7 +199,7 @@ if ($object->id > 0) { // $param .= '&contextpage=' . urlencode($contextpage); // } // if ($limit > 0 && $limit != $conf->liste_limit) { - // $param .= '&limit=' . urlencode($limit); + // $param .= '&limit='.((int) $limit); // } // // diff --git a/htdocs/asset/model/list.php b/htdocs/asset/model/list.php index 51e45f244d0..8ccf50a8ab1 100644 --- a/htdocs/asset/model/list.php +++ b/htdocs/asset/model/list.php @@ -360,7 +360,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index b3b2a1d36f4..bf5a07f98b5 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -325,7 +325,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_id != '') { $param .= '&search_id='.urlencode($search_id); diff --git a/htdocs/bom/bom_agenda.php b/htdocs/bom/bom_agenda.php index ddd57d34e76..5e25d788ac7 100644 --- a/htdocs/bom/bom_agenda.php +++ b/htdocs/bom/bom_agenda.php @@ -241,7 +241,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 065a3a578b7..0819c4f1cd1 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -442,7 +442,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index 16673d6b8a3..f21d88fa02a 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -247,7 +247,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php index fd5866eaff8..732ddf20a93 100644 --- a/htdocs/bookcal/availabilities_list.php +++ b/htdocs/bookcal/availabilities_list.php @@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/bookcal/booking_agenda.php b/htdocs/bookcal/booking_agenda.php index b171b953b42..da4c9936860 100644 --- a/htdocs/bookcal/booking_agenda.php +++ b/htdocs/bookcal/booking_agenda.php @@ -247,7 +247,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php index e030a52b7e3..e416dd498ed 100644 --- a/htdocs/bookcal/booking_list.php +++ b/htdocs/bookcal/booking_list.php @@ -396,7 +396,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key]) && count($search[$key])) { diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 34b727aaa16..2bd7109c80b 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -221,7 +221,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 786e571ee3c..ea776094625 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($actioncode != '') { if (is_array($actioncode)) { diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ba3839afa5f..206909d1602 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -529,7 +529,7 @@ if ($object->fetch($id) >= 0) { $param = "&id=".$object->id; //if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_lastname) { $param .= "&search_lastname=".urlencode($search_lastname); @@ -711,7 +711,7 @@ if ($object->fetch($id) >= 0) { print ''; print ''; if ($obj->statut == 0) { // Not sent yet - if (!empty($user->rights->mailing->creer) && $allowaddtarget) { + if (!empty($user->rights->mailing->creer)) { print ''.img_delete($langs->trans("RemoveRecipient")).''; } } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index ef83c5d1470..e5cda94aa9f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -61,6 +61,11 @@ class Mailing extends CommonObject */ public $body; + /** + * @var int 1=Email will be sent even to email that has opt-out + */ + public $evenunsubscribe; + /** * @var int number of email */ @@ -317,6 +322,7 @@ class Mailing extends CommonObject $sql .= ", email_errorsto = '".$this->db->escape($this->email_errorsto)."'"; $sql .= ", bgcolor = '".($this->bgcolor ? $this->db->escape($this->bgcolor) : null)."'"; $sql .= ", bgimage = '".($this->bgimage ? $this->db->escape($this->bgimage) : null)."'"; + $sql .= ", evenunsubscribe = ".((int) $this->evenunsubscribe); $sql .= " WHERE rowid = ".(int) $this->id; dol_syslog(__METHOD__, LOG_DEBUG); @@ -357,7 +363,7 @@ class Mailing extends CommonObject { global $conf; - $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage"; + $sql = "SELECT m.rowid, m.titre as title, m.sujet, m.body, m.bgcolor, m.bgimage, m.evenunsubscribe"; $sql .= ", m.email_from, m.email_replyto, m.email_errorsto"; $sql .= ", m.statut, m.nbemail"; $sql .= ", m.fk_user_creat, m.fk_user_valid"; @@ -389,6 +395,7 @@ class Mailing extends CommonObject $this->bgcolor = $obj->bgcolor; $this->bgimage = $obj->bgimage; + $this->evenunsubscribe = $obj->evenunsubscribe; $this->email_from = $obj->email_from; $this->email_replyto = $obj->email_replyto; @@ -454,6 +461,7 @@ class Mailing extends CommonObject $object->body = ''; $object->bgcolor = ''; $object->bgimage = ''; + $object->evenunsubscribe = 0; //$object->email_from = ''; // We do not reset from email because it is a mandatory value $object->email_replyto = ''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index e6163b9f2da..3fea5458a2d 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -271,7 +271,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index 42e15dca146..c679fd267da 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 13b9aa1a4fe..1b159c9a113 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -875,7 +875,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php index a998229f776..0cb944afa63 100644 --- a/htdocs/commande/agenda.php +++ b/htdocs/commande/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 27b9a05181b..49e6b0b3555 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -587,7 +587,7 @@ if (empty($reshook)) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); @@ -1143,7 +1143,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/commande/list_det.php b/htdocs/commande/list_det.php index d5b0336b95a..3faa292b78d 100644 --- a/htdocs/commande/list_det.php +++ b/htdocs/commande/list_det.php @@ -671,7 +671,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index a678c176ca7..5740c58c86c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -286,7 +286,7 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' $param .= '&offset='.urlencode($offset); } if ($limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_conciliated != '' && $search_conciliated != '-1') { $param .= '&search_conciliated='.urlencode($search_conciliated); @@ -438,7 +438,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($id > 0) { $param .= '&id='.urlencode($id); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 073e9de9a15..85c9e72af5a 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -313,7 +313,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref != '') { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index d72238e3fe6..ec703f3fea4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -351,7 +351,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 1333a6b2346..4451707bdff 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -348,7 +348,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php index a452a8dd6aa..45f495c1723 100644 --- a/htdocs/compta/facture/agenda.php +++ b/htdocs/compta/facture/agenda.php @@ -230,7 +230,7 @@ if ($object->id > 0) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } // Try to know count of actioncomm from cache diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 58c7e35724d..901207a8d58 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3908,7 +3908,7 @@ if ($action == 'create') { print $objectsrc->getNomUrl(1); // We check if Origin document (id and type is known) has already at least one invoice attached to it $objectsrc->fetchObjectLinked($originid, $origin, '', 'facture'); - if (is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { + if (isset($objectsrc->linkedObjects['facture']) && is_array($objectsrc->linkedObjects['facture']) && count($objectsrc->linkedObjects['facture']) >= 1) { setEventMessages('WarningBillExist', null, 'warnings'); echo ' - '.$langs->trans('LatestRelatedBill').' '.end($objectsrc->linkedObjects['facture'])->getNomUrl(1); } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9eadd0fa421..b9b4ff3d1c2 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -6440,7 +6440,7 @@ class FactureLigne extends CommonInvoiceLine return -1; } - $sql = 'UPDATE '.MAIN_DB_PREFIX.'projet_task_time'; + $sql = 'UPDATE '.MAIN_DB_PREFIX.'element_time'; $sql .= ' SET invoice_id = NULL, invoice_line_id = NULL'; $sql .= ' WHERE invoice_line_id = '.((int) $this->id); if (!$this->db->query($sql)) { diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index d0c8ea7f1f5..e0d45a5e38f 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -440,7 +440,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid > 0) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 928ffcfc4bd..407b2dc4e3c 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -993,7 +993,7 @@ if ($resql) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sall) { $param .= '&sall='.urlencode($sall); @@ -2590,6 +2590,9 @@ if ($resql) { $i++; } + // Use correct digits number for totals + $totalarray['val']['total_margin'] = price2num($totalarray['val']['total_margin'], 'MT'); + // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; } diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 6db18f6aa55..5e39e05c818 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -301,7 +301,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if (GETPOST("orphelins")) { diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index 727b3b85f48..8752e63517a 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -412,7 +412,7 @@ if ($id > 0 || $ref) { $urladd = "&id=".urlencode($id); if ($limit > 0 && $limit != $conf->liste_limit) { - $urladd .= '&limit='.urlencode($limit); + $urladd .= '&limit='.((int) $limit); } print '
'."\n"; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 85f0be90125..39c48e0767e 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -395,7 +395,7 @@ if ($resql) { $param = ''; if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($socid) { $param .= '&socid='.urlencode($socid); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 4c3d26720c3..949ebed87c5 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -235,7 +235,7 @@ if ($resql) { $i = 0; if ($limit > 0 && $limit != $conf->liste_limit) { - $param.='&limit='.urlencode($limit); + $param.='&limit='.((int) $limit); } $param = "&id=".urlencode($id); diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 307a7239fe8..96c365997b0 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -196,7 +196,7 @@ if ($result) { $param .= '&type=bank-transfer'; } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); diff --git a/htdocs/compta/prelevement/orders_list.php b/htdocs/compta/prelevement/orders_list.php index 8dd056ed796..974ed47deff 100644 --- a/htdocs/compta/prelevement/orders_list.php +++ b/htdocs/compta/prelevement/orders_list.php @@ -159,7 +159,7 @@ if ($result) { $param .= '&type=bank-transfer'; } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } $param .= "&statut=".urlencode($statut); diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index ed92d834488..6ea46c3ea4e 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -314,7 +314,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 9956cf5153a..8c575ad4b6a 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -114,7 +114,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sortfield) { $param .= '&sortfield='.urlencode($sortfield); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index 8efae5a836d..7b2374830b3 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -382,7 +382,7 @@ if ($sql_select) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($sprod_fulldescr) { $param .= "&sprod_fulldescr=".urlencode($sprod_fulldescr); diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 15b4776c2b9..a671297b0de 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -545,7 +545,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } if ($search_all != '') { $param .= '&search_all='.urlencode($search_all); diff --git a/htdocs/core/boxes/box_funnel_of_prospection.php b/htdocs/core/boxes/box_funnel_of_prospection.php index cdaa9298f63..2cecc278392 100644 --- a/htdocs/core/boxes/box_funnel_of_prospection.php +++ b/htdocs/core/boxes/box_funnel_of_prospection.php @@ -152,7 +152,7 @@ class box_funnel_of_prospection extends ModeleBoxes 'graph' => '1' ); - if ($user->rights->projet->lire || !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if ($user->hasRight('projet', 'lire') || getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."c_lead_status as cls"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index f5024b5cb71..73aefd0c3f7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8112,26 +8112,26 @@ class Form /** - * Return a HTML select string, built from an array of key+value. + * Return a HTML select string, built from an array of key+value. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice. * - * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect - * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) - * @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. - * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. - * @param int $key_in_label 1 to show key into label with format "[key] value" - * @param int $value_as_key 1 to use value as key - * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container - * @param int $translate 1=Translate and encode value - * @param int $maxlen Length maximum for labels - * @param int $disabled Html select box is disabled - * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order - * @param string $morecss Add more class to css styles - * @param int $addjscombo Add js combo - * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set - * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry - * @param int $nohtmlescape No html escaping. - * @return string HTML select string. + * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect + * @param array $array Array like array(key => value) or array(key=>array('label'=>..., 'data-...'=>..., 'disabled'=>..., 'css'=>...)) + * @param string|string[] $id Preselected key or preselected keys for multiselect. Use 'ifone' to autoselect record if there is only one record. + * @param int|string $show_empty 0 no empty value allowed, 1 or string to add an empty value into list (If 1: key is -1 and value is '' or ' ', If placeholder string: key is -1 and value is the string), <0 to add an empty value with key that is this value. + * @param int $key_in_label 1 to show key into label with format "[key] value" + * @param int $value_as_key 1 to use value as key + * @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container + * @param int $translate 1=Translate and encode value + * @param int $maxlen Length maximum for labels + * @param int $disabled Html select box is disabled + * @param string $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' or 'POS' = Do not sort, we keep original order + * @param string $morecss Add more class to css styles + * @param int $addjscombo Add js combo + * @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set + * @param int $disablebademail 1=Check if a not valid email, 2=Check string '---', and if found into value, disable and colorize entry + * @param int $nohtmlescape No html escaping. + * @return string HTML select string. * @see multiselectarray(), selectArrayAjax(), selectArrayFilter() */ public static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = 'minwidth75', $addjscombo = 1, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0) @@ -8245,7 +8245,7 @@ class Form if (is_array($tmpvalue)) { foreach ($tmpvalue as $keyforvalue => $valueforvalue) { if (preg_match('/^data-/', $keyforvalue)) { - $out .= ' ' . $keyforvalue . '="' . $valueforvalue . '"'; + $out .= ' '.$keyforvalue.'="'.dol_escape_htmltag($valueforvalue).'"'; } } } diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 118e75773c1..6bcd8ea1e6c 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -429,7 +429,9 @@ class FormOther if (!is_numeric($showempty)) { $textforempty = $showempty; } - $moreforfilter .= ''."\n"; + $moreforfilter .= '
'; - print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 1); + print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 0, 0, 0, '', 'maxwidth250'); //print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0); print '
'; if (!empty($object->conf->MAIN_LANDING_PAGE)) { + $urltoshow = ''; if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) { - print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + if (is_array($tmparray[$object->conf->MAIN_LANDING_PAGE])) { + $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]['label']); + } else { + $urltoshow = $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]); + } } else { - print $object->conf->MAIN_LANDING_PAGE; + $urltoshow = $object->conf->MAIN_LANDING_PAGE; } + print ' '; + print img_picto($urltoshow, $tmparray[$object->conf->MAIN_LANDING_PAGE]['picto'], 'class="pictofixedwidth"'); + print $urltoshow; + print img_picto($urltoshow, 'globe', 'class="paddingleft"'); + print ''; } - //print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1); print '