diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ce6740421..28e42accf 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -36,6 +36,8 @@ - fixed #8914: epoch for calendar/List View for Calendar - fixed: Get CS Mail workflow doesn't commit version tags created - rfe: Thingy can now copy thingy entries + - Added a switch to subscriptions so that they can be also non-recurring to + facilitate eg. limited time meberships (Martin Kamerbeek / Oqapi) 7.6.3 - improved performance of file uploads diff --git a/docs/upgrades/upgrade_7.6.3-7.6.4.pl b/docs/upgrades/upgrade_7.6.3-7.6.4.pl index e3fdfcdf1..1a3135262 100644 --- a/docs/upgrades/upgrade_7.6.3-7.6.4.pl +++ b/docs/upgrades/upgrade_7.6.3-7.6.4.pl @@ -40,6 +40,7 @@ upgradeAccount( $session ); removeProcessRecurringPaymentsFromConfig( $session ); addExtendedProfilePrivileges( $session ); addStorageUrlMacro( $session ); +addRecurringSubscriptionSwitch( $session ); finish($session); # this line required #---------------------------------------------------------------------------- @@ -384,6 +385,17 @@ sub fixFriendsGroups { } } +#---------------------------------------------------------------------------- +sub addRecurringSubscriptionSwitch { + my $session = shift; + + print "\tAdding a recurring/nonrecurring switch to subscriptions... " unless $quiet; + + $session->db->write('alter table Subscription add column recurringSubscription tinyint(1) not null default 1'); + + print "Done!\n"; +} + #---------------------------------------------------------------------------- sub upgradeAccount { my $session = shift; diff --git a/lib/WebGUI/Asset/Sku/Subscription.pm b/lib/WebGUI/Asset/Sku/Subscription.pm index c51e48a29..811bf6656 100644 --- a/lib/WebGUI/Asset/Sku/Subscription.pm +++ b/lib/WebGUI/Asset/Sku/Subscription.pm @@ -119,6 +119,12 @@ sub definition { hoverHelp => $i18n->get('subscription group description'), defaultvalue => [ 2 ] }, + recurringSubscription => { + fieldType => 'yesNo', + label => $i18n->get('recurring subscription'), + hoverHelp => $i18n->get('recurring subscription description'), + defaultValue => 1, + }, duration => { fieldType => 'selectBox', label => $i18n->get('subscription duration'), @@ -415,7 +421,9 @@ Tells the commerce system this Sku is recurring. =cut sub isRecurring { - return 1; + my $self = shift; + + return $self->getValue('recurringSubscription'); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/English/Asset_Subscription.pm b/lib/WebGUI/i18n/English/Asset_Subscription.pm index 76a9af49b..f0ff55a3f 100755 --- a/lib/WebGUI/i18n/English/Asset_Subscription.pm +++ b/lib/WebGUI/i18n/English/Asset_Subscription.pm @@ -503,6 +503,20 @@ The form in which the user can enter his subscription code.
|, context => q|template variable| }, + 'recurring subscription' => { + message => q|Is subscription recurring?|, + lastUpdated => 0, + context => q|Label for swith to set subscription to be recurring or not.| + }, + + 'recurring subscription description' => { + message => q|If set to yes, the customer will be charged after each term for a new one and the subscription +will be renewed for an extra term. If set to no, the customer will be charged for the first term only, and after one +term the subscription expires for the customer.|, + lastUpdated => 0, + context => q|Label for swith to set subscription to be recurring or not.| + }, + }; 1;