Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Commit

Permalink
Version 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Dijkstra authored and Nick Dijkstra committed Nov 28, 2016
1 parent f4ce3d4 commit 194eeb8
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doneren-met-mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
Plugin Name: Doneren met Mollie
Description: Donaties ontvangen via Mollie
Version: 2.1.7
Version: 2.2.0
Author: Nick Dijkstra
Author URI: http://nickdijkstra.nl
Text Domain: doneren-met-mollie
Expand All @@ -15,7 +15,7 @@

// Plugin Version
if (!defined('DMM_VERSION')) {
define('DMM_VERSION', '2.1.7');
define('DMM_VERSION', '2.2.0');
}

// Plugin Folder Path
Expand Down
63 changes: 60 additions & 3 deletions includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct()

add_action('admin_menu', array($this, 'dmm_admin_menu'));
add_action('admin_init', array($this, 'dmm_register_settings'));
add_action('admin_post_dmm_export', array($this, 'dmm_export_donations'));
}

/**
Expand Down Expand Up @@ -189,11 +190,68 @@ public function dmm_page_donations() {
<input type="text" name="search" placeholder="<?php esc_html_e('Search') ?>">
<input type="submit" value="<?php esc_html_e('Search') ?>">
</form>
<a style="float: right;" href="<?php echo admin_url('admin-post.php?action=dmm_export' . (isset($_GET['subscription']) ? '&subscription=' . $_GET['subscription'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : ''));?>"><?php esc_html_e('Export', DMM_TXT_DOMAIN) ?></a>
<?php $dmmTable->display();?>
</div>
<?php
}

public function dmm_export_donations()
{
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=donations.csv');
$output = fopen('php://output', 'w');

fputcsv($output, array(
esc_html_e('Date/time', DMM_TXT_DOMAIN),
esc_html_e('Name', DMM_TXT_DOMAIN),
esc_html_e('Company name', DMM_TXT_DOMAIN),
esc_html_e('Email address', DMM_TXT_DOMAIN),
esc_html_e('Phone number', DMM_TXT_DOMAIN),
esc_html_e('Address', DMM_TXT_DOMAIN),
esc_html_e('Zipcode', DMM_TXT_DOMAIN),
esc_html_e('City', DMM_TXT_DOMAIN),
esc_html_e('Country', DMM_TXT_DOMAIN),
esc_html_e('Project', DMM_TXT_DOMAIN),
esc_html_e('Message', DMM_TXT_DOMAIN),
esc_html_e('Amount', DMM_TXT_DOMAIN),
esc_html_e('Status', DMM_TXT_DOMAIN),
esc_html_e('Payment method', DMM_TXT_DOMAIN),
esc_html_e('Donation ID', DMM_TXT_DOMAIN),
esc_html_e('Payment ID', DMM_TXT_DOMAIN),
));

$where = '';
if (isset($_GET['subscription']))
$where .= ' WHERE subscription_id="' . esc_sql($_GET['subscription']) . '"';

if (isset($_GET['search']))
$where .= ($where ? ' AND' : ' WHERE') . ' (dm_name LIKE "%' . esc_sql($_GET['search']) . '%" OR dm_email LIKE "%' . esc_sql($_GET['search']) . '%" OR dm_company LIKE "%' . esc_sql($_GET['search']) . '%" OR donation_id LIKE "%' . esc_sql($_GET['search']) . '%" OR payment_id LIKE "%' . esc_sql($_GET['search']) . '%")';

$donations = $this->wpdb->get_results("SELECT * FROM " . DMM_TABLE_DONATIONS . $where . " ORDER BY time DESC");
foreach ($donations as $donation)
{
fputcsv($output, array(
$donation->time,
$donation->dm_name,
$donation->dm_company,
$donation->dm_email,
$donation->dm_phone,
$donation->dm_address,
$donation->dm_zipcode,
$donation->dm_city,
$donation->dm_country,
$donation->dm_project,
$donation->dm_message,
$donation->dm_amount,
$donation->dm_status,
$donation->payment_method,
$donation->donation_id,
$donation->payment_id,
));
}
}

public function dmm_page_donation()
{
$donation = $this->wpdb->get_row("SELECT * FROM " . DMM_TABLE_DONATIONS . " WHERE id = '" . esc_sql($_REQUEST['id']) . "'");
Expand Down Expand Up @@ -616,9 +674,8 @@ private function dmm_tab_settings_recurring()
return;
}

foreach ($mollie->methods->all() as $method)
if ($method->id == 'directdebit' || $method->id == 'creditcard')
$recurring = true;
if (count($mollie->methods->all(0,50, array('recurringType' => 'recurring'))))
$recurring = true;

} catch (Mollie_API_Exception $e) {
echo "<div class=\"error notice\"><p>API call failed: " . htmlspecialchars($e->getMessage()) . "</p></div>";
Expand Down
4 changes: 2 additions & 2 deletions includes/class-start.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ private function dmm_payment_methods($mollie) {
if (get_option('dmm_recurring'))
{
$recurring = array('dd' => false, 'cc' => false);
foreach ($mollie->methods->all() as $method)
foreach ($mollie->methods->all(0,50,array('recurringType' => 'recurring')) as $method)
{
if ($method->id == 'directdebit')$recurring['dd'] = true;
if ($method->id == 'creditcard')$recurring['cc'] = true;
Expand Down Expand Up @@ -584,7 +584,7 @@ function dmm_recurring_methods(value) {
*/
private function dmm_recurring_method($id)
{
$recurring = array('ideal', 'mistercash', 'belfius', 'sofort', 'creditcard');
$recurring = array('ideal', 'mistercash', 'kbc', 'belfius', 'sofort', 'creditcard');

return !in_array($id, $recurring) ? 'class="dmm_recurring"' : 'class="' . ($id == 'creditcard' ? 'dmm_cc' : 'dmm_dd') . '"';
}
Expand Down
Empty file modified includes/class-webhook.php
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions includes/config.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
define('DMM_TXT_DOMAIN', 'doneren-met-mollie');

// Pages
define('DMM_PAGE_EXPORT', 'doneren-met-mollie-export');
define('DMM_PAGE_DONATION', 'doneren-met-mollie-donatie');
define('DMM_PAGE_DONATIONS', 'doneren-met-mollie');
define('DMM_PAGE_DONORS', 'doneren-met-mollie-donateurs');
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: ndijkstra
Tags: mollie,doneren,donate,ideal,mistercash,bancontact,bitcoin,creditcard,paypal,sofort,belfius,overboeking,recurring,incasso,debit,herhaalbetalingen,sepa,subscriptions,kbc,cbc
Requires at least: 3.0.1
Tested up to: 4.6.1
Stable tag: 2.1.7
Stable tag: 2.2.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -39,6 +39,10 @@ Naast eenmalige donaties is deze plugin ook goed bruikbaar om periodiek bedragen

== Changelog ==

= 2.2.0 =
* Fix dat recurring niet meer mogelijk was vanwege aanpassing Mollie API SEPA-incasso
* Donaties exporteren naar CSV mogelijk

= 2.1.7 =
* Eerste bedrag bij herhaalbetaling (recurring) meteen bedrag voor eerste termijn ipv €0,01

Expand Down

0 comments on commit 194eeb8

Please sign in to comment.