866 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
869 global $langs, $hookmanager;
870 $langs->load(
'bills');
876 $statusType =
'status0';
880 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
881 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
882 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
884 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
885 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
887 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
888 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
890 $statusType =
'status5';
891 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
892 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
893 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
894 $statusType =
'status9';
895 } elseif ($alreadypaid == 0) {
896 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
897 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
898 $statusType =
'status1';
900 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
901 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
902 $statusType =
'status3';
905 $statusType =
'status6';
907 if ($type == self::TYPE_CREDIT_NOTE) {
908 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
909 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
910 } elseif ($type == self::TYPE_DEPOSIT) {
911 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
912 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
914 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
915 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
923 'alreadypaid' => $alreadypaid,
927 $reshook = $hookmanager->executeHooks(
'LibStatut', $parameters, $this);
930 return $hookmanager->resPrint;
935 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1195 public function makeStripeSepaRequest($fuser, $did, $type =
'direct-debit', $sourcetype =
'facture', $service =
'', $forcestripe =
'')
1197 global
$conf, $user, $langs;
1199 if ($type !=
'bank-transfer' && $type !=
'credit-transfer' && !
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT')) {
1206 if (empty($service)) {
1207 $service =
'StripeTest';
1209 $service =
'StripeLive';
1215 dol_syslog(get_class($this).
"::makeStripeSepaRequest start did=".$did.
" type=".$type.
" service=".$service.
" sourcetype=".$sourcetype.
" forcestripe=".$forcestripe, LOG_DEBUG);
1217 if ($this->
status > self::STATUS_DRAFT && $this->paye == 0) {
1219 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
1221 $result = $bac->fetch(0,
'', $this->socid, 1,
'ban');
1222 if ($result <= 0 || empty($bac->id)) {
1223 $this->error = $langs->trans(
"ThirdpartyHasNoDefaultBanAccount");
1224 $this->errors[] = $this->error;
1225 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error);
1230 $sql =
"SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons";
1231 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
1232 $sql .=
" WHERE rowid = ".((int) $did);
1233 if ($type !=
'bank-transfer' && $type !=
'credit-transfer') {
1234 $sql .=
" AND fk_facture = ".((int) $this->
id);
1236 if ($type !=
'direct-debit') {
1237 if ($sourcetype ==
'salary') {
1238 $sql .=
" AND fk_salary = ".((int) $this->
id);
1240 $sql .=
" AND fk_facture_fourn = ".((int) $this->
id);
1243 $sql .=
" AND traite = 0";
1245 dol_syslog(get_class($this).
"::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1246 $resql = $this->db->query($sql);
1248 $obj = $this->db->fetch_object($resql);
1255 $amount = $obj->amount;
1257 if (is_numeric($amount) && $amount != 0) {
1258 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
1260 $companypaymentmode->fetch($bac->id);
1262 $this->stripechargedone = 0;
1263 $this->stripechargeerror = 0;
1267 $currency =
$conf->currency;
1269 $errorforinvoice = 0;
1273 dol_syslog(
"makeStripeSepaRequest Process payment request amount=".$amount.
" thirdparty_id=" . $this->thirdparty->id .
", thirdparty_name=" . $this->thirdparty->name .
" ban id=" . $bac->id, LOG_DEBUG);
1278 $amounttopay = $amount;
1282 $arrayzerounitcurrency = [
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF'];
1283 $amountstripe = $amounttopay;
1284 if (!in_array($currency, $arrayzerounitcurrency)) {
1285 $amountstripe *= 100;
1288 $fk_bank_account =
getDolGlobalInt(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
1289 if (!($fk_bank_account > 0)) {
1292 dol_syslog(
"makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
1293 $this->errors[] =
"Error bank account for Stripe payments not defined into Stripe module";
1299 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
1302 if (empty($obj->fk_prelevement_bons)) {
1304 $nbinvoices = $bon->create(0, 0,
'real',
'ALL', 0, 0, $type, $did, $fk_bank_account);
1305 if ($nbinvoices <= 0) {
1308 dol_syslog(
"makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
1309 $this->errors[] =
"Error on BonPrelevement creation";
1328 dol_syslog(
"makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
1329 $this->errors[] =
"The line is already included into a bank payment order. Delete the bank payment order first.";
1333 $paymentintent =
null;
1335 if ($amountstripe > 0) {
1337 global $savstripearrayofkeysbyenv;
1338 global $stripearrayofkeysbyenv;
1340 if ($service ==
'StripeLive') {
1345 dol_syslog(
"makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id .
" stripe_card_ref=" . $companypaymentmode->stripe_card_ref .
" mode=" . $companypaymentmode->status, LOG_DEBUG);
1347 $thirdparty =
new Societe($this->db);
1348 $resultthirdparty = $thirdparty->fetch($this->socid);
1350 include_once DOL_DOCUMENT_ROOT .
'/stripe/class/stripe.class.php';
1352 $stripe =
new Stripe($this->db);
1354 if (empty($savstripearrayofkeysbyenv)) {
1355 $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1357 dol_syslog(
"makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1358 dol_syslog(
"makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1360 $foundalternativestripeaccount =
'';
1363 if (! empty($forcestripe)) {
1364 dol_syslog(
"makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1366 $tmparray = explode(
'@', $forcestripe);
1367 if (! empty($tmparray[1])) {
1368 $tmparray2 = explode(
':', $tmparray[1]);
1369 if (! empty($tmparray2[1])) {
1370 $stripearrayofkeysbyenv[$servicestatus][
"publishable_key"] = $tmparray2[0];
1371 $stripearrayofkeysbyenv[$servicestatus][
"secret_key"] = $tmparray2[1];
1373 $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1374 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1376 $foundalternativestripeaccount = $tmparray[0];
1378 dol_syslog(
"makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount.
" publishable_key=".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1382 if (! $foundalternativestripeaccount) {
1383 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1385 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1386 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1387 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);
1390 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1392 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1393 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1394 dol_syslog(
"makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1397 $stripeacc = $stripe->getStripeAccount($service, $this->socid);
1399 if ($foundalternativestripeaccount) {
1400 if (empty($stripeacc)) {
1401 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'));
1403 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'), array(
"stripe_account" => $stripeacc));
1406 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1407 if (empty($customer) && ! empty($stripe->error)) {
1408 $this->errors[] = $stripe->error;
1418 $postactionmessages = [];
1420 if ($resultthirdparty > 0 && !empty($customer)) {
1423 if ($companypaymentmode->type ==
'ban') {
1427 $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
1430 $this->error =
'The payment mode type is not "ban"';
1434 $FULLTAG =
'DID='.$did.
'-INV=' . $this->
id .
'-CUS=' . $thirdparty->id;
1435 $description =
'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG .
' did='.$did.
' ref=' . $this->ref;
1437 $stripefailurecode =
'';
1438 $stripefailuremessage =
'';
1439 $stripefailuredeclinecode =
'';
1442 dol_syslog(
"* Create payment on SEPA " . $stripecard->id .
", amounttopay=" . $amounttopay .
", amountstripe=" . $amountstripe .
", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1445 $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0,
'automatic',
true, $stripecard->id, 1, 1, $did);
1449 if ($paymentintent->status ===
'succeeded' || $paymentintent->status ===
'processing') {
1450 $charge->status =
'ok';
1451 $charge->id = $paymentintent->id;
1452 $charge->customer = $customer->id;
1453 } elseif ($paymentintent->status ===
'requires_action') {
1455 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1457 $charge->status =
'failed';
1458 $charge->customer = $customer->id;
1459 $charge->failure_code = $stripe->code;
1460 $charge->failure_message = $stripe->error;
1461 $charge->failure_declinecode = $stripe->declinecode;
1462 $stripefailurecode = $stripe->code;
1463 $stripefailuremessage =
'Action required. Contact the support at ';
1464 $stripefailuredeclinecode = $stripe->declinecode;
1466 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1468 $charge->status =
'failed';
1469 $charge->customer = $customer->id;
1470 $charge->failure_code = $stripe->code;
1471 $charge->failure_message = $stripe->error;
1472 $charge->failure_declinecode = $stripe->declinecode;
1473 $stripefailurecode = $stripe->code;
1474 $stripefailuremessage = $stripe->error;
1475 $stripefailuredeclinecode = $stripe->declinecode;
1483 if (empty($charge) || $charge->status ==
'failed') {
1484 dol_syslog(
'Failed to charge payment mode ' . $stripecard->id .
' stripefailurecode=' . $stripefailurecode .
' stripefailuremessage=' . $stripefailuremessage .
' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1487 $this->stripechargeerror++;
1491 $errmsg = $langs->trans(
"FailedToChargeCard");
1492 if (!empty($charge)) {
1493 if ($stripefailuredeclinecode ==
'authentication_required') {
1494 $errauthenticationmessage = $langs->trans(
"ErrSCAAuthentication");
1495 $errmsg = $errauthenticationmessage;
1496 } elseif (in_array($stripefailuredeclinecode, [
'insufficient_funds',
'generic_decline'])) {
1497 $errmsg .=
': ' . $charge->failure_code;
1498 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' ' . $charge->failure_message;
1499 if (empty($stripefailurecode)) {
1500 $stripefailurecode = $charge->failure_code;
1502 if (empty($stripefailuremessage)) {
1503 $stripefailuremessage = $charge->failure_message;
1506 $errmsg .=
': failure_code=' . $charge->failure_code;
1507 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' failure_message=' . $charge->failure_message;
1508 if (empty($stripefailurecode)) {
1509 $stripefailurecode = $charge->failure_code;
1511 if (empty($stripefailuremessage)) {
1512 $stripefailuremessage = $charge->failure_message;
1516 $errmsg .=
': ' . $stripefailurecode .
' - ' . $stripefailuremessage;
1517 $errmsg .= ($stripefailuredeclinecode ?
' - ' . $stripefailuredeclinecode :
'');
1520 $description =
'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1521 $postactionmessages[] = $errmsg .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1522 $this->errors[] = $errmsg;
1524 dol_syslog(
'Successfuly request '.$type.
' '.$stripecard->id);
1526 $postactionmessages[] =
'Success to request '.$type.
' (' . $charge->id .
' with ' . $stripearrayofkeys[
'publishable_key'] .
')';
1530 $this->stripechargedone++;
1533 $description =
'Stripe payment request OK (' . $charge->id .
') from makeStripeSepaRequest: ' . $FULLTAG;
1539 if (empty($charge) || $charge->status ==
'failed') {
1540 $actioncode =
'PAYMENT_STRIPE_KO';
1541 $extraparams = $stripefailurecode;
1542 $extraparams .= (($extraparams && $stripefailuremessage) ?
' - ' :
'') . $stripefailuremessage;
1543 $extraparams .= (($extraparams && $stripefailuredeclinecode) ?
' - ' :
'') . $stripefailuredeclinecode;
1545 $actioncode =
'PAYMENT_STRIPE_OK';
1551 dol_syslog(
"No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1552 $this->errors[] =
'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1554 $description =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1555 $stripefailurecode =
'BADPAYMENTMODE';
1556 $stripefailuremessage =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1557 $postactionmessages[] = $description .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1561 $actioncode =
'PAYMENT_STRIPE_KO';
1567 $stripefailurecode =
'';
1568 $stripefailuremessage =
'';
1576 if ($resultthirdparty <= 0) {
1577 dol_syslog(
'SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1578 $this->errors[] =
'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1580 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);
1581 $this->errors[] =
'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
1586 $description =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1587 $stripefailurecode =
'BADPAYMENTMODE';
1588 $stripefailuremessage =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1589 $postactionmessages = [];
1593 $actioncode =
'PAYMENT_STRIPE_KO';
1598 dol_syslog(
"* Record event for credit transfer or direct debit request result - " . $description);
1599 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1604 $actioncomm->type_code =
'AC_OTH_AUTO';
1605 $actioncomm->code =
'AC_' . $actioncode;
1606 $actioncomm->label = $description;
1607 $actioncomm->note_private = implode(
",\n", $postactionmessages);
1608 $actioncomm->fk_project = $this->fk_project;
1609 $actioncomm->datep = $now;
1610 $actioncomm->datef = $now;
1611 $actioncomm->percentage = -1;
1612 $actioncomm->socid = $thirdparty->id;
1613 $actioncomm->contactid = 0;
1614 $actioncomm->authorid = $user->id;
1615 $actioncomm->userownerid = $user->id;
1625 $actioncomm->fk_element = $this->id;
1626 $actioncomm->elementtype = $this->element;
1627 $actioncomm->extraparams =
dol_trunc($extraparams, 250);
1629 $actioncomm->create($user);
1633 $this->postactionmessages = $postactionmessages;
1637 dol_syslog(
'Error ' . $e->getMessage(), LOG_ERR);
1638 $this->errors[] =
'Error ' . $e->getMessage();
1643 dol_syslog(
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->
ref .
". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1644 $this->errors[] =
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->ref .
". Why is the invoice not classified 'Paid' ?";
1649 if (!$error && !$errorforinvoice) {
1650 $result = $bon->set_infotrans($user, $now, 3);
1654 dol_syslog(
"Error on BonPrelevement creation", LOG_ERR);
1655 $this->errors[] =
"Error on BonPrelevement creation";
1659 if (!$error && !$errorforinvoice && $paymentintent !==
null) {
1661 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_demande SET";
1662 $sql .=
" ext_payment_id = '".$this->db->escape($paymentintent->id).
"',";
1663 $sql .=
" ext_payment_site = '".$this->db->escape($service).
"'";
1664 $sql .=
" WHERE rowid = ".((int) $did);
1666 dol_syslog(get_class($this).
"::makeStripeSepaRequest update to save stripe paymentintent ids", LOG_DEBUG);
1667 $resql = $this->db->query($sql);
1669 $this->error = $this->db->lasterror();
1670 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur');
1675 if (!$error && !$errorforinvoice) {
1676 $this->db->commit();
1678 $this->db->rollback();
1681 $this->error =
'WithdrawRequestErrorNilAmount';
1682 dol_syslog(get_class($this).
'::makeStripeSepaRequest WithdrawRequestErrorNilAmount');
1700 $this->error = $this->db->error();
1701 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur -2');
1705 $this->error =
"Status of invoice does not allow this";
1706 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error.
" ".$this->status.
" ,".$this->paye.
", ".$this->mode_reglement_id, LOG_WARNING);
1851 global
$conf, $mysoc;
1854 $tmplang->setDefaultLang(
'en_US');
1855 $tmplang->load(
"main");
1857 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
1858 $pricetaxstring =
price2num($this->total_tva, 2, 1);
1860 $complementaryinfo =
'';
1874 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
1875 if ($this->ref_client) {
1876 $complementaryinfo .=
'/20/'.$this->ref_client;
1878 if ($this->thirdparty->tva_intra) {
1879 $complementaryinfo .=
'/30/'.$this->thirdparty->tva_intra;
1882 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1883 $bankaccount =
new Account($this->db);
1891 if ($this->fk_account > 0) {
1893 $bankaccount->fetch($this->fk_account);
1894 $s .= $bankaccount->iban.
"\n";
1898 if ($bankaccount->id > 0 &&
getDolGlobalString(
'PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
1902 $s .=
dol_trunc($bankaccount->owner_name, 70,
'right',
'UTF-8', 1).
"\n";
1903 $addresslinearray = explode(
"\n", $bankaccount->owner_address);
1904 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1905 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1911 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
1912 $addresslinearray = explode(
"\n", $mysoc->address);
1913 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1914 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1915 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
1916 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
1917 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1928 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
1929 $s .= ($this->multicurrency_code ? $this->multicurrency_code :
$conf->currency).
"\n";
1932 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
1933 $addresslinearray = explode(
"\n", $this->thirdparty->address);
1934 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1935 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1936 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
1937 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
1938 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1943 if ($complementaryinfo) {
1944 $s .= $complementaryinfo.
"\n";
1950 if ($complementaryinfo) {
1951 $s .= $complementaryinfo.
"\n";