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

Conflicts:
	htdocs/contact/list.php
	htdocs/core/modules/mailings/modules_mailings.php
This commit is contained in:
Laurent Destailleur 2021-10-26 13:52:00 +02:00
parent f592318cba
commit e9ba9fc103
13 changed files with 150 additions and 64 deletions

View File

@ -168,6 +168,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier'; - protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono'; + protected $default_monospaced_font = 'freemono';
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
of the function, replace:
$roman = '';
with:
$roman = '';
if ($number >= 4000) {
// do not represent numbers above 4000 in Roman numerals
return strval($number);
}

View File

@ -2846,6 +2846,16 @@ if (empty($reshook)) {
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'compta', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);

View File

@ -100,6 +100,16 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'contact', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses'); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

@ -92,6 +92,16 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'documents', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents'); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";

View File

@ -62,6 +62,16 @@ $result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', $field
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$form = new Form($db); $form = new Form($db);
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info'); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');

View File

@ -77,6 +77,16 @@ if (empty($reshook)) {
* View * View
*/ */
if (empty($object->id)) {
llxHeader();
$head = facture_prepare_head($object);
$langs->load('errors');
echo dol_get_fiche_head($head, 'note', $langs->trans("InvoiceCustomer"), -1, 'bill'),
'<div class="error">' . $langs->trans("ErrorRecordNotFound") . '</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes'); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

@ -818,7 +818,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
print '<tr>'; print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>'; print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)).'</td>'; print '<td>';
print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS), 1, false, ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
print '</td>';
print '</tr>'; print '</tr>';
} }
@ -1095,8 +1097,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
print '<tr>'; print '<tr>';
print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>'; print '<td class="noemail"><label for="no_email">'.$langs->trans("No_Email").'</label></td>';
print '<td>';
$useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2)); $useempty = (isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && ($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2));
print '<td>'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty).'</td>'; print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty);
print '</td>';
print '</tr>'; print '</tr>';
} }
@ -1323,7 +1327,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
print '<tr><td>'.$langs->trans("No_Email").'</td><td>'.yn($object->no_email).'</td></tr>'; print '<tr><td>'.$langs->trans("No_Email").'</td><td>';
if ($object->email) {
print yn($object->no_email);
} else {
print '<span class="opacitymedium">'.$langs->trans("EMailNotDefined").'</span>';
}
print '</td></tr>';
} }
print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td>'; print '<tr><td>'.$langs->trans("ContactVisibility").'</td><td>';

View File

