forked from Wavyzz/dolibarr
Work on default values
This commit is contained in:
@@ -83,25 +83,23 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
|||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
if (empty($langcode))
|
if (empty($defaulturl))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Language")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Url")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if ($transkey == '')
|
if (empty($defaultkey))
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors');
|
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Key")), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
if ($transvalue == '')
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NewTranslationStringToShow")), null, 'errors');
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')";
|
//$sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."')";
|
||||||
$result = $db->query($sql);
|
//$result = $db->query($sql);
|
||||||
|
|
||||||
|
// TODO Insert var
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
|
||||||
@@ -121,7 +119,8 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
|
|||||||
// Delete line from delete picto
|
// Delete line from delete picto
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".$db->escape($id);
|
//$sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".$db->escape($id);
|
||||||
|
// Delete const
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
@@ -186,8 +185,15 @@ if ($mode == 'createform') $texthelp.=$langs->trans("PageUrlForDefaultValuesCrea
|
|||||||
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
else $texthelp.=$langs->trans("PageUrlForDefaultValuesList", 'societe/list.php');
|
||||||
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
$texturl=$form->textwithpicto($langs->trans("Url"), $texthelp);
|
||||||
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'defaulturl','',$param,'',$sortfield,$sortorder);
|
print_liste_field_titre($texturl,$_SERVER["PHP_SELF"],'defaulturl','',$param,'',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Key"),$_SERVER["PHP_SELF"],'defaultkey','',$param,'',$sortfield,$sortorder);
|
if ($mode != 'sortorder')
|
||||||
print_liste_field_titre($langs->trans("Value"),$_SERVER["PHP_SELF"],'defaultvalue','',$param,'',$sortfield,$sortorder);
|
{
|
||||||
|
$texthelp=$langs->trans("TheKeyIsTheNameOfHtmlField");
|
||||||
|
$textkey=$form->textwithpicto($langs->trans("Key"), $texthelp);
|
||||||
|
print_liste_field_titre($textkey,$_SERVER["PHP_SELF"],'defaultkey','',$param,'',$sortfield,$sortorder);
|
||||||
|
}
|
||||||
|
$texthelp=$langs->trans("YouCanUseSubstitutionValue");
|
||||||
|
$textvalue=$form->textwithpicto($langs->trans("Value"), $texthelp);
|
||||||
|
print_liste_field_titre($textvalue, $_SERVER["PHP_SELF"], 'defaultvalue', '', $param, '', $sortfield, $sortorder);
|
||||||
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
|
//if (! empty($conf->multicompany->enabled) && !$user->entity) print_liste_field_titre($langs->trans("Entity"),$_SERVER["PHP_SELF"],'entity,transkey','',$param,'',$sortfield,$sortorder);
|
||||||
print '<td align="center"></td>';
|
print '<td align="center"></td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -200,9 +206,13 @@ print '<tr class="oddeven">';
|
|||||||
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="">';
|
||||||
print '</td>'."\n";
|
print '</td>'."\n";
|
||||||
|
if ($mode != 'sortorder')
|
||||||
|
{
|
||||||
|
print '<td>';
|
||||||
|
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
print '<td>';
|
print '<td>';
|
||||||
print '<input type="text" class="flat maxwidth100" name="defaultkey" value="">';
|
|
||||||
print '</td><td>';
|
|
||||||
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
|
print '<input type="text" class="flat maxwidthonsmartphone" name="defaultvalue" value="">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Limit to superadmin
|
// Limit to superadmin
|
||||||
@@ -224,13 +234,13 @@ print '</tr>';
|
|||||||
|
|
||||||
|
|
||||||
// Show constants
|
// Show constants
|
||||||
$sql = "SELECT";
|
/*$sql = "SELECT";
|
||||||
$sql.= " rowid";
|
$sql.= " rowid";
|
||||||
$sql.= ", lang";
|
$sql.= ", lang";
|
||||||
$sql.= ", transkey";
|
$sql.= ", transkey";
|
||||||
$sql.= ", transvalue";
|
$sql.= ", transvalue";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
$sql.= " FROM ".MAIN_DB_PREFIX."overwrite_trans";
|
||||||
$sql.= " WHERE 1 = 1";
|
$sql.= " WHERE 1 = 1";*/
|
||||||
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
//$sql.= " AND entity IN (".$user->entity.",".$conf->entity.")";
|
||||||
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
|
//if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug
|
||||||
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
//else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits
|
||||||
@@ -253,11 +263,14 @@ if ($result)
|
|||||||
|
|
||||||
print "\n";
|
print "\n";
|
||||||
|
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
print '<td>'.$obj->lang.'</td>'."\n";
|
print '<td>'.$obj->lang.'</td>'."\n";
|
||||||
print '<td>'.$obj->transkey.'</td>'."\n";
|
if ($mode != 'sortorder')
|
||||||
|
{
|
||||||
|
print '<td>'.$obj->transkey.'</td>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Value
|
// Value
|
||||||
print '<td>';
|
print '<td>';
|
||||||
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
/*print '<input type="hidden" name="const['.$i.'][rowid]" value="'.$obj->rowid.'">';
|
||||||
|
|||||||
@@ -101,11 +101,8 @@ if ($resql)
|
|||||||
//print "<td> </td>";
|
//print "<td> </td>";
|
||||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bid","", $param,'align="left"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Title"),'','');
|
print_liste_field_titre($langs->trans("Title"),'','');
|
||||||
print "</td>";
|
|
||||||
print_liste_field_titre($langs->trans("Link"),'','');
|
print_liste_field_titre($langs->trans("Link"),'','');
|
||||||
print "</td>";
|
|
||||||
print_liste_field_titre($langs->trans("Target"),'','','','','align="center"');
|
print_liste_field_titre($langs->trans("Target"),'','','','','align="center"');
|
||||||
print "</td>";
|
|
||||||
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Owner"),$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
|
||||||
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
|
print_liste_field_titre($langs->trans("Position"),$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
|
||||||
@@ -126,8 +123,8 @@ if ($resql)
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
$linkintern=0;
|
$linkintern=0;
|
||||||
$title=dol_trunc($obj->title,24);
|
$title=$obj->title;
|
||||||
$link=dol_trunc($obj->url,24);
|
$link=$obj->url;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
print "<td>";
|
print "<td>";
|
||||||
@@ -152,7 +149,7 @@ if ($resql)
|
|||||||
print "</td>\n";
|
print "</td>\n";
|
||||||
|
|
||||||
// Url
|
// Url
|
||||||
print "<td>";
|
print '<td class="tdoverflowmax200">';
|
||||||
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
if (! $linkintern) print '<a href="'.$obj->url.'"'.($obj->target?' target="newlink"':'').'>';
|
||||||
print $link;
|
print $link;
|
||||||
if (! $linkintern) print '</a>';
|
if (! $linkintern) print '</a>';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ AddThisPageToBookmarks=Add current page to bookmarks
|
|||||||
Bookmark=Bookmark
|
Bookmark=Bookmark
|
||||||
Bookmarks=Bookmarks
|
Bookmarks=Bookmarks
|
||||||
ListOfBookmarks=List of bookmarks
|
ListOfBookmarks=List of bookmarks
|
||||||
EditBookmarks=Edit bookmarks
|
EditBookmarks=List/edit bookmarks
|
||||||
NewBookmark=New bookmark
|
NewBookmark=New bookmark
|
||||||
ShowBookmark=Show bookmark
|
ShowBookmark=Show bookmark
|
||||||
OpenANewWindow=Open a new window
|
OpenANewWindow=Open a new window
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ Paste=Paste
|
|||||||
Default=Default
|
Default=Default
|
||||||
DefaultValue=Default value
|
DefaultValue=Default value
|
||||||
DefaultValues=Default values
|
DefaultValues=Default values
|
||||||
|
TheKeyIsTheNameOfHtmlField=The key 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. Examples:
|
PageUrlForDefaultValues=You must enter here the relative url of the page. Examples:
|
||||||
PageUrlForDefaultValuesCreate=<br>For form to create a new thirdparty, it is <strong>%s</strong>.
|
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>.
|
PageUrlForDefaultValuesList=<br>For page that list thirdparties, it is <strong>%s</strong>.
|
||||||
|
|||||||
Reference in New Issue
Block a user