36require
'../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
57$langs->loadLangs(array(
"companies",
"commercial",
"banks",
"bills",
'paypal',
'stripe',
'withdrawals'));
61$action =
GETPOST(
"action",
'alpha', 3);
62$cancel =
GETPOST(
'cancel',
'alpha');
63$backtopage =
GETPOST(
'backtopage');
66$source =
GETPOST(
"source",
"alpha");
72 $socid = $user->socid;
86$extrafields->fetch_name_optionals_label(
$object->table_element);
89$hookmanager->initHooks(array(
'thirdpartybancard',
'globalcard'));
92$permissiontoread = $user->hasRight(
'societe',
'lire');
93$permissiontoadd = $user->hasRight(
'societe',
'creer');
95$permissiontoaddupdatepaymentinformation = $user->hasRight(
'societe',
'thirdparty_paymentinformation',
'write');
106$site_account =
'UnknownSiteAccount';
110 $service =
'StripeTest';
112 $service =
'StripeLive';
117 global $stripearrayofkeysbyenv;
118 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
121 $stripeacc = $stripe->getStripeAccount($service);
122 $stripecu = $stripe->getStripeCustomerAccount(
$object->id, $servicestatus, $site_account);
137$parameters = array(
'id' => $socid);
138$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
143if (empty($reshook)) {
146 if (!empty($backtopage)) {
147 header(
"Location: ".$backtopage);
155 if (in_array($action, [
'update',
'updatecard',
'edit',
'editcard',
'setasbankdefault',
'confirm_deletecard',
'confirm_deletebank',
'synccardtostripe',
'syncsepatostripe'])) {
156 $idtocheckowner = ($ribid > 0 ? $ribid :
$id);
157 if ($idtocheckowner > 0) {
159 if ($tmppaymentinfo->fetch($idtocheckowner) <= 0 || $tmppaymentinfo->socid !=
$object->id) {
165 if ($action ==
'update' && $permissiontoaddupdatepaymentinformation) {
168 if (!
GETPOST(
'label',
'alpha')) {
169 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
172 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankName")),
null,
'errors');
177 $companybankaccount->fetch($id);
178 $companybankaccount->fk_country =
GETPOSTINT(
'account_country_id');
179 $companybankaccount->country_code =
getCountry($companybankaccount->fk_country,
'2');
180 if ($companybankaccount->needIBAN() == 1) {
182 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"IBAN")),
null,
'errors');
187 if ($companybankaccount->needBIC() == 1) {
189 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BIC")),
null,
'errors');
196 $companybankaccount->oldcopy =
dol_clone($companybankaccount, 2);
198 $companybankaccount->socid =
$object->id;
200 $companybankaccount->bank =
GETPOST(
'bank',
'alpha');
201 $companybankaccount->label =
GETPOST(
'label',
'alpha');
202 $companybankaccount->code_banque =
GETPOST(
'code_banque',
'alpha');
203 $companybankaccount->code_guichet =
GETPOST(
'code_guichet',
'alpha');
204 $companybankaccount->number =
GETPOST(
'number',
'alpha');
205 $companybankaccount->cle_rib =
GETPOST(
'cle_rib',
'alpha');
206 $companybankaccount->bic =
GETPOST(
'bic',
'alpha');
207 $companybankaccount->iban =
GETPOST(
'iban',
'alpha');
209 $companybankaccount->currency_code =
GETPOST(
'account_currency_code',
'alpha');
210 $companybankaccount->state_id =
GETPOSTINT(
'account_state_id');
211 $companybankaccount->address =
GETPOST(
'address',
'alpha');
213 $companybankaccount->owner_name =
GETPOST(
'proprio',
'alpha');
214 $companybankaccount->proprio = $companybankaccount->owner_name;
215 $companybankaccount->owner_address =
GETPOST(
'owner_address',
'alpha');
216 $companybankaccount->frstrecur =
GETPOST(
'frstrecur',
'alpha');
217 $companybankaccount->rum =
GETPOST(
'rum',
'alpha');
218 $companybankaccount->date_rum =
GETPOSTDATE(
'date_rum',
'00:00:00');
219 if (empty($companybankaccount->rum)) {
220 $companybankaccount->rum = $prelevement->buildRumNumber(
$object->code_client, $companybankaccount->datec, (
string) $companybankaccount->id);
223 $companybankaccount->status =
GETPOSTINT(
'clos');
225 if (
GETPOST(
'stripe_card_ref',
'alpha') &&
GETPOST(
'stripe_card_ref',
'alpha') != $companypaymentmode->stripe_card_ref) {
227 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
229 $companybankaccount->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
231 $result = $companybankaccount->update($user);
234 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
238 if ($companybankaccount->default_rib) {
239 $companybankaccount->setAsDefault($id);
242 if ($companypaymentmode->oldcopy->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
243 if ($companybankaccount->oldcopy->iban != $companybankaccount->iban) {
248 $url = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id;
249 header(
'Location: '.$url);
255 if ($action ==
'updatecard' && $permissiontoaddupdatepaymentinformation) {
257 if (!
GETPOST(
'label',
'alpha') || !
GETPOST(
'proprio',
'alpha') || !
GETPOST(
'exp_date_month',
'alpha') || !
GETPOST(
'exp_date_year',
'alpha')) {
258 if (!
GETPOST(
'label',
'alpha')) {
259 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
261 if (!
GETPOST(
'proprio',
'alpha')) {
262 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NameOnCard")),
null,
'errors');
265 if (!(
GETPOST(
'exp_date_month',
'alpha') > 0) || !(
GETPOST(
'exp_date_year',
'alpha') > 0)) {
266 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ExpiryDate")),
null,
'errors');
269 $action =
'createcard';
273 $companypaymentmode->fetch($id);
275 $companypaymentmode->oldcopy =
dol_clone($companypaymentmode, 2);
277 $companypaymentmode->fk_soc =
$object->id;
279 $companypaymentmode->bank =
GETPOST(
'bank',
'alpha');
280 $companypaymentmode->label =
GETPOST(
'label',
'alpha');
281 $companypaymentmode->number =
GETPOST(
'cardnumber',
'alpha');
282 $companypaymentmode->last_four = substr(
GETPOST(
'cardnumber',
'alpha'), -4);
283 $companypaymentmode->owner_name =
GETPOST(
'proprio',
'alpha');
284 $companypaymentmode->proprio = $companypaymentmode->owner_name;
285 $companypaymentmode->exp_date_month =
GETPOSTINT(
'exp_date_month');
286 $companypaymentmode->exp_date_year =
GETPOSTINT(
'exp_date_year');
287 $companypaymentmode->cvn =
GETPOST(
'cvn',
'alpha');
288 $companypaymentmode->country_code =
$object->country_code;
290 if (
GETPOST(
'stripe_card_ref',
'alpha') &&
GETPOST(
'stripe_card_ref',
'alpha') != $companypaymentmode->stripe_card_ref) {
292 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
294 $companypaymentmode->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
296 $result = $companypaymentmode->update($user);
298 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
301 if ($companypaymentmode->default_rib) {
302 $companypaymentmode->setAsDefault($id);
305 if ($companypaymentmode->oldcopy->stripe_card_ref != $companypaymentmode->stripe_card_ref) {
306 if ($companybankaccount->oldcopy->number != $companybankaccount->number) {
311 $url = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id;
312 header(
'Location: '.$url);
319 if ($action ==
'add' && $permissiontoaddupdatepaymentinformation) {
322 if (!
GETPOST(
'label',
'alpha')) {
323 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
332 $companybankaccount->socid =
$object->id;
334 $companybankaccount->fetch_thirdparty();
336 $companybankaccount->bank =
GETPOST(
'bank',
'alpha');
337 $companybankaccount->label =
GETPOST(
'label',
'alpha');
338 $companybankaccount->code_banque =
GETPOST(
'code_banque',
'alpha');
339 $companybankaccount->code_guichet =
GETPOST(
'code_guichet',
'alpha');
340 $companybankaccount->number =
GETPOST(
'number',
'alpha');
341 $companybankaccount->cle_rib =
GETPOST(
'cle_rib',
'alpha');
342 $companybankaccount->bic =
GETPOST(
'bic',
'alpha');
343 $companybankaccount->iban =
GETPOST(
'iban',
'alpha');
345 $companybankaccount->currency_code =
GETPOST(
'account_currency_code',
'alpha');
346 $companybankaccount->fk_country =
GETPOSTINT(
'account_country_id');
347 $companybankaccount->country_code =
getCountry($companybankaccount->fk_country,
'2');
348 $companybankaccount->state_id =
GETPOSTINT(
'account_state_id');
349 $companybankaccount->address =
GETPOST(
'address',
'alpha');
351 $companybankaccount->owner_name =
GETPOST(
'proprio',
'alpha');
352 $companybankaccount->proprio = $companybankaccount->owner_name;
353 $companybankaccount->owner_address =
GETPOST(
'owner_address',
'alpha');
354 $companybankaccount->frstrecur =
GETPOST(
'frstrecur',
'alpha');
355 $companybankaccount->rum =
GETPOST(
'rum',
'alpha');
356 $companybankaccount->date_rum =
GETPOSTDATE(
'date_rum',
'00:00:00');
357 $companybankaccount->datec =
dol_now();
359 $companybankaccount->status =
GETPOSTINT(
'clos');
361 $companybankaccount->bank = trim($companybankaccount->bank);
362 if (empty($companybankaccount->bank) && !empty($companybankaccount->thirdparty)) {
363 $companybankaccount->bank = $langs->trans(
"Bank").
' '.$companybankaccount->thirdparty->name;
365 $companybankaccount->bic = str_replace(
' ',
'', $companybankaccount->bic);
370 if ($companybankaccount->needIBAN() == 1) {
372 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"IBAN")),
null,
'errors');
377 if ($companybankaccount->needBIC() == 1) {
379 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BIC")),
null,
'errors');
386 $result = $companybankaccount->create($user);
389 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
393 if (empty($companybankaccount->rum)) {
394 $companybankaccount->rum = $prelevement->buildRumNumber(
$object->code_client, $companybankaccount->datec, (
string) $companybankaccount->id);
399 $result = $companybankaccount->update($user);
402 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
410 $url = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id;
411 header(
'Location: '.$url);
420 if ($action ==
'addcard' && $permissiontoaddupdatepaymentinformation) {
423 if (!
GETPOST(
'label',
'alpha') || !
GETPOST(
'proprio',
'alpha') || !
GETPOST(
'exp_date_month',
'alpha') || !
GETPOST(
'exp_date_year',
'alpha')) {
424 if (!
GETPOST(
'label',
'alpha')) {
425 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
427 if (!
GETPOST(
'proprio',
'alpha')) {
428 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NameOnCard")),
null,
'errors');
431 if (!(
GETPOST(
'exp_date_month',
'alpha') > 0) || !(
GETPOST(
'exp_date_year',
'alpha') > 0)) {
432 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ExpiryDate")),
null,
'errors');
435 $action =
'createcard';
443 $companypaymentmode->fk_soc =
$object->id;
444 $companypaymentmode->bank =
GETPOST(
'bank',
'alpha');
445 $companypaymentmode->label =
GETPOST(
'label',
'alpha');
446 $companypaymentmode->number =
GETPOST(
'cardnumber',
'alpha');
447 $companypaymentmode->last_four = substr(
GETPOST(
'cardnumber',
'alpha'), -4);
448 $companypaymentmode->proprio =
GETPOST(
'proprio',
'alpha');
449 $companypaymentmode->exp_date_month =
GETPOSTINT(
'exp_date_month');
450 $companypaymentmode->exp_date_year =
GETPOSTINT(
'exp_date_year');
451 $companypaymentmode->cvn =
GETPOST(
'cvn',
'alpha');
452 $companypaymentmode->datec =
dol_now();
453 $companypaymentmode->default_rib = 0;
454 $companypaymentmode->type =
'card';
455 $companypaymentmode->country_code =
$object->country_code;
456 $companypaymentmode->status = $servicestatus;
458 if (
GETPOST(
'stripe_card_ref',
'alpha')) {
460 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
462 $companypaymentmode->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
467 $result = $companypaymentmode->create($user);
470 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
471 $action =
'createcard';
478 $url = $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id;
479 header(
'Location: '.$url);
487 if ($action ==
'setasbankdefault' &&
GETPOSTINT(
'ribid') > 0 && $permissiontoaddupdatepaymentinformation) {
489 $res = $companybankaccount->setAsDefault(
GETPOSTINT(
'ribid'));
491 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id;
492 header(
'Location: '.$url);
499 if ($action ==
'confirm_deletecard' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoaddupdatepaymentinformation) {
502 if ($companypaymentmode->fetch($ribid ? $ribid :
$id)) {
513 $result = $companypaymentmode->delete($user);
515 $url = $_SERVER[
'PHP_SELF'].
"?socid=".
$object->id;
517 header(
'Location: '.$url);
520 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
523 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
526 if ($action ==
'confirm_deletebank' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoaddupdatepaymentinformation) {
529 if ($companybankaccount->fetch($ribid ? $ribid :
$id) > 0) {
540 $result = $companybankaccount->delete($user);
543 $url = $_SERVER[
'PHP_SELF'].
"?socid=".
$object->id;
545 header(
'Location: '.$url);
548 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
551 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
558 if ($action ==
'builddocrib' && $permissiontoread) {
559 $action =
'builddoc';
561 'use_companybankid' =>
GETPOST(
'companybankid'),
564 $_POST[
'lang_id'] =
GETPOST(
'lang_idrib'.
GETPOSTINT(
'companybankid'),
'alphanohtml');
565 $_POST[
'model'] =
GETPOST(
'modelrib'.
GETPOSTINT(
'companybankid'),
'alphanohtml');
570 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
576 if (($action ==
'synccustomertostripe' || $action ==
'synccustomertostripetest') && $permissiontoaddupdatepaymentinformation) {
581 if ($action ==
'synccustomertostripe') {
582 $tmpservicestatus = 1;
583 $tmpservice =
'StripeLive';
585 $tmpservicestatus = 0;
586 $tmpservice =
'StripeTest';
590 $tmpstripeacc = $stripe->getStripeAccount($tmpservice);
593 $tmpcu = $stripe->customerStripe($object, $tmpstripeacc, $tmpservicestatus, 1);
599 if ($tmpservicestatus == $servicestatus) {
600 $stripecu = $tmpcu->id;
605 if ($action ==
'synccardtostripe' && $permissiontoaddupdatepaymentinformation && $stripeacc !==
null) {
608 $companypaymentmode->fetch($id);
610 if ($companypaymentmode->type !=
'card') {
615 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
622 '@phan-var-force \Stripe\Customer $cu';
626 $card = $stripe->cardStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1);
634 if ($action ==
'syncsepatostripe' && $permissiontoaddupdatepaymentinformation && $stripeacc !==
null) {
637 $companypaymentmode->fetch($id);
639 if ($companypaymentmode->type !=
'ban') {
641 $langs->load(
"errors");
645 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
649 $langs->load(
"errors");
650 setEventMessages($langs->trans(
"ErrorStripeCustomerNotFoundCreateFirst"),
null,
'errors');
653 '@phan-var-force \Stripe\Customer $cu';
655 $card = $stripe->sepaStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1);
660 setEventMessages(
"", array(
"Bank Account on Stripe",
"BAN is now linked to the Stripe customer account !"));
667 if (($action ==
'setkey_account' || $action ==
'setkey_accounttest') && $permissiontoaddupdatepaymentinformation) {
670 $tmpservice =
'StripeTest';
671 $tmpservicestatus = 0;
672 if ($action ==
'setkey_account') {
673 $tmpservice =
'StripeLive';
674 $tmpservicestatus = 1;
678 global $stripearrayofkeysbyenv;
679 $tmpsite_account = $stripearrayofkeysbyenv[$tmpservicestatus][
'publishable_key'];
681 if ($action ==
'setkey_account') {
682 $newcu =
GETPOST(
'key_account',
'alpha');
684 $newcu =
GETPOST(
'key_accounttest',
'alpha');
690 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_account";
691 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account).
"') AND fk_soc = ".((int)
$object->id).
" AND status = ".((int) $tmpservicestatus).
" AND entity = ".((int)
$conf->entity);
693 $sql =
'SELECT rowid FROM '.MAIN_DB_PREFIX.
"societe_account";
694 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account).
"') AND fk_soc = ".((int)
$object->id).
" AND status = ".((int) $tmpservicestatus).
" AND entity = ".((int)
$conf->entity);
697 $resql =
$db->query($sql);
698 $num =
$db->num_rows($resql);
700 if (!empty($newcu)) {
703 $societeaccount->fk_soc =
$object->id;
704 $societeaccount->login =
'';
705 $societeaccount->pass_encoding =
'';
706 $societeaccount->site =
'stripe';
707 $societeaccount->status = $servicestatus;
708 $societeaccount->key_account = $newcu;
709 $societeaccount->site_account = $tmpsite_account;
710 $result = $societeaccount->create($user);
715 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"societe_account";
716 $sql .=
" SET key_account = '".$db->escape($newcu).
"', site_account = '".
$db->escape($tmpsite_account).
"'";
717 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($tmpsite_account).
"') AND fk_soc = ".((int)
$object->id).
" AND status = ".((int) $tmpservicestatus).
" AND entity = ".((int)
$conf->entity);
718 $resql =
$db->query($sql);
726 if ($tmpservicestatus == $servicestatus) {
736 if (($action ==
'setkey_account_supplier' || $action ==
'setkey_account_suppliertest') && $permissiontoaddupdatepaymentinformation) {
739 $tmpservice =
'StripeTest';
740 $tmpservicestatus = 0;
741 if ($action ==
'setkey_account_supplier') {
742 $tmpservice =
'StripeLive';
743 $tmpservicestatus = 1;
747 global $stripearrayofkeysbyenv;
748 $tmpsite_account = $stripearrayofkeysbyenv[$tmpservicestatus][
'publishable_key'];
750 if ($action ==
'setkey_account_supplier') {
751 $newsup =
GETPOST(
'key_account_supplier',
'alpha');
753 $newsup =
GETPOST(
'key_account_suppliertest',
'alpha');
759 if (empty($newsup)) {
760 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"oauth_token WHERE fk_soc = ".((int)
$object->id).
" AND service = '".
$db->escape($tmpservice).
"' AND entity = ".((int)
$conf->entity);
765 $stripesup = \Stripe\Account::retrieve($newsup);
766 $tokenstring = array();
767 $tokenstring[
'stripe_user_id'] = $stripesup->id;
768 $tokenstring[
'type'] = $stripesup->type;
769 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"oauth_token";
770 $sql .=
" SET tokenstring = '".$db->escape(json_encode($tokenstring)).
"'";
771 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$db->escape($tmpsite_account).
"') AND fk_soc = ".((int)
$object->id).
" AND service = '".
$db->escape($tmpservice).
"' AND entity = ".((int)
$conf->entity);
773 $sql .=
" WHERE fk_soc = ".((int)
$object->id).
" AND service = '".
$db->escape($tmpservice).
"' AND entity = ".((int)
$conf->entity);
780 $resql =
$db->query($sql);
781 $num =
$db->num_rows($resql);
782 if (empty($num) && !empty($newsup)) {
784 $stripesup = \Stripe\Account::retrieve($newsup);
785 $tokenstring[
'stripe_user_id'] = $stripesup->id;
786 $tokenstring[
'type'] = $stripesup->type;
787 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"oauth_token (service, fk_soc, entity, tokenstring)";
788 $sql .=
" VALUES ('".$db->escape($tmpservice).
"', ".((int)
$object->id).
", ".((int)
$conf->entity).
", '".
$db->escape(json_encode($tokenstring)).
"')";
794 $resql =
$db->query($sql);
798 if ($tmpservicestatus == $servicestatus) {
799 $stripesupplieracc = $newsup;
807 if ($action ==
'setlocalassourcedefault' && $permissiontoaddupdatepaymentinformation) {
809 $companypaymentmode->setAsDefault($id);
811 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id;
812 header(
'Location: '.$url);
818 } elseif ($action ==
'setassourcedefault' && $permissiontoaddupdatepaymentinformation && $stripeacc !==
null) {
820 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
821 if (preg_match(
'/pm_|src_/', $source)) {
822 $cu->invoice_settings->default_payment_method = (
string) $source;
824 $cu->default_source = (
string) $source;
827 $result = $cu->save();
829 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id;
830 header(
'Location: '.$url);
836 } elseif ($action ==
'deletecard' && $source && $permissiontoaddupdatepaymentinformation && $stripeacc !==
null) {
839 if (preg_match(
'/pm_/', $source)) {
840 $payment_method = \Stripe\PaymentMethod::retrieve($source, array(
"stripe_account" => $stripeacc));
841 if ($payment_method) {
842 $payment_method->detach();
845 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
846 $card = $cu->sources->retrieve(
"$source");
849 if (method_exists($card,
'detach')) {
851 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"societe_rib as sr ";
852 $sql .=
" SET stripe_card_ref = null";
853 $sql .=
" WHERE sr.stripe_card_ref = '".$db->escape($source).
"'";
855 $resql =
$db->query($sql);
862 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id;
863 header(
'Location: '.$url);
869 } elseif ($action ==
'deletebank' && $source && $permissiontoaddupdatepaymentinformation && $stripeacc !==
null) {
872 if (preg_match(
'/pm_/', $source)) {
873 $payment_method = \Stripe\PaymentMethod::retrieve($source, array(
"stripe_account" => $stripeacc));
874 if ($payment_method) {
875 $payment_method->detach();
878 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
879 $card = $cu->sources->retrieve((
string) $source);
882 if (method_exists($card,
'detach')) {
884 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"societe_rib as sr ";
885 $sql .=
" SET stripe_card_ref = null";
886 $sql .=
" WHERE sr.stripe_card_ref = '".$db->escape($source).
"'";
888 $resql =
$db->query($sql);
895 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id;
897 $url .=
'&page_y='.GETPOSTINT(
'page_y');
900 header(
'Location: '.$url);
921$countrynotdefined = $langs->trans(
"ErrorSetACountryFirst").
' ('.$langs->trans(
"SeeAbove").
')';
923$title = $langs->trans(
"ThirdParty");
925 $title =
$object->name.
" - ".$langs->trans(
'PaymentInformation');
938 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'), [],
'warning');
943 $companybankaccount->fetch($id);
944 $companypaymentmode->fetch($id);
945} elseif (!in_array($action, array(
'create',
'createcard'))) {
947 $companybankaccount->fetch(0,
'',
$object->id);
949 $companypaymentmode->fetch(0,
'',
$object->id,
'card');
951if (empty($companybankaccount->socid)) {
952 $companybankaccount->socid =
$object->id;
955if ($socid && ($action ==
'edit' || $action ==
'editcard') && $permissiontoaddupdatepaymentinformation) {
956 if ($action ==
'edit' &&
$conf->use_javascript_ajax) {
958 print
"\n".
'<script type="text/javascript">';
959 print
'jQuery(document).ready(function () {
960 jQuery("#selectaccount_country_id").change(function() {
961 document.formbank.action.value="edit";
962 document.formbank.submit();
965 print
'</script>'.
"\n";
967 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formbank" spellcheck="false">';
968 print
'<input type="hidden" name="token" value="'.newToken().
'">';
969 $actionforadd =
'update';
970 if ($action ==
'editcard') {
971 $actionforadd =
'updatecard';
973 print
'<input type="hidden" name="action" value="'.$actionforadd.
'">';
974 print
'<input type="hidden" name="id" value="'.GETPOSTINT(
"id").
'">';
976if ($socid && ($action ==
'create' || $action ==
'createcard') && $permissiontoaddupdatepaymentinformation) {
977 if ($action ==
'create' &&
$conf->use_javascript_ajax) {
979 print
"\n".
'<script type="text/javascript">';
980 print
'jQuery(document).ready(function () {
981 jQuery("#selectaccount_country_id").change(function() {
982 document.formbank.action.value="create";
983 document.formbank.submit();
986 print
'</script>'.
"\n";
988 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'" method="post" name="formbank" spellcheck="false">';
989 print
'<input type="hidden" name="token" value="'.newToken().
'">';
990 $actionforadd =
'add';
991 if ($action ==
'createcard') {
992 $actionforadd =
'addcard';
994 print
'<input type="hidden" name="action" value="'.$actionforadd.
'">';
998if ($socid && $action !=
'edit' && $action !=
'create' && $action !=
'editcard' && $action !=
'createcard') {
1002 if ($action ==
'deletebank') {
1003 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id.
"&ribid=".($ribid ? $ribid :
$id), $langs->trans(
"DeleteARib"), $langs->trans(
"ConfirmDeleteRib", $companybankaccount->getRibLabel()),
"confirm_deletebank",
'', 0, 1);
1006 if ($action ==
'deletecard') {
1007 print $form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
$object->id.
"&ribid=".($ribid ? $ribid :
$id), $langs->trans(
"DeleteACard"), $langs->trans(
"ConfirmDeleteCard", $companybankaccount->getRibLabel()),
"confirm_deletecard",
'', 0, 1);
1010 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1012 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
1014 print
'<div class="fichecenter">';
1016 print
'<div class="underbanner clearboth"></div>';
1017 print
'<table class="border tableforfield centpercent">';
1020 print
'<tr><td class="titlefield">';
1021 print $langs->trans(
'NatureOfThirdParty');
1027 print
'<tr><td class="titlefield">';
1028 print $langs->trans(
'CustomerCode');
1031 $tmpcheck =
$object->check_codeclient();
1032 if ($tmpcheck != 0 && $tmpcheck != -5) {
1033 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
1036 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
1037 $resql =
$db->query($sql);
1042 $obj =
$db->fetch_object($resql);
1043 $nbFactsClient = $obj->nb;
1044 $thirdTypeArray = array();
1045 $elementTypeArray = array();
1046 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
1047 if (
isModEnabled(
"propal") && $user->hasRight(
'propal',
'lire')) {
1048 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
1050 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
1051 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
1053 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1054 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
1056 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
1057 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
1062 global $stripearrayofkeysbyenv;
1065 $tmpsite_account = $stripearrayofkeysbyenv[$tmpservice][
'publishable_key'];
1066 $tmpstripeacc = $stripe->getStripeAccount((
string) $tmpservice);
1067 $tmpstripecu = $stripe->getStripeCustomerAccount(
$object->id, $tmpservice, $tmpsite_account);
1070 print
'<tr><td class="titlefield">';
1071 print $form->editfieldkey($langs->trans(
"StripeCustomerId").
' (Test)',
'key_accounttest', $tmpstripecu, $object, (
int) $permissiontoaddupdatepaymentinformation,
'string',
'', 0, 2,
'socid');
1072 print
'</td><td'.(empty($tmpstripecu) ?
' class="right"' :
'').
'>';
1073 print $form->editfieldval($langs->trans(
"StripeCustomerId").
' (Test)',
'key_accounttest', $tmpstripecu,
$object, $permissiontoaddupdatepaymentinformation,
'string',
'',
null,
null,
'', 2,
'',
'socid');
1074 if ($tmpstripecu && $action !=
'editkey_accounttest') {
1076 if (!empty($stripeacc)) {
1077 $connect = $stripeacc.
'/';
1079 $url =
'https://dashboard.stripe.com/'.$connect.
'test/customers/'.$tmpstripecu;
1080 print
' <a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Publishable key = '.$tmpsite_account,
'globe').
'</a>';
1082 if (empty($tmpstripecu)) {
1083 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" class="nowraponall" spellcheck="false">';
1084 print
'<input type="hidden" name="action" value="synccustomertostripetest">';
1085 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1086 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
1087 print
img_picto($langs->trans(
"CreateCustomerOnStripe"),
'stripe');
1088 print
'<input type="submit" class="buttonlink nomargintop nomarginbottom noborderbottom nopaddingtopimp nopaddingbottomimp" name="syncstripecustomertest" value="'.$langs->trans(
"CreateCustomerOnStripe").
'">';
1094 $tmpsite_account = $stripearrayofkeysbyenv[$tmpservice][
'publishable_key'];
1095 $tmpstripeacc = $stripe->getStripeAccount((
string) $tmpservice);
1096 $tmpstripecu = $stripe->getStripeCustomerAccount(
$object->id, $tmpservice, $tmpsite_account);
1099 print
'<tr><td class="titlefield">';
1100 print $form->editfieldkey($langs->trans(
"StripeCustomerId").
' (Live)',
'key_account', $tmpstripecu, $object, (
int) $permissiontoaddupdatepaymentinformation,
'string',
'', 0, 2,
'socid');
1101 print
'</td><td'.(empty($tmpstripecu) ?
' class="right"' :
'').
'>';
1102 print $form->editfieldval($langs->trans(
"StripeCustomerId").
' (Live)',
'key_account', $tmpstripecu,
$object, $permissiontoaddupdatepaymentinformation,
'string',
'',
null,
null,
'', 2,
'',
'socid');
1103 if ($tmpstripecu && $action !=
'editkey_account') {
1105 if (!empty($stripeacc)) {
1106 $connect = $stripeacc.
'/';
1108 $url =
'https://dashboard.stripe.com/'.$connect.
'customers/'.$tmpstripecu;
1109 print
' <a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Publishable key = '.$tmpsite_account,
'globe').
'</a>';
1111 if (empty($tmpstripecu)) {
1112 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" class="nowraponall" spellcheck="false">';
1113 print
'<input type="hidden" name="action" value="synccustomertostripe">';
1114 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1115 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
1116 print
img_picto($langs->trans(
"CreateCustomerOnStripe"),
'stripe');
1117 print
'<input type="submit" class="buttonlink nomargintop nomarginbottom noborderbottom nopaddingtopimp nopaddingbottomimp" name="syncstripecustomer" value="'.$langs->trans(
"CreateCustomerOnStripe").
'">';
1125 print
'<tr><td class="titlefield">';
1126 print $langs->trans(
'SupplierCode');
1129 $tmpcheck =
$object->check_codefournisseur();
1130 if ($tmpcheck != 0 && $tmpcheck != -5) {
1131 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
1134 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
1135 $resql =
$db->query($sql);
1139 $obj =
$db->fetch_object($resql);
1140 $nbFactsClient = $obj->nb;
1141 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
1142 if (
isModEnabled(
'propal') && $user->hasRight(
'propal',
'lire')) {
1143 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
1145 if (
isModEnabled(
'order') && $user->hasRight(
'commande',
'lire')) {
1146 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
1148 if (
isModEnabled(
'invoice') && $user->hasRight(
'facture',
'lire')) {
1149 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
1151 if (
isModEnabled(
'contract') && $user->hasRight(
'contrat',
'lire')) {
1152 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
1158 $stripesupplieracc = $stripe->getStripeAccount($service,
$object->id);
1161 print
'<tr><td class="titlefield">';
1162 print $form->editfieldkey(
"StripeConnectAccount",
'key_account_supplier', $stripesupplieracc, $object, (
int) $permissiontoaddupdatepaymentinformation,
'string',
'', 0, 2,
'socid');
1163 print
'</td><td'.(empty($stripesupplieracc) ?
' class="right"' :
'').
'>';
1164 print $form->editfieldval(
"StripeConnectAccount",
'key_account_supplier', $stripesupplieracc, $object, $permissiontoaddupdatepaymentinformation,
'string',
'',
null,
null,
'', 2,
'',
'socid');
1165 if ($stripesupplieracc && $action !=
'editkey_account_supplier') {
1168 $url =
'https://dashboard.stripe.com/test/connect/accounts/'.$stripesupplieracc;
1169 if ($servicestatus) {
1170 $url =
'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc;
1172 print
' <a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Publishable key '.$site_account,
'globe').
'</a>';
1174 if (empty($stripesupplieracc)) {
1175 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post" class="nowraponall" spellcheck="false">';
1176 print
'<input type="hidden" name="action" value="syncsuppliertostripe">';
1177 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1178 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
1179 print
'<input type="hidden" name="companybankid" value="'.$ribid.
'">';
1193 $showcardpaymentmode = 0;
1195 $showcardpaymentmode++;
1199 $listofsources = array();
1201 $customerstripe =
null;
1202 if (isset($stripe) && is_object($stripe) && $stripeacc !==
null) {
1204 $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus);
1205 if (!empty($customerstripe->id)) {
1208 $listofsources = $customerstripe->sources->data;
1210 $service =
'StripeTest';
1213 $service =
'StripeLive';
1218 global $stripearrayofkeysbyenv;
1219 \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus][
'secret_key']);
1222 if (empty($stripeacc)) {
1223 $paymentmethodobjsA = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"card"));
1224 $paymentmethodobjsB = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"sepa_debit"));
1226 $paymentmethodobjsA = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"card"), array(
"stripe_account" => $stripeacc));
1227 $paymentmethodobjsB = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"sepa_debit"), array(
"stripe_account" => $stripeacc));
1230 if ($paymentmethodobjsA->data !=
null && $paymentmethodobjsB->data !=
null) {
1231 $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data);
1232 } elseif ($paymentmethodobjsB->data !=
null) {
1233 $listofsources = $paymentmethodobjsB->data;
1235 $listofsources = $paymentmethodobjsA->data;
1244 dol_syslog(
"Error when searching/loading Stripe customer for thirdparty id =".
$object->id);
1250 if ($showcardpaymentmode &&
$object->client) {
1251 $morehtmlright =
'';
1253 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&action=createcard');
1255 print
load_fiche_titre($langs->trans(
'CreditCard'), $morehtmlright,
'fa-credit-card');
1258 print
'<!-- List of card payments -->'.
"\n";
1259 print
'<div class="div-table-responsive-no-min">';
1260 print
'<table class="liste centpercent noborder">'.
"\n";
1261 print
'<tr class="liste_titre">';
1262 print
'<td>'.$langs->trans(
'Label').
'</td>';
1263 print
'<td>'.$form->textwithpicto($langs->trans(
'ExternalSystemID'), $langs->trans(
"IDOfPaymentInAnExternalSystem")).
'</td>';
1264 print
'<td>'.$langs->trans(
'Type').
'</td>';
1265 print
'<td>'.$langs->trans(
'Informations').
'</td>';
1267 print
'<td class="center">'.$langs->trans(
'Default').
'</td>';
1268 print
'<td>'.$langs->trans(
'Note').
'</td>';
1269 print
'<td>'.$langs->trans(
'DateModification').
'</td>';
1271 $parameters = array(
'arrayfields' => array(),
'param' =>
'',
'sortfield' =>
'',
'sortorder' =>
'',
'linetype' =>
'stripetitle');
1272 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1273 print $hookmanager->resPrint;
1280 $arrayofremotecard = array();
1287 $sql =
'SELECT rowid FROM '.MAIN_DB_PREFIX.
"societe_rib";
1288 $sql .=
" WHERE type in ('card')";
1289 $sql .=
" AND fk_soc = ".((int)
$object->id);
1290 $sql .=
" AND status = ".((int) $servicestatus);
1292 $resql =
$db->query($sql);
1294 $num_rows =
$db->num_rows($resql);
1297 while ($i < $num_rows) {
1300 $obj =
$db->fetch_object($resql);
1302 $companypaymentmodetemp->fetch($obj->rowid);
1304 $arrayofremotecard[$companypaymentmodetemp->stripe_card_ref] = $companypaymentmodetemp->stripe_card_ref;
1306 print
'<tr class="oddeven" data-rowid="'.((int) $companypaymentmodetemp->id).
'">';
1308 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companypaymentmodetemp->label).
'">';
1312 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companypaymentmodetemp->stripe_card_ref.(empty($companypaymentmodetemp->stripe_account) ?
'' :
' - '.$companypaymentmodetemp->stripe_account)).
'">';
1313 if (!empty($companypaymentmodetemp->stripe_card_ref) && !empty($companypaymentmodetemp->ext_payment_site)) {
1314 if (
isModEnabled(
'stripe') && in_array($companypaymentmodetemp->ext_payment_site, array(
'StripeTest',
'StripeLive'))) {
1316 if (!empty($stripeacc)) {
1317 $connect = $stripeacc.
'/';
1319 if ($companypaymentmodetemp->ext_payment_site ==
'StripeLive') {
1320 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$companypaymentmodetemp->stripe_card_ref;
1322 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$companypaymentmodetemp->stripe_card_ref;
1324 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe').
' - '.$companypaymentmodetemp->stripe_account,
'globe').
"</a> ";
1335 print
'<td class="minwidth100">';
1336 if ($companypaymentmodetemp->owner_name) {
1337 print
'<span class="opacitymedium">'.$companypaymentmodetemp->owner_name.
'</span><br>';
1339 if ($companypaymentmodetemp->last_four) {
1340 print
'....'.$companypaymentmodetemp->last_four;
1342 if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) {
1343 print
' - '.sprintf(
"%02d", $companypaymentmodetemp->exp_date_month).
'/'.$companypaymentmodetemp->exp_date_year;
1347 print
'<td class="tdoverflowmax100">';
1348 if ($companypaymentmodetemp->country_code) {
1350 print $img ? $img.
' ' :
'';
1351 print
getCountry($companypaymentmodetemp->country_code,
'1');
1353 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1357 print
'<td class="center">';
1358 if (empty($companypaymentmodetemp->default_rib)) {
1359 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=setlocalassourcedefault&token='.
newToken().
'">';
1360 print
img_picto($langs->trans(
"Default"),
'off');
1363 print
img_picto($langs->trans(
"Default"),
'on');
1366 if (empty($companypaymentmodetemp->stripe_card_ref)) {
1367 $s = $langs->trans(
"Local");
1369 $s = $langs->trans(
"LocalAndRemote");
1371 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1375 print
dol_print_date($companypaymentmodetemp->date_modification,
'dayhour',
'tzuserrel');
1378 $parameters = array(
'arrayfields' => array(),
'obj' => $obj,
'linetype' =>
'stripecard');
1379 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1380 print $hookmanager->resPrint;
1382 print
'<td class="right minwidth50 nowraponall">';
1383 if ($permissiontoaddupdatepaymentinformation) {
1384 if ($stripecu && empty($companypaymentmodetemp->stripe_card_ref)) {
1385 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=synccardtostripe&token='.
newToken().
'&socid='.
$object->id.
'&id='.$companypaymentmodetemp->id.
'" class="paddingrightonly marginrightonly">'.$langs->trans(
"CreateCardOnStripe").
'</a>';
1388 print
'<a class="editfielda marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=editcard&token='.
newToken().
'">';
1389 print
img_picto($langs->trans(
"Modify"),
'edit');
1391 print
'<a class="marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=deletecard&token='.
newToken().
'">';
1392 print
img_picto($langs->trans(
"Delete"),
'delete');
1407 if (is_array($listofsources) && count($listofsources)) {
1408 foreach ($listofsources as $src) {
1409 if (!empty($arrayofremotecard[$src->id])) {
1416 if ($src->object ==
'card') {
1418 } elseif ($src->object ==
'source' && $src->type ==
'card') {
1420 } elseif ($src->object ==
'payment_method' && $src->type ==
'card') {
1422 } elseif ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1424 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1428 print
'<tr class="oddeven">';
1432 print
'<td class="tdoverflowmax150">';
1434 if (!empty($stripeacc)) {
1435 $connect = $stripeacc.
'/';
1438 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$src->id;
1439 if ($servicestatus) {
1441 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$src->id;
1443 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1451 print
'<td valign="middle">';
1452 if ($src->object ==
'card') {
1453 print
'....'.$src->last4.
' - '.$src->exp_month.
'/'.$src->exp_year;
1455 if ($src->country) {
1457 print $img ? $img.
' ' :
'';
1460 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1462 } elseif ($src->object ==
'source' && $src->type ==
'card') {
1463 print
'<span class="opacitymedium">'.$src->owner->name.
'</span><br>....'.$src->card->last4.
' - '.$src->card->exp_month.
'/'.$src->card->exp_year;
1466 if ($src->card->country) {
1468 print $img ? $img.
' ' :
'';
1471 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1473 } elseif ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1474 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->sepa_debit->last4;
1476 if ($src->sepa_debit->country) {
1478 print $img ? $img.
' ' :
'';
1479 print
getCountry($src->sepa_debit->country,
'1');
1481 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1483 } elseif ($src->object ==
'payment_method' && $src->type ==
'card') {
1484 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->card->last4.
' - '.$src->card->exp_month.
'/'.$src->card->exp_year;
1487 if ($src->card->country) {
1489 print $img ? $img.
' ' :
'';
1492 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1494 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1495 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->sepa_debit->last4;
1497 if ($src->sepa_debit->country) {
1499 print $img ? $img.
' ' :
'';
1500 print
getCountry($src->sepa_debit->country,
'1');
1502 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1509 print
'<td class="center" width="50">';
1510 if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) ||
1511 (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) {
1512 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&source='.$src->id.
'&action=setassourcedefault&token='.
newToken().
'">';
1513 print
img_picto($langs->trans(
"Default"),
'off');
1516 print
img_picto($langs->trans(
"Default"),
'on');
1520 print $langs->trans(
"Remote");
1529 $parameters = array(
'arrayfields' => array(),
'stripesource' => $src,
'linetype' =>
'stripecardremoteonly');
1530 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1531 print $hookmanager->resPrint;
1534 print
'<td class="right nowraponall">';
1535 if ($permissiontoaddupdatepaymentinformation) {
1536 print
'<a class="marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&source='.$src->id.
'&action=deletecard&token='.
newToken().
'">';
1537 print
img_picto($langs->trans(
"Delete"),
'delete');
1546 if ($nbremote == 0 && $nblocal == 0) {
1548 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
1556 if (
isModEnabled(
'stripe') && !empty(
$conf->stripeconnect->enabled) && !empty($stripesupplieracc)) {
1557 print
load_fiche_titre($langs->trans(
'StripeBalance').($stripesupplieracc ?
' (Stripe connection with StripeConnect account '.$stripesupplieracc.
')' :
' (Stripe connection with keys from Stripe module setup)'), $morehtmlright,
'stripe-s');
1558 $balance = \Stripe\Balance::retrieve(array(
"stripe_account" => $stripesupplieracc));
1559 print
'<!-- List of Stripe connected accounts -->'.
"\n";
1560 print
'<table class="liste centpercent noborder">'.
"\n";
1561 print
'<tr class="liste_titre">';
1562 print
'<td>'.$langs->trans(
'Currency').
'</td>';
1563 print
'<td>'.$langs->trans(
'Available').
'</td>';
1564 print
'<td>'.$langs->trans(
'Pending').
'</td>';
1565 print
'<td>'.$langs->trans(
'Total').
'</td>';
1568 $currencybalance = array();
1569 if (is_array($balance->available) && count($balance->available)) {
1570 foreach ($balance->available as $cpt) {
1571 $arrayzerounitcurrency = array(
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF');
1572 if (!in_array($cpt->currency, $arrayzerounitcurrency)) {
1573 $currencybalance[$cpt->currency][
'available'] = $cpt->amount / 100;
1575 $currencybalance[$cpt->currency][
'available'] = $cpt->amount;
1577 $currencybalance[$cpt->currency][
'currency'] = $cpt->currency;
1581 if (is_array($balance->pending) && count($balance->pending)) {
1582 foreach ($balance->pending as $cpt) {
1583 $arrayzerounitcurrency = array(
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF');
1584 if (!in_array($cpt->currency, $arrayzerounitcurrency)) {
1585 $currencybalance[$cpt->currency][
'pending'] = $currencybalance[$cpt->currency][
'available'] + $cpt->amount / 100;
1587 $currencybalance[$cpt->currency][
'pending'] = $currencybalance[$cpt->currency][
'available'] + $cpt->amount;
1592 if (is_array($currencybalance)) {
1593 foreach ($currencybalance as $cpt_arr) {
1594 print
'<tr><td>'.$langs->trans(
"Currency".strtoupper($cpt_arr[
'currency'])).
'</td><td>'.
price($cpt_arr[
'available'], 0,
'', 1, - 1, - 1, strtoupper($cpt_arr[
'currency'])).
'</td><td>'.
price(isset($cpt_arr[
'pending']) ? $cpt_arr[
'pending'] : 0, 0,
'', 1, - 1, - 1, strtoupper($cpt_arr[
'currency'])).
'</td><td>'.
price($cpt_arr[
'available'] + (isset($cpt_arr[
'pending']) ? $cpt_arr[
'pending'] : 0), 0,
'', 1, - 1, - 1, strtoupper($cpt_arr[
'currency'])).
'</td></tr>';
1604 if ($permissiontoaddupdatepaymentinformation) {
1605 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"] .
'?socid=' .
$object->id .
'&action=create');
1608 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank');
1612 $arrayofremoteban = array();
1614 $rib_list =
$object->get_all_rib();
1616 if (is_array($rib_list)) {
1617 print
'<!-- List of bank accounts -->'.
"\n";
1618 print
'<div class="div-table-responsive-no-min">';
1619 print
'<table class="liste centpercent noborder">';
1621 print
'<tr class="liste_titre">';
1623 print_liste_field_titre($form->textwithpicto($langs->trans(
'ExternalSystemID'), $langs->trans(
"IDOfPaymentInAnExternalSystem")));
1638 $parameters = array(
'arrayfields' => array(),
'linetype' =>
'stripebantitle');
1639 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1640 print $hookmanager->resPrint;
1645 foreach ($rib_list as $rib) {
1646 $arrayofremoteban[$rib->stripe_card_ref] = $rib->stripe_card_ref;
1650 print
'<tr class="oddeven">';
1652 print
'<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($rib->label).
'">'.
dolPrintHTML($rib->label);
1653 print
'<br><span class="opacitymedium">'.dolPrintHTML($rib->bank).
'</span>';
1657 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($rib->stripe_card_ref.(empty($rib->stripe_account) ?
'' :
' - '.$rib->stripe_account)).
'">';
1658 if (!empty($rib->stripe_card_ref) && !empty($rib->ext_payment_site)) {
1659 if (
isModEnabled(
'stripe') && in_array($rib->ext_payment_site, array(
'StripeTest',
'StripeLive'))) {
1661 if (!empty($stripeacc)) {
1662 $connect = $stripeacc.
'/';
1664 if ($rib->ext_payment_site ==
'StripeLive') {
1665 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$rib->stripe_card_ref;
1667 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$rib->stripe_card_ref;
1669 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1681 foreach ($rib->getFieldsToShow() as $val) {
1682 if ($val ==
'BankCode') {
1683 $string .= $rib->code_banque.
' ';
1684 } elseif ($val ==
'BankAccountNumber') {
1685 $string .= $rib->number.
' ';
1686 } elseif ($val ==
'DeskCode') {
1687 $string .= $rib->code_guichet.
' ';
1688 } elseif ($val ==
'BankAccountNumberKey') {
1689 $string .= $rib->cle_rib.
' ';
1698 if (!empty($rib->label) && $rib->number) {
1700 $label = $isValid ?
"ValueIsValid" :
"ValueIsNotValid";
1701 $picto = $isValid ?
'info' :
'warning';
1702 $string =
img_picto($langs->trans($label), $picto,
'class="pictofixedwidth"').$string;
1704 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($string).
'">';
1709 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($rib->iban).
'">';
1710 if (!empty($rib->iban)) {
1712 print
img_picto($langs->trans(
"IbanNotValid"),
'warning').
' ';
1719 if (!empty($rib->bic)) {
1721 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning').
' ';
1729 print
'<td class="tdoverflowmax100 small" title="'.dolPrintHTMLForAttribute($rib->rum).
'">'.
dolPrintHTML($rib->rum);
1730 print
'<br><span class="opacitymedium">'.dolPrintHTML($rib->frstrecur).
'</span>';
1734 print
'<td>'.dol_print_date($rib->date_rum,
'day').
'</td>';
1738 print
'<td class="center" width="70">';
1739 if (!$rib->default_rib) {
1740 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?socid='.((int)
$object->id).
'&ribid='.((int) $rib->id).
'&action=setasbankdefault&token='.
newToken().
'">';
1741 print
img_picto($langs->trans(
"Disabled"),
'off');
1744 print
img_picto($langs->trans(
"Enabled"),
'on');
1749 print
'<td class="center">';
1751 $buttonlabel = $langs->trans(
"BuildDoc");
1752 $forname =
'builddocrib'.$rib->id;
1754 include_once DOL_DOCUMENT_ROOT.
'/core/modules/bank/modules_bank.php';
1758 if (is_array($modellist) && count($modellist)) {
1759 $out .=
'<form action="'.$_SERVER[
"PHP_SELF"].(!
getDolGlobalString(
'MAIN_JUMP_TAG') ?
'' :
'#builddoc').
'" name="'.$forname.
'" id="'.$forname.
'_form" method="post" autocomplete="off" spellcheck="false">';
1760 $out .=
'<input type="hidden" name="action" value="builddocrib">';
1761 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1762 $out .=
'<input type="hidden" name="socid" value="'.$object->id.
'">';
1763 $out .=
'<input type="hidden" name="companybankid" value="'.$rib->id.
'">';
1765 $modelselected =
'';
1766 if (count($modellist) == 1) {
1767 $arraykeys = array_keys($modellist);
1768 $modelselected = $arraykeys[0];
1774 $morecss =
'maxwidth125';
1775 if (
$conf->browser->layout ==
'phone') {
1776 $morecss =
'maxwidth100';
1779 $out .= $form->selectarray(
'modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 '.$morecss);
1784 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
1786 $defaultlang = $langs->getDefaultLang();
1787 $out .= $formadmin->select_language($defaultlang,
'lang_idrib'.$rib->id, 0, array(), 0, 0, 0, $morecss);
1790 $out .=
'<input class="button buttongen reposition nomargintop nomarginbottom small '.$morecss.
'" id="'.$forname.
'_generatebutton" name="'.$forname.
'_generatebutton"';
1791 $out .=
' type="submit" value="'.$buttonlabel.
'"';
1799 $parameters = array(
'arrayfields' => array(),
'stripe_card_ref' => $rib->stripe_card_ref,
'stripe_account' => $rib->stripe_account,
'linetype' =>
'stripeban');
1800 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1801 print $hookmanager->resPrint;
1805 print
'<td class="minwidth200 width200">';
1806 $useonlinesignature = 1;
1807 if ($useonlinesignature) {
1808 $rib->entity =
$object->entity;
1809 require_once DOL_DOCUMENT_ROOT .
'/core/lib/signature.lib.php';
1810 print showOnlineSignatureUrl($companybankaccount->element, (
string) $rib->id, $rib,
'short');
1816 print
'<td class="right nowraponall">';
1817 if ($permissiontoaddupdatepaymentinformation) {
1819 if (empty($rib->stripe_card_ref)) {
1822 print
'<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&id='.$rib->id.
'&action=syncsepatostripe&token='.
newToken().
'">';
1823 print
img_picto($langs->trans(
"CreateBANOnStripe"),
'stripe');
1826 print
'<span class="opacitymedium marginrightonly marginleftonly">';
1827 print
img_picto($langs->trans(
"ThirdPartyMustBeACustomerToCreateBANOnStripe"),
'stripe');
1833 print
'<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&id='.$rib->id.
'&action=edit">';
1834 print
img_picto($langs->trans(
"Modify"),
'edit');
1837 print
'<a class="marginrightonly marginleftonly reposition" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.
$object->id.
'&id='.$rib->id.
'&action=deletebank&token='.
newToken().
'">';
1838 print
img_picto($langs->trans(
"Delete"),
'delete');
1848 foreach ($listofsources as $src) {
1849 if (!empty($arrayofremoteban[$src->id])) {
1854 if ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1855 $imgline =
'<span class="fa fa-university fa-2x fa-fw"></span>';
1856 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1857 $imgline =
'<span class="fa fa-university fa-2x fa-fw"></span>';
1864 print
'<tr class="oddeven">';
1869 print
'<td class="tdoverflowmax150">';
1871 if (!empty($stripeacc)) {
1872 $connect = $stripeacc.
'/';
1875 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$src->id;
1876 if ($servicestatus) {
1878 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$src->id;
1880 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1911 print
'<td class="center" width="50">';
1912 if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) ||
1913 (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) {
1914 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&source='.$src->id.
'&action=setassourcedefault&token='.
newToken().
'">';
1915 print
img_picto($langs->trans(
"Default"),
'off');
1918 print
img_picto($langs->trans(
"Default"),
'on');
1933 $parameters = array(
'arrayfields' => array(),
'src' => $src,
'linetype' =>
'stripebanremoteonly');
1934 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1935 print $hookmanager->resPrint;
1938 print
'<td class="right nowraponall">';
1939 if ($permissiontoaddupdatepaymentinformation) {
1940 print
'<a class="marginleftonly marginrightonly reposition" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.
$object->id.
'&source='.$src->id.
'&action=deletebank&token='.
newToken().
'">';
1941 print
img_picto($langs->trans(
"Delete"),
'delete');
1949 if ($nbremote == 0 && $nblocal == 0) {
1957 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
1967 $parameters = array(
'arrayfields' => array(),
'param' =>
'',
'sortfield' =>
'',
'sortorder' =>
'',
'linetype' =>
'');
1968 $reshook = $hookmanager->executeHooks(
'printNewTable', $parameters, $object);
1969 print $hookmanager->resPrint;
1974 print
'<div class="fichecenter"><div class="fichehalfleft">';
1975 print
'<a name="builddoc"></a>';
1981 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".
$object->id;
1983 print $formfile->showdocuments(
'company', (
string)
$object->id, $filedir, $urlsource, $permissiontoread, (
int) $permissiontoaddupdatepaymentinformation,
$object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity,
'',
'',
$object->default_lang);
1990 $result = $companypaymentmodetemp->fetch(0,
'',
$object->id,
'ban');
1992 include_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmfiles.class.php';
1995 $result = $ecmfile->fetch(0,
'',
'',
'',
'', $companybankaccounttemp->table_element, $companypaymentmodetemp->id);
1997 $companybankaccounttemp->last_main_doc = $ecmfile->filepath.
'/'.$ecmfile->filename;
1998 print
'<br><!-- Link to download main doc -->'.
"\n";
2003 print
'</div><div class="fichehalfright">';
2006 print
'</div></div>';
2032if ($socid && $action ==
'edit' && $permissiontoaddupdatepaymentinformation) {
2035 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2037 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2039 print
'<div class="underbanner clearboth"></div>';
2043 print
'<div class="div-table-responsive-no-min">';
2044 print
'<table class="border tableforfield centpercent">';
2046 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Label").
'</td>';
2047 print
'<td><input class="minwidth300" type="text" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $companybankaccount->label).
'" spellcheck="false"></td></tr>';
2049 print
'<tr><td>'.$langs->trans(
"BankName").
'</td>';
2050 print
'<td><input class="minwidth200" type="text" name="bank" value="'.dol_escape_htmltag(
GETPOSTISSET(
'bank') ?
GETPOST(
'bank',
'alpha') : $companybankaccount->bank).
'" spellcheck="false"></td></tr>';
2053 $companybankaccount->fetch($id);
2054 $bankaccount = $companybankaccount;
2055 $country_codeid =
GETPOSTINT(
"account_country_id");
2056 if (empty($country_codeid)) {
2057 $country_codeid = $bankaccount->fk_country;
2059 if (empty($country_codeid)) {
2060 $default_country_code = $bankaccount->country_code ? $bankaccount->country_code : (
$object->country_code ?
$object->country_code :
$mysoc->country_code);
2061 $country_codeid =
getCountry($default_country_code,
'3');
2063 $country_codeid = (int) $country_codeid;
2064 $bankaccount->fk_country = $country_codeid;
2065 $bankaccount->country_code =
getCountry($country_codeid,
'2');
2067 foreach ($bankaccount->getFieldsToShow(1) as $val) {
2072 $content =
'NoContent';
2073 if ($val ==
'BankCode') {
2074 $name =
'code_banque';
2076 $content = $bankaccount->code_banque;
2077 } elseif ($val ==
'DeskCode') {
2078 $name =
'code_guichet';
2080 $content = $bankaccount->code_guichet;
2081 } elseif ($val ==
'BankAccountNumber') {
2084 $content = $bankaccount->number;
2085 } elseif ($val ==
'BankAccountNumberKey') {
2088 $content = $bankaccount->cle_rib;
2089 } elseif ($val ==
'IBAN') {
2092 $content = $bankaccount->iban;
2093 if ($bankaccount->needIBAN()) {
2096 $tooltip = $langs->trans(
"Example").
':<br>CH93 0076 2011 6238 5295 7<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
2097 } elseif ($val ==
'BIC') {
2100 $content = $bankaccount->bic;
2101 if ($bankaccount->needBIC() && (
getDolGlobalInt(
'WITHDRAWAL_WITHOUT_BIC') == 0)) {
2104 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
2107 $content =
GETPOST($name,
'alpha');
2111 print
'<td'.($require ?
' class="fieldrequired" ' :
'').
'>';
2114 print $form->textwithpicto($langs->trans($bankaccount->getBankFieldLabel($val)), $tooltip, 4,
'help',
'', 0, 3, $name);
2116 print $langs->trans($bankaccount->getBankFieldLabel($val));
2119 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.
dol_escape_htmltag($content).
'"></td>';
2124 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
2126 $selectedcode = $bankaccount->currency_code;
2127 if (!$selectedcode) {
2128 $selectedcode =
$conf->currency;
2130 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
2137 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
2139 print $form->selectarray(
"clos", $bankaccount->labelStatus, $account_status, 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth150onsmartphone');
2143 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
2145 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2146 print $form->select_country($country_codeid,
'account_country_id');
2148 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2153 $selected_state_id =
GETPOSTISSET(
"account_state_id") ?
GETPOSTINT(
"account_state_id") : $bankaccount->state_id;
2154 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
2155 if ($country_codeid) {
2156 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2157 print $formcompany->select_state($selected_state_id, $country_codeid,
'account_state_id');
2159 print $countrynotdefined;
2163 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
2164 print
'<textarea name="address" rows="'.ROWS_4.
'" cols="40" maxlength="255" spellcheck="false">';
2166 print
"</textarea></td></tr>";
2168 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
2169 print
'<td><input class="minwidth300" type="text" name="proprio" value="'.dol_escape_htmltag(
GETPOSTISSET(
'proprio') ?
GETPOST(
'proprio',
'alpha') : $companybankaccount->owner_name).
'" spellcheck="false"></td></tr>';
2170 print
"</td></tr>\n";
2172 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
2173 print
'<textarea name="owner_address" rows="'.ROWS_4.
'" cols="40" maxlength="255" spellcheck="false">';
2175 print
"</textarea></td></tr>";
2183 print
'<div class="div-table-responsive-no-min">';
2184 print
'<table class="border tableforfield centpercent">';
2186 if (empty($companybankaccount->rum)) {
2187 $companybankaccount->rum = $prelevement->buildRumNumber(
$object->code_client, $companybankaccount->datec, (
string) $companybankaccount->id);
2191 print
'<tr><td class="titlefieldcreate" colspan="5">'.$langs->trans(
"WithdrawalsSetup").
'</td></tr>';
2194 print
'<tr><td class="titlefield">'.$langs->trans(
"RUM").
'</td>';
2195 print
'<td><input class="minwidth300" type="text" name="rum" value="'.dol_escape_htmltag(
GETPOSTISSET(
'rum') ?
GETPOST(
'rum',
'alpha') : $companybankaccount->rum).
'" spellcheck="false"></td></tr>';
2199 print
'<tr><td class="titlefield">'.$langs->trans(
"DateRUM").
'</td>';
2200 print
'<td>'.$form->selectDate($date_rum ? $date_rum : $companybankaccount->date_rum,
'date_rum', 0, 0, 1,
'date_rum', 1, 1).
'</td></tr>';
2202 print
'<tr><td>'.$langs->trans(
"WithdrawMode").
'</td><td>';
2203 $tblArraychoice = array(
"FRST" => $langs->trans(
"FRST"),
"RCUR" => $langs->trans(
"RECUR"));
2204 print $form->selectarray(
"frstrecur", $tblArraychoice,
dol_escape_htmltag(
GETPOST(
'frstrecur',
'alpha') ?
GETPOST(
'frstrecur',
'alpha') : $companybankaccount->frstrecur), 0);
2207 print
'<tr><td>'.$langs->trans(
"ExternalSystemID").
" ('pm_...' or 'src_...')</td>";
2208 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.dol_escape_htmltag(
GETPOSTISSET(
'stripe_card_ref') ?
GETPOST(
'stripe_card_ref',
'alpha') : $companypaymentmode->stripe_card_ref).
'" spellcheck="false"></td></tr>';
2217 print $form->buttonsSaveCancel(
"Modify");
2221if ($socid && $action ==
'editcard' && $permissiontoaddupdatepaymentinformation) {
2224 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2226 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2228 print
'<div class="nofichecenter">';
2230 print
'<div class="underbanner clearboth"></div>';
2234 print
'<div class="div-table-responsive-no-min">';
2235 print
'<table class="border centpercent">';
2237 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
2238 print
'<td><input class="minwidth300" type="text" id="label" name="label" value="'.$companypaymentmode->label.
'" spellcheck="false"></td></tr>';
2240 print
'<tr><td class="fieldrequired">'.$langs->trans(
"NameOnCard").
'</td>';
2241 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.$companypaymentmode->owner_name.
'" spellcheck="false"></td></tr>';
2243 print
'<tr><td>'.$langs->trans(
"CardNumber").
'</td>';
2244 print
'<td><input class="minwidth200" type="text" name="cardnumber" value="'.$companypaymentmode->number.
'" spellcheck="false"></td></tr>';
2246 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ExpiryDate").
'</td>';
2248 print $formother->select_month((
string) $companypaymentmode->exp_date_month,
'exp_date_month', 1);
2249 print $formother->selectyear((
string) $companypaymentmode->exp_date_year,
'exp_date_year', 1, 5, 10, 0, 0,
'',
'marginleftonly');
2252 print
'<tr><td>'.$langs->trans(
"CVN").
'</td>';
2253 print
'<td><input size="8" type="text" name="cvn" value="'.$companypaymentmode->cvn.
'"></td></tr>';
2255 print
'<tr><td>'.$langs->trans(
"ExternalSystemID").
" ('pm_... ".$langs->trans(
"or").
" card_....')</td>";
2256 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.$companypaymentmode->stripe_card_ref.
'" spellcheck="false"></td></tr>';
2264 print $form->buttonsSaveCancel(
"Modify");
2269if ($socid && $action ==
'create' && $permissiontoaddupdatepaymentinformation) {
2272 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2274 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2276 print
'<div class="nofichecenter">';
2278 print
'<div class="underbanner clearboth"></div>';
2282 print
'<div class="div-table-responsive-no-min">';
2283 print
'<table class="border tableforfield centpercent">';
2285 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
2286 print
'<td><input class="minwidth250" type="text" id="label" name="label" value="'.dol_escape_htmltag(
GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alpha') : $langs->trans(
"Bank").
' '.
$object->
name).
'" spellcheck="false"></td></tr>';
2288 print
'<tr><td>'.$langs->trans(
"Bank").
'</td>';
2289 print
'<td><input class="minwidth250" type="text" id="bank" name="bank" value="'.dol_escape_htmltag(
GETPOST(
'bank',
'alpha')).
'" spellcheck="false"></td></tr>';
2292 $selected_country_id =
GETPOSTINT(
'account_country_id');
2293 if (empty($selected_country_id)) {
2296 $selected_country_id = (int) $selected_country_id;
2297 $companybankaccount->fk_country = $selected_country_id;
2298 $companybankaccount->country_code =
getCountry($selected_country_id,
'2');
2299 foreach ($companybankaccount->getFieldsToShow(1) as $val) {
2304 $content =
'NoContent';
2306 if ($val ==
'BankCode') {
2307 $name =
'code_banque';
2309 $content = $companybankaccount->code_banque;
2310 } elseif ($val ==
'DeskCode') {
2311 $name =
'code_guichet';
2313 $content = $companybankaccount->code_guichet;
2314 } elseif ($val ==
'BankAccountNumber') {
2317 $content = $companybankaccount->number;
2318 } elseif ($val ==
'BankAccountNumberKey') {
2321 $content = $companybankaccount->cle_rib;
2322 } elseif ($val ==
'IBAN') {
2325 $content = $companybankaccount->iban;
2326 if ($companybankaccount->needIBAN()) {
2329 $tooltip = $langs->trans(
"Example").
':<br>CH93 0076 2011 6238 5295 7<br>LT12 1000 0111 0100 1000<br>FR14 2004 1010 0505 0001 3M02 606<br>LU28 0019 4006 4475 0000<br>DE89 3704 0044 0532 0130 00';
2330 } elseif ($val ==
'BIC') {
2333 $content = $companybankaccount->bic;
2334 if ($companybankaccount->needBIC() && (
getDolGlobalInt(
'WITHDRAWAL_WITHOUT_BIC') == 0)) {
2337 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
2340 $content =
GETPOST($name,
'alpha');
2343 print
'<tr><td'.($require ?
' class="fieldrequired" ' :
'').
'>';
2346 print $form->textwithpicto($langs->trans($companybankaccount->getBankFieldLabel($val)), $tooltip, 4,
'help',
'', 0, 3, $name);
2348 print $langs->trans($companybankaccount->getBankFieldLabel($val));
2351 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" id="'.$name.
'" value="'.
dol_escape_htmltag($content).
'" spellcheck="false"></td>';
2356 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Currency").
'</td>';
2358 $selectedcode =
$object->currency_code;
2359 if (!$selectedcode) {
2360 $selectedcode =
$conf->currency;
2362 print $form->selectCurrency((
GETPOSTISSET(
"account_currency_code") ?
GETPOST(
"account_currency_code") : $selectedcode),
'account_currency_code');
2368 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Status").
'</td>';
2370 print $form->selectarray(
"clos", $companybankaccount->labelStatus, (
GETPOSTISSET(
'clos') ?
GETPOSTINT(
'clos') : $companybankaccount::STATUS_OPEN), 0, 0, 0,
'', 0, 0, 0,
'',
'minwidth100 maxwidth150onsmartphone');
2374 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankAccountCountry").
'</td>';
2376 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2377 print $form->select_country($selected_country_id,
'account_country_id');
2379 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2384 print
'<tr><td>'.$langs->trans(
'State').
'</td><td>';
2385 if ($selected_country_id) {
2386 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2387 print $formcompany->select_state(
GETPOSTISSET(
"account_state_id") ?
GETPOSTINT(
"account_state_id") : 0, $selected_country_id,
'account_state_id');
2389 print $countrynotdefined;
2393 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
2394 print
'<textarea name="address" rows="'.ROWS_4.
'" class="quatrevingtpercent" maxlength="255">';
2396 print
"</textarea></td></tr>";
2398 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
2399 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.dol_escape_htmltag(
GETPOST(
'proprio',
'alpha')).
'" spellcheck="false"></td></tr>';
2400 print
"</td></tr>\n";
2402 print
'<tr><td class="tdtop">'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
2403 print
'<textarea name="owner_address" rows="'.ROWS_4.
'" class="quatrevingtpercent" maxlength="255">';
2405 print
"</textarea></td></tr>";
2413 print
'<div class="div-table-responsive-no-min">';
2414 print
'<table class="border tableforfield centpercent">';
2417 print
'<tr><td class="titlefieldcreate" colspan="5">'.$langs->trans(
"WithdrawalsSetup").
'</td></tr>';
2420 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"RUM"), $langs->trans(
"RUMLong").
'<br>'.$langs->trans(
"RUMWillBeGenerated")).
'</td>';
2421 print
'<td colspan="4"><input type="text" class="minwidth300" name="rum" value="'.GETPOST(
'rum',
'alpha').
'" spellcheck="false"></td></tr>';
2425 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DateRUM").
'</td>';
2426 print
'<td colspan="4">'.$form->selectDate($date_rum,
'date_rum', 0, 0, 1,
'date_rum', 1, 1).
'</td></tr>';
2428 print
'<tr><td>'.$langs->trans(
"WithdrawMode").
'</td><td>';
2429 $tblArraychoice = array(
"FRST" => $langs->trans(
"FRST"),
"RCUR" => $langs->trans(
"RECUR"));
2430 print $form->selectarray(
"frstrecur", $tblArraychoice, (
GETPOSTISSET(
'frstrecur') ?
GETPOST(
'frstrecur') :
'FRST'), 0);
2433 print
'<tr><td>'.$langs->trans(
"ExternalSystemID").
" ('src_....')</td>";
2434 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST(
'stripe_card_ref',
'alpha').
'" spellcheck="false"></td></tr>';
2446 print $form->buttonsSaveCancel(
"Add");
2450if ($socid && $action ==
'createcard' && $permissiontoaddupdatepaymentinformation) {
2453 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2455 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2457 print
'<div class="nofichecenter">';
2459 print
'<div class="underbanner clearboth"></div>';
2463 print
'<div class="div-table-responsive-no-min">';
2464 print
'<table class="border centpercent">';
2466 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
2467 print
'<td><input class="minwidth200" type="text" id="label" name="label" value="'.GETPOST(
'label',
'alpha').
'" spellcheck="false"></td></tr>';
2469 print
'<tr><td class="fieldrequired">'.$langs->trans(
"NameOnCard").
'</td>';
2470 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.GETPOST(
'proprio',
'alpha').
'" spellcheck="false"></td></tr>';
2472 print
'<tr><td>'.$langs->trans(
"CardNumber").
'</td>';
2473 print
'<td><input class="minwidth200" type="text" name="cardnumber" value="'.GETPOST(
'cardnumber',
'alpha').
'" spellcheck="false"></td></tr>';
2475 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ExpiryDate").
'</td>';
2477 print $formother->select_month((
string)
GETPOSTINT(
'exp_date_month'),
'exp_date_month', 1);
2478 print $formother->selectyear((
string)
GETPOSTINT(
'exp_date_year'),
'exp_date_year', 1, 5, 10, 0, 0,
'',
'marginleftonly');
2481 print
'<tr><td>'.$langs->trans(
"CVN").
'</td>';
2482 print
'<td><input class="width50" type="text" name="cvn" value="'.GETPOST(
'cvn',
'alpha').
'" spellcheck="false"></td></tr>';
2484 print
'<tr><td>'.$langs->trans(
"ExternalSystemID").
" ('card_....')</td>";
2485 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST(
'stripe_card_ref',
'alpha').
'" spellcheck="false"></td></tr>';
2496 print $form->buttonsSaveCancel(
"Add");
2499if ($socid && ($action ==
'edit' || $action ==
'editcard') && $permissiontoaddupdatepaymentinformation) {
2502if ($socid && ($action ==
'create' || $action ==
'createcard') && $permissiontoaddupdatepaymentinformation) {
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
checkIbanForAccount($account=null, $ibantocheck=null)
Check IBAN number information for a bank account.
checkBanForAccount($account)
Check account number information for a bank account.
checkSwiftForAccount($account=null, $swift=null)
Check SWIFT information for a bank account.
Class to manage withdrawal receipts.
Class to manage bank accounts description of third parties.
Class for CompanyPaymentMode.
Class to manage ECM files.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class for SocieteAccount.
Class to manage third parties objects (customers, suppliers, prospects...)
Stripe class @TODO No reason to extend CommonObject.
print $langs trans("Ref").' m titre as m m statut as status
Or an array listing all the potential status of the object: array: int of the status => translated la...
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
dol_now($mode='gmt')
Return date for now.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_credit_card($brand, $morecss='fa-2x inline-block valignmiddle')
Return image of a credit card according to its brand name.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolPrintHTMLForTextArea($s, $allowiframe=0)
Return a string ready to be output on input textarea.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formatted messages to output (Used to show messages on html output).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
div refaddress div address
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
$conf db name
Only used if Module[ID]Name translation string is not found.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.