diff --git a/installer/data/mysql/atomicupdate/bug_21701_PayPalReturnURL.perl b/installer/data/mysql/atomicupdate/bug_21701_PayPalReturnURL.perl new file mode 100644 index 0000000000..d62dbc1c0c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_21701_PayPalReturnURL.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # you can use $dbh here like: + # $dbh->do("INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('PayPalReturnURL','BaseURL','BaseURL|OPACAlias','Specify whether PayPal will return to the url specified in the OPACBaseURL option or to the OPAC\'s alias url.','Choice')" ); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + # Always end with this (adjust the bug info) + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 21701 - PayPal return URL option)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f6d16368db..bb6618f3ff 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -482,6 +482,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('PatronQuickAddFields', '', NULL , 'A list of fields separated by "|" to be displayed along with mandatory fields in the patron quick add form if chosen at patron entry', 'Free' ), ('PayPalChargeDescription', 'Koha fee payment', NULL , 'This preference defines what the user will see the charge listed as in PayPal', 'Free'), ('PayPalPwd', '', NULL , 'Your PayPal API password', 'Free'), +('PayPalReturnURL','BaseURL','BaseURL|OPACAlias','Specify whether PayPal will return to the url specified in the OPACBaseURL option or to the OPAC\'s alias url.','Choice'), ('PayPalSandboxMode', '1', NULL , 'If enabled, the system will use PayPal''s sandbox server for testing, rather than the production server.', 'YesNo'), ('PayPalSignature', '', NULL , 'Your PayPal API signature', 'Free'), ('PayPalUser', '', NULL , 'Your PayPal API username ( email address )', 'Free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index d455164a0d..0ffe05b44d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -893,3 +893,10 @@ OPAC: - "The patron should see the charge description as " - pref: PayPalChargeDescription class: long + - + - "After payment or cancellation, PayPal should return to the " + - pref: PayPalReturnURL + default: BaseURL + choices: + BaseURL: "OPACBaseURL" + OPACAlias: "OPAC's alias" diff --git a/opac/opac-account-pay.pl b/opac/opac-account-pay.pl index a4598bda38..470e4430c6 100755 --- a/opac/opac-account-pay.pl +++ b/opac/opac-account-pay.pl @@ -79,7 +79,10 @@ if ( $payment_method eq 'paypal' ) { ? 'https://api-3t.sandbox.paypal.com/nvp' : 'https://api-3t.paypal.com/nvp'; - my $opac_base_url = C4::Context->preference('OPACBaseURL'); + my $opac_base_url = + C4::Context->preference('PayPalReturnURL') eq 'BaseURL' + ? C4::Context->preference('OPACBaseURL') + : $cgi->url(-base=>1); my $return_url = URI->new( $opac_base_url . "/cgi-bin/koha/opac-account-pay-paypal-return.pl" ); $return_url->query_form( { amount => $amount_to_pay, accountlines => \@accountlines } );