diff --git a/dev/setup/apache/virtualhost b/dev/setup/apache/virtualhost
index c3a2dff3e43..8c7682fe3d9 100644
--- a/dev/setup/apache/virtualhost
+++ b/dev/setup/apache/virtualhost
@@ -1,62 +1,93 @@
-#php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
-#php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
-php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
-php_admin_value open_basedir /tmp/:/home/../htdocs
+ #php_admin_value sendmail_path "/usr/sbin/sendmail -t -i"
+ #php_admin_value mail.force_extra_parameters "-f postmaster@mydomain.com"
+ php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f postmaster@mydomain.com"
+ php_admin_value open_basedir /tmp/:/home/.../htdocs:/home/.../dolibarr_documents:
+
+ ServerName myvirtualalias
+ ServerAlias myvirtualalias
+
+ UseCanonicalName On
+
+ KeepAlive On
+ KeepAliveTimeout 5
+ MaxKeepAliveRequests 20
+
+ AddDefaultCharset UTF-8
+
+ DocumentRoot "/home/.../htdocs"
+
+
+ AllowOverride None
+ Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
+ Require all granted
-ServerName myvirtualalias
-ServerAlias myvirtualalias
+ # To restrict access by a HTTP basic auth
+ #AuthType Basic
+ #AuthName "Authenticate to backoffice"
+ #AuthUserFile /etc/apache2/.htpasswd
+ #require valid-user
+
+
+ # Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
+
+ AuthType None
+ Require all granted
+ Satisfy any
+
+
+ AuthType None
+ Require all granted
+ Satisfy any
+
+
+ AuthType None
+ Require all granted
+ Satisfy any
+
+
+ AuthType None
+ Require all granted
+ Satisfy any
+
+
+ AuthType None
+ Require all granted
+ Satisfy any
+
-UseCanonicalName On
-
-AddDefaultCharset UTF-8
-
-DocumentRoot "/home/.../htdocs"
-
-
- AllowOverride None
- Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
- Require all granted
-
-
-
- Deny from all
- RemoveHandler .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
- AddType application/x-httpd-php-source .phtml .php .php3 .php4 .php5 .php6 .phps .cgi .exe .pl .asp .aspx .shtml .shtm .fcgi .fpl .jsp .htm .html .wml
-
-
-
-ErrorLog /var/log/apache2/myvirtualalias_error_log
-TransferLog /var/log/apache2/myvirtualalias_access_log
-
-# Compress returned resources of type php pages, text file export, css and javascript
-AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
-
-AddType text/javascript .jgz
-AddEncoding gzip .jgz
-ExpiresActive On
-ExpiresByType image/x-icon A2592000
-ExpiresByType image/gif A2592000
-ExpiresByType image/png A2592000
-ExpiresByType image/jpeg A2592000
-ExpiresByType text/css A2592000
-ExpiresByType text/javascript A2592000
-ExpiresByType application/x-javascript A2592000
-ExpiresByType application/javascript A2592000
-
-SSLEngine On
-
-# A self-signed (snakeoil) certificate can be created by installing
-# the ssl-cert package. See
-# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
-# If both key and certificate are stored in the same file, only the
-# SSLCertificateFile directive is needed.
-SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
-SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
-SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
-
-#RewriteEngine on
-#RewriteCond %{SERVER_PORT} ^80$
-#RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
+
+ ErrorLog /var/log/apache2/myvirtualalias_error_log
+ TransferLog /var/log/apache2/myvirtualalias_access_log
+
+ # Compress returned resources of type php pages, text file export, css and javascript
+ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/x-javascript
+
+ AddType text/javascript .jgz
+ AddEncoding gzip .jgz
+ ExpiresActive On
+ ExpiresByType image/x-icon A2592000
+ ExpiresByType image/gif A2592000
+ ExpiresByType image/png A2592000
+ ExpiresByType image/jpeg A2592000
+ ExpiresByType text/css A2592000
+ ExpiresByType text/javascript A2592000
+ ExpiresByType application/x-javascript A2592000
+ ExpiresByType application/javascript A2592000
+
+ SSLEngine On
+
+ # A self-signed (snakeoil) certificate can be created by installing
+ # the ssl-cert package. See
+ # /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
+ # If both key and certificate are stored in the same file, only the
+ # SSLCertificateFile directive is needed.
+ SSLCertificateFile /etc/letsencrypt/live/www.mydomain.com/cert.pem
+ SSLCertificateKeyFile /etc/letsencrypt/live/www.mydomain.com/privkey.pem
+ SSLCertificateChainFile /etc/letsencrypt/live/www.mydomain.com/chain.pem
+
+ #RewriteEngine on
+ #RewriteCond %{SERVER_PORT} ^80$
+ #RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]
diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php
index daf20ce5aa2..787a9d6d820 100644
--- a/htdocs/admin/index.php
+++ b/htdocs/admin/index.php
@@ -47,6 +47,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
+
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
$conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/ /i', ' ', $conf->global->MAIN_MOTD_SETUPPAGE);
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
@@ -76,12 +77,15 @@ print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySet
print " ";
print '';
-print ' ';
+print ' ';
// Show info setup company
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
$setupcompanynotcomplete = 1;
}
+
+print '';
+
print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
print ' ';
print $langs->trans("SetupDescription3b");
@@ -90,10 +94,13 @@ if (!empty($setupcompanynotcomplete)) {
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
print ' ';
}
+
+print ' ';
+
print ' ';
print ' ';
-print ' ';
-print ' ';
+
+print '';
// Show info setup module
print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
@@ -103,7 +110,9 @@ if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FO
$warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
print ' ';
}
-print ' ';
+
+print ' ';
+
print ' ';
print ' ';
print ' ';
diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php
index 83ab700f59a..578e1afa497 100644
--- a/htdocs/blockedlog/class/blockedlog.class.php
+++ b/htdocs/blockedlog/class/blockedlog.class.php
@@ -320,12 +320,12 @@ class BlockedLog
$this->error++;
}
} elseif ($this->action == 'MODULE_SET') {
- return 'System to track events into unalterable logs were enabled ';
+ return ''.$langs->trans("BlockedLogEnabled").' ';
} elseif ($this->action == 'MODULE_RESET') {
if ($this->signature == '0000000000') {
- return 'System to track events into unalterable logs were disabled after some recording were done. We saved a special Fingerprint to track the chain as broken. ';
+ return ''.$langs->trans("BlockedLogDisabled").' ';
} else {
- return 'System to track events into unalterable logs were disabled. This is possible because no record were done yet. ';
+ return ''.$langs->trans("BlockedLogDisabledBis").' ';
}
}
diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php
index 7d83a88ce55..cbd730e5d23 100644
--- a/htdocs/bom/bom_card.php
+++ b/htdocs/bom/bom_card.php
@@ -148,8 +148,17 @@ if (empty($reshook)) {
$error = 0;
// Set if we used free entry or predefined product
- $idprod = (int) GETPOST('idprod', 'int');
- $bom_child = (int) GETPOST('bom_select', 'int');
+ $bom_child_id = (int) GETPOST('bom_id', 'int');
+ if ($bom_child_id > 0) {
+ $bom_child = new BOM($db);
+ $res = $bom_child->fetch($bom_child_id);
+ if ($res) {
+ $idprod = $bom_child->fk_product;
+ }
+ } else {
+ $idprod = (int) GETPOST('idprod', 'int');
+ }
+
$qty = price2num(GETPOST('qty', 'alpha'), 'MS');
$qty_frozen = price2num(GETPOST('qty_frozen', 'alpha'), 'MS');
$disable_stock_change = GETPOST('disable_stock_change', 'int');
@@ -173,7 +182,7 @@ if (empty($reshook)) {
$bomline = new BOMLine($db);
$bomline->fk_bom = $id;
$bomline->fk_product = $idprod;
- $bomline->fk_bom_child = $bom_child;
+ $bomline->fk_bom_child = $bom_child_id;
$bomline->qty = $qty;
$bomline->qty_frozen = (int) $qty_frozen;
$bomline->disable_stock_change = (int) $disable_stock_change;
@@ -580,13 +589,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$(".collapse_bom").click(function() {
console.log("We click on collapse");
var id_bom_line = $(this).attr('id').replace('collapse-', '');
- if($(this).text().indexOf('+') > 0) {
+ console.log($(this).html().indexOf('folder-open'));
+ if($(this).html().indexOf('folder-open') <= 0) {
$('[parentid="'+ id_bom_line +'"]').show();
- $(this).html('(-) ');
+ $(this).html('');
}
else {
$('[parentid="'+ id_bom_line +'"]').hide();
- $(this).html('(+) ');
+ $(this).html('');
}
return false;
@@ -596,7 +606,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$("#show_all").click(function() {
console.log("We click on show all");
$("[class^=sub_bom_lines]").show();
- $("[class^=collapse_bom]").html('(-) ');
+ $("[class^=collapse_bom]").html('');
return false;
});
@@ -604,7 +614,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$("#hide_all").click(function() {
console.log("We click on hide all");
$("[class^=sub_bom_lines]").hide();
- $("[class^=collapse_bom]").html('(+) ');
+ $("[class^=collapse_bom]").html('');
return false;
});
diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php
index 0520c76dde2..4923e9d0ca2 100644
--- a/htdocs/bom/class/bom.class.php
+++ b/htdocs/bom/class/bom.class.php
@@ -1064,26 +1064,41 @@ class BOM extends CommonObject
$tmpproduct->cost_price = 0;
$tmpproduct->pmp = 0;
- $result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
- if ($result < 0) {
- $this->error = $tmpproduct->error;
- return -1;
- }
- $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
- if (empty($line->unit_cost)) {
- if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
- $line->unit_cost = $productFournisseur->fourn_unitprice;
+ if (empty($line->fk_bom_child)) {
+ $result = $tmpproduct->fetch($line->fk_product, '', '', '', 0, 1, 1); // We discard selling price and language loading
+ if ($result < 0) {
+ $this->error = $tmpproduct->error;
+ return -1;
+ }
+ $line->unit_cost = price2num((!empty($tmpproduct->cost_price)) ? $tmpproduct->cost_price : $tmpproduct->pmp);
+ if (empty($line->unit_cost)) {
+ if ($productFournisseur->find_min_price_product_fournisseur($line->fk_product) > 0) {
+ $line->unit_cost = $productFournisseur->fourn_unitprice;
+ }
+ }
+
+ $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
+
+ $this->total_cost += $line->total_cost;
+ } else {
+ $bom_child= new BOM($this->db);
+ $res = $bom_child->fetch($line->fk_bom_child);
+ if ($res>0) {
+ $bom_child->calculateCosts();
+ $this->total_cost += $bom_child->total_cost;
+ } else {
+ $this->error = $bom_child->error;
+ return -2;
}
}
- $line->total_cost = price2num($line->qty * $line->unit_cost, 'MT');
-
- $this->total_cost += $line->total_cost;
}
$this->total_cost = price2num($this->total_cost, 'MT');
- if ($this->qty) {
+ if ($this->qty > 0) {
$this->unit_cost = price2num($this->total_cost / $this->qty, 'MU');
+ } elseif ($this->qty < 0) {
+ $this->unit_cost = price2num($this->total_cost * $this->qty, 'MU');
}
}
}
diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php
index 7419c4618e0..0a3a3b34e7a 100644
--- a/htdocs/bom/tpl/objectline_create.tpl.php
+++ b/htdocs/bom/tpl/objectline_create.tpl.php
@@ -109,7 +109,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
if (!empty($conf->global->BOM_SUB_BOM)) {
print ''.$langs->trans("or").' '.$langs->trans("BOM");
// TODO Add component to select a BOM
- print 'TODO ';
+ $form->select_bom();
}
print '';
diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php
index 82626c12fec..b72ed043581 100644
--- a/htdocs/bom/tpl/objectline_view.tpl.php
+++ b/htdocs/bom/tpl/objectline_view.tpl.php
@@ -41,7 +41,7 @@ if (empty($object) || !is_object($object)) {
}
-global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax;
+global $forceall, $senderissupplier, $inputalsopricewithtax, $outputalsopricetotalwithtax, $langs;
if (empty($dateSelector)) {
$dateSelector = 0;
@@ -83,8 +83,12 @@ $tmpproduct->fetch($line->fk_product);
$tmpbom = new BOM($object->db);
$res = $tmpbom->fetch($line->fk_bom_child);
if ($tmpbom->id > 0) {
+ print $tmpproduct->getNomUrl(1);
+ print ' '.$langs->trans("or").' ';
print $tmpbom->getNomUrl(1);
- print '' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' ';
+ print ' ';
+ print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open'));
+ print ' ';
} else {
print $tmpproduct->getNomUrl(1);
print ' - '.$tmpproduct->label;
@@ -176,7 +180,7 @@ if ($action == 'selectlines') {
print '';
// Select of all the sub-BOM lines
-$sql = 'SELECT rowid, fk_bom_child, fk_product FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
+$sql = 'SELECT rowid, fk_bom_child, fk_product, qty FROM '.MAIN_DB_PREFIX.'bom_bomline AS bl';
$sql.= ' WHERE fk_bom ='. (int) $tmpbom->id;
$resql = $object->db->query($sql);
@@ -199,21 +203,23 @@ if ($resql) {
print '
'.$langs->trans("DateActionEnd").' ';
- if (!$object->fulldayevent) {
+ if (empty($object->fulldayevent)) {
print dol_print_date($object->datef, 'dayhour', 'tzuser');
} else {
print dol_print_date($object->datef, 'day', 'tzuser');
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index e3b2c64c92a..c315a4fcd61 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -626,7 +626,7 @@ class Commande extends CommonOrder
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."commande";
- $sql .= " SET fk_statut = ".self::STATUS_DRAFT."',";
+ $sql .= " SET fk_statut = ".self::STATUS_DRAFT.",";
$sql .= " fk_user_modif = ".((int) $user->id);
$sql .= " WHERE rowid = ".((int) $this->id);
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 717b57ae8b1..febab2d5917 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -1462,11 +1462,6 @@ if ($resql) {
print ' ';
print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
- // Warning late icon and note
- if ($generic_commande->hasDelay()) {
- print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
- }
-
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
$urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
@@ -1590,6 +1585,10 @@ if ($resql) {
if (!empty($arrayfields['c.date_commande']['checked'])) {
print ' ';
print dol_print_date($db->jdate($obj->date_commande), 'day');
+ // Warning late icon and note
+ if ($generic_commande->hasDelay()) {
+ print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
+ }
print ' ';
if (!$i) {
$totalarray['nbfield']++;
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index 332f68c1293..c68a686d2bf 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -210,11 +210,11 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
print '';
print $tmpinvoice->getNomUrl(1, '');
print ' ';
- print '';
if ($tmpinvoice->hasDelay()) {
+ print ' ';
print img_warning($langs->trans("Late"));
+ print ' ';
}
- print '';
print '';
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php
index 4b44959bc1a..15c45d6055b 100644
--- a/htdocs/compta/tva/quadri_detail.php
+++ b/htdocs/compta/tva/quadri_detail.php
@@ -6,7 +6,7 @@
* Copyright (C) 2014 Ferran Marcet
* Copyright (C) 2018-2021 Frédéric France
* Copyright (C) 2019 Eric Seigne
- * Copyright (C) 2021 Open-Dsi
+ * Copyright (C) 2021-2022 Open-Dsi
*
* 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
@@ -47,7 +47,7 @@ $langs->loadLangs(array("other", "compta", "banks", "bills", "companies", "produ
$refresh = (GETPOSTISSET('submit') || GETPOSTISSET('vat_rate_show') || GETPOSTISSET('invoice_type')) ? true : false;
$invoice_type = GETPOSTISSET('invoice_type') ? GETPOST('invoice_type', 'alpha') : '';
-$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'int') : -1;
+$vat_rate_show = GETPOSTISSET('vat_rate_show') ? GETPOST('vat_rate_show', 'alphanohtml') : -1;
include DOL_DOCUMENT_ROOT.'/compta/tva/initdatesforvat.inc.php';
@@ -409,7 +409,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print '';
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
print ' - ' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . ' ';
@@ -643,7 +643,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
print ' ';
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
print ' - ' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . ' ';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 27e8cc6bf95..b2c9543453b 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -387,7 +387,7 @@ class Contrat extends CommonObject
if ($contratline->statut != ContratLigne::STATUS_OPEN) {
$contratline->context = $this->context;
- $result = $contratline->active_line($user, $date_start, -1, $comment);
+ $result = $contratline->active_line($user, $date_start, -1, $comment); // This call trigger LINECONTRACT_ACTIVATE
if ($result < 0) {
$error++;
$this->error = $contratline->error;
diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php
index 1814b476d06..ae4f7c41515 100644
--- a/htdocs/core/ajax/selectsearchbox.php
+++ b/htdocs/core/ajax/selectsearchbox.php
@@ -65,58 +65,58 @@ $arrayresult = array();
// Define $searchform
if (!empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) {
- $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintomember'] = array('position'=>8, 'shortcut'=>'M', 'img'=>'object_member', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('', 'object_member', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (((!empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) {
- $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintothirdparty'] = array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('', 'object_company', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED) && $user->rights->societe->lire) {
- $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintocontact'] = array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('', 'object_contact', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (((!empty($conf->product->enabled) && $user->rights->produit->lire) || (!empty($conf->service->enabled) && $user->rights->service->lire))
&& empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) {
- $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoproduct'] = array('position'=>30, 'shortcut'=>'P', 'img'=>'object_product', 'label'=>$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'text'=>img_picto('', 'object_product', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
// search on lot/serial numbers
if ( ! empty($conf->productbatch->enabled) ) {
- $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintobatch'] = array('position'=>32, 'shortcut'=>'B', 'img'=>'object_lot', 'label'=>$langs->trans("SearchIntoBatch", $search_boxvalue), 'text'=>img_picto('', 'object_lot', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoBatch", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/product/stock/productlot_list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
}
if (!empty($conf->mrp->enabled) && $user->rights->mrp->read && empty($conf->global->MAIN_SEARCHFORM_MRP_DISABLED)) {
- $arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintomo'] = array('position'=>35, 'shortcut'=>'', 'img'=>'object_mrp', 'label'=>$langs->trans("SearchIntoMO", $search_boxvalue), 'text'=>img_picto('', 'object_mrp', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMO", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/mrp/mo_list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_PROJECT_DISABLED) && $user->rights->projet->lire) {
- $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoprojects'] = array('position'=>40, 'shortcut'=>'Q', 'img'=>'object_project', 'label'=>$langs->trans("SearchIntoProjects", $search_boxvalue), 'text'=>img_picto('', 'object_project', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoProjects", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->projet->enabled) && empty($conf->global->MAIN_SEARCHFORM_TASK_DISABLED) && $user->rights->projet->lire) {
- $arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintotasks'] = array('position'=>45, 'img'=>'object_projecttask', 'label'=>$langs->trans("SearchIntoTasks", $search_boxvalue), 'text'=>img_picto('', 'object_projecttask', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTasks", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/projet/tasks/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->propal->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_PROPAL_DISABLED) && $user->rights->propal->lire) {
- $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintopropal'] = array('position'=>60, 'img'=>'object_propal', 'label'=>$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'text'=>img_picto('', 'object_propal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/comm/propal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->commande->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_ORDER_DISABLED) && $user->rights->commande->lire) {
- $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoorder'] = array('position'=>70, 'img'=>'object_order', 'label'=>$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'text'=>img_picto('', 'object_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/commande/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->expedition->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_SHIPMENT_DISABLED) && $user->rights->expedition->lire) {
- $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoshipment'] = array('position'=>80, 'img'=>'object_shipment', 'label'=>$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'text'=>img_picto('', 'object_shipment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerShipments", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expedition/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUSTOMER_INVOICE_DISABLED) && $user->rights->facture->lire) {
- $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoinvoice'] = array('position'=>90, 'img'=>'object_bill', 'label'=>$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_bill', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/compta/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->supplier_proposal->enabled) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_PROPAL_DISABLED) && $user->rights->supplier_proposal->lire) {
- $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintosupplierpropal'] = array('position'=>100, 'img'=>'object_supplier_proposal', 'label'=>$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_proposal', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierProposals", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/supplier_proposal/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_ORDER_DISABLED)) {
- $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintosupplierorder'] = array('position'=>110, 'img'=>'object_supplier_order', 'label'=>$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_order', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierOrders", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/commande/list.php'.($search_boxvalue ? '?search_all='.urlencode($search_boxvalue) : ''));
}
if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->lire)) && empty($conf->global->MAIN_SEARCHFORM_SUPPLIER_INVOICE_DISABLED)) {
- $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintosupplierinvoice'] = array('position'=>120, 'img'=>'object_supplier_invoice', 'label'=>$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'text'=>img_picto('', 'object_supplier_invoice', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoSupplierInvoices", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fourn/facture/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
// Customer payments
@@ -125,7 +125,7 @@ if (!empty($conf->facture->enabled) && empty($conf->global->MAIN_SEARCHFORM_CUST
'position'=>170,
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
- 'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
+ 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoCustomerPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/compta/paiement/list.php?leftmenu=customers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
@@ -135,7 +135,7 @@ if (((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_S
'position'=>175,
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
- 'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
+ 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoVendorPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/fourn/paiement/list.php?leftmenu=suppliers_bills_payment'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
@@ -145,29 +145,29 @@ if (!empty($conf->banque->enabled) && empty($conf->global->MAIN_SEARCHFORM_MISC_
'position'=>180,
'img'=>'object_payment',
'label'=>$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
- 'text'=>img_picto('', 'object_payment').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
+ 'text'=>img_picto('', 'object_payment', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoMiscPayments", $search_boxvalue),
'url'=>DOL_URL_ROOT.'/compta/bank/various_payment/list.php?leftmenu=tax_various'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->contrat->enabled) && empty($conf->global->MAIN_SEARCHFORM_CONTRACT_DISABLED) && $user->rights->contrat->lire) {
- $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintocontract'] = array('position'=>130, 'img'=>'object_contract', 'label'=>$langs->trans("SearchIntoContracts", $search_boxvalue), 'text'=>img_picto('', 'object_contract', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoContracts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contrat/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->ficheinter->enabled) && empty($conf->global->MAIN_SEARCHFORM_FICHINTER_DISABLED) && $user->rights->ficheinter->lire) {
- $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintointervention'] = array('position'=>140, 'img'=>'object_intervention', 'label'=>$langs->trans("SearchIntoInterventions", $search_boxvalue), 'text'=>img_picto('', 'object_intervention', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoInterventions", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/fichinter/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->ticket->enabled) && empty($conf->global->MAIN_SEARCHFORM_TICKET_DISABLED) && $user->rights->ticket->read) {
- $arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintotickets'] = array('position'=>145, 'img'=>'object_ticket', 'label'=>$langs->trans("SearchIntoTickets", $search_boxvalue), 'text'=>img_picto('', 'object_ticket', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoTickets", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/ticket/list.php?mainmenu=ticket'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
// HR
if (!empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_DISABLED) && $user->rights->user->user->lire) {
- $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintouser'] = array('position'=>200, 'shortcut'=>'U', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoUsers", $search_boxvalue), 'text'=>img_picto('', 'object_user', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoUsers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/user/list.php'.($search_boxvalue ? '?sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire) {
- $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoexpensereport'] = array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('', 'object_trip', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
if (!empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read) {
- $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
+ $arrayresult['searchintoleaves'] = array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('', 'object_holiday', 'class="pictofixedwidth"').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue ? '&sall='.urlencode($search_boxvalue) : ''));
}
// Execute hook addSearchEntry
diff --git a/htdocs/core/boxes/box_scheduled_jobs.php b/htdocs/core/boxes/box_scheduled_jobs.php
index 53cf5c79571..94695034cce 100644
--- a/htdocs/core/boxes/box_scheduled_jobs.php
+++ b/htdocs/core/boxes/box_scheduled_jobs.php
@@ -170,7 +170,7 @@ class box_scheduled_jobs extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center"',
- 'textnoformat' => ($nbjobsinerror ? ' '.$nbjobsinerror.'
' : '0
')
+ 'textnoformat' => ($nbjobsinerror ? ' '.$nbjobsinerror.'
' : '0
')
);
} else {
$this->info_box_contents[0][0] = array(
diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php
index 9a011591afb..abd2c7dd502 100644
--- a/htdocs/core/class/extrafields.class.php
+++ b/htdocs/core/class/extrafields.class.php
@@ -804,9 +804,6 @@ class ExtraFields
if ($elementtype == 'order_supplier') {
$elementtype = 'commande_fournisseur';
}
- if ($elementtype == 'stock_mouvement') {
- $elementtype = 'movement';
- }
$array_name_label = array();
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 91c45055296..6c4d5037bc3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -2367,6 +2367,69 @@ class Form
}
}
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+
+ /**
+ * Return list of BOM for customer in Ajax if Ajax activated or go to select_produits_list
+ *
+ * @param int $selected Preselected BOM id
+ * @param string $htmlname Name of HTML select field (must be unique in page).
+ * @param int $limit Limit on number of returned lines
+ * @param int $status Sell status -1=Return all bom, 0=Draft BOM, 1=Validated BOM
+ * @param int $type type of the BOM (-1=Return all BOM, 0=Return disassemble BOM, 1=Return manufacturing BOM)
+ * @param string $showempty '' to not show empty line. Translation key to show an empty line. '1' show empty line with no text.
+ * @param string $morecss Add more css on select
+ * @param string $nooutput No print, return the output into a string
+ * @param int $forcecombo Force to use combo box
+ * @return void|string
+ */
+ public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0)
+ {
+ // phpcs:enable
+ global $conf, $user, $langs, $db;
+
+ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
+
+ $error = 0;
+ $out = '';
+
+ if (!$forcecombo) {
+ include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php';
+ $out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
+ }
+
+ $out .= '';
+
+ $sql = 'SELECT b.rowid, b.ref, b.label, b.fk_product';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
+ $sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
+ if (!empty($status)) $sql.= ' AND status = '. (int) $status;
+ if (!empty($type)) $sql.= ' AND status = '. (int) $type;
+ if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit;
+ $resql = $db->query($sql);
+ if ($resql) {
+ if ($showempty) {
+ $out .= 'fetch_object($resql)) {
+ $product = new Product($db);
+ $res = $product->fetch($obj->fk_product);
+ if ($obj->rowid == $selected) $out .= ' '.$obj->ref.' - '. $product->label .' - '.$obj->label.' ';
+ $out .= ''.$obj->ref.' - '.$product->label .' - '. $obj->label.' ';
+ }
+ } else {
+ $error++;
+ dol_print_error($db);
+ }
+ if (empty($nooutput)) {
+ print $out;
+ } else {
+ return $out;
+ }
+ }
+
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of products for a customer.
@@ -8013,6 +8076,31 @@ class Form
}
}
+ // Try also magic suggest
+ $out .= ''."\n";
+ if (is_array($array) && !empty($array)) {
+ if ($value_as_key) {
+ $array = array_combine($array, $array);
+ }
+
+ if (!empty($array)) {
+ foreach ($array as $key => $value) {
+ $newval = ($translate ? $langs->trans($value) : $value);
+ $newval = ($key_in_label ? $key.' - '.$newval : $newval);
+
+ $out .= 'use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
$out .= "\n".'';
@@ -8067,31 +8155,6 @@ class Form
$out .= '';
}
- // Try also magic suggest
- $out .= ''."\n";
- if (is_array($array) && !empty($array)) {
- if ($value_as_key) {
- $array = array_combine($array, $array);
- }
-
- if (!empty($array)) {
- foreach ($array as $key => $value) {
- $newval = ($translate ? $langs->trans($value) : $value);
- $newval = ($key_in_label ? $key.' - '.$newval : $newval);
-
- $out .= 'database_name) {
- // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
- $ret = $this->db->query($query, $result_mode);
- } else {
- $ret = $this->db->query($query, $result_mode);
+ try {
+ if (!$this->database_name) {
+ // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE)
+ $ret = $this->db->query($query, $result_mode);
+ } else {
+ $ret = $this->db->query($query, $result_mode);
+ }
+ } catch (Exception $e) {
+ dol_syslog(get_class($this)."::query Exception in query instead of returning an error: ".$e->getMessage(), LOG_ERR);
+ $ret = false;
}
if (!preg_match("/^COMMIT/i", $query) && !preg_match("/^ROLLBACK/i", $query)) {
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index a59f35a3978..27ba8070000 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2925,6 +2925,38 @@ function dol_print_socialnetworks($value, $cid, $socid, $type, $dictsocialnetwor
return $htmllink;
}
+/**
+ * Format profIDs according to country
+ *
+ * @param string $profID Value of profID to format
+ * @param string $profIDtype Type of profID to format ('1', '2', '3', '4', '5', '6' or 'VAT')
+ * @param string $countrycode Country code to use for formatting
+ * @param int $addcpButton Add button to copy to clipboard (1 => show only on hoover ; 2 => always display )
+ * @param string $separ Separation between numbers for a better visibility example : xxx xxx xxx xxxxx
+ * @return string Formated profID
+ */
+function dol_print_profids($profID, $profIDtype, $countrycode = '', $addcpButton = 1, $separ = ' ')
+{
+ global $mysoc;
+
+ if (empty($profID) || empty($profIDtype)) {
+ return '';
+ }
+ if (empty($countrycode)) $countrycode = $mysoc->country_code;
+ $newProfID = $profID;
+ $id = substr($profIDtype, -1);
+ $ret = '';
+ if (strtoupper($countrycode) == 'FR') {
+ // France
+ if ($id == 1 && dol_strlen($newProfID) == 9) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3);
+ if ($id == 2 && dol_strlen($newProfID) == 14) $newProfID = substr($newProfID, 0, 3).$separ.substr($newProfID, 3, 3).$separ.substr($newProfID, 6, 3).$separ.substr($newProfID, 9, 5);
+ if ($profIDtype === 'VAT' && dol_strlen($newProfID) == 13) $newProfID = substr($newProfID, 0, 4).$separ.substr($newProfID, 4, 3).$separ.substr($newProfID, 7, 3).$separ.substr($newProfID, 10, 3);
+ }
+ if (!empty($addcpButton)) $ret = showValueWithClipboardCPButton(dol_escape_htmltag($profID), ($addcpButton == 1 ? 1 : 0), $newProfID);
+ else $ret = $newProfID;
+ return $ret;
+}
+
/**
* Format phone numbers according to country
*
@@ -7075,6 +7107,19 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
/*$substitutionarray['__MEMBER_NOTE_PUBLIC__'] = '__MEMBER_NOTE_PUBLIC__';
$substitutionarray['__MEMBER_NOTE_PRIVATE__'] = '__MEMBER_NOTE_PRIVATE__';*/
}
+ // add variables subtitutions ticket
+ if (!empty($conf->ticket->enabled) && (!is_object($object) || $object->element == 'ticket')) {
+ $substitutionarray['__TICKET_TRACKID__'] = '__TICKET_TRACKID__';
+ $substitutionarray['__TICKET_SUBJECT__'] = '__TICKET_SUBJECT__';
+ $substitutionarray['__TICKET_TYPE__'] = '__TICKET_TYPE__';
+ $substitutionarray['__TICKET_SEVERITY__'] = '__TICKET_SEVERITY__';
+ $substitutionarray['__TICKET_CATEGORY__'] = '__TICKET_CATEGORY__';
+ $substitutionarray['__TICKET_ANALYTIC_CODE__'] = '__TICKET_ANALYTIC_CODE__';
+ $substitutionarray['__TICKET_MESSAGE__'] = '__TICKET_MESSAGE__';
+ $substitutionarray['__TICKET_PROGRESSION__'] = '__TICKET_PROGRESSION__';
+ $substitutionarray['__TICKET_USER_ASSIGN__'] = '__TICKET_USER_ASSIGN__';
+ }
+
if (!empty($conf->recruitment->enabled) && (!is_object($object) || $object->element == 'candidature')) {
$substitutionarray['__CANDIDATE_FULLNAME__'] = '__CANDIDATE_FULLNAME__';
$substitutionarray['__CANDIDATE_FIRSTNAME__'] = '__CANDIDATE_FIRSTNAME__';
@@ -7264,6 +7309,28 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = dol_print_date($datenextexpiration, 'dayrfc');
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = dol_print_date($datenextexpiration, 'standard');
}
+ // add substition variable for ticket
+ if (is_object($object) && $object->element == 'ticket') {
+ $substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
+ $substitutionarray['__REF__'] = $object->ref;
+ $substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
+ $substitutionarray['__TICKET_TYPE__'] = $object->type_code;
+ $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code;
+ $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility
+ $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code;
+ $substitutionarray['__TICKET_MESSAGE__'] = $object->message;
+ $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress;
+ $userstat = new User($db);
+ if ($object->fk_user_assign > 0) {
+ $userstat->fetch($object->fk_user_assign);
+ $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+
+ if ($object->fk_user_create > 0) {
+ $userstat->fetch($object->fk_user_create);
+ $substitutionarray['__USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
+ }
+ }
// Create dynamic tags for __EXTRAFIELD_FIELD__
if ($object->table_element && $object->id > 0) {
diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php
index c64c63fc0dd..1e4cdf16791 100644
--- a/htdocs/core/lib/invoice.lib.php
+++ b/htdocs/core/lib/invoice.lib.php
@@ -1196,11 +1196,6 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
print '';
print $tmpinvoice->getNomUrl(1, '');
print ' ';
- print '';
- if ($tmpinvoice->hasDelay()) {
- print img_warning($langs->trans("Late"));
- }
- print ' ';
print '';
$filename = dol_sanitizeFileName($obj->ref);
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
@@ -1212,7 +1207,12 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
print ' ';
print $societestatic->getNomUrl(1, 'customer');
print ' ';
- print ''.dol_print_date($db->jdate($obj->datelimite), 'day').' ';
+ print '';
+ print dol_print_date($db->jdate($obj->datelimite), 'day');
+ if ($tmpinvoice->hasDelay()) {
+ print img_warning($langs->trans("Late"));
+ }
+ print ' ';
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
print ''.price($obj->total_ht).' ';
}
diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php
index 10c838b4c43..117871b4712 100644
--- a/htdocs/core/lib/product.lib.php
+++ b/htdocs/core/lib/product.lib.php
@@ -382,7 +382,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("propal");
print '';
- print ''.img_object('', 'propal', 'class="paddingright"').$langs->trans("Proposals").' ';
+ print ''.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").' ';
print ' ';
print $product->stats_propale['customers'];
print ' ';
@@ -401,7 +401,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("supplier_proposal");
print ' ';
- print ''.img_object('', 'supplier_proposal', 'class="paddingright"').$langs->trans("SupplierProposals").' ';
+ print ''.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").' ';
print ' ';
print $product->stats_proposal_supplier['suppliers'];
print ' ';
@@ -420,7 +420,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("orders");
print ' ';
- print ''.img_object('', 'order', 'class="paddingright"').$langs->trans("CustomersOrders").' ';
+ print ''.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").' ';
print ' ';
print $product->stats_commande['customers'];
print ' ';
@@ -439,7 +439,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("orders");
print ' ';
- print ''.img_object('', 'supplier_order', 'class="paddingright"').$langs->trans("SuppliersOrders").' ';
+ print ''.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").' ';
print ' ';
print $product->stats_commande_fournisseur['suppliers'];
print ' ';
@@ -458,7 +458,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("bills");
print ' ';
- print ''.img_object('', 'bill').' '.$langs->trans("CustomersInvoices").' ';
+ print ''.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").' ';
print ' ';
print $product->stats_facture['customers'];
print ' ';
@@ -477,7 +477,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("bills");
print ' ';
- print ''.img_object('', 'supplier_invoice', 'class="paddingright"').$langs->trans("SuppliersInvoices").' ';
+ print ''.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").' ';
print ' ';
print $product->stats_facture_fournisseur['suppliers'];
print ' ';
@@ -497,7 +497,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("contracts");
print ' ';
- print ''.img_object('', 'contract', 'class="paddingright"').$langs->trans("Contracts").' ';
+ print ''.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").' ';
print ' ';
print $product->stats_contrat['customers'];
print ' ';
@@ -518,7 +518,7 @@ function show_stats_for_company($product, $socid)
$langs->load("mrp");
print ' ';
- print ''.img_object('', 'bom', 'class="paddingright"').$langs->trans("BOM").' ';
+ print ''.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").' ';
print ' ';
print ' ';
@@ -540,7 +540,7 @@ function show_stats_for_company($product, $socid)
}
$langs->load("mrp");
print ' ';
- print ''.img_object('', 'mrp', 'class="paddingright"').$langs->trans("MO").' ';
+ print ''.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").' ';
print ' ';
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
diff --git a/htdocs/core/lib/stock.lib.php b/htdocs/core/lib/stock.lib.php
index 2e58e6c8082..066bf2165be 100644
--- a/htdocs/core/lib/stock.lib.php
+++ b/htdocs/core/lib/stock.lib.php
@@ -109,6 +109,11 @@ function stock_admin_prepare_head()
$head[$h][2] = 'attributes';
$h++;
+ $head[$h][0] = DOL_URL_ROOT.'/product/admin/stock_mouvement_extrafields.php';
+ $head[$h][1] = $langs->trans("StockMouvementExtraFields");
+ $head[$h][2] = 'stockMouvementAttributes';
+ $h++;
+
complete_head_from_modules($conf, $langs, null, $head, $h, 'stock_admin', 'remove');
return $head;
diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php
index 40e50544b22..490b95cc92d 100644
--- a/htdocs/core/lib/tax.lib.php
+++ b/htdocs/core/lib/tax.lib.php
@@ -6,7 +6,7 @@
* Copyright (C) 2012 Cédric Salvador
* Copyright (C) 2012-2014 Raphaël Doursenaud
* Copyright (C) 2015 Marcos García
- * Copyright (C) 2021 Open-Dsi
+ * Copyright (C) 2021-2022 Open-Dsi
*
* 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
@@ -696,7 +696,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_PRODUCT == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_PRODUCT == 'invoice')) {
// Count on delivery date (use invoice date as delivery is unknown)
- $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
+ $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
$sql .= " d.date_start as date_start, d.date_end as date_end,";
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
@@ -739,7 +739,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
- $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
+ $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
$sql .= " d.date_start as date_start, d.date_end as date_end,";
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
@@ -799,66 +799,71 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$rate = -1;
$oldrowid = '';
while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
+ }
+
// Code to avoid warnings when array entry not defined
- if (!isset($list[$assoc['rate']]['totalht'])) {
- $list[$assoc['rate']]['totalht'] = 0;
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
}
- if (!isset($list[$assoc['rate']]['vat'])) {
- $list[$assoc['rate']]['vat'] = 0;
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax1'])) {
- $list[$assoc['rate']]['localtax1'] = 0;
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax2'])) {
- $list[$assoc['rate']]['localtax2'] = 0;
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
}
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['rate']]['vat'] += $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += $assoc['total_ht'];
+ $list[$rate_key]['vat'] += $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
}
- $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
- $list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
- $list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
+ $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = $assoc['dtype'];
+ $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
- $list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
- $list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
- $list[$assoc['rate']]['company_alias'][] = $assoc['company_alias'];
- $list[$assoc['rate']]['company_email'][] = $assoc['company_email'];
- $list[$assoc['rate']]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$assoc['rate']]['company_client'][] = $assoc['company_client'];
- $list[$assoc['rate']]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$assoc['rate']]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$assoc['rate']]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$assoc['rate']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$assoc['rate']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$assoc['rate']]['company_status'][] = $assoc['company_status'];
+ $list[$rate_key]['company_name'][] = $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = $assoc['company_status'];
- $list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['rate']]['facid'][] = $assoc['facid'];
- $list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['rate']]['type'][] = $assoc['type'];
- $list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['rate']]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = $assoc['facid'];
+ $list[$rate_key]['facnum'][] = $assoc['facnum'];
+ $list[$rate_key]['type'][] = $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = $assoc['descr'];
- $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
- $list[$assoc['rate']]['pid'][] = $assoc['pid'];
- $list[$assoc['rate']]['pref'][] = $assoc['pref'];
- $list[$assoc['rate']]['ptype'][] = $assoc['ptype'];
+ $list[$rate_key]['pid'][] = $assoc['pid'];
+ $list[$rate_key]['pref'][] = $assoc['pref'];
+ $list[$rate_key]['ptype'][] = $assoc['ptype'];
- $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
- $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
$rate = $assoc['rate'];
}
@@ -876,7 +881,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
if (($direction == 'sell' && $conf->global->TAX_MODE_SELL_SERVICE == 'invoice')
|| ($direction == 'buy' && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) {
// Count on invoice date
- $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
+ $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
$sql .= " d.date_start as date_start, d.date_end as date_end,";
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
@@ -919,7 +924,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql .= " ORDER BY d.rowid, d.".$fk_facture;
} else {
// Count on payments date
- $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
+ $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,";
$sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, ";
$sql .= " d.date_start as date_start, d.date_end as date_end,";
$sql .= " f.".$invoicefieldref." as facnum, f.type, f.total_ttc as ftotal_ttc, f.datef,";
@@ -979,66 +984,71 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$rate = -1;
$oldrowid = '';
while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
+ }
+
// Code to avoid warnings when array entry not defined
- if (!isset($list[$assoc['rate']]['totalht'])) {
- $list[$assoc['rate']]['totalht'] = 0;
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
}
- if (!isset($list[$assoc['rate']]['vat'])) {
- $list[$assoc['rate']]['vat'] = 0;
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax1'])) {
- $list[$assoc['rate']]['localtax1'] = 0;
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax2'])) {
- $list[$assoc['rate']]['localtax2'] = 0;
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
}
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['rate']]['vat'] += $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += $assoc['total_ht'];
+ $list[$rate_key]['vat'] += $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
}
- $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$assoc['rate']]['dtype'][] = $assoc['dtype'];
- $list[$assoc['rate']]['datef'][] = $db->jdate($assoc['datef']);
- $list[$assoc['rate']]['datep'][] = $db->jdate($assoc['datep']);
+ $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = $assoc['dtype'];
+ $list[$rate_key]['datef'][] = $db->jdate($assoc['datef']);
+ $list[$rate_key]['datep'][] = $db->jdate($assoc['datep']);
- $list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['rate']]['company_name'][] = $assoc['company_name'];
- $list[$assoc['rate']]['company_id'][] = $assoc['company_id'];
- $list[$assoc['rate']]['company_alias'][] = $assoc['company_alias'];
- $list[$assoc['rate']]['company_email'][] = $assoc['company_email'];
- $list[$assoc['rate']]['company_tva_intra'][] = $assoc['company_tva_intra'];
- $list[$assoc['rate']]['company_client'][] = $assoc['company_client'];
- $list[$assoc['rate']]['company_fournisseur'][] = $assoc['company_fournisseur'];
- $list[$assoc['rate']]['company_customer_code'][] = $assoc['company_customer_code'];
- $list[$assoc['rate']]['company_supplier_code'][] = $assoc['company_supplier_code'];
- $list[$assoc['rate']]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
- $list[$assoc['rate']]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
- $list[$assoc['rate']]['company_status'][] = $assoc['company_status'];
+ $list[$rate_key]['company_name'][] = $assoc['company_name'];
+ $list[$rate_key]['company_id'][] = $assoc['company_id'];
+ $list[$rate_key]['company_alias'][] = $assoc['company_alias'];
+ $list[$rate_key]['company_email'][] = $assoc['company_email'];
+ $list[$rate_key]['company_tva_intra'][] = $assoc['company_tva_intra'];
+ $list[$rate_key]['company_client'][] = $assoc['company_client'];
+ $list[$rate_key]['company_fournisseur'][] = $assoc['company_fournisseur'];
+ $list[$rate_key]['company_customer_code'][] = $assoc['company_customer_code'];
+ $list[$rate_key]['company_supplier_code'][] = $assoc['company_supplier_code'];
+ $list[$rate_key]['company_customer_accounting_code'][] = $assoc['company_customer_accounting_code'];
+ $list[$rate_key]['company_supplier_accounting_code'][] = $assoc['company_supplier_accounting_code'];
+ $list[$rate_key]['company_status'][] = $assoc['company_status'];
- $list[$assoc['rate']]['facid'][] = $assoc['facid'];
- $list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['rate']]['type'][] = $assoc['type'];
- $list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['rate']]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = $assoc['facid'];
+ $list[$rate_key]['facnum'][] = $assoc['facnum'];
+ $list[$rate_key]['type'][] = $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = $assoc['descr'];
- $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
- $list[$assoc['rate']]['pid'][] = $assoc['pid'];
- $list[$assoc['rate']]['pref'][] = $assoc['pref'];
- $list[$assoc['rate']]['ptype'][] = $assoc['ptype'];
+ $list[$rate_key]['pid'][] = $assoc['pid'];
+ $list[$rate_key]['pref'][] = $assoc['pref'];
+ $list[$rate_key]['ptype'][] = $assoc['ptype'];
- $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
- $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
$rate = $assoc['rate'];
}
@@ -1056,7 +1066,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$sql = '';
// Count on payments date
- $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
+ $sql = "SELECT d.rowid, d.product_type as dtype, e.rowid as facid, d.$f_rate as rate, d.vat_src_code as vat_src_code, d.total_ht as total_ht, d.total_ttc as total_ttc, d.total_tva as total_vat, e.note_private as descr,";
$sql .= " d.total_localtax1 as total_localtax1, d.total_localtax2 as total_localtax2, ";
$sql .= " e.date_debut as date_start, e.date_fin as date_end, e.fk_user_author,";
$sql .= " e.ref as facnum, e.total_ttc as ftotal_ttc, e.date_create, d.fk_c_type_fees as type,";
@@ -1101,55 +1111,60 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$rate = -1;
$oldrowid = '';
while ($assoc = $db->fetch_array($resql)) {
+ $rate_key = $assoc['rate'];
+ if ($f_rate == 'tva_tx' && !empty($assoc['vat_src_code']) && !preg_match('/\(/', $rate_key)) {
+ $rate_key .= ' (' . $assoc['vat_src_code'] . ')';
+ }
+
// Code to avoid warnings when array entry not defined
- if (!isset($list[$assoc['rate']]['totalht'])) {
- $list[$assoc['rate']]['totalht'] = 0;
+ if (!isset($list[$rate_key]['totalht'])) {
+ $list[$rate_key]['totalht'] = 0;
}
- if (!isset($list[$assoc['rate']]['vat'])) {
- $list[$assoc['rate']]['vat'] = 0;
+ if (!isset($list[$rate_key]['vat'])) {
+ $list[$rate_key]['vat'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax1'])) {
- $list[$assoc['rate']]['localtax1'] = 0;
+ if (!isset($list[$rate_key]['localtax1'])) {
+ $list[$rate_key]['localtax1'] = 0;
}
- if (!isset($list[$assoc['rate']]['localtax2'])) {
- $list[$assoc['rate']]['localtax2'] = 0;
+ if (!isset($list[$rate_key]['localtax2'])) {
+ $list[$rate_key]['localtax2'] = 0;
}
if ($assoc['rowid'] != $oldrowid) { // Si rupture sur d.rowid
$oldrowid = $assoc['rowid'];
- $list[$assoc['rate']]['totalht'] += $assoc['total_ht'];
- $list[$assoc['rate']]['vat'] += $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1'] += $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2'] += $assoc['total_localtax2'];
+ $list[$rate_key]['totalht'] += $assoc['total_ht'];
+ $list[$rate_key]['vat'] += $assoc['total_vat'];
+ $list[$rate_key]['localtax1'] += $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2'] += $assoc['total_localtax2'];
}
- $list[$assoc['rate']]['dtotal_ttc'][] = $assoc['total_ttc'];
- $list[$assoc['rate']]['dtype'][] = 'ExpenseReportPayment';
- $list[$assoc['rate']]['datef'][] = $assoc['datef'];
- $list[$assoc['rate']]['company_name'][] = '';
- $list[$assoc['rate']]['company_id'][] = '';
- $list[$assoc['rate']]['user_id'][] = $assoc['fk_user_author'];
- $list[$assoc['rate']]['ddate_start'][] = $db->jdate($assoc['date_start']);
- $list[$assoc['rate']]['ddate_end'][] = $db->jdate($assoc['date_end']);
+ $list[$rate_key]['dtotal_ttc'][] = $assoc['total_ttc'];
+ $list[$rate_key]['dtype'][] = 'ExpenseReportPayment';
+ $list[$rate_key]['datef'][] = $assoc['datef'];
+ $list[$rate_key]['company_name'][] = '';
+ $list[$rate_key]['company_id'][] = '';
+ $list[$rate_key]['user_id'][] = $assoc['fk_user_author'];
+ $list[$rate_key]['ddate_start'][] = $db->jdate($assoc['date_start']);
+ $list[$rate_key]['ddate_end'][] = $db->jdate($assoc['date_end']);
- $list[$assoc['rate']]['facid'][] = $assoc['facid'];
- $list[$assoc['rate']]['facnum'][] = $assoc['facnum'];
- $list[$assoc['rate']]['type'][] = $assoc['type'];
- $list[$assoc['rate']]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
- $list[$assoc['rate']]['descr'][] = $assoc['descr'];
+ $list[$rate_key]['facid'][] = $assoc['facid'];
+ $list[$rate_key]['facnum'][] = $assoc['facnum'];
+ $list[$rate_key]['type'][] = $assoc['type'];
+ $list[$rate_key]['ftotal_ttc'][] = $assoc['ftotal_ttc'];
+ $list[$rate_key]['descr'][] = $assoc['descr'];
- $list[$assoc['rate']]['totalht_list'][] = $assoc['total_ht'];
- $list[$assoc['rate']]['vat_list'][] = $assoc['total_vat'];
- $list[$assoc['rate']]['localtax1_list'][] = $assoc['total_localtax1'];
- $list[$assoc['rate']]['localtax2_list'][] = $assoc['total_localtax2'];
+ $list[$rate_key]['totalht_list'][] = $assoc['total_ht'];
+ $list[$rate_key]['vat_list'][] = $assoc['total_vat'];
+ $list[$rate_key]['localtax1_list'][] = $assoc['total_localtax1'];
+ $list[$rate_key]['localtax2_list'][] = $assoc['total_localtax2'];
- $list[$assoc['rate']]['pid'][] = $assoc['pid'];
- $list[$assoc['rate']]['pref'][] = $assoc['pref'];
- $list[$assoc['rate']]['ptype'][] = 'ExpenseReportPayment';
+ $list[$rate_key]['pid'][] = $assoc['pid'];
+ $list[$rate_key]['pref'][] = $assoc['pref'];
+ $list[$rate_key]['ptype'][] = 'ExpenseReportPayment';
- $list[$assoc['rate']]['payment_id'][] = $assoc['payment_id'];
- $list[$assoc['rate']]['payment_ref'][] = $assoc['payment_ref'];
- $list[$assoc['rate']]['payment_amount'][] = $assoc['payment_amount'];
+ $list[$rate_key]['payment_id'][] = $assoc['payment_id'];
+ $list[$rate_key]['payment_ref'][] = $assoc['payment_ref'];
+ $list[$rate_key]['payment_amount'][] = $assoc['payment_amount'];
$rate = $assoc['rate'];
}
diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php
index 356b9ca6f51..1e3bb99c070 100644
--- a/htdocs/core/modules/modFicheinter.class.php
+++ b/htdocs/core/modules/modFicheinter.class.php
@@ -179,18 +179,11 @@ class modFicheinter extends DolibarrModules
'fd.rowid'=>'InterLineId',
'fd.date'=>"InterLineDate", 'fd.duree'=>"InterLineDuration", 'fd.description'=>"InterLineDesc"
);
- //$this->export_TypeFields_array[$r]=array(
- // 's.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
- // 's.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text',
- // 's.code_compta_fournisseur'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.duree'=>"Duree",'f.fk_statut'=>'Statut','f.description'=>"Text",
- // 'f.datee'=>"Date",'f.dateo'=>"Date",'f.fulldayevent'=>"Boolean",'fd.date'=>"Date",'fd.duree'=>"Duree",'fd.description'=>"Text",
- // 'fd.total_ht'=>"Numeric"
- //);
$this->export_TypeFields_array[$r] = array(
's.rowid'=>"Numeric", 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 's.fk_pays'=>'List:c_country:label', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text',
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.datec'=>"Date",
- 'f.duree'=>"Duree", 'f.fk_statut'=>'Numeric', 'f.description'=>"Text", 'f.datee'=>"Date", 'f.dateo'=>"Date", 'f.fulldayevent'=>"Boolean",
+ 'f.duree'=>"Duree", 'f.fk_statut'=>'Numeric', 'f.description'=>"Text", 'f.datee'=>"Date", 'f.dateo'=>"Date", 'f.fulldayevent'=>"Text",
'pj.ref'=>'Text', 'pj.title'=>'Text',
'fd.rowid'=>"Numeric", 'fd.date'=>"Date", 'fd.duree'=>"Duree", 'fd.description'=>"Text", 'fd.total_ht'=>"Numeric"
);
diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php
index 4696f15019a..29c10ccb3e5 100644
--- a/htdocs/core/modules/modReception.class.php
+++ b/htdocs/core/modules/modReception.class.php
@@ -47,7 +47,7 @@ class modReception extends DolibarrModules
$this->module_position = '40';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this));
- $this->description = "Gestion des réceptions fournisseurs";
+ $this->description = "ReceptionDescription";
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'dolibarr';
diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php
index 4b660e6159a..f77f1dacedf 100644
--- a/htdocs/core/modules/modUser.class.php
+++ b/htdocs/core/modules/modUser.class.php
@@ -239,7 +239,7 @@ class modUser extends DolibarrModules
'u.accountancy_code'=>'Text',
'u.address'=>"Text", 'u.zip'=>"Text", 'u.town'=>"Text",
'u.office_phone'=>'Text', 'u.user_mobile'=>'Text', 'u.office_fax'=>'Text',
- 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.datelastlogin'=>'Date',
+ 'u.email'=>'Text', 'u.datec'=>"Date", 'u.tms'=>"Date", 'u.admin'=>"Boolean", 'u.statut'=>'Status', 'u.note'=>"Text", 'u.signature'=>"Text", 'u.datelastlogin'=>'Date',
'u.fk_user'=>"List:user:login",
'u.birth'=>'Date',
'u.datepreviouslogin'=>'Date', 'u.fk_soc'=>"List:societe:nom:rowid", 'u.fk_member'=>"List:adherent:firstname",
diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php
index d7e9bda13dd..88c1428e8f9 100644
--- a/htdocs/core/tpl/login.tpl.php
+++ b/htdocs/core/tpl/login.tpl.php
@@ -30,11 +30,16 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
+// DDOS protection
+$size = (int) $_SERVER['CONTENT_LENGTH'];
+if ($size > 10000) {
+ http_response_code(413);
+ exit;
+}
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
-
header('Cache-Control: Public, must-revalidate');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
@@ -87,7 +92,7 @@ if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$disablenofollow = 0;
}
-print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 0, $disablenofollow);
+print top_htmlhead('', $titleofloginpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
$colorbackhmenu1 = '60,70,100'; // topmenu
diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php
index d33533a3f97..b61ef22739a 100644
--- a/htdocs/core/tpl/passwordforgotten.tpl.php
+++ b/htdocs/core/tpl/passwordforgotten.tpl.php
@@ -27,6 +27,12 @@ if (empty($conf) || !is_object($conf)) {
exit;
}
+// DDOS protection
+$size = (int) $_SERVER['CONTENT_LENGTH'];
+if ($size > 10000) {
+ http_response_code(413);
+ exit;
+}
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@@ -60,7 +66,18 @@ $php_self = str_replace('action=validatenewpassword', '', $php_self);
$titleofpage = $langs->trans('SendNewPassword');
-print top_htmlhead('', $titleofpage);
+// Javascript code on logon page only to detect user tz, dst_observed, dst_first, dst_second
+$arrayofjs = array();
+
+$disablenofollow = 1;
+if (!preg_match('/'.constant('DOL_APPLICATION_TITLE').'/', $title)) {
+ $disablenofollow = 0;
+}
+if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+ $disablenofollow = 0;
+}
+
+print top_htmlhead('', $titleofpage, 0, 0, $arrayofjs, array(), 1, $disablenofollow);
$colorbackhmenu1 = '60,70,100'; // topmenu
diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php
index e2493a338fd..17fe55d0583 100644
--- a/htdocs/emailcollector/class/emailcollector.class.php
+++ b/htdocs/emailcollector/class/emailcollector.class.php
@@ -2267,6 +2267,14 @@ class EmailCollector extends CommonObject
$errorforactions++;
$this->error = 'Failed to create ticket: '.$langs->trans($tickettocreate->error);
$this->errors = $tickettocreate->errors;
+ } else {
+ if ($attachments) {
+ $destdir = $conf->ticket->dir_output.'/'.$tickettocreate->ref;
+ if (!dol_is_dir($destdir)) {
+ dol_mkdir($destdir);
+ $this->getmsg($connection, $imapemail, $destdir);
+ }
+ }
}
}
}
@@ -2490,9 +2498,10 @@ class EmailCollector extends CommonObject
*
* @param Object $mbox Structure
* @param string $mid prefix
+ * @param string $destdir Target dir for attachments
* @return array Array with number and object
*/
- private function getmsg($mbox, $mid)
+ private function getmsg($mbox, $mid, $destdir = '')
{
// input $mbox = IMAP stream, $mid = message id
// output all the following:
@@ -2513,7 +2522,7 @@ class EmailCollector extends CommonObject
} else {
// multipart: cycle through each part
foreach ($s->parts as $partno0 => $p) {
- $this->getpart($mbox, $mid, $p, $partno0 + 1);
+ $this->getpart($mbox, $mid, $p, $partno0 + 1, $destdir);
}
}
}
@@ -2540,9 +2549,10 @@ class EmailCollector extends CommonObject
* @param string $mid Part no
* @param Object $p Object p
* @param string $partno Partno
+ * @param string $destdir Target dir for attachments
* @return void
*/
- private function getpart($mbox, $mid, $p, $partno)
+ private function getpart($mbox, $mid, $p, $partno, $destdir = '')
{
// $partno = '1', '2', '2.1', '2.1.3', etc for multipart, 0 if simple
global $htmlmsg, $plainmsg, $charset, $attachments;
@@ -2580,6 +2590,38 @@ class EmailCollector extends CommonObject
$filename = ($params['filename']) ? $params['filename'] : $params['name'];
// filename may be encoded, so see imap_mime_header_decode()
$attachments[$filename] = $data; // this is a problem if two files have same name
+
+ // Get file name (with extension)
+ $file_name_complete = $params['filename'];
+
+
+ $destination = $destdir.'/'.$file_name_complete;
+
+ // Extract file extension
+ $extension = pathinfo($file_name_complete, PATHINFO_EXTENSION);
+
+ // Extract file name without extension
+ $file_name = pathinfo($file_name_complete, PATHINFO_FILENAME);
+
+ // Save an original file name variable to track while renaming if file already exists
+ $file_name_original = $file_name;
+
+ // Increment file name by 1
+ $num = 1;
+
+ /**
+ * Check if the same file name already exists in the upload folder,
+ * append increment number to the original filename
+ */
+ while (file_exists($destdir."/" . $file_name . "." . $extension)) {
+ $file_name = (string) $file_name_original . ' (' . $num . ')';
+ $file_name_complete = $file_name . "." . $extension;
+ $destination = $destdir.'/'.$file_name_complete;
+ $num++;
+ }
+
+
+ file_put_contents($destination, $data);
}
// TEXT
diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php
index 93e20b06afe..ae5629b733b 100644
--- a/htdocs/exports/export.php
+++ b/htdocs/exports/export.php
@@ -388,16 +388,17 @@ if ($step == 4 && $action == 'submitFormField') {
$_SESSION["export_filtered_fields"] = array();
foreach ($objexport->array_export_TypeFields[0] as $code => $type) { // $code: s.fieldname $value: Text|Boolean|List:ccc
$newcode = (string) preg_replace('/\./', '_', $code);
- //print 'xxx'.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n ";
+ //print 'xxx '.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n ";
+ $check = 'alphanohtml';
$filterqualified = 1;
- if (!GETPOSTISSET($newcode) || GETPOST($newcode, 'restricthtml') == '') {
+ if (!GETPOSTISSET($newcode) || GETPOST($newcode, $check) == '') {
$filterqualified = 0;
- } elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, 'restricthtml')) && GETPOST($newcode, 'restricthtml') <= 0)) {
+ } elseif (preg_match('/^List/', $type) && (is_numeric(GETPOST($newcode, $check)) && GETPOST($newcode, $check) <= 0)) {
$filterqualified = 0;
}
if ($filterqualified) {
//print 'Filter on '.$newcode.' type='.$type.' value='.$_POST[$newcode]."\n";
- $objexport->array_export_FilterValue[0][$code] = GETPOST($newcode, 'restricthtml');
+ $objexport->array_export_FilterValue[0][$code] = GETPOST($newcode, $check);
}
}
$array_filtervalue = (!empty($objexport->array_export_FilterValue[0]) ? $objexport->array_export_FilterValue[0] : '');
diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php
index abeee1a9e26..f93e51dc850 100644
--- a/htdocs/fourn/commande/dispatch.php
+++ b/htdocs/fourn/commande/dispatch.php
@@ -622,10 +622,11 @@ if ($id > 0 || !empty($ref)) {
// if ($mesg) print $mesg;
print ' ';
- $disabled = 1;
+ /*$disabled = 1;
if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) {
$disabled = 0;
- }
+ }*/
+ $disabled = 0; // This is used to disable or not the bulk selection of target warehouse. No reason to have it disabled so forced to 0.
// Line of orders
if ($object->statut <= CommandeFournisseur::STATUS_ACCEPTED || $object->statut >= CommandeFournisseur::STATUS_CANCELED) {
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index 1c357d8b759..fb53811aeaf 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -7,6 +7,7 @@
* Copyright (C) 2014-2017 Ferran Marcet
* Copyright (C) 2018 Frédéric France
* Copyright (C) 2020-2021 Udo Tamm
+ * Copyright (C) 2022 Anthony Berton
*
* 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
@@ -784,6 +785,12 @@ if (empty($reshook)) {
$result = $object->update($user);
if ($result >= 0 && $oldstatus == Holiday::STATUS_APPROVED) { // holiday was already validated, status 3, so we must increase back the balance
+ // Call trigger
+ $result = $object->call_trigger('HOLIDAY_CANCEL', $user);
+ if ($result < 0) {
+ $error++;
+ }
+
// Calculcate number of days consummed
$nbopenedday = num_open_day($object->date_debut_gmt, $object->date_fin_gmt, 0, 1, $object->halfday);
diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql
index 119a4215f56..d039c285a3e 100644
--- a/htdocs/install/mysql/data/llx_c_action_trigger.sql
+++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql
@@ -9,7 +9,7 @@
-- Copyright (C) 2013 Cedric Gross
-- Copyright (C) 2014 Raphaël Doursenaud
-- Copyright (C) 2015 Bahfir Abbes
--- Copyright (C) 2022 Anthony Berton
+-- Copyright (C) 2021-2022 Anthony Berton
--
-- 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
@@ -166,3 +166,11 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_MODIFY','Task modified','Executed when a project task is modified','project',151);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('TASK_DELETE','Task deleted','Executed when a project task is deleted','project',152);
insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('ACTION_CREATE','Action added','Executed when an action is added to the agenda','agenda',700);
+
+-- oliday
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802);
+insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804);
diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
index 476e63aab68..9af52c8700a 100644
--- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
+++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql
@@ -494,3 +494,10 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_DELETE','User update','Executed when a user is deleted','user',303);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_NEW_PASSWORD','User update','Executed when a user is change password','user',304);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('USER_ENABLEDISABLE','User update','Executed when a user is enable or disable','user',305);
+
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CREATE','Holiday created','Executed when a holiday is created','holiday',800);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Holiday modified','Executed when a holiday is modified','holiday',801);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_VALIDATE','Holiday validated','Executed when a holiday is validated','holiday',802);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_APPROVE','Holiday aprouved','Executed when a holiday is aprouved','holiday',803);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_CANCEL','Holiday canceled','Executed when a holiday is canceled','holiday',802);
+INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_DELETE','Holiday deleted','Executed when a holiday is deleted','holiday',804);
diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
index 48292523326..9a903fdf4eb 100644
--- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
+++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql
@@ -87,3 +87,10 @@ INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) value
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_REPORT_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',202);
INSERT INTO llx_c_action_trigger (code,label,description,elementtype,rang) values ('HOLIDAY_MODIFY','Expense report modified','Executed when an expense report is modified','expensereport',212);
+
+CREATE TABLE llx_stock_mouvement_extrafields (
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_object integer NOT NULL,
+ import_key varchar(14)
+)ENGINE=innodb;
diff --git a/htdocs/install/mysql/tables/llx_stock_mouvement_extrafields.sql b/htdocs/install/mysql/tables/llx_stock_mouvement_extrafields.sql
new file mode 100644
index 00000000000..c13218b631e
--- /dev/null
+++ b/htdocs/install/mysql/tables/llx_stock_mouvement_extrafields.sql
@@ -0,0 +1,24 @@
+-- ===================================================================
+-- Copyright (C) 2022 Salvatore Chiariello
+--
+-- 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 .
+--
+-- ===================================================================
+
+CREATE TABLE llx_stock_mouvement_extrafields (
+ rowid integer AUTO_INCREMENT PRIMARY KEY,
+ tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ fk_object integer NOT NULL,
+ import_key varchar(14)
+)ENGINE=innodb;
\ No newline at end of file
diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php
index c03678151fc..e58ae528f97 100644
--- a/htdocs/install/upgrade.php
+++ b/htdocs/install/upgrade.php
@@ -309,8 +309,8 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
$filelist = array();
$i = 0;
$ok = 0;
- $from = '^'.$newversionfrom;
- $to = $newversionto.'\.sql$';
+ $from = '^'.preg_quote($newversionfrom, '/');
+ $to = preg_quote($newversionto.'.sql', '/').'$';
// Get files list
$filesindir = array();
@@ -328,9 +328,9 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
// Define which file to run
foreach ($filesindir as $file) {
- if (preg_match('/'.$from.'/i', $file)) {
+ if (preg_match('/'.$from.'\-/i', $file)) {
$filelist[] = $file;
- } elseif (preg_match('/'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
+ } elseif (preg_match('/\-'.$to.'/i', $file)) { // First test may be false if we migrate from x.y.* to x.y.*
$filelist[] = $file;
}
}
diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang
index 44cb183050a..a1046827559 100644
--- a/htdocs/langs/en_US/blockedlog.lang
+++ b/htdocs/langs/en_US/blockedlog.lang
@@ -52,3 +52,6 @@ BlockedLogDisableNotAllowedForCountry=List of countries where usage of this modu
OnlyNonValid=Non-valid
TooManyRecordToScanRestrictFilters=Too many records to scan/analyze. Please restrict list with more restrictive filters.
RestrictYearToExport=Restrict month / year to export
+BlockedLogEnabled=System to track events into unalterable logs has been enabled
+BlockedLogDisabled=System to track events into unalterable logs has been disabled after some recording were done. We saved a special Fingerprint to track the chain as broken
+BlockedLogDisabledBis=System to track events into unalterable logs has been disabled. This is possible because no record were done yet.
\ No newline at end of file
diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang
index 3f1aac53340..74bed0d9186 100644
--- a/htdocs/langs/en_US/mrp.lang
+++ b/htdocs/langs/en_US/mrp.lang
@@ -27,7 +27,7 @@ ConfirmCloneBillOfMaterials=Are you sure you want to clone the bill of materials
ConfirmCloneMo=Are you sure you want to clone the Manufacturing Order %s ?
ManufacturingEfficiency=Manufacturing efficiency
ConsumptionEfficiency=Consumption efficiency
-ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the production
+ValueOfMeansLoss=Value of 0.95 means an average of 5%% of loss during the manufacturing or the disassembly
ValueOfMeansLossForProductProduced=Value of 0.95 means an average of 5%% of loss of produced product
DeleteBillOfMaterials=Delete Bill Of Materials
DeleteMo=Delete Manufacturing Order
diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang
index a8942bd337f..14715670882 100644
--- a/htdocs/langs/en_US/products.lang
+++ b/htdocs/langs/en_US/products.lang
@@ -410,3 +410,4 @@ DefaultBOMDesc=The default BOM recommended to use to manufacture this product. T
Rank=Rank
SwitchOnSaleStatus=Switch on sale status
SwitchOnPurchaseStatus=Switch on purchase status
+StockMouvementExtraFields= Extra Fields (stock mouvement)
diff --git a/htdocs/langs/en_US/receptions.lang b/htdocs/langs/en_US/receptions.lang
index d9e8bdeebb7..3d69873c5fc 100644
--- a/htdocs/langs/en_US/receptions.lang
+++ b/htdocs/langs/en_US/receptions.lang
@@ -1,5 +1,6 @@
# Dolibarr language file - Source file is en_US - receptions
-ReceptionsSetup=Product Reception setup
+ReceptionDescription=Vendor reception management (Create reception documents)
+ReceptionsSetup=Vendor Reception setup
RefReception=Ref. reception
Reception=Reception
Receptions=Receptions
diff --git a/htdocs/langs/it_IT/products.lang b/htdocs/langs/it_IT/products.lang
index f33ca8759bf..f5b9043b4e8 100644
--- a/htdocs/langs/it_IT/products.lang
+++ b/htdocs/langs/it_IT/products.lang
@@ -410,3 +410,4 @@ DefaultBOMDesc=The default BOM recommended to use to manufacture this product. T
Rank=Rank
SwitchOnSaleStatus=Switch on sale status
SwitchOnPurchaseStatus=Switch on purchase status
+StockMouvementExtraFields= Campi extra (movimenti scorte)
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index fd811877295..4b5c851adf0 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1404,11 +1404,11 @@ function top_httphead($contenttype = 'text/html', $forcenocache = 0)
* @param int $disablehead Disable head output
* @param array $arrayofjs Array of complementary js files
* @param array $arrayofcss Array of complementary css files
- * @param int $disablejmobile Disable jmobile (No more used)
+ * @param int $disableforlogin Do not load heavy js and css for login pages
* @param int $disablenofollow Disable no follow tag
* @return void
*/
-function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $disablejmobile = 0, $disablenofollow = 0)
+function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $disableforlogin = 0, $disablenofollow = 0)
{
global $db, $conf, $langs, $user, $mysoc, $hookmanager;
@@ -1646,15 +1646,16 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
} else {
print ''."\n";
}
- if (!defined('DISABLE_JQUERY_TABLEDND')) {
- print ''."\n";
- }
// jQuery jnotify
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
print ''."\n";
}
+ // Table drag and drop lines
+ if (empty($disableforlogin) && !defined('DISABLE_JQUERY_TABLEDND')) {
+ print ''."\n";
+ }
// Chart
- if ((empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'chart') && !defined('DISABLE_JS_GRAPH')) {
+ if (empty($disableforlogin) && (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'chart') && !defined('DISABLE_JS_GRAPH')) {
print ''."\n";
}
@@ -1694,7 +1695,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
if (!$disablejs && !empty($conf->use_javascript_ajax)) {
// CKEditor
- if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) {
+ if (empty($disableforlogin) && (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) {
print ''."\n";
$pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/';
$jsckeditor = 'ckeditor.js';
@@ -2073,24 +2074,24 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$dropdownBody .= '';
diff --git a/htdocs/product/admin/stock_mouvement_extrafields.php b/htdocs/product/admin/stock_mouvement_extrafields.php
new file mode 100644
index 00000000000..23e5aadc9cc
--- /dev/null
+++ b/htdocs/product/admin/stock_mouvement_extrafields.php
@@ -0,0 +1,123 @@
+
+ * Copyright (C) 2003 Jean-Louis Bergamo
+ * Copyright (C) 2004-2011 Laurent Destailleur
+ * Copyright (C) 2012 Regis Houssin
+ * Copyright (C) 2014 Florian Henry
+ * Copyright (C) 2015 Jean-François Ferry
+ *
+ * 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 .
+ */
+
+/**
+ * \file htdocs/product/admin/stock_mouvement_extrafields.php
+ * \ingroup stock
+ * \brief Page to setup extra fields of stock mouvement
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+// Try main.inc.php using relative path
+if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
+if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
+if (!$res) die("Include of main fails");
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('stock@stock', 'admin'));
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val);
+
+$action = GETPOST('action', 'aZ09');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield
+
+if (!$user->admin) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+
+llxHeader('', $langs->trans("StockSetup"), $help_url);
+
+
+$linkback = ''.$langs->trans("BackToModuleList").' ';
+print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup');
+
+
+$head = stock_admin_prepare_head();
+
+print dol_get_fiche_head($head, 'stockMouvementAttributes', $langs->trans("StockMouvementExtraFields"), -1, 'account');
+
+require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
+
+print dol_get_fiche_end();
+
+
+// Buttons
+if ($action != 'create' && $action != 'edit') {
+ print '";
+}
+
+
+/*
+ * Creation of an optional field
+ */
+if ($action == 'create') {
+ print '
';
+ print load_fiche_titre($langs->trans('NewAttribute'));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+/*
+ * Edition of an optional field
+ */
+if ($action == 'edit' && !empty($attrname)) {
+ print " ";
+ print load_fiche_titre($langs->trans("FieldEdition", $attrname));
+
+ require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index 420203eedae..64c6b6817bd 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1870,40 +1870,40 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
// Brut Weight
print ''.$langs->trans("Weight").' ';
- print ' ';
- print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
+ print ' ';
+ print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units') : $object->weight_units, 0, 2);
print ' ';
}
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
// Brut Length
print ''.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").' ';
- print ' x';
- print ' x';
- print ' ';
- print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2);
+ print ' x';
+ print ' x';
+ print ' ';
+ print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units, 0, 2);
print ' ';
}
if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) {
// Brut Surface
print ''.$langs->trans("Surface").' ';
- print ' ';
- print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2);
+ print ' ';
+ print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units, 0, 2);
print ' ';
}
if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) {
// Brut Volume
print ''.$langs->trans("Volume").' ';
- print ' ';
- print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2);
+ print ' ';
+ print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units') : $object->volume_units, 0, 2);
print ' ';
}
if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) {
// Net Measure
print ''.$langs->trans("NetMeasure").' ';
- print ' ';
- print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0);
+ print ' ';
+ print $formproduct->selectMeasuringUnits("net_measure_units", "", GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units') : $object->net_measure_units, 0, 0);
print ' ';
}
}
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 457da877ee9..bac6c958d24 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -655,11 +655,13 @@ class FormProduct
}
foreach ($productIdArray as $productId) {
- foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
- if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
- $label = $arraytypes['entrepot_label'].' - ';
- $label .= $arraytypes['batch'];
- $out .= ''.$arraytypes['batch'].' ';
+ if (array_key_exists($productId, $this->cache_lot)) {
+ foreach ($this->cache_lot[$productId] as $id => $arraytypes) {
+ if (empty($fk_entrepot) || $fk_entrepot == $arraytypes['entrepot_id']) {
+ $label = $arraytypes['entrepot_label'] . ' - ';
+ $label .= $arraytypes['batch'];
+ $out .= '' . $arraytypes['batch'] . ' ';
+ }
}
}
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index ec9494e77b0..5db23396a1c 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -860,6 +860,8 @@ class Product extends CommonObject
*/
public function verify()
{
+ global $langs;
+
$this->errors = array();
$result = 0;
@@ -870,6 +872,15 @@ class Product extends CommonObject
$result = -2;
}
+ $arrayofnonnegativevalue = array('weight'=>'Weight', 'width'=>'Width', 'height'=>'Height', 'length'=>'Length', 'surface'=>'Surface', 'volume'=>'Volume');
+ foreach ($arrayofnonnegativevalue as $key => $value) {
+ if (property_exists($this, $key) && $this->$key < 0) {
+ $langs->load("other");
+ $this->errors[] = $langs->trans("FieldCannotBeNegative", $langs->transnoentitiesnoconv($value));
+ $result = -4;
+ }
+ }
+
$rescode = $this->check_barcode($this->barcode, $this->barcode_type_code);
if ($rescode) {
if ($rescode == -1) {
@@ -5120,9 +5131,10 @@ class Product extends CommonObject
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct)
- * @return int <0 if KO, >0 if OK
+ * @param array $extrafields Array of extrafields
+ * @return int <0 if KO, >0 if OK
*/
- public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0)
+ public function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null)
{
// phpcs:enable
if ($id_entrepot) {
@@ -5145,6 +5157,11 @@ class Product extends CommonObject
$result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode, '', '', '', '', false, 0, $disablestockchangeforsubproduct);
if ($result >= 0) {
+ if ($extrafields) {
+ $array_options = $extrafields->getOptionalsFromPost('stock_mouvement');
+ $movementstock->array_options = $array_options;
+ $movementstock->insertExtraFields();
+ }
$this->db->commit();
return 1;
} else {
@@ -5174,9 +5191,10 @@ class Product extends CommonObject
* @param string $origin_element Origin element type
* @param int $origin_id Origin id of element
* @param int $disablestockchangeforsubproduct Disable stock change for sub-products of kit (usefull only if product is a subproduct)
+ * @param array $extrafields Array of extrafields
* @return int <0 if KO, >0 if OK
*/
- public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0)
+ public function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label = '', $price = 0, $dlc = '', $dluo = '', $lot = '', $inventorycode = '', $origin_element = '', $origin_id = null, $disablestockchangeforsubproduct = 0, $extrafields = null)
{
// phpcs:enable
if ($id_entrepot) {
@@ -5199,6 +5217,11 @@ class Product extends CommonObject
$result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode, '', $dlc, $dluo, $lot, false, 0, $disablestockchangeforsubproduct);
if ($result >= 0) {
+ if ($extrafields) {
+ $array_options = $extrafields->getOptionalsFromPost('stock_mouvement');
+ $movementstock->array_options = $array_options;
+ $movementstock->insertExtraFields();
+ }
$this->db->commit();
return 1;
} else {
diff --git a/htdocs/product/price.php b/htdocs/product/price.php
index d21574e696e..45ecbd9bafa 100644
--- a/htdocs/product/price.php
+++ b/htdocs/product/price.php
@@ -1278,22 +1278,30 @@ if (!$action || $action == 'delete' || $action == 'showlog_customer_price' || $a
if (empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '';
+ } else {
+ print '' . $langs->trans("UpdateDefaultPrice") . '
';
}
}
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '';
+ } else {
+ print '' . $langs->trans("AddCustomerPrice") . '
';
}
}
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '';
+ } else {
+ print '' . $langs->trans("UpdateVAT") . '
';
}
if ($user->rights->produit->creer || $user->rights->service->creer) {
print '';
+ } else {
+ print '' . $langs->trans("UpdateLevelPrices") . '
';
}
}
}
diff --git a/htdocs/product/reassort.php b/htdocs/product/reassort.php
index 62bfd626f82..23258aa1e86 100644
--- a/htdocs/product/reassort.php
+++ b/htdocs/product/reassort.php
@@ -39,14 +39,14 @@ $action = GETPOST('action', 'aZ09');
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
-$type = GETPOST("type", "int");
+$type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT;
$search_barcode = GETPOST("search_barcode", 'alpha');
-$catid = GETPOST('catid', 'int');
$toolowstock = GETPOST('toolowstock');
$tosell = GETPOST("tosell");
$tobuy = GETPOST("tobuy");
$fourn_id = GETPOST("fourn_id", 'int');
$sbarcode = GETPOST("sbarcode", 'int');
+$search_stock_physique = GETPOST('search_stock_physique', 'alpha');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@@ -68,7 +68,11 @@ $offset = $limit * $page;
// Load sale and categ filters
$search_sale = GETPOST("search_sale");
-$search_categ = GETPOST("search_categ");
+if (GETPOSTISSET('catid')) {
+ $search_categ = GETPOST('catid', 'int');
+} else {
+ $search_categ = GETPOST('search_categ', 'int');
+}
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas = GETPOST("canvas");
@@ -111,11 +115,10 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$tobuy = "";
$search_sale = "";
$search_categ = "";
- $type = "";
- $catid = '';
$toolowstock = '';
$fourn_id = '';
$sbarcode = '';
+ $search_stock_physique = '';
}
@@ -146,13 +149,22 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid A
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
}
-// We'll need this table joined to the select in order to filter by categ
-if ($search_categ) {
- $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
-}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
-if ($search_categ) {
- $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
+if (!empty($search_categ) && $search_categ != '-1') {
+ $sql .= " AND ";
+ if ($search_categ == -2) {
+ $sql .= " NOT EXISTS ";
+ } else {
+ $sql .= " EXISTS ";
+ }
+ $sql .= "(";
+ $sql .= " SELECT cp.fk_categorie, cp.fk_product";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp";
+ $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ
+ if ($search_categ > 0) {
+ $sql .= " AND cp.fk_categorie = " . ((int) $search_categ);
+ }
+ $sql .= ")";
}
if ($sall) {
$sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
@@ -183,24 +195,32 @@ if (!empty($tobuy)) {
if (!empty($canvas)) {
$sql .= " AND p.canvas = '".$db->escape($canvas)."'";
}
-if ($catid > 0) {
- $sql .= " AND cp.fk_categorie = ".((int) $catid);
-}
if ($fourn_id > 0) {
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
}
-// Insert categ filter
-if ($search_categ > 0) {
- $sql .= " AND cp.fk_categorie = ".((int) $search_categ);
-}
$sql .= " GROUP BY p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,";
$sql .= " p.fk_product_type, p.tms, p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock";
// Add fields from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
+$sql_having = '';
if ($toolowstock) {
- $sql .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
+ $sql_having .= " HAVING SUM(".$db->ifsql('s.reel IS NULL', '0', 's.reel').") < p.seuil_stock_alerte";
+}
+if ($search_stock_physique != '') {
+ //$natural_search_physique = natural_search('HAVING SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
+ $natural_search_physique = natural_search('SUM(' . $db->ifsql('s.reel IS NULL', '0', 's.reel') . ')', $search_stock_physique, 1, 1);
+ $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
+ if (!empty($sql_having)) {
+ $sql_having .= " AND";
+ } else {
+ $sql_having .= " HAVING";
+ }
+ $sql_having .= $natural_search_physique;
+}
+if (!empty($sql_having)) {
+ $sql .= $sql_having;
}
$sql .= $db->order($sortfield, $sortorder);
@@ -253,7 +273,7 @@ if ($resql) {
if ($tobuy) {
$param .= "&tobuy=".urlencode($tobuy);
}
- if ($type) {
+ if ($type != '') {
$param .= "&type=".urlencode($type);
}
if ($fourn_id) {
@@ -268,7 +288,7 @@ if ($resql) {
if ($search_sale) {
$param .= "&search_sale=".urlencode($search_sale);
}
- if ($search_categ) {
+ if (!empty($search_categ) && $search_categ != '-1') {
$param .= "&search_categ=".urlencode($search_categ);
}
if ($toolowstock) {
@@ -277,8 +297,8 @@ if ($resql) {
if ($sbarcode) {
$param .= "&sbarcode=".urlencode($sbarcode);
}
- if ($catid) {
- $param .= "&catid=".urlencode($catid);
+ if ($search_stock_physique) {
+ $param .= '&search_stock_physique=' . urlencode($search_stock_physique);
}
llxHeader("", $texte, $helpurl);
@@ -292,10 +312,10 @@ if ($resql) {
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'product', 0, '', '', $limit);
- if (!empty($catid)) {
+ if ($search_categ > 0) {
print "";
$c = new Categorie($db);
- $c->fetch($catid);
+ $c->fetch($search_categ);
$ways = $c->print_all_ways(' > ', 'product/reassort.php');
print " > ".$ways[0]." \n";
print "
";
@@ -306,7 +326,7 @@ if ($resql) {
if (!empty($conf->categorie->enabled)) {
$moreforfilter .= '';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
- $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ');
+ $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1);
$moreforfilter .= '
';
}
@@ -323,32 +343,6 @@ if ($resql) {
print '';
}
- $param = '';
- if ($tosell) {
- $param .= "&tosell=".urlencode($tosell);
- }
- if ($tobuy) {
- $param .= "&tobuy=".urlencode($tobuy);
- }
- if ($type) {
- $param .= "&type=".urlencode($type);
- }
- if ($fourn_id) {
- $param .= "&fourn_id=".urlencode($fourn_id);
- }
- if ($snom) {
- $param .= "&snom=".urlencode($snom);
- }
- if ($sref) {
- $param .= "&sref=".urlencode($sref);
- }
- if ($toolowstock) {
- $param .= "&toolowstock=".urlencode($toolowstock);
- }
- if ($search_categ) {
- $param .= "&search_categ=".urlencode($search_categ);
- }
-
$formProduct = new FormProduct($db);
$formProduct->loadWarehouses();
$warehouses_list = $formProduct->cache_warehouses;
@@ -378,7 +372,10 @@ if ($resql) {
// Stock limit
print ' ';
print ' ';
- print ' ';
+ // Physical stock
+ print '';
+ print ' ';
+ print ' ';
if ($virtualdiffersfromphysical) {
print ' ';
}
@@ -396,14 +393,14 @@ if ($resql) {
//Line for column titles
print "";
- print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder);
- print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder);
+ print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder);
+ print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder);
if (!empty($conf->service->enabled) && $type == 1) {
- print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", '', $param, "", $sortfield, $sortorder, 'center ');
}
- print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", $param, "", '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock", $param, "", '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("StockLimit", $_SERVER["PHP_SELF"], "p.seuil_stock_alerte", '', $param, "", $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock", '', $param, "", $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", '', $param, "", $sortfield, $sortorder, 'right ');
// Details per warehouse
if (!empty($conf->global->STOCK_DETAIL_ON_WAREHOUSE)) { // TODO This should be moved into the selection of fields on page product/list (page product/stock will be removed and replaced with product/list with its own context)
if ($nb_warehouse > 1) {
@@ -413,15 +410,15 @@ if ($resql) {
}
}
if ($virtualdiffersfromphysical) {
- print_liste_field_titre("VirtualStock", $_SERVER["PHP_SELF"], "", $param, "", '', $sortfield, $sortorder, 'right ', 'VirtualStockDesc');
+ print_liste_field_titre("VirtualStock", $_SERVER["PHP_SELF"], "", '', $param, "", $sortfield, $sortorder, 'right ', 'VirtualStockDesc');
}
// Units
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
- print_liste_field_titre("Unit", $_SERVER["PHP_SELF"], "unit_short", $param, "", 'align="right"', $sortfield, $sortorder);
+ print_liste_field_titre("Unit", $_SERVER["PHP_SELF"], "unit_short", '', $param, 'align="right"', $sortfield, $sortorder);
}
print_liste_field_titre('');
- print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", $param, "", '', $sortfield, $sortorder, 'right ');
- print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", $param, "", '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("ProductStatusOnSell", $_SERVER["PHP_SELF"], "p.tosell", '', $param, "", $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("ProductStatusOnBuy", $_SERVER["PHP_SELF"], "p.tobuy", '', $param, "", $sortfield, $sortorder, 'right ');
// Hook fields
$parameters = array('param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php
index 2bd62b2ce22..c5463e3e4e2 100644
--- a/htdocs/product/reassortlot.php
+++ b/htdocs/product/reassortlot.php
@@ -41,16 +41,16 @@ $action = GETPOST('action', 'aZ09');
$sref = GETPOST("sref", 'alpha');
$snom = GETPOST("snom", 'alpha');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
-$type = GETPOST("type", "int");
+$type = GETPOSTISSET('type') ? GETPOST('type', 'int') : Product::TYPE_PRODUCT;
$search_barcode = GETPOST("search_barcode", 'alpha');
$search_warehouse = GETPOST('search_warehouse', 'alpha');
$search_batch = GETPOST('search_batch', 'alpha');
-$catid = GETPOST('catid', 'int');
$toolowstock = GETPOST('toolowstock');
$tosell = GETPOST("tosell");
$tobuy = GETPOST("tobuy");
$fourn_id = GETPOST("fourn_id", 'int');
$sbarcode = GETPOST("sbarcode", 'int');
+$search_stock_physique = GETPOST('search_stock_physique', 'alpha');
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
@@ -72,7 +72,11 @@ $offset = $limit * $page;
// Load sale and categ filters
$search_sale = GETPOST("search_sale");
-$search_categ = GETPOST("search_categ");
+if (GETPOSTISSET('catid')) {
+ $search_categ = GETPOST('catid', 'int');
+} else {
+ $search_categ = GETPOST('search_categ', 'int');
+}
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
$canvas = GETPOST("canvas");
@@ -102,13 +106,12 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$tobuy = "";
$search_sale = "";
$search_categ = "";
- $type = "";
- $catid = '';
$toolowstock = '';
$search_batch = '';
$search_warehouse = '';
$fourn_id = '';
$sbarcode = '';
+ $search_stock_physique = '';
}
@@ -135,13 +138,22 @@ $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as ps on p.rowid = ps.fk_pro
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e on ps.fk_entrepot = e.rowid'; // Link on unique key
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_batch as pb on pb.fk_product_stock = ps.rowid'; // Detail for each lot on each warehouse
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowid AND pl.batch = pb.batch'; // Link on unique key
-// We'll need this table joined to the select in order to filter by categ
-if ($search_categ > 0) {
- $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
-}
$sql .= " WHERE p.entity IN (".getEntity('product').")";
-if ($search_categ > 0) {
- $sql .= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
+if (!empty($search_categ) && $search_categ != '-1') {
+ $sql .= " AND ";
+ if ($search_categ == -2) {
+ $sql .= " NOT EXISTS ";
+ } else {
+ $sql .= " EXISTS ";
+ }
+ $sql .= "(";
+ $sql .= " SELECT cp.fk_categorie, cp.fk_product";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_product as cp";
+ $sql .= " WHERE cp.fk_product = p.rowid"; // Join for the needed table to filter by categ
+ if ($search_categ > 0) {
+ $sql .= " AND cp.fk_categorie = " . ((int) $search_categ);
+ }
+ $sql .= ")";
}
if ($sall) {
$sql .= natural_search(array('p.ref', 'p.label', 'p.description', 'p.note'), $sall);
@@ -172,16 +184,9 @@ if (!empty($tobuy)) {
if (!empty($canvas)) {
$sql .= " AND p.canvas = '".$db->escape($canvas)."'";
}
-if ($catid > 0) {
- $sql .= " AND cp.fk_categorie = ".((int) $catid);
-}
if ($fourn_id > 0) {
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".((int) $fourn_id);
}
-// Insert categ filter
-if ($search_categ > 0) {
- $sql .= " AND cp.fk_categorie = ".((int) $search_categ);
-}
if ($search_warehouse) {
$sql .= natural_search("e.ref", $search_warehouse);
}
@@ -195,8 +200,22 @@ $sql .= " ps.fk_entrepot,";
$sql .= " e.ref, e.lieu, e.fk_parent,";
$sql .= " pb.batch, pb.eatby, pb.sellby,";
$sql .= " pl.rowid, pl.eatby, pl.sellby";
+$sql_having = '';
if ($toolowstock) {
- $sql .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
+ $sql_having .= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet
+}
+if ($search_stock_physique != '') {
+ $natural_search_physique = natural_search('SUM(' . $db->ifsql('pb.qty IS NULL', '0', 'pb.qty') . ')', $search_stock_physique, 1, 1);
+ $natural_search_physique = " " . substr($natural_search_physique, 1, -1); // remove first "(" and last ")" characters
+ if (!empty($sql_having)) {
+ $sql_having .= " AND";
+ } else {
+ $sql_having .= " HAVING";
+ }
+ $sql_having .= $natural_search_physique;
+}
+if (!empty($sql_having)) {
+ $sql .= $sql_having;
}
$sql .= $db->order($sortfield, $sortorder);
@@ -248,7 +267,7 @@ if ($resql) {
if ($tobuy) {
$param .= "&tobuy=".urlencode($tobuy);
}
- if ($type) {
+ if ($type != '') {
$param .= "&type=".urlencode($type);
}
if ($fourn_id) {
@@ -269,18 +288,18 @@ if ($resql) {
if ($search_warehouse) {
$param .= "&search_warehouse=".urlencode($search_warehouse);
}
- if ($catid) {
- $param .= "&catid=".urlencode($catid);
- }
if ($toolowstock) {
$param .= "&toolowstock=".urlencode($toolowstock);
}
if ($search_sale) {
$param .= "&search_sale=".urlencode($search_sale);
}
- if ($search_categ > 0) {
+ if (!empty($search_categ) && $search_categ != '-1') {
$param .= "&search_categ=".urlencode($search_categ);
}
+ if ($search_stock_physique) {
+ $param .= '&search_stock_physique=' . urlencode($search_stock_physique);
+ }
/*if ($eatby) $param.="&eatby=".$eatby;
if ($sellby) $param.="&sellby=".$sellby;*/
@@ -295,10 +314,10 @@ if ($resql) {
print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'product', 0, '', '', $limit, 0, 0, 1);
- if (!empty($catid)) {
+ if ($search_categ > 0) {
print "";
$c = new Categorie($db);
- $c->fetch($catid);
+ $c->fetch($search_categ);
$ways = $c->print_all_ways(' > ', 'product/reassortlot.php');
print " > ".$ways[0]." \n";
print "
";
@@ -309,7 +328,7 @@ if ($resql) {
if (!empty($conf->categorie->enabled)) {
$moreforfilter .= '';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"');
- $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ');
+ $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1);
$moreforfilter .= '
';
}
//$moreforfilter.=$langs->trans("StockTooLow").' ';
@@ -342,14 +361,17 @@ if ($resql) {
}
print ' ';
print ' ';
- print ' ';
- print ' ';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print ' ';
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print ' ';
}
+ // Physical stock
+ print '';
+ print ' ';
+ print ' ';
+ print ' ';
print ' ';
print ' ';
print '';
@@ -360,21 +382,21 @@ if ($resql) {
//Line for column titles
print " ";
- print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", $param, "", "", $sortfield, $sortorder);
- print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", $param, "", "", $sortfield, $sortorder);
+ print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "p.ref", '', $param, "", $sortfield, $sortorder);
+ print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "p.label", '', $param, "", $sortfield, $sortorder);
if (!empty($conf->service->enabled) && $type == 1) {
- print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", $param, "", '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("Duration", $_SERVER["PHP_SELF"], "p.duration", '', $param, "", $sortfield, $sortorder, 'center ');
}
- print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", $param, "", '', $sortfield, $sortorder);
+ print_liste_field_titre("Warehouse", $_SERVER["PHP_SELF"], "e.ref", '', $param, "", $sortfield, $sortorder);
//print_liste_field_titre("DesiredStock", $_SERVER["PHP_SELF"], "p.desiredstock",$param,"",'',$sortfield,$sortorder, 'right );
- print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", $param, "", '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("Batch", $_SERVER["PHP_SELF"], "pb.batch", '', $param, "", $sortfield, $sortorder, 'center ');
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
- print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", $param, "", '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("SellByDate", $_SERVER["PHP_SELF"], "pb.sellby", '', $param, "", $sortfield, $sortorder, 'center ');
}
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
- print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", $param, "", '', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre("EatByDate", $_SERVER["PHP_SELF"], "pb.eatby", '', $param, "", $sortfield, $sortorder, 'center ');
}
- print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", $param, "", '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("PhysicalStock", $_SERVER["PHP_SELF"], "stock_physique", '', $param, "", $sortfield, $sortorder, 'right ');
// TODO Add info of running suppliers/customers orders
//print_liste_field_titre("TheoreticalStock",$_SERVER["PHP_SELF"], "stock_theorique",$param,"",'',$sortfield,$sortorder, 'right ');
print_liste_field_titre('');
diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php
index 405528a3480..73c6751262a 100644
--- a/htdocs/product/stock/movement_list.php
+++ b/htdocs/product/stock/movement_list.php
@@ -139,6 +139,9 @@ $arrayfields = array(
//'m.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
//'m.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500)
);
+
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
+
if (!empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
unset($arrayfields['pl.sellby']);
}
@@ -381,7 +384,9 @@ if ($action == "correct_stock") {
$batch,
GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
- $origin_id
+ $origin_id,
+ 0,
+ $extrafields
); // We do not change value of stock for a correction
} else {
$result = $product->correct_stock(
@@ -393,7 +398,9 @@ if ($action == "correct_stock") {
price2num(GETPOST('unitprice'), 'MT'),
GETPOST('inventorycode', 'alphanohtml'),
$origin_element,
- $origin_id
+ $origin_id,
+ 0,
+ $extrafields
); // We do not change value of stock for a correction
}
@@ -500,7 +507,11 @@ if ($action == "transfert_stock" && !$cancel) {
$eatby,
$sellby,
$batch,
- GETPOST('inventorycode')
+ GETPOST('inventorycode'),
+ '',
+ null,
+ 0,
+ $extrafields
);
// Add stock
$result2 = $product->correct_stock_batch(
@@ -513,7 +524,11 @@ if ($action == "transfert_stock" && !$cancel) {
$eatby,
$sellby,
$batch,
- GETPOST('inventorycode', 'alphanohtml')
+ GETPOST('inventorycode', 'alphanohtml'),
+ '',
+ null,
+ 0,
+ $extrafields
);
}
} else {
@@ -525,7 +540,11 @@ if ($action == "transfert_stock" && !$cancel) {
1,
GETPOST("label", 'san_alpha'),
$pricesrc,
- GETPOST('inventorycode', 'alphanohtml')
+ GETPOST('inventorycode', 'alphanohtml'),
+ '',
+ null,
+ 0,
+ $extrafields
);
// Add stock
@@ -536,7 +555,11 @@ if ($action == "transfert_stock" && !$cancel) {
0,
GETPOST("label", 'san_alpha'),
$pricedest,
- GETPOST('inventorycode', 'alphanohtml')
+ GETPOST('inventorycode', 'alphanohtml'),
+ '',
+ null,
+ 0,
+ $extrafields
);
}
if (!$error && $result1 >= 0 && $result2 >= 0) {
@@ -1434,6 +1457,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
}
// Extra fields
+ $object = $movement;
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
// Fields from hook
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
diff --git a/htdocs/product/stock/tpl/extrafields_add.tpl.php b/htdocs/product/stock/tpl/extrafields_add.tpl.php
new file mode 100644
index 00000000000..62921f0a6e0
--- /dev/null
+++ b/htdocs/product/stock/tpl/extrafields_add.tpl.php
@@ -0,0 +1,51 @@
+
+ * Copyright (C) 2014 Juanjo Menent
+ *
+ * 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 .
+ *
+ * Need to have following variables defined:
+ * $object (invoice, order, ...)
+ * $action
+ * $conf
+ * $langs
+ *
+ * $parameters
+ * $cols
+ */
+
+// Protection to avoid direct call of template
+if (empty($conf) || !is_object($conf)) {
+ print "Error, template page can't be called as URL";
+ exit;
+}
+
+?>
+
+executeHooks('formObjectOptions', $parameters, $movement, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+if (empty($reshook)) {
+ $params = array();
+ if (isset($tpl_context)) $params['tpl_context'] = $tpl_context;
+ $params['cols'] = $parameters['colspanvalue'];
+ print $movement->showOptionals($extrafields, 'create', $params);
+}
+
+?>
+
diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php
index 00699b95e18..eb84df7d14e 100644
--- a/htdocs/product/stock/tpl/stockcorrection.tpl.php
+++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php
@@ -179,6 +179,9 @@ print '\n";
exec('cat /test.txt; ls /dev/std*; sleep 1;', $out, $ret);
print $ret." \n";
print_r($out);
+print ' ';
print ' '."\n";
+
print "*** TRY TO RUN CLAMDSCAN \n";
$ret = 0;
diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php
index e9dc03d7571..2d7c46e0c85 100644
--- a/htdocs/reception/card.php
+++ b/htdocs/reception/card.php
@@ -1048,9 +1048,17 @@ if ($action == 'create') {
print " \n";
}
+ // $objectsrc->lines contains the line of the purchase order
+ // $dispatchLines is list of lines with dispatching detail (with product, qty and warehouse). One purchase order line may have n of this dispatch lines.
+
+ $arrayofpurchaselinealreadyoutput= array();
+
+ // $_POST contains fk_commandefourndet_X_Y where Y is num of product line and X is number of splitted line
$indiceAsked = 1;
- while ($indiceAsked <= $numAsked) {
+ while ($indiceAsked <= $numAsked) { // Loop on $dispatchLines. Warning: $dispatchLines must be sorted by fk_commandefourndet (it is a regroupment key on output)
$product = new Product($db);
+
+ // We search the purchase order line that is linked to the dispatchLines
foreach ($objectsrc->lines as $supplierLine) {
if ($dispatchLines[$indiceAsked]['fk_commandefourndet'] == $supplierLine->id) {
$line = $supplierLine;
@@ -1072,7 +1080,6 @@ if ($action == 'create') {
print ''."\n";
print ''."\n";
-
// Product label
if ($line->fk_product > 0) { // If predefined product
$product->fetch($line->fk_product);
@@ -1081,42 +1088,45 @@ if ($action == 'create') {
print '';
print ' '; // ancre pour retourner sur la ligne
- print ' ';
+ if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
+ print ' ';
- // Show product and description
- $product_static = $product;
+ // Show product and description
+ $product_static = $product;
- $text = $product_static->getNomUrl(1);
- $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
- $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
- print $form->textwithtooltip($text, $description, 3, '', '', $i);
+ $text = $product_static->getNomUrl(1);
+ $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label);
+ $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc));
+ print $form->textwithtooltip($text, $description, 3, '', '', $i);
- // Show range
- print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
+ // Show range
+ print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
- // Add description in form
- if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
- print ($line->desc && $line->desc != $line->product_label) ? ' '.dol_htmlentitiesbr($line->desc) : '';
+ // Add description in form
+ if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
+ print ($line->desc && $line->desc != $line->product_label) ? ' '.dol_htmlentitiesbr($line->desc) : '';
+ }
}
-
print ' ';
} else {
print "";
- if ($type == 1) {
- $text = img_object($langs->trans('Service'), 'service');
- } else {
- $text = img_object($langs->trans('Product'), 'product');
- }
+ if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
+ if ($type == 1) {
+ $text = img_object($langs->trans('Service'), 'service');
+ } else {
+ $text = img_object($langs->trans('Product'), 'product');
+ }
- if (!empty($line->label)) {
- $text .= ' '.$line->label.' ';
- print $form->textwithtooltip($text, $line->desc, 3, '', '', $i);
- } else {
- print $text.' '.nl2br($line->desc);
- }
+ if (!empty($line->label)) {
+ $text .= ' '.$line->label.' ';
+ print $form->textwithtooltip($text, $line->desc, 3, '', '', $i);
+ } else {
+ print $text.' '.nl2br($line->desc);
+ }
- // Show range
- print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
+ // Show range
+ print_date_range($db->jdate($line->date_start), $db->jdate($line->date_end));
+ }
print " \n";
}
@@ -1127,8 +1137,11 @@ if ($action == 'create') {
print ' ';
print '';
- // Qty
- print ''.$line->qty;
+ // Qty in source purchase order line
+ print ' ';
+ if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
+ print $line->qty;
+ }
print ' ';
print ' ';
print ' ';
@@ -1138,7 +1151,9 @@ if ($action == 'create') {
// Qty already received
print ' ';
$quantityDelivered = $objectsrc->receptions[$line->id];
- print $quantityDelivered;
+ if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
+ print $quantityDelivered;
+ }
print ' ';
print ' ';
@@ -1214,6 +1229,9 @@ if ($action == 'create') {
}
}
}
+
+ $arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
+
print " \n";
$extralabelslines = $extrafields->attributes[$line->table_element];
@@ -1775,7 +1793,9 @@ if ($action == 'create') {
//var_dump($alreadysent);
}
- // Loop on each product to send/sent
+ $arrayofpurchaselinealreadyoutput = array();
+
+ // Loop on each product to send/sent. Warning: $lines must be sorted by ->fk_commandefourndet (it is a regroupment key on output)
for ($i = 0; $i < $num_prod; $i++) {
print ''; // id of order line
print '';
@@ -1797,32 +1817,35 @@ if ($action == 'create') {
}
print '';
-
- $text = $lines[$i]->product->getNomUrl(1);
- $text .= ' - '.$label;
- $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
- print $form->textwithtooltip($text, $description, 3, '', '', $i);
- print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
- if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
- print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? ' '.dol_htmlentitiesbr($lines[$i]->description) : '';
+ if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
+ $text = $lines[$i]->product->getNomUrl(1);
+ $text .= ' - '.$label;
+ $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
+ print $form->textwithtooltip($text, $description, 3, '', '', $i);
+ print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
+ if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
+ print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? ' '.dol_htmlentitiesbr($lines[$i]->description) : '';
+ }
}
print " \n";
} else {
print "";
- if ($lines[$i]->product_type == Product::TYPE_SERVICE) {
- $text = img_object($langs->trans('Service'), 'service');
- } else {
- $text = img_object($langs->trans('Product'), 'product');
- }
+ if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
+ if ($lines[$i]->product_type == Product::TYPE_SERVICE) {
+ $text = img_object($langs->trans('Service'), 'service');
+ } else {
+ $text = img_object($langs->trans('Product'), 'product');
+ }
- if (!empty($lines[$i]->label)) {
- $text .= ' '.$lines[$i]->label.' ';
- print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
- } else {
- print $text.' '.nl2br($lines[$i]->description);
- }
+ if (!empty($lines[$i]->label)) {
+ $text .= ' '.$lines[$i]->label.' ';
+ print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
+ } else {
+ print $text.' '.nl2br($lines[$i]->description);
+ }
- print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
+ print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
+ }
print " \n";
}
@@ -1834,33 +1857,39 @@ if ($action == 'create') {
// Qty ordered
- print ''.$lines[$i]->qty_asked.' ';
+ print '';
+ if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
+ print $lines[$i]->qty_asked;
+ }
+ print ' ';
// Qty in other receptions (with reception and warehouse used)
if ($origin && $origin_id > 0) {
print '';
- foreach ($alreadysent as $key => $val) {
- if ($lines[$i]->fk_commandefourndet == $key) {
- $j = 0;
- foreach ($val as $receptionline_id => $receptionline_var) {
- if ($receptionline_var['reception_id'] == $lines[$i]->fk_reception) {
- continue; // We want to show only "other receptions"
- }
+ if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
+ foreach ($alreadysent as $key => $val) {
+ if ($lines[$i]->fk_commandefourndet == $key) {
+ $j = 0;
+ foreach ($val as $receptionline_id => $receptionline_var) {
+ if ($receptionline_var['reception_id'] == $lines[$i]->fk_reception) {
+ continue; // We want to show only "other receptions"
+ }
- $j++;
- if ($j > 1) {
- print ' ';
- }
- $reception_static->fetch($receptionline_var['reception_id']);
- print $reception_static->getNomUrl(1);
- print ' - '.$receptionline_var['qty'];
+ $j++;
+ if ($j > 1) {
+ print ' ';
+ }
+ $reception_static->fetch($receptionline_var['reception_id']);
+ print $reception_static->getNomUrl(1);
+ print ' - '.$receptionline_var['qty'];
- $htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour'));
- if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) {
- $warehousestatic->fetch($receptionline_var['warehouse']);
- $htmltext .= ' '.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
+ $htmltext = $langs->trans("DateValidation").' : '.(empty($receptionline_var['date_valid']) ? $langs->trans("Draft") : dol_print_date($receptionline_var['date_valid'], 'dayhour'));
+ if (!empty($conf->stock->enabled) && $receptionline_var['warehouse'] > 0) {
+ $warehousestatic->fetch($receptionline_var['warehouse']);
+ $htmltext .= ' '.$langs->trans("From").' : '.$warehousestatic->getNomUrl(1, '', 0, 1);
+ }
+ print ' '.$form->textwithpicto('', $htmltext, 1);
}
- print ' '.$form->textwithpicto('', $htmltext, 1);
}
}
}
@@ -1990,6 +2019,8 @@ if ($action == 'create') {
}
print " ";
+ $arrayofpurchaselinealreadyoutput[$lines[$i]->fk_commandefourndet] = $lines[$i]->fk_commandefourndet;
+
// Display lines extrafields
$extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index 7e58c75d35f..d0ca6416390 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -119,7 +119,7 @@ if (empty($reshook)) {
if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $objstat->element == 'action' && $resource_type == 'dolresource' && intval($busy) == 1) {
$eventDateStart = $objstat->datep;
$eventDateEnd = $objstat->datef;
- $isFullDayEvent = intval($objstat->fulldayevent);
+ $isFullDayEvent = $objstat->fulldayevent;
if (empty($eventDateEnd)) {
if ($isFullDayEvent) {
$eventDateStartArr = dol_getdate($eventDateStart);
@@ -194,7 +194,7 @@ if (empty($reshook)) {
if (!empty($conf->global->RESOURCE_USED_IN_EVENT_CHECK) && $object->element_type == 'action' && $object->resource_type == 'dolresource' && intval($object->busy) == 1) {
$eventDateStart = $object->objelement->datep;
$eventDateEnd = $object->objelement->datef;
- $isFullDayEvent = intval($objstat->fulldayevent);
+ $isFullDayEvent = $objstat->fulldayevent;
if (empty($eventDateEnd)) {
if ($isFullDayEvent) {
$eventDateStartArr = dol_getdate($eventDateStart);
@@ -376,11 +376,11 @@ if (!$ret) {
}
// Full day event
- print ''.$langs->trans("EventOnFullDay").' '.yn($act->fulldayevent, 3).' ';
+ print ''.$langs->trans("EventOnFullDay").' '.yn($act->fulldayevent ? 1 : 0, 3).' ';
// Date start
print ''.$langs->trans("DateActionStart").' ';
- if (!$act->fulldayevent) {
+ if (empty($act->fulldayevent)) {
print dol_print_date($act->datep, 'dayhour', 'tzuser');
} else {
print dol_print_date($act->datep, 'day', 'tzuser');
@@ -393,7 +393,7 @@ if (!$ret) {
// Date end
print ' '.$langs->trans("DateActionEnd").' ';
- if (!$act->fulldayevent) {
+ if (empty($act->fulldayevent)) {
print dol_print_date($act->datef, 'dayhour', 'tzuser');
} else {
print dol_print_date($act->datef, 'day', 'tzuser');
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index b6c483fc026..43e9bb30314 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -2542,7 +2542,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' ';
print ''.$idprof.' ';
$key = 'idprof'.$i;
- print showValueWithClipboardCPButton(dol_escape_htmltag($object->$key));
+ print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1);
if ($object->$key) {
if ($object->id_prof_check($i, $object) > 0) {
print ' '.$object->id_prof_url($i, $object);
@@ -2655,7 +2655,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print ' '.$langs->trans('VATIntra').' ';
if ($object->tva_intra) {
$s = '';
- $s .= showValueWithClipboardCPButton(dol_escape_htmltag($object->tva_intra));
+ $s .= dol_print_profids($object->tva_intra, 'VATIntra', $object->country_code, 1);
$s .= ' ';
if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index 596f9b6f3c6..3624f80187d 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -79,8 +79,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$month = '';
}
// Customer or supplier selected in drop box
-$thirdTypeSelect = GETPOST("third_select_id");
-$type_element = GETPOST('type_element') ?GETPOST('type_element') : '';
+$thirdTypeSelect = GETPOST("third_select_id", 'az09');
+$type_element = GETPOST('type_element') ? GETPOST('type_element') : '';
// Load translation files required by the page
$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products"));
@@ -441,9 +441,9 @@ if ($sql_select) {
print ' ';
print ' ';
print ' ';
- print ''; // date
+ print ' '; // date
print $formother->select_month($month ? $month : -1, 'month', 1, 0, 'valignmiddle');
- $formother->select_year($year ? $year : -1, 'year', 1, 20, 1);
+ $formother->select_year($year ? $year : -1, 'year', 1, 20, 1, 0, 0, '', 'valignmiddle maxwidth75imp marginleftonly');
print ' ';
print '';
print ' ';
@@ -463,7 +463,7 @@ if ($sql_select) {
// Titles with sort buttons
print ' ';
print_liste_field_titre('Ref', $_SERVER['PHP_SELF'], 'doc_number', '', $param, '', $sortfield, $sortorder, 'left ');
- print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, 'width="150"', $sortfield, $sortorder, 'center ');
+ print_liste_field_titre('Date', $_SERVER['PHP_SELF'], 'dateprint', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Status', $_SERVER['PHP_SELF'], 'fk_statut', '', $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('Product', $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'left ');
print_liste_field_titre('Quantity', $_SERVER['PHP_SELF'], 'prod_qty', '', $param, '', $sortfield, $sortorder, 'right ');
@@ -500,6 +500,8 @@ if ($sql_select) {
print $documentstaticline->getLibStatut(5);
} elseif ($type_element == 'invoice') {
print $documentstatic->getLibStatut(5, $objp->paid);
+ } elseif ($type_element == 'supplier_invoice') {
+ print $documentstatic->getLibStatut(5, $objp->paid);
} else {
print $documentstatic->getLibStatut(5);
}
@@ -673,7 +675,7 @@ if ($sql_select) {
print ' ';
print ''.$total_qty.' ';
print ''.price($total_ht).' ';
- print ''.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).' ';
+ print ''.price(price2num($total_ht / (empty($total_qty) ? 1 : $total_qty), 'MU')).' ';
print "";
print '';
diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php
index ea10b4d7137..057b32e89ca 100644
--- a/htdocs/supplier_proposal/class/supplier_proposal.class.php
+++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php
@@ -725,6 +725,9 @@ class SupplierProposal extends CommonObject
$total_ttc = $tabprice[2];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
+ $pu_ht = $tabprice[3];
+ $pu_tva = $tabprice[4];
+ $pu_ttc = $tabprice[5];
// MultiCurrency
$multicurrency_total_ht = $tabprice[16];
@@ -732,6 +735,11 @@ class SupplierProposal extends CommonObject
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
+ $pu = $pu_ht;
+ if ($price_base_type == 'TTC') {
+ $pu = $pu_ttc;
+ }
+
//Fetch current line from the database and then clone the object and set it in $oldline property
$line = new SupplierProposalLine($this->db);
$line->fetch($rowid);
diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php
index 02d25d30797..f1d4f62587f 100644
--- a/htdocs/takepos/invoice.php
+++ b/htdocs/takepos/invoice.php
@@ -290,7 +290,7 @@ if ($action == 'valid' && $user->rights->facture->creer) {
$payment->datepaye = $now;
$payment->fk_account = $bankaccount;
$payment->amounts[$invoice->id] = $amountofpayment;
- if ($pay == 'cash') {
+ if ($pay == 'LIQ') {
$payment->pos_change = price2num(GETPOST('excess', 'alpha'));
}
diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php
index a26fe1aa2fa..fde749b7520 100644
--- a/htdocs/theme/eldy/global.inc.php
+++ b/htdocs/theme/eldy/global.inc.php
@@ -59,7 +59,7 @@ if (!empty($conf->global->THEME_DARKMODEENABLED)) {
print "@media (prefers-color-scheme: dark) {";
}
print ":root {
- --colorbackhmenu1: #1d1e20;
+ --colorbackhmenu1: #3d3e40;
--colorbackvmenu1: #2b2c2e;
--colorbacktitle1: #2b2d2f;
--colorbacktabcard1: #1d1e20; /* Must be same than colorbackbody */
@@ -154,8 +154,9 @@ table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.
max-width: 100px;
text-overflow: ellipsis;
}
-.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
+/*.liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth],
.liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month],
+.liste_titre select[name=year],
.liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
.liste_titre input[name=search_month_lim], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end], .liste_titre input[name=search_month_create],
.liste_titre input[name=search_month_update], .liste_titre input[name=search_month_start], .liste_titre input[name=search_month_end],
@@ -166,6 +167,7 @@ table.liste th.wrapcolumntitle.liste_titre:not(.maxwidthsearch), table.liste td.
.liste_titre input[name=search_day_create], .liste_titre input[name=search_day_start], .liste_titre input[name=search_day_end],
.liste_titre input[name=search_day_date_when], .liste_titre input[name=search_month_date_when], .liste_titre input[name=search_year_date_when],
.liste_titre input[name=search_dtstartday], .liste_titre input[name=search_dtendday], .liste_titre input[name=search_dtstartmonth], .liste_titre input[name=search_dtendmonth],
+*/
select#date_startday, select#date_startmonth, select#date_endday, select#date_endmonth, select#reday, select#remonth,
input, input.flat, form.flat select, select, select.flat, .dataTables_length label select {
border: none;
@@ -255,6 +257,12 @@ input:invalid, select:invalid, input.--error , select.--error {
border-color: #ea1212;
}
+section.setupsection {
+ padding: 20px;
+ background-color: var(--colorbacktitle1);
+ border-radius: 5px;
+}
+
.field-error-icon { color: #ea1212; !important; }
/* Focus definitions must be after standard definition */
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 7394cbe697f..78745c70531 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -474,6 +474,18 @@ input.short {
width: 40px;
}
+input:invalid, select:invalid, input.--error , select.--error {
+ border-color: #ea1212;
+}
+
+section.setupsection {
+ padding: 20px;
+ background-color: var(--colorbacktitle1);
+ border-radius: 5px;
+}
+
+.field-error-icon { color: #ea1212; !important; }
+
textarea {
border-radius: 0;
border-top:solid 1px var(--inputbordercolor);
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 690bcb5cad2..f1d33f4eeb0 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -1479,31 +1479,6 @@ if ($action == 'create' || $action == 'presend') {
$morehtmlright = '';
$help = "";
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, $arrayoffamiliestoexclude, $object);
- if ($object->fk_soc > 0) {
- $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
- }
- $substitutionarray['__USER_SIGNATURE__'] = $user->signature;
- $substitutionarray['__TICKET_TRACKID__'] = $object->track_id;
- $substitutionarray['__TICKET_REF__'] = $object->ref;
- $substitutionarray['__TICKET_SUBJECT__'] = $object->subject;
- $substitutionarray['__TICKET_TYPE__'] = $object->type_code;
- $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code;
- $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility
- $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code;
- $substitutionarray['__TICKET_MESSAGE__'] = $object->message;
- $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress;
- if ($object->fk_user_assign > 0) {
- $userstat->fetch($object->fk_user_assign);
- $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
- }
-
- if ($object->fk_user_create > 0) {
- $userstat->fetch($object->fk_user_create);
- $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname);
- }
- foreach ($substitutionarray as $key => $val) {
- $help .= $key.' -> '.$langs->trans($val).' ';
- }
$morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").' ', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution');
print '';
diff --git a/htdocs/user/vcard.php b/htdocs/user/vcard.php
index 57778c44259..0f9085d0b52 100644
--- a/htdocs/user/vcard.php
+++ b/htdocs/user/vcard.php
@@ -1,8 +1,9 @@
- * Copyright (C) 2004-2010 Laurent Destailleur
- * Copyright (C) 2005-2012 Regis Houssin
+/* Copyright (C) 2004 Rodolphe Quiedeville
+ * Copyright (C) 2004-2010 Laurent Destailleur
+ * Copyright (C) 2005-2012 Regis Houssin
* Copyright (C) 2020 Tobias Sekan
+ * Copyright (C) 2021-2022 Anthony Berton
*
* 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
@@ -64,27 +65,27 @@ $v->setUid('DOLIBARR-USERID-'.$user2->id);
$v->setName($user2->lastname, $user2->firstname, "", $user2->civility_code, "");
$v->setFormattedName($user2->getFullName($langs, 1));
-$v->setPhoneNumber($user2->phone_pro, "TYPE=WORK;VOICE");
-//$v->setPhoneNumber($user2->phone_perso,"TYPE=HOME;VOICE");
-$v->setPhoneNumber($user2->phone_mobile, "TYPE=CELL;VOICE");
-$v->setPhoneNumber($user2->fax, "TYPE=WORK;FAX");
+$v->setPhoneNumber($user2->office_phone, "TYPE=WORK;VOICE");
+$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE");
+$v->setPhoneNumber($user2->user_mobile, "TYPE=CELL;VOICE");
+$v->setPhoneNumber($user2->office_fax, "TYPE=WORK;FAX");
$country = $user2->country_code ? $user2->country : '';
$v->setAddress("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK;POSTAL");
$v->setLabel("", "", $user2->address, $user2->town, $user2->state, $user2->zip, $country, "TYPE=WORK");
-$v->setEmail($user2->email);
+$v->setEmail($user2->email, "TYPE=WORK");
$v->setNote($user2->note);
$v->setTitle($user2->poste);
// Data from linked company
if ($company->id) {
$v->setURL($company->url, "TYPE=WORK");
- if (!$user2->phone_pro) {
+ if (!$user2->office_phone) {
$v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE");
}
- if (!$user2->fax) {
+ if (!$user2->office_fax) {
$v->setPhoneNumber($company->fax, "TYPE=WORK;FAX");
}
if (!$user2->zip) {
@@ -96,16 +97,16 @@ if ($company->id) {
// was set before, don't set twice
} elseif (empty(trim($user2->email))) {
// when user e-mail is empty, use only company e-mail
- $v->setEmail($company->email);
+ $v->setEmail($company->email, "TYPE=WORK");
} elseif (strtolower(end(explode("@", $user2->email))) == strtolower(end(explode("@", $company->email)))) {
// when e-mail domain of user and company are the same, use user e-mail at first (and company e-mail at second)
- $v->setEmail($user2->email);
+ $v->setEmail($user2->email, "TYPE=WORK");
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($company->email, 'INTERNET');
} else {
// when e-mail of user and company complete different use company e-mail at first (and user e-mail at second)
- $v->setEmail($company->email);
+ $v->setEmail($company->email, "TYPE=WORK");
// support by Microsoft Outlook (2019 and possible earlier)
$v->setEmail($user2->email, 'INTERNET');
@@ -118,7 +119,7 @@ if ($company->id) {
}
// Personal informations
-$v->setPhoneNumber($user2->phone_perso, "TYPE=HOME;VOICE");
+$v->setPhoneNumber($user2->personal_mobile, "TYPE=HOME;VOICE");
if ($user2->birth) {
$v->setBirthday($user2->birth);
}
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index af2f3a96ae1..dab79faee3b 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2787,7 +2787,7 @@ if (!GETPOST('hide_websitemenu')) {
print ' ';
}
if ($action != 'preview') {
- print ' ';
+ print ' ';
}
}
@@ -3123,7 +3123,7 @@ if (!GETPOST('hide_websitemenu')) {
print ' ';
}
if ($action != 'preview') {
- print ' ';
+ print ' ';
}
}
@@ -3545,8 +3545,8 @@ if ($action == 'createsite') {
if ($action == 'createsite') {
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print '
';
}
@@ -3574,8 +3574,8 @@ if ($action == 'importsite') {
print ' ';
print ' ';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print ' ';
@@ -3630,29 +3630,6 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
if ($action == 'createcontainer') {
print ' ';
- if (!empty($conf->use_javascript_ajax)) {
- print ' ';
- }
- print ''.$langs->trans("CreateByFetchingExternalPage").' ';
- print ' ';
- print '';
- print '';
- print $langs->trans("URL");
- print ' ';
- print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
- print ' ';
- print ' '.$langs->trans("GrabImagesInto");
- print ' ';
- print $langs->trans("ImagesShouldBeSavedInto").' ';
- $arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
- print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
- print ' ';
- print ' ';
- print ' ';
- print '
';
-
- print ' ';
-
if (!empty($conf->use_javascript_ajax)) {
print ' ';
}
@@ -3819,7 +3796,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
if (empty($object->lang) && empty($object->otherlang)) {
$onlykeys = null; // We keep full list of languages
}
- print $formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
+ print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($pagelang ? $pagelang : '', 'WEBSITE_LANG', 0, null, '1', 0, 0, 'minwidth200', 0, 0, 0, $onlykeys, 1);
$htmltext = $langs->trans("AvailableLanguagesAreDefinedIntoWebsiteProperties");
print $form->textwithpicto('', $htmltext);
print ' ';
@@ -3907,7 +3884,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
}
print ''.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).' ';
- print img_picto('', 'category', 'class="paddingright"');
+ print img_picto('', 'category', 'class="pictofixedwidth"');
print $form->multiselectarray('categories', $cate_arbo, (GETPOSTISSET('categories') ? GETPOST('categories', 'array') : $arrayselected), null, null, 'minwidth200 widthcentpercentminusxx');
print " ";
}
@@ -3983,16 +3960,42 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
if ($action == 'createcontainer') {
print '';
- print ' ';
- print ' ';
+ print ' ';
+ print ' ';
print '
';
+
+
+ print ' ';
+
+ if (!empty($conf->use_javascript_ajax)) {
+ print ' ';
+ }
+ print ''.$langs->trans("CreateByFetchingExternalPage").' ';
+ print ' ';
+ print '';
+ print '';
+ print $langs->trans("URL");
+ print ' ';
+ print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
+ print ' ';
+ print ' '.$langs->trans("GrabImagesInto");
+ print ' ';
+ print $langs->trans("ImagesShouldBeSavedInto").' ';
+ $arraygrabimagesinto = array('root'=>$langs->trans("WebsiteRootOfImages"), 'subpage'=>$langs->trans("SubdirOfPage"));
+ print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto') ? GETPOST('grabimagesinto') : 'root', 0, 0, 0, '', 0, 0, 0, '', '', 1);
+ print ' ';
+ print ' ';
+ print ' ';
+ print '
';
}
if ($action == 'createcontainer') {
print '