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

This commit is contained in:
Laurent Destailleur 2023-02-25 01:58:16 +01:00
commit 70eaa79e18
4 changed files with 55 additions and 55 deletions

View File

@ -49,6 +49,7 @@ if (!empty($conf->modules_parts['theme'])) { // This slow down
}
//print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
$themeparam = '';
print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
?>
<script type="text/javascript" src="js/fckxml.js"></script>

View File

@ -37,7 +37,7 @@ $pos = strstr($uri, '/'); // $pos contient alors url sans nom domaine
if ($pos == '/') {
$pos = ''; // si $pos vaut /, on le met a ''
}
define('DOL_URL_ROOT', $pos);
//define('DOL_URL_ROOT', $pos);
$entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null);
// SECURITY: You must explicitly enable this "connector". (Set it to "true").

View File

@ -73,55 +73,53 @@ class mailing_thirdparties extends MailingTargets
$cibles = array();
$addDescription = "";
$addFilter = "";
if (GETPOSTISSET("filter_client_thirdparties") && GETPOST("filter_client_thirdparties") <> '-1') {
$addFilter .= " AND s.client=".((int) GETPOST("filter_client_thirdparties", 'int'));
$addDescription = $langs->trans('ProspectCustomer')."=";
if (GETPOST("filter_client_thirdparties") == 0) {
$addDescription .= $langs->trans('NorProspectNorCustomer');
} elseif (GETPOST("filter_client_thirdparties") == 1) {
$addDescription .= $langs->trans('Customer');
} elseif (GETPOST("filter_client_thirdparties") == 2) {
$addDescription .= $langs->trans('Prospect');
} elseif (GETPOST("filter_client_thirdparties") == 3) {
$addDescription .= $langs->trans('ProspectCustomer');
} else {
$addDescription .= "Unknown status ".GETPOST("filter_client_thirdparties");
}
}
if (GETPOSTISSET("filter_status")) {
if (strlen($addDescription) > 0) {
$addDescription .= ";";
}
$addDescription .= $langs->trans("Status")."=";
if (GETPOST("filter_status") == '1') {
$addFilter .= " AND s.status=1";
$addDescription .= $langs->trans("Enabled");
} else {
$addFilter .= " AND s.status=0";
$addDescription .= $langs->trans("Disabled");
}
}
if (GETPOST('default_lang', 'alpha')) {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
if (GETPOST('filter_lang_thirdparties', 'alpha')) {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('filter_lang_thirdparties', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
// Select the third parties from category
if (!GETPOST('filter')) {
if (!GETPOST('filter_thirdparties') || GETPOST('filter_thirdparties') == '-1') {
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, null as label";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.email <> ''";
$sql .= " AND s.entity IN (".getEntity('societe').")";
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
if (GETPOST('default_lang', 'alpha')) {
$sql .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
}
$sql .= $addFilter;
} else {
$addFilter = "";
if (GETPOSTISSET("filter_client") && GETPOST("filter_client") <> '-1') {
$addFilter .= " AND s.client=".((int) GETPOST("filter_client", 'int'));
$addDescription = $langs->trans('ProspectCustomer')."=";
if (GETPOST("filter_client") == 0) {
$addDescription .= $langs->trans('NorProspectNorCustomer');
} elseif (GETPOST("filter_client") == 1) {
$addDescription .= $langs->trans('Customer');
} elseif (GETPOST("filter_client") == 2) {
$addDescription .= $langs->trans('Prospect');
} elseif (GETPOST("filter_client") == 3) {
$addDescription .= $langs->trans('ProspectCustomer');
} else {
$addDescription .= "Unknown status ".GETPOST("filter_client");
}
}
if (GETPOSTISSET("filter_status")) {
if (strlen($addDescription) > 0) {
$addDescription .= ";";
}
$addDescription .= $langs->trans("Status")."=";
if (GETPOST("filter_status") == '1') {
$addFilter .= " AND s.status=1";
$addDescription .= $langs->trans("Enabled");
} else {
$addFilter .= " AND s.status=0";
$addDescription .= $langs->trans("Disabled");
}
}
if (GETPOST('default_lang', 'alpha')) {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('default_lang', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
if (GETPOST('filter_lang_thirdparties', 'alpha')) {
$addFilter .= " AND s.default_lang LIKE '".$this->db->escape(GETPOST('filter_lang_thirdparties', 'alpha'))."%'";
$addDescription = $langs->trans('DefaultLang')."=";
}
$sql = "SELECT s.rowid as id, s.email as email, s.nom as name, null as fk_contact, null as firstname, c.label as label";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."categorie_societe as cs, ".MAIN_DB_PREFIX."categorie as c";
$sql .= " WHERE s.email <> ''";
@ -129,8 +127,8 @@ class mailing_thirdparties extends MailingTargets
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND cs.fk_soc = s.rowid";
$sql .= " AND c.rowid = cs.fk_categorie";
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
$sql .= $addFilter;
$sql .= " UNION ";
@ -141,13 +139,15 @@ class mailing_thirdparties extends MailingTargets
$sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".((int) $mailing_id).")";
$sql .= " AND cs.fk_soc = s.rowid";
$sql .= " AND c.rowid = cs.fk_categorie";
if (GETPOST('filter', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter', 'int'));
if (GETPOST('filter_thirdparties', 'int') > 0) {
$sql .= " AND c.rowid=".((int) GETPOST('filter_thirdparties', 'int'));
}
$sql .= $addFilter;
}
$sql .= " ORDER BY email";
//print $sql;exit;
// Stock recipients emails into targets table
$result = $this->db->query($sql);
if ($result) {
@ -243,7 +243,8 @@ class mailing_thirdparties extends MailingTargets
$langs->load("companies");
$s = '<select id="filter_thirdparties" name="filter" class="flat">';
// filter
$s = '<select id="filter_thirdparties" name="filter_thirdparties" class="flat">';
// Show categories
$sql = "SELECT rowid, label, type, visible";
@ -293,6 +294,7 @@ class mailing_thirdparties extends MailingTargets
$s .= '</select> ';
// filter_client_thirdparties
$s .= '<select id="filter_client_thirdparties" name="filter_client_thirdparties" class="flat">';
$s .= '<option value="-1">'.$langs->trans('ProspectCustomer').'</option>';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) {
@ -309,6 +311,7 @@ class mailing_thirdparties extends MailingTargets
$s .= '</select> ';
$s .= ajax_combobox("filter_client_thirdparties");
// filter_status
$s .= ' <select id="filter_status_thirdparties" name="filter_status" class="flat">';
$s .= '<option value="-1">'.$langs->trans("Status").'</option>';
$s .= '<option value="1">'.$langs->trans("Enabled").'</option>';
@ -316,6 +319,7 @@ class mailing_thirdparties extends MailingTargets
$s .= '</select>';
$s .= ajax_combobox("filter_status_thirdparties");
// filter_lang_thirdparties
if (getDolGlobalInt('MAIN_MULTILANGS')) {
// Choose language
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';

View File

@ -289,13 +289,8 @@ if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
if (!empty($canvas)) {
$sql .= " AND p.canvas = '".$db->escape($canvas)."'";
}
if (!empty($search_fk_warehouse)) {
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
} else {
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
}
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price, p.pmp, p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms, p.duration, p.tobuy, p.stock';
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook