From 7a17c43b262bfcf565fea6922b33d574020ebe4e Mon Sep 17 00:00:00 2001 From: atm-josselin Date: Mon, 24 Jun 2019 16:05:24 +0200 Subject: [PATCH 01/28] FIX : filepath of generated documents doesn't handle products with special characters --- htdocs/core/class/html.formfile.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 679989a75a0..522804b601c 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -764,7 +764,7 @@ class FormFile // Show file name with link to download $out.= ''; - $out.= ' Date: Mon, 1 Jul 2019 09:31:01 +0200 Subject: [PATCH 02/28] Sanitize at creation of the product instead of the creation of the filepath --- htdocs/core/class/html.formfile.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 522804b601c..679989a75a0 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -764,7 +764,7 @@ class FormFile // Show file name with link to download $out.= ''; - $out.= 'ref = dol_string_nospecial(trim($this->ref)); + $this->ref = dol_sanitizeFileName(dol_string_nospecial(trim($this->ref))); $this->label = trim($this->label); $this->price_ttc=price2num($this->price_ttc); $this->price=price2num($this->price); From 75ae611f9e49fead3aa825249b55734a5088cab4 Mon Sep 17 00:00:00 2001 From: "atm-florian.m" Date: Wed, 10 Jul 2019 17:53:14 +0200 Subject: [PATCH 03/28] FIX: calculation of $products_dispatched After the DB retrieval method was changed from fetch_row to fetch_object, the indices used became wrong. --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 4b15f04faa0..e6fa2937e0b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -482,7 +482,7 @@ if ($id > 0 || ! empty($ref)) { if ($num) { while ( $i < $num ) { $objd = $db->fetch_object($resql); - $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); + $products_dispatched[$objd->fk_product] = price2num($objd->qty, 5); $i++; } } @@ -540,7 +540,7 @@ if ($id > 0 || ! empty($ref)) { if (! $objp->fk_product > 0) { $nbfreeproduct++; } else { - $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched + $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->fk_product]), 5); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch = 0; From b155fdc014caaeea15848605ae75e82823819c1f Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Fri, 12 Jul 2019 15:04:47 +0200 Subject: [PATCH 04/28] FIX: wrong display (and hidden input) for already dispatched quantity --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e6fa2937e0b..966be778773 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -556,7 +556,7 @@ if ($id > 0 || ! empty($ref)) { print '' . "\n"; // hidden fields for js function print ''; - print ''; + print ''; print ''; $linktoprod = '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; @@ -598,7 +598,7 @@ if ($id > 0 || ! empty($ref)) { print '' . $objp->qty . ''; // Already dispatched - print '' . $products_dispatched[$objp->rowid] . ''; + print '' . (float) $products_dispatched[$objp->fk_product] . ''; if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; From 770b4197699d0a9a23ac25b99e2fc60281ba8c7b Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 18 Jul 2019 17:00:46 +0200 Subject: [PATCH 05/28] Revert "FIX: wrong display (and hidden input) for already dispatched quantity" This reverts commit b155fdc014caaeea15848605ae75e82823819c1f. --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 966be778773..e6fa2937e0b 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -556,7 +556,7 @@ if ($id > 0 || ! empty($ref)) { print '' . "\n"; // hidden fields for js function print ''; - print ''; + print ''; print ''; $linktoprod = '' . img_object($langs->trans("ShowProduct"), 'product') . ' ' . $objp->ref . ''; @@ -598,7 +598,7 @@ if ($id > 0 || ! empty($ref)) { print '' . $objp->qty . ''; // Already dispatched - print '' . (float) $products_dispatched[$objp->fk_product] . ''; + print '' . $products_dispatched[$objp->rowid] . ''; if (! empty($conf->productbatch->enabled) && $objp->tobatch == 1) { $type = 'batch'; From e404069d264afb2e5078aa92de029d8dd7c1da95 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 18 Jul 2019 17:00:57 +0200 Subject: [PATCH 06/28] Revert "FIX: calculation of $products_dispatched" This reverts commit 75ae611f9e49fead3aa825249b55734a5088cab4. --- htdocs/fourn/commande/dispatch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index e6fa2937e0b..4b15f04faa0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -482,7 +482,7 @@ if ($id > 0 || ! empty($ref)) { if ($num) { while ( $i < $num ) { $objd = $db->fetch_object($resql); - $products_dispatched[$objd->fk_product] = price2num($objd->qty, 5); + $products_dispatched[$objd->rowid] = price2num($objd->qty, 5); $i++; } } @@ -540,7 +540,7 @@ if ($id > 0 || ! empty($ref)) { if (! $objp->fk_product > 0) { $nbfreeproduct++; } else { - $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->fk_product]), 5); // Calculation of dispatched + $remaintodispatch = price2num($objp->qty - (( float ) $products_dispatched[$objp->rowid]), 5); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch = 0; From dbd68027f86329bc6ad061adb9d9b870f39f807f Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Thu, 18 Jul 2019 16:57:52 +0200 Subject: [PATCH 07/28] =?UTF-8?q?New=20script=20that=20links=20"orphaned"?= =?UTF-8?q?=20dispatch=20lines=20to=20order=20lines=20(the=20"orphans"=20a?= =?UTF-8?q?re=20dispatch=20lines=20that=20were=20created=20in=20old=20vers?= =?UTF-8?q?ions=20of=20Dolibarr=20which=20didn=E2=80=99t=20have=20fk=5Fcom?= =?UTF-8?q?mandefourndet=20in=20llx=5Fcommande=5Ffournisseur=5Fdispatch)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ..._commande_fournisseur_dispatch_3.6-9.0.php | 165 ++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php diff --git a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php new file mode 100644 index 00000000000..fec3c82cb56 --- /dev/null +++ b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php @@ -0,0 +1,165 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * This script is meant to be run when upgrading from a dolibarr version < 3.8 + * to a newer version. + * + * Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which + * matches the dispatch to a specific supplier order line (so that if there are + * several with the same product, the user can specifically tell which products of + * which line were dispatched where). + * + * However when migrating, the new column has a default value of 0, which means that + * old supplier orders whose lines were dispatched using the old dolibarr version + * have unspecific dispatch lines, which are not taken into account by the new version, + * thus making the order look like it was never dispatched at all. + * + * This scripts sets this foreign key to the first matching supplier order line whose + * product (and supplier order of course) are the same as the dispatch’s. + * + * If the dispatched quantity is more than indicated on the order line (this happens if + * there are several order lines for the same product), it creates new dispatch lines + * pointing to the other order lines accordingly, until all the dispatched quantity is + * accounted for. + */ + +// Dolibarr environment +$path_dir = '../../'; +$main_inc_file = 'main.inc.php'; +while ((false == @include($path_dir . $main_inc_file)) && 3*10 > strlen($path_dir)) { + $path_dir = '../' . $path_dir; + if (strlen($path_dir) > 20) { + echo 'Error: unable to include "' . $main_inc_file . '" from any of the parent directories.'; + exit; + } +} + +// Access control +if (!$user->admin) { + accessforbidden(); +} + +echo '

Repair llx_commande_fournisseur_dispatch.fk_commandefourndet

'; +echo '

Repair in progress. This may take a while.

'; + +echo '
';
+//$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch AS dispatch SET dispatch.fk_commandefourndet =
+//           ( SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line
+//            WHERE line.fk_commande = dispatch.fk_commande LIMIT 1) WHERE dispatch.fk_commandefourndet = 0;';
+
+$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
+//$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE fk_commandefourndet = 0 OR fk_commandefourndet IS NULL';
+$db->begin();
+$resql_dispatch = $db->query($sql_dispatch);
+$n_processed_rows = 0;
+$errors = array();
+if ($resql_dispatch) {
+    if ($db->num_rows($resql_dispatch) == 0) {
+        echo 'Nothing to do.'; exit;
+    };
+    while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
+        $sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line'
+            .  ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande
+            .  ' AND line.fk_product = ' . $obj_dispatch->fk_product;
+        $resql_line = $db->query($sql_line);
+
+        // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur,
+        // on divise la ligne de dispatch en autant de lignes qu’on en a sur la commande pour le produit
+        // et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty
+
+        $remaining_qty = $obj_dispatch->qty;
+        $first_iteration = true;
+        if (!$resql_line) {
+            echo 'Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . "\n";
+            $errors[] = $sql_line;
+            $n_processed_rows++;
+            continue;
+        }
+        if ($db->num_rows($resql_line) == 0) continue;
+        while ($obj_line = $db->fetch_object($resql_line)) {
+            if (!$remaining_qty) break;
+            if (!$obj_line->rowid) {
+                continue;
+            }
+            $qty_for_line = min($remaining_qty, $obj_line->qty);
+            if ($first_iteration) {
+                $sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
+                    . ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line
+                    . ' WHERE rowid = ' . $obj_dispatch->rowid;
+                $first_iteration = false;
+            } else {
+                $sql_attach_values = array(
+                    $obj_dispatch->fk_commande,
+                    $obj_dispatch->fk_product,
+                    $obj_line->rowid,
+                    $qty_for_line,
+                    $obj_dispatch->fk_entrepot,
+                    $obj_dispatch->fk_user,
+                    $obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL',
+                    $obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL',
+                    $obj_dispatch->status ?: 'NULL',
+                    $obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL',
+                    $obj_dispatch->batch ?: 'NULL',
+                    $obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL',
+                    $obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL'
+                );
+                $sql_attach_values = join(', ', $sql_attach_values);
+
+                $sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
+                    . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'
+                    . ' VALUES (' . $sql_attach_values . ')';
+            }
+            $resql_attach = $db->query($sql_attach);
+            if ($resql_attach) {
+                $remaining_qty -= $qty_for_line;
+            } else {
+                $errors[] = $sql_attach;
+            }
+            $first_iteration = false;
+        }
+        $n_processed_rows++;
+
+        // report progress every 256th row
+        if (!($n_processed_rows & 0xff)) {
+            echo 'Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "\n";
+            flush();
+            ob_flush();
+        }
+
+    }
+} else {
+    echo 'Unable to find any dispatch without an fk_commandefourndet.' . "\n";
+    echo $sql_dispatch . "\n";
+}
+echo 'Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "\n";
+echo 'DONE.' . "\n";
+echo '
'; + +if (count($errors)) { + $db->rollback(); + echo 'The transaction was rolled back due to errors: nothing was changed by the script.'; +} else { + $db->commit(); +} +$db->close(); + + +echo '

SQL queries with errors:

'; +echo '
  • ' . join('
  • ', $errors) . '
'; + From c9e70ed1c1d4f544e773cc9b703aace0b712c9a4 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Mon, 22 Jul 2019 09:30:43 +0200 Subject: [PATCH 08/28] Fix problems detected by travis-ci --- .../repair_llx_commande_fournisseur_dispatch_3.6-9.0.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php index fec3c82cb56..0c4b006664c 100644 --- a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php +++ b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php @@ -42,7 +42,7 @@ // Dolibarr environment $path_dir = '../../'; $main_inc_file = 'main.inc.php'; -while ((false == @include($path_dir . $main_inc_file)) && 3*10 > strlen($path_dir)) { +while ((false == (@include $path_dir . $main_inc_file)) && 3*10 > strlen($path_dir)) { $path_dir = '../' . $path_dir; if (strlen($path_dir) > 20) { echo 'Error: unable to include "' . $main_inc_file . '" from any of the parent directories.'; @@ -141,7 +141,6 @@ if ($resql_dispatch) { flush(); ob_flush(); } - } } else { echo 'Unable to find any dispatch without an fk_commandefourndet.' . "\n"; From 3ef257f4f2a82de116588ef568046de81922e004 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 31 Jul 2019 09:21:00 +0200 Subject: [PATCH 09/28] Removed commented out code from the new migration script --- .../repair_llx_commande_fournisseur_dispatch_3.6-9.0.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php index 0c4b006664c..95cf50aabbf 100644 --- a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php +++ b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php @@ -59,12 +59,8 @@ echo '

Repair llx_commande_fournisseur_dispatch.fk_commandefourndet

'; echo '

Repair in progress. This may take a while.

'; echo '
';
-//$sql = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch AS dispatch SET dispatch.fk_commandefourndet =
-//           ( SELECT rowid FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line
-//            WHERE line.fk_commande = dispatch.fk_commande LIMIT 1) WHERE dispatch.fk_commandefourndet = 0;';
 
 $sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
-//$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE fk_commandefourndet = 0 OR fk_commandefourndet IS NULL';
 $db->begin();
 $resql_dispatch = $db->query($sql_dispatch);
 $n_processed_rows = 0;

From fa29415e6a16d5bab7afc9a9c342d75cfc6f07c3 Mon Sep 17 00:00:00 2001
From: Florian Mortgat 
Date: Thu, 22 Aug 2019 14:06:18 +0200
Subject: [PATCH 10/28] Moved repair payload from a specific script to
 install/repair.php

---
 ..._commande_fournisseur_dispatch_3.6-9.0.php | 160 ------------------
 htdocs/install/repair.php                     | 125 ++++++++++++++
 2 files changed, 125 insertions(+), 160 deletions(-)
 delete mode 100644 htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php

diff --git a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php b/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php
deleted file mode 100644
index 95cf50aabbf..00000000000
--- a/htdocs/fourn/commande/script/repair_llx_commande_fournisseur_dispatch_3.6-9.0.php
+++ /dev/null
@@ -1,160 +0,0 @@
-
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
- */
-
-/**
- * This script is meant to be run when upgrading from a dolibarr version < 3.8
- * to a newer version.
- *
- * Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which
- * matches the dispatch to a specific supplier order line (so that if there are
- * several with the same product, the user can specifically tell which products of
- * which line were dispatched where).
- *
- * However when migrating, the new column has a default value of 0, which means that
- * old supplier orders whose lines were dispatched using the old dolibarr version
- * have unspecific dispatch lines, which are not taken into account by the new version,
- * thus making the order look like it was never dispatched at all.
- *
- * This scripts sets this foreign key to the first matching supplier order line whose
- * product (and supplier order of course) are the same as the dispatch’s.
- *
- * If the dispatched quantity is more than indicated on the order line (this happens if
- * there are several order lines for the same product), it creates new dispatch lines
- * pointing to the other order lines accordingly, until all the dispatched quantity is
- * accounted for.
- */
-
-// Dolibarr environment
-$path_dir = '../../';
-$main_inc_file = 'main.inc.php';
-while ((false == (@include $path_dir . $main_inc_file)) && 3*10 > strlen($path_dir)) {
-    $path_dir = '../' . $path_dir;
-    if (strlen($path_dir) > 20) {
-        echo 'Error: unable to include "' . $main_inc_file . '" from any of the parent directories.';
-        exit;
-    }
-}
-
-// Access control
-if (!$user->admin) {
-    accessforbidden();
-}
-
-echo '

Repair llx_commande_fournisseur_dispatch.fk_commandefourndet

'; -echo '

Repair in progress. This may take a while.

'; - -echo '
';
-
-$sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
-$db->begin();
-$resql_dispatch = $db->query($sql_dispatch);
-$n_processed_rows = 0;
-$errors = array();
-if ($resql_dispatch) {
-    if ($db->num_rows($resql_dispatch) == 0) {
-        echo 'Nothing to do.'; exit;
-    };
-    while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
-        $sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line'
-            .  ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande
-            .  ' AND line.fk_product = ' . $obj_dispatch->fk_product;
-        $resql_line = $db->query($sql_line);
-
-        // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur,
-        // on divise la ligne de dispatch en autant de lignes qu’on en a sur la commande pour le produit
-        // et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty
-
-        $remaining_qty = $obj_dispatch->qty;
-        $first_iteration = true;
-        if (!$resql_line) {
-            echo 'Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . "\n";
-            $errors[] = $sql_line;
-            $n_processed_rows++;
-            continue;
-        }
-        if ($db->num_rows($resql_line) == 0) continue;
-        while ($obj_line = $db->fetch_object($resql_line)) {
-            if (!$remaining_qty) break;
-            if (!$obj_line->rowid) {
-                continue;
-            }
-            $qty_for_line = min($remaining_qty, $obj_line->qty);
-            if ($first_iteration) {
-                $sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
-                    . ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line
-                    . ' WHERE rowid = ' . $obj_dispatch->rowid;
-                $first_iteration = false;
-            } else {
-                $sql_attach_values = array(
-                    $obj_dispatch->fk_commande,
-                    $obj_dispatch->fk_product,
-                    $obj_line->rowid,
-                    $qty_for_line,
-                    $obj_dispatch->fk_entrepot,
-                    $obj_dispatch->fk_user,
-                    $obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL',
-                    $obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL',
-                    $obj_dispatch->status ?: 'NULL',
-                    $obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL',
-                    $obj_dispatch->batch ?: 'NULL',
-                    $obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL',
-                    $obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL'
-                );
-                $sql_attach_values = join(', ', $sql_attach_values);
-
-                $sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'
-                    . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'
-                    . ' VALUES (' . $sql_attach_values . ')';
-            }
-            $resql_attach = $db->query($sql_attach);
-            if ($resql_attach) {
-                $remaining_qty -= $qty_for_line;
-            } else {
-                $errors[] = $sql_attach;
-            }
-            $first_iteration = false;
-        }
-        $n_processed_rows++;
-
-        // report progress every 256th row
-        if (!($n_processed_rows & 0xff)) {
-            echo 'Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "\n";
-            flush();
-            ob_flush();
-        }
-    }
-} else {
-    echo 'Unable to find any dispatch without an fk_commandefourndet.' . "\n";
-    echo $sql_dispatch . "\n";
-}
-echo 'Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "\n";
-echo 'DONE.' . "\n";
-echo '
'; - -if (count($errors)) { - $db->rollback(); - echo 'The transaction was rolled back due to errors: nothing was changed by the script.'; -} else { - $db->commit(); -} -$db->close(); - - -echo '

SQL queries with errors:

'; -echo '
  • ' . join('
  • ', $errors) . '
'; - diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 4d3e28a38d3..b7f3f9eb5b6 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -78,6 +78,7 @@ print 'Option rebuild_product_thumbs (0 or \'test\' or \'confirmed\') is '.(GETP print 'Option force_disable_of_modules_not_found (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found','alpha')?GETPOST('force_disable_of_modules_not_found','alpha'):'0').'
'."\n"; print 'Option clean_perm_table (0 or \'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table','alpha')?GETPOST('clean_perm_table','alpha'):'0').'
'."\n"; print 'Option force_utf8_on_tables, for mysql/mariadb only (0 or \'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables','alpha')?GETPOST('force_utf8_on_tables','alpha'):'0').'
'."\n"; +print 'Option repair_link_dispatch_lines_supplier_order_lines, (0 or \'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines','alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines','alpha'):'0').'
'."\n"; print '
'; print ''; @@ -1122,6 +1123,130 @@ if ($ok && GETPOST('force_utf8_on_tables','alpha')) } } +// +if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { + /* + * This script is meant to be run when upgrading from a dolibarr version < 3.8 + * to a newer version. + * + * Version 3.8 introduces a new column in llx_commande_fournisseur_dispatch, which + * matches the dispatch to a specific supplier order line (so that if there are + * several with the same product, the user can specifically tell which products of + * which line were dispatched where). + * + * However when migrating, the new column has a default value of 0, which means that + * old supplier orders whose lines were dispatched using the old dolibarr version + * have unspecific dispatch lines, which are not taken into account by the new version, + * thus making the order look like it was never dispatched at all. + * + * This scripts sets this foreign key to the first matching supplier order line whose + * product (and supplier order of course) are the same as the dispatch’s. + * + * If the dispatched quantity is more than indicated on the order line (this happens if + * there are several order lines for the same product), it creates new dispatch lines + * pointing to the other order lines accordingly, until all the dispatched quantity is + * accounted for. + */ + echo ''; + echo ''; + + $sql_dispatch = 'SELECT * FROM ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0'; + $db->begin(); + $resql_dispatch = $db->query($sql_dispatch); + $n_processed_rows = 0; + $errors = array(); + if ($resql_dispatch) { + if ($db->num_rows($resql_dispatch) == 0) { + echo ''; + exit; + } + while ($obj_dispatch = $db->fetch_object($resql_dispatch)) { + $sql_line = 'SELECT line.rowid, line.qty FROM ' . MAIN_DB_PREFIX . 'commande_fournisseurdet AS line' + . ' WHERE line.fk_commande = ' . $obj_dispatch->fk_commande + . ' AND line.fk_product = ' . $obj_dispatch->fk_product; + $resql_line = $db->query($sql_line); + + // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur, + // on divise la ligne de dispatch en autant de lignes qu’on en a sur la commande pour le produit + // et on met la quantité de la ligne dans la limite du "budget" indiqué par dispatch.qty + + $remaining_qty = $obj_dispatch->qty; + $first_iteration = true; + if (!$resql_line) { + echo ''; + $errors[] = $sql_line; + $n_processed_rows++; + continue; + } + if ($db->num_rows($resql_line) == 0) continue; + while ($obj_line = $db->fetch_object($resql_line)) { + if (!$remaining_qty) break; + if (!$obj_line->rowid) { + continue; + } + $qty_for_line = min($remaining_qty, $obj_line->qty); + if ($first_iteration) { + $sql_attach = 'UPDATE ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch' + . ' SET fk_commandefourndet = ' . $obj_line->rowid . ', qty = ' . $qty_for_line + . ' WHERE rowid = ' . $obj_dispatch->rowid; + $first_iteration = false; + } else { + $sql_attach_values = array( + $obj_dispatch->fk_commande, + $obj_dispatch->fk_product, + $obj_line->rowid, + $qty_for_line, + $obj_dispatch->fk_entrepot, + $obj_dispatch->fk_user, + $obj_dispatch->datec ? '"' . $db->escape($obj_dispatch->datec) . '"' : 'NULL', + $obj_dispatch->comment ? '"' . $db->escape($obj_dispatch->comment) . '"' : 'NULL', + $obj_dispatch->status ?: 'NULL', + $obj_dispatch->tms ? '"' . $db->escape($obj_dispatch->tms) . '"': 'NULL', + $obj_dispatch->batch ?: 'NULL', + $obj_dispatch->eatby ? '"' . $db->escape($obj_dispatch->eatby) . '"': 'NULL', + $obj_dispatch->sellby ? '"' . $db->escape($obj_dispatch->sellby) . '"': 'NULL' + ); + $sql_attach_values = join(', ', $sql_attach_values); + + $sql_attach = 'INSERT INTO ' . MAIN_DB_PREFIX . 'commande_fournisseur_dispatch' + . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)' + . ' VALUES (' . $sql_attach_values . ')'; + } + $resql_attach = $db->query($sql_attach); + if ($resql_attach) { + $remaining_qty -= $qty_for_line; + } else { + $errors[] = $sql_attach; + } + $first_iteration = false; + } + $n_processed_rows++; + + // report progress every 256th row + if (!($n_processed_rows & 0xff)) { + echo '\n"; + flush(); + ob_flush(); + } + } + } else { + echo '\n"; + echo $sql_dispatch . "\n"; + } + echo '\n"; + echo '\n"; + + if (count($errors)) { + $db->rollback(); + echo ''; + } else { + $db->commit(); + } + $db->close(); + + echo ''; + echo ''; +} print '
Repair llx_commande_fournisseur_dispatch.fk_commandefourndet
Repair in progress. This may take a while.
Nothing to do.
Unable to find a matching supplier order line for dispatch #' . $obj_dispatch->rowid . '
Processed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "
Unable to find any dispatch without an fk_commandefourndet.' . "
Fixed ' . $n_processed_rows . ' rows with ' . count($errors) . ' errors…' . "
DONE.' . "
The transaction was rolled back due to errors: nothing was changed by the script.

SQL queries with errors:

' . join('
', $errors) . '
'; From 14b9460de0126f00eae02c17dbc3b84f10a3705c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 29 Aug 2019 16:27:25 +0200 Subject: [PATCH 11/28] FIX Sens of the balance (Debit - Credit in accountancy not contrary) --- htdocs/accountancy/bookkeeping/balance.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index de7fa495770..6c4a8175195 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2016-2019 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -164,7 +164,7 @@ if ($action == 'export_csv') print $object->get_compte_desc($line->numero_compte) . $sep; print price($line->debit) . $sep; print price($line->credit) . $sep; - print price($line->credit - $line->debit) . $sep; + print price($line->debit - $line->credit) . $sep; print "\n"; } @@ -235,7 +235,7 @@ if ($action != 'export_csv') print $langs->trans('to'); print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -274,7 +274,7 @@ if ($action != 'export_csv') { // Affiche un Sous-Total par compte comptable if ($displayed_account != "") { - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; print " \n"; print ''; } @@ -293,10 +293,10 @@ if ($action != 'export_csv') print '' . length_accountg($line->numero_compte) . ''; print '' . $description . ''; - print '' . price($line->debit) . ''; - print '' . price($line->credit) . ''; - print '' . price($line->credit - $line->debit) . ''; - print '' . $link; + print '' . price($line->debit) . ''; + print '' . price($line->credit) . ''; + print '' . price($line->debit - $line->credit) . ''; + print '' . $link; print ''; print "\n"; @@ -305,11 +305,11 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_debit - $sous_total_credit)) . ''; print " \n"; print ''; - print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_credit - $total_debit)) . ''; + print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_debit - $total_credit)) . ''; print " \n"; print ''; From 4a76dfa6ffa36f9006f2aad96663ddbf99edec06 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 30 Aug 2019 18:23:43 +0200 Subject: [PATCH 12/28] Fix link to setup --- htdocs/comm/mailing/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 50f0b761c57..e2f32edc3d3 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -835,7 +835,7 @@ else { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. - $linktoadminemailbefore=''; + $linktoadminemailbefore=''; $linktoadminemailend=''; setEventMessages($langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]), null, 'warnings'); setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); From a7ecf9f18b4a1ce3f9e9aa9580549853937d90f0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 4 Sep 2019 09:32:37 +0200 Subject: [PATCH 13/28] FIX Missing ticket icon on md theme --- htdocs/theme/md/img/title_ticket.png | Bin 0 -> 234 bytes htdocs/theme/md/img/title_ticketsup.png | Bin 1044 -> 0 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 htdocs/theme/md/img/title_ticket.png delete mode 100644 htdocs/theme/md/img/title_ticketsup.png diff --git a/htdocs/theme/md/img/title_ticket.png b/htdocs/theme/md/img/title_ticket.png new file mode 100644 index 0000000000000000000000000000000000000000..b1cf5df0e7580226f61d129d2ebbd93506c0ee75 GIT binary patch literal 234 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE^%(yc-&<;;;jpisG|i(`nz>ARCRaxok7IL~kXzgpJm zM11VK^(HA9|5mHa<@0*ky3KvMaD~7LH>R5mMdzB|2db>yXXyFuWtvwery_%ZMTfA= zhjgLjJv)AvF52&z70kZ(`(4T8Co7wyvYBt$D^Iz;@5gSAYJ<(cFLJz|+5P3Pw|E2l Ywo4Xlix2!20y=@g)78&qol`;+0C<>DdjJ3c literal 0 HcmV?d00001 diff --git a/htdocs/theme/md/img/title_ticketsup.png b/htdocs/theme/md/img/title_ticketsup.png deleted file mode 100644 index 3ec332075e66b1160122713117fa0d8087f659c5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1044 zcmV+v1nc{WP)kdg00002VoOIv0RM-N z%)bBt010qNS#tmY4c7nw4c7reD4Tcy000McNliru;sXr{7YHUBg%1D#1EonsK~zY` z&6Vv>+f@|DKj+?GOI!Oe%0ttN3<`sdEyC0&NN_>-kSr`F#uvWx?=#VuMVTRPCT5Yr zP}vM5jFurAY!phN4;j$*_q)DmDJ{$w`bN*Yn{&ROdmeJ`h5y<#QQFC2{*|_yCP87* zN0FzL|AE*dj+&fVoe_65-(Z92B{Iloa0Y6 z;Jn9-FoK6BJh*@o2OM%B4|uS20K7>T2{M(89t#fnTLn{Kj%~800OBV^8}CT~lh5Sl?fd!d`exKwPxRI0 z{dnFvGpl~FlMDG{&!vD)nh$s1CloQh$ zeuhU36K#-38Rk*pp);pfRg)fk=i(`V88s1XW`9iri%fH+0dR$B7UB1&YDR2{$ml76 z6}B8}K`#RkB!)wKP2P?}j39tcSc}?N%_jgO5#<$2WmKi}1}_8D(&Qooc&q!8CoQ79 z!;uDnM3qb1YI~*tfQ^qK+_(U6;bsUQHo$B_?`XuWVvQxl#H)~8_2f{-%~eVOl(>qU zGEVifoD%VxXam5~T8kscOYPtgr3-*AqL?E&C`W89E~^2cQgWy)9jL}+Sp?kl0?>;a z!{X7ds-SYop-MHDu%QmM(&0~h)%%y2!b=>0I9{e$s^svoPqirI(5yEA{3%@&RGav# zz#S$@)-p&k$xgKce$}c(m;8+xd|xIf!iA~?AWec+T4rxDgI=|!9|E&exn;N zKa*#l9QK6eTxV3oJd~-VeFBiM`?As@t%S9!e`mQsj^|_%c35G99Hm<=e5A%yKrO2~ zchawU4-$J9EZw8Sa!&l`vmfLi+d#Tf{g+l(r`(Wh;#Yfe@4NZBN1%S?KJ{>oal*hB zQ*4ss0Pqkb!VMz8E_bq?S!@i3pUe;6?4693*MB@;G@Bl}O?TyEkyTb%`D&N{rTqo<%tv;ioLqST O0000 Date: Thu, 5 Sep 2019 11:11:48 +0200 Subject: [PATCH 14/28] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index d0459e1e288..2211bf80118 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -383,6 +383,7 @@ class Stripe extends CommonObject { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; + if (isset($object->thirdparty->id)) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; } $dataforintent = array( From 4fe141c9f1eb3e4999f87e9667bd4afe8c132d00 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 5 Sep 2019 12:05:50 +0200 Subject: [PATCH 15/28] FIX Nowrap missing on amount in boxes --- htdocs/core/boxes/box_activity.php | 6 +++--- htdocs/core/boxes/box_comptes.php | 2 +- htdocs/core/boxes/box_produits_alerte_stock.php | 4 ++-- htdocs/core/boxes/box_supplier_orders.php | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 995ba93fb64..c313b6c526a 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -173,7 +173,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -256,7 +256,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency), ); $this->info_box_contents[$line][4] = array( @@ -340,7 +340,7 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][3] = array( - 'td' => 'class="right"', + 'td' => 'class="nowrap right"', 'text' => price($data[$j]->Mnttot, 1, $langs, 0, 0, -1, $conf->currency) ); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 525562d308d..1928ac7cc94 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -134,7 +134,7 @@ class box_comptes extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index d1381870338..165b6db0d6b 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -179,12 +179,12 @@ class box_produits_alerte_stock extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowraponall"', 'text' => $price, ); $this->info_box_contents[$line][] = array( - 'td' => 'class="nowrap"', + 'td' => 'class="right"', 'text' => $price_base_type, ); diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 34316cd1ad1..6874425db78 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -135,7 +135,7 @@ class box_supplier_orders extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'class="right"', + 'td' => 'class="right nowrap"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); From 369961b3766891766626307efbd8a3c5eab97ac1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 6 Sep 2019 11:55:41 +0200 Subject: [PATCH 16/28] FIX avoid Warning: A non-numeric value encountered --- htdocs/contrat/card.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5c9ac3375dd..35338f41903 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -433,7 +433,7 @@ if (empty($reshook)) } $qty = GETPOST('qty'.$predef); - $remise_percent = GETPOST('remise_percent'.$predef); + $remise_percent = (GETPOST('remise_percent'.$predef) != '' ? GETPOST('remise_percent'.$predef) : 0); if ($qty == '') { @@ -566,7 +566,8 @@ if (empty($reshook)) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) + if (((! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) + || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1 ; From cad9a59d2a9c16ebe6231db7bbda7020e65faba4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Sep 2019 14:45:55 +0200 Subject: [PATCH 17/28] Add option to be able to find behaviour before the fix of list of invoice in direct debit order. --- htdocs/compta/prelevement/class/bonprelevement.class.php | 7 +++++-- htdocs/compta/prelevement/create.php | 5 ++++- htdocs/compta/prelevement/demandes.php | 5 ++++- htdocs/compta/prelevement/index.php | 5 ++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index d37e8be9412..10c12d967b3 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -739,8 +739,11 @@ class BonPrelevement extends CommonObject $sql = "SELECT count(f.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; $sql.= ", ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; - $sql.= " WHERE f.fk_statut = ".Facture::STATUS_VALIDATED; - $sql.= " AND f.entity IN (".getEntity('invoice').")"; + $sql.= " WHERE f.entity IN (".getEntity('invoice').")"; + if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) + { + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; + } $sql.= " AND f.rowid = pfd.fk_facture"; $sql.= " AND pfd.traite = 0"; $sql.= " AND f.total_ttc > 0"; diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3145bd20598..34da3336bcc 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -207,7 +207,10 @@ $sql.= " ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND f.total_ttc > 0"; $sql.= " AND pfd.traite = 0"; $sql.= " AND pfd.fk_facture = f.rowid"; diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index a34fde042e5..6c1ea278430 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -93,7 +93,10 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid; if (!$status) $sql.= " AND pfd.traite = 0"; if ($status) $sql.= " AND pfd.traite = ".$status; $sql.= " AND f.total_ttc > 0"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.fk_facture = f.rowid"; if (dol_strlen(trim(GETPOST('search_societe', 'alpha')))) { diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 44db7dd2625..468d4807c65 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -102,7 +102,10 @@ $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql.= " WHERE s.rowid = f.fk_soc"; $sql.= " AND f.entity IN (".getEntity('invoice').")"; $sql.= " AND f.total_ttc > 0"; -$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) +{ + $sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED; +} $sql.= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND f.fk_soc = ".$socid; From 348ab4765cf16fdceb7533c0fb22be6c87626c37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Sep 2019 15:20:04 +0200 Subject: [PATCH 18/28] Fix sql injection --- htdocs/categories/viewcat.php | 2 +- htdocs/product/class/product.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index a7170b799a2..a7a0767c6b5 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -40,7 +40,7 @@ $type = GETPOST('type', 'az09'); $action=GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $removeelem = GETPOST('removeelem', 'int'); -$elemid = GETPOST('elemid', 'alpha'); +$elemid = GETPOST('elemid', 'int'); if ($id == "" && $label == "") { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9c515d619c6..dd5544a9a06 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -284,14 +284,14 @@ class Product extends CommonObject * @var int */ public $barcode_type; - + /** * Main Barcode type code * * @var string */ public $barcode_type_code; - + /** * Additional barcodes (Some products have different barcodes according to the country of origin of manufacture) * @@ -2052,7 +2052,7 @@ class Product extends CommonObject $sql.= " fk_price_expression, price_autogen"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; if ($id) { - $sql.= " WHERE rowid = ".$this->db->escape($id); + $sql.= " WHERE rowid = ".(int) $id; } else { $sql.= " WHERE entity IN (".getEntity($this->element).")"; if ($ref) { From f12a01293233b43dceed54eb13ed3842dcf2b76d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Sep 2019 23:25:40 +0200 Subject: [PATCH 19/28] Update card.php --- htdocs/contrat/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 35338f41903..0bf304b96a1 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -433,7 +433,7 @@ if (empty($reshook)) } $qty = GETPOST('qty'.$predef); - $remise_percent = (GETPOST('remise_percent'.$predef) != '' ? GETPOST('remise_percent'.$predef) : 0); + $remise_percent = ((GETPOST('remise_percent'.$predef) != '') ? GETPOST('remise_percent'.$predef) : 0); if ($qty == '') { From a168c989f8a12462bee3c96a4f1e50ec737480cd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Sep 2019 23:29:27 +0200 Subject: [PATCH 20/28] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 2211bf80118..abc875c370f 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -383,7 +383,7 @@ class Stripe extends CommonObject { $metadata['dol_type'] = $object->element; $metadata['dol_id'] = $object->id; - if (isset($object->thirdparty->id)) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; + if (is_object($object->thirdparty) && $object->thirdparty->id > 0) $metadata['dol_thirdparty_id'] = $object->thirdparty->id; } $dataforintent = array( From bdbae9b3bcd000a991d2e7f0f760d05dbd9706f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 6 Sep 2019 23:51:33 +0200 Subject: [PATCH 21/28] Fix phpcs --- htdocs/install/repair.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 37a7dfaa842..472e77e1974 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -78,7 +78,7 @@ print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST(' print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST('force_disable_of_modules_not_found', 'alpha')?GETPOST('force_disable_of_modules_not_found', 'alpha'):'undefined').'
'."\n"; print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST('clean_perm_table', 'alpha')?GETPOST('clean_perm_table', 'alpha'):'undefined').'
'."\n"; print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST('force_utf8_on_tables', 'alpha')?GETPOST('force_utf8_on_tables', 'alpha'):'undefined').'
'."\n"; -print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines','alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines','alpha'):'undefined').'
'."\n"; +print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha')?GETPOST('repair_link_dispatch_lines_supplier_order_lines', 'alpha'):'undefined').'
'."\n"; print '
'; print ''; From 3a8d8ee902ccdb2eb40960c2fe12f021b46ca521 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 8 Sep 2019 03:56:01 +0200 Subject: [PATCH 22/28] FIX #11401 Adherent unknown language key --- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/type.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 0d3980318a4..9591a24fa78 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -424,7 +424,7 @@ class AdherentType extends CommonObject global $langs; if ($morphy == 'phy') { return $langs->trans("Physical"); } elseif ($morphy == 'mor') { return $langs->trans("Moral"); } - else return $langs->trans("Physical & Morale"); + else return $langs->trans("MorPhy"); //return $morphy; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 019388aeaab..f41275a4c71 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -283,7 +283,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; From ac539d20b97510caf15095f01fe4a9ce685c7b8b Mon Sep 17 00:00:00 2001 From: david Date: Sun, 8 Sep 2019 05:15:26 +0200 Subject: [PATCH 23/28] FIX #10460 compatibility with MariaDB 10.4 --- htdocs/core/class/html.form.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 28053f5d441..b87f2118ac8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1152,9 +1152,8 @@ class Form $sql .= ", dictp.code as country_code"; } - $sql.= " FROM (".MAIN_DB_PREFIX ."societe as s"; + $sql.= " FROM ".MAIN_DB_PREFIX ."societe as s"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " )"; if ($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST) { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."c_country as dictp ON dictp.rowid=s.fk_pays"; } From f6e04ba3142415c39968bc0dd3c0808ae9ab40d8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2019 13:05:41 +0200 Subject: [PATCH 24/28] Fix sql error --- htdocs/modulebuilder/template/myobject_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 60f64834583..497f46919fd 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -222,7 +222,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook $sql.=preg_replace('/^,/', '', $hookmanager->resPrint); -$sql =preg_replace('/, $/', '', $sql); +$sql =preg_replace('/,\s*$/', '', $sql); $sql.= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")"; From f2b9517dac9e8fc2a3b91e7f2713d8aa8d7fb540 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2019 13:16:31 +0200 Subject: [PATCH 25/28] FIX #11834 --- htdocs/projet/activity/perday.php | 2 +- htdocs/projet/activity/perweek.php | 2 +- htdocs/projet/list.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index 3c9fc7cd3dc..1f7209e1f65 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -443,7 +443,7 @@ $moreforfilter=''; // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.='
'.$langs->trans('User'). '
'; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200 marginleftonly'); $moreforfilter.='
'; diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index 075245ec7d8..4dfdad7879a 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -480,7 +480,7 @@ if (! empty($conf->categorie->enabled)) // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.='
'.$langs->trans('User'). '
'; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_usertoprocessid?$search_usertoprocessid:$usertoprocess->id, 'search_usertoprocessid', $user->rights->user->user->lire?0:0, null, 0, $includeonly, null, 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
'; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index aa03eada135..a0e068c79f6 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -505,7 +505,7 @@ if (! empty($conf->categorie->enabled)) // If the user can view user other than himself $moreforfilter.='
'; $moreforfilter.=$langs->trans('ProjectsWithThisUserAsContact'). ': '; -$includeonly='hierachyme'; +$includeonly='hierarchyme'; if (empty($user->rights->user->user->lire)) $includeonly=array($user->id); $moreforfilter.=$form->select_dolusers($search_project_user?$search_project_user:'', 'search_project_user', 1, '', 0, $includeonly, '', 0, 0, 0, '', 0, '', 'maxwidth200'); $moreforfilter.='
'; From 28ba5abb89750db238ba2469517b612e35a89217 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2019 13:31:14 +0200 Subject: [PATCH 26/28] Clean code --- htdocs/comm/mailing/class/mailing.class.php | 36 ++++++++++--------- .../mailings/advthirdparties.modules.php | 2 -- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index d82ec07612d..1538cbd7c81 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -335,15 +335,15 @@ class Mailing extends CommonObject $target_array=array(); - $sql = "SELECT fk_contact, "; - $sql.=" lastname, "; - $sql.=" firstname,"; - $sql.=" email,"; - $sql.=" other,"; - $sql.=" source_url,"; - $sql.=" source_id ,"; - $sql.=" source_type "; - $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles "; + $sql = "SELECT fk_contact,"; + $sql.= " lastname,"; + $sql.= " firstname,"; + $sql.= " email,"; + $sql.= " other,"; + $sql.= " source_url,"; + $sql.= " source_id ,"; + $sql.= " source_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$fromid; $result=$this->db->query($sql); @@ -353,14 +353,16 @@ class Mailing extends CommonObject { while ($obj = $this->db->fetch_object($result)) { - $target_array[]=array('fk_contact'=>$obj->fk_contact, - 'lastname'=>$obj->lastname, - 'firstname'=>$obj->firstname, - 'email'=>$obj->email, - 'other'=>$obj->other, - 'source_url'=>$obj->source_url, - 'source_id'=>$obj->source_id, - 'source_type'=>$obj->source_type); + $target_array[]=array( + 'fk_contact'=>$obj->fk_contact, + 'lastname'=>$obj->lastname, + 'firstname'=>$obj->firstname, + 'email'=>$obj->email, + 'other'=>$obj->other, + 'source_url'=>$obj->source_url, + 'source_id'=>$obj->source_id, + 'source_type'=>$obj->source_type + ); } } } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index a29fdd119bf..370f05e4232 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -88,7 +88,6 @@ class mailing_advthirdparties extends MailingTargets dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found", LOG_DEBUG); - $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); @@ -144,7 +143,6 @@ class mailing_advthirdparties extends MailingTargets dol_syslog(get_class($this)."::add_to_target mailing ".$num." targets found"); - $old = ''; while ($i < $num) { $obj = $this->db->fetch_object($result); From d061e61d25a06bbd74d497bd16275721382474c7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 9 Sep 2019 13:45:25 +0200 Subject: [PATCH 27/28] Fix add_to_target has only 1 param. --- .../mailings/mailinglist_mymodule_myobject.modules.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 07419af532d..854e7f37bd5 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -97,16 +97,14 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * This is the main function that returns the array of emails * * @param int $mailing_id Id of emailing - * @param array $cibles Array with targets * @return int <0 if error, number of emails added if ok */ - public function add_to_target($mailing_id, $cibles) + public function add_to_target($mailing_id) { // phpcs:enable $target = array(); $j = 0; - $sql = " select rowid as id, email, firstname, lastname, plan, partner"; $sql.= " from ".MAIN_DB_PREFIX."myobject"; $sql.= " where email IS NOT NULL AND email != ''"; @@ -161,7 +159,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets // ----- Your code end here ----- - return parent::add_to_target($mailing_id, $target); + return parent::addTargetsToDatabase($mailing_id, $target); } From 08f8ad6f300894e15bd1beb5c6035b801ee2e481 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 10 Sep 2019 00:09:18 +0200 Subject: [PATCH 28/28] FIX javascript error when using dol_use_jmobile=1 --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b87f2118ac8..dce42c79d33 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4237,7 +4237,7 @@ class Form $formconfirm.= '
'; - $formconfirm.= ''; + $formconfirm.= ''; $formconfirm.= ''."\n"; $formconfirm.= '
'; if ($objp->morphy == 'phy') { print $langs->trans("Physical"); } elseif ($objp->morphy == 'mor') { print $langs->trans("Moral"); } - else print $langs->trans("Physical & Morale"); + else print $langs->trans("MorPhy"); print ''.yn($objp->subscription).''.yn($objp->vote).''; $formconfirm.= $this->selectyesno("confirm", $newselectedchoice); $formconfirm.= 'trans("Validate").'">
'."\n";