Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 18.0
This commit is contained in:
commit
0e11cd1ee3
8 changed files with 48 additions and 14 deletions
|
|
@ -201,7 +201,7 @@ $tablib[44] = "DictionaryAssetDisposalType";
|
|||
$tabsql = array();
|
||||
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
|
||||
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as state_code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
|
||||
$tabsql[4] = "SELECT c.rowid as rowid, c.code, c.label, c.active, c.favorite, c.eec FROM ".MAIN_DB_PREFIX."c_country AS c";
|
||||
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
|
||||
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
|
||||
|
|
@ -823,7 +823,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors');
|
||||
}
|
||||
}
|
||||
if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code"))) {
|
||||
if (($id == 3 || $id == 42) && !is_numeric(GETPOST("code")) && GETPOST('actionadd')) {
|
||||
$ok = 0;
|
||||
setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors');
|
||||
}
|
||||
|
|
@ -1199,7 +1199,7 @@ if (empty($id)) {
|
|||
|
||||
|
||||
$param = '&id='.urlencode($id);
|
||||
if ($search_country_id > 0) {
|
||||
if ($search_country_id || GETPOSTISSET('page') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter_x', 'alpha')) {
|
||||
$param .= '&search_country_id='.urlencode($search_country_id);
|
||||
}
|
||||
if ($search_code != '') {
|
||||
|
|
@ -1370,7 +1370,8 @@ if ($id > 0) {
|
|||
}
|
||||
if ($value == 'country') {
|
||||
if (in_array('region_id', $fieldlist)) {
|
||||
print '<td> </td>'; continue;
|
||||
//print '<td> </td>';
|
||||
continue;
|
||||
} // For region page, we do not show the country input
|
||||
$valuetoshow = $langs->trans("Country");
|
||||
}
|
||||
|
|
@ -2009,7 +2010,9 @@ if ($id > 0) {
|
|||
if (empty($rowidcol) || in_array($id, array(6, 7, 8, 13, 17, 19, 27, 32))) {
|
||||
$rowidcol = 'rowid';
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(isset($obj->{$rowidcol}) ? $obj->{$rowidcol} : (!empty($obj->code) ? urlencode($obj->code) : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
$url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder;
|
||||
$url .= '&rowid='.(isset($obj->$rowidcol) ? $obj->$rowidcol : (!empty($obj->code) ? urlencode($obj->code) : ''));
|
||||
$url .= '&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
||||
if (!empty($param)) {
|
||||
$url .= '&'.$param;
|
||||
}
|
||||
|
|
@ -2230,8 +2233,8 @@ if ($id > 0) {
|
|||
$langs->load('other');
|
||||
$key = $langs->trans($obj->label);
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$value});
|
||||
} elseif ($value == 'code' && $id == 3) {
|
||||
$valuetoshow = $obj->state_code;
|
||||
/*} elseif ($value == 'code' && $id == 3) {
|
||||
$valuetoshow = $obj->state_code; */
|
||||
} elseif ($value == 'label' && $tabname[$id] == 'c_product_nature') {
|
||||
$langs->load("products");
|
||||
$valuetoshow = $langs->trans($obj->{$value});
|
||||
|
|
|
|||
|
|
@ -274,6 +274,9 @@ function getEntity($element, $shared = 1, $currentobject = null)
|
|||
|
||||
// fix different element names (France to English)
|
||||
switch ($element) {
|
||||
case 'projet':
|
||||
$element = 'project';
|
||||
break;
|
||||
case 'contrat':
|
||||
$element = 'contract';
|
||||
break; // "/contrat/class/contrat.class.php"
|
||||
|
|
|
|||
|
|
@ -76,6 +76,9 @@ function dolStripPhpCode($str, $replacewith = '')
|
|||
function dolKeepOnlyPhpCode($str)
|
||||
{
|
||||
$str = str_replace('<?=', '<?php', $str);
|
||||
$str = str_replace('<?php', '__LTINTPHP__', $str);
|
||||
$str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini
|
||||
$str = str_replace('__LTINTPHP__', '<?php', $str);
|
||||
|
||||
$newstr = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
// $sendto
|
||||
// $withmaindocfilemail
|
||||
|
||||
|
||||
if ($massaction == 'predeletedraft') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDraftDeletion"), $langs->trans("ConfirmMassDeletionQuestion", count($toselect)), "delete", null, '', 0, 200, 500, 1);
|
||||
}
|
||||
|
|
@ -94,7 +93,7 @@ if ($massaction == 'preaffecttag' && isModEnabled('category')) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($massaction == 'preupdateprice' && isModEnabled('category')) {
|
||||
if ($massaction == 'preupdateprice') {
|
||||
$formquestion = array();
|
||||
|
||||
$valuefield = '<div style="display: flex; align-items: center; justify-content: flex-end; padding-right: 150px">';
|
||||
|
|
|
|||
|
|
@ -4100,6 +4100,7 @@ function migrate_delete_old_files($db, $langs, $conf)
|
|||
|
||||
// List of files to delete
|
||||
$filetodeletearray = array(
|
||||
'/core/ajax/ajaxcompanies.php',
|
||||
'/core/triggers/interface_demo.class.php',
|
||||
'/core/menus/barre_left/default.php',
|
||||
'/core/menus/barre_top/default.php',
|
||||
|
|
@ -4107,8 +4108,6 @@ function migrate_delete_old_files($db, $langs, $conf)
|
|||
'/core/modules/modCommercial.class.php',
|
||||
'/core/modules/modProduit.class.php',
|
||||
'/core/modules/modSkype.class.php',
|
||||
'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php',
|
||||
'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php',
|
||||
'/core/triggers/interface_modWebcalendar_Webcalsynchro.class.php',
|
||||
'/core/triggers/interface_modCommande_Ecotax.class.php',
|
||||
'/core/triggers/interface_modCommande_fraisport.class.php',
|
||||
|
|
@ -4138,6 +4137,10 @@ function migrate_delete_old_files($db, $langs, $conf)
|
|||
'/core/modules/mailings/kiwi.modules.php',
|
||||
'/core/boxes/box_members.php',
|
||||
|
||||
'/includes/restler/framework/Luracast/Restler/Data/Object.php',
|
||||
'/phenix/inc/triggers/interface_modPhenix_Phenixsynchro.class.php',
|
||||
'/webcalendar/inc/triggers/interface_modWebcalendar_webcalsynchro.class.php',
|
||||
|
||||
'/api/class/api_generic.class.php',
|
||||
'/asterisk/cidlookup.php',
|
||||
'/categories/class/api_category.class.php',
|
||||
|
|
|
|||
|
|
@ -191,9 +191,9 @@ if (session_id() && !empty($_SESSION["dol_entity"])) {
|
|||
} elseif (!empty($_ENV["dol_entity"])) {
|
||||
// Entity inside a CLI script
|
||||
$conf->entity = $_ENV["dol_entity"];
|
||||
} elseif (GETPOSTISSET("loginfunction") && GETPOST("entity", 'int')) {
|
||||
} elseif (GETPOSTISSET("loginfunction") && (GETPOST("entity", 'int') || GETPOST("switchentity", 'int'))) {
|
||||
// Just after a login page
|
||||
$conf->entity = GETPOST("entity", 'int');
|
||||
$conf->entity = (GETPOSTISSET("entity") ? GETPOST("entity", 'int') : GETPOST("switchentity", 'int'));
|
||||
} elseif (defined('DOLENTITY') && is_numeric(constant('DOLENTITY'))) {
|
||||
// For public page with MultiCompany module
|
||||
$conf->entity = constant('DOLENTITY');
|
||||
|
|
|
|||
|
|
@ -5058,7 +5058,7 @@ class Product extends CommonObject
|
|||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load('products', 'other');
|
||||
$langs->loadLangs(array('products', 'other'));
|
||||
|
||||
$datas = array();
|
||||
$nofetch = !empty($params['nofetch']);
|
||||
|
|
|
|||
|
|
@ -226,4 +226,27 @@ class WebsiteTest extends PHPUnit\Framework\TestCase
|
|||
print __METHOD__." result checkPHPCode=".$result."\n";
|
||||
$this->assertEquals($result, 1, 'checkPHPCode did not detect the string was dangerous');
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolKeepOnlyPhpCode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testDolKeepOnlyPhpCode()
|
||||
{
|
||||
$s = 'HTML content <?php exec("eee"); ?> and more HTML content';
|
||||
$result = dolKeepOnlyPhpCode($s);
|
||||
print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n";
|
||||
$this->assertEquals('<?php exec("eee"); ?>', $result, 'dolKeepOnlyPhpCode did extract the correct string');
|
||||
|
||||
$s = 'HTML content <? exec("eee"); ?> and more HTML content';
|
||||
$result = dolKeepOnlyPhpCode($s);
|
||||
print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n";
|
||||
$this->assertEquals('<?php exec("eee"); ?>', $result, 'dolKeepOnlyPhpCode did extract the correct string');
|
||||
|
||||
$s = 'HTML content <?php test() <?php test2(); ?> and more HTML content';
|
||||
$result = dolKeepOnlyPhpCode($s);
|
||||
print __METHOD__." result dolKeepOnlyPhpCode=".$result."\n";
|
||||
$this->assertEquals('<?php test() ?><?php test2(); ?>', $result, 'dolKeepOnlyPhpCode did extract the correct string');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue