920 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $nbofopendirectdebitorcredittransfer = 0)
923 global $langs, $hookmanager;
924 $langs->load(
'bills');
930 $statusType =
'status0';
934 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
935 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
936 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
938 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
939 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
941 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
942 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
944 $statusType =
'status5';
945 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
946 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
947 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
948 $statusType =
'status9';
949 } elseif ($alreadypaid == 0 && $nbofopendirectdebitorcredittransfer == 0) {
950 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
951 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
952 $statusType =
'status1';
954 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
955 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
956 $statusType =
'status3';
959 $statusType =
'status6';
961 if ($type == self::TYPE_CREDIT_NOTE) {
962 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
963 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
964 } elseif ($type == self::TYPE_DEPOSIT) {
965 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
966 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
968 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
969 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
977 'alreadypaid' => $alreadypaid,
981 $reshook = $hookmanager->executeHooks(
'LibStatut', $parameters, $this);
984 return $hookmanager->resPrint;
987 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1247 public function makeStripeSepaRequest($fuser, $did, $type =
'direct-debit', $sourcetype =
'facture', $service =
'', $forcestripe =
'')
1249 global
$conf, $user, $langs;
1251 if ($type !=
'bank-transfer' && $type !=
'credit-transfer' && !
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT')) {
1258 if (empty($service)) {
1259 $service =
'StripeTest';
1261 $service =
'StripeLive';
1267 dol_syslog(get_class($this).
"::makeStripeSepaRequest start did=".$did.
" type=".$type.
" service=".$service.
" sourcetype=".$sourcetype.
" forcestripe=".$forcestripe, LOG_DEBUG);
1269 if ($this->
status > self::STATUS_DRAFT && $this->paye == 0) {
1271 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
1273 $result = $bac->fetch(0,
'', $this->socid, 1,
'ban');
1274 if ($result <= 0 || empty($bac->id)) {
1275 $this->error = $langs->trans(
"ThirdpartyHasNoDefaultBanAccount");
1276 $this->errors[] = $this->error;
1277 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error);
1282 $sql =
"SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons";
1283 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
1284 $sql .=
" WHERE rowid = ".((int) $did);
1285 if ($type !=
'bank-transfer' && $type !=
'credit-transfer') {
1286 $sql .=
" AND fk_facture = ".((int) $this->
id);
1288 if ($type !=
'direct-debit') {
1289 if ($sourcetype ==
'salary') {
1290 $sql .=
" AND fk_salary = ".((int) $this->
id);
1292 $sql .=
" AND fk_facture_fourn = ".((int) $this->
id);
1295 $sql .=
" AND traite = 0";
1297 dol_syslog(get_class($this).
"::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1298 $resql = $this->db->query($sql);
1300 $obj = $this->db->fetch_object($resql);
1307 $amount = $obj->amount;
1309 if (is_numeric($amount) && $amount != 0) {
1310 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
1312 $companypaymentmode->fetch($bac->id);
1314 $this->stripechargedone = 0;
1315 $this->stripechargeerror = 0;
1319 $currency =
$conf->currency;
1321 $errorforinvoice = 0;
1325 dol_syslog(
"makeStripeSepaRequest Process payment request amount=".$amount.
" thirdparty_id=" . $this->thirdparty->id .
", thirdparty_name=" . $this->thirdparty->name .
" ban id=" . $bac->id, LOG_DEBUG);
1330 $amounttopay = $amount;
1334 $arrayzerounitcurrency = [
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF'];
1335 $amountstripe = $amounttopay;
1336 if (!in_array($currency, $arrayzerounitcurrency)) {
1337 $amountstripe *= 100;
1340 $fk_bank_account =
getDolGlobalInt(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
1341 if (!($fk_bank_account > 0)) {
1344 dol_syslog(
"makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
1345 $this->errors[] =
"Error bank account for Stripe payments not defined into Stripe module";
1351 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
1354 if (empty($obj->fk_prelevement_bons)) {
1356 $nbinvoices = $bon->create(0, 0,
'real',
'ALL', 0, 0, $type, $did, $fk_bank_account);
1357 if ($nbinvoices <= 0) {
1360 dol_syslog(
"makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
1361 $this->errors[] =
"Error on BonPrelevement creation";
1380 dol_syslog(
"makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
1381 $this->errors[] =
"The line is already included into a bank payment order. Delete the bank payment order first.";
1385 $paymentintent =
null;
1387 if ($amountstripe > 0) {
1389 global $savstripearrayofkeysbyenv;
1390 global $stripearrayofkeysbyenv;
1392 if ($service ==
'StripeLive') {
1397 dol_syslog(
"makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id .
" stripe_card_ref=" . $companypaymentmode->stripe_card_ref .
" mode=" . $companypaymentmode->status, LOG_DEBUG);
1399 $thirdparty =
new Societe($this->db);
1400 $resultthirdparty = $thirdparty->fetch($this->socid);
1402 include_once DOL_DOCUMENT_ROOT .
'/stripe/class/stripe.class.php';
1404 $stripe =
new Stripe($this->db);
1406 if (empty($savstripearrayofkeysbyenv)) {
1407 $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1409 dol_syslog(
"makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1410 dol_syslog(
"makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1412 $foundalternativestripeaccount =
'';
1415 if (! empty($forcestripe)) {
1416 dol_syslog(
"makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1418 $tmparray = explode(
'@', $forcestripe);
1419 if (! empty($tmparray[1])) {
1420 $tmparray2 = explode(
':', $tmparray[1]);
1421 if (! empty($tmparray2[1])) {
1422 $stripearrayofkeysbyenv[$servicestatus][
"publishable_key"] = $tmparray2[0];
1423 $stripearrayofkeysbyenv[$servicestatus][
"secret_key"] = $tmparray2[1];
1425 $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1426 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1428 $foundalternativestripeaccount = $tmparray[0];
1430 dol_syslog(
"makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount.
" publishable_key=".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1434 if (! $foundalternativestripeaccount) {
1435 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1437 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1438 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1439 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);
1442 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1444 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1445 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1446 dol_syslog(
"makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1449 $stripeacc = $stripe->getStripeAccount($service, $this->socid);
1451 if ($foundalternativestripeaccount) {
1452 if (empty($stripeacc)) {
1453 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'));
1455 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'), array(
"stripe_account" => $stripeacc));
1458 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1459 if (empty($customer) && ! empty($stripe->error)) {
1460 $this->errors[] = $stripe->error;
1470 $postactionmessages = [];
1472 if ($resultthirdparty > 0 && !empty($customer)) {
1475 if ($companypaymentmode->type ==
'ban') {
1479 $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
1482 $this->error =
'The payment mode type is not "ban"';
1486 $FULLTAG =
'DID='.$did.
'-INV=' . $this->
id .
'-CUS=' . $thirdparty->id;
1487 $description =
'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG .
' did='.$did.
' ref=' . $this->ref;
1489 $stripefailurecode =
'';
1490 $stripefailuremessage =
'';
1491 $stripefailuredeclinecode =
'';
1494 dol_syslog(
"* Create payment on SEPA " . $stripecard->id .
", amounttopay=" . $amounttopay .
", amountstripe=" . $amountstripe .
", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1497 $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0,
'automatic',
true, $stripecard->id, 1, 1, $did);
1501 if ($paymentintent->status ===
'succeeded' || $paymentintent->status ===
'processing') {
1502 $charge->status =
'ok';
1503 $charge->id = $paymentintent->id;
1504 $charge->customer = $customer->id;
1505 } elseif ($paymentintent->status ===
'requires_action') {
1507 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1509 $charge->status =
'failed';
1510 $charge->customer = $customer->id;
1511 $charge->failure_code = $stripe->code;
1512 $charge->failure_message = $stripe->error;
1513 $charge->failure_declinecode = $stripe->declinecode;
1514 $stripefailurecode = $stripe->code;
1515 $stripefailuremessage =
'Action required. Contact the support at ';
1516 $stripefailuredeclinecode = $stripe->declinecode;
1518 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1520 $charge->status =
'failed';
1521 $charge->customer = $customer->id;
1522 $charge->failure_code = $stripe->code;
1523 $charge->failure_message = $stripe->error;
1524 $charge->failure_declinecode = $stripe->declinecode;
1525 $stripefailurecode = $stripe->code;
1526 $stripefailuremessage = $stripe->error;
1527 $stripefailuredeclinecode = $stripe->declinecode;
1535 if (empty($charge) || $charge->status ==
'failed') {
1536 dol_syslog(
'Failed to charge payment mode ' . $stripecard->id .
' stripefailurecode=' . $stripefailurecode .
' stripefailuremessage=' . $stripefailuremessage .
' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1539 $this->stripechargeerror++;
1543 $errmsg = $langs->trans(
"FailedToChargeCard");
1544 if (!empty($charge)) {
1545 if ($stripefailuredeclinecode ==
'authentication_required') {
1546 $errauthenticationmessage = $langs->trans(
"ErrSCAAuthentication");
1547 $errmsg = $errauthenticationmessage;
1548 } elseif (in_array($stripefailuredeclinecode, [
'insufficient_funds',
'generic_decline'])) {
1549 $errmsg .=
': ' . $charge->failure_code;
1550 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' ' . $charge->failure_message;
1551 if (empty($stripefailurecode)) {
1552 $stripefailurecode = $charge->failure_code;
1554 if (empty($stripefailuremessage)) {
1555 $stripefailuremessage = $charge->failure_message;
1558 $errmsg .=
': failure_code=' . $charge->failure_code;
1559 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' failure_message=' . $charge->failure_message;
1560 if (empty($stripefailurecode)) {
1561 $stripefailurecode = $charge->failure_code;
1563 if (empty($stripefailuremessage)) {
1564 $stripefailuremessage = $charge->failure_message;
1568 $errmsg .=
': ' . $stripefailurecode .
' - ' . $stripefailuremessage;
1569 $errmsg .= ($stripefailuredeclinecode ?
' - ' . $stripefailuredeclinecode :
'');
1572 $description =
'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1573 $postactionmessages[] = $errmsg .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1574 $this->errors[] = $errmsg;
1576 dol_syslog(
'Successfuly request '.$type.
' '.$stripecard->id);
1578 $postactionmessages[] =
'Success to request '.$type.
' (' . $charge->id .
' with ' . $stripearrayofkeys[
'publishable_key'] .
')';
1582 $this->stripechargedone++;
1585 $description =
'Stripe payment request OK (' . $charge->id .
') from makeStripeSepaRequest: ' . $FULLTAG;
1591 if (empty($charge) || $charge->status ==
'failed') {
1592 $actioncode =
'PAYMENT_STRIPE_KO';
1593 $extraparams = $stripefailurecode;
1594 $extraparams .= (($extraparams && $stripefailuremessage) ?
' - ' :
'') . $stripefailuremessage;
1595 $extraparams .= (($extraparams && $stripefailuredeclinecode) ?
' - ' :
'') . $stripefailuredeclinecode;
1597 $actioncode =
'PAYMENT_STRIPE_OK';
1603 dol_syslog(
"No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1604 $this->errors[] =
'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1606 $description =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1607 $stripefailurecode =
'BADPAYMENTMODE';
1608 $stripefailuremessage =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1609 $postactionmessages[] = $description .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1613 $actioncode =
'PAYMENT_STRIPE_KO';
1619 $stripefailurecode =
'';
1620 $stripefailuremessage =
'';
1628 if ($resultthirdparty <= 0) {
1629 dol_syslog(
'SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1630 $this->errors[] =
'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1632 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);
1633 $this->errors[] =
'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
1638 $description =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1639 $stripefailurecode =
'BADPAYMENTMODE';
1640 $stripefailuremessage =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1641 $postactionmessages = [];
1645 $actioncode =
'PAYMENT_STRIPE_KO';
1650 dol_syslog(
"* Record event for credit transfer or direct debit request result - " . $description);
1651 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1656 $actioncomm->type_code =
'AC_OTH_AUTO';
1657 $actioncomm->code =
'AC_' . $actioncode;
1658 $actioncomm->label = $description;
1659 $actioncomm->note_private = implode(
",\n", $postactionmessages);
1660 $actioncomm->fk_project = $this->fk_project;
1661 $actioncomm->datep = $now;
1662 $actioncomm->datef = $now;
1663 $actioncomm->percentage = -1;
1664 $actioncomm->socid = $thirdparty->id;
1665 $actioncomm->contactid = 0;
1666 $actioncomm->authorid = $user->id;
1667 $actioncomm->userownerid = $user->id;
1677 $actioncomm->fk_element = $this->id;
1678 $actioncomm->elementtype = $this->element;
1679 $actioncomm->extraparams =
dol_trunc($extraparams, 250);
1681 $actioncomm->create($user);
1685 $this->postactionmessages = $postactionmessages;
1689 dol_syslog(
'Error ' . $e->getMessage(), LOG_ERR);
1690 $this->errors[] =
'Error ' . $e->getMessage();
1695 dol_syslog(
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->
ref .
". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1696 $this->errors[] =
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->ref .
". Why is the invoice not classified 'Paid' ?";
1701 if (!$error && !$errorforinvoice) {
1702 $result = $bon->set_infotrans($user, $now, 3);
1706 dol_syslog(
"Error on BonPrelevement creation", LOG_ERR);
1707 $this->errors[] =
"Error on BonPrelevement creation";
1711 if (!$error && !$errorforinvoice && $paymentintent !==
null) {
1713 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_demande SET";
1714 $sql .=
" ext_payment_id = '".$this->db->escape($paymentintent->id).
"',";
1715 $sql .=
" ext_payment_site = '".$this->db->escape($service).
"'";
1716 $sql .=
" WHERE rowid = ".((int) $did);
1718 dol_syslog(get_class($this).
"::makeStripeSepaRequest update to save stripe paymentintent ids", LOG_DEBUG);
1719 $resql = $this->db->query($sql);
1721 $this->error = $this->db->lasterror();
1722 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur');
1727 if (!$error && !$errorforinvoice) {
1728 $this->db->commit();
1730 $this->db->rollback();
1733 $this->error =
'WithdrawRequestErrorNilAmount';
1734 dol_syslog(get_class($this).
'::makeStripeSepaRequest WithdrawRequestErrorNilAmount');
1752 $this->error = $this->db->error();
1753 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur -2');
1757 $this->error =
"Status of invoice does not allow this";
1758 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error.
" ".$this->status.
" ,".$this->paye.
", ".$this->mode_reglement_id, LOG_WARNING);
1903 global
$conf, $mysoc;
1906 $tmplang->setDefaultLang(
'en_US');
1907 $tmplang->load(
"main");
1909 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
1910 $pricetaxstring =
price2num($this->total_tva, 2, 1);
1912 $complementaryinfo =
'';
1926 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
1927 if ($this->ref_client) {
1928 $complementaryinfo .=
'/20/'.$this->ref_client;
1930 if ($this->thirdparty->tva_intra) {
1931 $complementaryinfo .=
'/30/'.$this->thirdparty->tva_intra;
1934 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1935 $bankaccount =
new Account($this->db);
1943 if ($this->fk_account > 0) {
1945 $bankaccount->fetch($this->fk_account);
1946 $s .= $bankaccount->iban.
"\n";
1950 if ($bankaccount->id > 0 &&
getDolGlobalString(
'PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
1954 $s .=
dol_trunc($bankaccount->owner_name, 70,
'right',
'UTF-8', 1).
"\n";
1955 $addresslinearray = explode(
"\n", $bankaccount->owner_address);
1956 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1957 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1963 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
1964 $addresslinearray = explode(
"\n", $mysoc->address);
1965 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1966 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1967 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
1968 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
1969 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1980 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
1981 $s .= ($this->multicurrency_code ? $this->multicurrency_code :
$conf->currency).
"\n";
1984 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
1985 $addresslinearray = explode(
"\n", $this->thirdparty->address);
1986 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1987 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1988 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
1989 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
1990 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
1995 if ($complementaryinfo) {
1996 $s .= $complementaryinfo.
"\n";
2002 if ($complementaryinfo) {
2003 $s .= $complementaryinfo.
"\n";