mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-03-28 23:53:09 +08:00
Fix contacts search
This commit is contained in:
parent
2c1087b987
commit
c3540bfdb1
3 changed files with 25 additions and 12 deletions
package.json
rainloop/v/0.0.0/app/libraries/RainLoop
|
@ -2,7 +2,7 @@
|
|||
"name": "RainLoop",
|
||||
"title": "RainLoop Webmail",
|
||||
"version": "1.6.1",
|
||||
"release": "626",
|
||||
"release": "627",
|
||||
"description": "Simple, modern & fast web-based email client",
|
||||
"homepage": "http://rainloop.net",
|
||||
"main": "Gruntfile.js",
|
||||
|
|
|
@ -4418,17 +4418,18 @@ class Actions
|
|||
$iOffset = 0 > $iOffset ? 0 : $iOffset;
|
||||
$iLimit = 0 > $iLimit ? 20 : $iLimit;
|
||||
|
||||
$iResultCount = 0;
|
||||
if ($this->PersonalAddressBookProvider($oAccount)->IsActive())
|
||||
{
|
||||
$iCount = 0;
|
||||
$iResultCount = 0;
|
||||
$mResult = $this->PersonalAddressBookProvider($oAccount)->GetContacts($oAccount->ParentEmailHelper(),
|
||||
$iOffset, $iLimit, $sSearch, $iCount);
|
||||
$iOffset, $iLimit, $sSearch, $iResultCount);
|
||||
}
|
||||
|
||||
return $this->DefaultResponse(__FUNCTION__, array(
|
||||
'Offset' => $iOffset,
|
||||
'Limit' => $iLimit,
|
||||
'Count' => $iCount,
|
||||
'Count' => $iResultCount,
|
||||
'Search' => $sSearch,
|
||||
'List' => $mResult
|
||||
));
|
||||
|
|
|
@ -390,24 +390,35 @@ class PdoPersonalAddressBook
|
|||
|
||||
if (0 < \strlen($sSearch))
|
||||
{
|
||||
$sCustomSearch = $this->specialConvertSearchValueCustomPhone($sSearch);
|
||||
if ('%%' === $sCustomSearch)
|
||||
{
|
||||
// TODO fix this
|
||||
$sCustomSearch = '';
|
||||
}
|
||||
|
||||
$sSql = 'SELECT id_user, id_prop, id_contact FROM rainloop_pab_properties '.
|
||||
'WHERE ('.
|
||||
'id_user = :id_user'.
|
||||
($this->bConsiderShare ? ' OR scope_type = :scope_type_share_all' : '').
|
||||
') AND (prop_value LIKE :search ESCAPE \'=\' OR ('.
|
||||
'prop_type IN ('.\implode(',', array(
|
||||
') AND (prop_value LIKE :search ESCAPE \'=\''.
|
||||
(0 < \strlen($sCustomSearch) ? ' OR (prop_type IN ('.\implode(',', array(
|
||||
PropertyType::PHONE_PERSONAL, PropertyType::PHONE_BUSSINES,
|
||||
PropertyType::MOBILE_PERSONAL, PropertyType::MOBILE_BUSSINES,
|
||||
PropertyType::FAX_PERSONAL, PropertyType::FAX_BUSSINES
|
||||
)).') AND prop_value_custom LIKE :search_custom_phone'.
|
||||
')) GROUP BY id_contact, id_prop';
|
||||
)).') AND prop_value_custom <> \'\' AND prop_value_custom LIKE :search_custom_phone)' : '').
|
||||
') GROUP BY id_contact, id_prop';
|
||||
|
||||
$aParams = array(
|
||||
':id_user' => array($iUserID, \PDO::PARAM_INT),
|
||||
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR),
|
||||
':search_custom_phone' => array($this->specialConvertSearchValueCustomPhone($sSearch), \PDO::PARAM_STR)
|
||||
':search' => array($this->specialConvertSearchValue($sSearch, '='), \PDO::PARAM_STR)
|
||||
);
|
||||
|
||||
if (0 < \strlen($sCustomSearch))
|
||||
{
|
||||
$aParams[':search_custom_phone'] = array($sCustomSearch, \PDO::PARAM_STR);
|
||||
}
|
||||
|
||||
if ($this->bConsiderShare)
|
||||
{
|
||||
$aParams[':scope_type_share_all'] = array(\RainLoop\Providers\PersonalAddressBook\Enumerations\ScopeType::SHARE_ALL, \PDO::PARAM_INT);
|
||||
|
@ -430,6 +441,7 @@ class PdoPersonalAddressBook
|
|||
}
|
||||
}
|
||||
|
||||
$aSearchIds = \array_unique($aSearchIds);
|
||||
$iCount = \count($aSearchIds);
|
||||
}
|
||||
}
|
||||
|
@ -465,8 +477,8 @@ class PdoPersonalAddressBook
|
|||
if (0 < $iCount)
|
||||
{
|
||||
$sSql = 'SELECT * FROM rainloop_pab_contacts '.
|
||||
'WHERE id_user = :id_user'.
|
||||
($this->bConsiderShare ? ' OR scope_type = :scope_type_share_all' : '')
|
||||
'WHERE (id_user = :id_user'.
|
||||
($this->bConsiderShare ? ' OR scope_type = :scope_type_share_all)' : ')')
|
||||
;
|
||||
|
||||
$aParams = array(
|
||||
|
|
Loading…
Add table
Reference in a new issue