Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to filter backer invests by subscription based payment methods #594

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Goteo/Controller/Dashboard/ProjectDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
use Goteo\Model\Project\Support;
use Goteo\Model\Stories;
use Goteo\Model\User;
use Goteo\Payment\Method\StripeSubscriptionPaymentMethod;
use Goteo\Util\Form\Type\SubmitType;
use Goteo\Util\Form\Type\TextareaType;
use Goteo\Util\Form\Type\TextType;
Expand Down Expand Up @@ -900,10 +901,16 @@ public static function getInvestFilters(Project $project, $filter = []): array
foreach($project->getIndividualRewards() as $reward) {
$filters['reward'][$reward->id] = $reward->getTitle();
}

if($project->getCall()) {
$filters['others']['drop'] = Text::Get('dashboard-project-filter-by-drop');
$filters['others']['nondrop'] = Text::Get('dashboard-project-filter-by-nondrop');
}

if ($project->isPermanent()) {
$filters['others']['from_subscription'] = Text::get('dashboard-project-filter-by-subscription');
}

$status = [
Invest::STATUS_CHARGED,
Invest::STATUS_PAID,
Expand All @@ -919,6 +926,12 @@ public static function getInvestFilters(Project $project, $filter = []): array
}
if(array_key_exists($filter['others'], $filters['others'])) {
$filter_by['types'] = $filter['others'];

if($filter['others']['from_subscription']) {
$filter_by['methods'] = [
StripeSubscriptionPaymentMethod::PAYMENT_METHOD_ID
];
}
}
if($filter['query']) {
$filter_by['name'] = $filter['query'];
Expand Down
1 change: 1 addition & 0 deletions src/Goteo/Model/Invest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Goteo\Library\Text;
use Goteo\Model\Invest\InvestLocation;
use Goteo\Model\Project\Reward;
use Goteo\Payment\Method\StripeSubscriptionPaymentMethod;
use Goteo\Payment\Payment;
use Goteo\Repository\InvestOriginRepository;

Expand Down
1 change: 1 addition & 0 deletions translations/ca/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ dashboard-project-filter-by-drop: 'Veure només les aportacions de matchfunding'
dashboard-project-filter-by-nondrop: 'Amaga les aportacions de matchfunding'
dashboard-project-filter-by-pending: 'Veure només les pendents'
dashboard-project-filter-by-fulfilled: 'Veure només les completades'
dashboard-project-filter-by-subscription: 'Veure només les aportacions des de suscripcions'
dashboard-project-no-invests: 'No hi ha aportacions per a aquest criteri de cerca'
dashboard-new-message-to-donors: 'Nou missatge als cofinançadors'
dashboard-message-donors-reward: 'Cofinançadors amb la recompensa %s'
Expand Down
1 change: 1 addition & 0 deletions translations/en/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ dashboard-project-filter-by-drop: 'Show only matchfunding donations'
dashboard-project-filter-by-nondrop: 'Hide matchfunding donations'
dashboard-project-filter-by-pending: 'Show only pending'
dashboard-project-filter-by-fulfilled: 'Show only completed'
dashboard-project-filter-by-subscription: 'Show only donations from subscriptions'
dashboard-project-no-invests: 'No entries for the current search criteria'
dashboard-new-message-to-donors: 'New message to donors'
dashboard-message-donors-reward: 'Donors with the reward %s'
Expand Down
1 change: 1 addition & 0 deletions translations/es/dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ dashboard-project-filter-by-drop: 'Ver sólo aportes de matchfunding'
dashboard-project-filter-by-nondrop: 'Esconder aportes de matchfunding'
dashboard-project-filter-by-pending: 'Ver sólo las pendientes'
dashboard-project-filter-by-fulfilled: 'Ver sólo las completadas'
dashboard-project-filter-by-subscription: 'Ver sólo aportes desde subscripciones'
dashboard-project-no-invests: 'No hay aportes para este criterio de búsqueda'
dashboard-new-message-to-donors: 'Nuevo mensaje a cofinanciadores'
dashboard-message-donors-reward: 'Los cofinanciadores con la recompensa %s'
Expand Down
Loading