Merge remote-tracking branch 'upstream/develop' into camelCaps2
This commit is contained in:
commit
ce76a2e714
@ -306,7 +306,7 @@ if (! empty($conf->product->enabled))
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||||
print '<td width="60" align="right">';
|
print '<td width="60" align="right">';
|
||||||
$formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1);
|
print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,7 +317,7 @@ if (! empty($conf->societe->enabled))
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||||
print '<td width="60" align="right">';
|
print '<td width="60" align="right">';
|
||||||
print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1);
|
print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -190,7 +190,7 @@ if ($action == 'builddoc')
|
|||||||
'%MONTH%' => $month,
|
'%MONTH%' => $month,
|
||||||
'%DAY%' => $day,
|
'%DAY%' => $day,
|
||||||
'%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
|
'%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT,
|
||||||
'%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/"
|
'%SERVER%' => "http://".$_SERVER["SERVER_NAME"]."/",
|
||||||
);
|
);
|
||||||
complete_substitutions_array($substitutionarray, $langs);
|
complete_substitutions_array($substitutionarray, $langs);
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ print $langs->trans("BarcodeType").' ';
|
|||||||
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
print '</div><div class="tagtd" style="overflow: hidden; white-space: nowrap; max-width: 300px;">';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||||
$formbarcode = new FormBarCode($db);
|
$formbarcode = new FormBarCode($db);
|
||||||
$formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1);
|
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
|
|
||||||
// Barcode value
|
// Barcode value
|
||||||
|
|||||||
@ -346,7 +346,7 @@ class Account extends CommonObject
|
|||||||
* @param int $fk_bank To search using bank transaction id
|
* @param int $fk_bank To search using bank transaction id
|
||||||
* @param int $url_id To search using link to
|
* @param int $url_id To search using link to
|
||||||
* @param string $type To search using type
|
* @param string $type To search using type
|
||||||
* @return array|-1 Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
|
* @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error
|
||||||
*/
|
*/
|
||||||
function get_url($fk_bank='', $url_id='', $type='')
|
function get_url($fk_bank='', $url_id='', $type='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
/* Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
|
||||||
@ -105,18 +106,34 @@ class FormBarCode
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Return form to select type of barcode
|
* Print form to select type of barcode
|
||||||
*
|
*
|
||||||
* @param int $selected Id code pre-selected
|
* @param int $selected Id code pre-selected
|
||||||
* @param string $htmlname Name of HTML select field
|
* @param string $htmlname Name of HTML select field
|
||||||
* @param int $useempty Affiche valeur vide dans liste
|
* @param int $useempty Affiche valeur vide dans liste
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function select_barcode_type($selected='', $htmlname='barcodetype_id', $useempty=0)
|
function select_barcode_type($selected='', $htmlname='barcodetype_id', $useempty=0)
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
|
print $this->selectBarcodeType($selected, $htmlname, $useempty);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return html form to select type of barcode
|
||||||
|
*
|
||||||
|
* @param int $selected Id code pre-selected
|
||||||
|
* @param string $htmlname Name of HTML select field
|
||||||
|
* @param int $useempty Display empty value in select
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function selectBarcodeType($selected='', $htmlname='barcodetype_id', $useempty=0)
|
||||||
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$out = '';
|
||||||
|
|
||||||
$sql = "SELECT rowid, code, libelle";
|
$sql = "SELECT rowid, code, libelle";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
$sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type";
|
||||||
$sql.= " WHERE coder <> '0'";
|
$sql.= " WHERE coder <> '0'";
|
||||||
@ -124,44 +141,37 @@ class FormBarCode
|
|||||||
$sql.= " ORDER BY code";
|
$sql.= " ORDER BY code";
|
||||||
|
|
||||||
$result = $this->db->query($sql);
|
$result = $this->db->query($sql);
|
||||||
if ($result)
|
if ($result) {
|
||||||
{
|
|
||||||
$num = $this->db->num_rows($result);
|
$num = $this->db->num_rows($result);
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|
||||||
if ($useempty && $num > 0)
|
if ($useempty && $num > 0) {
|
||||||
{
|
$out .= '<select class="flat minwidth75imp" name="' . $htmlname . '" id="select_' . $htmlname . '">';
|
||||||
print '<select class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
$out .= '<option value="0"> </option>';
|
||||||
print '<option value="0"> </option>';
|
} else {
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
print '<select disabled class="flat minwidth75imp" name="'.$htmlname.'" id="select_'.$htmlname.'">';
|
$out .= '<select disabled class="flat minwidth75imp" name="' . $htmlname . '" id="select_' . $htmlname . '">';
|
||||||
print '<option value="0" selected>'.$langs->trans('ErrorNoActivatedBarcode').'</option>';
|
$out .= '<option value="0" selected>' . $langs->trans('ErrorNoActivatedBarcode') . '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($i < $num)
|
while ($i < $num) {
|
||||||
{
|
|
||||||
$obj = $this->db->fetch_object($result);
|
$obj = $this->db->fetch_object($result);
|
||||||
if ($selected == $obj->rowid)
|
if ($selected == $obj->rowid) {
|
||||||
{
|
$out .= '<option value="' . $obj->rowid . '" selected>';
|
||||||
print '<option value="'.$obj->rowid.'" selected>';
|
} else {
|
||||||
|
$out .= '<option value="' . $obj->rowid . '">';
|
||||||
}
|
}
|
||||||
else
|
$out .= $obj->libelle;
|
||||||
{
|
$out .= '</option>';
|
||||||
print '<option value="'.$obj->rowid.'">';
|
|
||||||
}
|
|
||||||
print $obj->libelle;
|
|
||||||
print '</option>';
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
print "</select>";
|
$out .= "</select>";
|
||||||
print ajax_combobox("select_".$htmlname);
|
$out .= ajax_combobox("select_".$htmlname);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
}
|
}
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||||
@ -172,22 +182,37 @@ class FormBarCode
|
|||||||
* @param int $selected Id condition preselected
|
* @param int $selected Id condition preselected
|
||||||
* @param string $htmlname Nom du formulaire select
|
* @param string $htmlname Nom du formulaire select
|
||||||
* @return void
|
* @return void
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function form_barcode_type($page, $selected='', $htmlname='barcodetype_id')
|
function form_barcode_type($page, $selected='', $htmlname='barcodetype_id')
|
||||||
{
|
{
|
||||||
// phpcs:enable
|
// phpcs:enable
|
||||||
global $langs,$conf;
|
print $this->formBarcodeType($page, $selected, $htmlname);
|
||||||
if ($htmlname != "none")
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return html form to select type of barcode
|
||||||
|
*
|
||||||
|
* @param string $page Page
|
||||||
|
* @param int $selected Id condition preselected
|
||||||
|
* @param string $htmlname Nom du formulaire select
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function formBarcodeType($page, $selected='', $htmlname='barcodetype_id')
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$page.'">';
|
global $langs, $conf;
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
$out = '';
|
||||||
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
if ($htmlname != "none") {
|
||||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
$out .= '<form method="post" action="' . $page . '">';
|
||||||
print '<tr><td>';
|
$out .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
|
||||||
$this->select_barcode_type($selected, $htmlname, 1);
|
$out .= '<input type="hidden" name="action" value="set'.$htmlname.'">';
|
||||||
print '</td>';
|
$out .= '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
$out .= '<tr><td>';
|
||||||
print '</td></tr></table></form>';
|
$out .= $this->selectBarcodeType($selected, $htmlname, 1);
|
||||||
}
|
$out .= '</td>';
|
||||||
|
$out .= '<td align="left"><input type="submit" class="button" value="' . $langs->trans("Modify") . '">';
|
||||||
|
$out .= '</td></tr></table></form>';
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -90,7 +90,7 @@ class modAgenda extends DolibarrModules
|
|||||||
$resql = $this->db->query($sqlreadactions);
|
$resql = $this->db->query($sqlreadactions);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
while ($obj = $this->db->fetch_object($sqlreadactions))
|
while ($obj = $this->db->fetch_object($resql))
|
||||||
{
|
{
|
||||||
//if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation).
|
//if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation).
|
||||||
if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default.
|
if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default.
|
||||||
|
|||||||
@ -61,3 +61,4 @@ ConfirmDeleteCard=Are you sure you want to delete this Credit or Debit card?
|
|||||||
CreateCustomerOnStripe=Create customer on Stripe
|
CreateCustomerOnStripe=Create customer on Stripe
|
||||||
CreateCardOnStripe=Create card on Stripe
|
CreateCardOnStripe=Create card on Stripe
|
||||||
ShowInStripe=Show in Stripe
|
ShowInStripe=Show in Stripe
|
||||||
|
StripeUserAccountForActions=User account to use for some emails notification of Stripe events (Stripe payouts)
|
||||||
|
|||||||
@ -977,7 +977,7 @@ else
|
|||||||
}
|
}
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||||
$formbarcode = new FormBarCode($db);
|
$formbarcode = new FormBarCode($db);
|
||||||
print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1);
|
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
|
||||||
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
||||||
$tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
|
$tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
|
||||||
if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
|
if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
|
||||||
@ -1343,7 +1343,7 @@ else
|
|||||||
}
|
}
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php';
|
||||||
$formbarcode = new FormBarCode($db);
|
$formbarcode = new FormBarCode($db);
|
||||||
print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1);
|
print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1);
|
||||||
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
print '</td><td>'.$langs->trans("BarcodeValue").'</td><td>';
|
||||||
$tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
|
$tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode;
|
||||||
if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
|
if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type);
|
||||||
@ -1639,7 +1639,7 @@ else
|
|||||||
}
|
}
|
||||||
if ($action == 'editbarcodetype')
|
if ($action == 'editbarcodetype')
|
||||||
{
|
{
|
||||||
$formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type');
|
print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
|
/* Copyright (C) 2018 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
|
||||||
@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php';
|
||||||
|
|
||||||
// You can find your endpoint's secret in your webhook settings
|
// You can find your endpoint's secret in your webhook settings
|
||||||
if (isset($_GET['connect'])){
|
if (isset($_GET['connect'])){
|
||||||
@ -86,9 +88,12 @@ catch(\UnexpectedValueException $e) {
|
|||||||
// Do something with $event
|
// Do something with $event
|
||||||
|
|
||||||
http_response_code(200); // PHP 5.4 or greater
|
http_response_code(200); // PHP 5.4 or greater
|
||||||
|
|
||||||
$langs->load("main");
|
$langs->load("main");
|
||||||
|
|
||||||
|
// TODO Do we really need a user in setup just to have an name to fill an email topic when it is a technical system notification email
|
||||||
$user = new User($db);
|
$user = new User($db);
|
||||||
$user->fetch(5);
|
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
|
||||||
$user->getrights();
|
$user->getrights();
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) {
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) {
|
||||||
@ -126,11 +131,36 @@ if ($event->type == 'payout.created') {
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// TODO Use CMail and translation
|
$subject = '[NOTIFICATION] Payment out scheduled';
|
||||||
$body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date);
|
if (!empty($user->email)) {
|
||||||
$subject = '[NOTIFICATION] Virement programmée';
|
$sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">";
|
||||||
$headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard
|
} else {
|
||||||
mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers);
|
$sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||||
|
}
|
||||||
|
$replyto = $sendto;
|
||||||
|
$sendtocc = '';
|
||||||
|
if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) {
|
||||||
|
$sendtocc = $conf->global->ONLINE_PAYMENT_SENDEMAIL.'" <'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$message = "A bank transfer of ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour');
|
||||||
|
|
||||||
|
$mailfile = new CMailFile(
|
||||||
|
$subject,
|
||||||
|
$sendto,
|
||||||
|
$replyto,
|
||||||
|
$message,
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
array(),
|
||||||
|
$sendtocc,
|
||||||
|
'',
|
||||||
|
0,
|
||||||
|
-1
|
||||||
|
);
|
||||||
|
|
||||||
|
$ret = $mailfile->sendfile();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
* Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com>
|
* Copyright (C) 2017 Olivier Geffroy <jeff@jeffinfo.com>
|
||||||
* Copyright (C) 2017 Saasprov <saasprov@gmail.com>
|
* Copyright (C) 2017 Saasprov <saasprov@gmail.com>
|
||||||
* Copyright (C) 2018 ptibogxiv <support@ptibogxiv.net>
|
* Copyright (C) 2018 ptibogxiv <support@ptibogxiv.net>
|
||||||
|
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.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
|
||||||
@ -70,6 +71,10 @@ if ($action == 'setvalue' && $user->admin)
|
|||||||
$result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
|
$result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
if (! $result > 0)
|
if (! $result > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
|
$result = dolibarr_set_const($db, "STRIPE_USER_ACCOUNT_FOR_ACTIONS", GETPOST('STRIPE_USER_ACCOUNT_FOR_ACTIONS', 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
|
if (! $result > 0) {
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
$result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity);
|
$result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity);
|
||||||
if (! $result > 0)
|
if (! $result > 0)
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -117,9 +122,7 @@ if ($action=="setlive")
|
|||||||
{
|
{
|
||||||
$liveenable = GETPOST('value','int');
|
$liveenable = GETPOST('value','int');
|
||||||
$res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity);
|
||||||
if (! $res > 0) $error++;
|
if ($res > 0) {
|
||||||
if (! $error)
|
|
||||||
{
|
|
||||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -251,6 +254,11 @@ print '<input size="64" type="text" name="ONLINE_PAYMENT_CREDITOR" value="'.$con
|
|||||||
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
print ' '.$langs->trans("Example").': '.$mysoc->name;
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print $langs->trans("StripeUserAccountForActions").'</td><td>';
|
||||||
|
print $form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("BankAccount").'</td><td>';
|
print $langs->trans("BankAccount").'</td><td>';
|
||||||
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
|
print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1);
|
||||||
@ -357,4 +365,3 @@ if (! empty($conf->use_javascript_ajax))
|
|||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
|||||||
@ -125,15 +125,19 @@ if (!$rowid)
|
|||||||
// Save into $tmparray all metadata
|
// Save into $tmparray all metadata
|
||||||
$tmparray = dolExplodeIntoArray($FULLTAG,'.','=');
|
$tmparray = dolExplodeIntoArray($FULLTAG,'.','=');
|
||||||
// Load origin object according to metadata
|
// Load origin object according to metadata
|
||||||
if (! empty($tmparray['CUS']))
|
if (! empty($tmparray['CUS']) && $tmparray['CUS'] > 0)
|
||||||
{
|
{
|
||||||
$societestatic->fetch($tmparray['CUS']);
|
$societestatic->fetch($tmparray['CUS']);
|
||||||
}
|
}
|
||||||
|
elseif (! empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0)
|
||||||
|
{
|
||||||
|
$societestatic->fetch($charge->metadata->dol_thirdparty_id);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$societestatic->id = 0;
|
$societestatic->id = 0;
|
||||||
}
|
}
|
||||||
if (! empty($tmparray['MEM']))
|
if (! empty($tmparray['MEM']) && $tmparray['MEM'] > 0)
|
||||||
{
|
{
|
||||||
$memberstatic->fetch($tmparray['MEM']);
|
$memberstatic->fetch($tmparray['MEM']);
|
||||||
}
|
}
|
||||||
@ -144,7 +148,12 @@ if (!$rowid)
|
|||||||
|
|
||||||
print '<TR class="oddeven">';
|
print '<TR class="oddeven">';
|
||||||
// Ref
|
// Ref
|
||||||
print "<TD><A href='".DOL_URL_ROOT."/stripe/charge.php?rowid=".$charge->id."'>".$charge->id."</A></TD>\n";
|
$url='https://dashboard.stripe.com/test/payments/'.$charge->id;
|
||||||
|
if ($servicestatus)
|
||||||
|
{
|
||||||
|
$url='https://dashboard.stripe.com/payments/'.$charge->id;
|
||||||
|
}
|
||||||
|
print "<TD><a href='".$url."' target='_stripe'>".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."</a></TD>\n";
|
||||||
// Stripe customer
|
// Stripe customer
|
||||||
print "<TD>".$charge->customer."</TD>\n";
|
print "<TD>".$charge->customer."</TD>\n";
|
||||||
// Link
|
// Link
|
||||||
@ -153,23 +162,26 @@ if (!$rowid)
|
|||||||
{
|
{
|
||||||
print $societestatic->getNomUrl(1);
|
print $societestatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
if ($memberstatic->id > 0)
|
elseif ($memberstatic->id > 0)
|
||||||
{
|
{
|
||||||
print $memberstatic->getNomUrl(1);
|
print $memberstatic->getNomUrl(1);
|
||||||
}
|
}
|
||||||
print "</TD>\n";
|
print "</TD>\n";
|
||||||
// Origine
|
// Origine
|
||||||
print "<TD>";
|
print "<TD>";
|
||||||
print $FULLTAG;
|
if ($charge->metadata->dol_type=="order"){
|
||||||
if ($charge->metadata->source=="order"){
|
|
||||||
$object = new Commande($db);
|
$object = new Commande($db);
|
||||||
$object->fetch($charge->metadata->idsource);
|
$object->fetch($charge->metadata->dol_id);
|
||||||
print "<A href='".DOL_URL_ROOT."/commande/card.php?id=".$charge->metadata->idsource."'>".img_picto('', 'object_order')." ".$object->ref."</A>";
|
if ($object->id > 0) {
|
||||||
} elseif ($charge->metadata->source=="invoice"){
|
print "<A href='".DOL_URL_ROOT."/commande/card.php?id=".$object->id."'>".img_picto('', 'object_order')." ".$object->ref."</A>";
|
||||||
|
} else print $FULLTAG;
|
||||||
|
} elseif ($charge->metadata->dol_type=="invoice"){
|
||||||
$object = new Facture($db);
|
$object = new Facture($db);
|
||||||
$object->fetch($charge->metadata->idsource);
|
$object->fetch($charge->metadata->dol_id);
|
||||||
print "<A href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->idsource."'>".img_picto('', 'object_invoice')." ".$object->ref."</A>";
|
if ($object->id > 0) {
|
||||||
}
|
print "<A href='".DOL_URL_ROOT."/compta/facture/card.php?facid=".$charge->metadata->dol_id."'>".img_picto('', 'object_invoice')." ".$object->ref."</A>";
|
||||||
|
} else print $FULLTAG;
|
||||||
|
} else print $FULLTAG;
|
||||||
print "</TD>\n";
|
print "</TD>\n";
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<TD align="center">'.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."</TD>\n";
|
print '<TD align="center">'.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."</TD>\n";
|
||||||
@ -190,14 +202,16 @@ if (!$rowid)
|
|||||||
// Status
|
// Status
|
||||||
print '<TD align="right">';
|
print '<TD align="right">';
|
||||||
if ($charge->refunded=='1'){
|
if ($charge->refunded=='1'){
|
||||||
print $langs->trans("refunded");
|
print img_picto($langs->trans("refunded"),'statut6');
|
||||||
} elseif ($charge->paid=='1'){
|
} elseif ($charge->paid=='1'){
|
||||||
print $langs->trans("".$charge->status."");
|
|
||||||
|
print img_picto($langs->trans("".$charge->status.""),'statut4');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$label="Message: ".$charge->failure_message."<br>";
|
$label="Message: ".$charge->failure_message."<br>";
|
||||||
$label.="Réseau: ".$charge->outcome->network_status."<br>";
|
$label.="Réseau: ".$charge->outcome->network_status."<br>";
|
||||||
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
|
$label.="Statut: ".$langs->trans("".$charge->outcome->seller_message."");
|
||||||
print $form->textwithpicto($langs->trans("".$charge->status.""),$label,1);
|
print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1);
|
||||||
}
|
}
|
||||||
print "</TD>\n";
|
print "</TD>\n";
|
||||||
|
|
||||||
|
|||||||
@ -344,9 +344,10 @@ class Stripe extends CommonObject
|
|||||||
* @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount()
|
* @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount()
|
||||||
* @param int $status Status (0=test, 1=live)
|
* @param int $status Status (0=test, 1=live)
|
||||||
* @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email
|
* @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email
|
||||||
|
* @param boolean $capture Set capture flag to true (take payment) or false (wait)
|
||||||
* @return Stripe
|
* @return Stripe
|
||||||
*/
|
*/
|
||||||
public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0)
|
public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -417,9 +418,9 @@ class Stripe extends CommonObject
|
|||||||
$charge = \Stripe\Charge::create(array(
|
$charge = \Stripe\Charge::create(array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source"
|
"source" => "$source"
|
||||||
));
|
));
|
||||||
@ -427,9 +428,9 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
@ -452,9 +453,9 @@ class Stripe extends CommonObject
|
|||||||
$paymentarray = array(
|
$paymentarray = array(
|
||||||
"amount" => "$stripeamount",
|
"amount" => "$stripeamount",
|
||||||
"currency" => "$currency",
|
"currency" => "$currency",
|
||||||
"capture" => true,
|
|
||||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||||
"description" => "Stripe payment: ".$description,
|
"description" => "Stripe payment: ".$description,
|
||||||
|
"capture" => $capture,
|
||||||
"metadata" => $metadata,
|
"metadata" => $metadata,
|
||||||
"source" => "$source",
|
"source" => "$source",
|
||||||
"customer" => "$customer"
|
"customer" => "$customer"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user