diff --git a/.github/workflows/stale-issues-safe.yml b/.github/workflows/stale-issues-safe.yml
index 55599654707..ed37c9aadc2 100644
--- a/.github/workflows/stale-issues-safe.yml
+++ b/.github/workflows/stale-issues-safe.yml
@@ -16,7 +16,7 @@ jobs:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-label: 'Issue Stale (automatic label)'
- exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE)'
+ exempt-labels: 'Priority High / Blocking,Priority Top Strategic,Priority Medium,Hacktoberfest,good first issue,Bug Security (CVE),Analysis of PR in progres'
days-before-stale: 365
days-before-close: 15
operations-per-run: 100
diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php
index cf4b5f9e9bc..c3ce7724752 100644
--- a/htdocs/admin/index.php
+++ b/htdocs/admin/index.php
@@ -91,14 +91,6 @@ print ' ';
// Show info setup module
print img_picto('', 'puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
-
-/*
-$nbofactivatedmodules=count($conf->modules);
-$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
-if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
-print ' '.$moreinfo;
-*/
-
if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING) ? 1 : $conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled
{
$langs->load("errors");
diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php
index 56602502715..fb15a57a87e 100644
--- a/htdocs/admin/user.php
+++ b/htdocs/admin/user.php
@@ -147,13 +147,13 @@ dol_fiche_head($head, 'card', $langs->trans("MenuUsersAndGroups"), -1, 'user');
print '
';
print '
';
-print '
'.$langs->trans("Description").'
';
+print '
'.$langs->trans("Parameter").'
';
print '
';
print '
'.$langs->trans("Value").'
'."\n";
print '
';
-// Mail required for members
+// Mail required for users
print '
';
-dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '', 0, '', '', 1);
+dol_banner_tab($object, 'label', $linkback, ($user->socid?0:1), 'label', 'label', $morehtmlref, '&type=' . $type, 0, '', '', 1);
/*
diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example
index a742c5c45fd..32c37301a0e 100644
--- a/htdocs/conf/conf.php.example
+++ b/htdocs/conf/conf.php.example
@@ -218,7 +218,7 @@ $dolibarr_main_authentication='dolibarr';
// 0 = No forced redirect
// 1 = Force redirect to https, until SCRIPT_URI start with https into response
// 2 = Force redirect to https, until SERVER["HTTPS"] is 'on' into response
-// 'https://my.domain.com' = Force reditect to https using this domain name.
+// 'https://my.domain.com' = Force redirect to https using this domain name.
// Warning: If you enable this parameter, your web server must be configured to
// respond URL with https protocol.
// According to your web server setup, some values may works and other not. Try
@@ -226,7 +226,7 @@ $dolibarr_main_authentication='dolibarr';
// Default value: 0
// Possible values: 0, 1, 2 or 'https://my.domain.com'
// Examples:
-// $dolibarr_main_force_https='0';
+// $dolibarr_main_force_https='1';
//
$dolibarr_main_force_https='0';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 2c22e83f786..f3615d4180f 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -316,6 +316,33 @@ class Form
return $ret;
}
+ /**
+ * Output edit in place form
+ *
+ * @param string $fieldname Name of the field
+ * @param object $object Object
+ * @param boolean $perm Permission to allow button to edit parameter. Set it to 0 to have a not edited field.
+ * @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
+ * @return string HTML code for the edit of alternative language
+ */
+ public function widgetForTranslation($fieldname, $object, $perm, $typeofdata = 'string')
+ {
+ global $conf, $langs;
+
+ $result = '';
+
+ if (! empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
+ $result ='
';
+ }
+
+ return $result;
+ }
+
/**
* Output edit in place form
*
@@ -3514,11 +3541,11 @@ class Form
* Return list of payment methods
* Constant MAIN_DEFAULT_PAYMENT_TYPE_ID can used to set default value but scope is all application, probably not what you want.
*
- * @param string $selected Id du mode de paiement pre-selectionne
- * @param string $htmlname Nom de la zone select
+ * @param string $selected Id or code or preselected payment mode
+ * @param string $htmlname Name of select field
* @param string $filtertype To filter on field type in llx_c_paiement ('CRDT' or 'DBIT' or array('code'=>xx,'label'=>zz))
- * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code
- * @param int $empty 1=peut etre vide, 0 sinon
+ * @param int $format 0=id+label, 1=code+code, 2=code+label, 3=id+code
+ * @param int $empty 1=can be empty, 0 otherwise
* @param int $noadmininfo 0=Add admin info, 1=Disable admin info
* @param int $maxlength Max length of label
* @param int $active Active or not, -1 = all
@@ -3559,9 +3586,12 @@ class Form
elseif ($format == 1) print '
';
print '
';
}
-
-
-
-/**
- * Return HTML content to add structured data for an article, news or Blog Post.
- *
- * @return string HTML content
- */
-function getRSSForBlogPosts()
-{
- global $conf, $db, $hookmanager, $langs, $mysoc, $user, $website, $websitepage, $weblangs; // Very important. Required to have var available when running inluded containers.
-
-
-
- return $out;
-}
-
-
diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php
index 4aba32007bf..ef81ecda5bf 100644
--- a/htdocs/core/lib/xcal.lib.php
+++ b/htdocs/core/lib/xcal.lib.php
@@ -336,7 +336,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
* @param string $url Url
* @return int < 0 if ko, Nb of events in file if ok
*/
-function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = "", $url="")
+function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '')
{
global $user, $conf, $langs;
global $dolibarr_main_url_root;
@@ -534,7 +534,7 @@ function calEncode($line)
// Take char at position $j
$char = substr($line, $j, 1);
- if ((dol_strlen($newpara) + dol_strlen($char)) >= 75 )
+ if ((dol_strlen($newpara) + dol_strlen($char)) >= 75)
{
// CRLF + Space for cal
$out .= $newpara . "\r\n ";
diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php
index c8706d1b22e..302cf3b47b7 100644
--- a/htdocs/fourn/commande/card.php
+++ b/htdocs/fourn/commande/card.php
@@ -55,7 +55,7 @@ if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
-$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch'));
+$langs->loadLangs(array('admin', 'orders', 'sendings', 'companies', 'bills', 'propal', 'receptions', 'supplier_proposal', 'deliveries', 'products', 'stocks', 'productbatch'));
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
$id = GETPOST('id', 'int');
@@ -2483,11 +2483,14 @@ elseif (!empty($object->id))
if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)))
{
+ $labelofbutton = $langs->trans('ReceiveProducts');
+ if ($conf->reception->enabled) $labelofbutton = $langs->trans("CreateReception");
+
if (in_array($object->statut, array(3, 4, 5))) {
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->receptionner) {
- print '
';
if (! empty($conf->global->SUPPLIER_ORDER_CAN_UPDATE_BUYINGPRICE_DURING_RECEIPT)) {
@@ -894,7 +892,8 @@ if ($id > 0 || !empty($ref)) {
print ' '.$checkboxlabel;
}
- empty($conf->reception->enabled) ? $dispatchBt = $langs->trans("DispatchVerb") : $dispatchBt = $langs->trans("Receive");
+
+ $dispatchBt = empty($conf->reception->enabled) ? $langs->trans("Receive") : $langs->trans("CreateReception");
print '
// Copyright (C) 2017 Francis Appels
//
@@ -15,14 +16,33 @@
// along with this program. If not, see .
// or see https://www.gnu.org/
-//
-// \file htdocs/core/js/lib_dispatch.js
-// \brief File that include javascript functions used dispatch.php
-//
+/**
+ * \file htdocs/fourn/js/lib_dispatch.js.php
+ * \brief File that include javascript functions used for dispatching qty/stock/lot
+ */
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+
+session_cache_limiter('public');
+
+require_once '../../main.inc.php';
+
+// Define javascript type
+top_httphead('text/javascript; charset=UTF-8');
+// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
+else header('Cache-Control: no-cache');
+
+?>
/**
* addDispatchLine
- * Adds new table row for dispatching to multiple stock locations
+ * Adds new table row for dispatching to multiple stock locations or multiple lot/serial
*
* @param index int index of product line. 0 = first product line
* @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
@@ -32,12 +52,12 @@ function addDispatchLine(index, type, mode)
{
mode = mode || 'qtymissing'
- console.log("fourn/js/lib_dispatch.js Split line type="+type+" index="+index+" mode="+mode);
- var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true), // clone first batch line to jQuery object
- nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length, // position of line for batch
- qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()), // Qty ordered is same for all rows
- qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val()),
- qtyDispatched;
+ console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode);
+ var $row = $("tr[name='"+type+'_0_'+index+"']").clone(true); // clone first batch line to jQuery object
+ var nbrTrs = $("tr[name^='"+type+"_'][name$='_"+index+"']").length; // position of line for batch
+ var qtyOrdered = parseFloat($("#qty_ordered_0_"+index).val()); // Qty ordered is same for all rows
+ var qty = parseFloat($("#qty_"+(nbrTrs - 1)+"_"+index).val());
+ var qtyDispatched;
if (mode === 'lessone')
{
@@ -46,8 +66,17 @@ function addDispatchLine(index, type, mode)
else
{
qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + qty;
+ // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line
+ if (qtyDispatched == qtyOrdered && qtyDispatched > 1) {
+ qtyDispatched = parseFloat($("#qty_dispatched_0_"+index).val()) + 1;
+ mode = 'lessone';
+ }
}
+ console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered);
+ if (qtyOrdered <= 1) {
+ window.alert("Quantity can't be split");
+ }
if (qtyDispatched < qtyOrdered)
{
//replace tr suffix nbr
@@ -97,7 +126,7 @@ function addDispatchLine(index, type, mode)
*
* Change event handler for dispatch qty input field,
* recalculate qty dispatched when qty input has changed.
- * If qty is more then qty ordered reset input qty to max qty to dispatch.
+ * If qty is more than qty ordered reset input qty to max qty to dispatch.
*
* element requires arbitrary data qty (value before change), type (type of dispatch) and index (index of product line)
*/
diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
index b2d0b9b0bd1..dfbbc4d2e19 100644
--- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
+++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql
@@ -193,8 +193,9 @@ ALTER TABLE llx_accounting_account DROP COLUMN pcg_subtype;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_intra varchar(32) AFTER accountancy_code_buy;
ALTER TABLE llx_product ADD COLUMN accountancy_code_buy_export varchar(32) AFTER accountancy_code_buy_intra;
-ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL AFTER fk_pays;
-ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL AFTER fk_pays;
+ALTER TABLE llx_entrepot ADD COLUMN fax varchar(20) DEFAULT NULL;
+ALTER TABLE llx_entrepot ADD COLUMN phone varchar(20) DEFAULT NULL;
ALTER TABLE llx_accounting_account ADD COLUMN reconcilable tinyint DEFAULT 0 NOT NULL after active;
+ALTER TABLE llx_categorie MODIFY type integer NOT NULL DEFAULT 1;
diff --git a/htdocs/install/mysql/tables/llx_categorie.sql b/htdocs/install/mysql/tables/llx_categorie.sql
index ed1cb828363..c57c2adaa10 100644
--- a/htdocs/install/mysql/tables/llx_categorie.sql
+++ b/htdocs/install/mysql/tables/llx_categorie.sql
@@ -26,7 +26,7 @@ create table llx_categorie
fk_parent integer DEFAULT 0 NOT NULL,
label varchar(180) NOT NULL, -- category ref/name
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)
- type tinyint DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member)
+ type integer DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member)
description text, -- description of the category
color varchar(8), -- color
fk_soc integer DEFAULT NULL, -- not used by default. Used when option CATEGORY_ASSIGNED_TO_A_CUSTOMER is set.
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 62119428b9a..7e46cdefbad 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1108,8 +1108,8 @@ Delays_MAIN_DELAY_EXPENSEREPORTS=Expense report to approve
Delays_MAIN_DELAY_HOLIDAYS=Leave requests to approve
SetupDescription1=Before starting to use Dolibarr some initial parameters must be defined and modules enabled/configured.
SetupDescription2=The following two sections are mandatory (the two first entries in the Setup menu):
-SetupDescription3=%s -> %s Basic parameters used to customize the default behavior of your application (e.g for country-related features).
-SetupDescription4=%s -> %s This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module.
+SetupDescription3=%s -> %s
Basic parameters used to customize the default behavior of your application (e.g for country-related features).
+SetupDescription4=%s -> %s
This software is a suite of many modules/applications, all more or less independent. The modules relevant to your needs must be enabled and configured. New items/options are added to menus with the activation of a module.
SetupDescription5=Other Setup menu entries manage optional parameters.
LogEvents=Security audit events
Audit=Audit
@@ -1264,6 +1264,8 @@ RuleForGeneratedPasswords=Rules to generate and validate passwords
DisableForgetPasswordLinkOnLogonPage=Do not show the "Password Forgotten" link on the Login page
UsersSetup=Users module setup
UserMailRequired=Email required to create a new user
+UsersDocModules=Document templates for documents generated from user record
+GroupsDocModules=Document templates for documents generated from a group record
##### HRM setup #####
HRMSetup=HRM module setup
##### Company setup #####
@@ -1980,5 +1982,5 @@ MakeAnonymousPing=Make an anonymous Ping '+1' to the Dolibarr foundation server
FeatureNotAvailableWithReceptionModule=Feature not available when module Reception is enabled
EmailTemplate=Template for email
EMailsWillHaveMessageID=Emails will have a tag 'References' matching this syntax
-PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some text title in your PDF duplicated in 2 different languages in the same generate PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
+PDF_USE_ALSO_LANGUAGE_CODE=If you want to have some texts in your PDF duplicated in 2 different languages in the same generated PDF, you must set here this second language so generated PDF will contains 2 different languages in same page, the one chosen when generating PDF and this one (only few PDF templates support this). Keep empty for 1 language per PDF.
FafaIconSocialNetworksDesc=Enter here the code of a FontAwesome icon. If you don't know what is FontAwesome, you can use the generic value fa-address-book.
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 1cea53ae2a7..8d3812d5553 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -210,7 +210,7 @@ $sessionname = 'DOLSESSID_'.$prefix;
$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
if (!empty($_COOKIE[$sessiontimeout])) ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
session_name($sessionname);
-session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
+session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
// This create lock, released when session_write_close() or end of page.
// We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
if (!defined('NOSESSION'))
@@ -257,7 +257,7 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
}
-// Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
+// Force HTTPS if required ($conf->file->main_force_https is 0/1 or 'https dolibarr root url')
// $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on'))
{
@@ -284,6 +284,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV
// Start redirect
if ($newurl)
{
+ header_remove(); // Clean header already set to be sure to remove any header like "Set-Cookie: DOLSESSID_..." from non HTTPS answers
dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
header("Location: ".$newurl);
exit;
@@ -625,7 +626,7 @@ if (!defined('NOLOGIN'))
dol_syslog('User not found, connexion refused');
session_destroy();
session_name($sessionname);
- session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
+ session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie
session_start();
if ($resultFetchUser == 0)
@@ -682,7 +683,7 @@ if (!defined('NOLOGIN'))
dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
session_destroy();
session_name($sessionname);
- session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
+ session_set_cookie_params(0, '/', null, (empty($dolibarr_main_force_https) ? false : true), true); // Add tag secure and httponly on session cookie
session_start();
if ($resultFetchUser == 0)
diff --git a/htdocs/mrp/js/lib_dispatch.js.php b/htdocs/mrp/js/lib_dispatch.js.php
new file mode 100644
index 00000000000..dc7c079a024
--- /dev/null
+++ b/htdocs/mrp/js/lib_dispatch.js.php
@@ -0,0 +1,136 @@
+
+// Copyright (C) 2017 Francis Appels
+//
+// 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 .
+// or see https://www.gnu.org/
+
+/**
+ * \file htdocs/mrp/js/lib_dispatch.js.php
+ * \brief File that include javascript functions used for dispatching qty/stock/lot
+ */
+
+if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
+if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK', 1);
+if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1);
+if (! defined('NOLOGIN')) define('NOLOGIN', 1);
+if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1);
+if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1);
+if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
+
+session_cache_limiter('public');
+
+require_once '../../main.inc.php';
+
+// Define javascript type
+top_httphead('text/javascript; charset=UTF-8');
+// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+if (empty($dolibarr_nocache)) header('Cache-Control: max-age=10800, public, must-revalidate');
+else header('Cache-Control: no-cache');
+
+?>
+/**
+ * addDispatchLine
+ * Adds new table row for dispatching to multiple stock locations or multiple lot/serial
+ *
+ * @param index int index of product line. 0 = first product line
+ * @param type string type of dispatch (batch = batch dispatch, dispatch = non batch dispatch)
+ * @param mode string 'qtymissing' will create new line with qty missing, 'lessone' will keep 1 in old line and the rest in new one
+ */
+function addDispatchLine(index, type, mode)
+{
+ mode = mode || 'qtymissing'
+
+ console.log("fourn/js/lib_dispatch.js.php Split line type="+type+" index="+index+" mode="+mode);
+ var nbrTrs = $("tr[name^='"+type+"_"+index+"']").length; // position of line for batch
+ var $row = $("tr[name='"+type+'_'+index+"_1']").clone(true); // clone last batch line to jQuery object
+ var qtyOrdered = parseFloat($("#qty_ordered_"+index).val()); // Qty ordered is same for all rows
+ var qty = parseFloat($("#qtytoproduce-"+index+"-"+nbrTrs).val());
+ var qtyDispatched;
+
+ if (mode === 'lessone')
+ {
+ qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1;
+ }
+ else
+ {
+ qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + qty;
+ console.log(qty);
+ // If user did not reduced the qty to dispatch on old line, we keep only 1 on old line and the rest on new line
+ if (qtyDispatched == qtyOrdered && qtyDispatched > 1) {
+ qtyDispatched = parseFloat($("#qty_dispatched_"+index).val()) + 1;
+ mode = 'lessone';
+ }
+ }
+ console.log("qtyDispatched="+qtyDispatched+" qtyOrdered="+qtyOrdered);
+
+ if (qtyOrdered <= 1) {
+ window.alert("Quantity can't be split");
+ }
+ if (qtyDispatched < qtyOrdered)
+ {
+ //replace tr suffix nbr
+ var re1 = new RegExp('_'+index+'_1', 'g');
+ var re2 = new RegExp('-'+index+'-1', 'g');
+ $row.html($row.html().replace(re1, '_'+index+'_'+(nbrTrs+1)));
+ $row.html($row.html().replace(re2, '-'+index+'-'+(nbrTrs+1)));
+ //create new select2 to avoid duplicate id of cloned one
+ $row.find("select[name='"+'idwarehousetoproduce-'+index+'-'+(nbrTrs+1)+"']").select2();
+ // TODO find solution to copy selected option to new select
+ // TODO find solution to keep new tr's after page refresh
+ //clear value
+ $row.find("input[name^='qtytoproduce']").val('');
+ //change name of new row
+ $row.attr('name',type+'_'+index+'_'+(nbrTrs+1));
+ //insert new row before last row
+ $("tr[name^='"+type+"_"+index+"_"+nbrTrs+"']:last").after($row);
+
+ //remove cloned select2 with duplicate id.
+ $("#s2id_entrepot_"+nbrTrs+'_'+index).detach(); // old way to find duplicated select2 component
+ $(".csswarehouse_"+index+"_"+(nbrTrs+1)+":first-child").parent("span.selection").parent(".select2").detach();
+
+ /* Suffix of lines are: index _ trs.length */
+ $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).focus();
+ if ($("#qtytoproduce-"+index+"-"+(nbrTrs)).val() == 0) {
+ $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1);
+ }
+ var totalonallines = 0;
+ for (let i = 1; i <= nbrTrs; i++) {
+ console.log(i+" = "+parseFloat($("#qtytoproduce-"+index+"-"+i).val()));
+ totalonallines = totalonallines + parseFloat($("#qtytoproduce-"+index+"-"+i).val());
+ }
+ console.log("totalonallines="+totalonallines);
+ if (totalonallines == qtyOrdered && qtyOrdered > 1) {
+ var prevouslineqty = $("#qtytoproduce-"+index+"-"+nbrTrs).val();
+ $("#qtytoproduce-"+index+"-"+(nbrTrs)).val(1);
+ $("#qtytoproduce-"+index+"-"+(nbrTrs+1)).val(prevouslineqty - 1);
+ }
+ $("#qty_dispatched_"+index).val(qtyDispatched);
+
+ //hide all buttons then show only the last one
+ $("tr[name^='"+type+"_'][name$='_"+index+"'] .splitbutton").hide();
+ $("tr[name^='"+type+"_'][name$='_"+index+"']:last .splitbutton").show();
+
+ if (mode === 'lessone')
+ {
+ qty = 1; // keep 1 in old line
+ $("#qty_"+(nbrTrs-1)+"_"+index).val(qty);
+ }
+ // Store arbitrary data for dispatch qty input field change event
+ $("#qtytoproduce-"+index+(nbrTrs)).data('qty', qty);
+ $("#qtytoproduce-"+index+(nbrTrs)).data('type', type);
+ $("#qtytoproduce-"+index+(nbrTrs)).data('index', index);
+ }
+}
+
diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php
index a065cc922fe..b25f5093cb9 100644
--- a/htdocs/mrp/mo_production.php
+++ b/htdocs/mrp/mo_production.php
@@ -57,7 +57,7 @@ dol_include_once('/mrp/class/mo.class.php');
dol_include_once('/mrp/lib/mrp_mo.lib.php');
// Load translation files required by the page
-$langs->loadLangs(array("mrp", "stocks", "other"));
+$langs->loadLangs(array("mrp", "stocks", "other", "productbatch"));
// Get parameters
$id = GETPOST('id', 'int');
@@ -397,7 +397,8 @@ $formproduct = new FormProduct($db);
$tmpwarehouse = new Entrepot($db);
$tmpbatch = new Productlot($db);
-llxHeader('', $langs->trans('Mo'), '');
+$help_url = 'EN:Module_Manufacturing_Orders|FR:Module_Ordres_de_Fabrication';
+llxHeader('', $langs->trans('Mo'), $help_url, '', 0, 0, array('/mrp/js/lib_dispatch.js.php'));
// Part to show record
if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create')))
@@ -621,11 +622,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if (in_array($action, array('consumeorproduce', 'consumeandproduceall', 'addconsumeline')))
{
- print '
';
+ print '';
+ print $form->widgetForTranslation("name", $object, $permissiontoadd);
+ print '';
if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '
';
// Country
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index ad5c66a50b8..e61c98e3267 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -712,6 +712,7 @@ class Societe extends CommonObject
*/
public $multicurrency_code;
+
/**
* Constructor
*
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 04ad577bff9..63641f27625 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -228,7 +228,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
if ($action == "change") // Change customer for TakePOS
{
$idcustomer = GETPOST('idcustomer', 'int');
- $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+ $place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
// Check if draft invoice already exists, if not create it
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")";
@@ -1031,7 +1031,7 @@ while ($i < min($num, $limit))
print '
0 ? GETPOST('place', 'int') : 0); // $place is id of table for Bar or Restaurant
+ $place = (GETPOST('place', 'alpha') > 0 ? GETPOST('place', 'alpha') : 0); // $place is id of table for Bar or Restaurant
print ' onclick="location.href=\'list.php?action=change&contextpage=poslist&idcustomer='.$obj->rowid.'&place='.$place.'\'"';
}
print '>';
diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php
index 7b412cfe610..d50faa480cb 100644
--- a/htdocs/takepos/admin/receipt.php
+++ b/htdocs/takepos/admin/receipt.php
@@ -83,7 +83,6 @@ $linkback = ''.$langs->trans("BackT
print load_fiche_titre($langs->trans("CashDeskSetup").' (TakePOS)', $linkback, 'title_setup');
$head = takepos_prepare_head();
dol_fiche_head($head, 'receipt', 'TakePOS', -1);
-print ' ';
print '\');';
+ }
+ echo '$("#customerandsales").append(\'\');';
+ }
+
$s = '';
$constantforkey = 'CASHDESK_NO_DECREASE_STOCK'.$_SESSION["takeposterminal"];
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index f79e310f36b..a3bac766aaf 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');
diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php
index c32561d3f52..424282d27cf 100644
--- a/htdocs/takepos/phone.php
+++ b/htdocs/takepos/phone.php
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
-$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$action = GETPOST('action', 'alpha');
$setterminal = GETPOST('setterminal', 'int');
diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php
index 31390c347bd..50010cf1712 100644
--- a/htdocs/takepos/receipt.php
+++ b/htdocs/takepos/receipt.php
@@ -30,7 +30,7 @@ include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$langs->loadLangs(array("main", "cashdesk", "companies"));
-$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$facid = GETPOST('facid', 'int');
diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php
index 7ad3e88d2b5..f4a83a09c52 100644
--- a/htdocs/takepos/reduction.php
+++ b/htdocs/takepos/reduction.php
@@ -34,7 +34,7 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
require '../main.inc.php'; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
-$place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant
+$place = (GETPOST('place', 'alpha') ? GETPOST('place', 'alpha') : 0); // $place is id of table for Ba or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');
diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php
index 8615d2db803..24d32bdf281 100644
--- a/htdocs/website/samples/wrapper.php
+++ b/htdocs/website/samples/wrapper.php
@@ -71,10 +71,10 @@ if (GETPOSTISSET('type')) $type=GETPOST('type', 'alpha');
else $type=dol_mimetype($original_file);
// Security: Delete string ../ into $original_file
-$original_file=str_replace("../","/", $original_file);
+$original_file = str_replace("../", "/", $original_file);
// Cache or not
-if (GETPOST("cache",'none') || image_format_supported($original_file) >= 0)
+if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0)
{
// Important: Following code is to avoid page request by browser and PHP CPU at
// each Dolibarr page access.
@@ -257,4 +257,4 @@ else
readfile($fullpath_original_file_osencoded);
}
if (is_object($db)) $db->close();
-// END PHP ?>
+// END PHP
diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php
index 4e5069b4fdc..eb5b794d3d1 100755
--- a/scripts/emailings/mailing-send.php
+++ b/scripts/emailings/mailing-send.php
@@ -328,7 +328,7 @@ if ($resql) {
dol_syslog("error for emailing id " . $id . " #" . $i . ($mail->error ? ' - ' . $mail->error : ''), LOG_DEBUG);
$sqlerror = "UPDATE " . MAIN_DB_PREFIX . "mailing_cibles";
- $sqlerror .= " SET statut=-1, date_envoi=" . $db->idate($now) . " WHERE rowid=" . $obj->rowid;
+ $sqlerror .= " SET statut=-1, date_envoi='" . $db->idate($now) . "' WHERE rowid=" . $obj->rowid;
$resqlerror = $db->query($sqlerror);
if (! $resqlerror) {
dol_print_error($db);