34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/bank.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societeaccount.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/stripe/class/stripe.class.php';
47 $langs->loadLangs(array(
"companies",
"commercial",
"banks",
"bills",
'paypal',
'stripe',
'withdrawals'));
52 $source =
GETPOST(
"source",
"alpha");
53 $ribid =
GETPOST(
"ribid",
"int");
54 $action =
GETPOST(
"action",
'alpha', 3);
55 $cancel =
GETPOST(
'cancel',
'alpha');
58 $socid =
GETPOST(
"socid",
"int");
60 $socid = $user->socid;
65 $object->fetch($socid);
74 $extrafields->fetch_name_optionals_label($object->table_element);
77 $hookmanager->initHooks(array(
'thirdpartybancard',
'globalcard'));
80 $permissiontoread = $user->hasRight(
'societe',
'lire');
81 $permissiontoadd = $user->hasRight(
'societe',
'creer');
83 $permissiontoaddupdatepaymentinformation = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $permissiontoadd) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->societe->thirdparty_paymentinformation_advance->write)));
92 $service =
'StripeTest';
94 if (!empty($conf->global->STRIPE_LIVE) && !
GETPOST(
'forcesandbox',
'alpha')) {
95 $service =
'StripeLive';
100 global $stripearrayofkeysbyenv;
101 $site_account = $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
103 $stripe =
new Stripe($db);
104 $stripeacc = $stripe->getStripeAccount($service);
105 $stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus, $site_account);
119 $parameters = array(
'id'=>$socid);
120 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
125 if (empty($reshook)) {
128 if (!empty($backtopage)) {
129 header(
"Location: ".$backtopage);
134 if ($action ==
'update') {
137 if (!
GETPOST(
'label',
'alpha')) {
138 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
140 if (!
GETPOST(
'bank',
'alpha')) {
141 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankName")),
null,
'errors');
146 $companybankaccount->fetch($id);
147 if ($companybankaccount->needIBAN() == 1) {
149 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"IBAN")),
null,
'errors');
154 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BIC")),
null,
'errors');
161 $companybankaccount->socid = $object->id;
163 $companybankaccount->bank =
GETPOST(
'bank',
'alpha');
164 $companybankaccount->label =
GETPOST(
'label',
'alpha');
165 $companybankaccount->courant =
GETPOST(
'courant',
'alpha');
166 $companybankaccount->clos =
GETPOST(
'clos',
'alpha');
167 $companybankaccount->code_banque =
GETPOST(
'code_banque',
'alpha');
168 $companybankaccount->code_guichet =
GETPOST(
'code_guichet',
'alpha');
169 $companybankaccount->number =
GETPOST(
'number',
'alpha');
170 $companybankaccount->cle_rib =
GETPOST(
'cle_rib',
'alpha');
171 $companybankaccount->bic =
GETPOST(
'bic',
'alpha');
172 $companybankaccount->iban =
GETPOST(
'iban',
'alpha');
173 $companybankaccount->domiciliation =
GETPOST(
'domiciliation',
'alpha');
174 $companybankaccount->proprio =
GETPOST(
'proprio',
'alpha');
175 $companybankaccount->owner_address =
GETPOST(
'owner_address',
'alpha');
176 $companybankaccount->frstrecur =
GETPOST(
'frstrecur',
'alpha');
177 $companybankaccount->rum =
GETPOST(
'rum',
'alpha');
179 if (empty($companybankaccount->rum)) {
180 $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id);
183 if (
GETPOST(
'stripe_card_ref',
'alpha') &&
GETPOST(
'stripe_card_ref',
'alpha') != $companypaymentmode->stripe_card_ref) {
185 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
187 $companybankaccount->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
189 $result = $companybankaccount->update($user);
192 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
196 if ($companybankaccount->default_rib) {
197 $companybankaccount->setAsDefault($id);
200 $url = $_SERVER[
"PHP_SELF"].
'?socid='.$object->id;
201 header(
'Location: '.$url);
207 if ($action ==
'updatecard') {
209 if (!
GETPOST(
'label',
'alpha') || !
GETPOST(
'proprio',
'alpha') || !
GETPOST(
'exp_date_month',
'alpha') || !
GETPOST(
'exp_date_year',
'alpha')) {
210 if (!
GETPOST(
'label',
'alpha')) {
211 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
213 if (!
GETPOST(
'proprio',
'alpha')) {
214 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NameOnCard")),
null,
'errors');
217 if (!(
GETPOST(
'exp_date_month',
'alpha') > 0) || !(
GETPOST(
'exp_date_year',
'alpha') > 0)) {
218 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ExpiryDate")),
null,
'errors');
221 $action =
'createcard';
225 $companypaymentmode->fetch($id);
227 $companypaymentmode->fk_soc = $object->id;
229 $companypaymentmode->bank =
GETPOST(
'bank',
'alpha');
230 $companypaymentmode->label =
GETPOST(
'label',
'alpha');
231 $companypaymentmode->number =
GETPOST(
'cardnumber',
'alpha');
232 $companypaymentmode->last_four = substr(
GETPOST(
'cardnumber',
'alpha'), -4);
233 $companypaymentmode->proprio =
GETPOST(
'proprio',
'alpha');
234 $companypaymentmode->exp_date_month =
GETPOST(
'exp_date_month',
'int');
235 $companypaymentmode->exp_date_year =
GETPOST(
'exp_date_year',
'int');
236 $companypaymentmode->cvn =
GETPOST(
'cvn',
'alpha');
237 $companypaymentmode->country_code = $object->country_code;
239 if (
GETPOST(
'stripe_card_ref',
'alpha') &&
GETPOST(
'stripe_card_ref',
'alpha') != $companypaymentmode->stripe_card_ref) {
241 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
243 $companypaymentmode->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
245 $result = $companypaymentmode->update($user);
247 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
250 if ($companypaymentmode->default_rib) {
251 $companypaymentmode->setAsDefault($id);
254 $url = $_SERVER[
"PHP_SELF"].
'?socid='.$object->id;
255 header(
'Location: '.$url);
261 if ($action ==
'add') {
265 if (!
GETPOST(
'label',
'alpha')) {
266 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
268 if (!
GETPOST(
'bank',
'alpha')) {
269 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BankName")),
null,
'errors');
279 $companybankaccount->socid = $object->id;
281 $companybankaccount->bank =
GETPOST(
'bank',
'alpha');
282 $companybankaccount->label =
GETPOST(
'label',
'alpha');
283 $companybankaccount->courant =
GETPOST(
'courant',
'alpha');
284 $companybankaccount->clos =
GETPOST(
'clos',
'alpha');
285 $companybankaccount->code_banque =
GETPOST(
'code_banque',
'alpha');
286 $companybankaccount->code_guichet =
GETPOST(
'code_guichet',
'alpha');
287 $companybankaccount->number =
GETPOST(
'number',
'alpha');
288 $companybankaccount->cle_rib =
GETPOST(
'cle_rib',
'alpha');
289 $companybankaccount->bic =
GETPOST(
'bic',
'alpha');
290 $companybankaccount->iban =
GETPOST(
'iban',
'alpha');
291 $companybankaccount->domiciliation =
GETPOST(
'domiciliation',
'alpha');
292 $companybankaccount->proprio =
GETPOST(
'proprio',
'alpha');
293 $companybankaccount->owner_address =
GETPOST(
'owner_address',
'alpha');
294 $companybankaccount->frstrecur =
GETPOST(
'frstrecur',
'alpha');
295 $companybankaccount->rum =
GETPOST(
'rum',
'alpha');
297 $companybankaccount->datec =
dol_now();
298 $companybankaccount->status = 1;
303 if ($companybankaccount->needIBAN() == 1) {
305 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"IBAN")),
null,
'errors');
310 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"BIC")),
null,
'errors');
317 $result = $companybankaccount->create($user);
320 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
324 if (empty($companybankaccount->rum)) {
325 $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id);
330 $result = $companybankaccount->update($user);
333 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
341 $url = $_SERVER[
"PHP_SELF"].
'?socid='.$object->id;
342 header(
'Location: '.$url);
350 if ($action ==
'addcard') {
353 if (!
GETPOST(
'label',
'alpha') || !
GETPOST(
'proprio',
'alpha') || !
GETPOST(
'exp_date_month',
'alpha') || !
GETPOST(
'exp_date_year',
'alpha')) {
354 if (!
GETPOST(
'label',
'alpha')) {
355 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"Label")),
null,
'errors');
357 if (!
GETPOST(
'proprio',
'alpha')) {
358 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"NameOnCard")),
null,
'errors');
361 if (!(
GETPOST(
'exp_date_month',
'alpha') > 0) || !(
GETPOST(
'exp_date_year',
'alpha') > 0)) {
362 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"ExpiryDate")),
null,
'errors');
365 $action =
'createcard';
373 $companypaymentmode->fk_soc = $object->id;
374 $companypaymentmode->bank =
GETPOST(
'bank',
'alpha');
375 $companypaymentmode->label =
GETPOST(
'label',
'alpha');
376 $companypaymentmode->number =
GETPOST(
'cardnumber',
'alpha');
377 $companypaymentmode->last_four = substr(
GETPOST(
'cardnumber',
'alpha'), -4);
378 $companypaymentmode->proprio =
GETPOST(
'proprio',
'alpha');
379 $companypaymentmode->exp_date_month =
GETPOST(
'exp_date_month',
'int');
380 $companypaymentmode->exp_date_year =
GETPOST(
'exp_date_year',
'int');
381 $companypaymentmode->cvn =
GETPOST(
'cvn',
'alpha');
382 $companypaymentmode->datec =
dol_now();
383 $companypaymentmode->default_rib = 0;
384 $companypaymentmode->type =
'card';
385 $companypaymentmode->country_code = $object->country_code;
386 $companypaymentmode->status = $servicestatus;
388 if (
GETPOST(
'stripe_card_ref',
'alpha')) {
390 $companypaymentmode->stripe_account = $stripecu.
'@'.$site_account;
392 $companypaymentmode->stripe_card_ref =
GETPOST(
'stripe_card_ref',
'alpha');
397 $result = $companypaymentmode->create($user);
400 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
401 $action =
'createcard';
408 $url = $_SERVER[
"PHP_SELF"].
'?socid='.$object->id;
409 header(
'Location: '.$url);
417 if ($action ==
'setasbankdefault' &&
GETPOST(
'ribid',
'int') > 0) {
419 $res = $companybankaccount->setAsDefault(
GETPOST(
'ribid',
'int'));
421 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id;
422 header(
'Location: '.$url);
429 if ($action ==
'confirm_deletecard' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
431 if ($companypaymentmode->fetch($ribid ? $ribid : $id)) {
442 $result = $companypaymentmode->delete($user);
444 $url = $_SERVER[
'PHP_SELF'].
"?socid=".$object->id;
446 header(
'Location: '.$url);
449 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
452 setEventMessages($companypaymentmode->error, $companypaymentmode->errors,
'errors');
455 if ($action ==
'confirm_deletebank' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
457 if ($companybankaccount->fetch($ribid ? $ribid : $id)) {
468 $result = $companybankaccount->delete($user);
471 $url = $_SERVER[
'PHP_SELF'].
"?socid=".$object->id;
473 header(
'Location: '.$url);
476 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
479 setEventMessages($companybankaccount->error, $companybankaccount->errors,
'errors');
486 if ($action ==
'builddocrib') {
487 $action =
'builddoc';
489 'use_companybankid'=>
GETPOST(
'companybankid'),
490 'force_dir_output'=>$conf->societe->multidir_output[$object->entity].
'/'.
dol_sanitizeFileName($object->id)
492 $_POST[
'lang_id'] =
GETPOST(
'lang_idrib'.
GETPOST(
'companybankid',
'int'),
'alpha');
493 $_POST[
'model'] =
GETPOST(
'modelrib'.
GETPOST(
'companybankid',
'int'),
'alpha');
497 $upload_dir = $conf->societe->multidir_output[$object->entity];
498 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
504 if ($action ==
'synccustomertostripe') {
505 if ($object->client == 0) {
510 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus, 1);
519 if ($action ==
'synccardtostripe') {
521 $companypaymentmode->fetch($id);
523 if ($companypaymentmode->type !=
'card') {
528 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
538 $card = $stripe->cardStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1);
546 if ($action ==
'syncsepatostripe') {
548 $companypaymentmode->fetch($id);
550 if ($companypaymentmode->type !=
'ban') {
552 $langs->load(
"errors");
556 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
560 $langs->load(
"errors");
561 setEventMessages($langs->trans(
"ErrorStripeCustomerNotFoundCreateFirst"),
null,
'errors');
565 $card = $stripe->sepaStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1);
570 setEventMessages(
"", array(
"Bank Account on Stripe",
"BAN is now linked to the Stripe customer account !"));
576 if ($action ==
'setkey_account') {
579 $newcu =
GETPOST(
'key_account',
'alpha');
584 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"societe_account WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($site_account).
"') AND fk_soc = ".$object->id.
" AND status = ".((int) $servicestatus).
" AND entity = ".$conf->entity;
586 $sql =
'SELECT rowid FROM '.MAIN_DB_PREFIX.
"societe_account";
587 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($site_account).
"') AND fk_soc = ".((int) $object->id).
" AND status = ".((int) $servicestatus).
" AND entity = ".$conf->entity;
590 $resql = $db->query($sql);
591 $num = $db->num_rows(
$resql);
592 if (!empty($newcu)) {
595 $societeaccount->fk_soc = $object->id;
596 $societeaccount->login =
'';
597 $societeaccount->pass_encoding =
'';
598 $societeaccount->site =
'stripe';
599 $societeaccount->status = $servicestatus;
600 $societeaccount->key_account = $newcu;
601 $societeaccount->site_account = $site_account;
602 $result = $societeaccount->create($user);
607 $sql =
'UPDATE '.MAIN_DB_PREFIX.
"societe_account";
608 $sql .=
" SET key_account = '".$db->escape(
GETPOST(
'key_account',
'alpha')).
"', site_account = '".$db->escape($site_account).
"'";
609 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '' or site_account = '".$db->escape($site_account).
"') AND fk_soc = ".((int) $object->id).
" AND status = ".((int) $servicestatus).
" AND entity = ".$conf->entity;
610 $resql = $db->query($sql);
625 if ($action ==
'setkey_account_supplier') {
628 $newsup =
GETPOST(
'key_account_supplier',
'alpha');
632 if (empty($newsup)) {
633 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"oauth_token WHERE fk_soc = ".$object->id.
" AND service = '".$db->escape($service).
"' AND entity = ".$conf->entity;
638 $stripesup = \Stripe\Account::retrieve($db->escape(
GETPOST(
'key_account_supplier',
'alpha')));
639 $tokenstring[
'stripe_user_id'] = $stripesup->id;
640 $tokenstring[
'type'] = $stripesup->type;
641 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"oauth_token";
642 $sql .=
" SET tokenstring = '".$db->escape(json_encode($tokenstring)).
"'";
643 $sql .=
" WHERE site = 'stripe' AND (site_account IS NULL or site_account = '".$db->escape($site_account).
"') AND fk_soc = ".((int) $object->id).
" AND service = '".$db->escape($service).
"' AND entity = ".$conf->entity;
645 $sql .=
" WHERE fk_soc = ".$object->id.
" AND service = '".$db->escape($service).
"' AND entity = ".$conf->entity;
652 $resql = $db->query($sql);
653 $num = $db->num_rows(
$resql);
654 if (empty($num) && !empty($newsup)) {
656 $stripesup = \Stripe\Account::retrieve($db->escape(
GETPOST(
'key_account_supplier',
'alpha')));
657 $tokenstring[
'stripe_user_id'] = $stripesup->id;
658 $tokenstring[
'type'] = $stripesup->type;
659 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"oauth_token (service, fk_soc, entity, tokenstring)";
660 $sql .=
" VALUES ('".$db->escape($service).
"', ".((int) $object->id).
", ".((int) $conf->entity).
", '".$db->escape(json_encode($tokenstring)).
"')";
666 $resql = $db->query($sql);
670 $stripesupplieracc = $newsup;
677 if ($action ==
'setlocalassourcedefault') {
679 $companypaymentmode->setAsDefault($id);
681 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id;
682 header(
'Location: '.$url);
688 } elseif ($action ==
'setassourcedefault') {
690 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
691 if (preg_match(
'/pm_|src_/', $source)) {
692 $cu->invoice_settings->default_payment_method = (string) $source;
694 $cu->default_source = (string) $source;
696 $result = $cu->save();
698 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id;
699 header(
'Location: '.$url);
705 } elseif ($action ==
'deletecard' && $source) {
707 if (preg_match(
'/pm_/', $source)) {
708 $payment_method = \Stripe\PaymentMethod::retrieve($source, array(
"stripe_account" => $stripeacc));
709 if ($payment_method) {
710 $payment_method->detach();
713 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
714 $card = $cu->sources->retrieve(
"$source");
717 if (method_exists($card,
'detach')) {
719 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"societe_rib as sr ";
720 $sql .=
" SET stripe_card_ref = null";
721 $sql .=
" WHERE sr.stripe_card_ref = '".$db->escape($source).
"'";
722 $resql = $db->query($sql);
729 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id;
730 header(
'Location: '.$url);
736 } elseif ($action ==
'deletebank' && $source) {
738 if (preg_match(
'/pm_/', $source)) {
739 $payment_method = \Stripe\PaymentMethod::retrieve($source, array(
"stripe_account" => $stripeacc));
740 if ($payment_method) {
741 $payment_method->detach();
744 $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus);
745 $card = $cu->sources->retrieve(
"$source");
748 if (method_exists($card,
'detach')) {
750 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"societe_rib as sr ";
751 $sql .=
" SET stripe_card_ref = null";
752 $sql .=
" WHERE sr.stripe_card_ref = '".$db->escape($source).
"'";
753 $resql = $db->query($sql);
760 $url = DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id;
761 header(
'Location: '.$url);
781 $title = $langs->trans(
"ThirdParty");
782 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) {
783 $title = $object->name.
" - ".$langs->trans(
'PaymentInformation');
796 if (
isModEnabled(
'stripe') && (empty($conf->global->STRIPE_LIVE) ||
GETPOST(
'forcesandbox',
'alpha'))) {
797 dol_htmloutput_mesg($langs->trans(
'YouAreCurrentlyInSandboxMode',
'Stripe'),
'',
'warning');
802 $companybankaccount->fetch(0, $object->id);
803 $companypaymentmode->fetch(0,
null, $object->id,
'card');
805 $companybankaccount->fetch($id);
806 $companypaymentmode->fetch($id);
808 if (empty($companybankaccount->socid)) {
809 $companybankaccount->socid = $object->id;
812 if ($socid && ($action ==
'edit' || $action ==
'editcard') && $permissiontoaddupdatepaymentinformation) {
813 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'" method="post">';
814 print
'<input type="hidden" name="token" value="'.newToken().
'">';
815 $actionforadd =
'update';
816 if ($action ==
'editcard') {
817 $actionforadd =
'updatecard';
819 print
'<input type="hidden" name="action" value="'.$actionforadd.
'">';
820 print
'<input type="hidden" name="id" value="'.GETPOST(
"id",
"int").
'">';
822 if ($socid && ($action ==
'create' || $action ==
'createcard') && $permissiontoaddupdatepaymentinformation) {
823 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'" method="post">';
824 print
'<input type="hidden" name="token" value="'.newToken().
'">';
825 $actionforadd =
'add';
826 if ($action ==
'createcard') {
827 $actionforadd =
'addcard';
829 print
'<input type="hidden" name="action" value="'.$actionforadd.
'">';
834 if ($socid && $action !=
'edit' && $action !=
'create' && $action !=
'editcard' && $action !=
'createcard') {
838 if ($action ==
'deletebank') {
839 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);
842 if ($action ==
'deletecard') {
843 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);
846 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
848 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
850 print
'<div class="fichecenter">';
852 print
'<div class="underbanner clearboth"></div>';
853 print
'<table class="border tableforfield centpercent">';
856 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td colspan="2">';
857 print $object->getTypeUrl(1);
860 if (!empty($conf->global->SOCIETE_USEPREFIX)) {
861 print
'<tr><td class="titlefield">'.$langs->trans(
'Prefix').
'</td><td colspan="2">'.$object->prefix_comm.
'</td></tr>';
864 if ($object->client) {
865 print
'<tr><td class="titlefield">';
866 print $langs->trans(
'CustomerCode').
'</td><td colspan="2">';
868 $tmpcheck = $object->check_codeclient();
869 if ($tmpcheck != 0 && $tmpcheck != -5) {
870 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
873 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
874 $resql = $db->query($sql);
879 $obj = $db->fetch_object(
$resql);
880 $nbFactsClient = $obj->nb;
881 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
882 if (
isModEnabled(
"propal") && $user->rights->propal->lire) {
883 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
885 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
886 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
888 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
889 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
891 if (
isModEnabled(
'contrat') && $user->rights->contrat->lire) {
892 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
897 print
'<tr><td class="titlefield">';
898 print
$form->editfieldkey(
"StripeCustomerId",
'key_account', $stripecu, $object, $permissiontoaddupdatepaymentinformation,
'string',
'', 0, 2,
'socid');
900 print
$form->editfieldval(
"StripeCustomerId",
'key_account', $stripecu, $object, $permissiontoaddupdatepaymentinformation,
'string',
'',
null,
null,
'', 2,
'',
'socid');
901 if (
isModEnabled(
'stripe') && $stripecu && $action !=
'editkey_account') {
903 if (!empty($stripeacc)) {
904 $connect = $stripeacc.
'/';
906 $url =
'https://dashboard.stripe.com/'.$connect.
'test/customers/'.$stripecu;
907 if ($servicestatus) {
908 $url =
'https://dashboard.stripe.com/'.$connect.
'customers/'.$stripecu;
910 print
' <a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Publishable key = '.$site_account,
'globe').
'</a>';
912 print
'</td><td class="right">';
913 if (empty($stripecu)) {
914 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
915 print
'<input type="hidden" name="action" value="synccustomertostripe">';
916 print
'<input type="hidden" name="token" value="'.newToken().
'">';
917 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
918 print
img_picto($langs->trans(
"CreateCustomerOnStripe"),
'stripe');
919 print
'<input type="submit" class="buttonlink nomargintop nomarginbottom noborderbottom nopaddingtopimp nopaddingbottomimp" name="syncstripecustomer" value="'.$langs->trans(
"CreateCustomerOnStripe").
'">';
926 if ($object->fournisseur) {
927 print
'<tr><td class="titlefield">';
928 print $langs->trans(
'SupplierCode').
'</td><td colspan="2">';
930 $tmpcheck = $object->check_codefournisseur();
931 if ($tmpcheck != 0 && $tmpcheck != -5) {
932 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
935 $sql =
"SELECT count(*) as nb from ".MAIN_DB_PREFIX.
"facture where fk_soc = ".((int) $socid);
936 $resql = $db->query($sql);
940 $obj = $db->fetch_object(
$resql);
941 $nbFactsClient = $obj->nb;
942 $thirdTypeArray[
'customer'] = $langs->trans(
"customer");
943 if (
isModEnabled(
'propal') && $user->rights->propal->lire) {
944 $elementTypeArray[
'propal'] = $langs->transnoentitiesnoconv(
'Proposals');
946 if (
isModEnabled(
'commande') && $user->rights->commande->lire) {
947 $elementTypeArray[
'order'] = $langs->transnoentitiesnoconv(
'Orders');
949 if (
isModEnabled(
'facture') && $user->rights->facture->lire) {
950 $elementTypeArray[
'invoice'] = $langs->transnoentitiesnoconv(
'Invoices');
952 if (
isModEnabled(
'contrat') && $user->rights->contrat->lire) {
953 $elementTypeArray[
'contract'] = $langs->transnoentitiesnoconv(
'Contracts');
958 $stripesupplieracc = $stripe->getStripeAccount($service, $object->id);
961 print
'<tr><td class="titlefield">';
962 print
$form->editfieldkey(
"StripeConnectAccount",
'key_account_supplier', $stripesupplieracc, $object, $permissiontoaddupdatepaymentinformation,
'string',
'', 0, 2,
'socid');
964 print
$form->editfieldval(
"StripeConnectAccount",
'key_account_supplier', $stripesupplieracc, $object, $permissiontoaddupdatepaymentinformation,
'string',
'',
null,
null,
'', 2,
'',
'socid');
965 if (
isModEnabled(
'stripe') && $stripesupplieracc && $action !=
'editkey_account_supplier') {
968 $url =
'https://dashboard.stripe.com/test/connect/accounts/'.$stripesupplieracc;
969 if ($servicestatus) {
970 $url =
'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc;
972 print
' <a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Publishable key '.$site_account,
'globe').
'</a>';
974 print
'</td><td class="right">';
975 if (empty($stripesupplieracc)) {
976 print
'<form action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
977 print
'<input type="hidden" name="action" value="syncsuppliertostripe">';
978 print
'<input type="hidden" name="token" value="'.newToken().
'">';
979 print
'<input type="hidden" name="socid" value="'.$object->id.
'">';
980 print
'<input type="hidden" name="companybankid" value="'.$rib->id.
'">';
994 $showcardpaymentmode = 0;
996 $showcardpaymentmode++;
1000 $listofsources = array();
1002 if (is_object($stripe)) {
1004 $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus);
1005 if (!empty($customerstripe->id)) {
1007 if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) {
1008 $listofsources = $customerstripe->sources->data;
1010 $service =
'StripeTest';
1012 if (!empty($conf->global->STRIPE_LIVE) && !
GETPOST(
'forcesandbox',
'alpha')) {
1013 $service =
'StripeLive';
1018 global $stripearrayofkeysbyenv;
1019 \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$servicestatus][
'secret_key']);
1022 if (empty($stripeacc)) {
1023 $paymentmethodobjsA = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"card"));
1024 $paymentmethodobjsB = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"sepa_debit"));
1026 $paymentmethodobjsA = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"card"), array(
"stripe_account" => $stripeacc));
1027 $paymentmethodobjsB = \Stripe\PaymentMethod::all(array(
"customer" => $customerstripe->id,
"type" =>
"sepa_debit"), array(
"stripe_account" => $stripeacc));
1030 if ($paymentmethodobjsA->data !=
null && $paymentmethodobjsB->data !=
null) {
1031 $listofsources = array_merge((array) $paymentmethodobjsA->data, (array) $paymentmethodobjsB->data);
1032 } elseif ($paymentmethodobjsB->data !=
null) {
1033 $listofsources = $paymentmethodobjsB->data;
1035 $listofsources = $paymentmethodobjsA->data;
1044 dol_syslog(
"Error when searching/loading Stripe customer for thirdparty id =".$object->id);
1050 if ($showcardpaymentmode && $object->client) {
1051 $morehtmlright =
'';
1052 if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) {
1053 $morehtmlright .=
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'&action=createcard');
1055 print
load_fiche_titre($langs->trans(
'CreditCard').($stripeacc ?
' (Stripe connection with StripeConnect account '.$stripeacc.
')' :
' (Stripe connection with keys from Stripe module setup)'), $morehtmlright,
'fa-credit-card');
1057 print
'<!-- List of card payments -->'.
"\n";
1058 print
'<div class="div-table-responsive-no-min">';
1059 print
'<table class="liste centpercent">'.
"\n";
1060 print
'<tr class="liste_titre">';
1061 print
'<td>'.$langs->trans(
'Label').
'</td>';
1062 print
'<td>'.$langs->trans(
'StripeID').
'</td>';
1063 print
'<td>'.$langs->trans(
'Type').
'</td>';
1064 print
'<td>'.$langs->trans(
'Informations').
'</td>';
1066 print
'<td class="center">'.$langs->trans(
'Default').
'</td>';
1067 print
'<td>'.$langs->trans(
'Note').
'</td>';
1068 print
'<td>'.$langs->trans(
'DateModification').
'</td>';
1070 $parameters = array(
'arrayfields'=>array(),
'param'=>
'',
'sortfield'=>
'',
'sortorder'=>
'',
'linetype'=>
'stripetitle');
1071 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
1072 print $hookmanager->resPrint;
1079 $arrayofremotecard = array();
1082 if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) {
1086 $sql =
'SELECT rowid FROM '.MAIN_DB_PREFIX.
"societe_rib";
1087 $sql .=
" WHERE type in ('card')";
1088 $sql .=
" AND fk_soc = ".((int) $object->id);
1089 $sql .=
" AND status = ".((int) $servicestatus);
1091 $resql = $db->query($sql);
1093 $num_rows = $db->num_rows(
$resql);
1096 while ($i < $num_rows) {
1099 $obj = $db->fetch_object(
$resql);
1101 $companypaymentmodetemp->fetch($obj->rowid);
1103 $arrayofremotecard[$companypaymentmodetemp->stripe_card_ref] = $companypaymentmodetemp->stripe_card_ref;
1105 print
'<tr class="oddeven" data-rowid="'.((int) $companypaymentmodetemp->id).
'">';
1107 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($companypaymentmodetemp->label).
'">';
1111 print
'<td class="tdoverflowmax150">';
1112 if (!empty($companypaymentmodetemp->stripe_card_ref)) {
1114 if (!empty($stripeacc)) {
1115 $connect = $stripeacc.
'/';
1117 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$companypaymentmodetemp->stripe_card_ref;
1118 if ($servicestatus) {
1119 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$companypaymentmodetemp->stripe_card_ref;
1121 print
'<a href="'.$url.
'" target="_stripe">'.
img_picto($langs->trans(
'ShowInStripe').
' - Customer and Publishable key = '.$companypaymentmodetemp->stripe_account,
'globe').
'</a> ';
1130 print
'<td class="minwidth100">';
1131 if ($companypaymentmodetemp->proprio) {
1132 print
'<span class="opacitymedium">'.$companypaymentmodetemp->proprio.
'</span><br>';
1134 if ($companypaymentmodetemp->last_four) {
1135 print
'....'.$companypaymentmodetemp->last_four;
1137 if ($companypaymentmodetemp->exp_date_month || $companypaymentmodetemp->exp_date_year) {
1138 print
' - '.sprintf(
"%02d", $companypaymentmodetemp->exp_date_month).
'/'.$companypaymentmodetemp->exp_date_year.
'';
1142 print
'<td class="tdoverflowmax100">';
1143 if ($companypaymentmodetemp->country_code) {
1145 print $img ? $img.
' ' :
'';
1146 print
getCountry($companypaymentmodetemp->country_code, 1);
1148 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1152 print
'<td class="center">';
1153 if (empty($companypaymentmodetemp->default_rib)) {
1154 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=setlocalassourcedefault&token='.
newToken().
'">';
1155 print
img_picto($langs->trans(
"Default"),
'off');
1158 print
img_picto($langs->trans(
"Default"),
'on');
1161 if (empty($companypaymentmodetemp->stripe_card_ref)) {
1162 $s = $langs->trans(
"Local");
1164 $s = $langs->trans(
"LocalAndRemote");
1166 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($s).
'">';
1173 $parameters = array(
'arrayfields'=>array(),
'obj'=>$obj,
'linetype'=>
'stripecard');
1174 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1175 print $hookmanager->resPrint;
1177 print
'<td class="right minwidth50 nowraponall">';
1178 if ($permissiontoaddupdatepaymentinformation) {
1179 if ($stripecu && empty($companypaymentmodetemp->stripe_card_ref)) {
1180 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?action=synccardtostripe&socid='.$object->id.
'&id='.$companypaymentmodetemp->id.
'" class="paddingrightonly marginrightonly">'.$langs->trans(
"CreateCardOnStripe").
'</a>';
1183 print
'<a class="editfielda marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=editcard&token='.
newToken().
'">';
1184 print
img_picto($langs->trans(
"Modify"),
'edit');
1186 print
'<a class="marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&id='.$companypaymentmodetemp->id.
'&action=deletecard&token='.
newToken().
'">';
1187 print
img_picto($langs->trans(
"Delete"),
'delete');
1202 if (is_array($listofsources) && count($listofsources)) {
1203 foreach ($listofsources as $src) {
1204 if (!empty($arrayofremotecard[$src->id])) {
1211 if ($src->object ==
'card') {
1213 } elseif ($src->object ==
'source' && $src->type ==
'card') {
1215 } elseif ($src->object ==
'payment_method' && $src->type ==
'card') {
1217 } elseif ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1219 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1223 print
'<tr class="oddeven">';
1227 print
'<td class="tdoverflowmax150">';
1229 if (!empty($stripeacc)) {
1230 $connect = $stripeacc.
'/';
1233 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$src->id;
1234 if ($servicestatus) {
1236 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$src->id;
1238 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1246 print
'<td valign="middle">';
1247 if ($src->object ==
'card') {
1248 print
'....'.$src->last4.
' - '.$src->exp_month.
'/'.$src->exp_year.
'';
1250 if ($src->country) {
1252 print $img ? $img.
' ' :
'';
1255 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1257 } elseif ($src->object ==
'source' && $src->type ==
'card') {
1258 print
'<span class="opacitymedium">'.$src->owner->name.
'</span><br>....'.$src->card->last4.
' - '.$src->card->exp_month.
'/'.$src->card->exp_year.
'';
1261 if ($src->card->country) {
1263 print $img ? $img.
' ' :
'';
1266 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1268 } elseif ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1269 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->sepa_debit->last4;
1271 if ($src->sepa_debit->country) {
1273 print $img ? $img.
' ' :
'';
1274 print
getCountry($src->sepa_debit->country, 1);
1276 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1278 } elseif ($src->object ==
'payment_method' && $src->type ==
'card') {
1279 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->card->last4.
' - '.$src->card->exp_month.
'/'.$src->card->exp_year.
'';
1282 if ($src->card->country) {
1284 print $img ? $img.
' ' :
'';
1287 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1289 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1290 print
'<span class="opacitymedium">'.$src->billing_details->name.
'</span><br>....'.$src->sepa_debit->last4;
1292 if ($src->sepa_debit->country) {
1294 print $img ? $img.
' ' :
'';
1295 print
getCountry($src->sepa_debit->country, 1);
1297 print
img_warning().
' <span class="error">'.$langs->trans(
"ErrorFieldRequired", $langs->transnoentitiesnoconv(
"CompanyCountry")).
'</span>';
1304 print
'<td class="center" width="50">';
1305 if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) ||
1306 (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) {
1307 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&source='.$src->id.
'&action=setassourcedefault&token='.
newToken().
'">';
1308 print
img_picto($langs->trans(
"Default"),
'off');
1311 print
img_picto($langs->trans(
"Default"),
'on');
1315 print $langs->trans(
"Remote");
1324 $parameters = array(
'arrayfields'=>array(),
'stripesource'=>$src,
'linetype'=>
'stripecardremoteonly');
1325 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1326 print $hookmanager->resPrint;
1329 print
'<td class="right nowraponall">';
1330 if ($permissiontoaddupdatepaymentinformation) {
1331 print
'<a class="marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&source='.$src->id.
'&action=deletecard&token='.
newToken().
'">';
1332 print
img_picto($langs->trans(
"Delete"),
'delete');
1341 if ($nbremote == 0 && $nblocal == 0) {
1342 $colspan = (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD) ? 10 : 9);
1343 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
1351 if (
isModEnabled(
'stripe') && !empty($conf->stripeconnect->enabled) && !empty($stripesupplieracc)) {
1352 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');
1353 $balance = \Stripe\Balance::retrieve(array(
"stripe_account" => $stripesupplieracc));
1354 print
'<table class="liste centpercent">'.
"\n";
1355 print
'<tr class="liste_titre">';
1356 print
'<td>'.$langs->trans(
'Currency').
'</td>';
1357 print
'<td>'.$langs->trans(
'Available').
'</td>';
1358 print
'<td>'.$langs->trans(
'Pending').
'</td>';
1359 print
'<td>'.$langs->trans(
'Total').
'</td>';
1362 $currencybalance = array();
1363 if (is_array($balance->available) && count($balance->available)) {
1364 foreach ($balance->available as $cpt) {
1365 $arrayzerounitcurrency = array(
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF');
1366 if (!in_array($cpt->currency, $arrayzerounitcurrency)) {
1367 $currencybalance[$cpt->currency][
'available'] = $cpt->amount / 100;
1369 $currencybalance[$cpt->currency][
'available'] = $cpt->amount;
1371 $currencybalance[$cpt->currency][
'currency'] = $cpt->currency;
1375 if (is_array($balance->pending) && count($balance->pending)) {
1376 foreach ($balance->pending as $cpt) {
1377 $arrayzerounitcurrency = array(
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF');
1378 if (!in_array($cpt->currency, $arrayzerounitcurrency)) {
1379 $currencybalance[$cpt->currency][
'pending'] = $currencybalance[$cpt->currency][
'available'] + $cpt->amount / 100;
1381 $currencybalance[$cpt->currency][
'pending'] = $currencybalance[$cpt->currency][
'available'] + $cpt->amount;
1386 if (is_array($currencybalance)) {
1387 foreach ($currencybalance as $cpt) {
1388 print
'<tr><td>'.$langs->trans(
"Currency".strtoupper($cpt[
'currency'])).
'</td><td>'.
price($cpt[
'available'], 0,
'', 1, - 1, - 1, strtoupper($cpt[
'currency'])).
'</td><td>'.
price(isset($cpt->pending)?$cpt->pending:0, 0,
'', 1, - 1, - 1, strtoupper($cpt[
'currency'])).
'</td><td>'.
price($cpt[
'available'] + (isset($cpt->pending)?$cpt->pending:0), 0,
'', 1, - 1, - 1, strtoupper($cpt[
'currency'])).
'</td></tr>';
1397 if ($permissiontoaddupdatepaymentinformation) {
1398 $morehtmlright =
dolGetButtonTitle($langs->trans(
'Add'),
'',
'fa fa-plus-circle', $_SERVER[
"PHP_SELF"] .
'?socid=' . $object->id .
'&action=create');
1401 print
load_fiche_titre($langs->trans(
"BankAccounts"), $morehtmlright,
'bank');
1403 $nblocal = 0; $nbremote = 0;
1404 $arrayofremoteban = array();
1406 $rib_list = $object->get_all_rib();
1408 if (is_array($rib_list)) {
1409 print
'<div class="div-table-responsive-no-min">';
1410 print
'<table class="liste centpercent">';
1412 print
'<tr class="liste_titre">';
1419 if (!empty($conf->prelevement->enabled)) {
1427 $parameters = array(
'arrayfields'=>array(),
'linetype'=>
'stripebantitle');
1428 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1429 print $hookmanager->resPrint;
1434 foreach ($rib_list as $rib) {
1435 $arrayofremoteban[$rib->stripe_card_ref] = $rib->stripe_card_ref;
1439 print
'<tr class="oddeven">';
1441 print
'<td>'.dol_escape_htmltag($rib->label).
'</td>';
1443 print
'<td class="tdoverflowmax150">';
1444 if ($rib->stripe_card_ref) {
1446 if (!empty($stripeacc)) {
1447 $connect = $stripeacc.
'/';
1450 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$rib->stripe_card_ref;
1451 if ($servicestatus) {
1453 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$rib->stripe_card_ref;
1455 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1457 print $rib->stripe_card_ref;
1460 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($rib->bank).
'">'.
dol_escape_htmltag($rib->bank).
'</td>';
1463 foreach ($rib->getFieldsToShow() as $val) {
1464 if ($val ==
'BankCode') {
1465 $string .= $rib->code_banque.
' ';
1466 } elseif ($val ==
'BankAccountNumber') {
1467 $string .= $rib->number.
' ';
1468 } elseif ($val ==
'DeskCode') {
1469 $string .= $rib->code_guichet.
' ';
1470 } elseif ($val ==
'BankAccountNumberKey') {
1471 $string .= $rib->cle_rib.
' ';
1480 if (!empty($rib->label) && $rib->number) {
1482 $string .=
' '.img_picto($langs->trans(
"ValueIsNotValid"),
'warning');
1484 $string .=
' '.img_picto($langs->trans(
"ValueIsValid"),
'info');
1487 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($string).
'">';
1491 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($rib->iban).
'">';
1492 if (!empty($rib->iban)) {
1494 print
img_picto($langs->trans(
"IbanNotValid"),
'warning').
' ';
1501 if (!empty($rib->bic)) {
1503 print
img_picto($langs->trans(
"SwiftNotValid"),
'warning').
' ';
1509 if (!empty($conf->prelevement->enabled)) {
1512 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($rib->rum).
'">'.
dol_escape_htmltag($rib->rum).
'</td>';
1514 print
'<td>'.dol_print_date($rib->date_rum,
'day').
'</td>';
1517 print
'<td>'.$rib->frstrecur.
'</td>';
1521 print
'<td class="center" width="70">';
1522 if (!$rib->default_rib) {
1523 print
'<a href="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'&ribid='.$rib->id.
'&action=setasbankdefault&token='.
newToken().
'">';
1524 print
img_picto($langs->trans(
"Disabled"),
'off');
1527 print
img_picto($langs->trans(
"Enabled"),
'on');
1532 print
'<td class="center">';
1534 $buttonlabel = $langs->trans(
"BuildDoc");
1535 $forname =
'builddocrib'.$rib->id;
1537 include_once DOL_DOCUMENT_ROOT.
'/core/modules/bank/modules_bank.php';
1541 if (is_array($modellist) && count($modellist)) {
1542 $out .=
'<form action="'.$_SERVER[
"PHP_SELF"].(empty($conf->global->MAIN_JUMP_TAG) ?
'' :
'#builddoc').
'" name="'.$forname.
'" id="'.$forname.
'_form" method="post">';
1543 $out .=
'<input type="hidden" name="action" value="builddocrib">';
1544 $out .=
'<input type="hidden" name="token" value="'.newToken().
'">';
1545 $out .=
'<input type="hidden" name="socid" value="'.$object->id.
'">';
1546 $out .=
'<input type="hidden" name="companybankid" value="'.$rib->id.
'">';
1548 if (is_array($modellist) && count($modellist) == 1) {
1549 $arraykeys = array_keys($modellist);
1550 $modelselected = $arraykeys[0];
1552 if (!empty($conf->global->BANKADDON_PDF)) {
1553 $modelselected = $conf->global->BANKADDON_PDF;
1556 $out .=
$form->selectarray(
'modelrib'.$rib->id, $modellist, $modelselected, 1, 0, 0,
'', 0, 0, 0,
'',
'minwidth100');
1559 $allowgenifempty = 0;
1563 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
1565 $defaultlang = $langs->getDefaultLang();
1566 $morecss =
'maxwidth150';
1567 if ($conf->browser->layout ==
'phone') {
1568 $morecss =
'maxwidth100';
1570 $out .= $formadmin->select_language($defaultlang,
'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss);
1573 $genbutton =
'<input class="button buttongen reposition nomargintop nomarginbottom" id="'.$forname.
'_generatebutton" name="'.$forname.
'_generatebutton"';
1574 $genbutton .=
' type="submit" value="'.$buttonlabel.
'"';
1575 if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) {
1576 $genbutton .=
' disabled';
1579 if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
1580 $langs->load(
"errors");
1581 $genbutton .=
' '.img_warning($langs->transnoentitiesnoconv(
"WarningNoDocumentModelActivated"));
1583 if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart !=
'unpaid') {
1586 if (empty($modellist) && !$showempty && $modulepart !=
'unpaid') {
1596 $parameters = array(
'arrayfields'=>array(),
'stripe_card_ref'=>$rib->stripe_card_ref,
'stripe_account'=>$rib->stripe_account,
'linetype'=>
'stripeban');
1597 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1598 print $hookmanager->resPrint;
1601 print
'<td class="right nowraponall">';
1602 if ($permissiontoaddupdatepaymentinformation) {
1603 if (empty($rib->stripe_card_ref)) {
1605 print
'<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'&id='.$rib->id.
'&action=syncsepatostripe&token='.
newToken().
'">';
1606 print
img_picto($langs->trans(
"CreateBANOnStripe"),
'stripe');
1610 print
'<a class="editfielda marginrightonly marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'&id='.$rib->id.
'&action=edit">';
1611 print
img_picto($langs->trans(
"Modify"),
'edit');
1614 print
'<a class="marginrightonly marginleftonly" href="'.$_SERVER[
"PHP_SELF"].
'?socid='.$object->id.
'&id='.$rib->id.
'&action=deletebank&token='.
newToken().
'">';
1615 print
img_picto($langs->trans(
"Delete"),
'delete');
1625 foreach ($listofsources as $src) {
1626 if (!empty($arrayofremoteban[$src->id])) {
1631 if ($src->object ==
'source' && $src->type ==
'sepa_debit') {
1632 $imgline =
'<span class="fa fa-university fa-2x fa-fw"></span>';
1633 } elseif ($src->object ==
'payment_method' && $src->type ==
'sepa_debit') {
1634 $imgline =
'<span class="fa fa-university fa-2x fa-fw"></span>';
1641 print
'<tr class="oddeven">';
1645 print
'<td class="tdoverflowmax150">';
1647 if (!empty($stripeacc)) {
1648 $connect = $stripeacc.
'/';
1651 $url =
'https://dashboard.stripe.com/'.$connect.
'test/search?query='.$src->id;
1652 if ($servicestatus) {
1654 $url =
'https://dashboard.stripe.com/'.$connect.
'search?query='.$src->id;
1656 print
"<a href='".$url.
"' target='_stripe'>".
img_picto($langs->trans(
'ShowInStripe'),
'globe').
"</a> ";
1663 print
'<td valign="middle">';
1666 print
'<td valign="middle">';
1670 print
'<td valign="middle">';
1674 if (!empty($conf->prelevement->enabled)) {
1676 print
'<td valign="middle">';
1680 print
'<td valign="middle">';
1684 print
'<td valign="middle">';
1690 print
'<td class="center" width="50">';
1691 if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) ||
1692 (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) {
1693 print
'<a href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&source='.$src->id.
'&action=setassourcedefault&token='.
newToken().
'">';
1694 print
img_picto($langs->trans(
"Default"),
'off');
1697 print
img_picto($langs->trans(
"Default"),
'on');
1711 $parameters = array(
'arrayfields'=>array(),
'stripe_card_ref'=>$rib->stripe_card_ref,
'stripe_account'=>$rib->stripe_account,
'linetype'=>
'stripebanremoteonly');
1712 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1713 print $hookmanager->resPrint;
1716 print
'<td class="right nowraponall">';
1717 if ($permissiontoaddupdatepaymentinformation) {
1718 print
'<a class="marginleftonly marginrightonly" href="'.DOL_URL_ROOT.
'/societe/paymentmodes.php?socid='.$object->id.
'&source='.$src->id.
'&action=deletebank&token='.
newToken().
'">';
1719 print
img_picto($langs->trans(
"Delete"),
'delete');
1727 if ($nbremote == 0 && $nblocal == 0) {
1732 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoBANRecord").
'</span></td></tr>';
1742 if (empty($conf->global->SOCIETE_DISABLE_BUILDDOC)) {
1745 print
'<div class="fichecenter"><div class="fichehalfleft">';
1746 print
'<a name="builddoc"></a>';
1751 $filedir = $conf->societe->multidir_output[$object->entity].
'/'.$object->id;
1752 $urlsource = $_SERVER[
"PHP_SELF"].
"?socid=".$object->id;
1754 print $formfile->showdocuments(
'company', $object->id, $filedir, $urlsource, $permissiontoread, $permissiontoaddupdatepaymentinformation, $object->model_pdf, 0, 0, 0, 28, 0,
'entity='.$object->entity, 0,
'', $object->default_lang);
1757 if (!empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) {
1760 $result = $companypaymentmodetemp->fetch(0,
null, $object->id,
'ban');
1762 include_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmfiles.class.php';
1764 $result = $ecmfile->fetch(0,
'',
'',
'',
'', $companybankaccounttemp->table_element, $companypaymentmodetemp->id);
1766 $companybankaccounttemp->last_main_doc = $ecmfile->filepath.
'/'.$ecmfile->filename;
1767 print
'<br><!-- Link to download main doc -->'.
"\n";
1772 print
'</div><div class="fichehalfright">';
1775 print
'</div></div>';
1801 if ($socid && $action ==
'edit' && $permissiontoaddupdatepaymentinformation) {
1804 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1806 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
1808 print
'<div class="underbanner clearboth"></div>';
1812 print
'<div class="div-table-responsive-no-min">';
1813 print
'<table class="border centpercent">';
1815 print
'<tr><td class="titlefield fieldrequired">'.$langs->trans(
"Label").
'</td>';
1816 print
'<td><input class="minwidth300" type="text" name="label" value="'.$companybankaccount->label.
'"></td></tr>';
1818 print
'<tr><td class="fieldrequired">'.$langs->trans(
"BankName").
'</td>';
1819 print
'<td><input class="minwidth200" type="text" name="bank" value="'.$companybankaccount->bank.
'"></td></tr>';
1822 foreach ($companybankaccount->getFieldsToShow(1) as $val) {
1825 if ($val ==
'BankCode') {
1826 $name =
'code_banque';
1828 $content = $companybankaccount->code_banque;
1829 } elseif ($val ==
'DeskCode') {
1830 $name =
'code_guichet';
1832 $content = $companybankaccount->code_guichet;
1833 } elseif ($val ==
'BankAccountNumber') {
1836 $content = $companybankaccount->number;
1837 } elseif ($val ==
'BankAccountNumberKey') {
1840 $content = $companybankaccount->cle_rib;
1841 } elseif ($val ==
'IBAN') {
1844 $content = $companybankaccount->iban;
1845 if ($companybankaccount->needIBAN()) {
1848 $tooltip = $langs->trans(
"Example").
':<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';
1849 } elseif ($val ==
'BIC') {
1852 $content = $companybankaccount->bic;
1853 if ($companybankaccount->needIBAN()) {
1856 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
1859 print
'<tr><td'.($require ?
' class="fieldrequired" ' :
'').
'>';
1861 print
$form->textwithpicto($langs->trans($val), $tooltip, 4,
'help',
'', 0, 3, $name);
1863 print $langs->trans($val);
1866 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.$content.
'"></td>';
1870 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
1871 print
'<textarea name="domiciliation" rows="4" cols="40" maxlength="255">';
1872 print $companybankaccount->domiciliation;
1873 print
"</textarea></td></tr>";
1875 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
1876 print
'<td><input class="minwidth300" type="text" name="proprio" value="'.$companybankaccount->proprio.
'"></td></tr>';
1877 print
"</td></tr>\n";
1879 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
1880 print
'<textarea name="owner_address" rows="'.ROWS_4.
'" cols="40" maxlength="255">';
1881 print $companybankaccount->owner_address;
1882 print
"</textarea></td></tr>";
1890 print
'<div class="div-table-responsive-no-min">';
1891 print
'<table class="border centpercent">';
1893 if (empty($companybankaccount->rum)) {
1894 $companybankaccount->rum = $prelevement->buildRumNumber($object->code_client, $companybankaccount->datec, $companybankaccount->id);
1898 print
'<tr><td class="titlefield">'.$langs->trans(
"RUM").
'</td>';
1899 print
'<td><input class="minwidth300" type="text" name="rum" value="'.dol_escape_htmltag($companybankaccount->rum).
'"></td></tr>';
1903 print
'<tr><td class="titlefield">'.$langs->trans(
"DateRUM").
'</td>';
1904 print
'<td>'.$form->selectDate($date_rum ? $date_rum : $companybankaccount->date_rum,
'date_rum', 0, 0, 1,
'date_rum', 1, 1).
'</td></tr>';
1906 print
'<tr><td>'.$langs->trans(
"WithdrawMode").
'</td><td>';
1907 $tblArraychoice = array(
"FRST" => $langs->trans(
"FRST"),
"RECUR" => $langs->trans(
"RECUR"));
1911 print
'<tr><td>'.$langs->trans(
"StripeID").
" ('src_....')</td>";
1912 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.$companypaymentmode->stripe_card_ref.
'"></td></tr>';
1921 print
$form->buttonsSaveCancel(
"Modify");
1925 if ($socid && $action ==
'editcard' && $permissiontoaddupdatepaymentinformation) {
1928 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1930 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
1932 print
'<div class="nofichecenter">';
1934 print
'<div class="underbanner clearboth"></div>';
1938 print
'<table class="border centpercent">';
1940 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
1941 print
'<td><input class="minwidth300" type="text" id="label" name="label" value="'.$companypaymentmode->label.
'"></td></tr>';
1943 print
'<tr><td class="fieldrequired">'.$langs->trans(
"NameOnCard").
'</td>';
1944 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.$companypaymentmode->proprio.
'"></td></tr>';
1946 print
'<tr><td>'.$langs->trans(
"CardNumber").
'</td>';
1947 print
'<td><input class="minwidth200" type="text" name="cardnumber" value="'.$companypaymentmode->number.
'"></td></tr>';
1949 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ExpiryDate").
'</td>';
1951 print $formother->select_month($companypaymentmode->exp_date_month,
'exp_date_month', 1);
1952 print $formother->selectyear($companypaymentmode->exp_date_year,
'exp_date_year', 1, 5, 10, 0, 0,
'',
'marginleftonly');
1955 print
'<tr><td>'.$langs->trans(
"CVN").
'</td>';
1956 print
'<td><input size="8" type="text" name="cvn" value="'.$companypaymentmode->cvn.
'"></td></tr>';
1958 print
'<tr><td>'.$langs->trans(
"StripeID").
" ('card_....')</td>";
1959 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.$companypaymentmode->stripe_card_ref.
'"></td></tr>';
1966 print
$form->buttonsSaveCancel(
"Modify");
1971 if ($socid && $action ==
'create' && $permissiontoaddupdatepaymentinformation) {
1974 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1976 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
1978 print
'<div class="nofichecenter">';
1980 print
'<div class="underbanner clearboth"></div>';
1984 print
'<table class="border centpercent">';
1986 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
1987 print
'<td><input class="minwidth200" type="text" id="label" name="label" value="'.(GETPOSTISSET(
'label') ?
GETPOST(
'label') : $object->
name).
'"></td></tr>';
1989 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Bank").
'</td>';
1990 print
'<td><input class="minwidth200" type="text" id="bank" name="bank" value="'.GETPOST(
'bank').
'"></td></tr>';
1993 foreach ($companybankaccount->getFieldsToShow(1) as $val) {
1996 if ($val ==
'BankCode') {
1997 $name =
'code_banque';
1999 $content = $companybankaccount->code_banque;
2000 } elseif ($val ==
'DeskCode') {
2001 $name =
'code_guichet';
2003 $content = $companybankaccount->code_guichet;
2004 } elseif ($val ==
'BankAccountNumber') {
2007 $content = $companybankaccount->number;
2008 } elseif ($val ==
'BankAccountNumberKey') {
2011 $content = $companybankaccount->cle_rib;
2012 } elseif ($val ==
'IBAN') {
2015 $content = $companybankaccount->iban;
2016 if ($companybankaccount->needIBAN()) {
2019 $tooltip = $langs->trans(
"Example").
':<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';
2020 } elseif ($val ==
'BIC') {
2023 $content = $companybankaccount->bic;
2024 if ($companybankaccount->needIBAN()) {
2027 $tooltip = $langs->trans(
"Example").
': LIABLT2XXXX';
2030 print
'<tr><td'.($require ?
' class="fieldrequired" ' :
'').
'>';
2032 print
$form->textwithpicto($langs->trans($val), $tooltip, 4,
'help',
'', 0, 3, $name);
2034 print $langs->trans($val);
2037 print
'<td><input size="'.$size.
'" type="text" class="flat" name="'.$name.
'" value="'.
GETPOST($name).
'"></td>';
2041 print
'<tr><td>'.$langs->trans(
"BankAccountDomiciliation").
'</td><td>';
2042 print
'<textarea name="domiciliation" rows="'.ROWS_4.
'" class="quatrevingtpercent" maxlength="255">';
2043 print
GETPOST(
'domiciliation');
2044 print
"</textarea></td></tr>";
2046 print
'<tr><td>'.$langs->trans(
"BankAccountOwner").
'</td>';
2047 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.GETPOST(
'proprio').
'"></td></tr>';
2048 print
"</td></tr>\n";
2050 print
'<tr><td>'.$langs->trans(
"BankAccountOwnerAddress").
'</td><td>';
2051 print
'<textarea name="owner_address" rows="'.ROWS_4.
'" class="quatrevingtpercent" maxlength="255">';
2052 print
GETPOST(
'owner_address');
2053 print
"</textarea></td></tr>";
2060 print
'<table class="border centpercent">';
2063 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"RUM").
'</td>';
2064 print
'<td colspan="4"><input type="text" class="minwidth300" name="rum" value="'.GETPOST(
'rum',
'alpha').
'"> <div class="opacitymedium">'.$langs->trans(
"RUMWillBeGenerated").
'</div></td></tr>';
2068 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DateRUM").
'</td>';
2069 print
'<td colspan="4">'.$form->selectDate($date_rum,
'date_rum', 0, 0, 1,
'date_rum', 1, 1).
'</td></tr>';
2071 print
'<tr><td>'.$langs->trans(
"WithdrawMode").
'</td><td>';
2072 $tblArraychoice = array(
"FRST" => $langs->trans(
"FRST"),
"RECUR" => $langs->trans(
"RECUR"));
2073 print
$form->selectarray(
"frstrecur", $tblArraychoice, (
GETPOSTISSET(
'frstrecur') ?
GETPOST(
'frstrecur') :
'FRST'), 0);
2076 print
'<tr><td>'.$langs->trans(
"StripeID").
" ('src_....')</td>";
2077 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST(
'stripe_card_ref',
'alpha').
'"></td></tr>';
2088 print
$form->buttonsSaveCancel(
"Add");
2092 if ($socid && $action ==
'createcard' && $permissiontoaddupdatepaymentinformation) {
2095 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
2097 dol_banner_tab($object,
'socid', $linkback, ($user->socid ? 0 : 1),
'rowid',
'nom');
2099 print
'<div class="nofichecenter">';
2101 print
'<div class="underbanner clearboth"></div>';
2105 print
'<table class="border centpercent">';
2107 print
'<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Label").
'</td>';
2108 print
'<td><input class="minwidth200" type="text" id="label" name="label" value="'.GETPOST(
'label',
'alpha').
'"></td></tr>';
2110 print
'<tr><td class="fieldrequired">'.$langs->trans(
"NameOnCard").
'</td>';
2111 print
'<td><input class="minwidth200" type="text" name="proprio" value="'.GETPOST(
'proprio',
'alpha').
'"></td></tr>';
2113 print
'<tr><td>'.$langs->trans(
"CardNumber").
'</td>';
2114 print
'<td><input class="minwidth200" type="text" name="cardnumber" value="'.GETPOST(
'cardnumber',
'alpha').
'"></td></tr>';
2116 print
'<tr><td class="fieldrequired">'.$langs->trans(
"ExpiryDate").
'</td>';
2118 print $formother->select_month(
GETPOST(
'exp_date_month',
'int'),
'exp_date_month', 1);
2119 print $formother->selectyear(
GETPOST(
'exp_date_year',
'int'),
'exp_date_year', 1, 5, 10, 0, 0,
'',
'marginleftonly');
2122 print
'<tr><td>'.$langs->trans(
"CVN").
'</td>';
2123 print
'<td><input class="width50" type="text" name="cvn" value="'.GETPOST(
'cvn',
'alpha').
'"></td></tr>';
2125 print
'<tr><td>'.$langs->trans(
"StripeID").
" ('card_....')</td>";
2126 print
'<td><input class="minwidth300" type="text" name="stripe_card_ref" value="'.GETPOST(
'stripe_card_ref',
'alpha').
'"></td></tr>';
2136 print
$form->buttonsSaveCancel(
"Add");
2139 if ($socid && ($action ==
'edit' || $action ==
'editcard') && $permissiontoaddupdatepaymentinformation) {
2142 if ($socid && ($action ==
'create' || $action ==
'createcard') && $permissiontoaddupdatepaymentinformation) {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
checkIbanForAccount(Account $account)
Check IBAN number informations for a bank account.
checkBanForAccount($account)
Check account number informations for a bank account.
checkSwiftForAccount($account)
Check SWIFT informations 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...)
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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'.
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
showDirectDownloadLink($object)
Return string with full Url.
dol_htmloutput_mesg($mesgstring='', $mesgarray=array(), $style='ok', $keepembedded=0)
Print formated messages to output (Used to show messages on html output).
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
img_credit_card($brand, $morecss=null)
Return image of a credit card according to its brand name.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$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, $mode=0)
Check permissions of a user to show a page and an object.