Fix phpunit
This commit is contained in:
parent
51e5959765
commit
205989b64b
@ -248,8 +248,8 @@ print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
// Page
|
||||
$texthelp=$langs->trans("PageUrlForDefaultValues");
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
||||
if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCreate", 'societe/card.php', 'societe/card.php?abc=val1&def=val2');
|
||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php', 'societe/card.php?abc=val1&def=val2');
|
||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'page,param','',$param,'',$sortfield,$sortorder);
|
||||
// Field
|
||||
|
||||
@ -306,12 +306,25 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
||||
// Else, retreive default values if we are not doing a sort
|
||||
elseif (! isset($_GET['sortfield']) && ! empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set
|
||||
{
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
if (! empty($_GET['action']) && $_GET['action'] == 'create' && ! isset($_GET[$paramname]) && ! isset($_POST[$paramname]))
|
||||
{
|
||||
if (! empty($user->default_values)) // $user->default_values defined from menu default values
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
|
||||
$qualified=1;
|
||||
if (isset($user->default_values[$relativepathstring]['createform_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['createform_queries']);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
||||
}
|
||||
}
|
||||
if ($qualified)
|
||||
{
|
||||
//var_dump($user->default_values[$relativepathstring]['createform']);
|
||||
if (isset($user->default_values[$relativepathstring]['createform'][$paramname])) $out = $user->default_values[$relativepathstring]['createform'][$paramname];
|
||||
}
|
||||
}
|
||||
}
|
||||
// Management of default search_filters and sort order
|
||||
@ -327,7 +340,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder_queries'])) // Even if paramname is sortfield, data are stored into ['sortorder...']
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
|
||||
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
||||
@ -352,7 +365,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
||||
if (isset($user->default_values[$relativepathstring]['sortorder_queries']))
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['sortorder_queries']);
|
||||
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
||||
@ -377,7 +390,7 @@ function GETPOST($paramname, $check='', $method=0, $filter=NULL, $options=NULL)
|
||||
if (isset($user->default_values[$relativepathstring]['filters_queries']))
|
||||
{
|
||||
$tmpqueryarraytohave=explode('&', $user->default_values[$relativepathstring]['filters_queries']);
|
||||
$tmpqueryarraywehave=explode('&', $_SERVER['QUERY_STRING']);
|
||||
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||
{
|
||||
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $qualified=0;
|
||||
|
||||
@ -451,8 +451,8 @@ DependsOn=This module need the module(s)
|
||||
RequiredBy=This module is required by module(s)
|
||||
TheKeyIsTheNameOfHtmlField=This is the name of the HTML field. This need to have technical knowledges to read the content of the HTML page to get the key name of a field.
|
||||
PageUrlForDefaultValues=You must enter here the relative url of the page. If you include parameters in URL, the default values will be effective if all parameters are set to same value. Examples:
|
||||
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>
|
||||
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>
|
||||
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
|
||||
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>,<br>If we want default only if url has some parameter, we can use <strong>%s</strong>
|
||||
EnableDefaultValues=Enable usage of personalized default values
|
||||
EnableOverwriteTranslation=Enable usage of overwrote translation
|
||||
GoIntoTranslationMenuToChangeThis=A translation has been found for the key with this code, so to change this value, you must edit it fom Home-Setup-translation.
|
||||
|
||||
@ -199,13 +199,13 @@ class CodingPhpTest extends PHPUnit_Framework_TestCase
|
||||
preg_match_all('/(...................)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER);
|
||||
foreach($matches as $key => $val)
|
||||
{
|
||||
if ($val[1] != 'dol_escape_htmltag(')
|
||||
if ($val[1] != 'dol_escape_htmltag(' && $val[1] != 'l_string_nohtmltag(')
|
||||
{
|
||||
$ok=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($ok, 'Found a $_SERVER[\'QUERY_STRING\'] without dol_escape_htmltag around in file '.$file['fullname'].' ('.$val[1].'$_SERVER[\'QUERY_STRING\']). Bad.');
|
||||
$this->assertTrue($ok, 'Found a $_SERVER[\'QUERY_STRING\'] without dol_escape_htmltag neither dol_string_nohtmltag around it, in file '.$file['fullname'].' ('.$val[1].'$_SERVER[\'QUERY_STRING\']). Bad.');
|
||||
|
||||
|
||||
// Test that first param of print_liste_field_titre is a translation key and not the translated value
|
||||
|
||||
Loading…
Reference in New Issue
Block a user