Merge remote-tracking branch 'upstream/develop' into Squiz.Scope.MethodScope.Missing

This commit is contained in:
Frédéric FRANCE 2019-02-25 22:51:20 +01:00
commit 72ef70dbd7
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
3 changed files with 24 additions and 20 deletions

View File

@ -372,7 +372,7 @@ class Invoices extends DolibarrApi
throw new RestException(304, $this->invoice->error); throw new RestException(304, $this->invoice->error);
} }
} }
/** /**
* Add a contact type of given invoice * Add a contact type of given invoice
* *
@ -939,7 +939,7 @@ class Invoices extends DolibarrApi
if(! DolibarrApiAccess::$user->rights->facture->creer) { if(! DolibarrApiAccess::$user->rights->facture->creer) {
throw new RestException(401); throw new RestException(401);
} }
$result = $this->invoice->fetch($id); $result = $this->invoice->fetch($id);
if( ! $result ) { if( ! $result ) {
throw new RestException(404, 'Invoice not found'); throw new RestException(404, 'Invoice not found');
@ -956,9 +956,12 @@ class Invoices extends DolibarrApi
if (! $this->invoice->paye) // protection against multiple submit if (! $this->invoice->paye) // protection against multiple submit
{ {
$this->db->begin(); $this->db->begin();
$this->invoice->fetch_lines(); $this->invoice->fetch_lines();
$amount_ht = $amount_tva = $amount_ttc = array();
// Loop on each vat rate // Loop on each vat rate
$i=0; $i=0;
$amount_ht = array(); $amount_ht = array();
@ -1011,14 +1014,14 @@ class Invoices extends DolibarrApi
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
throw new RestException(500, 'Could not set paid'); throw new RestException(500, 'Could not set paid');
} }
} }
else else
{ {
$this->db->rollback(); $this->db->rollback();
throw new RestException(500, 'Discount creation error'); throw new RestException(500, 'Discount creation error');
} }
} }

View File

@ -150,7 +150,7 @@ ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
ACCOUNTING_SOCIAL_JOURNAL=Social journal ACCOUNTING_SOCIAL_JOURNAL=Social journal
ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal ACCOUNTING_HAS_NEW_JOURNAL=Has new Journal
ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transfer ACCOUNTING_ACCOUNT_TRANSFER_CASH=Accounting account of transitional bank transfer
ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait ACCOUNTING_ACCOUNT_SUSPENSE=Accounting account of wait
DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations DONATION_ACCOUNTINGACCOUNT=Accounting account to register donations
ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT=Accounting account to register subscriptions
@ -207,6 +207,7 @@ DescThirdPartyReport=Consult here the list of third-party customers and vendors
ListAccounts=List of the accounting accounts ListAccounts=List of the accounting accounts
UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdparty=Unknown third-party account. We will use %s
UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error
ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. Blocking error.
UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error
PaymentsNotLinkedToProduct=Payment not linked to any product / service PaymentsNotLinkedToProduct=Payment not linked to any product / service

View File

@ -243,13 +243,13 @@ class Stripe extends CommonObject
/** /**
* Get the Stripe payment intent * Get the Stripe payment intent
* *
* @param Societe $object Object tp pay on Stripe * @param Societe $object Object to pay with Stripe
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect * @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
* @param int $status Status (0=test, 1=live) * @param int $status Status (0=test, 1=live)
* @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt * @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email for receipt
* @param int $mode automatic=automatic payment, manual=need confirmation * @param int $mode automatic=automatic payment, manual=need confirmation
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found * @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found
*/ */
public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic') public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic')
{ {
@ -284,7 +284,7 @@ class Stripe extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$intent = $obj->ext_payment_id; $intent = $obj->ext_payment_id;
dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers); dol_syslog(get_class($this) . "::customerStripe found record");
// Force to use the correct API key // Force to use the correct API key
global $stripearrayofkeysbyenv; global $stripearrayofkeysbyenv;
@ -308,7 +308,7 @@ class Stripe extends CommonObject
if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100; if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100;
else $stripeamount = $object->multicurrency_total_ttc; else $stripeamount = $object->multicurrency_total_ttc;
$fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100); $fee = round(($object->total_ttc * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100);
if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) { if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) {
$fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100); $fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100);
} }
@ -328,9 +328,9 @@ class Stripe extends CommonObject
{ {
$dataforintent["application_fee"] = $fee; $dataforintent["application_fee"] = $fee;
} }
if ($societe->email && $usethirdpartyemailforreceiptemail) if ($usethirdpartyemailforreceiptemail && $object->thirdparty->email)
{ {
$dataforintent["receipt_email"] = $societe->email; $dataforintent["receipt_email"] = $object->thirdparty->email;
} }
try { try {