diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 4f525330e79..d0a67aa6448 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -788,10 +788,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $permissiontowrite = $user->rights->societe->creer; // Stripe customer key 'cu_....' stored into llx_societe_account print ''; - //print $langs->trans('StripeCustomerId'); print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); print ''; - //print $stripecu; print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); if (! empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account') { @@ -817,6 +815,60 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; } } + + if ($object->fournisseur && $conf->global->MAIN_FEATURES_LEVEL >= 2) + { + print ''; + print $langs->trans('SupplierCode').''; + print $object->code_fournisseur; + if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; + print ''; + $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; + $resql=$db->query($sql); + if (!$resql) dol_print_error($db); + $obj = $db->fetch_object($resql); + $nbFactsClient = $obj->nb; + $thirdTypeArray['customer']=$langs->trans("customer"); + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); + if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); + + if (! empty($conf->stripe->enabled) && ! empty($conf->stripeconnect->enabled)) + { + $permissiontowrite = $user->rights->societe->creer; + $stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here) + + // Stripe customer key 'cu_....' stored into llx_societe_account + print ''; + print $form->editfieldkey("StripeSupplierId", 'key_account_supplier', $stripesupplieracc, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); + print ''; + print $form->editfieldval("StripeSupplierId", 'key_account_supplier', $stripesupplieracc, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); + if (! empty($conf->stripe->enabled) && $stripesupplieracc && $action != 'editkey_account') + { + $connect=''; + + $url='https://dashboard.stripe.com/test/'.$stripesupplieracc; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/'.$stripesupplieracc; + } + print ' '.img_picto($langs->trans('ShowInStripe'), 'object_globe').''; + } + print ''; + if (empty($stripesupplieracc)) + { + print '
'; + print ''; + print ''; + print ''; + print ''; + //print ''; + print '
'; + } + print ''; + } + } print ''; print ''; @@ -826,7 +878,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; // List of Stripe payment modes - if (! (empty($conf->stripe->enabled))) + if (! (empty($conf->stripe->enabled)) && $object->client) { $morehtmlright=''; if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) @@ -1188,11 +1240,41 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } print ""; print ""; + print '
'; } - + + // List of Stripe payment modes + if (! empty($conf->stripe->enabled) && ! empty($conf->stripeconnect->enabled) && $object->fournisseur && ! empty($stripesupplieracc)) + { + print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc?' (Stripe connection with StripeConnect account '.$stripesupplieracc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); + $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); + print ''."\n"; + print ''; + print ''; + print ''; + print ''; + print ''; + + if (is_array($balance->available) && count($balance->available)) + { + foreach ($balance->available as $cpt) + { + print ''; + } + } + + if (is_array($balance->pending) && count($balance->pending)) + { + foreach ($balance->pending as $cpt) + { + print ''; + } + } + print '
'.$langs->trans('Status').''.$langs->trans('Amount').''.$langs->trans('Currency').'
'.$langs->trans("Available").''.price($cpt->amount, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).' '.$langs->trans("Currency".strtoupper($cpt->currency)).'
'.$langs->trans("Pending").''.price($cpt->amount, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).' '.$langs->trans("Currency".strtoupper($cpt->currency)).'
'; + print '
'; + } // List of bank accounts - print '
'; $morehtmlright= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=create');