@ -204,6 +204,12 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) {
$arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1); $arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1);
} }
$arrayfields['unsubscribed'] = array(
'label'=>'No_Email',
'checked'=>0,
'enabled'=>(!empty($conf->mailing->enabled)),
'position'=>41);
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
if ($value['active']) { if ($value['active']) {
@ -355,7 +361,7 @@ if ($resql) {
} }
$sql = "SELECT s.rowid as socid, s.nom as name,"; $sql = "SELECT s.rowid as socid, s.nom as name,";
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email, p.no_email,"; $sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.zip, p.town, p.poste, p.email,";
$sql .= " p.socialnetworks, p.photo,"; $sql .= " p.socialnetworks, p.photo,";
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,"; $sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
@ -366,6 +372,9 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
} }
} }
if (!empty($conf->mailing->enabled)) {
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
}
// Add fields from hooks // Add fields from hooks
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@ -499,8 +508,11 @@ if (strlen($search_town)) {
if (count($search_roles) > 0) { if (count($search_roles) > 0) {
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))"; $sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".$db->sanitize(implode(',', $search_roles))."))";
} }
if ($search_no_email != '' && $search_no_email >= 0) { if ($search_no_email != -1 && $search_no_email > 0) {
$sql .= " AND p.no_email = ".((int) $search_no_email); $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
}
if ($search_no_email != -1 && $search_no_email == 0) {
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0 AND p.email IS NOT NULL AND p.email <> ''";
} }
if ($search_status != '' && $search_status >= 0) { if ($search_status != '' && $search_status >= 0) {
$sql .= " AND p.statut = ".((int) $search_status); $sql .= " AND p.statut = ".((int) $search_status);
@ -568,75 +580,75 @@ llxHeader('', $title, $help_url);
$param = ''; $param = '';
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
$param .= '&amp;contextpage='.$contextpage; $param .= '&contextpage='.urlencode($contextpage);
} }
if ($limit > 0 && $limit != $conf->liste_limit) { if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&amp;limit='.$limit; $param .= '&limit='.((int) $limit);
} }
$param .= '&amp;begin='.urlencode($begin).'&amp;userid='.urlencode($userid).'&amp;contactname='.urlencode($sall); $param .= '&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
$param .= '&amp;type='.urlencode($type).'&amp;view='.urlencode($view); $param .= '&type='.urlencode($type).'&view='.urlencode($view);
if (!empty($search_categ) && $search_categ != '-1') { if (!empty($search_categ) && $search_categ != '-1') {
$param .= '&amp;search_categ='.urlencode($search_categ); $param .= '&search_categ='.urlencode($search_categ);
} }
if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') { if (!empty($search_categ_thirdparty) && $search_categ_thirdparty != '-1') {
$param .= '&amp;search_categ_thirdparty='.urlencode($search_categ_thirdparty); $param .= '&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
} }
if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') { if (!empty($search_categ_supplier) && $search_categ_supplier != '-1') {
$param .= '&amp;search_categ_supplier='.urlencode($search_categ_supplier); $param .= '&search_categ_supplier='.urlencode($search_categ_supplier);
} }
if ($sall != '') { if ($sall != '') {
$param .= '&amp;sall='.urlencode($sall); $param .= '&sall='.urlencode($sall);
} }
if ($search_id > 0) { if ($search_id > 0) {
$param .= "&amp;search_id=".urlencode($search_id); $param .= "&search_id=".urlencode($search_id);
} }
if ($search_lastname != '') { if ($search_lastname != '') {
$param .= '&amp;search_lastname='.urlencode($search_lastname); $param .= '&search_lastname='.urlencode($search_lastname);
} }
if ($search_firstname != '') { if ($search_firstname != '') {
$param .= '&amp;search_firstname='.urlencode($search_firstname); $param .= '&search_firstname='.urlencode($search_firstname);
} }
if ($search_societe != '') { if ($search_societe != '') {
$param .= '&amp;search_societe='.urlencode($search_societe); $param .= '&search_societe='.urlencode($search_societe);
} }
if ($search_address != '') { if ($search_address != '') {
$param .= '&amp;search_address='.urlencode($search_address); $param .= '&search_address='.urlencode($search_address);
} }
if ($search_zip != '') { if ($search_zip != '') {
$param .= '&amp;search_zip='.urlencode($search_zip); $param .= '&search_zip='.urlencode($search_zip);
} }
if ($search_town != '') { if ($search_town != '') {
$param .= '&amp;search_town='.urlencode($search_town); $param .= '&search_town='.urlencode($search_town);
} }
if ($search_country != '') { if ($search_country != '') {
$param .= "&search_country=".urlencode($search_country); $param .= "&search_country=".urlencode($search_country);
} }
if ($search_poste != '') { if ($search_poste != '') {
$param .= '&amp;search_poste='.urlencode($search_poste); $param .= '&search_poste='.urlencode($search_poste);
} }
if ($search_phone_pro != '') { if ($search_phone_pro != '') {
$param .= '&amp;search_phone_pro='.urlencode($search_phone_pro); $param .= '&search_phone_pro='.urlencode($search_phone_pro);
} }
if ($search_phone_perso != '') { if ($search_phone_perso != '') {
$param .= '&amp;search_phone_perso='.urlencode($search_phone_perso); $param .= '&search_phone_perso='.urlencode($search_phone_perso);
} }
if ($search_phone_mobile != '') { if ($search_phone_mobile != '') {
$param .= '&amp;search_phone_mobile='.urlencode($search_phone_mobile); $param .= '&search_phone_mobile='.urlencode($search_phone_mobile);
} }
if ($search_fax != '') { if ($search_fax != '') {
$param .= '&amp;search_fax='.urlencode($search_fax); $param .= '&search_fax='.urlencode($search_fax);
} }
if ($search_email != '') { if ($search_email != '') {
$param .= '&amp;search_email='.urlencode($search_email); $param .= '&search_email='.urlencode($search_email);
} }
if ($search_no_email != '') { if ($search_no_email != '') {
$param .= '&amp;search_no_email='.urlencode($search_no_email); $param .= '&search_no_email='.urlencode($search_no_email);
} }
if ($search_status != '') { if ($search_status != '') {
$param .= '&amp;search_status='.urlencode($search_status); $param .= '&search_status='.urlencode($search_status);
} }
if ($search_priv == '0' || $search_priv == '1') { if ($search_priv == '0' || $search_priv == '1') {
$param .= "&amp;search_priv=".urlencode($search_priv); $param .= "&search_priv=".urlencode($search_priv);
} }
if ($search_stcomm != '') { if ($search_stcomm != '') {
$param .= '&search_stcomm='.urlencode($search_stcomm); $param .= '&search_stcomm='.urlencode($search_stcomm);
@ -843,7 +855,7 @@ if (!empty($arrayfields['p.email']['checked'])) {
print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">'; print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
print '</td>'; print '</td>';
} }
if (!empty($arrayfields['p.no_email']['checked'])) { if (!empty($arrayfields['unsubscribed']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email); print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
print '</td>'; print '</td>';
@ -965,8 +977,8 @@ if (!empty($arrayfields['p.fax']['checked'])) {
if (!empty($arrayfields['p.email']['checked'])) { if (!empty($arrayfields['p.email']['checked'])) {
print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
} }
if (!empty($arrayfields['p.no_email']['checked'])) { if (!empty($arrayfields['unsubscribed']['checked'])) {
print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center ');
} }
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
foreach ($socialnetworks as $key => $value) { foreach ($socialnetworks as $key => $value) {
@ -1155,8 +1167,14 @@ while ($i < min($num, $limit)) {
} }
} }
// No EMail // No EMail
if (!empty($arrayfields['p.no_email']['checked'])) { if (!empty($arrayfields['unsubscribed']['checked'])) {
print '<td class="center">'.yn($obj->no_email).'</td>'; print '<td class="center">';
if (empty($obj->email)) {
//print '<span class="opacitymedium">'.$langs->trans("NoEmail").'</span>';
} else {
print yn(($obj->unsubscribed > 0) ? 1 : 0);
}
print '</td>';
if (!$i) { if (!$i) {
$totalarray['nbfield']++; $totalarray['nbfield']++;
} }

View File

@ -79,8 +79,8 @@ class mailing_contacts1 extends MailingTargets
$statssql[0] .= " count(distinct(c.email)) as nb"; $statssql[0] .= " count(distinct(c.email)) as nb";
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")"; $statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")";
$statssql[0] .= " AND c.email != ''"; // Note that null != '' is false $statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
$statssql[0] .= " AND c.no_email = 0"; $statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
$statssql[0] .= " AND c.statut = 1"; $statssql[0] .= " AND c.statut = 1";
return $statssql; return $statssql;
@ -103,8 +103,7 @@ class mailing_contacts1 extends MailingTargets
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
$sql .= " WHERE c.entity IN (".getEntity('socpeople').")"; $sql .= " WHERE c.entity IN (".getEntity('socpeople').")";
$sql .= " AND c.email != ''"; // Note that null != '' is false $sql .= " AND c.email <> ''"; // Note that null != '' is false
$sql .= " AND c.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0"; $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
// exclude unsubscribed users // exclude unsubscribed users
$sql .= " AND c.statut = 1"; $sql .= " AND c.statut = 1";
@ -132,10 +131,9 @@ class mailing_contacts1 extends MailingTargets
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb"; $sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
/*$sql.= " AND sp.email != ''"; // Note that null != '' is false $sql .= " AND sp.email <> ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0"; $sql .= " AND sp.statut = 1";
$sql.= " AND sp.statut = 1";*/ $sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')";
$sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
$sql .= " GROUP BY sp.poste"; $sql .= " GROUP BY sp.poste";
$sql .= " ORDER BY sp.poste"; $sql .= " ORDER BY sp.poste";
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -169,10 +167,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs"; $sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs";
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
//$sql.= " AND sp.no_email = 0"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false
//$sql.= " AND sp.email != ''"; $sql .= " AND sp.statut = 1";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_socpeople = sp.rowid"; $sql .= " AND cs.fk_socpeople = sp.rowid";
$sql .= " GROUP BY c.label"; $sql .= " GROUP BY c.label";
@ -244,10 +241,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
//$sql.= " AND sp.no_email = 0"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false
//$sql.= " AND sp.email != ''"; $sql .= " AND sp.statut = 1";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc"; $sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label"; $sql .= " GROUP BY c.label";
@ -282,10 +278,9 @@ class mailing_contacts1 extends MailingTargets
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,"; $sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
$sql .= " ".MAIN_DB_PREFIX."categorie as c,"; $sql .= " ".MAIN_DB_PREFIX."categorie as c,";
$sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs"; $sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
//$sql.= " AND sp.no_email = 0"; $sql .= " AND sp.email <> ''"; // Note that null != '' is false
//$sql.= " AND sp.email != ''"; $sql .= " AND sp.statut = 1";
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND cs.fk_categorie = c.rowid"; $sql .= " AND cs.fk_categorie = c.rowid";
$sql .= " AND cs.fk_soc = sp.fk_soc"; $sql .= " AND cs.fk_soc = sp.fk_soc";
$sql .= " GROUP BY c.label"; $sql .= " GROUP BY c.label";
@ -391,7 +386,6 @@ class mailing_contacts1 extends MailingTargets
} }
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")"; $sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
$sql .= " AND sp.email <> ''"; $sql .= " AND sp.email <> ''";
$sql .= " AND sp.no_email = 0";
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0"; $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
// Exclude unsubscribed email adresses // Exclude unsubscribed email adresses
$sql .= " AND sp.statut = 1"; $sql .= " AND sp.statut = 1";

View File

@ -224,7 +224,7 @@ class MailingTargets // This can't be abstract as it is used for some method
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
$sql .= " SET statut=3"; $sql .= " SET statut=3";
$sql .= " WHERE fk_mailing =" .((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))"; $sql .= " WHERE fk_mailing = ".((int) $mailing_id)." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG); dol_syslog(__METHOD__.":mailing update status to display emails that do not want to be contacted anymore", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -395,7 +395,7 @@ class Delivery extends CommonObject
$error = 0; $error = 0;
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer)) if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery->creer))
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) { || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->delivery_advance->validate))) {
if (!empty($conf->global->DELIVERY_ADDON_NUMBER)) { if (!empty($conf->global->DELIVERY_ADDON_NUMBER)) {
// Setting the command numbering module name // Setting the command numbering module name
$modName = $conf->global->DELIVERY_ADDON_NUMBER; $modName = $conf->global->DELIVERY_ADDON_NUMBER;
@ -610,7 +610,7 @@ class Delivery extends CommonObject
{ {
global $conf; global $conf;
$num = count($this->lines); $num = count($this->lines);
$line = new DeliveryLine($this->db); $line = new DeliveryLine($this->db);
$line->origin_id = $origin_id; $line->origin_id = $origin_id;
@ -736,8 +736,8 @@ class Delivery extends CommonObject
//if ($option !== 'nolink') //if ($option !== 'nolink')
//{ //{
// Add param to save lastsearch_values or not // Add param to save lastsearch_values or not
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) { if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
$add_save_lastsearch_values = 1; $add_save_lastsearch_values = 1;
} }
@ -997,7 +997,7 @@ class Delivery extends CommonObject
$array[$i]['label'] = $objSourceLine->label ? $objSourceLine->label : $objSourceLine->description; $array[$i]['label'] = $objSourceLine->label ? $objSourceLine->label : $objSourceLine->description;
} }
$i++; $i++;
} }
return $array; return $array;
} else { } else {

View File

@ -60,6 +60,7 @@ EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions
MailingAddFile=Attach this file MailingAddFile=Attach this file
NoAttachedFiles=No attached files NoAttachedFiles=No attached files
BadEMail=Bad value for Email BadEMail=Bad value for Email
EMailNotDefined=Email not defined
ConfirmCloneEMailing=Are you sure you want to clone this emailing? ConfirmCloneEMailing=Are you sure you want to clone this emailing?
CloneContent=Clone message CloneContent=Clone message
CloneReceivers=Cloner recipients CloneReceivers=Cloner recipients

View File

@ -1922,11 +1922,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("CountryOrigin").'</td>'; print '<tr><td>'.$langs->trans("CountryOrigin").'</td>';
print '<td>'; print '<td>';
print img_picto('', 'globe-americas', 'class="paddingrightonly"'); print img_picto('', 'globe-americas', 'class="paddingrightonly"');
print $form->select_country($object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone'); print $form->select_country(GETPOSTISSET('country_id') ? GETPOST('country_id', 'int') : $object->country_id, 'country_id', '', 0, 'minwidth100 maxwidthonsmartphone');
if ($user->admin) { if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
} }
print '</td></tr>'; print '</td></tr>';
// State // State
if (empty($conf->global->PRODUCT_DISABLE_STATE)) { if (empty($conf->global->PRODUCT_DISABLE_STATE)) {
print '<tr>'; print '<tr>';
@ -1937,7 +1938,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
} }
print img_picto('', 'state', 'class="pictofixedwidth"'); print img_picto('', 'state', 'class="pictofixedwidth"');
print $formcompany->select_state($object->state_id, $object->country_code); print $formcompany->select_state(GETPOSTISSET('state_id') ? GETPOST('state_id', 'int') : $object->state_id, $object->country_code);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }