Update works

This commit is contained in:
Alexandre SPANGARO 2017-04-22 06:58:44 +02:00
parent c3fe1c963a
commit 3b626b75c4
6 changed files with 26 additions and 98 deletions

View File

@ -73,8 +73,8 @@ class modStripe extends DolibarrModules
// Dependencies
$this->depends = array(); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->phpmin = array(4,1); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(2,6); // Minimum version of Dolibarr required by module
$this->phpmin = array(5,3); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(5,0); // Minimum version of Dolibarr required by module
$this->langfiles = array("stripe");
// Constants

View File

@ -1,6 +1,6 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) <2016> SaaSprov.ma <saasprov@gmail.com>
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Saasprov <saasprov@gmail.com>
*
* 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
@ -16,12 +16,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require '../main.inc.php';
// Load Dolibarr environment
require_once('config.php');
require_once('stripe/init.php');
require_once DOL_DOCUMENT_ROOT.'/stripe/config.php');
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php');
define("NOLOGIN",1);
define("NOCSRFCHECK",1);
@ -30,8 +29,8 @@ $langs->load("main");
$langs->load("other");
$langs->load("stripe");
$SOURCE=GETPOST("source",'alpha');
$ref=$REF=GETPOST('ref','alpha');
$source=GETPOST("source",'alpha');
$ref=GETPOST('ref','alpha');
$form = new Form($db);
@ -40,18 +39,18 @@ $form = new Form($db);
*
* @return void
*/
function llxHeader() { }
function llxHeader() {}
/**
* Footer empty
*
* @return void
*/
function llxFooter() { }
function llxFooter() {}
$invoice = null;
// Payment on customer invoice
if (GETPOST("source") == 'invoice')
if ($source == 'invoice')
{
$found=true;
$langs->load("bills");

View File

@ -1,6 +1,6 @@
<?php
/* <one line to give the program's name and a brief idea of what it does.>
* Copyright (C) <2016> <jamelbaz@gmail.com>
/* Copyright (C) 2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2017 Saasprov <saasprov@gmail.com>
*
* 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
@ -16,21 +16,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file stripe/config.php
* \ingroup Stripe
* \brief Page to move config in api
*/
// Load Dolibarr environment
if (false === (@include '../main.inc.php')) { // From htdocs directory
require '../../main.inc.php'; // From "custom" directory
}
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
dol_include_once('/stripe/lib/stripe.lib.php');
require_once('stripe/init.php');
require_once DOL_DOCUMENT_ROOT.'/includes/stripe/init.php');
//use \Stripe\Stripe as Stripe;
//use \includes\stripe as stripe;
$stripe = array(
"secret_key" => $conf->global->TEST_SECRET_KEY,
"publishable_key" => $conf->global->TEST_PUBLISHABLE_KEY
"secret_key" => $conf->global->STRIPE_TEST_SECRET_KEY,
"publishable_key" => $conf->global->STRIPE_TEST_PUBLISHABLE_KEY
);
\Stripe\Stripe::setApiKey($stripe['secret_key']);
?>
\includes\stripe::setApiKey($stripe['secret_key']);

View File

@ -1,72 +0,0 @@
<?php
/* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) ---Put here your own copyright and developer email---
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
// Load Dolibarr environment
if (false === (@include '../main.inc.php')) { // From htdocs directory
require '../../main.inc.php'; // From "custom" directory
}
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
// Load traductions files requiredby by page
$langs->load("mymodule");
$langs->load("other");
// Get parameters
$id = GETPOST('id', 'int'); // For backward compatibility
$object = new Facture($db);
// Load object
if ($id > 0 || ! empty($ref)) {
$ret = $object->fetch($id, $ref, '', '', $conf->global->INVOICE_USE_SITUATION);
}
/***************************************************
* VIEW
*
* Put here all code to build page
****************************************************/
llxHeader('','StripePaymentLink','');
// Part to show record
if ($id)
{
print load_fiche_titre($langs->trans("StripePaymentLink"));
dol_fiche_head();
$link = $dolibarr_main_url_root . '/custom/stripe/checkout.php?source=invoice&ref=' . $object->ref;
print '<table class="border centpercent">'."\n";
print '<tr><td class="fieldrequired">'.$langs->trans("PaymentLink").'</td><td><input class="flat" type="text" size="100%" name="label" value="'.$link.'"></td></tr>';
// LIST_OF_TD_LABEL_FIELDS_VIEW
print '</table>';
dol_fiche_end();
}
llxFooter();
$db->close();