865 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
868 global $langs, $hookmanager;
869 $langs->load(
'bills');
875 $statusType =
'status0';
879 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
880 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
881 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
883 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
884 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
886 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
887 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
889 $statusType =
'status5';
890 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
891 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
892 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
893 $statusType =
'status9';
894 } elseif ($alreadypaid == 0) {
895 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
896 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
897 $statusType =
'status1';
899 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
900 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
901 $statusType =
'status3';
904 $statusType =
'status6';
906 if ($type == self::TYPE_CREDIT_NOTE) {
907 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
908 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
909 } elseif ($type == self::TYPE_DEPOSIT) {
910 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
911 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
913 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
914 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
922 'alreadypaid' => $alreadypaid,
926 $reshook = $hookmanager->executeHooks(
'LibStatut', $parameters, $this);
929 return $hookmanager->resPrint;
934 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1194 public function makeStripeSepaRequest($fuser, $did, $type =
'direct-debit', $sourcetype =
'facture', $service =
'', $forcestripe =
'')
1196 global $conf, $user, $langs;
1198 if ($type !=
'bank-transfer' && $type !=
'credit-transfer' && !
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT')) {
1205 if (empty($service)) {
1206 $service =
'StripeTest';
1208 $service =
'StripeLive';
1214 dol_syslog(get_class($this).
"::makeStripeSepaRequest start did=".$did.
" type=".$type.
" service=".$service.
" sourcetype=".$sourcetype.
" forcestripe=".$forcestripe, LOG_DEBUG);
1216 if ($this->
status > self::STATUS_DRAFT && $this->paye == 0) {
1218 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
1220 $result = $bac->fetch(0,
'', $this->socid, 1,
'ban');
1221 if ($result <= 0 || empty($bac->id)) {
1222 $this->error = $langs->trans(
"ThirdpartyHasNoDefaultBanAccount");
1223 $this->errors[] = $this->error;
1224 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error);
1229 $sql =
"SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons";
1230 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
1231 $sql .=
" WHERE rowid = ".((int) $did);
1232 if ($type !=
'bank-transfer' && $type !=
'credit-transfer') {
1233 $sql .=
" AND fk_facture = ".((int) $this->
id);
1235 if ($type !=
'direct-debit') {
1236 if ($sourcetype ==
'salary') {
1237 $sql .=
" AND fk_salary = ".((int) $this->
id);
1239 $sql .=
" AND fk_facture_fourn = ".((int) $this->
id);
1242 $sql .=
" AND traite = 0";
1244 dol_syslog(get_class($this).
"::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1245 $resql = $this->db->query($sql);
1247 $obj = $this->db->fetch_object($resql);
1254 $amount = $obj->amount;
1256 if (is_numeric($amount) && $amount != 0) {
1257 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
1259 $companypaymentmode->fetch($bac->id);
1261 $this->stripechargedone = 0;
1262 $this->stripechargeerror = 0;
1266 $currency = $conf->currency;
1268 $errorforinvoice = 0;
1272 dol_syslog(
"makeStripeSepaRequest Process payment request amount=".$amount.
" thirdparty_id=" . $this->thirdparty->id .
", thirdparty_name=" . $this->thirdparty->name .
" ban id=" . $bac->id, LOG_DEBUG);
1277 $amounttopay = $amount;
1281 $arrayzerounitcurrency = [
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF'];
1282 $amountstripe = $amounttopay;
1283 if (!in_array($currency, $arrayzerounitcurrency)) {
1284 $amountstripe *= 100;
1287 $fk_bank_account =
getDolGlobalInt(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
1288 if (!($fk_bank_account > 0)) {
1291 dol_syslog(
"makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
1292 $this->errors[] =
"Error bank account for Stripe payments not defined into Stripe module";
1298 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
1301 if (empty($obj->fk_prelevement_bons)) {
1303 $nbinvoices = $bon->create(0, 0,
'real',
'ALL',
'', 0, $type, $did, $fk_bank_account);
1304 if ($nbinvoices <= 0) {
1307 dol_syslog(
"makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
1308 $this->errors[] =
"Error on BonPrelevement creation";
1327 dol_syslog(
"makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
1328 $this->errors[] =
"The line is already included into a bank payment order. Delete the bank payment order first.";
1332 $paymentintent =
null;
1334 if ($amountstripe > 0) {
1336 global $savstripearrayofkeysbyenv;
1337 global $stripearrayofkeysbyenv;
1339 if ($service ==
'StripeLive') {
1344 dol_syslog(
"makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id .
" stripe_card_ref=" . $companypaymentmode->stripe_card_ref .
" mode=" . $companypaymentmode->status, LOG_DEBUG);
1346 $thirdparty =
new Societe($this->db);
1347 $resultthirdparty = $thirdparty->fetch($this->socid);
1349 include_once DOL_DOCUMENT_ROOT .
'/stripe/class/stripe.class.php';
1351 $stripe =
new Stripe($this->db);
1353 if (empty($savstripearrayofkeysbyenv)) {
1354 $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1356 dol_syslog(
"makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1357 dol_syslog(
"makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1359 $foundalternativestripeaccount =
'';
1362 if (! empty($forcestripe)) {
1363 dol_syslog(
"makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1365 $tmparray = explode(
'@', $forcestripe);
1366 if (! empty($tmparray[1])) {
1367 $tmparray2 = explode(
':', $tmparray[1]);
1368 if (! empty($tmparray2[1])) {
1369 $stripearrayofkeysbyenv[$servicestatus][
"publishable_key"] = $tmparray2[0];
1370 $stripearrayofkeysbyenv[$servicestatus][
"secret_key"] = $tmparray2[1];
1372 $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1373 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1375 $foundalternativestripeaccount = $tmparray[0];
1377 dol_syslog(
"makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount.
" publishable_key=".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1381 if (! $foundalternativestripeaccount) {
1382 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1384 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1385 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1386 dol_syslog(
"makeStripeSepaRequest We found a bad value for Stripe Account for thirdparty id=".$thirdparty->id.
", so we ignore it and keep using the global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_WARNING);
1389 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1391 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1392 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1393 dol_syslog(
"makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1396 $stripeacc = $stripe->getStripeAccount($service, $this->socid);
1398 if ($foundalternativestripeaccount) {
1399 if (empty($stripeacc)) {
1400 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'));
1402 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'), array(
"stripe_account" => $stripeacc));
1405 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1406 if (empty($customer) && ! empty($stripe->error)) {
1407 $this->errors[] = $stripe->error;
1417 $postactionmessages = [];
1419 if ($resultthirdparty > 0 && !empty($customer)) {
1422 if ($companypaymentmode->type ==
'ban') {
1426 $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
1429 $this->error =
'The payment mode type is not "ban"';
1433 $FULLTAG =
'DID='.$did.
'-INV=' . $this->
id .
'-CUS=' . $thirdparty->id;
1434 $description =
'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG .
' did='.$did.
' ref=' . $this->ref;
1436 $stripefailurecode =
'';
1437 $stripefailuremessage =
'';
1438 $stripefailuredeclinecode =
'';
1441 dol_syslog(
"* Create payment on SEPA " . $stripecard->id .
", amounttopay=" . $amounttopay .
", amountstripe=" . $amountstripe .
", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1444 $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0,
'automatic',
true, $stripecard->id, 1, 1, $did);
1448 if ($paymentintent->status ===
'succeeded' || $paymentintent->status ===
'processing') {
1449 $charge->status =
'ok';
1450 $charge->id = $paymentintent->id;
1451 $charge->customer = $customer->id;
1452 } elseif ($paymentintent->status ===
'requires_action') {
1454 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1456 $charge->status =
'failed';
1457 $charge->customer = $customer->id;
1458 $charge->failure_code = $stripe->code;
1459 $charge->failure_message = $stripe->error;
1460 $charge->failure_declinecode = $stripe->declinecode;
1461 $stripefailurecode = $stripe->code;
1462 $stripefailuremessage =
'Action required. Contact the support at ';
1463 $stripefailuredeclinecode = $stripe->declinecode;
1465 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1467 $charge->status =
'failed';
1468 $charge->customer = $customer->id;
1469 $charge->failure_code = $stripe->code;
1470 $charge->failure_message = $stripe->error;
1471 $charge->failure_declinecode = $stripe->declinecode;
1472 $stripefailurecode = $stripe->code;
1473 $stripefailuremessage = $stripe->error;
1474 $stripefailuredeclinecode = $stripe->declinecode;
1482 if (empty($charge) || $charge->status ==
'failed') {
1483 dol_syslog(
'Failed to charge payment mode ' . $stripecard->id .
' stripefailurecode=' . $stripefailurecode .
' stripefailuremessage=' . $stripefailuremessage .
' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1486 $this->stripechargeerror++;
1490 $errmsg = $langs->trans(
"FailedToChargeCard");
1491 if (!empty($charge)) {
1492 if ($stripefailuredeclinecode ==
'authentication_required') {
1493 $errauthenticationmessage = $langs->trans(
"ErrSCAAuthentication");
1494 $errmsg = $errauthenticationmessage;
1495 } elseif (in_array($stripefailuredeclinecode, [
'insufficient_funds',
'generic_decline'])) {
1496 $errmsg .=
': ' . $charge->failure_code;
1497 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' ' . $charge->failure_message;
1498 if (empty($stripefailurecode)) {
1499 $stripefailurecode = $charge->failure_code;
1501 if (empty($stripefailuremessage)) {
1502 $stripefailuremessage = $charge->failure_message;
1505 $errmsg .=
': failure_code=' . $charge->failure_code;
1506 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' failure_message=' . $charge->failure_message;
1507 if (empty($stripefailurecode)) {
1508 $stripefailurecode = $charge->failure_code;
1510 if (empty($stripefailuremessage)) {
1511 $stripefailuremessage = $charge->failure_message;
1515 $errmsg .=
': ' . $stripefailurecode .
' - ' . $stripefailuremessage;
1516 $errmsg .= ($stripefailuredeclinecode ?
' - ' . $stripefailuredeclinecode :
'');
1519 $description =
'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1520 $postactionmessages[] = $errmsg .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1521 $this->errors[] = $errmsg;
1523 dol_syslog(
'Successfuly request '.$type.
' '.$stripecard->id);
1525 $postactionmessages[] =
'Success to request '.$type.
' (' . $charge->id .
' with ' . $stripearrayofkeys[
'publishable_key'] .
')';
1529 $this->stripechargedone++;
1532 $description =
'Stripe payment request OK (' . $charge->id .
') from makeStripeSepaRequest: ' . $FULLTAG;
1538 if (empty($charge) || $charge->status ==
'failed') {
1539 $actioncode =
'PAYMENT_STRIPE_KO';
1540 $extraparams = $stripefailurecode;
1541 $extraparams .= (($extraparams && $stripefailuremessage) ?
' - ' :
'') . $stripefailuremessage;
1542 $extraparams .= (($extraparams && $stripefailuredeclinecode) ?
' - ' :
'') . $stripefailuredeclinecode;
1544 $actioncode =
'PAYMENT_STRIPE_OK';
1550 dol_syslog(
"No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1551 $this->errors[] =
'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1553 $description =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1554 $stripefailurecode =
'BADPAYMENTMODE';
1555 $stripefailuremessage =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1556 $postactionmessages[] = $description .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1560 $actioncode =
'PAYMENT_STRIPE_KO';
1566 $stripefailurecode =
'';
1567 $stripefailuremessage =
'';
1575 if ($resultthirdparty <= 0) {
1576 dol_syslog(
'SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1577 $this->errors[] =
'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1579 dol_syslog(
'SellYourSaasUtils Failed to get Stripe customer id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'], LOG_WARNING);
1580 $this->errors[] =
'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
1585 $description =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1586 $stripefailurecode =
'BADPAYMENTMODE';
1587 $stripefailuremessage =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1588 $postactionmessages = [];
1592 $actioncode =
'PAYMENT_STRIPE_KO';
1597 dol_syslog(
"* Record event for credit transfer or direct debit request result - " . $description);
1598 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1603 $actioncomm->type_code =
'AC_OTH_AUTO';
1604 $actioncomm->code =
'AC_' . $actioncode;
1605 $actioncomm->label = $description;
1606 $actioncomm->note_private = implode(
",\n", $postactionmessages);
1607 $actioncomm->fk_project = $this->fk_project;
1608 $actioncomm->datep = $now;
1609 $actioncomm->datef = $now;
1610 $actioncomm->percentage = -1;
1611 $actioncomm->socid = $thirdparty->id;
1612 $actioncomm->contactid = 0;
1613 $actioncomm->authorid = $user->id;
1614 $actioncomm->userownerid = $user->id;
1624 $actioncomm->fk_element = $this->id;
1625 $actioncomm->elementtype = $this->element;
1626 $actioncomm->extraparams =
dol_trunc($extraparams, 250);
1628 $actioncomm->create($user);
1632 $this->postactionmessages = $postactionmessages;
1636 dol_syslog(
'Error ' . $e->getMessage(), LOG_ERR);
1637 $this->errors[] =
'Error ' . $e->getMessage();
1642 dol_syslog(
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->
ref .
". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1643 $this->errors[] =
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->ref .
". Why is the invoice not classified 'Paid' ?";
1648 if (!$error && !$errorforinvoice) {
1649 $result = $bon->set_infotrans($user, $now, 3);
1653 dol_syslog(
"Error on BonPrelevement creation", LOG_ERR);
1654 $this->errors[] =
"Error on BonPrelevement creation";
1658 if (!$error && !$errorforinvoice && $paymentintent !==
null) {
1660 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_demande SET";
1661 $sql .=
" ext_payment_id = '".$this->db->escape($paymentintent->id).
"',";
1662 $sql .=
" ext_payment_site = '".$this->db->escape($service).
"'";
1663 $sql .=
" WHERE rowid = ".((int) $did);
1665 dol_syslog(get_class($this).
"::makeStripeSepaRequest update to save stripe paymentintent ids", LOG_DEBUG);
1666 $resql = $this->db->query($sql);
1668 $this->error = $this->db->lasterror();
1669 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur');
1674 if (!$error && !$errorforinvoice) {
1675 $this->db->commit();
1677 $this->db->rollback();
1680 $this->error =
'WithdrawRequestErrorNilAmount';
1681 dol_syslog(get_class($this).
'::makeStripeSepaRequest WithdrawRequestErrorNilAmount');
1699 $this->error = $this->db->error();
1700 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur -2');
1704 $this->error =
"Status of invoice does not allow this";
1705 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error.
" ".$this->status.
" ,".$this->paye.
", ".$this->mode_reglement_id, LOG_WARNING);
1846 global $conf, $mysoc;
1849 $tmplang->setDefaultLang(
'en_US');
1850 $tmplang->load(
"main");
1852 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
1853 $pricetaxstring =
price2num($this->total_tva, 2, 1);
1855 $complementaryinfo =
'';
1869 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
1870 if ($this->ref_client) {
1871 $complementaryinfo .=
'/20/'.$this->ref_client;
1873 if ($this->thirdparty->tva_intra) {
1874 $complementaryinfo .=
'/30/'.$this->thirdparty->tva_intra;
1877 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1878 $bankaccount =
new Account($this->db);
1886 if ($this->fk_account > 0) {
1888 $bankaccount->fetch($this->fk_account);
1889 $s .= $bankaccount->iban.
"\n";
1893 if ($bankaccount->id > 0 &&
getDolGlobalString(
'PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
1897 $s .=
dol_trunc($bankaccount->owner_name, 70,
'right',
'UTF-8', 1).
"\n";
1898 $addresslinearray = explode(
"\n", $bankaccount->owner_address);
1899 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1900 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1906 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
1907 $addresslinearray = explode(
"\n", $mysoc->address);
1908 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1909 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1910 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
1911 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
1912 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1923 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
1924 $s .= ($this->multicurrency_code ? $this->multicurrency_code : $conf->currency).
"\n";
1927 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
1928 $addresslinearray = explode(
"\n", $this->thirdparty->address);
1929 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1930 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1931 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
1932 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
1933 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1938 if ($complementaryinfo) {
1939 $s .= $complementaryinfo.
"\n";
1945 if ($complementaryinfo) {
1946 $s .= $complementaryinfo.
"\n";