Browse Source

Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	ChangeLog
	htdocs/reception/list.php
	htdocs/takepos/pay.php
Laurent Destailleur 3 years ago
parent
commit
f8010dfcbc

+ 42 - 0
ChangeLog

@@ -17,6 +17,48 @@ Following changes may create regressions for some external modules, but were nec
 * The 'action=delete&file=...' has been replaced with 'action=deletefile&file=...' to avoid confusion with deletion of object lines.
 
 
+***** ChangeLog for 14.0.3 compared to 14.0.2 *****
+
+FIX: #18698 Supplier invoice list - "alert" checkbox not working
+FIX: #18735
+FIX: #18767 : Member delete
+FIX: #18854
+FIX: #18910 : MRP List SQL query syntax error with more than one extrafileds.
+FIX: Accountancy - Format Quadra export - Missing line type C to create automaticly a subledger account with label
+FIX: Accountancy - Missing specific filename for export on format FEC2, Ciel & repare it
+FIX: Accountancy - Option of export popup are inverted
+FIX: Accountancy - Some correction on export name
+FIX: Accountancy - Trunc code_journal to 2 in format XIMPORT (Ciel, Sage50)
+FIX: add warehouse in projects' overview count
+FIX: autocalculation of the supplier price in main currency.
+FIX: avoid warning if $categories is an id
+FIX: Bad use of a forced contact of another company on PDF/ODT documents
+FIX: Button text on proposal card to create a invoice
+FIX: calculateCosts of BOM must not be included into fetch
+FIX: check if greater 0
+FIX: default language defined for IN country
+FIX: fetch of product with modulebuilder load too much data
+FIX: Filter on categories
+FIX: indentation
+FIX: init hookmanager after loading $conf values
+FIX: legal issue on expense report pdf (must also show price without tax)
+FIX: missing filter status=1 on rss feeds
+FIX: move fetch_optionnal into $ac_static->fetch()
+FIX: payment using wrong type in takepos when too many payment mode
+FIX: Product accountancy affectation with product_perentity activated (PR #18620)
+FIX: products/services card: hidden extrafields were overridden
+FIX: Propal list - Problem of pagination on date
+FIX: selected lines on supplier invoice create
+FIX: Selection of type "people" for membership must hide the company
+FIX: select list of orders not complete when field type of company is on
+FIX: support of localtax on expense report
+FIX: task time: can't filter by user with pgsql + show error message
+FIX: task time: keep on using natural_search
+FIX: Test when date of invoie is in future (pb with TZ and offset)
+FIX: translation into email for member at membership validation.
+FIX: unprivileged user can see task associated with a not allowed project
+FIX: user without permission can set ticket subject
+
 ***** ChangeLog for 14.0.2 compared to 14.0.1 *****
 
 FIX: #18353 Invoice list translation issue

+ 4 - 3
htdocs/admin/dict.php

@@ -1457,6 +1457,10 @@ if ($id) {
 		print $tdsoffields;
 
 
+		// Line to enter new values
+		print '<!-- line to add new entry -->';
+		print '<tr class="oddeven nodrag nodrop nohover">';
+
 		$obj = new stdClass();
 		// If data was already input, we define them in obj to populate input fields.
 		if (GETPOST('actionadd')) {
@@ -1476,9 +1480,6 @@ if ($id) {
 			unset($fieldlist[2]); // Remove field ??? if dictionary Regions
 		}
 
-		// Line to enter new values
-		print '<!-- line to add new entry -->';
-		print '<tr class="oddeven nodrag nodrop nohover">';
 
 		if (empty($reshook)) {
 			fieldList($fieldlist, $obj, $tabname[$id], 'add');

+ 1 - 1
htdocs/asset/type.php

@@ -390,7 +390,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 	print '<tbody>';
 	print "</table>\n";

+ 1 - 1
htdocs/categories/card.php

@@ -266,7 +266,7 @@ if ($user->rights->categorie->creer) {
 		$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 		print $hookmanager->resPrint;
 		if (empty($reshook)) {
-			print $object->showOptionals($extrafields, 'edit', $parameters);
+			print $object->showOptionals($extrafields, 'create', $parameters);
 		}
 
 		print '</table>';

+ 1 - 1
htdocs/comm/action/card.php

@@ -1298,7 +1298,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	print '</table>';

+ 1 - 1
htdocs/comm/mailing/card.php

@@ -726,7 +726,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit');
+		print $object->showOptionals($extrafields, 'create');
 	}
 
 	print '</table>';

+ 1 - 1
htdocs/commande/card.php

@@ -1737,7 +1737,7 @@ if ($action == 'create' && $usercancreate) {
 			}
 		};
 
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	// Template to use by default

+ 1 - 1
htdocs/compta/bank/card.php

@@ -463,7 +463,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	print '</table>';

+ 1 - 1
htdocs/compta/facture/card.php

@@ -3651,7 +3651,7 @@ if ($action == 'create') {
 			}
 		};
 
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	// Template to use by default

+ 4 - 0
htdocs/compta/facture/stats/index.php

@@ -110,6 +110,10 @@ if ($mode == 'supplier') {
 	if ($object_status != '' && $object_status >= 0) {
 		$stats->where .= ' AND f.fk_statut IN ('.$db->sanitize($object_status).')';
 	}
+	if (is_array($custcats) && !empty($custcats)) {
+		$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
+		$stats->where .= ' AND cat.fk_categorie IN ('.$db->sanitize(implode(',', $custcats)).')';
+	}
 }
 
 // Build graphic number of object

+ 2 - 0
htdocs/core/class/html.formmail.class.php

@@ -792,6 +792,7 @@ class FormMail extends Form
 					if (count($listofpaths)) {
 						foreach ($listofpaths as $key => $val) {
 							$relativepathtofile = substr($val, (strlen(DOL_DATA_ROOT) - strlen($val)));
+
 							if ($conf->entity > 1) {
 								$relativepathtofile = str_replace($conf->entity.'/', '', $relativepathtofile);
 							}
@@ -802,6 +803,7 @@ class FormMail extends Form
 							$out .= '<div id="attachfile_'.$key.'">';
 							// Preview of attachment
 							$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
+
 							$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
 							if (!$this->withfilereadonly) {
 								$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';

+ 3 - 2
htdocs/core/lib/files.lib.php

@@ -2719,13 +2719,14 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
 		if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) {
 			$accessallowed = 1;
 		}
-		$original_file = $conf->expedition->dir_output."/sending/".$original_file;
+		$original_file = $conf->expedition->dir_output."/".(strpos('sending/', $original_file) === 0 ? '' : 'sending/').$original_file;
+		//$original_file = $conf->expedition->dir_output."/".$original_file;
 	} elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) {
 		// Delivery Note Wrapping
 		if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) {
 			$accessallowed = 1;
 		}
-		$original_file = $conf->expedition->dir_output."/receipt/".$original_file;
+		$original_file = $conf->expedition->dir_output."/".(strpos('receipt/', $original_file) === 0 ? '' : 'receipt/').$original_file;
 	} elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) {
 		// Wrapping pour les actions
 		if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) {

+ 1 - 4
htdocs/core/tpl/massactions_pre.tpl.php

@@ -99,12 +99,9 @@ if ($massaction == 'presend') {
 
 	print '<input type="hidden" name="massaction" value="confirm_presend">';
 
-	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
-	$formmail = new FormMail($db);
-
 	print dol_get_fiche_head(null, '', '');
 
-	// Cree l'objet formulaire mail
+	// Create mail form
 	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
 	$formmail = new FormMail($db);
 	$formmail->withform = -1;

+ 1 - 1
htdocs/don/card.php

@@ -517,7 +517,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	print '</tbody>';

+ 2 - 2
htdocs/expedition/card.php

@@ -2566,8 +2566,8 @@ if ($action == 'create') {
 
 	// Presend form
 	$modelmail = 'shipping_send';
-	$defaulttopic = 'SendShippingRef';
-	$diroutput = $conf->expedition->dir_output;
+	$defaulttopic = $langs->trans('SendShippingRef');
+	$diroutput = $conf->expedition->dir_output.'/sending';
 	$trackid = 'shi'.$object->id;
 
 	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';

+ 1 - 1
htdocs/expensereport/card.php

@@ -1465,7 +1465,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 	print '<tbody>';

+ 1 - 1
htdocs/fichinter/card.php

@@ -945,7 +945,7 @@ if ($action == 'create') {
 		$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 		print $hookmanager->resPrint;
 		if (empty($reshook)) {
-			print $object->showOptionals($extrafields, 'edit');
+			print $object->showOptionals($extrafields, 'create');
 		}
 
 		// Show link to origin object

+ 5 - 5
htdocs/fourn/class/fournisseur.commande.class.php

@@ -2936,11 +2936,11 @@ class CommandeFournisseur extends CommonOrder
 					$this->user_approve_id2 = $obj->fk_user_approve2;
 				}
 
-				$this->date_creation     = $this->db->idate($obj->datec);
-				$this->date_modification = $this->db->idate($obj->datem);
-				$this->date_approve      = $this->db->idate($obj->datea);
-				$this->date_approve2     = $this->db->idate($obj->datea2);
-				$this->date_validation   = $this->db->idate($obj->date_validation);
+				$this->date_creation     = $this->db->jdate($obj->datec);
+				$this->date_modification = $this->db->jdate($obj->datem);
+				$this->date_approve      = $this->db->jdate($obj->datea);
+				$this->date_approve2     = $this->db->jdate($obj->datea2);
+				$this->date_validation   = $this->db->jdate($obj->date_validation);
 			}
 			$this->db->free($result);
 		} else {

+ 1 - 1
htdocs/fourn/commande/card.php

@@ -1786,7 +1786,7 @@ if ($action == 'create') {
 	print $hookmanager->resPrint;
 
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit');
+		print $object->showOptionals($extrafields, 'create');
 	}
 
 	// Bouton "Create Draft"

+ 1 - 1
htdocs/fourn/facture/card.php

@@ -2285,7 +2285,7 @@ if ($action == 'create') {
 	}
 
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit');
+		print $object->showOptionals($extrafields, 'create');
 	}
 
 	// Public note

+ 1 - 1
htdocs/product/card.php

@@ -1403,7 +1403,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
 		$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 		print $hookmanager->resPrint;
 		if (empty($reshook)) {
-			print $object->showOptionals($extrafields, 'edit', $parameters);
+			print $object->showOptionals($extrafields, 'create', $parameters);
 		}
 
 		// Note (private, no output on invoices, propales...)

+ 1 - 1
htdocs/product/class/product.class.php

@@ -5335,7 +5335,7 @@ class Product extends CommonObject
 			$stock_sending_client = $this->stats_expedition['qty'];
 		}
 		if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
