Skip to content

Commit

Permalink
Merge pull request #2604 from phili67/philil67-thumbnail-deletion
Browse files Browse the repository at this point in the history
Philil67 thumbnail deletion
  • Loading branch information
phili67 committed Apr 13, 2024
2 parents 20d95f8 + e5381c6 commit d7c3afd
Show file tree
Hide file tree
Showing 47 changed files with 1,917 additions and 1,847 deletions.
Expand Up @@ -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;
Expand Down
31 changes: 18 additions & 13 deletions src/EcclesiaCRM/APIControllers/PeopleGroupController.php
Expand Up @@ -10,6 +10,7 @@

namespace EcclesiaCRM\APIControllers;

use EcclesiaCRM\Base\FamilyQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;
Expand Down Expand Up @@ -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)
Expand All @@ -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 {
Expand Down
12 changes: 9 additions & 3 deletions src/EcclesiaCRM/APIControllers/PeoplePersonController.php
Expand Up @@ -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,
Expand Down Expand Up @@ -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" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $family->getId() . '">' . $family->getSaluation() . '</a>', "email" => $Person->getEmail()]);
array_push($missingEmailInMailChimp,
["id" => $Person->getId(),
"img" => $Person->getJPGPhotoDatas(),
"url" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $family->getId() . '">' . $family->getSaluation() . '</a>', "email" => $Person->getEmail()]);
}
}
}
Expand All @@ -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" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/person/view/' . $Person->getId() . '">' . $Person->getFullName() . '</a>', "email" => $Person->getEmail()]);
array_push($missingEmailInMailChimp,
["id" => $Person->getId(),
"img" => $Person->getJPGPhotoDatas(),
"url" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/person/view/' . $Person->getId() . '">' . $Person->getFullName() . '</a>', "email" => $Person->getEmail()]);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/EcclesiaCRM/APIControllers/SearchController.php
Expand Up @@ -10,7 +10,6 @@

namespace EcclesiaCRM\APIControllers;

use EcclesiaCRM\Utils\LoggerUtils;
use EcclesiaCRM\VolunteerOpportunityQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
Expand Down
5 changes: 5 additions & 0 deletions src/EcclesiaCRM/APIControllers/SundaySchoolController.php
Expand Up @@ -10,6 +10,7 @@

namespace EcclesiaCRM\APIControllers;

use EcclesiaCRM\Base\PersonQuery;
use Psr\Container\ContainerInterface;
use Slim\Http\Response;
use Slim\Http\ServerRequest;
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/AddressSearchRes.php
Expand Up @@ -140,7 +140,7 @@ public function buildSearch(string $qry)
} else {
$elt = [
"id" => $address->getId(),
"img" => '<img src="/api/families/' . $address->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $address->getJPGPhotoDatas(),
"searchresult" => _("Addresse") . ' : <a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $address->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . $address->getName() . '</a>' . " " . _("Members") . " : <br>" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address->getAddress(),
"type" => _($this->getGlobalSearchType()),
Expand All @@ -157,7 +157,7 @@ public function buildSearch(string $qry)
}
}
}
} catch (Exception $e) {
} catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EcclesiaCRM/Search/DepositSearchRes.php
Expand Up @@ -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());
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/EcclesiaCRM/Search/FamilyCustomSearchRes.php
Expand Up @@ -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;
Expand Down Expand Up @@ -129,7 +128,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $fam->getFamily()->getId(),
"img" =>'<img src="/api/families/'.$fam->getFamily()->getId().'/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $fam->getFamily()->getJPGPhotoDatas(),
"searchresult" => _("Family").' : <a href="'.SystemURLs::getRootPath().'/v2/people/family/view/'.$fam->getFamily()->getId().'" data-toggle="tooltip" data-placement="top" title="'._('Edit').'">'.$fam->getFamily()->getName().'</a>'." "._("Members")." : <br>".$globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled())?_('Private Data'):$fam->getFamily()->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => _($this->getGlobalSearchType()),
Expand All @@ -147,7 +146,7 @@ public function buildSearch(string $qry)
}
}
}
} catch (Exception $e) {
} catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/FamilyPastoralCareSearchRes.php
Expand Up @@ -121,7 +121,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $care->getFamily()->getId(),
"img" => '<img src="/api/families/' . $care->getFamily()->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $care->getFamily()->getJPGPhotoDatas(),
"searchresult" => _("Family Pastoral Care") . ' : <a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $care->getFamily()->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . $care->getFamily()->getName() . '</a>' . " " . _("Members") . " : <br>" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $care->getFamily()->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => " " . _($this->getGlobalSearchType()),
Expand All @@ -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());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/FamilyPropsSearchRes.php
Expand Up @@ -133,7 +133,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $family->getId(),
"img" => '<img src="/api/families/' . $family->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $family->getJPGPhotoDatas(),
"searchresult" => _("Family") . ' : <a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $family->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . $family->getName() . '</a>' . " " . _("Members") . " : <br>" . $globalMembers,
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $family->getFamilyString(SystemConfig::getBooleanValue("bSearchIncludeFamilyHOH")),
"type" => _($this->getGlobalSearchType()),
Expand All @@ -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());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/FamilySearchRes.php
Expand Up @@ -162,7 +162,7 @@ public function buildSearch(string $qry)
} elseif ( $isGlobalSearch ) {
$elt = [
"id" => $family->getId(),
"img" => '<img src="/api/families/' . $family->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $family->getJPGPhotoDatas(),
"searchresult" => _("Family") . ' : <a href="' . SystemURLs::getRootPath() . '/v2/people/family/view/' . $family->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . $family->getName() . '</a>' . " " . _("Members") . " : <br>" . $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()),
Expand All @@ -180,7 +180,7 @@ public function buildSearch(string $qry)
}
}
}
} catch (Exception $e) {
} catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EcclesiaCRM/Search/GroupPropsSearchRes.php
Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EcclesiaCRM/Search/GroupSearchRes.php
Expand Up @@ -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());
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EcclesiaCRM/Search/PaymentSearchRes.php
Expand Up @@ -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());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/PersonAssignToGroupSearchRes.php
Expand Up @@ -132,7 +132,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $per->getPerson()->getId(),
"img" => '<img src="/api/persons/' . $per->getPerson()->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $per->getPerson()->getJPGPhotoDatas(),
"searchresult" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/person/view/' . $per->getPerson()->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(),
$per->getPerson()->getSuffix(), 3) . '</a> (<a href="'.SystemURLs::getRootPath().'/v2/group/'.$per->getGroupId().'/view" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">'.$per->getgroupName().'</a>)',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
Expand All @@ -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());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/PersonCustomSearchRes.php
Expand Up @@ -128,7 +128,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $per->getPerson()->getId(),
"img" => '<img src="/api/persons/' . $per->getPerson()->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $per->getJPGPhotoDatas(),
"searchresult" => '<a href="' . SystemURLs::getRootPath() . '/v2/people/person/view/' . $per->getPerson()->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(), $per->getPerson()->getSuffix(), 3) . '</a>',
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
"type" => " " . _($this->getGlobalSearchType()),
Expand All @@ -147,7 +147,7 @@ public function buildSearch(string $qry)
}
}
}
} catch (Exception $e) {
} catch (\Exception $e) {
LoggerUtils::getAppLogger()->warn($e->getMessage());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/EcclesiaCRM/Search/PersonGroupManagerSearchRes.php
Expand Up @@ -134,7 +134,7 @@ public function buildSearch(string $qry)

$elt = [
"id" => $per->getPerson()->getId(),
"img" => '<img src="/api/persons/' . $per->getPerson()->getId() . '/thumbnail" class="initials-image direct-chat-img " width="10px" height="10px">',
"img" => $per->getPerson()->getJPGPhotoDatas(),
"searchresult" => _("Group")." : ". '<a href="'.SystemURLs::getRootPath().'/v2/group/'.$per->getGroup()->getId().'/view" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">'.$per->getGroup()->getName().'</a>'
." (".'<a href="' . SystemURLs::getRootPath() . '/v2/people/person/view/' . $per->getPerson()->getId() . '" data-toggle="tooltip" data-placement="top" title="' . _('Edit') . '">' . OutputUtils::FormatFullName($per->getPerson()->getTitle(), $per->getPerson()->getFirstName(), $per->getPerson()->getMiddleName(), $per->getPerson()->getLastName(), $per->getPerson()->getSuffix(), 3) . '</a>'.")",
"address" => (!SessionUser::getUser()->isSeePrivacyDataEnabled()) ? _('Private Data') : $address,
Expand All @@ -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());
}
}
Expand Down

0 comments on commit d7c3afd

Please sign in to comment.