* Copyright (C) 2005-2010 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** \file htdocs/paypal/admin/paypal.php * \ingroup paypal * \brief Page to setup paypal module * \version $Id$ */ require("../../main.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); $servicename='PayPal'; $langs->load("admin"); $langs->load("paypal"); $langs->load("paybox"); if (!$user->admin) accessforbidden(); if ($_POST["action"] == 'setvalue' && $user->admin) { //$result=dolibarr_set_const($db, "PAYPAL_IBS_DEVISE",$_POST["PAYPAL_IBS_DEVISE"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_CSS_URL",$_POST["PAYPAL_CSS_URL"],'chaine',0,'',$conf->entity); /* $result=dolibarr_set_const($db, "PAYPAL_CREDITOR",$_POST["PAYPAL_CREDITOR"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_CGI_URL_V1",$_POST["PAYPAL_CGI_URL_V1"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_CGI_URL_V2",$_POST["PAYPAL_CGI_URL_V2"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_IBS_SITE",$_POST["PAYPAL_IBS_SITE"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_IBS_RANG",$_POST["PAYPAL_IBS_RANG"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_PBX_IDENTIFIANT",$_POST["PAYPAL_PBX_IDENTIFIANT"],'chaine',0,'',$conf->entity); */ $result=dolibarr_set_const($db, "PAYPAL_API_SANDBOX",$_POST["PAYPAL_API_SANDBOX"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_API_INTEGRAL",$_POST["PAYPAL_API_INTEGRAL"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_API_USER",$_POST["PAYPAL_API_USER"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_API_PASSWORD",$_POST["PAYPAL_API_PASSWORD"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "PAYPAL_API_SIGNATURE",$_POST["PAYPAL_API_SIGNATURE"],'chaine',0,'',$conf->entity); if ($result >= 0) { $mesg='
'.$langs->trans("SetupSaved").'
'; } else { dol_print_error($db); } } /* * View */ $form=new Form($db); $IBS_SITE="1999888"; # Site test if (empty($conf->global->PAYPAL_IBS_SITE)) $conf->global->PAYPAL_IBS_SITE=$IBS_SITE; $IBS_RANG="99"; # Rang test if (empty($conf->global->PAYPAL_IBS_RANG)) $conf->global->PAYPAL_IBS_RANG=$IBS_RANG; $IBS_DEVISE="978"; # Euro if (empty($conf->global->PAYPAL_IBS_DEVISE)) $conf->global->PAYPAL_IBS_DEVISE=$IBS_DEVISE; llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("PaypalSetup"),$linkback,'setup'); print $langs->trans("PaypalDesc")."
\n"; if ($mesg) print '
'.$mesg; print '
'; print '
'; print ''; print ''; $var=true; print ''; print ''; print ''; print ''; print "\n"; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''.$langs->trans("PAYPAL_API_USER").''; print ''; print '
'.$langs->trans("Example").': paypal_api1.mywebsite.com'; print '
'; print ''.$langs->trans("PAYPAL_API_PASSWORD").''; print ''; print '
'; print ''.$langs->trans("PAYPAL_API_SIGNATURE").''; print ''; print '
'.$langs->trans("Example").': ASsqXEmw4KzmX-CPChWSVDNCNfd.A3YNR7uz-VncXXAERFDFDFDF'; print '
'; print ''.$langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").''; print $form->selectyesno("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY); print '
'; print ''.$langs->trans("PAYPAL_API_EXPRESS").''; print $form->selectyesno("PAYPAL_API_EXPRESS",$conf->global->PAYPAL_API_EXPRESS); print '
'; print $langs->trans("PAYPAL_API_SANDBOX").''; print $form->selectyesno("PAYPAL_API_SANDBOX",$conf->global->PAYPAL_API_SANDBOX); print '
'; print $langs->trans("PAYPAL_CSS_URL").''; print ''; print '
'.$langs->trans("Example").': http://mysite/mycss.css'; print '
'; print '

'; print ''.$langs->trans("FollowingUrlAreAvailableToMakePayments").':
'; // Should work with DOL_URL_ROOT='' or DOL_URL_ROOT='/dolibarr' $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',$dolibarr_main_url_root); print '
'; print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnFreeAmount",$servicename).':
'; print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=9.99&tag=your_free_tag'."
\n"; print '
'; if ($conf->commande->enabled) { print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnOrder",$servicename).':
'; print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=order&ref=order_ref'."
\n"; print '
'; } if ($conf->facture->enabled) { print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnInvoice",$servicename).':
'; print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=invoice&ref=invoice_ref'."
\n"; // print $langs->trans("SetupPaypalToHavePaymentCreatedAutomatically",$langs->transnoentitiesnoconv("FeatureNotYetAvailable"))."
\n"; print '
'; } if ($conf->contrat->enabled) { print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnContractLine",$servicename).':
'; print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=contractline&ref=contractline_ref'."
\n"; print '
'; } if ($conf->adherent->enabled) { print img_picto('','puce.png').' '.$langs->trans("ToOfferALinkForOnlinePaymentOnMemberSubscription",$servicename).':
'; print ''.$urlwithouturlroot.DOL_URL_ROOT.'/public/paypal/newpayment.php?amount=membersubscription&ref=member_ref'."
\n"; print '
'; } print $langs->trans("YouCanAddTagOnUrl"); $db->close(); llxFooter('$Date$ - $Revision$'); ?>