';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['cd.subprice']['checked']))
{
- print '
';
+ print '
';
print price($obj->subprice);
print '
';
if (! $i) $totalarray['nbfield']++;
@@ -698,7 +698,7 @@ while ($i < min($num, $limit))
// Status
if (! empty($arrayfields['status']['checked']))
{
- print '
';
+ print '
';
if ($obj->cstatut == 0) // If contract is draft, we say line is also draft
{
print $contractstatic->LibStatut(0, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now));
@@ -735,9 +735,9 @@ if (isset($totalarray['displaytotalline'])) {
if ($num < $limit && empty($offset)) print '
';
$userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
$userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
$htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].' ';
diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php
index c8c3d9c94b6..e041c0ab197 100644
--- a/htdocs/core/boxes/box_produits_alerte_stock.php
+++ b/htdocs/core/boxes/box_produits_alerte_stock.php
@@ -3,7 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2005-2012 Maxime Kohlhaas
- * Copyright (C) 2015 Frederic France
+ * Copyright (C) 2015-2019 Frédéric France
* Copyright (C) 2015 Juanjo Menent
*
* This program is free software; you can redistribute it and/or modify
@@ -117,6 +117,8 @@ class box_produits_alerte_stock extends ModeleBoxes
while ($line < $num) {
$objp = $db->fetch_object($result);
$datem=$db->jdate($objp->tms);
+ $price = '';
+ $price_base_type = '';
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) // si l'option est active
diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php
index c60b6675a1d..f92bee4519f 100644
--- a/htdocs/core/class/html.formcompany.class.php
+++ b/htdocs/core/class/html.formcompany.class.php
@@ -188,11 +188,10 @@ class FormCompany
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
- * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
- * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
- * La cle de la liste est le code (il peut y avoir plusieurs entree pour
- * un code donnee mais dans ce cas, le champ pays differe).
- * Ainsi les liens avec les departements se font sur un departement independemment de son nom.
+ * Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
+ * In the case of an all-country list, the display breaks on the country.
+ * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
+ * Thus the links with the departments are done on a department independently of its name.
*
* @param string $selected Code state preselected
* @param int $country_codeid 0=list for all countries, otherwise country code or country rowid to show
@@ -207,11 +206,10 @@ class FormCompany
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
/**
- * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne.
- * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays.
- * La cle de la liste est le code (il peut y avoir plusieurs entree pour
- * un code donnee mais dans ce cas, le champ pays differe).
- * Ainsi les liens avec les departements se font sur un departement independemment de son nom.
+ * Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
+ * In the case of an all-country list, the display breaks on the country.
+ * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs).
+ * Thus the links with the departments are done on a department independently of its name.
*
* @param string $selected Code state preselected (mus be state id)
* @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 49ecd40b4e8..6e7914d9206 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1550,20 +1550,20 @@ class FormFile
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
- if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
- if ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
- if ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
- if ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
- if ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
- if ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
+ elseif ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
+ elseif ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'supplier_proposal') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'product') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
+ elseif ($modulepart == 'project') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
+ elseif ($modulepart == 'fichinter') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
+ elseif ($modulepart == 'user') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
+ elseif ($modulepart == 'expensereport') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');}
+ elseif ($modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:'');}
if (! $id && ! $ref) continue;
$found=0;
@@ -1720,7 +1720,7 @@ class FormFile
print '
';
print '
';
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("Links"),
$_SERVER['PHP_SELF'],
"name",
@@ -1730,7 +1730,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
"",
"",
"",
@@ -1738,7 +1738,7 @@ print_liste_field_titre(
"",
'class="right"'
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("Date"),
$_SERVER['PHP_SELF'],
"date",
@@ -1748,7 +1748,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
'',
$_SERVER['PHP_SELF'],
"",
@@ -1825,7 +1825,7 @@ print_liste_field_titre(
* @param array $file Array with data of file. Example: array('name'=>...)
* @param string $modulepart propal, facture, facture_fourn, ...
* @param string $relativepath Relative path of docs
- * @param string $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file)
+ * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file)
* @param string $param More param on http links
* @return string $out Output string with HTML
*/
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 752d2406ea4..6ea2e01fbfc 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -4,7 +4,7 @@
* Copyright (C) 2010-2011 Juanjo Menent
* Copyright (C) 2015-2017 Marcos García
* Copyright (C) 2015-2017 Nicolas ZABOURI
- * Copyright (C) 2018 Frédéric France
+ * Copyright (C) 2018-2019 Frédéric France
*
* 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
@@ -455,7 +455,7 @@ class FormMail extends Form
}
if (! empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
{
- $out.= '
';
+ $out.= '
';
//$out.='
';
if (is_numeric($this->withsubstit)) $out.= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
else $out.= $form->textwithpicto($langs->trans('AvailableVariables'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // New usage
@@ -1140,7 +1140,7 @@ class FormMail extends Form
* @param int $id Id of template to find, or -1 for first found with position 0, or 0 for first found whatever is position (priority order depends on lang provided or not) or -2 for exact match with label (no answer if not found)
* @param int $active 1=Only active template, 0=Only disabled, -1=All
* @param string $label Label of template
- * @return ModelMail One instance of ModelMail
+ * @return ModelMail|integer One instance of ModelMail or -1 if error
*/
public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '')
{
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index cce12ae5f8b..5aecb6efc71 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -223,16 +223,16 @@ class FormMargin
print '
';
print '
';
print '
'.$langs->trans('Margins').'
';
- print '
'.$langs->trans('SellingPrice').'
';
+ print '
'.$langs->trans('SellingPrice').'
';
if ($conf->global->MARGIN_TYPE == "1")
- print '
'.$langs->trans('BuyingPrice').'
';
+ print '
'.$langs->trans('BuyingPrice').'
';
else
- print '
'.$langs->trans('CostPrice').'
';
- print '
'.$langs->trans('Margin').'
';
+ print '
'.$langs->trans('CostPrice').'
';
+ print '
'.$langs->trans('Margin').'
';
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
- print '
'.$langs->trans('MarginRate').'
';
+ print '
'.$langs->trans('MarginRate').'
';
if (! empty($conf->global->DISPLAY_MARK_RATES))
- print '
\n";
print "\n";
$i++;
diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php
new file mode 100644
index 00000000000..cf2c2418092
--- /dev/null
+++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php
@@ -0,0 +1,179 @@
+
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/core/modules/oauth/stripe_oauthcallback.php
+ * \ingroup oauth
+ * \brief Page to get oauth callback
+ */
+
+require '../../../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php';
+use OAuth\Common\Storage\DoliStorage;
+use OAuth\Common\Consumer\Credentials;
+use OAuth\OAuth2\Service\GitHub;
+
+// Define $urlwithroot
+$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
+$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
+//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
+
+
+
+$action = GETPOST('action', 'alpha');
+$backtourl = GETPOST('backtourl', 'alpha');
+
+
+/**
+ * Create a new instance of the URI class with the current URI, stripping the query string
+ */
+$uriFactory = new \OAuth\Common\Http\Uri\UriFactory();
+//$currentUri = $uriFactory->createFromSuperGlobalArray($_SERVER);
+//$currentUri->setQuery('');
+$currentUri = $uriFactory->createFromAbsolute($urlwithroot.'/core/modules/oauth/stripe_oauthcallback.php');
+
+
+/**
+ * Load the credential for the service
+ */
+
+/** @var $serviceFactory \OAuth\ServiceFactory An OAuth service factory. */
+$serviceFactory = new \OAuth\ServiceFactory();
+$httpClient = new \OAuth\Common\Http\Client\CurlClient();
+// TODO Set options for proxy and timeout
+// $params=array('CURLXXX'=>value, ...)
+//$httpClient->setCurlParameters($params);
+$serviceFactory->setHttpClient($httpClient);
+
+// Dolibarr storage
+$storage = new DoliStorage($db, $conf);
+
+// Setup the credentials for the requests
+$credentials = new Credentials(
+ $conf->global->OAUTH_STRIPE_TEST_ID,
+ $conf->global->STRIPE_LIVE_SECRET_KEY,
+ $currentUri->getAbsoluteUri()
+);
+
+$requestedpermissionsarray=array();
+if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'userinfo_email,userinfo_profile,cloud_print'. 'state' parameter is standard to retrieve some parameters back
+/*if ($action != 'delete' && empty($requestedpermissionsarray))
+{
+ print 'Error, parameter state is not defined';
+ exit;
+}*/
+//var_dump($requestedpermissionsarray);exit;
+
+// Instantiate the Api service using the credentials, http client and storage mechanism for the token
+/** @var $apiService Service */
+//$apiService = $serviceFactory->createService('StripeTest', $credentials, $storage, $requestedpermissionsarray);
+
+$sql="INSERT INTO ".MAIN_DB_PREFIX."oauth_token set service='StripeLive', entity=".$conf->entity;
+$db->query($sql);
+
+// access type needed to have oauth provider refreshing token
+//$apiService->setAccessType('offline');
+
+$langs->load("oauth");
+
+
+/*
+ * Actions
+ */
+
+
+if ($action == 'delete')
+{
+ $storage->clearToken('StripeLive');
+
+ setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
+
+ header('Location: ' . $backtourl);
+ exit();
+}
+
+if (! empty($_GET['code'])) // We are coming from oauth provider page
+{
+ // We should have
+ //$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
+
+ dol_syslog("We are coming from the oauth provider page");
+ //llxHeader('',$langs->trans("OAuthSetup"));
+
+ //$linkback=''.$langs->trans("BackToModuleList").'';
+ //print load_fiche_titre($langs->trans("OAuthSetup"),$linkback,'title_setup');
+
+ //dol_fiche_head();
+ // retrieve the CSRF state parameter
+ $state = isset($_GET['state']) ? $_GET['state'] : null;
+ //print '
';
+
+ // This was a callback request from service, get the token
+ try {
+ //var_dump($_GET['code']);
+ //var_dump($state);
+ //var_dump($apiService); // OAuth\OAuth2\Service\GitHub
+
+ //$token = $apiService->requestAccessToken($_GET['code'], $state);
+ $token = $apiService->requestAccessToken($_GET['code']);
+ // Github is a service that does not need state to be stored.
+ // Into constructor of GitHub, the call
+ // parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
+ // has not the ending parameter to true like the Google class constructor.
+
+ setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
+
+ $backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
+ unset($_SESSION["backtourlsavedbeforeoauthjump"]);
+
+ header('Location: ' . $backtourl);
+ exit();
+ } catch (Exception $e) {
+ print $e->getMessage();
+ }
+}
+else // If entry on page with no parameter, we arrive here
+{
+ $_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
+
+ // This may create record into oauth_state before the header redirect.
+ // Creation of record with state in this tables depend on the Provider used (see its constructor).
+ if (GETPOST('state'))
+ {
+ $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state')));
+ }
+ else
+ {
+ //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
+ //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write
+ $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write';
+ }
+
+ // we go on oauth provider authorization page
+ header('Location: ' . $url);
+ exit();
+}
+
+
+/*
+ * View
+ */
+
+// No view at all, just actions
+
+$db->close();
diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
index fb93998ef84..bcae2c990af 100644
--- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
+++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php
@@ -300,7 +300,7 @@ class doc_generic_reception_odt extends ModelePdfReception
'__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht,
- '__TOTAL_VAT__' => $object->total_vat
+ '__TOTAL_VAT__' => $object->total_tva
);
complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook
diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php
index a872bdae8ae..81e8680034e 100644
--- a/htdocs/product/stock/class/entrepot.class.php
+++ b/htdocs/product/stock/class/entrepot.class.php
@@ -4,6 +4,7 @@
* Copyright (C) 2005-2008 Regis Houssin
* Copyright (C) 2011 Juanjo Menent
* Copyright (C) 2016 Francis Appels
+ * Copyright (C) 2019 Frédéric France
*
* 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
@@ -76,8 +77,14 @@ class Entrepot extends CommonObject
*/
public $address;
- //! Code Postal
+ /**
+ * @var string Zipcode
+ */
public $zip;
+
+ /**
+ * @var string Town
+ */
public $town;
/**
@@ -573,26 +580,26 @@ class Entrepot extends CommonObject
{
return $label;
}
- if ($mode == 1)
+ elseif ($mode == 1)
{
return $label;
}
- if ($mode == 2)
+ elseif ($mode == 2)
{
if ($statut > 0) $picto = 'statut4';
return img_picto($label, $picto).' '.$label;
}
- if ($mode == 3)
+ elseif ($mode == 3)
{
if ($statut > 0) $picto = 'statut4';
return img_picto($label, $picto).' '.$label;
}
- if ($mode == 4)
+ elseif ($mode == 4)
{
if ($statut > 0) $picto = 'statut4';
return img_picto($label, $picto).' '.$label;
}
- if ($mode == 5)
+ elseif ($mode == 5)
{
if ($statut > 0) $picto = 'statut4';
return $label.' '.img_picto($label, $picto);
@@ -617,7 +624,6 @@ class Entrepot extends CommonObject
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
$result='';
- $label = '';
$label = '' . $langs->trans("ShowWarehouse").'';
$label.= ' ' . $langs->trans('Ref') . ': ' . (empty($this->ref)?(empty($this->label)?$this->libelle:$this->label):$this->ref);
@@ -724,9 +730,9 @@ class Entrepot extends CommonObject
/**
* Return array of children warehouses ids from $id warehouse (recursive function)
*
- * @param int $id id parent warehouse
- * @param array $TChildWarehouses array which will contain all children (param by reference)
- * @return array $TChildWarehouses array which will contain all children
+ * @param int $id id parent warehouse
+ * @param integer[] $TChildWarehouses array which will contain all children (param by reference)
+ * @return integer[] $TChildWarehouses array which will contain all children
*/
function get_children_warehouses($id, &$TChildWarehouses)
{
diff --git a/htdocs/stripe/payment.php b/htdocs/stripe/payment.php
index bf8802f4c89..50d64521621 100644
--- a/htdocs/stripe/payment.php
+++ b/htdocs/stripe/payment.php
@@ -8,7 +8,7 @@
* Copyright (C) 2014 Raphaël Doursenaud
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015 Juanjo Menent
- * Copyright (C) 2018 Thibault FOUCART
+ * Copyright (C) 2018-2019 Thibault FOUCART
* Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -80,22 +80,29 @@ if ($facid > 0)
if (! empty($conf->stripe->enabled))
{
- $service = 'StripeTest';
- $servicestatus = 0;
- if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha'))
- {
- $service = 'StripeLive';
- $servicestatus = 0;
- }
-
- $stripe=new Stripe($db);
- $stripeacc = $stripe->getStripeAccount($service); // Stripe OAuth connect account of dolibarr user (no network access here)
+ access_forbidden();
}
+if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))
+{
+ $service = 'StripeTest';
+ $servicestatus = '0';
+ dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning');
+}
+else
+{
+ $service = 'StripeLive';
+ $servicestatus = '1';
+}
+$stripeacc = $stripe->getStripeAccount($service);
+/*if (empty($stripeaccount))
+{
+ print $langs->trans('ErrorStripeAccountNotDefined');
+}*/
+
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('paiementcard','globalcard'));
-
/*
* Actions
*/
diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php
index 467d242a0c8..b0575a53ee4 100644
--- a/htdocs/stripe/transaction.php
+++ b/htdocs/stripe/transaction.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2018-2019 Thibault FOUCART
* Copyright (C) 2018 Frédéric France
*
* This program is free software; you can redistribute it and/or modify
@@ -71,7 +71,6 @@ else
$service = 'StripeLive';
$servicestatus = '1';
}
-
$stripeacc = $stripe->getStripeAccount($service);
/*if (empty($stripeaccount))
{