926 public function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = -1, $nbofopendirectdebitorcredittransfer = 0)
929 global $langs, $hookmanager;
930 $langs->load(
'bills');
936 $statusType =
'status0';
940 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusDraft');
941 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusDraft');
942 } elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) {
944 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusCanceled');
945 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusCanceled');
947 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedUnpaid');
948 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedUnpaid');
950 $statusType =
'status5';
951 } elseif (($status == 3 || $status == 2) && $alreadypaid > 0) {
952 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusClosedPaidPartially');
953 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusClosedPaidPartially');
954 $statusType =
'status9';
955 } elseif ($alreadypaid == 0 && $nbofopendirectdebitorcredittransfer == 0) {
956 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusNotPaid');
957 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusNotPaid');
958 $statusType =
'status1';
960 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusStarted');
961 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusStarted');
962 $statusType =
'status3';
965 $statusType =
'status6';
966 if ($type == self::TYPE_CREDIT_NOTE) {
967 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaidBackOrConverted');
968 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaidBackOrConverted');
969 } elseif ($type == self::TYPE_DEPOSIT) {
970 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusConverted');
971 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusConverted');
973 $labelStatus = $langs->transnoentitiesnoconv(
'BillStatusPaid');
974 $labelStatusShort = $langs->transnoentitiesnoconv(
'Bill'.$prefix.
'StatusPaid');
982 'alreadypaid' => $alreadypaid,
986 $reshook = $hookmanager->executeHooks(
'LibStatut', $parameters, $this);
989 return $hookmanager->resPrint;
992 return dolGetStatus($labelStatus, $labelStatusShort,
'', $statusType, $mode);
1252 public function makeStripeSepaRequest($fuser, $did, $type =
'direct-debit', $sourcetype =
'facture', $service =
'', $forcestripe =
'')
1254 global
$conf, $user, $langs;
1256 if ($type !=
'bank-transfer' && $type !=
'credit-transfer' && !
getDolGlobalString(
'STRIPE_SEPA_DIRECT_DEBIT')) {
1263 if (empty($service)) {
1264 $service =
'StripeTest';
1266 $service =
'StripeLive';
1272 dol_syslog(get_class($this).
"::makeStripeSepaRequest start did=".$did.
" type=".$type.
" service=".$service.
" sourcetype=".$sourcetype.
" forcestripe=".$forcestripe, LOG_DEBUG);
1274 if ($this->
status > self::STATUS_DRAFT && $this->paye == 0) {
1276 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companybankaccount.class.php';
1278 $result = $bac->fetch(0,
'', $this->socid, 1,
'ban');
1279 if ($result <= 0 || empty($bac->id)) {
1280 $this->error = $langs->trans(
"ThirdpartyHasNoDefaultBanAccount");
1281 $this->errors[] = $this->error;
1282 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error);
1287 $sql =
"SELECT rowid, date_demande, amount, fk_facture, fk_facture_fourn, fk_salary, fk_prelevement_bons";
1288 $sql .=
" FROM ".$this->db->prefix().
"prelevement_demande";
1289 $sql .=
" WHERE rowid = ".((int) $did);
1290 if ($type !=
'bank-transfer' && $type !=
'credit-transfer') {
1291 $sql .=
" AND fk_facture = ".((int) $this->
id);
1293 if ($type !=
'direct-debit') {
1294 if ($sourcetype ==
'salary') {
1295 $sql .=
" AND fk_salary = ".((int) $this->
id);
1297 $sql .=
" AND fk_facture_fourn = ".((int) $this->
id);
1300 $sql .=
" AND traite = 0";
1302 dol_syslog(get_class($this).
"::makeStripeSepaRequest load requests to process", LOG_DEBUG);
1303 $resql = $this->db->query($sql);
1305 $obj = $this->db->fetch_object($resql);
1312 $amount = $obj->amount;
1314 if (is_numeric($amount) && $amount != 0) {
1315 require_once DOL_DOCUMENT_ROOT.
'/societe/class/companypaymentmode.class.php';
1317 $companypaymentmode->fetch($bac->id);
1319 $this->stripechargedone = 0;
1320 $this->stripechargeerror = 0;
1324 $currency =
$conf->currency;
1326 $errorforinvoice = 0;
1330 dol_syslog(
"makeStripeSepaRequest Process payment request amount=".$amount.
" thirdparty_id=" . $this->thirdparty->id .
", thirdparty_name=" . $this->thirdparty->name .
" ban id=" . $bac->id, LOG_DEBUG);
1335 $amounttopay = $amount;
1339 $arrayzerounitcurrency = [
'BIF',
'CLP',
'DJF',
'GNF',
'JPY',
'KMF',
'KRW',
'MGA',
'PYG',
'RWF',
'VND',
'VUV',
'XAF',
'XOF',
'XPF'];
1340 $amountstripe = $amounttopay;
1341 if (!in_array($currency, $arrayzerounitcurrency)) {
1342 $amountstripe *= 100;
1345 $fk_bank_account =
getDolGlobalInt(
'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS');
1346 if (!($fk_bank_account > 0)) {
1349 dol_syslog(
"makeStripeSepaRequest Error no bank account defined for Stripe payments", LOG_ERR);
1350 $this->error =
"Error bank account for Stripe payments not defined into Stripe module";
1351 $this->errors[] = $this->error;
1357 require_once DOL_DOCUMENT_ROOT.
'/compta/prelevement/class/bonprelevement.class.php';
1360 if (empty($obj->fk_prelevement_bons)) {
1362 $nbinvoices = $bon->create(0, 0,
'real',
'ALL', 0, 0, $type, $did, $fk_bank_account);
1363 if ($nbinvoices <= 0) {
1366 dol_syslog(
"makeStripeSepaRequest Error on BonPrelevement creation", LOG_ERR);
1367 $this->error =
"Error on BonPrelevement creation";
1368 $this->errors[] = $this->error;
1388 dol_syslog(
"makeStripeSepaRequest Error Line already part of a bank payment order", LOG_ERR);
1389 $this->error =
"The line is already included into a bank payment order. Delete the bank payment order first.";
1390 $this->errors[] = $this->error;
1394 $paymentintent =
null;
1396 if ($amountstripe > 0) {
1398 global $savstripearrayofkeysbyenv;
1399 global $stripearrayofkeysbyenv;
1401 if ($service ==
'StripeLive') {
1406 dol_syslog(
"makeStripeSepaRequest We will try to pay with companypaymentmodeid=" . $companypaymentmode->id .
" stripe_card_ref=" . $companypaymentmode->stripe_card_ref .
" mode=" . $companypaymentmode->status, LOG_DEBUG);
1408 $thirdparty =
new Societe($this->db);
1409 $resultthirdparty = $thirdparty->fetch($this->socid);
1411 include_once DOL_DOCUMENT_ROOT .
'/stripe/class/stripe.class.php';
1413 $stripe =
new Stripe($this->db);
1415 if (empty($savstripearrayofkeysbyenv)) {
1416 $savstripearrayofkeysbyenv = $stripearrayofkeysbyenv;
1418 dol_syslog(
"makeStripeSepaRequest Current Stripe environment is " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1419 dol_syslog(
"makeStripeSepaRequest Current Saved Stripe environment is ".$savstripearrayofkeysbyenv[$servicestatus][
'publishable_key']);
1421 $foundalternativestripeaccount =
'';
1424 if (! empty($forcestripe)) {
1425 dol_syslog(
"makeStripeSepaRequest A dedicated stripe account was forced, so we switch to it.");
1427 $tmparray = explode(
'@', $forcestripe);
1428 if (! empty($tmparray[1])) {
1429 $tmparray2 = explode(
':', $tmparray[1]);
1430 if (! empty($tmparray2[1])) {
1431 $stripearrayofkeysbyenv[$servicestatus][
"publishable_key"] = $tmparray2[0];
1432 $stripearrayofkeysbyenv[$servicestatus][
"secret_key"] = $tmparray2[1];
1434 $stripearrayofkeys = $stripearrayofkeysbyenv[$servicestatus];
1435 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1437 $foundalternativestripeaccount = $tmparray[0];
1439 dol_syslog(
"makeStripeSepaRequest We use now customer=".$foundalternativestripeaccount.
" publishable_key=".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1443 if (! $foundalternativestripeaccount) {
1444 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1446 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1447 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1448 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);
1451 $stripearrayofkeysbyenv = $savstripearrayofkeysbyenv;
1453 $stripearrayofkeys = $savstripearrayofkeysbyenv[$servicestatus];
1454 \Stripe\Stripe::setApiKey($stripearrayofkeys[
'secret_key']);
1455 dol_syslog(
"makeStripeSepaRequest No dedicated Stripe Account requested, so we use global one, so ".$stripearrayofkeys[
'publishable_key'], LOG_DEBUG);
1458 $stripeacc = $stripe->getStripeAccount($service, $this->socid);
1460 if ($foundalternativestripeaccount) {
1461 if (empty($stripeacc)) {
1462 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'));
1464 $customer = \Stripe\Customer::retrieve(array(
'id' =>
"$foundalternativestripeaccount",
'expand[]' =>
'sources'), array(
"stripe_account" => $stripeacc));
1467 $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 0);
1468 if (empty($customer) && ! empty($stripe->error)) {
1469 $this->error = $stripe->error;
1470 $this->errors[] = $this->error;
1481 $postactionmessages = [];
1483 if ($resultthirdparty > 0 && !empty($customer)) {
1486 if ($companypaymentmode->type ==
'ban') {
1490 $stripecard = $stripe->sepaStripe($customer, $companypaymentmode, $stripeacc, $servicestatus, 0);
1493 $this->error =
'The payment mode type is not "ban"';
1497 $FULLTAG =
'DID='.$did.
'-INV=' . $this->
id .
'-CUS=' . $thirdparty->id;
1498 $description =
'Stripe payment from makeStripeSepaRequest: ' . $FULLTAG .
' did='.$did.
' ref=' . $this->ref;
1500 $stripefailurecode =
'';
1501 $stripefailuremessage =
'';
1502 $stripefailuredeclinecode =
'';
1505 dol_syslog(
"* Create payment on SEPA " . $stripecard->id .
", amounttopay=" . $amounttopay .
", amountstripe=" . $amountstripe .
", FULLTAG=" . $FULLTAG, LOG_DEBUG);
1508 $paymentintent = $stripe->getPaymentIntent($amounttopay, $currency, $FULLTAG, $description, $this, $customer->id, $stripeacc, $servicestatus, 0,
'automatic',
true, $stripecard->id, 1, 1, $did);
1512 if ($paymentintent->status ===
'succeeded' || $paymentintent->status ===
'processing') {
1513 $charge->status =
'ok';
1514 $charge->id = $paymentintent->id;
1515 $charge->customer = $customer->id;
1516 } elseif ($paymentintent->status ===
'requires_action') {
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 =
'Action required. Contact the support at ';
1527 $stripefailuredeclinecode = $stripe->declinecode;
1529 dol_syslog(var_export($paymentintent,
true), LOG_DEBUG);
1531 $charge->status =
'failed';
1532 $charge->customer = $customer->id;
1533 $charge->failure_code = $stripe->code;
1534 $charge->failure_message = $stripe->error;
1535 $charge->failure_declinecode = $stripe->declinecode;
1536 $stripefailurecode = $stripe->code;
1537 $stripefailuremessage = $stripe->error;
1538 $stripefailuredeclinecode = $stripe->declinecode;
1546 if (empty($charge) || $charge->status ==
'failed') {
1547 dol_syslog(
'Failed to charge payment mode ' . $stripecard->id .
' stripefailurecode=' . $stripefailurecode .
' stripefailuremessage=' . $stripefailuremessage .
' stripefailuredeclinecode=' . $stripefailuredeclinecode, LOG_WARNING);
1550 $this->stripechargeerror++;
1554 $errmsg = $langs->trans(
"FailedToChargeSEPA");
1555 if (!empty($charge)) {
1556 if ($stripefailuredeclinecode ==
'authentication_required') {
1557 $errauthenticationmessage = $langs->trans(
"ErrSCAAuthentication");
1558 $errmsg = $errauthenticationmessage;
1559 } elseif (in_array($stripefailuredeclinecode, [
'insufficient_funds',
'generic_decline'])) {
1560 $errmsg .=
': ' . $charge->failure_code;
1561 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' ' . $charge->failure_message;
1562 if (empty($stripefailurecode)) {
1563 $stripefailurecode = $charge->failure_code;
1565 if (empty($stripefailuremessage)) {
1566 $stripefailuremessage = $charge->failure_message;
1569 $errmsg .=
': failure_code=' . $charge->failure_code;
1570 $errmsg .= ($charge->failure_message ?
' - ' :
'') .
' failure_message=' . $charge->failure_message;
1571 if (empty($stripefailurecode)) {
1572 $stripefailurecode = $charge->failure_code;
1574 if (empty($stripefailuremessage)) {
1575 $stripefailuremessage = $charge->failure_message;
1579 $errmsg .=
': ' . $stripefailurecode .
' - ' . $stripefailuremessage;
1580 $errmsg .= ($stripefailuredeclinecode ?
' - ' . $stripefailuredeclinecode :
'');
1583 $description =
'Stripe payment ERROR from makeStripeSepaRequest: ' . $FULLTAG;
1584 $postactionmessages[] = $errmsg .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1586 $this->error = $errmsg;
1587 $this->errors[] = $this->error;
1589 dol_syslog(
'Successfuly request '.$type.
' '.$stripecard->id);
1591 $postactionmessages[] =
'Success to request '.$type.
' (' . $charge->id .
' with ' . $stripearrayofkeys[
'publishable_key'] .
')';
1595 $this->stripechargedone++;
1598 $description =
'Stripe payment request OK (' . $charge->id .
') from makeStripeSepaRequest: ' . $FULLTAG;
1604 if (empty($charge) || $charge->status ==
'failed') {
1605 $actioncode =
'PAYMENT_STRIPE_KO';
1606 $extraparams = $stripefailurecode;
1607 $extraparams .= (($extraparams && $stripefailuremessage) ?
' - ' :
'') . $stripefailuremessage;
1608 $extraparams .= (($extraparams && $stripefailuredeclinecode) ?
' - ' :
'') . $stripefailuredeclinecode;
1610 $actioncode =
'PAYMENT_STRIPE_OK';
1616 dol_syslog(
"No ban payment method found for this stripe customer " . $customer->id, LOG_WARNING);
1618 $this->error =
'Failed to get direct debit payment method for stripe customer = ' . $customer->id;
1619 $this->errors[] = $this->error;
1621 $description =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1622 $stripefailurecode =
'BADPAYMENTMODE';
1623 $stripefailuremessage =
'Failed to find or use the payment mode - no ban defined for the thirdparty account';
1624 $postactionmessages[] = $description .
' (' . $stripearrayofkeys[
'publishable_key'] .
')';
1628 $actioncode =
'PAYMENT_STRIPE_KO';
1634 $stripefailurecode =
'';
1635 $stripefailuremessage =
'';
1643 if ($resultthirdparty <= 0) {
1644 dol_syslog(
'SellYourSaasUtils Failed to load customer for thirdparty_id = ' . $thirdparty->id, LOG_WARNING);
1645 $this->error =
'Failed to load Stripe account for thirdparty_id = ' . $thirdparty->id;
1646 $this->errors[] = $this->error;
1648 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);
1649 $this->error =
'Failed to get Stripe account id for thirdparty_id = ' . $thirdparty->id .
" in mode " . $servicestatus .
" in Stripe env " . $stripearrayofkeysbyenv[$servicestatus][
'publishable_key'];
1650 $this->errors[] = $this->error;
1655 $description =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1656 $stripefailurecode =
'BADPAYMENTMODE';
1657 $stripefailuremessage =
'Failed to find or use your payment mode (no payment mode for this customer id)';
1658 $postactionmessages = [];
1662 $actioncode =
'PAYMENT_STRIPE_KO';
1667 dol_syslog(
"* Record event for credit transfer or direct debit request result - " . $description);
1668 require_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
1673 $actioncomm->type_code =
'AC_OTH_AUTO';
1674 $actioncomm->code =
'AC_' . $actioncode;
1675 $actioncomm->label = $description;
1676 $actioncomm->note_private = implode(
",\n", $postactionmessages);
1677 $actioncomm->fk_project = $this->fk_project;
1678 $actioncomm->datep = $now;
1679 $actioncomm->datef = $now;
1680 $actioncomm->percentage = -1;
1681 $actioncomm->socid = $thirdparty->id;
1682 $actioncomm->contactid = 0;
1683 $actioncomm->authorid = $user->id;
1684 $actioncomm->userownerid = $user->id;
1694 $actioncomm->fk_element = $this->id;
1695 $actioncomm->elementtype = $this->element;
1696 $actioncomm->extraparams =
dol_trunc($extraparams, 250);
1698 $actioncomm->create($user);
1702 $this->postactionmessages = $postactionmessages;
1706 dol_syslog(
'Error ' . $e->getMessage(), LOG_ERR);
1707 $this->error =
'Error ' . $e->getMessage();
1708 $this->errors[] = $this->error;
1713 dol_syslog(
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->
ref .
". Why is the invoice not classified 'Paid' ?", LOG_WARNING);
1714 $this->error =
"Remain to pay is null for the invoice " . $this->
id .
" " . $this->ref .
". Why is the invoice not classified 'Paid' ?";
1715 $this->errors[] = $this->error;
1720 if (!$error && !$errorforinvoice) {
1721 $result = $bon->set_infotrans($user, $now, 3);
1725 dol_syslog(
"Error on BonPrelevement creation", LOG_ERR);
1726 $this->error =
"Error on BonPrelevement creation";
1727 $this->errors[] = $this->error;
1731 if (!$error && !$errorforinvoice && $paymentintent !==
null) {
1733 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"prelevement_demande SET";
1734 $sql .=
" ext_payment_id = '".$this->db->escape($paymentintent->id).
"',";
1735 $sql .=
" ext_payment_site = '".$this->db->escape($service).
"'";
1736 $sql .=
" WHERE rowid = ".((int) $did);
1738 dol_syslog(get_class($this).
"::makeStripeSepaRequest update to save stripe paymentintent ids", LOG_DEBUG);
1739 $resql = $this->db->query($sql);
1741 $this->error = $this->db->lasterror();
1742 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur');
1747 if (!$error && !$errorforinvoice) {
1748 $this->db->commit();
1750 $this->db->rollback();
1753 $this->error =
'WithdrawRequestErrorNilAmount';
1754 dol_syslog(get_class($this).
'::makeStripeSepaRequest WithdrawRequestErrorNilAmount');
1772 $this->error = $this->db->error();
1773 dol_syslog(get_class($this).
'::makeStripeSepaRequest Erreur -2');
1777 $this->error =
"Status of invoice does not allow this";
1778 dol_syslog(get_class($this).
"::makeStripeSepaRequest ".$this->error.
" ".$this->status.
" ,".$this->paye.
", ".$this->mode_reglement_id, LOG_WARNING);
1923 global
$conf, $mysoc;
1926 $tmplang->setDefaultLang(
'en_US');
1927 $tmplang->load(
"main");
1929 $pricewithtaxstring =
price2num($this->total_ttc, 2, 1);
1930 $pricetaxstring =
price2num($this->total_tva, 2, 1);
1932 $complementaryinfo =
'';
1946 $complementaryinfo =
'//S1/10/'.str_replace(
'/',
'', $this->
ref).
'/11/'.$datestring;
1947 if ($this->ref_client) {
1948 $complementaryinfo .=
'/20/'.$this->ref_client;
1950 if ($this->thirdparty->tva_intra) {
1951 $complementaryinfo .=
'/30/'.$this->thirdparty->tva_intra;
1954 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
1955 $bankaccount =
new Account($this->db);
1963 if ($this->fk_account > 0) {
1965 $bankaccount->fetch($this->fk_account);
1966 $s .= $bankaccount->iban.
"\n";
1970 if ($bankaccount->id > 0 &&
getDolGlobalString(
'PDF_SWISS_QRCODE_USE_OWNER_OF_ACCOUNT_AS_CREDITOR')) {
1974 $s .=
dol_trunc($bankaccount->owner_name, 70,
'right',
'UTF-8', 1).
"\n";
1975 $addresslinearray = explode(
"\n", $bankaccount->owner_address);
1976 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1977 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1983 $s .=
dol_trunc($mysoc->name, 70,
'right',
'UTF-8', 1).
"\n";
1984 $addresslinearray = explode(
"\n", $mysoc->address);
1985 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
1986 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
1987 $s .=
dol_trunc($mysoc->zip, 16,
'right',
'UTF-8', 1).
"\n";
1988 $s .=
dol_trunc($mysoc->town, 35,
'right',
'UTF-8', 1).
"\n";
1989 $s .=
dol_trunc($mysoc->country_code, 2,
'right',
'UTF-8', 1).
"\n";
2000 $s .=
price($pricewithtaxstring, 0,
'none', 0, 0, 2).
"\n";
2001 $s .= ($this->multicurrency_code ? $this->multicurrency_code :
$conf->currency).
"\n";
2004 $s .=
dol_trunc($this->thirdparty->name, 70,
'right',
'UTF-8', 1).
"\n";
2005 $addresslinearray = explode(
"\n", $this->thirdparty->address);
2006 $s .=
dol_trunc(empty($addresslinearray[1]) ?
'' : $addresslinearray[1], 70,
'right',
'UTF-8', 1).
"\n";
2007 $s .=
dol_trunc(empty($addresslinearray[2]) ?
'' : $addresslinearray[2], 70,
'right',
'UTF-8', 1).
"\n";
2008 $s .=
dol_trunc($this->thirdparty->zip, 16,
'right',
'UTF-8', 1).
"\n";
2009 $s .=
dol_trunc($this->thirdparty->town, 35,
'right',
'UTF-8', 1).
"\n";
2010 $s .=
dol_trunc($this->thirdparty->country_code, 2,
'right',
'UTF-8', 1).
"\n";
2015 if ($complementaryinfo) {
2016 $s .= $complementaryinfo.
"\n";
2022 if ($complementaryinfo) {
2023 $s .= $complementaryinfo.
"\n";