-			$filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '2,3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
+			$filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK;
 			if (isset($includedraftpoforvirtual)) {
 				$filterStatus = '0,1,2,'.$filterStatus;	// 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them
 			}

+ 1 - 1
htdocs/reception/card.php

@@ -873,7 +873,7 @@ if ($action == 'create') {
 				if ($objectsrc->fetch_optionals() > 0) {
 					$recept->array_options = array_merge($recept->array_options, $objectsrc->array_options);
 				}
-				print $object->showOptionals($extrafields, 'edit', $parameters);
+				print $object->showOptionals($extrafields, 'create', $parameters);
 			}
 
 			// Incoterms

+ 1 - 1
htdocs/reception/list.php

@@ -623,7 +623,7 @@ if ($search_array_options) {
 		$crit = $val;
 		$tmpkey = preg_replace('/search_options_/', '', $key);
 		if ($val != '') {
-			$param .= '&search_options_' . $tmpkey . '=' . urlencode($val);
+			$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
 		}
 	}
 }

+ 1 - 1
htdocs/salaries/card.php

@@ -579,7 +579,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit');
+		print $object->showOptionals($extrafields, 'create');
 	}
 
 	print '</table>';

+ 1 - 1
htdocs/supplier_proposal/card.php

@@ -1261,7 +1261,7 @@ if ($action == 'create') {
 	$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
 	print $hookmanager->resPrint;
 	if (empty($reshook)) {
-		print $object->showOptionals($extrafields, 'edit', $parameters);
+		print $object->showOptionals($extrafields, 'create', $parameters);
 	}
 
 

+ 26 - 31
htdocs/takepos/pay.php

@@ -269,39 +269,34 @@ if (!empty($conf->global->TAKEPOS_CUSTOMER_DISPLAY)) {
 </script>
 
 <div style="position:relative; padding-top: 20px; left:5%; height:150px; width:90%;">
-
-<div class="paymentbordline paymentbordlinetotal">
-	<center><span class="takepospay" style="color: white"><?php echo $langs->trans('TotalTTC'); ?>: </span><span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></center>
-</div>
-<?php if ($remaintopay != $invoice->total_ttc) { ?>
-<div class="paymentbordline paymentbordlineremain">
-	<center><span class="takepospay" style="color: white"><?php echo $langs->trans('RemainToPay'); ?>: </span><span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></center>
-</div>
-<?php } ?>
-<div class="paymentbordline paymentbordlinereceived">
-	<center><span class="takepospay" style="color: white"><?php echo $langs->trans("Received"); ?>: </span><span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?><input type="hidden" id="change1" class="change1" value="0"></span></center>
-</div>
-<div class="paymentbordline paymentbordlinechange">
-	<center><span class="takepospay" style="color: white"><?php echo $langs->trans("Change"); ?>: </span><span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?><input type="hidden" id="change2" class="change2" value="0"></span></center>
-</div>
-<?php
-if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
-	require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
-	print '<div class="paymentbordline paddingtop paddingbottom">
-	<center>';
-	$filter = '';
-	$form = new Form($db);
-	print '<span class="takepospay" style="color: white">'.$langs->trans("BankAccount").': </span>';
-	$form->select_comptes(0, 'accountid', 0, $filter, 1, '');
-	print ajax_combobox('selectaccountid');
-	print '</center>
-	</div>';
-}
-?>
-
+	<div class="paymentbordline paymentbordlinetotal center">
+		<span class="takepospay colorwhite"><?php echo $langs->trans('TotalTTC'); ?>: <span id="totaldisplay" class="colorwhite"><?php echo price($invoice->total_ttc, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
+	</div>
+	<?php if ($remaintopay != $invoice->total_ttc) { ?>
+		<div class="paymentbordline paymentbordlineremain center">
+			<span class="takepospay colorwhite"><?php echo $langs->trans('RemainToPay'); ?>: <span id="remaintopaydisplay" class="colorwhite"><?php echo price($remaintopay, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span></span>
+		</div>
+	<?php } ?>
+	<div class="paymentbordline paymentbordlinereceived center">
+		<span class="takepospay colorwhite"><?php echo $langs->trans("Received"); ?>: <span class="change1 colorred"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change1" class="change1" value="0"></span>
+	</div>
+	<div class="paymentbordline paymentbordlinechange center">
+		<span class="takepospay colorwhite"><?php echo $langs->trans("Change"); ?>: <span class="change2 colorwhite"><?php echo price(0, 1, '', 1, -1, -1, $invoice->multicurrency_code); ?></span><input type="hidden" id="change2" class="change2" value="0"></span>
+	</div>
+	<?php
+	if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) {
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+		print '<div class="paymentbordline paddingtop paddingbottom center">';
+		$filter = '';
+		$form = new Form($db);
+		print '<span class="takepospay colorwhite">'.$langs->trans("BankAccount").': </span>';
+		$form->select_comptes(0, 'accountid', 0, $filter, 1, '');
+		print ajax_combobox('selectaccountid');
+		print '</div>';
+	}
+	?>
 </div>
 
-
 <div style="position:absolute; left:5%; height:52%; width:90%;">
 <?php
 $action_buttons = array(

+ 18 - 6
scripts/cron/cron_run_jobs.php

@@ -76,9 +76,6 @@ $userlogin = $argv[2];
 $version = DOL_VERSION;
 $error = 0;
 
-// Language Management
-$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
-
 
 /*
  * Main
@@ -130,7 +127,7 @@ if ($userlogin == 'firstadmin') {
 
 // Check user login
 $user = new User($db);
-$result = $user->fetch('', $userlogin);
+$result = $user->fetch('', $userlogin, '', 1);
 if ($result < 0) {
 	echo "User Error: ".$user->error;
 	dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
@@ -142,6 +139,19 @@ if ($result < 0) {
 		exit(-1);
 	}
 }
+
+// Reload langs
+$langcode = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT);
+if (!empty($user->conf->MAIN_LANG_DEFAULT)) {
+	$langcode = $user->conf->MAIN_LANG_DEFAULT;
+}
+if ($langs->getDefaultLang() != $langcode) {
+	$langs->setDefaultLang($langcode);
+	$langs->tab_translate = array();
+}
+// Language Management
+$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
+
 $user->getrights();
 
 if (isset($argv[3]) && $argv[3]) {
@@ -200,8 +210,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
 			$mysoc->setMysoc($conf);
 
 			// Force recheck that user is ok for the entity to process and reload permission for entity
-			if ($conf->entity != $user->entity && $user->entity != 0) {
-				$result = $user->fetch('', $userlogin, '', 0, $conf->entity);
+			if ($conf->entity != $user->entity) {
+				$result = $user->fetch('', $userlogin, '', 1);
 				if ($result < 0) {
 					echo "\nUser Error: ".$user->error."\n";
 					dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR);
@@ -223,6 +233,8 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) {
 			}
 			if ($langs->getDefaultLang() != $langcode) {
 				$langs->setDefaultLang($langcode);
+				$langs->tab_translate = array();
+				$langs->loadLangs(array('main', 'admin', 'cron', 'dict'));
 			}
 		}