diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php
index d87ade16b12a38f5531d47517ec91e942c97f463..39d1b7c8d8d16733b718cb2da13dcfd4fbbb9194 100644
--- a/htdocs/comm/mailing/advtargetemailing.php
+++ b/htdocs/comm/mailing/advtargetemailing.php
@@ -22,6 +22,8 @@
  *       \brief      Page to define emailing targets
  */
 
+if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
+
 require '../../main.inc.php';
 
 require_once DOL_DOCUMENT_ROOT . '/comm/mailing/class/mailing.class.php';
@@ -404,14 +406,8 @@ if ($_POST["button_removefilter"]) {
  * View
  */
 
-$extrajs = array (
-		'/includes/jquery/plugins/multiselect/js/ui.multiselect.js'
-);
-$extracss = array (
-		'/includes/jquery/plugins/multiselect/css/ui.multiselect.css',
-);
 
-llxHeader('', $langs->trans("MailAdvTargetRecipients"), '', '', '', '', $extrajs, $extracss);
+llxHeader('', $langs->trans("MailAdvTargetRecipients"));
 
 print '<script type="text/javascript" language="javascript">
 	$(document).ready(function() {
diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php
index a36077f94db16bc9c20d048f4b7f427093088779..b0d970248eb3a1aba7625ab607251aab5e39dae1 100644
--- a/htdocs/comm/mailing/class/advtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/advtargetemailing.class.php
@@ -474,7 +474,7 @@ class AdvanceTargetingMailing extends CommonObject
 				$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as saleman ON saleman.fk_soc=t.rowid ";
 			}
 			if (array_key_exists('cust_categ', $arrayquery)) {
-				$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_societe=t.rowid ";
+				$sql.= " LEFT OUTER JOIN " . MAIN_DB_PREFIX . "categorie_societe as custcateg ON custcateg.fk_soc=t.rowid ";
 			}
 
 			if (!empty($arrayquery['cust_name'])) {
diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
index 69fb747f36451f3e97beef3bc1970f7fb92a7505..f5f0e085ccd3891c97df5fe74c6f0c527a25bc81 100644
--- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
+++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php
@@ -89,7 +89,7 @@ class FormAdvTargetEmailing extends Form
 
 		$langs->load("dict");
 		$maxlength = 0;
-		
+
 		$out = '';
 		$countryArray = array();
 		$label = array ();
@@ -252,7 +252,7 @@ class FormAdvTargetEmailing extends Form
 			// $sql.= ' WHERE entity = '.$conf->entity;
 
 			$options_array = array();
-			
+
 			dol_syslog(get_class($this) . "::".__METHOD__,LOG_DEBUG);
 			$resql = $this->db->query($sql);
 			if ($resql) {
@@ -335,49 +335,8 @@ class FormAdvTargetEmailing extends Form
 	function advMultiselectarray($htmlname, $options_array = array(), $selected_array = array(), $showempty = 0) {
 		global $conf, $langs;
 
-		$return = '';
-		$return .= '<script type="text/javascript" language="javascript">
-						$(document).ready(function() {
-							$.extend($.ui.multiselect.locale, {
-								addAll:\'' . $langs->transnoentities ( "AddAll" ) . '\',
-								removeAll:\'' . $langs->transnoentities ( "RemoveAll" ) . '\',
-								itemsCount:\'' . $langs->transnoentities ( "ItemsCount" ) . '\'
-							});
-
-							$(function(){
-								$("#' . $htmlname . '").addClass("' . $htmlname . '").attr("multiple","multiple").attr("name","' . $htmlname . '[]");
-								$(".multiselect").multiselect({sortable: false, searchable: false});
-							});
-						});
-					</script>';
-		$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]" style="display: none;">';
-        //$return .= '<select id="' . $htmlname . '" class="multiselect" multiple="multiple" name="' . $htmlname . '[]">';
-        
-		if ($showempty)
-			$return .= '<option value="">&nbsp;</option>';
-
-		// Find if keys is in selected array value
-		if (is_array($selected_array) && count($selected_array)>0) {
-			$intersect_array = array_intersect_key($options_array, array_flip($selected_array));
-		} else {
-			$intersect_array=array();
-		}
-
-		if (count($options_array) > 0) {
-			foreach ($options_array as $keyoption => $valoption) {
-				// If key is in intersect table then it have to e selected
-				$selected = '';
-			    if (count ( $intersect_array ) > 0) {
-					if (array_key_exists ( $keyoption, $intersect_array )) {
-						$selected = ' selected="selected"';
-					}
-				}
-				$return .= '<option' . $selected . ' value="' . $keyoption . '">' . $valoption . '</option>';
-			}
-		}
-
-		$return .= '</select>';
-
+		$form=new Form($this->db);
+		$return = $form->multiselectarray($htmlname, $options_array, $selected_array,0,0,'',0,295);
 		return $return;
 	}
 
@@ -448,7 +407,7 @@ class FormAdvTargetEmailing extends Form
 			dol_print_error($this->db);
 		}
 
-		return $this->advMultiselectarray ( $htmlname, $options_array, $selected_array );
+		return $this->advMultiselectarray( $htmlname, $options_array, $selected_array );
 	}
 
 	/**
diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
index 0137353f71436a3ad165cc947489d1601f70da0f..edb63662e65a613878a4b61a5b712bdfbaff48e5 100644
--- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
+++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql
@@ -74,7 +74,7 @@ ALTER TABLE llx_holiday ADD COLUMN ref	varchar(30) NULL;
 ALTER TABLE llx_holiday ADD COLUMN ref_ext	varchar(255);
 
 
-create table llx_notify_def_object
+CREATE TABLE llx_notify_def_object
 (
   id				integer AUTO_INCREMENT PRIMARY KEY,
   entity			integer DEFAULT 1 NOT NULL,		-- multi company id
@@ -129,14 +129,15 @@ ALTER TABLE llx_bank_account ADD COLUMN extraparams		varchar(255);
 -- VMYSQL4.1 ALTER TABLE llx_adherent MODIFY COLUMN country integer DEFAULT NULL;
 -- VPGSQL8.2 ALTER TABLE llx_adherent MODIFY COLUMN country integer USING country::integer;
 
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_CREATE','Product or service created','Executed when a product or sevice is created','product',30);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_MODIFY','Product or service modified','Executed when a product or sevice is modified','product',30);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('PRODUCT_DELETE','Product or service deleted','Executed when a product or sevice is deleted','product',30);
 
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expense_report',202);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expense_report',203);
-insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expense_report',204);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_CREATE','Expense report created','Executed when an expense report is created','expense_report',201);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_VALIDATE','Expense report validated','Executed when an expense report is validated','expense_report',202);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_APPROVE','Expense report approved','Executed when an expense report is approved','expense_report',203);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) VALUES ('EXPENSE_REPORT_PAYED','Expense report billed','Executed when an expense report is set as billed','expense_report',204);
 
 ALTER TABLE llx_c_email_templates ADD COLUMN content_lines text;
 
@@ -196,7 +197,7 @@ CREATE TABLE llx_product_attribute_combination
 );
 
 
-ALTER TABLE llx_bank_account drop foreign key bank_fk_accountancy_journal;
+ALTER TABLE llx_bank_account DROP FOREIGN KEY bank_fk_accountancy_journal;
 
 -- Fix missing entity column after init demo
 ALTER TABLE llx_accounting_journal ADD COLUMN entity integer DEFAULT 1;
@@ -209,18 +210,18 @@ INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (
 INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (5,'AN', 'Has new journal', 9, 1);
 INSERT INTO llx_accounting_journal (rowid, code, label, nature, active) VALUES (6,'ER', 'Expense report journal', 5, 1);
 -- Fix old entries
-UPDATE llx_accounting_journal SET nature = 1 where code = 'OD' and nature = 0;
-UPDATE llx_accounting_journal SET nature = 2 where code = 'VT' and nature = 1;
-UPDATE llx_accounting_journal SET nature = 3 where code = 'AC' and nature = 2;
-UPDATE llx_accounting_journal SET nature = 4 where (code = 'BK' or code = 'BQ') and nature = 3;
+UPDATE llx_accounting_journal SET nature = 1 WHERE code = 'OD' AND nature = 0;
+UPDATE llx_accounting_journal SET nature = 2 WHERE code = 'VT' AND nature = 1;
+UPDATE llx_accounting_journal SET nature = 3 WHERE code = 'AC' AND nature = 2;
+UPDATE llx_accounting_journal SET nature = 4 WHERE (code = 'BK' OR code = 'BQ') AND nature = 3;
 
-UPDATE llx_bank_account as ba set accountancy_journal = 'BQ' where accountancy_journal = 'BK';
-UPDATE llx_bank_account as ba set accountancy_journal = 'OD' where accountancy_journal IS NULL;
+UPDATE llx_bank_account SET accountancy_journal = 'BQ' WHERE accountancy_journal = 'BK';
+UPDATE llx_bank_account SET accountancy_journal = 'OD' WHERE accountancy_journal IS NULL;
 
 ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer;
 ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal);
 
-UPDATE llx_bank_account as ba set fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal as aj where ba.accountancy_journal = aj.code) where accountancy_journal not in ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
+UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
 ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
 
 --Update general ledger for FEC format & harmonization
@@ -233,7 +234,7 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN subledger_account varchar(32);
 ALTER TABLE llx_accounting_bookkeeping CHANGE COLUMN thirdparty_label subledger_label varchar(255);    	-- If field was already created, rename it	
 ALTER TABLE llx_accounting_bookkeeping ADD COLUMN subledger_label varchar(255) AFTER subledger_account;	-- If field dod not exists yet
 
-update llx_accounting_bookkeeping set subledger_account = numero_compte where subledger_account IS NULL;
+UPDATE llx_accounting_bookkeeping SET subledger_account = numero_compte WHERE subledger_account IS NULL;
 
 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN label_compte varchar(255);
 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_journal varchar(32);
@@ -358,9 +359,9 @@ ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_tx	     d
 ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price	 double(24,8) DEFAULT NULL;
 ALTER TABLE llx_product_fournisseur_price_log ADD COLUMN multicurrency_price_ttc double(24,8) DEFAULT NULL;
 
-UPDATE llx_contrat set ref = rowid where ref is null or ref = '';
+UPDATE llx_contrat SET ref = rowid WHERE ref IS NULL OR ref = '';
 
-create table llx_payment_various
+CREATE TABLE llx_payment_various
 (
   rowid                 integer AUTO_INCREMENT PRIMARY KEY,
   tms                   timestamp,
@@ -381,7 +382,7 @@ create table llx_payment_various
 )ENGINE=innodb;
 
 
-create table llx_default_values
+CREATE TABLE llx_default_values
 (
   rowid           integer AUTO_INCREMENT PRIMARY KEY,
   entity          integer DEFAULT 1 NOT NULL,		-- multi company id
@@ -441,27 +442,27 @@ ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_tms (tms);
 ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_datec (datec);
 ALTER TABLE llx_inventorydet ADD INDEX idx_inventorydet_fk_inventory (fk_inventory);
 
-insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active)                                                   values (1, '8.5', '85', '0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0);
-insert into llx_c_tva(fk_pays,taux,code,recuperableonly,note,active)                                                   values (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0);
-insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active)                          values (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0);
-insert into llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) values (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0);
+INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,note,active)                                                   VALUES (1, '8.5', '85', '0','VAT standard rate (DOM sauf Guyane et Saint-Martin)',0);
+INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,note,active)                                                   VALUES (1, '8.5', '85NPR', '1','VAT standard rate (DOM sauf Guyane et Saint-Martin), non perçu par le vendeur mais récupérable par acheteur',0);
+INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,note,active)                          VALUES (1, '8.5', '85NPROM', '1', 2, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer',0);
+INSERT INTO llx_c_tva(fk_pays,taux,code,recuperableonly,localtax1,localtax1_type,localtax2,localtax2_type,note,active) VALUES (1, '8.5', '85NPROMOMR', '1', 2, 3, 2.5, 3, 'VAT standard rate (DOM sauf Guyane et Saint-Martin), NPR, Octroi de Mer et Octroi de Mer Regional',0);
 
 ALTER TABLE llx_events MODIFY COLUMN ip varchar(250);
 
 ALTER TABLE llx_facture ADD COLUMN fk_fac_rec_source integer;
 
-DELETE from llx_c_actioncomm where code in ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm);
+DELETE FROM llx_c_actioncomm WHERE code IN ('AC_PROP','AC_COM','AC_FAC','AC_SHIP','AC_SUP_ORD','AC_SUP_INV') AND id NOT IN (SELECT DISTINCT fk_action FROM llx_actioncomm);
 
 -- Fix: delete orphelin category.
-delete from llx_categorie_product where fk_categorie not in (select rowid from llx_categorie where type = 0);
-delete from llx_categorie_societe where fk_categorie not in (select rowid from llx_categorie where type in (1, 2));
-delete from llx_categorie_member where fk_categorie not in (select rowid from llx_categorie where type = 3);
-delete from llx_categorie_contact where fk_categorie not in (select rowid from llx_categorie where type = 4);
-delete from llx_categorie_project where fk_categorie not in (select rowid from llx_categorie where type = 5);
+DELETE FROM llx_categorie_product WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 0);
+DELETE FROM llx_categorie_societe WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type IN (1, 2));
+DELETE FROM llx_categorie_member WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 3);
+DELETE FROM llx_categorie_contact WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 4);
+DELETE FROM llx_categorie_project WHERE fk_categorie NOT IN (SELECT rowid FROM llx_categorie WHERE type = 5);
 
 ALTER TABLE llx_inventory ADD COLUMN ref varchar(48);
 
-create table llx_loan_schedule
+CREATE TABLE llx_loan_schedule
 (
   rowid				integer AUTO_INCREMENT PRIMARY KEY,
   fk_loan			integer,
@@ -559,3 +560,5 @@ ALTER TABLE llx_blockedlog_authority ADD INDEX signature (signature);
 
 UPDATE llx_bank SET label= '(SupplierInvoicePayment)' WHERE label= 'Règlement fournisseur';
 UPDATE llx_bank SET label= '(CustomerInvoicePayment)' WHERE label= 'Règlement client';
+
+ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_url varchar(255);
diff --git a/htdocs/install/mysql/tables/llx_mailing_cibles.sql b/htdocs/install/mysql/tables/llx_mailing_cibles.sql
index f3031069220105ff0740881e9fb8af40df492da7..c533eb0ff8a18606ee028c4949af02d0efd4e316 100644
--- a/htdocs/install/mysql/tables/llx_mailing_cibles.sql
+++ b/htdocs/install/mysql/tables/llx_mailing_cibles.sql
@@ -30,7 +30,7 @@ create table llx_mailing_cibles
   other				varchar(255) NULL,
   tag				varchar(128) NULL,
   statut			smallint NOT NULL DEFAULT 0,		-- -1 = error, 0 = not sent, ...
-  source_url		varchar(160),
+  source_url		varchar(255),
   source_id			integer,
   source_type		varchar(16),
   date_envoi		datetime,