Fix sort of list and number of records
This commit is contained in:
parent
8a5bafc2dd
commit
385aca8bf2
@ -52,7 +52,7 @@ $offset = $conf->liste_limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder="DESC";
|
||||
if (! $sortfield) $sortfield="a.daten";
|
||||
if (! $sortfield) $sortfield="n.daten";
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
@ -264,8 +264,30 @@ if ($result > 0)
|
||||
print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
// List of notifications enabled for contacts
|
||||
$sql = "SELECT n.rowid, n.type,";
|
||||
$sql.= " a.code, a.label,";
|
||||
$sql.= " c.rowid as contactid, c.lastname, c.firstname, c.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople c";
|
||||
$sql.= " WHERE a.rowid = n.fk_action";
|
||||
$sql.= " AND c.rowid = n.fk_contact";
|
||||
$sql.= " AND c.fk_soc = ".$object->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// List of active notifications
|
||||
print load_fiche_titre($langs->trans("ListOfActiveNotifications"),'','');
|
||||
print load_fiche_titre($langs->trans("ListOfActiveNotifications").' ('.$num.')','','');
|
||||
$var=true;
|
||||
|
||||
// Line with titles
|
||||
@ -280,21 +302,8 @@ if ($result > 0)
|
||||
$langs->load("errors");
|
||||
$langs->load("other");
|
||||
|
||||
// List of notifications enabled for contacts
|
||||
$sql = "SELECT n.rowid, n.type,";
|
||||
$sql.= " a.code, a.label,";
|
||||
$sql.= " c.rowid as contactid, c.lastname, c.firstname, c.email";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger as a,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."socpeople c";
|
||||
$sql.= " WHERE a.rowid = n.fk_action";
|
||||
$sql.= " AND c.rowid = n.fk_contact";
|
||||
$sql.= " AND c.fk_soc = ".$object->id;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
if ($num)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
$contactstatic=new Contact($db);
|
||||
@ -336,10 +345,6 @@ if ($result > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// List of notifications enabled for fixed email
|
||||
/*
|
||||
@ -395,20 +400,6 @@ if ($result > 0)
|
||||
print '<br>';
|
||||
|
||||
|
||||
// List of notifications done
|
||||
print load_fiche_titre($langs->trans("ListOfNotificationsDone"),'','');
|
||||
$var=true;
|
||||
|
||||
// Line with titles
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.titre",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.daten",'',$param,'align="right"',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
// List
|
||||
$sql = "SELECT n.rowid, n.daten, n.email, n.objet_type as object_type, n.objet_id as object_id, n.type,";
|
||||
$sql.= " c.rowid as id, c.lastname, c.firstname, c.email as contactemail,";
|
||||
@ -418,11 +409,34 @@ if ($result > 0)
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as c ON n.fk_contact = c.rowid";
|
||||
$sql.= " WHERE a.rowid = n.fk_action";
|
||||
$sql.= " AND n.fk_soc = ".$object->id;
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// List of notifications done
|
||||
print load_fiche_titre($langs->trans("ListOfNotificationsDone").' ('.$num.')','','');
|
||||
$var=true;
|
||||
|
||||
// Line with titles
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Target"),$_SERVER["PHP_SELF"],"c.lastname,c.firstname",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"",'',$param,'',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"n.type",'',$param,'',$sortfield,$sortorder);
|
||||
//print_liste_field_titre($langs->trans("Object"),$_SERVER["PHP_SELF"],"",'',$param,'"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"n.daten",'',$param,'align="right"',$sortfield,$sortorder);
|
||||
print '</tr>';
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
|
||||
$contactstatic=new Contact($db);
|
||||
@ -471,10 +485,6 @@ if ($result > 0)
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user