Skip to content
Snippets Groups Projects
Commit 63a2aa33 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: sql error with postgres when creating extrafield with an upper cas

character. code for new fields must be always lowercase.
parent b1eef7cd
No related branches found
No related tags found
No related merge requests found
......@@ -117,8 +117,8 @@ if ($action == 'add')
if (! $error)
{
// Type et taille non encore pris en compte => varchar(255)
if (isset($_POST["attrname"]) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$_POST['attrname']))
// attrname must be alphabetical and lower case only
if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']))
{
// Construct array for parameter (value of select list)
$default_value = GETPOST('default_value');
......@@ -159,7 +159,7 @@ if ($action == 'add')
{
$error++;
$langs->load("errors");
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode"));
$mesg=$langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters",$langs->transnoentities("AttributeCode"));
setEventMessage($mesg,'errors');
$action = 'create';
}
......
......@@ -70,7 +70,7 @@
<!-- Label -->
<tr><td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td><td class="valeur"><input type="text" name="label" size="40" value="<?php echo GETPOST('label'); ?>"></td></tr>
<!-- Code -->
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?> (<?php echo $langs->trans("AlphaNumOnlyCharsAndNoSpace"); ?>)</td><td class="valeur"><input type="text" name="attrname" id="attrname" size="10" value="<?php echo GETPOST('attrname'); ?>"></td></tr>
<tr><td class="fieldrequired"><?php echo $langs->trans("AttributeCode"); ?></td><td class="valeur"><input type="text" name="attrname" id="attrname" size="10" value="<?php echo GETPOST('attrname'); ?>"> (<?php echo $langs->trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>)</td></tr>
<!-- Type -->
<tr><td class="fieldrequired"><?php echo $langs->trans("Type"); ?></td><td class="valeur">
<?php print $form->selectarray('type',$type2label,GETPOST('type')); ?>
......
......@@ -983,6 +983,7 @@ ExtraFieldsProject=Complementary attributes (projects)
ExtraFieldsProjectTask=Complementary attributes (tasks)
ExtraFieldHasWrongValue=Attribut %s has a wrong value.
AlphaNumOnlyCharsAndNoSpace=only alphanumericals characters without space
AlphaNumOnlyLowerCharsAndNoSpace=only alphanumericals and lower case characters without space
SendingMailSetup=Setup of sendings by email
SendmailOptionNotComplete=Warning, on some Linux systems, to send email from your email, sendmail execution setup must contains option -ba (parameter mail.force_extra_parameters into your php.ini file). If some recipients never receive emails, try to edit this PHP parameter with mail.force_extra_parameters = -ba).
PathToDocuments=Path to documents
......
......@@ -62,6 +62,7 @@ ErrorNoValueForCheckBoxType=Please fill value for checkbox list
ErrorNoValueForRadioType=Please fill value for radio list
ErrorBadFormatValueList=The list value cannot have more than one come : <u>%s</u>, but need at least one: llave,valores
ErrorFieldCanNotContainSpecialCharacters=Field <b>%s</b> must not contains special characters.
ErrorFieldCanNotContainSpecialNorUpperCharacters=Field <b>%s</b> must not contains special characters, nor upper case characters.
ErrorNoAccountancyModuleLoaded=No accountancy module activated
ErrorExportDuplicateProfil=This profil name already exists for this export set.
ErrorLDAPSetupNotComplete=Dolibarr-LDAP matching is not complete.
......
......@@ -983,6 +983,7 @@ ExtraFieldsProject=Attributs supplémentaires (projets)
ExtraFieldsProjectTask=Attributs supplémentaires (tâches)
ExtraFieldHasWrongValue=L'attribut %s a une valeur incorrecte.
AlphaNumOnlyCharsAndNoSpace=uniquement caractères alphanumériques sans espace
AlphaNumOnlyLowerCharsAndNoSpace=uniquement caractères minuscules alphanumériques sans espace
SendingMailSetup=Configuration de l'envoi par email
SendmailOptionNotComplete=Attention, sur certains systèmes Linux, avec cette méthode d'envoi, pour pouvoir envoyer des emails en votre nom, la configuration d'exécution de sendmail doit contenir l'option <b>-ba</b> (paramètre <b>mail.force_extra_parameters</b> dans le fichier <b>php.ini</b>). Si certains de vos destinataires ne reçoivent pas de message, essayer de modifier ce paramètre PHP avec <b>mail.force_extra_parameters = -ba</b>.
PathToDocuments=Chemin d'accès aux documents
......
......@@ -62,6 +62,7 @@ ErrorNoValueForCheckBoxType=Les valeurs de la liste de case a cochées doivent
ErrorNoValueForRadioType=Les valeurs de la liste d'options doivent être renseignées
ErrorBadFormatValueList=Les valeurs de la liste ne peuvent pas contenir plus d'une virgule : <b>%s</b>, mais doivent en avoir au moins une: clef,valeur
ErrorFieldCanNotContainSpecialCharacters=Le champ <b>%s</b> ne peut contenir de caractères spéciaux.
ErrorFieldCanNotContainSpecialNorUpperCharacters=Le champ <b>%s</b> ne peut contenir de caractères spéciaux, ni de caractères en majuscules.
ErrorNoAccountancyModuleLoaded=Aucun module de comptabilité activé
ErrorExportDuplicateProfil=Ce nom de profil existe déjà pour ce lot d'export.
ErrorLDAPSetupNotComplete=Le matching Dolibarr-LDAP est incomplet.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment