From e22bd5c0481ddce1d35c630abb338d10fac48425 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Sep 2021 10:39:56 +0200 Subject: [PATCH 1/6] Fix better format address for jp in romaji --- htdocs/core/lib/functions.lib.php | 10 ++++++++-- test/phpunit/FunctionsLibTest.php | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4334aa9a12d..9b3156f485c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2191,13 +2191,19 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if (!empty($object->state)) { $ret .= "\n".$object->state; } + } elseif (isset($object->country_code) && in_array($object->country_code, array('JP'))) { + // JP: In romaji, title firstname name\n address lines \n [state,] town zip \n country + // See https://www.sljfaq.org/afaq/addresses.html + $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); + $ret .= ($ret ? $sep : '').($object->state ? $object->state.', ' : '').$town.($object->zip ? ' ' : '').$object->zip; } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { - // IT: tile firstname name\n address lines \n zip (Code Departement) \n country + // IT: title firstname name\n address lines \n zip town state_code \n country $ret .= ($ret ? $sep : '').$object->zip; $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); $ret .= (empty($object->state_code) ? '' : (' '.$object->state_code)); - } else { // Other: title firstname name \n address lines \n zip town \n country + } else { + // Other: title firstname name \n address lines \n zip town[, state] \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : (empty($object->town) ? '' : $object->town)); $ret .= !empty($object->zip) ? (($ret ? $sep : '').$object->zip) : ''; $ret .= ($town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$town) : ''); diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php index d7855c381d4..32b6cceb2e9 100644 --- a/test/phpunit/FunctionsLibTest.php +++ b/test/phpunit/FunctionsLibTest.php @@ -951,6 +951,10 @@ class FunctionsLibTest extends PHPUnit\Framework\TestCase $object->country_code='AU'; $address=dol_format_address($object); $this->assertEquals("21 jump street\nMyTown, MyState, 99999", $address); + + $object->country_code='JP'; + $address=dol_format_address($object); + $this->assertEquals("21 jump street\nMyState, MyTown 99999", $address); } From 7758c0b8a76ebc2c96bfeb08652bcb41bc5c60bd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 Sep 2021 16:06:19 +0200 Subject: [PATCH 2/6] Fix phpcs --- htdocs/api/class/api_access.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 075059fefda..5a4097b089b 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -147,10 +147,12 @@ class DolibarrApiAccess implements iAuthenticate if ($result <= 0) { throw new RestException(503, 'Error when fetching user :'.$fuser->error.' (conf->entity='.$conf->entity.')'); } + $fuser->getrights(); + + // Set the property $user to the $user of API static::$user = $fuser; - - // Set the global variable $user to the $user of API + // Set also the global variable $user to the $user of API $user = $fuser; if ($fuser->socid) { From 260049c91727f2171976cda0b75b97467f0a25c5 Mon Sep 17 00:00:00 2001 From: ksar <35605507+ksar-ksar@users.noreply.github.com> Date: Thu, 2 Sep 2021 17:15:57 +0200 Subject: [PATCH 3/6] FIX #18565 --- htdocs/admin/pdf.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index cee63fd91fd..6cf035f26a4 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -55,7 +55,8 @@ if ($action == 'update') { if (GETPOSTISSET('MAIN_PDF_FORMAT')) dolibarr_set_const($db, "MAIN_PDF_FORMAT", GETPOST("MAIN_PDF_FORMAT"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PDF_MARGIN_LEFT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_LEFT", GETPOST("MAIN_PDF_MARGIN_LEFT"), 'chaine', 0, '', $conf->entity); - if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MARGIN_RIGHT')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_RIGHT", GETPOST("MAIN_PDF_MARGIN_RIGHT"), 'chaine', 0, '', $conf->entity); + if (GETPOSTISSET('MAIN_PDF_MARGIN_TOP')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_TOP", GETPOST("MAIN_PDF_MARGIN_TOP"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PDF_MARGIN_BOTTOM')) dolibarr_set_const($db, "MAIN_PDF_MARGIN_BOTTOM", GETPOST("MAIN_PDF_MARGIN_BOTTOM"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET('MAIN_PROFID1_IN_ADDRESS')) dolibarr_set_const($db, "MAIN_PROFID1_IN_ADDRESS", GETPOST("MAIN_PROFID1_IN_ADDRESS"), 'chaine', 0, '', $conf->entity); From 6e5258f4824dc16c2a9c35a93c0b71e5cc9e80f3 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sun, 29 Aug 2021 07:51:29 +0800 Subject: [PATCH 4/6] Update stocks.lang --- htdocs/langs/en_US/stocks.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index efa5257498c..88e14abaaf6 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -12,7 +12,7 @@ AddWarehouse=Create warehouse AddOne=Add one DefaultWarehouse=Default warehouse WarehouseTarget=Target warehouse -ValidateSending=Delete sending +ValidateSending=Confirm sending CancelSending=Cancel sending DeleteSending=Delete sending Stock=Stock From 4c1d8579917beb322353fab2a3060562ba6088f1 Mon Sep 17 00:00:00 2001 From: henrynopo Date: Sun, 29 Aug 2021 08:51:02 +0800 Subject: [PATCH 5/6] Update remx.php --- htdocs/comm/remx.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 8f26d897389..f8a4c12fba7 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -709,8 +709,8 @@ if ($socid > 0) { //$sql.= " UNION "; // Discount linked to invoices $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; - $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,"; - $sql2 .= " rc.fk_facture_source,"; + $sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql2 .= " rc.datec as dc, rc.description, rc.fk_facture, rc.fk_facture_source,"; $sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " f.rowid as invoiceid, f.ref,"; $sql2 .= " fa.ref as invoice_source_ref, fa.type as type"; @@ -850,7 +850,7 @@ if ($socid > 0) { // Discount linked to invoice lines $sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; $sql .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; - $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; + $sql .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line,"; $sql .= " rc.fk_invoice_supplier_source,"; $sql .= " u.login, u.rowid as user_id,"; $sql .= " f.rowid as invoiceid, f.ref as ref,"; @@ -869,7 +869,8 @@ if ($socid > 0) { //$sql.= " UNION "; // Discount linked to invoices $sql2 = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx, rc.vat_src_code,"; - $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,"; + $sql2 .= " rc.multicurrency_amount_ht, rc.multicurrency_amount_tva, rc.multicurrency_amount_ttc,"; + $sql2 .= " rc.datec as dc, rc.description, rc.fk_invoice_supplier,"; $sql2 .= " rc.fk_invoice_supplier_source,"; $sql2 .= " u.login, u.rowid as user_id,"; $sql2 .= " f.rowid as invoiceid, f.ref as ref,"; From 35e5480f2fefb06640b4b85ed6cdeacdc48ee861 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 3 Sep 2021 10:58:43 +0200 Subject: [PATCH 6/6] Fix var init --- .../triggers/interface_20_modWorkflow_WorkflowManager.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index db3b3c56855..0ea378672c1 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -66,6 +66,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers return 0; // Module not active, we do nothing } + $ret = 0; + // Proposals to order if ($action == 'PROPAL_CLOSE_SIGNED') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);