Uniformize code

This commit is contained in:
Laurent Destailleur 2016-08-24 19:38:34 +02:00
parent 87c49366d8
commit 8f809e403d
4 changed files with 35 additions and 6 deletions

View File

@ -79,6 +79,7 @@ class Mailing extends CommonObject
$this->statuts[2] = 'MailingStatusSentPartialy';
$this->statuts[3] = 'MailingStatusSentCompletely';
$this->statut_dest[0] = 'MailingStatusNotSent';
$this->statut_dest[-1] = 'MailingStatusError';
$this->statut_dest[1] = 'MailingStatusSent';
$this->statut_dest[2] = 'MailingStatusRead';

View File

@ -45,6 +45,19 @@ $sall=GETPOST("sall","alpha");
$sref=GETPOST("sref","alpha");
$filteremail=GETPOST('filteremail','alpha');
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('mailinglist'));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('mailing');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'm.titre'=>'Ref',
);
/*
@ -107,6 +120,7 @@ if ($result)
if (! $filteremail) print_liste_field_titre($langs->trans("DateLastSend"),$_SERVER["PHP_SELF"],"m.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
else print_liste_field_titre($langs->trans("DateSending"),$_SERVER["PHP_SELF"],"mc.date_envoi",$param,"",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],($filteremail?"mc.statut":"m.statut"),$param,"",'align="right"',$sortfield,$sortorder);
print_liste_field_titre('', $_SERVER["PHP_SELF"],"",'','','align="right"',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
print '<tr class="liste_titre">';
@ -120,8 +134,11 @@ if ($result)
print '<td class="liste_titre">&nbsp;</td>';
if (! $filteremail) print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print "</td>";
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="right">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
$var=True;
@ -172,6 +189,7 @@ if ($result)
print $email->LibStatut($obj->statut,5);
}
print '</td>';
print '<td></td>';
print "</tr>\n";
$i++;
}

View File

@ -43,7 +43,9 @@ function emailing_prepare_head(Mailing $object)
{
$head[$h][0] = DOL_URL_ROOT."/comm/mailing/cibles.php?id=".$object->id;
$head[$h][1] = $langs->trans("MailRecipients");
if ($object->nbemail > 0) $head[$h][1].= ' <span class="badge">'.$object->nbemail.'</span>';
$head[$h][2] = 'targets';
$h++;
if (! empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR))

View File

@ -388,10 +388,10 @@ if ($result)
print '<td class="liste_titre" align="right">';
$formsupplier_proposal->selectSupplierProposalStatus($viewstatut,1);
print '</td>';
// Check boxes
print '<td class="liste_titre" align="right">';
print '<input type="image" name="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" name="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
$searchpitco=$form->showFilterAndCheckAddButtons(0);
print $searchpitco;
print '</td>';
print "</tr>\n";
@ -475,7 +475,15 @@ if ($result)
print '<td align="right">'.$objectstatic->LibStatut($obj->fk_statut,5)."</td>\n";
print '<td>&nbsp;</td>';
// Action column
print '<td class="nowrap" align="center">';
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($obj->rowid, $arrayofselected)) $selected=1;
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
print "</tr>\n";