796 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1)
799 global $langs, $hookmanager;
800 $langs->load(
'bills');
806 $statusType =
'status0';
810 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
811 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
812 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
814 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
815 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
817 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
818 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
820 $statusType =
'status5';
821 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
822 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
823 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
824 $statusType =
'status9';
825 } elseif ($alreadypaid == 0) {
826 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
827 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
828 $statusType =
'status1';
830 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
831 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
832 $statusType =
'status3';
835 $statusType =
'status6';
837 if ($type == self::TYPE_CREDIT_NOTE) {
838 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
839 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
840 } elseif ($type == self::TYPE_DEPOSIT) {
841 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
842 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
844 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
845 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
853 'alreadypaid' => $alreadypaid,
857 $reshook = $hookmanager->executeHooks(
'LibStatut', $parameters, $this);
860 return $hookmanager->resPrint;
865 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1116 public function makeStripeSepaRequest($fuser, $did, $type =
'direct-debit', $sourcetype =
'facture', $service =
'', $forcestripe =
'')
1118 global $conf, $user, $langs;
1120 if ($type !=
'bank-transfer' && $type !=
'credit-transfer' && !
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT')) {
1127 if (empty($service)) {
1128 $service =
'StripeTest';
1130 $service =
'StripeLive';
1136 dol_syslog(get_class($this).
"::makeStripeSepaRequest start did=".$did.
" type=".$type.
" service=".$service.
" sourcetype=".$sourcetype.
" forcestripe=".$forcestripe, LOG_DEBUG);
1138 if ($this->
status > self::STATUS_DRAFT && $this->paye == 0) {
1140 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
1142 $result = $bac->fetch(0,
'', $this->socid, 1,
'ban');
1143 if ($result <= 0 || empty($bac->id)) {
1144 $this->error = $langs->trans(
"ThirdpartyHasNoDefaultBanAccount");
1145 $this->errors[] = $this->error;
1146 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error);
1151 $sql =
"SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons";
1152 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
1153 $sql .=
" WHERE rowid = ".((int) $did);
1154 if ($type !=
'bank-transfer' && $type !=
'credit-transfer') {
1155 $sql .=
" AND fk_facture = ".((int) $this->
id);
1157 if ($type !=
'direct-debit') {
1158 if ($sourcetype ==
'salary') {
1159 $sql .=
" AND fk_salary = ".((int) $this->
id);
1161 $sql .=
" AND fk_facture_fourn = ".((int) $this->
id);
1164 $sql .=
" AND traite = 0";
1166 dol_syslog(get_class($this).
"::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1167 $resql = $this->db->query($sql);
1169 $obj = $this->db->fetch_object($resql);
1176 $amount = $obj->amount;
1178 if (is_numeric($amount) && $amount != 0) {
1179 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
1181 $companypaymentmode->fetch($bac->id);
1183 $this->stripechargedone = 0;
1184 $this->stripechargeerror = 0;
1188 $currency = $conf->currency;
1190 $errorforinvoice = 0;
1194 dol_syslog(
"makeStripeSepaRequest Process payment request amount=".$amount.
" thirdparty_id=" . $this->thirdparty->id .
", thirdparty_name=" . $this->thirdparty->name .
" ban id=" . $bac->id, LOG_DEBUG);
1199 $amounttopay = $amount;
1203 $arrayzerounitcurrency = [
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF'];
1204 $amountstripe = $amounttopay;
1205 if (!in_array($currency, $arrayzerounitcurrency)) {
1206 $amountstripe = $amountstripe * 100;
1209 $fk_bank_account =
getDolGlobalInt(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
1210 if (!($fk_bank_account > 0)) {
1213 dol_syslog(
"makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
1214 $this->errors[] =
"Error bank account for Stripe payments not defined into Stripe module";
1220 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
1223 if (empty($obj->fk_prelevement_bons)) {
1225 $nbinvoices = $bon->create(0, 0,
'real',
'ALL',
'', 0, $type, $did, $fk_bank_account);
1226 if ($nbinvoices <= 0) {
1229 dol_syslog(
"makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
1230 $this->errors[] =
"Error on BonPrelevement creation";
1249 dol_syslog(
"makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
1250 $this->errors[] =
"The line is already included into a bank payment order. Delete the bank payment order first.";
1255 if ($amountstripe > 0) {
1257 global $savstripearrayofkeysbyenv;
1258 global $stripearrayofkeysbyenv;
1260 if ($service ==
'StripeLive') {
1265 dol_syslog(
"makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id .
" stripe_card_ref=" . $companypaymentmode->stripe_card_ref .
" mode=" . $companypaymentmode->status, LOG_DEBUG);
1267 $thirdparty =
new Societe($this->db);
1268 $resultthirdparty = $thirdparty->fetch($this->socid);
1270 include_once DOL_DOCUMENT_ROOT .
'/stripe/class/stripe.class.php';
1272 $stripe =
new Stripe($this->db);
1274 if (empty($savstripearrayofkeysbyenv)) {
1275 $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1277 dol_syslog(
"makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1278 dol_syslog(
"makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1280 $foundalternativestripeaccount =
'';
1283 if (! empty($forcestripe)) {
1284 dol_syslog(
"makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1286 $tmparray = explode(
'@', $forcestripe);
1287 if (! empty($tmparray[1])) {
1288 $tmparray2 = explode(
':', $tmparray[1]);
1289 if (! empty($tmparray2[1])) {
1290 $stripearrayofkeysbyenv[$servicestatus][
"publishable_key"] = $tmparray2[0];
1291 $stripearrayofkeysbyenv[$servicestatus][
"secret_key"] = $tmparray2[1];
1293 $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1294 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1296 $foundalternativestripeaccount = $tmparray[0];
1298 dol_syslog(
"makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount.
" publishable_key=".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1302 if (! $foundalternativestripeaccount) {
1303 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1305 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1306 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1307 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);
1310 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1312 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1313 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1314 dol_syslog(
"makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1317 $stripeacc = $stripe->getStripeAccount($service, $this->socid);
1319 if ($foundalternativestripeaccount) {
1320 if (empty($stripeacc)) {
1321 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'));
1323 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'), array(
"stripe_account" => $stripeacc));
1326 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1327 if (empty($customer) && ! empty($stripe->error)) {
1328 $this->errors[] = $stripe->error;
1338 $postactionmessages = [];
1340 if ($resultthirdparty > 0 && !empty($customer)) {
1343 if ($companypaymentmode->type ==
'ban') {
1347 $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
1350 $this->error =
'The payment mode type is not "ban"';
1354 $FULLTAG =
'DID='.$did.
'-INV=' . $this->
id .
'-CUS=' . $thirdparty->id;
1355 $description =
'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG .
' did='.$did.
' ref=' . $this->ref;
1357 $stripefailurecode =
'';
1358 $stripefailuremessage =
'';
1359 $stripefailuredeclinecode =
'';
1362 dol_syslog(
"* Create payment on SEPA " . $stripecard->id .
", amounttopay=" . $amounttopay .
", amountstripe=" . $amountstripe .
", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1365 $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0,
'automatic',
true, $stripecard->id, 1, 1, $did);
1369 if ($paymentintent->status ===
'succeeded' || $paymentintent->status ===
'processing') {
1370 $charge->status =
'ok';
1371 $charge->id = $paymentintent->id;
1372 $charge->customer = $customer->id;
1373 } elseif ($paymentintent->status ===
'requires_action') {
1375 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1377 $charge->status =
'failed';
1378 $charge->customer = $customer->id;
1379 $charge->failure_code = $stripe->code;
1380 $charge->failure_message = $stripe->error;
1381 $charge->failure_declinecode = $stripe->declinecode;
1382 $stripefailurecode = $stripe->code;
1383 $stripefailuremessage =
'Action required. Contact the support at ';
1384 $stripefailuredeclinecode = $stripe->declinecode;
1386 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1388 $charge->status =
'failed';
1389 $charge->customer = $customer->id;
1390 $charge->failure_code = $stripe->code;
1391 $charge->failure_message = $stripe->error;
1392 $charge->failure_declinecode = $stripe->declinecode;
1393 $stripefailurecode = $stripe->code;
1394 $stripefailuremessage = $stripe->error;
1395 $stripefailuredeclinecode = $stripe->declinecode;
1403 if (empty($charge) || $charge->status ==
'failed') {
1404 dol_syslog(
'Failed to charge payment mode ' . $stripecard->id .
' stripefailurecode=' . $stripefailurecode .
' stripefailuremessage=' . $stripefailuremessage .
' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1407 $this->stripechargeerror++;
1411 $errmsg = $langs->trans(
"FailedToChargeCard");
1412 if (!empty($charge)) {
1413 if ($stripefailuredeclinecode ==
'authentication_required') {
1414 $errauthenticationmessage = $langs->trans(
"ErrSCAAuthentication");
1415 $errmsg = $errauthenticationmessage;
1416 } elseif (in_array($stripefailuredeclinecode, [
'insufficient_funds',
'generic_decline'])) {
1417 $errmsg .=
': ' . $charge->failure_code;
1418 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' ' . $charge->failure_message;
1419 if (empty($stripefailurecode)) {
1420 $stripefailurecode = $charge->failure_code;
1422 if (empty($stripefailuremessage)) {
1423 $stripefailuremessage = $charge->failure_message;
1426 $errmsg .=
': failure_code=' . $charge->failure_code;
1427 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' failure_message=' . $charge->failure_message;
1428 if (empty($stripefailurecode)) {
1429 $stripefailurecode = $charge->failure_code;
1431 if (empty($stripefailuremessage)) {
1432 $stripefailuremessage = $charge->failure_message;
1436 $errmsg .=
': ' . $stripefailurecode .
' - ' . $stripefailuremessage;
1437 $errmsg .= ($stripefailuredeclinecode ?
' - ' . $stripefailuredeclinecode :
'');
1440 $description =
'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1441 $postactionmessages[] = $errmsg .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1442 $this->errors[] = $errmsg;
1444 dol_syslog(
'Successfuly request '.$type.
' '.$stripecard->id);
1446 $postactionmessages[] =
'Success to request '.$type.
' (' . $charge->id .
' with ' . $stripearrayofkeys[
'publishable_key'] .
')';
1450 $this->stripechargedone++;
1453 $description =
'Stripe payment request OK (' . $charge->id .
') from makeStripeSepaRequest: ' . $FULLTAG;
1459 if (empty($charge) || $charge->status ==
'failed') {
1460 $actioncode =
'PAYMENT_STRIPE_KO';
1461 $extraparams = $stripefailurecode;
1462 $extraparams .= (($extraparams && $stripefailuremessage) ?
' - ' :
'') . $stripefailuremessage;
1463 $extraparams .= (($extraparams && $stripefailuredeclinecode) ?
' - ' :
'') . $stripefailuredeclinecode;
1465 $actioncode =
'PAYMENT_STRIPE_OK';
1471 dol_syslog(
"No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1472 $this->errors[] =
'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1474 $description =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1475 $stripefailurecode =
'BADPAYMENTMODE';
1476 $stripefailuremessage =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1477 $postactionmessages[] = $description .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1481 $actioncode =
'PAYMENT_STRIPE_KO';
1487 $stripefailurecode =
'';
1488 $stripefailuremessage =
'';
1496 if ($resultthirdparty <= 0) {
1497 dol_syslog(
'SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1498 $this->errors[] =
'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1500 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);
1501 $this->errors[] =
'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
1506 $description =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1507 $stripefailurecode =
'BADPAYMENTMODE';
1508 $stripefailuremessage =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1509 $postactionmessages = [];
1513 $actioncode =
'PAYMENT_STRIPE_KO';
1518 dol_syslog(
"* Record event for credit transfer or direct debit request result - " . $description);
1519 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1524 $actioncomm->type_code =
'AC_OTH_AUTO';
1525 $actioncomm->code =
'AC_' . $actioncode;
1526 $actioncomm->label = $description;
1527 $actioncomm->note_private = implode(
",\n", $postactionmessages);
1528 $actioncomm->fk_project = $this->fk_project;
1529 $actioncomm->datep = $now;
1530 $actioncomm->datef = $now;
1531 $actioncomm->percentage = -1;
1532 $actioncomm->socid = $thirdparty->id;
1533 $actioncomm->contactid = 0;
1534 $actioncomm->authorid = $user->id;
1535 $actioncomm->userownerid = $user->id;
1545 $actioncomm->fk_element = $this->id;
1546 $actioncomm->elementtype = $this->element;
1547 $actioncomm->extraparams =
dol_trunc($extraparams, 250);
1549 $actioncomm->create($user);
1553 $this->postactionmessages = $postactionmessages;
1557 dol_syslog(
'Error ' . $e->getMessage(), LOG_ERR);
1558 $this->errors[] =
'Error ' . $e->getMessage();
1563 dol_syslog(
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->
ref .
". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1564 $this->errors[] =
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->ref .
". Why is the invoice not classified 'Paid' ?";
1569 if (!$error && !$errorforinvoice) {
1570 $result = $bon->set_infotrans($user, $now, 3);
1574 dol_syslog(
"Error on BonPrelevement creation", LOG_ERR);
1575 $this->errors[] =
"Error on BonPrelevement creation";
1579 if (!$error && !$errorforinvoice) {
1581 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_demande SET";
1582 $sql .=
" ext_payment_id = '".$this->db->escape($paymentintent->id).
"',";
1583 $sql .=
" ext_payment_site = '".$this->db->escape($service).
"'";
1584 $sql .=
" WHERE rowid = ".((int) $did);
1586 dol_syslog(get_class($this).
"::makeStripeSepaRequest update to save stripe paymentintent ids", LOG_DEBUG);
1587 $resql = $this->db->query($sql);
1589 $this->error = $this->db->lasterror();
1590 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur');
1595 if (!$error && !$errorforinvoice) {
1596 $this->db->commit();
1598 $this->db->rollback();
1601 $this->error =
'WithdrawRequestErrorNilAmount';
1602 dol_syslog(get_class($this).
'::makeStripeSepaRequest WithdrawRequestErrorNilAmount');
1620 $this->error = $this->db->error();
1621 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur -2');
1625 $this->error =
"Status of invoice does not allow this";
1626 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error.
" ".$this->status.
" ,".$this->paye.
", ".$this->mode_reglement_id, LOG_WARNING);
1766 global $conf, $mysoc;
1769 $tmplang->setDefaultLang(
'en_US');
1770 $tmplang->load(
"main");
1772 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
1773 $pricetaxstring =
price2num($this->total_tva, 2, 1);
1775 $complementaryinfo =
'';
1789 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
1790 if ($this->ref_client) {
1791 $complementaryinfo .=
'/20/'.$this->ref_client;
1793 if ($this->thirdparty->tva_intra) {
1794 $complementaryinfo .=
'/30/'.$this->thirdparty->tva_intra;
1797 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1798 $bankaccount =
new Account($this->db);
1806 if ($this->fk_account > 0) {
1808 $bankaccount->fetch($this->fk_account);
1809 $s .= $bankaccount->iban.
"\n";
1813 if ($bankaccount->id > 0 &&
getDolGlobalString(
'PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
1817 $s .=
dol_trunc($bankaccount->proprio, 70,
'right',
'UTF-8', 1).
"\n";
1818 $addresslinearray = explode(
"\n", $bankaccount->owner_address);
1819 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1820 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1826 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
1827 $addresslinearray = explode(
"\n", $mysoc->address);
1828 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1829 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1830 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
1831 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
1832 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1843 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
1844 $s .= ($this->multicurrency_code ? $this->multicurrency_code : $conf->currency).
"\n";
1847 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
1848 $addresslinearray = explode(
"\n", $this->thirdparty->address);
1849 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1850 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1851 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
1852 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
1853 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1858 if ($complementaryinfo) {
1859 $s .= $complementaryinfo.
"\n";
1865 if ($complementaryinfo) {
1866 $s .= $complementaryinfo.
"\n";