diff --git a/src/EcclesiaCRM/APIControllers/PeopleAttendeesController.php b/src/EcclesiaCRM/APIControllers/PeopleAttendeesController.php
index a00125566..a30077ce6 100644
--- a/src/EcclesiaCRM/APIControllers/PeopleAttendeesController.php
+++ b/src/EcclesiaCRM/APIControllers/PeopleAttendeesController.php
@@ -314,6 +314,7 @@ public function attendeesEvent(ServerRequest $request, Response $response, array
$item['isCheckinDate'] = (!is_null($per->getCheckinDate())) ? "checked" : "";
$item['checkoutDate'] = (!empty($per->getCheckoutDate())) ? OutputUtils::FormatDate($per->getCheckoutDate()->format("Y-m-d H:i:s"), 1) : "";
$item['isCheckoutDate'] = (!is_null($per->getCheckoutDate())) ? "checked" : "";
+ $item['img'] = $checkedInPerson->getJPGPhotoDatas();
if (is_null($checkedInPerson)) {// we have to avoid pure user and not persons
continue;
diff --git a/src/EcclesiaCRM/APIControllers/PeopleGroupController.php b/src/EcclesiaCRM/APIControllers/PeopleGroupController.php
index 51de5fa85..cb24f9349 100644
--- a/src/EcclesiaCRM/APIControllers/PeopleGroupController.php
+++ b/src/EcclesiaCRM/APIControllers/PeopleGroupController.php
@@ -10,6 +10,7 @@
namespace EcclesiaCRM\APIControllers;
+use EcclesiaCRM\Base\FamilyQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;
@@ -397,19 +398,21 @@ public function groupMembers (ServerRequest $request, Response $response, array
}
$groupID = $args['groupID'];
- $members = Person2group2roleP2g2rQuery::create()
+ $membersArray = Person2group2roleP2g2rQuery::create()
->joinWithPerson()
->usePersonQuery()
->filterByDateDeactivated(null)// GDRP, when a person is completely deactivated
->endUse()
- ->findByGroupId($groupID);
+ ->findByGroupId($groupID)->toArray();
- // we loop to find the information in the family to add adresses etc ... this is now unusefull, the address is created automatically
- foreach ($members as $member)
+ // we loop to find the information in the family to add adresses etc ... this is now unusefull, the address is created automatically
+ $res = [];
+
+ foreach ($membersArray as $member)
{
- $p = $member->getPerson();
- $fam = $p->getFamily();
+ $fam = FamilyQuery::create()->findOneById($member['PersonId']);
+ $per = PersonQuery::create()->findOneById($member['PersonId']);
// Philippe Logel : this is usefull when a person don't have a family : ie not an address
if (!is_null($fam)
@@ -420,16 +423,18 @@ public function groupMembers (ServerRequest $request, Response $response, array
&& !is_null($fam->getZip())
)
{
- $p->setAddress1 ($fam->getAddress1());
- $p->setAddress2 ($fam->getAddress2());
-
- $p->setCity($fam->getCity());
- $p->setState($fam->getState());
- $p->setZip($fam->getZip());
+ $member['Person']['Address1']= $fam->getAddress1();
+ $member['Person']['Address2']= $fam->getAddress2();
+ $member['Person']['City']= $fam->getCity();
+ $member['Person']['State']= $fam->getState();
+ $member['Person']['Zip']= $fam->getZip();
+ $member['Person']['img']= $per->getJPGPhotoDatas();
+
+ $res[] = $member;
}
}
- return $response->write($members->toJSON());
+ return $response->withJson(['Person2group2roleP2g2rs' => $res]);
}
public function groupEvents (ServerRequest $request, Response $response, array $args): Response {
diff --git a/src/EcclesiaCRM/APIControllers/PeoplePersonController.php b/src/EcclesiaCRM/APIControllers/PeoplePersonController.php
index 145562995..f0b27e921 100644
--- a/src/EcclesiaCRM/APIControllers/PeoplePersonController.php
+++ b/src/EcclesiaCRM/APIControllers/PeoplePersonController.php
@@ -209,7 +209,7 @@ public function personCartView (ServerRequest $request, Response $response, arra
}
$personName = $person->getFirstName() . ' ' . $person->getLastName();
- $thumbnail = SystemURLs::getRootPath() . '/api/persons/' . $person->getId() . '/thumbnail';
+ $thumbnail = $person->getJPGPhotoDatas();
$res[] = ['personID' => $person->getId(),
'Address1' => $sAddress1,
@@ -541,7 +541,10 @@ public function notInMailChimpEmails (ServerRequest $request, Response $response
foreach ($persons as $Person) {
$mailchimpList = $mailchimp->getListNameFromEmail($Person->getEmail());
if ($mailchimpList == '') {
- array_push($missingEmailInMailChimp, ["id" => $Person->getId(), "url" => '' . $family->getSaluation() . '', "email" => $Person->getEmail()]);
+ array_push($missingEmailInMailChimp,
+ ["id" => $Person->getId(),
+ "img" => $Person->getJPGPhotoDatas(),
+ "url" => '' . $family->getSaluation() . '', "email" => $Person->getEmail()]);
}
}
}
@@ -556,7 +559,10 @@ public function notInMailChimpEmails (ServerRequest $request, Response $response
foreach ($People as $Person) {
$mailchimpList = $mailchimp->getListNameFromEmail($Person->getEmail());
if ($mailchimpList == '') {
- array_push($missingEmailInMailChimp, ["id" => $Person->getId(), "url" => '' . $Person->getFullName() . '', "email" => $Person->getEmail()]);
+ array_push($missingEmailInMailChimp,
+ ["id" => $Person->getId(),
+ "img" => $Person->getJPGPhotoDatas(),
+ "url" => '' . $Person->getFullName() . '', "email" => $Person->getEmail()]);
}
}
}
diff --git a/src/EcclesiaCRM/APIControllers/SearchController.php b/src/EcclesiaCRM/APIControllers/SearchController.php
index 6b52b9e56..bfcc8ff6c 100644
--- a/src/EcclesiaCRM/APIControllers/SearchController.php
+++ b/src/EcclesiaCRM/APIControllers/SearchController.php
@@ -10,7 +10,6 @@
namespace EcclesiaCRM\APIControllers;
-use EcclesiaCRM\Utils\LoggerUtils;
use EcclesiaCRM\VolunteerOpportunityQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
diff --git a/src/EcclesiaCRM/APIControllers/SundaySchoolController.php b/src/EcclesiaCRM/APIControllers/SundaySchoolController.php
index 0e88ac51a..e84a68cff 100644
--- a/src/EcclesiaCRM/APIControllers/SundaySchoolController.php
+++ b/src/EcclesiaCRM/APIControllers/SundaySchoolController.php
@@ -10,6 +10,7 @@
namespace EcclesiaCRM\APIControllers;
+use EcclesiaCRM\Base\PersonQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;
@@ -38,6 +39,10 @@ public function getallstudentsForGroup (ServerRequest $request, Response $respon
$children['inCart']=0;
}
+ $per = PersonQuery::create()->findOneById($children['kidId']);
+
+ $children['img'] = $per->getJPGPhotoDatas(50,50);
+
$result[] = $children;
}
diff --git a/src/EcclesiaCRM/Search/AddressSearchRes.php b/src/EcclesiaCRM/Search/AddressSearchRes.php
index f852ac0e0..52d4f7600 100644
--- a/src/EcclesiaCRM/Search/AddressSearchRes.php
+++ b/src/EcclesiaCRM/Search/AddressSearchRes.php
@@ -140,7 +140,7 @@ public function buildSearch(string $qry)
} else {
$elt = [
"id" => $address->getId(),
- "img" => '
',
+ "img" => $address->getJPGPhotoDatas(),
"searchresult" => _("Addresse") . ' : ' . $address->getName() . '' . " " . _("Members") . " :
" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address->getAddress(),
"type" => _($this->getGlobalSearchType()),
@@ -157,7 +157,7 @@ public function buildSearch(string $qry)
}
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/DepositSearchRes.php b/src/EcclesiaCRM/Search/DepositSearchRes.php
index a42a497c6..9ce140103 100644
--- a/src/EcclesiaCRM/Search/DepositSearchRes.php
+++ b/src/EcclesiaCRM/Search/DepositSearchRes.php
@@ -100,7 +100,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/FamilyCustomSearchRes.php b/src/EcclesiaCRM/Search/FamilyCustomSearchRes.php
index 58df4da0c..d29bb62c3 100644
--- a/src/EcclesiaCRM/Search/FamilyCustomSearchRes.php
+++ b/src/EcclesiaCRM/Search/FamilyCustomSearchRes.php
@@ -4,7 +4,6 @@
use EcclesiaCRM\dto\Cart;
use EcclesiaCRM\dto\SystemURLs;
-use EcclesiaCRM\Person2group2roleP2g2rQuery;
use EcclesiaCRM\Search\BaseSearchRes;
use EcclesiaCRM\Base\FamilyCustomMasterQuery;
use EcclesiaCRM\Base\FamilyCustomQuery;
@@ -129,7 +128,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $fam->getFamily()->getId(),
- "img" =>'
',
+ "img" => $fam->getFamily()->getJPGPhotoDatas(),
"searchresult" => _("Family").' : '.$fam->getFamily()->getName().''." "._("Members")." :
".$globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled())?_('Private Data'):$fam->getFamily()->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => _($this->getGlobalSearchType()),
@@ -147,7 +146,7 @@ public function buildSearch(string $qry)
}
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/FamilyPastoralCareSearchRes.php b/src/EcclesiaCRM/Search/FamilyPastoralCareSearchRes.php
index e4d3d8877..7dc228cb2 100644
--- a/src/EcclesiaCRM/Search/FamilyPastoralCareSearchRes.php
+++ b/src/EcclesiaCRM/Search/FamilyPastoralCareSearchRes.php
@@ -121,7 +121,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $care->getFamily()->getId(),
- "img" => '
',
+ "img" => $care->getFamily()->getJPGPhotoDatas(),
"searchresult" => _("Family Pastoral Care") . ' : ' . $care->getFamily()->getName() . '' . " " . _("Members") . " :
" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $care->getFamily()->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => " " . _($this->getGlobalSearchType()),
@@ -138,7 +138,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/FamilyPropsSearchRes.php b/src/EcclesiaCRM/Search/FamilyPropsSearchRes.php
index 5001f8ee1..dfc64c0e2 100644
--- a/src/EcclesiaCRM/Search/FamilyPropsSearchRes.php
+++ b/src/EcclesiaCRM/Search/FamilyPropsSearchRes.php
@@ -133,7 +133,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $family->getId(),
- "img" => '
',
+ "img" => $family->getJPGPhotoDatas(),
"searchresult" => _("Family") . ' : ' . $family->getName() . '' . " " . _("Members") . " :
" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $family->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => _($this->getGlobalSearchType()),
@@ -150,7 +150,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/FamilySearchRes.php b/src/EcclesiaCRM/Search/FamilySearchRes.php
index 7e7a86e1a..8e20f4b45 100644
--- a/src/EcclesiaCRM/Search/FamilySearchRes.php
+++ b/src/EcclesiaCRM/Search/FamilySearchRes.php
@@ -162,7 +162,7 @@ public function buildSearch(string $qry)
} elseif ( $isGlobalSearch ) {
$elt = [
"id" => $family->getId(),
- "img" => '
',
+ "img" => $family->getJPGPhotoDatas(),
"searchresult" => _("Family") . ' : ' . $family->getName() . '' . " " . _("Members") . " :
" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $family->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => (mb_strtolower($qry) == mb_strtolower(_('single')) || mb_strtolower($qry) == mb_strtolower(_('singles'))) ? _("Singles") : _($this->getGlobalSearchType()),
@@ -180,7 +180,7 @@ public function buildSearch(string $qry)
}
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/GroupPropsSearchRes.php b/src/EcclesiaCRM/Search/GroupPropsSearchRes.php
index f6664b1e4..bc205ad3a 100644
--- a/src/EcclesiaCRM/Search/GroupPropsSearchRes.php
+++ b/src/EcclesiaCRM/Search/GroupPropsSearchRes.php
@@ -138,7 +138,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/GroupSearchRes.php b/src/EcclesiaCRM/Search/GroupSearchRes.php
index 90d7ebcbf..257207ca9 100644
--- a/src/EcclesiaCRM/Search/GroupSearchRes.php
+++ b/src/EcclesiaCRM/Search/GroupSearchRes.php
@@ -139,7 +139,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PaymentSearchRes.php b/src/EcclesiaCRM/Search/PaymentSearchRes.php
index 14665cc95..1cc7d0b03 100644
--- a/src/EcclesiaCRM/Search/PaymentSearchRes.php
+++ b/src/EcclesiaCRM/Search/PaymentSearchRes.php
@@ -66,7 +66,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonAssignToGroupSearchRes.php b/src/EcclesiaCRM/Search/PersonAssignToGroupSearchRes.php
index 5dd6d668d..f765b8eb3 100644
--- a/src/EcclesiaCRM/Search/PersonAssignToGroupSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonAssignToGroupSearchRes.php
@@ -132,7 +132,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getPerson()->getId(),
- "img" => '
',
+ "img" => $per->getPerson()->getJPGPhotoDatas(),
"searchresult" => '' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(),
$per->getPerson()->getSuffix(), 3) . ' ('.$per->getgroupName().')',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
@@ -150,7 +150,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonCustomSearchRes.php b/src/EcclesiaCRM/Search/PersonCustomSearchRes.php
index 06403c7d5..8800bcd1f 100644
--- a/src/EcclesiaCRM/Search/PersonCustomSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonCustomSearchRes.php
@@ -128,7 +128,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getPerson()->getId(),
- "img" => '
',
+ "img" => $per->getJPGPhotoDatas(),
"searchresult" => '' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(), $per->getPerson()->getSuffix(), 3) . '',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
"type" => " " . _($this->getGlobalSearchType()),
@@ -147,7 +147,7 @@ public function buildSearch(string $qry)
}
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonGroupManagerSearchRes.php b/src/EcclesiaCRM/Search/PersonGroupManagerSearchRes.php
index 770364bfa..9831430bc 100644
--- a/src/EcclesiaCRM/Search/PersonGroupManagerSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonGroupManagerSearchRes.php
@@ -134,7 +134,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getPerson()->getId(),
- "img" => '
',
+ "img" => $per->getPerson()->getJPGPhotoDatas(),
"searchresult" => _("Group")." : ". ''.$per->getGroup()->getName().''
." (".'' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(), $per->getPerson()->getSuffix(), 3) . ''.")",
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
@@ -153,7 +153,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonPastoralCareSearchRes.php b/src/EcclesiaCRM/Search/PersonPastoralCareSearchRes.php
index 3536cedbd..6ebdfde4a 100644
--- a/src/EcclesiaCRM/Search/PersonPastoralCareSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonPastoralCareSearchRes.php
@@ -126,7 +126,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getId(),
- "img" => '
',
+ "img" => $per->getJPGPhotoDatas(),
"searchresult" => ''.OutputUtils::FormatFullName($per->getTitle(), $per->getFirstName(), $per->getMiddleName(), $per->getLastName(), $per->getSuffix(), 3).'',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled())?_('Private Data'):$address,
"type" => " "._($this->getGlobalSearchType()),
@@ -143,7 +143,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonPropsSearchRes.php b/src/EcclesiaCRM/Search/PersonPropsSearchRes.php
index c2e104a78..3eedb513a 100644
--- a/src/EcclesiaCRM/Search/PersonPropsSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonPropsSearchRes.php
@@ -141,7 +141,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getId(),
- "img" => '
',
+ "img" => $per->getJPGPhotoDatas(),
"searchresult" => ''.OutputUtils::FormatFullName($per->getTitle(), $per->getFirstName(), $per->getMiddleName(), $per->getLastName(), $per->getSuffix(), 3).'',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled())?_('Private Data'):$address,
"type" => " "._($this->getGlobalSearchType()),
@@ -158,7 +158,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonSearchRes.php b/src/EcclesiaCRM/Search/PersonSearchRes.php
index 670376737..7ad70030d 100644
--- a/src/EcclesiaCRM/Search/PersonSearchRes.php
+++ b/src/EcclesiaCRM/Search/PersonSearchRes.php
@@ -329,8 +329,8 @@ public function buildSearch(string $qry)
} else {
$elt = [
'id' => $person->getId(),
+ "img" => $person->getJPGPhotoDatas(),
'searchresult' => '' . OutputUtils::FormatFullName($person->getTitle(), $person->getFirstName(), $person->getMiddleName(), $person->getLastName(), $person->getSuffix(), 3) . '',
- 'img' => '
',
'address' => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
'type' => _($this->getGlobalSearchType()),
'realType' => $this->getGlobalSearchType(),
@@ -372,7 +372,7 @@ public function buildSearch(string $qry)
}
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PersonVolunteerOpportunitySearch.php b/src/EcclesiaCRM/Search/PersonVolunteerOpportunitySearch.php
index 9da47e98f..8eac20735 100644
--- a/src/EcclesiaCRM/Search/PersonVolunteerOpportunitySearch.php
+++ b/src/EcclesiaCRM/Search/PersonVolunteerOpportunitySearch.php
@@ -120,8 +120,7 @@ public function buildSearch(string $qry)
$elt = [
"id" => $per->getId(),
- "img" => '
',
- "searchresult" => ''.OutputUtils::FormatFullName($per->getTitle(), $per->getFirstName(), $per->getMiddleName(), $per->getLastName(), $per->getSuffix(), 3).' ('.$per->getOpportunityName().")",
+ "img" => $per->getJPGPhotoDatas(),
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled())?_('Private Data'):$address,
"type" => " "._($this->getGlobalSearchType()),
"realType" => $this->getGlobalSearchType(),
@@ -137,7 +136,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/PledgeSearchRes.php b/src/EcclesiaCRM/Search/PledgeSearchRes.php
index 3de4d1779..9c955651e 100644
--- a/src/EcclesiaCRM/Search/PledgeSearchRes.php
+++ b/src/EcclesiaCRM/Search/PledgeSearchRes.php
@@ -98,7 +98,7 @@ public function buildSearch(string $qry)
array_push($this->results, $elt);
}
}
- } catch (Exception $e) {
+ } catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
diff --git a/src/EcclesiaCRM/Search/SearchRes.php b/src/EcclesiaCRM/Search/SearchRes.php
index f0ff697f9..8ec2793c2 100644
--- a/src/EcclesiaCRM/Search/SearchRes.php
+++ b/src/EcclesiaCRM/Search/SearchRes.php
@@ -2,8 +2,6 @@
namespace EcclesiaCRM\Search;
-use EcclesiaCRM\Utils\LoggerUtils;
-
class SearchRes implements \JsonSerializable {
protected $name;
protected $array;
diff --git a/src/EcclesiaCRM/Service/SundaySchoolService.php b/src/EcclesiaCRM/Service/SundaySchoolService.php
index fa3d13f34..2c6797ef0 100644
--- a/src/EcclesiaCRM/Service/SundaySchoolService.php
+++ b/src/EcclesiaCRM/Service/SundaySchoolService.php
@@ -2,6 +2,7 @@
namespace EcclesiaCRM\Service;
+use EcclesiaCRM\Base\PersonQuery;
use Propel\Runtime\Propel;
class SundaySchoolService
@@ -77,6 +78,10 @@ public function getClassByRole($groupId, $role)
$members = [];
while ($row = $statement->fetch(\PDO::FETCH_BOTH)) {
+ $per = PersonQuery::create()->findOneById($row['per_ID']);
+ $img = $per->getJPGPhotoDatas();
+ $row['img'] = $img;
+
array_push($members, $row);
}
diff --git a/src/EcclesiaCRM/Synchronize/FamilyDashboardItem.php b/src/EcclesiaCRM/Synchronize/FamilyDashboardItem.php
index dfcf8d433..08e3fda8e 100644
--- a/src/EcclesiaCRM/Synchronize/FamilyDashboardItem.php
+++ b/src/EcclesiaCRM/Synchronize/FamilyDashboardItem.php
@@ -4,10 +4,7 @@
use EcclesiaCRM\Synchronize\DashboardItemInterface;
use EcclesiaCRM\FamilyQuery;
-use EcclesiaCRM\SessionUser;
use Propel\Runtime\ActiveQuery\Criteria;
-use EcclesiaCRM\Map\PersonTableMap;
-use EcclesiaCRM\Map\FamilyTableMap;
use EcclesiaCRM\Service\PastoralCareService;
class FamilyDashboardItem implements DashboardItemInterface {
@@ -44,27 +41,27 @@ private static function getCountFamilies()
* @param int $limit
* @return array|\EcclesiaCRM\Family[]|mixed|\Propel\Runtime\ActiveRecord\ActiveRecordInterface[]|\Propel\Runtime\Collection\ObjectCollection
*/
- private static function getUpdatedFamilies($limit = 6) {
+ private static function getUpdatedFamilies($limit = 6) : array {
$families = FamilyQuery::create()
->filterByDateDeactivated(null)
->filterByDateLastEdited(null, Criteria::NOT_EQUAL)
->orderByDateLastEdited('DESC')
->limit($limit)
- ->select(array("Id","Name","Address1","DateEntered","DateLastEdited"))
- ->find()->toArray();
-
- if (!SessionUser::getUser()->isSeePrivacyDataEnabled()) {
- $res = [];
-
- foreach ($families as $family) {
- $family["Address1"] = gettext("Private Data");
- $res[] = $family;
- }
-
- return $res;
+ ->find();
+
+ $res = [];
+ foreach ($families as $family) {
+ $res[] = [
+ 'Id' => $family->getId(),
+ 'Name' => $family->getName(),
+ 'Address1' => $family->getAddress(),
+ 'DateEntered' => (!is_null($family->getDateEntered())?$family->getDateEntered()->format('Y-m-d h:i'):''),
+ 'DateLastEdited' => (!is_null($family->getDateLastEdited())?$family->getDateLastEdited()->format('Y-m-d h:i'):''),
+ 'img' => $family->getJPGPhotoDatas()
+ ];
}
- return $families;
+ return $res;
}
/**
@@ -72,32 +69,32 @@ private static function getUpdatedFamilies($limit = 6) {
* @param int $limit
* @return array|\EcclesiaCRM\Family[]|mixed|\Propel\Runtime\ActiveRecord\ActiveRecordInterface[]|\Propel\Runtime\Collection\ObjectCollection
*/
- private static function getLatestFamilies($limit = 6) {
+ private static function getLatestFamilies($limit = 6) : array {
$families = FamilyQuery::create()
->filterByDateDeactivated(null)
->orderByDateEntered('DESC')
->limit($limit)
- ->select(array("Id","Name","Address1","DateEntered","DateLastEdited"))
- ->find()->toArray();
-
-
- if (!SessionUser::getUser()->isSeePrivacyDataEnabled()) {
- $res = [];
-
- foreach ($families as $family) {
- $family["Address1"] = gettext("Private Data");
- $res[] = $family;
- }
-
- return $res;
+ ->find();
+
+
+ $res = [];
+ foreach ($families as $family) {
+ $res[] = [
+ 'Id' => $family->getId(),
+ 'Name' => $family->getName(),
+ 'Address1' => $family->getAddress(),
+ 'DateEntered' => (!is_null($family->getDateEntered())?$family->getDateEntered()->format('Y-m-d h:i'):''),
+ 'DateLastEdited' => (!is_null($family->getDateLastEdited())?$family->getDateLastEdited()->format('Y-m-d h:i'):''),
+ 'img' => $family->getJPGPhotoDatas()
+ ];
}
- return $families;
+ return $res;
}
public static function shouldInclude($PageName) {
return $PageName == "/v2/dashboard" || $PageName == "/menu"|| $PageName == "/v2/people/dashboard"; // this ID would be found on all pages.
}
-}
+}
\ No newline at end of file
diff --git a/src/EcclesiaCRM/Synchronize/PersonDashboardItem.php b/src/EcclesiaCRM/Synchronize/PersonDashboardItem.php
index 95f2789e3..60a702eb1 100644
--- a/src/EcclesiaCRM/Synchronize/PersonDashboardItem.php
+++ b/src/EcclesiaCRM/Synchronize/PersonDashboardItem.php
@@ -14,8 +14,8 @@ public static function getDashboardItemName() {
public static function getDashboardItemValue() {
$data = ['personCount' => self::getMembersCount(),
- 'LatestPersons' => self::getLatestMembers()->toArray(),
- 'UpdatedPerson' => self::getUpdatedMembers()->toArray()];
+ 'LatestPersons' => self::getLatestMembers(),
+ 'UpdatedPerson' => self::getUpdatedMembers()];
return $data;
}
@@ -25,7 +25,7 @@ public static function getDashboardItemValue() {
* @param int $limit
* @return array|\EcclesiaCRM\Person[]|mixed|\Propel\Runtime\ActiveRecord\ActiveRecordInterface[]|\Propel\Runtime\Collection\ObjectCollection
*/
- public static function getMembersCount()
+ public static function getMembersCount() : int
{
return PersonQuery::Create('per')
->filterByDateDeactivated(null)
@@ -40,15 +40,30 @@ public static function getMembersCount()
* @param int $limit
* @return array|\EcclesiaCRM\Person[]|mixed|\Propel\Runtime\ActiveRecord\ActiveRecordInterface[]|\Propel\Runtime\Collection\ObjectCollection
*/
- public static function getUpdatedMembers($limit = 6)
+ public static function getUpdatedMembers($limit = 6) : array
{
- return PersonQuery::create()
+ $persons = PersonQuery::create()
->filterByDateDeactivated(null)// GDRP, when a person is completely deactivated
->leftJoinWithFamily()
->where('Family.DateDeactivated is null')
->orderByDateLastEdited('DESC')
->limit($limit)
->find();
+
+ $res = [];
+ foreach ($persons as $person) {
+ $res[] = [
+ 'Id' => $person->getId(),
+ 'LastName' => $person->getLastName(),
+ 'FirstName' => $person->getFirstName(),
+ 'Address1' => $person->getAddress(),
+ 'DateEntered' => (!is_null($person->getDateEntered())?$person->getDateEntered()->format('Y-m-d h:i'):''),
+ 'DateLastEdited' => (!is_null($person->getDateLastEdited())?$person->getDateLastEdited()->format('Y-m-d h:i'):''),
+ 'img' => $person->getJPGPhotoDatas()
+ ];
+ }
+
+ return $res;
}
/**
@@ -56,9 +71,9 @@ public static function getUpdatedMembers($limit = 6)
* @param int $limit
* @return array|\EcclesiaCRM\Person[]|mixed|\Propel\Runtime\ActiveRecord\ActiveRecordInterface[]|\Propel\Runtime\Collection\ObjectCollection
*/
- public static function getLatestMembers($limit = 6)
+ public static function getLatestMembers($limit = 6) : array
{
- return PersonQuery::create()
+ $persons = PersonQuery::create()
->filterByDateDeactivated(null)// GDRP, when a person is completely deactivated
->leftJoinWithFamily()
->where('Family.DateDeactivated is null')
@@ -66,6 +81,21 @@ public static function getLatestMembers($limit = 6)
->orderByDateEntered('DESC')
->limit($limit)
->find();
+
+ $res = [];
+ foreach ($persons as $person) {
+ $res[] = [
+ 'Id' => $person->getId(),
+ 'LastName' => $person->getLastName(),
+ 'FirstName' => $person->getFirstName(),
+ 'Address1' => $person->getAddress(),
+ 'DateEntered' => (!is_null($person->getDateEntered())?$person->getDateEntered()->format('Y-m-d h:i'):''),
+ 'DateLastEdited' => (!is_null($person->getDateLastEdited())?$person->getDateLastEdited()->format('Y-m-d h:i'):''),
+ 'img' => $person->getJPGPhotoDatas()
+ ];
+ }
+
+ return $res;
}
public static function getPersonStats()
@@ -169,4 +199,4 @@ public static function shouldInclude($PageName) {
return $PageName=="/v2/dashboard" || $PageName=="/menu" || $PageName == "/v2/people/dashboard"; // this ID would be found on all pages.
}
-}
+}
\ No newline at end of file
diff --git a/src/EcclesiaCRM/VIEWControllers/Session/VIEWSessionController.php b/src/EcclesiaCRM/VIEWControllers/Session/VIEWSessionController.php
index 25de4b2fb..26c67f5aa 100644
--- a/src/EcclesiaCRM/VIEWControllers/Session/VIEWSessionController.php
+++ b/src/EcclesiaCRM/VIEWControllers/Session/VIEWSessionController.php
@@ -107,9 +107,12 @@ public function renderLogout(ServerRequestInterface $request, ResponseInterface
unset($_SESSION['ControllerAdminUserSecret']);
unset($_SESSION['ControllerAdminUserToken']);
}
+
+ if (isset($_SESSION['photos'])) {
+ unset($_SESSION['photos']);
+ }
if (!is_null($currentUser)) {
-
$currentUser->setShowPledges($_SESSION['sshowPledges']);
$currentUser->setShowPayments($_SESSION['sshowPayments']);
$currentUser->setDefaultFY($_SESSION['idefaultFY']);
diff --git a/src/EcclesiaCRM/dto/Photo.php b/src/EcclesiaCRM/dto/Photo.php
index 22bf246d3..ecbcd2f76 100644
--- a/src/EcclesiaCRM/dto/Photo.php
+++ b/src/EcclesiaCRM/dto/Photo.php
@@ -14,6 +14,7 @@ class Photo {
private $photoThumbURI;
private $photoContentType;
private $remotesEnabled;
+ private $thumbnailContentType;
public static $validExtensions = ["png", "jpeg", "jpg"];
public function __construct($photoType,$id) {
@@ -103,7 +104,7 @@ private function convertToPNG() {
$image = $this->getGDImage($this->getPhotoURI());
$this->delete();
$targetPath = SystemURLs::getImagesRoot() . "/" . $this->photoType . "/" . $this->id.".png";
- imagepng($image,$targetPath);
+ imagepng($image,$targetPath, 3);
$this->setURIs($targetPath);
}
diff --git a/src/EcclesiaCRM/model/EcclesiaCRM/Family.php b/src/EcclesiaCRM/model/EcclesiaCRM/Family.php
index 472b96a8d..f3d5601e7 100644
--- a/src/EcclesiaCRM/model/EcclesiaCRM/Family.php
+++ b/src/EcclesiaCRM/model/EcclesiaCRM/Family.php
@@ -328,6 +328,22 @@ public function getPhoto()
return $this->photo;
}
+ // 'initials-image direct-chat-img'
+ public function getJPGPhotoDatas($width = '50', $heigth = '50', $class = 'user-image initials-image'): string
+ {
+ if (isset($_SESSION['photos']['families'][$this->getId()])) {
+ return $_SESSION['photos']['families'][$this->getId()];
+ }
+
+ // usefull for base 64
+ $photo = $this->getPhoto();
+ $datas = base64_encode($photo->getThumbnailBytes());
+
+ $_SESSION['photos']['families'][$this->getId()] = '
';
+
+ return $_SESSION['photos']['families'][$this->getId()];
+ }
+
public function deletePhoto()
{
if (SessionUser::getUser()->isAddRecordsEnabled() || SessionUser::getUser()->getPerson()->getFamily()->getId() == $this->getId() ) {
diff --git a/src/EcclesiaCRM/model/EcclesiaCRM/Person.php b/src/EcclesiaCRM/model/EcclesiaCRM/Person.php
index 4a81f39d5..60559461d 100644
--- a/src/EcclesiaCRM/model/EcclesiaCRM/Person.php
+++ b/src/EcclesiaCRM/model/EcclesiaCRM/Person.php
@@ -565,6 +565,22 @@ public function getLatLng()
);
}
+ // 'initials-image direct-chat-img'
+ public function getJPGPhotoDatas($width = '50', $heigth = '50', $class = 'user-image initials-image'): string
+ {
+ if (isset($_SESSION['photos']['persons'][$this->getId()])) {
+ return $_SESSION['photos']['persons'][$this->getId()];
+ }
+
+ // usefull for base 64
+ $photo = $this->getPhoto();
+ $datas = base64_encode($photo->getThumbnailBytes());
+
+ $_SESSION['photos']['persons'][$this->getId()] = '
';
+
+ return $_SESSION['photos']['persons'][$this->getId()];
+ }
+
public function deletePhoto()
{
if (SessionUser::getUser()->isAddRecordsEnabled() || SessionUser::getUser()->getPersonId() == $this->getId() ) {
diff --git a/src/EcclesiaCRM/model/EcclesiaCRM/User.php b/src/EcclesiaCRM/model/EcclesiaCRM/User.php
index d5ad3d5f7..ec6cb3599 100644
--- a/src/EcclesiaCRM/model/EcclesiaCRM/User.php
+++ b/src/EcclesiaCRM/model/EcclesiaCRM/User.php
@@ -1056,6 +1056,11 @@ public function LoginPhaseActivations($takeControl = false)
$_SESSION['sshowPledges'] = $this->getShowPledges();
$_SESSION['sshowPayments'] = $this->getShowPayments();
+ $_SESSION['photos'] = [
+ 'persons' => [],
+ 'families' => []
+ ];
+
// set the jwt token
// we create the token and secret, only when login in not as ControllerAdminUserId
if (!isset($_SESSION['ControllerAdminUserId'])) {
diff --git a/src/Images/Family.png b/src/Images/Family.png
new file mode 100644
index 000000000..9cc0c0243
Binary files /dev/null and b/src/Images/Family.png differ
diff --git a/src/Images/Person.png b/src/Images/Person.png
new file mode 100644
index 000000000..b2a2a6ccd
Binary files /dev/null and b/src/Images/Person.png differ
diff --git a/src/Include/Header.php b/src/Include/Header.php
index 6ca10da45..01f3bd707 100644
--- a/src/Include/Header.php
+++ b/src/Include/Header.php
@@ -36,7 +36,6 @@
require_once 'Header-Security.php';
// Top level menu index counter
-$MenuFirst = 1;
?>
@@ -63,9 +62,6 @@ class="sidebar-mini layout-navbar-fixed layout-fixed = Theme::isSidebarCollaps
getPersonId() . '/thumbnail';
- $MenuFirst = 1;
?>