Merge pull request #14100 from atm-florian/12_fixAdvTargetTplWarning
fix: warning and clean old code about multiselect category for advtarget tpl
This commit is contained in:
commit
c919d3d5aa
@ -341,74 +341,6 @@ class FormAdvTargetEmailing extends Form
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return combo list with customer categories
|
|
||||||
*
|
|
||||||
* @param string $htmlname Name of categorie
|
|
||||||
* @param array $selected_array value selected
|
|
||||||
* @return string HTML combo
|
|
||||||
*/
|
|
||||||
public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array())
|
|
||||||
{
|
|
||||||
return $this->multiselectCategories($htmlname, $selected_array, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return combo list with customer contact
|
|
||||||
*
|
|
||||||
* @param string $htmlname Name of categorie
|
|
||||||
* @param array $selected_array value selected
|
|
||||||
* @return string HTML combo
|
|
||||||
*/
|
|
||||||
public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array())
|
|
||||||
{
|
|
||||||
return $this->multiselectCategories($htmlname, $selected_array, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return combo list of categories
|
|
||||||
*
|
|
||||||
* @param string $htmlname Name of categorie
|
|
||||||
* @param array $selected_array Value selected
|
|
||||||
* @param int $type Type
|
|
||||||
* @return string HTML combo
|
|
||||||
*/
|
|
||||||
public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0)
|
|
||||||
{
|
|
||||||
global $conf, $langs, $user;
|
|
||||||
$langs->load("dict");
|
|
||||||
|
|
||||||
$options_array = array();
|
|
||||||
|
|
||||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie";
|
|
||||||
$sql .= " WHERE type=".$type;
|
|
||||||
|
|
||||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($resql);
|
|
||||||
$i = 0;
|
|
||||||
if ($num)
|
|
||||||
{
|
|
||||||
while ($i < $num)
|
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($resql);
|
|
||||||
|
|
||||||
$options_array[$obj->rowid] = $obj->label;
|
|
||||||
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->advMultiselectarray($htmlname, $options_array, $selected_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a combo list to select emailing target selector
|
* Return a combo list to select emailing target selector
|
||||||
*
|
*
|
||||||
|
|||||||
@ -48,7 +48,7 @@ function emailing_prepare_head(Mailing $object)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
if (!empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id;
|
||||||
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
$head[$h][1] = $langs->trans("MailAdvTargetRecipients");
|
||||||
|
|||||||
@ -15,6 +15,10 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
|
}
|
||||||
|
|
||||||
print '<script type="text/javascript" language="javascript">
|
print '<script type="text/javascript" language="javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
||||||
@ -135,7 +139,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Customer Country
|
// Customer Country
|
||||||
print '<tr><td>'.$langs->trans("Country");
|
print '<tr><td>'.$langs->trans("Country");
|
||||||
if (count($array_query['cust_country']) > 0) {
|
if (!empty($array_query['cust_country'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
@ -145,7 +149,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// State Customer
|
// State Customer
|
||||||
print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('ThirdParty');
|
print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('ThirdParty');
|
||||||
if (count($array_query['cust_status']) > 0) {
|
if (!empty($array_query['cust_status'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -173,7 +177,7 @@ print '</td></tr>'."\n";
|
|||||||
// Prospect/Customer
|
// Prospect/Customer
|
||||||
$selected = $array_query['cust_typecust'];
|
$selected = $array_query['cust_typecust'];
|
||||||
print '<tr><td>'.$langs->trans('ProspectCustomer').' '.$langs->trans('ThirdParty');
|
print '<tr><td>'.$langs->trans('ProspectCustomer').' '.$langs->trans('ThirdParty');
|
||||||
if (count($array_query['cust_typecust']) > 0) {
|
if (!empty($array_query['cust_typecust'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -189,7 +193,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Prospection status
|
// Prospection status
|
||||||
print '<tr><td>'.$langs->trans('ProspectLevel');
|
print '<tr><td>'.$langs->trans('ProspectLevel');
|
||||||
if (count($array_query['cust_prospect_status']) > 0) {
|
if (!empty($array_query['cust_prospect_status'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -199,7 +203,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Prospection comm status
|
// Prospection comm status
|
||||||
print '<tr><td>'.$langs->trans('StatusProsp');
|
print '<tr><td>'.$langs->trans('StatusProsp');
|
||||||
if (count($array_query['cust_comm_status']) > 0) {
|
if (!empty($array_query['cust_comm_status'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -209,7 +213,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Customer Type
|
// Customer Type
|
||||||
print '<tr><td>'.$langs->trans("ThirdPartyType");
|
print '<tr><td>'.$langs->trans("ThirdPartyType");
|
||||||
if (count($array_query['cust_typeent']) > 0) {
|
if (!empty($array_query['cust_typeent'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
@ -219,7 +223,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Staff number
|
// Staff number
|
||||||
print '<td>'.$langs->trans("Staff");
|
print '<td>'.$langs->trans("Staff");
|
||||||
if (count($array_query['cust_effectif_id']) > 0) {
|
if (!empty($array_query['cust_effectif_id'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -229,7 +233,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Sales manager
|
// Sales manager
|
||||||
print '<tr><td>'.$langs->trans("SalesRepresentatives");
|
print '<tr><td>'.$langs->trans("SalesRepresentatives");
|
||||||
if (count($array_query['cust_saleman']) > 0) {
|
if (!empty($array_query['cust_saleman'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
@ -240,7 +244,7 @@ print '</td></tr>'."\n";
|
|||||||
// Customer Default Langauge
|
// Customer Default Langauge
|
||||||
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
if (!empty($conf->global->MAIN_MULTILANGS)) {
|
||||||
print '<tr><td>'.$langs->trans("DefaultLang");
|
print '<tr><td>'.$langs->trans("DefaultLang");
|
||||||
if (count($array_query['cust_language']) > 0) {
|
if (!empty($array_query['cust_language'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
@ -252,11 +256,12 @@ if (!empty($conf->global->MAIN_MULTILANGS)) {
|
|||||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||||
// Customer Categories
|
// Customer Categories
|
||||||
print '<tr><td>'.$langs->trans("CustomersCategoryShort");
|
print '<tr><td>'.$langs->trans("CustomersCategoryShort");
|
||||||
if (count($array_query['cust_categ']) > 0) {
|
if (!empty($array_query['cust_categ'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
print $formadvtargetemaling->multiselectCustomerCategories('cust_categ', $array_query['cust_categ']);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
|
||||||
|
print $form->multiselectarray('cust_categ', $cate_arbo, GETPOST('cust_categ', 'array'), null, null, null, null, "90%");
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -346,7 +351,7 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
|||||||
|
|
||||||
// State Contact
|
// State Contact
|
||||||
print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('Contact');
|
print '<tr><td>'.$langs->trans('Status').' '.$langs->trans('Contact');
|
||||||
if (count($array_query['contact_status']) > 0) {
|
if (!empty($array_query['contact_status'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -364,7 +369,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Civility
|
// Civility
|
||||||
print '<tr><td width="15%">'.$langs->trans("UserTitle");
|
print '<tr><td width="15%">'.$langs->trans("UserTitle");
|
||||||
if (count($array_query['contact_civility']) > 0) {
|
if (!empty($array_query['contact_civility'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
@ -389,7 +394,7 @@ print '</td></tr>'."\n";
|
|||||||
|
|
||||||
// Contact Country
|
// Contact Country
|
||||||
print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("Country");
|
print '<tr><td>'.$langs->trans('Contact').' '.$langs->trans("Country");
|
||||||
if (count($array_query['contact_country']) > 0) {
|
if (!empty($array_query['contact_country'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
@ -448,11 +453,12 @@ print '</td></tr>'."\n";
|
|||||||
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
|
||||||
// Customer Categories
|
// Customer Categories
|
||||||
print '<tr><td>'.$langs->trans("ContactCategoriesShort");
|
print '<tr><td>'.$langs->trans("ContactCategoriesShort");
|
||||||
if (count($array_query['contact_categ']) > 0) {
|
if (!empty($array_query['contact_categ'])) {
|
||||||
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
print img_picto($langs->trans('AdvTgtUse'), 'ok.png@advtargetemailing');
|
||||||
}
|
}
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
print $formadvtargetemaling->multiselectContactCategories('contact_categ', $array_query['contact_categ']);
|
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1);
|
||||||
|
print $form->multiselectarray('contact_categ', $cate_arbo, GETPOST('contact_categ', 'array'), null, null, null, null, "90%");
|
||||||
print '</td><td>'."\n";
|
print '</td><td>'."\n";
|
||||||
print '</td></tr>'."\n";
|
print '</td></tr>'."\n";
|
||||||
}
|
}
|
||||||
@ -465,10 +471,13 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
|||||||
dol_include_once('/core/class/extrafields.class.php');
|
dol_include_once('/core/class/extrafields.class.php');
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$extrafields->fetch_name_optionals_label($elementype);
|
$extrafields->fetch_name_optionals_label($elementype);
|
||||||
|
if (!empty($extrafields->attributes[$elementtype]['type'])) {
|
||||||
foreach ($extrafields->attributes[$elementtype]['type'] as $key => &$value) {
|
foreach ($extrafields->attributes[$elementtype]['type'] as $key => &$value) {
|
||||||
if ($value == 'radio')$value = 'select';
|
if ($value == 'radio')
|
||||||
|
$value = 'select';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!empty($extrafields->attributes[$elementtype]['label'])) {
|
||||||
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
|
foreach ($extrafields->attributes[$elementtype]['label'] as $key => $val) {
|
||||||
print '<tr><td>' . $extrafields->attributes[$elementtype]['label'][$key];
|
print '<tr><td>' . $extrafields->attributes[$elementtype]['label'][$key];
|
||||||
if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) {
|
if ($array_query['options_' . $key . '_cnct'] != '' || (is_array($array_query['options_' . $key . '_cnct']) && count($array_query['options_' . $key . '_cnct']) > 0)) {
|
||||||
@ -523,6 +532,7 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) {
|
|||||||
print '</td></tr>' . "\n";
|
print '</td></tr>' . "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
print '<tr>'."\n";
|
print '<tr>'."\n";
|
||||||
print '<td colspan="3" class="right">'."\n";
|
print '<td colspan="3" class="right">'."\n";
|
||||||
print '<input type="button" name="addcontact" id="addcontact" value="'.$langs->trans('AdvTgtAddContact').'" class="butAction"/>'."\n";
|
print '<input type="button" name="addcontact" id="addcontact" value="'.$langs->trans('AdvTgtAddContact').'" class="butAction"/>'."\n";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user