Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into fix_works_to_add_prefix_db_function
This commit is contained in:
commit
5f376685c3
@ -1,62 +1,93 @@
|
||||
<VirtualHost *:80>
|
||||
#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"
|
||||
|
||||
<Directory /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
|
||||
</Directory>
|
||||
|
||||
# Leaving /public and /api, /dav, .well_known but also wrappers for document and viewimage accessible to everyone
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/public/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/api/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/dav/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Directory /home/admin/wwwroot/dolibarr/htdocs/.well-known/>
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Directory>
|
||||
<Files ~ "(document\.php|viewimage\.php|\.js\.php|\.json\.php|\.js|\.css\.php|\.css|\.gif|\.png|\.svg|\.woff2|favicon\.ico)$">
|
||||
AuthType None
|
||||
Require all granted
|
||||
Satisfy any
|
||||
</Files>
|
||||
|
||||
UseCanonicalName On
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
DocumentRoot "/home/.../htdocs"
|
||||
|
||||
<Directory /home/.../htdocs/>
|
||||
AllowOverride None
|
||||
Options -Indexes -MultiViews +FollowSymLinks -ExecCGI
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<Directory "/home/../htdocs/cache">
|
||||
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
|
||||
</Directory>
|
||||
|
||||
|
||||
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]
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
@ -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('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
|
||||
if (!empty($conf->global->MAIN_MOTD_SETUPPAGE)) {
|
||||
@ -76,12 +77,15 @@ print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySet
|
||||
print "<br><br>";
|
||||
print '</span>';
|
||||
|
||||
print '<br><br>';
|
||||
print '<br>';
|
||||
|
||||
// Show info setup company
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) {
|
||||
$setupcompanynotcomplete = 1;
|
||||
}
|
||||
|
||||
print '<section class="setupsection">';
|
||||
|
||||
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 '<br><br>';
|
||||
print $langs->trans("SetupDescription3b");
|
||||
@ -90,10 +94,13 @@ if (!empty($setupcompanynotcomplete)) {
|
||||
$warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
}
|
||||
|
||||
print '</section>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
print '<section class="setupsection">';
|
||||
|
||||
// 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 '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
print '</section>';
|
||||
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
|
||||
@ -320,12 +320,12 @@ class BlockedLog
|
||||
$this->error++;
|
||||
}
|
||||
} elseif ($this->action == 'MODULE_SET') {
|
||||
return '<i class="opacitymedium">System to track events into unalterable logs were enabled</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogEnabled").'</i>';
|
||||
} elseif ($this->action == 'MODULE_RESET') {
|
||||
if ($this->signature == '0000000000') {
|
||||
return '<i class="opacitymedium">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.</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogDisabled").'</i>';
|
||||
} else {
|
||||
return '<i class="opacitymedium">System to track events into unalterable logs were disabled. This is possible because no record were done yet.</i>';
|
||||
return '<i class="opacitymedium">'.$langs->trans("BlockedLogDisabledBis").'</i>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
}
|
||||
else {
|
||||
$('[parentid="'+ id_bom_line +'"]').hide();
|
||||
$(this).html('(+) ');
|
||||
$(this).html('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
}
|
||||
|
||||
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('<?php echo dol_escape_js(img_picto('', 'folder-open')); ?>');
|
||||
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('<?php echo dol_escape_js(img_picto('', 'folder')); ?>');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
|
||||
if (!empty($conf->global->BOM_SUB_BOM)) {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("or").'</span><br>'.$langs->trans("BOM");
|
||||
// TODO Add component to select a BOM
|
||||
print '<select id="bom_select" name="bom_select"><option value="-1">TODO</option></select>';
|
||||
$form->select_bom();
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
|
||||
@ -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 '<a class="collapse_bom" id="collapse-'.$line->id.'" href="#">' . (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? '(+)' : '(-)') . ' </a>';
|
||||
print ' <a class="collapse_bom" id="collapse-'.$line->id.'" href="#">';
|
||||
print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open'));
|
||||
print '</a>';
|
||||
} else {
|
||||
print $tmpproduct->getNomUrl(1);
|
||||
print ' - '.$tmpproduct->label;
|
||||
@ -176,7 +180,7 @@ if ($action == 'selectlines') {
|
||||
print '</tr>';
|
||||
|
||||
// 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 '<tr class="sub_bom_lines" parentid="'.$line->id.'">';
|
||||
}
|
||||
|
||||
// Product
|
||||
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">'.$sub_bom_product->getNomUrl(1).'</td>';
|
||||
|
||||
// Sub-BOM
|
||||
if ($sub_bom_line->fk_bom_child > 0) {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'">'.$sub_bom->getNomUrl(1).'</td>';
|
||||
// Product OR BOM
|
||||
print '<td style="padding-left: 5%" id="sub_bom_product_'.$sub_bom_line->id.'">';
|
||||
if (!empty($obj->fk_bom_child)) {
|
||||
print $sub_bom_product->getNomUrl(1);
|
||||
print ' '.$langs->trans('or').' ';
|
||||
print $sub_bom->getNomUrl(1);
|
||||
} else {
|
||||
print '<td id="sub_bom_bom_'.$sub_bom_line->id.'"> </td>';
|
||||
print $sub_bom_product->getNomUrl(1);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Qty
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
if ($sub_bom_line->qty_frozen > 0) {
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$sub_bom_line->qty_frozen.'</td>';
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'">'.$langs->trans('Yes').'</td>';
|
||||
} else {
|
||||
print '<td class="linecolqty nowrap right" id="sub_bom_qty_'.$sub_bom_line->id.'">'.price($sub_bom_line->qty * $line->qty, 0, '', 0, 0).'</td>';
|
||||
print '<td class="linecolqtyfrozen nowrap right" id="sub_bom_qty_frozen_'.$sub_bom_line->id.'"> </td>';
|
||||
}
|
||||
|
||||
@ -230,18 +236,20 @@ if ($resql) {
|
||||
// Cost price if it's defined
|
||||
if ($sub_bom_product->cost_price > 0) {
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->cost_price * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->cost_price * $line->qty;
|
||||
$total_cost+= $sub_bom_product->cost_price * $line->qty;
|
||||
} elseif ($sub_bom_product->pmp > 0) { // PMP if cost price isn't defined
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($sub_bom_product->pmp * $line->qty).'</td>';
|
||||
$total_cost.= $sub_bom_product->pmp * $line->qty;
|
||||
} else { // Minimum purchase price if cost price and PMP aren't defined
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
$sql_supplier_price = 'SELECT MIN(price) AS min_price, quantity AS qty FROM '.MAIN_DB_PREFIX.'product_fournisseur_price';
|
||||
$sql_supplier_price.= ' WHERE fk_product = '. (int) $sub_bom_product->id;
|
||||
$resql_supplier_price = $object->db->query($sql_supplier_price);
|
||||
if ($resql_supplier_price) {
|
||||
$obj = $object->db->fetch_object($resql_supplier_price);
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($obj->min_price * $line->qty).'</td>';
|
||||
$total_cost+= $obj->min_price * $line->qty;
|
||||
$line_cost = $obj->min_price/$obj->qty * $sub_bom_line->qty;
|
||||
|
||||
print '<td class="linecolcost nowrap right" id="sub_bom_cost_'.$sub_bom_line->id.'">'.price($line_cost).'</td>';
|
||||
$total_cost+= $line_cost;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ if (empty($reshook) && $action == 'add') {
|
||||
if (!$error) {
|
||||
// Initialisation objet actioncomm
|
||||
$object->priority = GETPOSTISSET("priority") ? GETPOST("priority", "int") : 0;
|
||||
$object->fulldayevent = (!empty($fulldayevent) ? 1 : 0);
|
||||
$object->fulldayevent = ($fulldayevent ? 1 : 0);
|
||||
$object->location = GETPOST("location", 'alphanohtml');
|
||||
$object->label = GETPOST('label', 'alphanohtml');
|
||||
|
||||
@ -1960,7 +1960,7 @@ if ($id > 0) {
|
||||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
$rowspan = 4;
|
||||
if (empty($conf->global->AGENDA_DISABLE_LOCATION)) {
|
||||
@ -1969,7 +1969,7 @@ if ($id > 0) {
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td>';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datep, 'day', 'tzuser');
|
||||
@ -1982,7 +1982,7 @@ if ($id > 0) {
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td>';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datef, 'day', 'tzuser');
|
||||
|
||||
@ -555,7 +555,11 @@ class ActionComm extends CommonObject
|
||||
$sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", ";
|
||||
$sql .= ($userownerid > 0 ? $userownerid : "null").", ";
|
||||
$sql .= ($userdoneid > 0 ? $userdoneid : "null").", ";
|
||||
$sql .= "'".$this->db->escape($this->label)."','".$this->db->escape($this->percentage)."','".$this->db->escape($this->priority)."','".$this->db->escape($this->fulldayevent)."','".$this->db->escape($this->location)."', ";
|
||||
$sql .= "'".$this->db->escape($this->label)."', ";
|
||||
$sql .= "'".$this->db->escape($this->percentage)."', ";
|
||||
$sql .= "'".$this->db->escape($this->priority)."', ";
|
||||
$sql .= "'".$this->db->escape($this->fulldayevent)."', ";
|
||||
$sql .= "'".$this->db->escape($this->location)."', ";
|
||||
$sql .= "'".$this->db->escape($this->transparency)."', ";
|
||||
$sql .= (!empty($this->fk_element) ? ((int) $this->fk_element) : "null").", ";
|
||||
$sql .= (!empty($this->elementtype) ? "'".$this->db->escape($this->elementtype)."'" : "null").", ";
|
||||
|
||||
@ -194,11 +194,11 @@ if ($object->id > 0) {
|
||||
}
|
||||
|
||||
// Full day event
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datep, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datep, 'day', 'tzuser');
|
||||
@ -211,7 +211,7 @@ if ($object->id > 0) {
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
|
||||
if (!$object->fulldayevent) {
|
||||
if (empty($object->fulldayevent)) {
|
||||
print dol_print_date($object->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($object->datef, 'day', 'tzuser');
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -1462,11 +1462,6 @@ if ($resql) {
|
||||
print '<td class="nowraponall">';
|
||||
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 '<td class="center">';
|
||||
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 '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
|
||||
@ -210,11 +210,11 @@ if (!empty($conf->facture->enabled) && !empty($user->rights->facture->lire)) {
|
||||
print '<td class="nobordernopadding nowraponall">';
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$filename = dol_sanitizeFileName($obj->ref);
|
||||
$filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($obj->ref);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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 '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
||||
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
||||
print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=customer';
|
||||
if (!GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
if ($invoice_type != 'customer' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
print '&vat_rate_show='.urlencode($rate);
|
||||
}
|
||||
print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
||||
@ -643,7 +643,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) {
|
||||
print '<td class="tax_rate" colspan="' . ($span+1) . '">';
|
||||
print $langs->trans('Rate') . ' : ' . vatrate($rate) . '%';
|
||||
print ' - <a href="'.DOL_URL_ROOT.'/compta/tva/quadri_detail.php?invoice_type=supplier';
|
||||
if (!GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
if ($invoice_type != 'supplier' || !GETPOSTISSET('vat_rate_show') || GETPOST('vat_rate_show') != $rate) {
|
||||
print '&vat_rate_show='.urlencode($rate);
|
||||
}
|
||||
print '&date_startyear='.urlencode($date_start_year).'&date_startmonth='.urlencode($date_start_month).'&date_startday='.urlencode($date_start_day).'&date_endyear='.urlencode($date_end_year).'&date_endmonth='.urlencode($date_end_month).'&date_endday='.urlencode($date_end_day).'">' . img_picto('', 'chevron-down', 'class="paddingrightonly"') . $langs->trans('VATReportShowByRateDetails') . '</a>';
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -170,7 +170,7 @@ class box_scheduled_jobs extends ModeleBoxes
|
||||
);
|
||||
$this->info_box_contents[$line][] = array(
|
||||
'td' => 'class="center"',
|
||||
'textnoformat' => ($nbjobsinerror ? '<a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'"><div class="badge badge-danger"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>' : '<div class="center badge-status4">0</div>')
|
||||
'textnoformat' => ($nbjobsinerror ? '<a href="'.DOL_URL_ROOT.'/cron/list.php?search_lastresult='.urlencode('<>0').'"><div class="badge badge-danger"><i class="fa fa-exclamation-triangle"></i> '.$nbjobsinerror.'</div></a>' : '<a href="'.DOL_URL_ROOT.'/cron/list.php"><div class="center badge-status4">0</div></a>')
|
||||
);
|
||||
} else {
|
||||
$this->info_box_contents[0][0] = array(
|
||||
|
||||
@ -804,9 +804,6 @@ class ExtraFields
|
||||
if ($elementtype == 'order_supplier') {
|
||||
$elementtype = 'commande_fournisseur';
|
||||
}
|
||||
if ($elementtype == 'stock_mouvement') {
|
||||
$elementtype = 'movement';
|
||||
}
|
||||
|
||||
$array_name_label = array();
|
||||
|
||||
|
||||
@ -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 .= '<select class="flat'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
|
||||
|
||||
$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 .= '<option value="-1"';
|
||||
if (empty($selected)) $out .= ' selected';
|
||||
$out .= '> </option>';
|
||||
}
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$product = new Product($db);
|
||||
$res = $product->fetch($obj->fk_product);
|
||||
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>';
|
||||
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
|
||||
}
|
||||
} 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 .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\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 .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
// Add code for jquery to use multiselect
|
||||
if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) {
|
||||
$out .= "\n".'<!-- JS CODE TO ENABLE select for id '.$htmlname.', addjscombo='.$addjscombo.' -->';
|
||||
@ -8067,31 +8155,6 @@ class Form
|
||||
$out .= '</script>';
|
||||
}
|
||||
|
||||
// Try also magic suggest
|
||||
$out .= '<select id="'.$htmlname.'" class="multiselect'.($morecss ? ' '.$morecss : '').'" multiple name="'.$htmlname.'[]"'.($moreattrib ? ' '.$moreattrib : '').($width ? ' style="width: '.(preg_match('/%/', $width) ? $width : $width.'px').'"' : '').'>'."\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 .= '<option value="'.$key.'"';
|
||||
if (is_array($selected) && !empty($selected) && in_array((string) $key, $selected) && ((string) $key != '')) {
|
||||
$out .= ' selected';
|
||||
}
|
||||
$out .= ' data-html="'.dol_escape_htmltag($newval).'"';
|
||||
$out .= '>';
|
||||
$out .= dol_htmlentitiesbr($newval);
|
||||
$out .= '</option>'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
$out .= '</select>'."\n";
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
@ -210,6 +210,8 @@ class DoliDBMysqli extends DoliDB
|
||||
{
|
||||
dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
|
||||
|
||||
//mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
// Can also be
|
||||
// mysqli::init(); mysql::options(MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT = 0'); mysqli::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
|
||||
// return mysqli::real_connect($host, $user, $pass, $db, $port);
|
||||
@ -255,6 +257,8 @@ class DoliDBMysqli extends DoliDB
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Execute a SQL request and return the resultset
|
||||
*
|
||||
@ -288,11 +292,16 @@ class DoliDBMysqli extends DoliDB
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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)) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -1196,11 +1196,6 @@ function getCustomerInvoiceUnpaidOpenTable($maxCount = 500, $socid = 0)
|
||||
print '<td class="nobordernopadding nowrap">';
|
||||
print $tmpinvoice->getNomUrl(1, '');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding nowrap">';
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
print '<td width="16" class="nobordernopadding hideonsmartphone right">';
|
||||
$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 '<td class="nowrap tdoverflowmax100">';
|
||||
print $societestatic->getNomUrl(1, 'customer');
|
||||
print '</td>';
|
||||
print '<td class="right">'.dol_print_date($db->jdate($obj->datelimite), 'day').'</td>';
|
||||
print '<td class="right">';
|
||||
print dol_print_date($db->jdate($obj->datelimite), 'day');
|
||||
if ($tmpinvoice->hasDelay()) {
|
||||
print img_warning($langs->trans("Late"));
|
||||
}
|
||||
print '</td>';
|
||||
if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) {
|
||||
print '<td class="right"><span class="amount">'.price($obj->total_ht).'</span></td>';
|
||||
}
|
||||
|
||||
@ -382,7 +382,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("propal");
|
||||
print '<tr><td>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal', 'class="paddingright"').$langs->trans("Proposals").'</a>';
|
||||
print '<a href="propal.php?id='.$product->id.'">'.img_object('', 'propal', 'class="pictofixedwidth"').$langs->trans("Proposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_propale['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -401,7 +401,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("supplier_proposal");
|
||||
print '<tr><td>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal', 'class="paddingright"').$langs->trans("SupplierProposals").'</a>';
|
||||
print '<a href="supplier_proposal.php?id='.$product->id.'">'.img_object('', 'supplier_proposal', 'class="pictofixedwidth"').$langs->trans("SupplierProposals").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_proposal_supplier['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -420,7 +420,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order', 'class="paddingright"').$langs->trans("CustomersOrders").'</a>';
|
||||
print '<a href="commande.php?id='.$product->id.'">'.img_object('', 'order', 'class="pictofixedwidth"').$langs->trans("CustomersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -439,7 +439,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("orders");
|
||||
print '<tr><td>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order', 'class="paddingright"').$langs->trans("SuppliersOrders").'</a>';
|
||||
print '<a href="commande_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans("SuppliersOrders").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_commande_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -458,7 +458,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("bills");
|
||||
print '<tr><td>';
|
||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('', 'bill').' '.$langs->trans("CustomersInvoices").'</a>';
|
||||
print '<a href="facture.php?id='.$product->id.'">'.img_object('', 'bill', 'class="pictofixedwidth"').$langs->trans("CustomersInvoices").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -477,7 +477,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("bills");
|
||||
print '<tr><td>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice', 'class="paddingright"').$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '<a href="facture_fournisseur.php?id='.$product->id.'">'.img_object('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans("SuppliersInvoices").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_facture_fournisseur['suppliers'];
|
||||
print '</td><td class="right">';
|
||||
@ -497,7 +497,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("contracts");
|
||||
print '<tr><td>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract', 'class="paddingright"').$langs->trans("Contracts").'</a>';
|
||||
print '<a href="contrat.php?id='.$product->id.'">'.img_object('', 'contract', 'class="pictofixedwidth"').$langs->trans("Contracts").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $product->stats_contrat['customers'];
|
||||
print '</td><td class="right">';
|
||||
@ -518,7 +518,7 @@ function show_stats_for_company($product, $socid)
|
||||
$langs->load("mrp");
|
||||
|
||||
print '<tr><td>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'bom', 'class="paddingright"').$langs->trans("BOM").'</a>';
|
||||
print '<a href="bom.php?id='.$product->id.'">'.img_object('', 'bom', 'class="pictofixedwidth"').$langs->trans("BOM").'</a>';
|
||||
print '</td><td class="right">';
|
||||
|
||||
print '</td><td class="right">';
|
||||
@ -540,7 +540,7 @@ function show_stats_for_company($product, $socid)
|
||||
}
|
||||
$langs->load("mrp");
|
||||
print '<tr><td>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="paddingright"').$langs->trans("MO").'</a>';
|
||||
print '<a href="mo.php?id='.$product->id.'">'.img_object('', 'mrp', 'class="pictofixedwidth"').$langs->trans("MO").'</a>';
|
||||
print '</td><td class="right">';
|
||||
print $form->textwithpicto($product->stats_mo['customers_toconsume'], $langs->trans("ToConsume"));
|
||||
print $form->textwithpicto($product->stats_mo['customers_consumed'], $langs->trans("QtyAlreadyConsumed"));
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2021 Open-Dsi <support@open-dsi.fr>
|
||||
* Copyright (C) 2021-2022 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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'];
|
||||
}
|
||||
|
||||
@ -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"
|
||||
);
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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<br>";
|
||||
//print 'xxx '.$code."=".$newcode."=".$type."=".$_POST[$newcode]."\n<br>";
|
||||
$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] : '');
|
||||
|
||||
@ -622,10 +622,11 @@ if ($id > 0 || !empty($ref)) {
|
||||
// if ($mesg) print $mesg;
|
||||
print '<br>';
|
||||
|
||||
$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) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020-2021 Udo Tamm <dev@dolibit.de>
|
||||
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* 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);
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
-- Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
|
||||
-- Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
-- Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
-- Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
-- Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
--
|
||||
-- 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);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2022 Salvatore Chiariello <sal.chiariello@gmail.com>
|
||||
--
|
||||
-- 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 <https://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
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;
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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 '<script src="'.DOL_URL_ROOT.'/includes/jquery/js/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
|
||||
}
|
||||
if (!defined('DISABLE_JQUERY_TABLEDND')) {
|
||||
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
|
||||
}
|
||||
// jQuery jnotify
|
||||
if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
|
||||
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
|
||||
}
|
||||
// Table drag and drop lines
|
||||
if (empty($disableforlogin) && !defined('DISABLE_JQUERY_TABLEDND')) {
|
||||
print '<script src="'.DOL_URL_ROOT.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\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 '<script src="'.DOL_URL_ROOT.'/includes/nnnick/chartjs/dist/Chart.min.js'.($ext ? '?'.$ext : '').'"></script>'."\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 '<!-- Includes JS for CKEditor -->'."\n";
|
||||
$pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/';
|
||||
$jsckeditor = 'ckeditor.js';
|
||||
@ -2073,24 +2074,24 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
|
||||
$dropdownBody .= '<div id="topmenulogincompanyinfo" >';
|
||||
|
||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIREN")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId1", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIREN"), 1).'</span>';
|
||||
}
|
||||
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_SIRET")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId2", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_SIRET"), 2).'</span>';
|
||||
}
|
||||
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_APE")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId3", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_APE"), 3).'</span>';
|
||||
}
|
||||
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_RCS")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId4", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_RCS"), 4).'</span>';
|
||||
}
|
||||
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID5")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId5", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID5"), 5).'</span>';
|
||||
}
|
||||
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') {
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_PROFID6")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->transcountry("ProfId6", $mysoc->country_code).'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_PROFID6"), 6).'</span>';
|
||||
}
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.showValueWithClipboardCPButton(getDolGlobalString("MAIN_INFO_TVAINTRA")).'</span>';
|
||||
$dropdownBody .= '<br><b>'.$langs->trans("VATIntraShort").'</b>: <span>'.dol_print_profids(getDolGlobalString("MAIN_INFO_TVAINTRA"), 'VAT').'</span>';
|
||||
|
||||
$dropdownBody .= '</div>';
|
||||
|
||||
|
||||
123
htdocs/product/admin/stock_mouvement_extrafields.php
Normal file
123
htdocs/product/admin/stock_mouvement_extrafields.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \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 = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
|
||||
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 '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Creation of an optional field
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
print '<br><div id="newattrib"></div>';
|
||||
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 "<br>";
|
||||
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();
|
||||
@ -1870,40 +1870,40 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) {
|
||||
// Brut Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", $object->weight_units, 0, 2);
|
||||
print '<input name="weight" size="5" value="'.(GETPOSTISSET('weight') ? GETPOST('weight') : $object->weight).'"> ';
|
||||
print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units') : $object->weight_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SIZE)) {
|
||||
// Brut Length
|
||||
print '<tr><td>'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").'</td><td>';
|
||||
print '<input name="size" size="5" value="'.$object->length.'">x';
|
||||
print '<input name="sizewidth" size="5" value="'.$object->width.'">x';
|
||||
print '<input name="sizeheight" size="5" value="'.$object->height.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", $object->length_units, 0, 2);
|
||||
print '<input name="size" size="5" value="'.(GETPOSTISSET('size') ? GETPOST('size') : $object->length).'">x';
|
||||
print '<input name="sizewidth" size="5" value="'.(GETPOSTISSET('sizewidth') ? GETPOST('sizewidth') : $object->width).'">x';
|
||||
print '<input name="sizeheight" size="5" value="'.(GETPOSTISSET('sizeheight') ? GETPOST('sizeheight') : $object->height).'"> ';
|
||||
print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) {
|
||||
// Brut Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||
print '<input name="surface" size="5" value="'.$object->surface.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("surface_units", "surface", $object->surface_units, 0, 2);
|
||||
print '<input name="surface" size="5" value="'.(GETPOSTISSET('surface') ? GETPOST('surface') : $object->surface).'"> ';
|
||||
print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) {
|
||||
// Brut Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||
print '<input name="volume" size="5" value="'.$object->volume.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("volume_units", "volume", $object->volume_units, 0, 2);
|
||||
print '<input name="volume" size="5" value="'.(GETPOSTISSET('volume') ? GETPOST('volume') : $object->volume).'"> ';
|
||||
print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units') : $object->volume_units, 0, 2);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) {
|
||||
// Net Measure
|
||||
print '<tr><td>'.$langs->trans("NetMeasure").'</td><td>';
|
||||
print '<input name="net_measure" size="5" value="'.$object->net_measure.'"> ';
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", "", $object->net_measure_units, 0, 0);
|
||||
print '<input name="net_measure" size="5" value="'.(GETPOSTISSET('net_measure') ? GETPOST('net_measure') : $object->net_measure).'"> ';
|
||||
print $formproduct->selectMeasuringUnits("net_measure_units", "", GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units') : $object->net_measure_units, 0, 0);
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 .= '<option>'.$arraytypes['batch'].'</option>';
|
||||
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 .= '<option>' . $arraytypes['batch'] . '</option>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateDefaultPrice") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateDefaultPrice") . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=add_customer_price&token='.newToken().'token='.newToken().'&id=' . $object->id . '">' . $langs->trans("AddCustomerPrice") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("AddCustomerPrice") . '</span></div>';
|
||||
}
|
||||
}
|
||||
|
||||
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 '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_vat&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateVAT") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateVAT") . '</span></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?action=edit_price&token='.newToken().'&id=' . $object->id . '">' . $langs->trans("UpdateLevelPrices") . '</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">' . $langs->trans("UpdateLevelPrices") . '</span></div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 "<div id='ways'>";
|
||||
$c = new Categorie($db);
|
||||
$c->fetch($catid);
|
||||
$c->fetch($search_categ);
|
||||
$ways = $c->print_all_ways(' > ', 'product/reassort.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
@ -306,7 +326,7 @@ if ($resql) {
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$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 .= '</div>';
|
||||
}
|
||||
|
||||
@ -323,32 +343,6 @@ if ($resql) {
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
$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 '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre right"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Physical stock
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).'">';
|
||||
print '</td>';
|
||||
if ($virtualdiffersfromphysical) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
@ -396,14 +393,14 @@ if ($resql) {
|
||||
|
||||
//Line for column titles
|
||||
print "<tr class=\"liste_titre\">";
|
||||
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
|
||||
|
||||
@ -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 "<div id='ways'>";
|
||||
$c = new Categorie($db);
|
||||
$c->fetch($catid);
|
||||
$c->fetch($search_categ);
|
||||
$ways = $c->print_all_ways(' > ', 'product/reassortlot.php');
|
||||
print " > ".$ways[0]."<br>\n";
|
||||
print "</div><br>";
|
||||
@ -309,7 +328,7 @@ if ($resql) {
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$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 .= '</div>';
|
||||
}
|
||||
//$moreforfilter.=$langs->trans("StockTooLow").' <input type="checkbox" name="toolowstock" value="1"'.($toolowstock?' checked':'').'>';
|
||||
@ -342,14 +361,17 @@ if ($resql) {
|
||||
}
|
||||
print '<td class="liste_titre"><input class="flat" type="text" name="search_warehouse" size="6" value="'.$search_warehouse.'"></td>';
|
||||
print '<td class="liste_titre center"><input class="flat" type="text" name="search_batch" size="6" value="'.$search_batch.'"></td>';
|
||||
print '<td class="liste_titre right"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
// Physical stock
|
||||
print '<td class="liste_titre right">';
|
||||
print '<input class="flat" type="text" size="5" name="search_stock_physique" value="'.dol_escape_htmltag($search_stock_physique).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre maxwidthsearch">';
|
||||
@ -360,21 +382,21 @@ if ($resql) {
|
||||
|
||||
//Line for column titles
|
||||
print "<tr class=\"liste_titre\">";
|
||||
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('');
|
||||
|
||||
@ -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);
|
||||
|
||||
51
htdocs/product/stock/tpl/extrafields_add.tpl.php
Normal file
51
htdocs/product/stock/tpl/extrafields_add.tpl.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Maxime Kohlhaas <support@atm-consulting.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- BEGIN PHP TEMPLATE extrafields_add.tpl.php -->
|
||||
<?php
|
||||
|
||||
// Other attributes
|
||||
if (!isset($parameters)) $parameters = array();
|
||||
|
||||
$reshook = $hookmanager->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);
|
||||
}
|
||||
|
||||
?>
|
||||
<!-- END PHP TEMPLATE extrafields_add.tpl.php -->
|
||||
@ -179,6 +179,9 @@ print '<input class="maxwidth100onsmartphone" name="inventorycode" id="inventory
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Extrafield template
|
||||
include 'extrafields_add.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -136,6 +136,9 @@ print '<input class="maxwidth100onsmartphone" name="inventorycode" id="inventory
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Extrafield template
|
||||
include 'extrafields_add.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
@ -87,9 +87,11 @@ print "*** TEST READ OF /test.txt FILE AND LS /dev/std*<br>\n";
|
||||
exec('cat /test.txt; ls /dev/std*; sleep 1;', $out, $ret);
|
||||
print $ret."<br>\n";
|
||||
print_r($out);
|
||||
print '<br>';
|
||||
|
||||
print '<br><br>'."\n";
|
||||
|
||||
|
||||
print "*** TRY TO RUN CLAMDSCAN<br>\n";
|
||||
|
||||
$ret = 0;
|
||||
|
||||
@ -1048,9 +1048,17 @@ if ($action == 'create') {
|
||||
print "</tr>\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 '<!-- line fk_commandefourndet='.$line->id.' for product='.$line->fk_product.' -->'."\n";
|
||||
print '<tr class="oddeven">'."\n";
|
||||
|
||||
|
||||
// Product label
|
||||
if ($line->fk_product > 0) { // If predefined product
|
||||
$product->fetch($line->fk_product);
|
||||
@ -1081,42 +1088,45 @@ if ($action == 'create') {
|
||||
|
||||
print '<td>';
|
||||
print '<a name="'.$line->id.'"></a>'; // ancre pour retourner sur la ligne
|
||||
print '<input type="hidden" name="productid'.$indiceAsked.'" value="'.$line->fk_product.'">';
|
||||
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||
print '<input type="hidden" name="productid'.$indiceAsked.'" value="'.$line->fk_product.'">';
|
||||
|
||||
// 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) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
|
||||
// Add description in form
|
||||
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
|
||||
print ($line->desc && $line->desc != $line->product_label) ? '<br>'.dol_htmlentitiesbr($line->desc) : '';
|
||||
}
|
||||
}
|
||||
|
||||
print '</td>';
|
||||
} else {
|
||||
print "<td>";
|
||||
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 .= ' <strong>'.$line->label.'</strong>';
|
||||
print $form->textwithtooltip($text, $line->desc, 3, '', '', $i);
|
||||
} else {
|
||||
print $text.' '.nl2br($line->desc);
|
||||
}
|
||||
if (!empty($line->label)) {
|
||||
$text .= ' <strong>'.$line->label.'</strong>';
|
||||
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 "</td>\n";
|
||||
}
|
||||
|
||||
@ -1127,8 +1137,11 @@ if ($action == 'create') {
|
||||
print '<input type="text" class="maxwidth100" name="comment'.$indiceAsked.'" value="'.$defaultcomment.'">';
|
||||
print '</td>';
|
||||
|
||||
// Qty
|
||||
print '<td class="center">'.$line->qty;
|
||||
// Qty in source purchase order line
|
||||
print '<td class="center">';
|
||||
if (! array_key_exists($line->id, $arrayofpurchaselinealreadyoutput)) { // Add test to avoid to show qty twice
|
||||
print $line->qty;
|
||||
}
|
||||
print '<input type="hidden" name="fk_commandefournisseurdet'.$indiceAsked.'" value="'.$line->id.'">';
|
||||
print '<input type="hidden" name="pul'.$indiceAsked.'" value="'.$line->pu_ht.'">';
|
||||
print '<input name="qtyasked'.$indiceAsked.'" id="qtyasked'.$indiceAsked.'" type="hidden" value="'.$line->qty.'">';
|
||||
@ -1138,7 +1151,9 @@ if ($action == 'create') {
|
||||
// Qty already received
|
||||
print '<td class="center">';
|
||||
$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 '<input name="qtydelivered'.$indiceAsked.'" id="qtydelivered'.$indiceAsked.'" type="hidden" value="'.$quantityDelivered.'">';
|
||||
print '</td>';
|
||||
|
||||
@ -1214,6 +1229,9 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$arrayofpurchaselinealreadyoutput[$line->id] = $line->id;
|
||||
|
||||
print "</tr>\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 '<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).' -->'; // id of order line
|
||||
print '<tr class="oddeven">';
|
||||
@ -1797,32 +1817,35 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
print '<td>';
|
||||
|
||||
$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) ? '<br>'.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) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
} else {
|
||||
print "<td>";
|
||||
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 .= ' <strong>'.$lines[$i]->label.'</strong>';
|
||||
print $form->textwithtooltip($text, $lines[$i]->description, 3, '', '', $i);
|
||||
} else {
|
||||
print $text.' '.nl2br($lines[$i]->description);
|
||||
}
|
||||
if (!empty($lines[$i]->label)) {
|
||||
$text .= ' <strong>'.$lines[$i]->label.'</strong>';
|
||||
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 "</td>\n";
|
||||
}
|
||||
|
||||
@ -1834,33 +1857,39 @@ if ($action == 'create') {
|
||||
|
||||
|
||||
// Qty ordered
|
||||
print '<td class="center">'.$lines[$i]->qty_asked.'</td>';
|
||||
print '<td class="center">';
|
||||
if (!array_key_exists($lines[$i]->fk_commandefourndet, $arrayofpurchaselinealreadyoutput)) {
|
||||
print $lines[$i]->qty_asked;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Qty in other receptions (with reception and warehouse used)
|
||||
if ($origin && $origin_id > 0) {
|
||||
print '<td class="center nowrap">';
|
||||
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 '<br>';
|
||||
}
|
||||
$reception_static->fetch($receptionline_var['reception_id']);
|
||||
print $reception_static->getNomUrl(1);
|
||||
print ' - '.$receptionline_var['qty'];
|
||||
$j++;
|
||||
if ($j > 1) {
|
||||
print '<br>';
|
||||
}
|
||||
$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 .= '<br>'.$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 .= '<br>'.$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 "</tr>";
|
||||
|
||||
$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) {
|
||||
|
||||
@ -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 '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($act->fulldayevent, 3).'</td></tr>';
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($act->fulldayevent ? 1 : 0, 3).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateActionStart").'</td><td colspan="3">';
|
||||
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 '<tr><td>'.$langs->trans("DateActionEnd").'</td><td colspan="3">';
|
||||
if (!$act->fulldayevent) {
|
||||
if (empty($act->fulldayevent)) {
|
||||
print dol_print_date($act->datef, 'dayhour', 'tzuser');
|
||||
} else {
|
||||
print dol_print_date($act->datef, 'day', 'tzuser');
|
||||
|
||||
@ -2542,7 +2542,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
print '<tr>';
|
||||
print '<td>'.$idprof.'</td><td>';
|
||||
$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 '<td class="nowrap">'.$langs->trans('VATIntra').'</td><td>';
|
||||
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 .= '<input type="hidden" id="tva_intra" name="tva_intra" maxlength="20" value="'.$object->tva_intra.'">';
|
||||
|
||||
if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
|
||||
|
||||
@ -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 '<td class="liste_titre left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap center">'; // date
|
||||
print '<td class="liste_titre nowrap center valignmiddle">'; // 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 '</td>';
|
||||
print '<td class="liste_titre center">';
|
||||
print '</td>';
|
||||
@ -463,7 +463,7 @@ if ($sql_select) {
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
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 '<td colspan="3"></td>';
|
||||
print '<td class="right">'.$total_qty.'</td>';
|
||||
print '<td class="right">'.price($total_ht).'</td>';
|
||||
print '<td class="right">'.price($total_ht / (empty($total_qty) ? 1 : $total_qty)).'</td>';
|
||||
print '<td class="right">'.price(price2num($total_ht / (empty($total_qty) ? 1 : $total_qty), 'MU')).'</td>';
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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'));
|
||||
}
|
||||
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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).'<br>';
|
||||
}
|
||||
$morehtmlright .= $form->textwithpicto('<span class="opacitymedium">'.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'</span>', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution');
|
||||
|
||||
print '<div>';
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Tobias Sekan <tobias.sekan@startmail.com>
|
||||
* Copyright (C) 2021-2022 Anthony Berton <anthony.berton@bb2a.fr>
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -2787,7 +2787,7 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
print '<input type="submit" id="savefile" class="button buttonforacesave button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
if ($action != 'preview') {
|
||||
print '<input type="submit" class="button button-cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';
|
||||
print '<input type="submit" class="button button-cancel small" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';
|
||||
}
|
||||
}
|
||||
|
||||
@ -3123,7 +3123,7 @@ if (!GETPOST('hide_websitemenu')) {
|
||||
print '<input type="submit" id="savefile" class="button buttonforacesave button-save" value="'.dol_escape_htmltag($langs->trans("Save")).'" name="update">';
|
||||
}
|
||||
if ($action != 'preview') {
|
||||
print '<input type="submit" class="button button-cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';
|
||||
print '<input type="submit" class="button button-cancel small" value="'.dol_escape_htmltag($langs->trans("Cancel")).'" name="cancel">';
|
||||
}
|
||||
}
|
||||
|
||||
@ -3545,8 +3545,8 @@ if ($action == 'createsite') {
|
||||
if ($action == 'createsite') {
|
||||
print '<div class="center">';
|
||||
|
||||
print '<input type="submit" class="button" name="addcontainer" value="'.$langs->trans("Create").'">';
|
||||
print '<input class="button button-cancel" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button small" name="addcontainer" value="'.$langs->trans("Create").'">';
|
||||
print '<input class="button button-cancel small" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
@ -3574,8 +3574,8 @@ if ($action == 'importsite') {
|
||||
|
||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
||||
print '<input class="flat minwidth400" type="file" name="userfile[]" accept=".zip">';
|
||||
print '<input type="submit" class="button" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">';
|
||||
print '<input type="submit" class="button button-cancel" name="preview" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
print '<input type="submit" class="button small" name="buttonsubmitimportfile" value="'.dol_escape_htmltag($langs->trans("Upload")).'">';
|
||||
print '<input type="submit" class="button button-cancel small" name="preview" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
|
||||
|
||||
print '<br><br><br>';
|
||||
|
||||
@ -3630,29 +3630,6 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
||||
if ($action == 'createcontainer') {
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
|
||||
}
|
||||
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("URL");
|
||||
print '</td><td>';
|
||||
print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
|
||||
print '<input class="flat minwidth500" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl', 'alpha')).'" placeholder="https://externalsite/pagetofetch"> ';
|
||||
print '<br><input class="flat paddingtop" type="checkbox" name="grabimages" value="1" checked="checked"> '.$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 '<br>';
|
||||
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatemanually" value="checkboxcreatemanually"'.(GETPOST('radiocreatefrom') == 'checkboxcreatemanually' ? ' checked' : '').'> ';
|
||||
}
|
||||
@ -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 '</td></tr>';
|
||||
@ -3907,7 +3884,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
||||
}
|
||||
|
||||
print '<tr><td class="toptd">'.$form->editfieldkey('Categories', 'categories', '', $objectpage, 0).'</td><td>';
|
||||
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 "</td></tr>";
|
||||
}
|
||||
@ -3983,16 +3960,42 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
||||
if ($action == 'createcontainer') {
|
||||
print '<div class="center tablecheckboxcreatemanually'.$hiddenmanuallyafterload.'">';
|
||||
|
||||
print '<input type="submit" class="button" name="addcontainer" value="'.$langs->trans("Create").'">';
|
||||
print '<input class="button button-cancel" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
print '<input type="submit" class="button small" name="addcontainer" value="'.$langs->trans("Create").'">';
|
||||
print '<input class="button button-cancel small" type="submit" name="preview" value="'.$langs->trans("Cancel").'">';
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print '<input type="radio" name="radiocreatefrom" id="checkboxcreatefromfetching" value="checkboxcreatefromfetching"'.(GETPOST('radiocreatefrom') == 'checkboxcreatefromfetching' ? ' checked' : '').'> ';
|
||||
}
|
||||
print '<label for="checkboxcreatefromfetching"><span class="opacitymediumxx">'.$langs->trans("CreateByFetchingExternalPage").'</span></label><br>';
|
||||
print '<hr class="tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<table class="tableforfield centpercent tablecheckboxcreatefromfetching'.$hiddenfromfetchingafterload.'">';
|
||||
print '<tr><td class="titlefield">';
|
||||
print $langs->trans("URL");
|
||||
print '</td><td>';
|
||||
print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning');
|
||||
print '<input class="flat minwidth500" type="text" name="externalurl" value="'.dol_escape_htmltag(GETPOST('externalurl', 'alpha')).'" placeholder="https://externalsite/pagetofetch"> ';
|
||||
print '<br><input class="flat paddingtop" type="checkbox" name="grabimages" value="1" checked="checked"> '.$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 '<br>';
|
||||
print '<input class="button" style="margin-top: 5px" type="submit" name="fetchexternalurl" value="'.dol_escape_htmltag($langs->trans("FetchAndCreate")).'">';
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
if ($action == 'createcontainer') {
|
||||
print '<script type="text/javascript">
|
||||
jQuery(document).ready(function() {
|
||||
var disableautofillofalias = 0;
|
||||
var selectedm = \'\';
|
||||
var selectedf = \'\';
|
||||
jQuery("#WEBSITE_TITLE").keyup(function() {
|
||||
if (disableautofillofalias == 0)
|
||||
{
|
||||
@ -4009,17 +4012,31 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
|
||||
disableautofillofalias = 1;
|
||||
});
|
||||
|
||||
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").change(function() {
|
||||
console.log("we select a method to create a new container"+jQuery("#checkboxcreatefromfetching:checked").val())
|
||||
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").show();
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
jQuery("#checkboxcreatefromfetching,#checkboxcreatemanually").click(function() {
|
||||
console.log("we select a method to create a new container "+jQuery("#checkboxcreatefromfetching:checked").val())
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
if (typeof(jQuery("#checkboxcreatefromfetching:checked").val()) != \'undefined\') {
|
||||
console.log("show a");
|
||||
if (selectedf != \'createfromfetching\') {
|
||||
jQuery(".tablecheckboxcreatefromfetching").show();
|
||||
selectedf = \'createfromfetching\';
|
||||
selectedm = \'\';
|
||||
} else {
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
selectedf = \'\';
|
||||
}
|
||||
}
|
||||
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\')
|
||||
{
|
||||
jQuery(".tablecheckboxcreatefromfetching").hide();
|
||||
jQuery(".tablecheckboxcreatemanually").show();
|
||||
if (typeof(jQuery("#checkboxcreatemanually:checked").val()) != \'undefined\') {
|
||||
console.log("show b");
|
||||
if (selectedm != \'createmanually\') {
|
||||
jQuery(".tablecheckboxcreatemanually").show();
|
||||
selectedm = \'createmanually\';
|
||||
selectedf = \'\';
|
||||
} else {
|
||||
jQuery(".tablecheckboxcreatemanually").hide();
|
||||
selectedm = \'\';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -359,7 +359,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
$_POST['param8b']='<img src=x onerror=alert(document.location) t='; // this is html obfuscated by non closing tag
|
||||
$_POST['param8c']='< with space after is ok';
|
||||
$_POST['param8d']='<abc123 is html to clean';
|
||||
$_POST['param8e']='<123abc is not html to clean';
|
||||
$_POST['param8e']='<123abc is not html to clean'; // other similar case: '<2021-12-12'
|
||||
$_POST['param8f']='abc<<svg <><<animate onbegin=alert(document.domain) a';
|
||||
$_POST["param9"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'objnotdefined\'';
|
||||
$_POST["param10"]='is_object($object) ? ($object->id < 10 ? round($object->id / 2, 2) : (2 * $user->id) * (int) substr($mysoc->zip, 1, 2)) : \'<abc>objnotdefined\'';
|
||||
@ -501,6 +501,10 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
print __METHOD__." result param7 = ".$result."\n";
|
||||
$this->assertEquals('"c:\this is a path~1\aaan &#x;;;;" abcdef', $result);
|
||||
|
||||
$result=GETPOST("param8e", 'restricthtml');
|
||||
print __METHOD__." result param8e = ".$result."\n";
|
||||
$this->assertEquals('', $result);
|
||||
|
||||
$result=GETPOST("param12", 'restricthtml');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(trim($_POST["param12"]), $result, 'Test a string with DOCTYPE and restricthtml');
|
||||
@ -519,7 +523,7 @@ class SecurityTest extends PHPUnit\Framework\TestCase
|
||||
|
||||
$result=GETPOST("param15", 'restricthtml'); // <img onerror<=alert(document.domain)> src=>0xbeefed
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15a'); // The GETPOST return a harmull string
|
||||
$this->assertEquals("<img onerror=alert(document.domain) src=>0xbeefed", $result, 'Test 15'); // The GETPOST return a harmull string
|
||||
|
||||
// Test with restricthtml + MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES to test disabling of bad atrributes
|
||||
$conf->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML = 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user