';
}
print '
';
@@ -408,7 +420,8 @@
try {
$nbofrecipient = $obj->getNbOfRecipients('');
- } catch (Exception $e)
+ }
+ catch (Exception $e)
{
dol_syslog($e->getMessage(), LOG_ERR);
}
@@ -417,7 +430,9 @@
if ($nbofrecipient >= 0)
{
print $nbofrecipient;
- } else {
+ }
+ else
+ {
print $langs->trans("Error").' '.img_error($obj->error);
}
print '
';
@@ -425,14 +440,15 @@
print '
';
if ($allowaddtarget)
{
- try {
- $filter = $obj->formFilter();
- } catch (Exception $e)
- {
- dol_syslog($e->getMessage(), LOG_ERR);
- }
- if ($filter) print $filter;
- else print $langs->trans("None");
+ try {
+ $filter = $obj->formFilter();
+ }
+ catch (Exception $e)
+ {
+ dol_syslog($e->getMessage(), LOG_ERR);
+ }
+ if ($filter) print $filter;
+ else print $langs->trans("None");
}
print '
';
@@ -440,8 +456,10 @@
if ($allowaddtarget)
{
print '
';
- } else {
- print '
';
+ }
+ else
+ {
+ print '
';
//print $langs->trans("MailNoChangePossible");
print " ";
}
@@ -463,27 +481,11 @@
$sql .= " mc.source_url, mc.source_id, mc.source_type, mc.error_text";
$sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
$sql .= " WHERE mc.fk_mailing=".$object->id;
- $asearchcriteriahasbeenset = 0;
- if ($search_lastname) {
- $sql .= natural_search("mc.lastname", $search_lastname);
- $asearchcriteriahasbeenset++;
- }
- if ($search_firstname) {
- $sql .= natural_search("mc.firstname", $search_firstname);
- $asearchcriteriahasbeenset++;
- }
- if ($search_email) {
- $sql .= natural_search("mc.email", $search_email);
- $asearchcriteriahasbeenset++;
- }
- if ($search_other) {
- $sql .= natural_search("mc.other", $search_other);
- $asearchcriteriahasbeenset++;
- }
- if ($search_dest_status != '' && $search_dest_status >= -1) {
- $sql .= " AND mc.statut=".$db->escape($search_dest_status)." ";
- $asearchcriteriahasbeenset++;
- }
+ if ($search_lastname) $sql .= natural_search("mc.lastname", $search_lastname);
+ if ($search_firstname) $sql .= natural_search("mc.firstname", $search_firstname);
+ if ($search_email) $sql .= natural_search("mc.email", $search_email);
+ if ($search_other) $sql .= natural_search("mc.other", $search_other);
+ if ($search_dest_status != '' && $search_dest_status >= -1) $sql .= " AND mc.statut=".$db->escape($search_dest_status)." ";
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records
@@ -492,21 +494,10 @@
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
- if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
+ if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
+ {
$page = 0;
$offset = 0;
- }
-
- // Fix/update nbemail on emailing record if it differs (may happen if user edit lines from database directly)
- if (empty($asearchcriteriahasbeenset)) {
- if ($nbtotalofrecords != $object->nbemail) {
- dol_syslog("We found a difference in nb of record in target table and the property ->nbemail, we fix ->nbemail");
- //print "nbemail=".$object->nbemail." nbtotalofrecords=".$nbtotalofrecords;
- $resultrefresh = $object->refreshNbOfTargets();
- if ($resultrefresh < 0) {
- dol_print_error($db, $object->error, $object->errors);
- }
- }
}
}
@@ -530,7 +521,7 @@
print '
';
print '
';
print '
';
- print '
';
+ print '
';
print '
';
$morehtmlcenter = '';
@@ -548,7 +539,7 @@
print '
';
print '
';
print '
';
- print '
';
+ print '
';
print '
';
print '
';
@@ -638,30 +629,37 @@
print '
'.$obj->firstname.' | ';
print '
'.$obj->other.' | ';
print '
';
- if (empty($obj->source_id) || empty($obj->source_type))
- {
- print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
- } else {
- if ($obj->source_type == 'member')
- {
+ if (empty($obj->source_id) || empty($obj->source_type))
+ {
+ print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility
+ }
+ else
+ {
+ if ($obj->source_type == 'member')
+ {
$objectstaticmember->fetch($obj->source_id);
- print $objectstaticmember->getNomUrl(1);
- } elseif ($obj->source_type == 'user')
- {
+ print $objectstaticmember->getNomUrl(1);
+ }
+ elseif ($obj->source_type == 'user')
+ {
$objectstaticuser->fetch($obj->source_id);
- print $objectstaticuser->getNomUrl(1);
- } elseif ($obj->source_type == 'thirdparty')
- {
+ print $objectstaticuser->getNomUrl(1);
+ }
+ elseif ($obj->source_type == 'thirdparty')
+ {
$objectstaticcompany->fetch($obj->source_id);
- print $objectstaticcompany->getNomUrl(1);
- } elseif ($obj->source_type == 'contact')
- {
- $objectstaticcontact->fetch($obj->source_id);
- print $objectstaticcontact->getNomUrl(1);
- } else {
- print $obj->source_url;
- }
- }
+ print $objectstaticcompany->getNomUrl(1);
+ }
+ elseif ($obj->source_type == 'contact')
+ {
+ $objectstaticcontact->fetch($obj->source_id);
+ print $objectstaticcontact->getNomUrl(1);
+ }
+ else
+ {
+ print $obj->source_url;
+ }
+ }
print ' | ';
// Date last update
@@ -678,7 +676,9 @@
print '
';
print $object::libStatutDest($obj->statut, 2, '');
print ' | ';
- } else {
+ }
+ else
+ {
// Date sent
print '
'.$obj->date_envoi.' | ';
@@ -692,7 +692,7 @@
if ($obj->statut == 0) // Not sent yet
{
if ($user->rights->mailing->creer && $allowaddtarget) {
- print '
'.img_delete($langs->trans("RemoveRecipient")).'';
+ print '
'.img_delete($langs->trans("RemoveRecipient")).'';
}
}
/*if ($obj->statut == -1) // Sent with error
@@ -704,12 +704,14 @@
$i++;
}
- } else {
+ }
+ else
+ {
if ($object->statut < 2)
{
- print '
';
- print $langs->trans("NoTargetYet");
- print ' |
';
+ print '
';
+ print $langs->trans("NoTargetYet");
+ print ' |
';
}
}
print "