Fix: more compatibility with multicompany
This commit is contained in:
parent
1726720d16
commit
b9b2dbe9b1
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -103,6 +103,14 @@ class InterfacePaypalWorkflow
|
|||||||
{
|
{
|
||||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref);
|
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". source=".$object->source." ref=".$object->ref);
|
||||||
|
|
||||||
|
if ($object->source == 'membersubscription')
|
||||||
|
{
|
||||||
|
//require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherents.class.php");
|
||||||
|
|
||||||
|
// TODO add subscription treatment
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
|
||||||
|
|
||||||
$soc = new Societe($this->db);
|
$soc = new Societe($this->db);
|
||||||
@ -115,8 +123,12 @@ class InterfacePaypalWorkflow
|
|||||||
$filename = $regs[2];
|
$filename = $regs[2];
|
||||||
}
|
}
|
||||||
// For compatibility
|
// For compatibility
|
||||||
if ($element == 'order') { $path = $filename = 'commande'; }
|
if ($element == 'order') {
|
||||||
if ($element == 'invoice') { $path = 'compta/facture'; $filename = 'facture'; }
|
$path = $filename = 'commande';
|
||||||
|
}
|
||||||
|
if ($element == 'invoice') {
|
||||||
|
$path = 'compta/facture'; $filename = 'facture';
|
||||||
|
}
|
||||||
|
|
||||||
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
|
dol_include_once('/'.$path.'/class/'.$filename.'.class.php');
|
||||||
|
|
||||||
@ -131,6 +143,7 @@ class InterfacePaypalWorkflow
|
|||||||
|
|
||||||
// Add transaction id
|
// Add transaction id
|
||||||
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
|
$obj->setValueFrom('ref_int',$object->resArray["TRANSACTIONID"]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -274,12 +274,18 @@ if ($action == 'add')
|
|||||||
$urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
$urlback=DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||||
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
|
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
|
||||||
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
|
||||||
|
if (! empty($entity)) $urlback.='&entity='.$entity;
|
||||||
}
|
}
|
||||||
else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
|
else if ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal')
|
||||||
{
|
{
|
||||||
$urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
$urlback=DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref;
|
||||||
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
|
if (price2num(GETPOST('amount'))) $urlback.='&amount='.price2num(GETPOST('amount'));
|
||||||
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
|
if (GETPOST('email')) $urlback.='&email='.urlencode(GETPOST('email'));
|
||||||
|
if (! empty($conf->global->PAYPAL_SECURITY_TOKEN) && ! empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE))
|
||||||
|
{
|
||||||
|
$urlback.='&securekey='.dol_hash($conf->global->PAYPAL_SECURITY_TOKEN . 'membersubscription' . $adh->ref, 2);
|
||||||
|
}
|
||||||
|
if (! empty($entity)) $urlback.='&entity='.$entity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -368,7 +374,7 @@ jQuery(document).ready(function () {
|
|||||||
// Print form
|
// Print form
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" / >';
|
||||||
print '<input type="hidden" name="entity" value"'.$entity.'" />';
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
print '<input type="hidden" name="action" value="add" />';
|
print '<input type="hidden" name="action" value="add" />';
|
||||||
|
|
||||||
print '<div id="divsubscribe">';
|
print '<div id="divsubscribe">';
|
||||||
|
|||||||
@ -27,6 +27,13 @@
|
|||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||||
|
|
||||||
|
// For MultiCompany module
|
||||||
|
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||||
|
if (is_int($entity))
|
||||||
|
{
|
||||||
|
define("DOLENTITY", $entity);
|
||||||
|
}
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
||||||
@ -113,6 +120,11 @@ if (! empty($SECUREKEY))
|
|||||||
$urlok.='securekey='.urlencode($SECUREKEY).'&';
|
$urlok.='securekey='.urlencode($SECUREKEY).'&';
|
||||||
$urlko.='securekey='.urlencode($SECUREKEY).'&';
|
$urlko.='securekey='.urlencode($SECUREKEY).'&';
|
||||||
}
|
}
|
||||||
|
if (! empty($entity))
|
||||||
|
{
|
||||||
|
$urlok.='entity='.urlencode($entity).'&';
|
||||||
|
$urlko.='entity='.urlencode($entity).'&';
|
||||||
|
}
|
||||||
$urlok=preg_replace('/&$/','',$urlok); // Remove last &
|
$urlok=preg_replace('/&$/','',$urlok); // Remove last &
|
||||||
$urlko=preg_replace('/&$/','',$urlko); // Remove last &
|
$urlko=preg_replace('/&$/','',$urlko); // Remove last &
|
||||||
|
|
||||||
@ -255,6 +267,7 @@ print '<input type="hidden" name="action" value="dopayment">'."\n";
|
|||||||
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
print '<input type="hidden" name="tag" value="'.GETPOST("tag",'alpha').'">'."\n";
|
||||||
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
print '<input type="hidden" name="suffix" value="'.GETPOST("suffix",'alpha').'">'."\n";
|
||||||
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
print '<input type="hidden" name="securekey" value="'.$SECUREKEY.'">'."\n";
|
||||||
|
print '<input type="hidden" name="entity" value="'.$entity.'" />';
|
||||||
print "\n";
|
print "\n";
|
||||||
print '<!-- Form to send a Paypal payment -->'."\n";
|
print '<!-- Form to send a Paypal payment -->'."\n";
|
||||||
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
print '<!-- PAYPAL_API_SANDBOX = '.$conf->global->PAYPAL_API_SANDBOX.' -->'."\n";
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,6 +29,13 @@
|
|||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||||
|
|
||||||
|
// For MultiCompany module
|
||||||
|
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||||
|
if (is_int($entity))
|
||||||
|
{
|
||||||
|
define("DOLENTITY", $entity);
|
||||||
|
}
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2006-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -28,6 +29,13 @@
|
|||||||
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
||||||
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
||||||
|
|
||||||
|
// For MultiCompany module
|
||||||
|
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
||||||
|
if (is_int($entity))
|
||||||
|
{
|
||||||
|
define("DOLENTITY", $entity);
|
||||||
|
}
|
||||||
|
|
||||||
require("../../main.inc.php");
|
require("../../main.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypalfunctions.lib.php");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user