Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
archivesCourrier
Commits
05b5662d
Commit
05b5662d
authored
Aug 29, 2017
by
Alexandre Morin
Browse files
Merge branch 'master' of labs.maarch.org:maarch/archivesCourrier
parents
60a4059e
2f79e53e
Changes
2
Hide whitespace changes
Inline
Side-by-side
bundle/archivesCourrier/Controller/Content.php
View file @
05b5662d
...
...
@@ -34,8 +34,8 @@ class content
* Recherche d'un contenu d'archive
* @param string $query
* @param bool $hasParent
* @param date $
sentD
ateFrom
* @param date $
sentD
ateTo
* @param date $
d
ateFrom
* @param date $
d
ateTo
* @param string $originatorOrgRegNumber
*
* @return Array Array of archive description
...
...
@@ -43,8 +43,8 @@ class content
public
function
find
(
$query
=
null
,
$hasParent
=
false
,
$
sentD
ateFrom
=
null
,
$
sentD
ateTo
=
null
,
$
d
ateFrom
=
null
,
$
d
ateTo
=
null
,
$originatorOrgRegNumber
=
null
)
{
$queryParts
=
array
();
...
...
@@ -63,31 +63,46 @@ class content
$queryParts
[
'term'
]
=
"<?SQL text @@ to_tsquery('"
.
implode
(
' & '
,
$tokens
)
.
"') ?>"
;
}
// content description
if
(
$sentDateFrom
&&
$sentDateTo
)
{
$queryParams
[
'sentDateFrom'
]
=
$sentDateFrom
;
$queryParams
[
'sentDateTo'
]
=
$sentDateTo
;
$queryParts
[
'date'
]
=
"sentDateTo >= :sentDateFrom AND sentDateFrom <= :sentDateTo"
;
}
elseif
(
$sentDateFrom
)
{
$queryParams
[
'sentDateFrom'
]
=
$sentDateFrom
;
$queryParts
[
'date'
]
=
"sentDateFrom >= :sentDateFrom"
;
}
elseif
(
$sentDateTo
)
{
$queryParams
[
'sentDateTo'
]
=
$sentDateTo
;
$queryParts
[
'date'
]
=
"sentDateTo <= :sentDateTo"
;
}
if
(
$originatorOrgRegNumber
)
{
$queryParams
[
'originatorOrgRegNumber'
]
=
$originatorOrgRegNumber
;
$queryParts
[
'originatorOrgRegNumber'
]
=
"originatorOrgRegNumber = :originatorOrgRegNumber"
;
}
if
(
$hasParent
===
true
)
{
$queryParts
[
'hasParent'
]
=
"parentArchiveId!=null"
;
}
// Search forlders
if
(
$hasParent
===
false
)
{
$queryParts
[
'hasParent'
]
=
"parentArchiveId=null"
;
if
(
$dateFrom
&&
$dateTo
)
{
$queryParams
[
'dateFrom'
]
=
$dateFrom
;
$queryParams
[
'dateTo'
]
=
$dateTo
;
$queryParts
[
'date'
]
=
"endDate >= :dateFrom AND startDate <= :dateTo"
;
}
elseif
(
$dateFrom
)
{
$queryParams
[
'dateFrom'
]
=
$dateFrom
;
$queryParts
[
'date'
]
=
"endDate >= :dateFrom"
;
}
elseif
(
$dateTo
)
{
$queryParams
[
'dateTo'
]
=
$dateTo
;
$queryParts
[
'date'
]
=
"startDate <= :dateTo"
;
}
}
// Search mails and attachments
if
(
$hasParent
===
true
)
{
$queryParts
[
'hasParent'
]
=
"parentArchiveId!=null"
;
if
(
$dateFrom
&&
$dateTo
)
{
$queryParams
[
'dateFrom'
]
=
$dateFrom
;
$queryParams
[
'dateTo'
]
=
$dateTo
;
$queryParts
[
'date'
]
=
"sentDate >= :dateFrom AND sentDate <= :dateTo"
;
}
elseif
(
$dateFrom
)
{
$queryParams
[
'dateFrom'
]
=
$dateFrom
;
$queryParts
[
'date'
]
=
"sentDate >= :dateFrom"
;
}
elseif
(
$dateTo
)
{
$queryParams
[
'dateTo'
]
=
$dateTo
;
$queryParts
[
'date'
]
=
"sentDate <= :dateTo"
;
}
}
$queryString
=
\
laabs\implode
(
' AND '
,
$queryParts
);
...
...
bundle/archivesCourrier/contentInterface.php
0 → 100644
View file @
05b5662d
<?php
/*
* Copyright (C) 2015 Maarch
*
* This file is part of bundle archivesCourrier.
*
* Bundle archivesCourrier is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bundle archivesCourrier is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with bundle archivesCourrier. If not, see <http://www.gnu.org/licenses/>.
*/
namespace
ext\archivesCourrier\bundle\archivesCourrier
;
/**
* Interface pour l'index des courriers archivés
*
* @package ArchivesCourrier
* @author Cyril Vazquez <cyril.vazquez@maarch.org>
*/
interface
contentInterface
{
/**
* Recherche d'un contenu d'archive
* @param string $query
* @param bool $hasParent
* @param date $dateFrom
* @param date $dateTo
* @param string $originatorOrgRegNumber
*
* @action archivesCourrier/content/find
*
* @return Array Array of archive description
*/
public
function
readSearch
(
$query
=
null
,
$hasParent
=
false
,
$dateFrom
=
null
,
$dateTo
=
null
,
$originatorOrgRegNumber
=
null
);
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment