NEW Can set the default focus of each page.
NEW Can set if a field is mandatory on form level.
This commit is contained in:
parent
a623d80830
commit
851fd4cc18
@ -235,13 +235,9 @@ if ($mode == 'sortorder')
|
|||||||
{
|
{
|
||||||
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
print info_admin($langs->trans("WarningSettingSortOrder")).'<br>';
|
||||||
}
|
}
|
||||||
if ($mode == 'focus')
|
|
||||||
{
|
|
||||||
print info_admin($langs->trans("FeatureNotYetAvailable")).'<br>';
|
|
||||||
}
|
|
||||||
if ($mode == 'mandatory')
|
if ($mode == 'mandatory')
|
||||||
{
|
{
|
||||||
print info_admin($langs->trans("FeatureNotYetAvailable")).'<br>';
|
print info_admin($langs->trans("FeatureSupportedOnTextFieldsOnly")).'<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
@ -303,11 +299,11 @@ print "\n";
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
// Page
|
// Page
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="defaulturl" value="">';
|
print '<input type="text" class="flat minwidth200 maxwidthonsmartphone" name="defaulturl" value="'.dol_escape_htmltag(GETPOST('defaulturl','alphanohtml')).'">';
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
// Field
|
// Field
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultkey" value="">';
|
print '<input type="text" class="flat maxwidth100onsmartphone" name="defaultkey" value="'.dol_escape_htmltag(GETPOST('defaultkey','alphanohtml')).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Value
|
// Value
|
||||||
if ($mode != 'focus' && $mode != 'mandatory')
|
if ($mode != 'focus' && $mode != 'mandatory')
|
||||||
@ -320,7 +316,7 @@ if ($mode != 'focus' && $mode != 'mandatory')
|
|||||||
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
if (! empty($conf->multicompany->enabled) && !$user->entity)
|
||||||
{
|
{
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat" size="1" name="entity" value="'.$conf->entity.'">';
|
print '<input type="text" class="flat" size="1" disabled name="entity" value="'.$conf->entity.'">'; // We see environment, but to change it we must switch on other entity
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -7023,7 +7023,8 @@ function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode=
|
|||||||
*/
|
*/
|
||||||
function printCommonFooter($zone='private')
|
function printCommonFooter($zone='private')
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager;
|
global $conf, $hookmanager, $user;
|
||||||
|
global $action;
|
||||||
global $micro_start_time;
|
global $micro_start_time;
|
||||||
|
|
||||||
if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n";
|
if ($zone == 'private') print "\n".'<!-- Common footer for private page -->'."\n";
|
||||||
@ -7056,7 +7057,71 @@ function printCommonFooter($zone='private')
|
|||||||
print '});'."\n";
|
print '});'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Google Analytics (need Google module)
|
// Management of focus and mandatory for fields
|
||||||
|
if ($action == 'create' || $action == 'edit')
|
||||||
|
{
|
||||||
|
print '/* Code js to manage focus and mandatory form fields */'."\n";
|
||||||
|
$relativepathstring = $_SERVER["PHP_SELF"];
|
||||||
|
// Clean $relativepathstring
|
||||||
|
if (constant('DOL_URL_ROOT')) $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'),'/').'/', '', $relativepathstring);
|
||||||
|
$relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
||||||
|
$relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
||||||
|
$tmpqueryarraywehave=explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
||||||
|
foreach($user->default_values[$relativepathstring]['focus'] as $defkey => $defval)
|
||||||
|
{
|
||||||
|
$qualified = 0;
|
||||||
|
if ($defkey != '_noquery_')
|
||||||
|
{
|
||||||
|
$tmpqueryarraytohave=explode('&', $defkey);
|
||||||
|
$foundintru=0;
|
||||||
|
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||||
|
{
|
||||||
|
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||||
|
}
|
||||||
|
if (! $foundintru) $qualified=1;
|
||||||
|
//var_dump($defkey.'-'.$qualified);
|
||||||
|
}
|
||||||
|
else $qualified = 1;
|
||||||
|
|
||||||
|
if ($qualified)
|
||||||
|
{
|
||||||
|
foreach($defval as $paramkey => $paramval)
|
||||||
|
{
|
||||||
|
// Add property 'required' on input
|
||||||
|
print 'jQuery("input[name=\''.$paramkey.'\']").focus();'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($user->default_values[$relativepathstring]['mandatory'] as $defkey => $defval)
|
||||||
|
{
|
||||||
|
$qualified = 0;
|
||||||
|
if ($defkey != '_noquery_')
|
||||||
|
{
|
||||||
|
$tmpqueryarraytohave=explode('&', $defkey);
|
||||||
|
$foundintru=0;
|
||||||
|
foreach($tmpqueryarraytohave as $tmpquerytohave)
|
||||||
|
{
|
||||||
|
if (! in_array($tmpquerytohave, $tmpqueryarraywehave)) $foundintru=1;
|
||||||
|
}
|
||||||
|
if (! $foundintru) $qualified=1;
|
||||||
|
//var_dump($defkey.'-'.$qualified);
|
||||||
|
}
|
||||||
|
else $qualified = 1;
|
||||||
|
|
||||||
|
if ($qualified)
|
||||||
|
{
|
||||||
|
foreach($defval as $paramkey => $paramval)
|
||||||
|
{
|
||||||
|
// Add property 'required' on input
|
||||||
|
print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
|
||||||
|
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Google Analytics
|
||||||
|
// TODO Add a hook here
|
||||||
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))
|
||||||
{
|
{
|
||||||
if (($conf->dol_use_jmobile != 4))
|
if (($conf->dol_use_jmobile != 4))
|
||||||
|
|||||||
@ -1810,6 +1810,7 @@ SocialNetworkSetup=Setup of module Social Networks
|
|||||||
EnableFeatureFor=Enable features for <strong>%s</strong>
|
EnableFeatureFor=Enable features for <strong>%s</strong>
|
||||||
VATIsUsedIsOff=Note: The option to use sales Tax or VAT has been set to <strong>Off</strong> in the menu %s - %s, so Sale tax or Vat used will always be 0 for sales.
|
VATIsUsedIsOff=Note: The option to use sales Tax or VAT has been set to <strong>Off</strong> in the menu %s - %s, so Sale tax or Vat used will always be 0 for sales.
|
||||||
SwapSenderAndRecipientOnPDF=Swap sender and recipient address on PDF
|
SwapSenderAndRecipientOnPDF=Swap sender and recipient address on PDF
|
||||||
|
FeatureSupportedOnTextFieldsOnly=Warning, feature supported on text fields only
|
||||||
##### Resource ####
|
##### Resource ####
|
||||||
ResourceSetup=Configuration du module Resource
|
ResourceSetup=Configuration du module Resource
|
||||||
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
UseSearchToSelectResource=Use a search form to choose a resource (rather than a drop-down list).
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user