Main language of a web site is now mandatory
This commit is contained in:
parent
d3f8c7af1e
commit
df1851838e
@ -144,7 +144,7 @@ class Website extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function create(User $user, $notrigger = false)
|
public function create(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $langs;
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
@ -184,6 +184,10 @@ class Website extends CommonObject
|
|||||||
if (empty($this->entity)) {
|
if (empty($this->entity)) {
|
||||||
$this->entity = $conf->entity;
|
$this->entity = $conf->entity;
|
||||||
}
|
}
|
||||||
|
if (empty($this->lang)) {
|
||||||
|
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MainLanguage"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Insert request
|
// Insert request
|
||||||
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.$this->table_element.'(';
|
||||||
@ -444,7 +448,7 @@ class Website extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function update(User $user, $notrigger = false)
|
public function update(User $user, $notrigger = false)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $langs;
|
||||||
|
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -474,6 +478,10 @@ class Website extends CommonObject
|
|||||||
}
|
}
|
||||||
$this->otherlang = join(',', $tmparray);
|
$this->otherlang = join(',', $tmparray);
|
||||||
}
|
}
|
||||||
|
if (empty($this->lang)) {
|
||||||
|
$this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MainLanguage"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
// Put here code to add a control on parameters values
|
// Put here code to add a control on parameters values
|
||||||
|
|||||||
@ -2692,14 +2692,14 @@ if ($action == 'editcss')
|
|||||||
print '<table class="border centpercent">';
|
print '<table class="border centpercent">';
|
||||||
|
|
||||||
// Website
|
// Website
|
||||||
print '<tr><td class="titlefieldcreate">';
|
print '<tr><td class="titlefieldcreate fieldrequired">';
|
||||||
print $langs->trans('WebSite');
|
print $langs->trans('WebSite');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print $websitekey;
|
print $websitekey;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Main language
|
// Main language
|
||||||
print '<tr><td class="tdtop">';
|
print '<tr><td class="tdtop fieldrequired">';
|
||||||
$htmltext='';
|
$htmltext='';
|
||||||
print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG');
|
print $form->textwithpicto($langs->trans('MainLanguage'), $htmltext, 1, 'help', '', 0, 2, 'WEBSITE_LANG');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -2853,18 +2853,19 @@ if ($action == 'createsite')
|
|||||||
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
|
print '<input type="text" class="flat maxwidth300" name="WEBSITE_REF" value="'.dol_escape_htmltag($siteref).'" autofocus>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td class="fieldrequired">';
|
||||||
|
print $langs->trans('MainLanguage');
|
||||||
|
print '</td><td>';
|
||||||
|
$shortlangcode = preg_replace('/[_-].*$/', '', trim($langs->defaultlang));
|
||||||
|
print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : $shortlangcode), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2, 0, 0, array(), 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('Description');
|
print $langs->trans('Description');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
print '<input type="text" class="flat minwidth500" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
|
print '<input type="text" class="flat minwidth500" name="WEBSITE_DESCRIPTION" value="'.dol_escape_htmltag($sitedesc).'">';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td>';
|
|
||||||
print $langs->trans('MainLanguage');
|
|
||||||
print '</td><td>';
|
|
||||||
print $formadmin->select_language((GETPOSTISSET('WEBSITE_LANG') ? GETPOST('WEBSITE_LANG', 'aZ09comma') : '0'), 'WEBSITE_LANG', 0, null, 1, 0, 0, 'minwidth300', 2, 0, 0, array(), 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print $langs->trans('OtherLanguages');
|
print $langs->trans('OtherLanguages');
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user