Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop

Conflicts:
	htdocs/langs/en_US/products.lang
This commit is contained in:
Laurent Destailleur 2022-03-17 00:16:14 +01:00
commit 079fcacf13
10 changed files with 51 additions and 32 deletions

View File

@ -267,6 +267,7 @@ $constantes = array();
foreach ($listofnotifiedevents as $notifiedevent) {
$label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
$model = $notifiedevent['elementtype'].'_send';
if ($notifiedevent['elementtype'] == 'order_supplier') {
$elementLabel = $langs->trans('SupplierOrder');

View File

@ -16,7 +16,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014-2020 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2018 Christophe Battarel <christophe@altairis.fr>
@ -8587,6 +8587,7 @@ class Form
print '<br><form action="' . $_SERVER["PHP_SELF"] . '" method="POST" name="formlinkedbyref' . $key . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print '<input type="hidden" name="action" value="addlinkbyref">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="addlink" value="' . $key . '">';
print '<table class="noborder">';
print '<tr>';

View File

@ -88,7 +88,7 @@ class FormOther
$stringaddbarcode = str_replace("tmphtml", $htmltoreplaceby, $stringaddbarcode);
$out .= $stringaddbarcode.' <input type="text" name="barcodeproductqty" class="width50 right" value="1"><br>';
$out .= '<br>';
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'" placeholder="'.dol_escape_htmltag($langs->trans("ScanOrTypeOrCopyPasteYouBarCode")).'"></textarea>';
$out .= '<textarea type="text" name="barcodelist" class="centpercent" autofocus rows="'.ROWS_3.'" placeholder="'.dol_escape_htmltag($langs->trans("ScanOrTypeOrCopyPasteYourBarCodes")).'"></textarea>';
/*print '<br>'.$langs->trans("or").'<br>';
@ -110,7 +110,7 @@ class FormOther
$out .= 'jQuery("#scantoolmessage").text("");';
$out .= '});'."\n";
$out .= '$("#exec'.dol_escape_js($jstoexecuteonadd).'").click(function(){
console.log("We call js to execute '.dol_escape_js($jstoexecuteonadd).'");
console.log("We call js to execute \''.dol_escape_js($jstoexecuteonadd).'\'");
'.dol_escape_js($jstoexecuteonadd).'();
return false; /* We want to stay on the scan tool */
})';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2022 Ferran Marcet <fmarcet@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
@ -132,7 +133,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$this->db = $db;
$this->name = "standard";
$this->description = $langs->trans('DocumentModelStandardPDF');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
$this->update_main_doc_field = 0; // Save the name of generated file as the main doc when generating a doc with this template
// Page size for A4 format
$this->type = 'pdf';

View File

@ -337,7 +337,7 @@ if ($action == 'dispatch' && $permissiontoreceive) {
}
if (!$error) {
$result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLC, $dDLUO, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger);
$result = $object->dispatchProduct($user, GETPOST($prod, 'int'), GETPOST($qty), GETPOST($ent, 'int'), GETPOST($pu), GETPOST('comment'), $dDLUO, $dDLC, GETPOST($lot, 'alpha'), GETPOST($fk_commandefourndet, 'int'), $notrigger);
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
$error++;

View File

@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Check payments (incl. tax) are payable to
SendTo=sent to
PaymentByTransferOnThisBankAccount=Payment by transfer to the following bank account
VATIsNotUsedForInvoice=* Non applicable VAT art-293B of CGI
VATIsNotUsedForInvoiceAsso=* Non applicable VAT art-261-7 of CGI
LawApplicationPart1=By application of the law 80.335 of 12/05/80
LawApplicationPart2=the goods remain the property of
LawApplicationPart3=the seller until full payment of

View File

@ -413,3 +413,4 @@ SwitchOnSaleStatus=Switch on sale status
SwitchOnPurchaseStatus=Switch on purchase status
StockMouvementExtraFields= Extra Fields (stock mouvement)
InventoryExtraFields= Extra Fields (inventory)
ScanOrTypeOrCopyPasteYourBarCodes=Scan or type or copy/paste your barcodes

View File

@ -482,6 +482,7 @@ PaymentByChequeOrderedToShort=Règlement TTC par chèque à l'ordre de
SendTo=envoyé à
PaymentByTransferOnThisBankAccount=Règlement par virement sur le compte bancaire suivant
VATIsNotUsedForInvoice=* TVA non applicable art-293B du CGI
VATIsNotUsedForInvoiceAsso=* TVA non applicable art-261-7 du CGI
LawApplicationPart1=Par application de la loi 80.335 du 12/05/80
LawApplicationPart2=les marchandises demeurent la propriété du
LawApplicationPart3=vendeur jusqu'à complet encaissement de

View File

@ -46,7 +46,7 @@ class Mo extends CommonObject
/**
* @var int Does mo support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
*/
public $ismultientitymanaged = 0;
public $ismultientitymanaged = 1;
/**
* @var int Does mo support extrafields ? 0=No, 1=Yes

View File

@ -377,8 +377,9 @@ print '<script type="text/javascript">
function disablebuttonmakemovementandclose() {
console.log("Disable button idbuttonmakemovementandclose until we save");
jQuery("#idbuttonmakemovementandclose").attr(\'disabled\',\'disabled\');
jQuery("#idbuttonmakemovementandclose").attr(\'onclick\', \'return false;\');
jQuery("#idbuttonmakemovementandclose").attr(\'title\',\''.dol_escape_js($langs->trans("SaveQtyFirst")).'\');
jQuery("#idbuttonmakemovementandclose").attr(\'class\',\'butActionRefused\');
jQuery("#idbuttonmakemovementandclose").attr(\'class\',\'butActionRefused classfortooltip\');
};
jQuery(document).ready(function() {
@ -546,7 +547,7 @@ if ($object->id > 0) {
// Save
if ($object->status == $object::STATUS_VALIDATED) {
if ($permissiontoadd) {
print '<a class="butAction" id="idbuttonmakemovementandclose" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=record&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
print '<a class="butAction classfortooltip" id="idbuttonmakemovementandclose" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=record&token='.newToken().'" title="'.dol_escape_htmltag($langs->trans("MakeMovementsAndClose")).'">'.$langs->trans("MakeMovementsAndClose").'</a>'."\n";
} else {
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('MakeMovementsAndClose').'</a>'."\n";
}
@ -610,6 +611,7 @@ if ($object->id > 0) {
print '<script>';
print '
var duplicatedbatchcode = [];
var errortab1 = [];
var errortab2 = [];
var errortab3 = [];
@ -625,6 +627,7 @@ if ($object->id > 0) {
var textarea = $("textarea[name=barcodelist]").val();
var textarray = textarea.split(/[\s,;]+/);
var tabproduct = [];
duplicatedbatchcode = [];
errortab1 = [];
errortab2 = [];
errortab3 = [];
@ -636,18 +639,20 @@ if ($object->id > 0) {
if(textarray.some((element) => element != "")){
$(".expectedqty").each(function(){
id = this.id;
console.log("Analyze line "+id+" in inventory");
warehouse = $("#"+id+"_warehouse").children().first().text();
productbarcode = $("#"+id+"_product").children().first().attr("title");
productbarcode = productbarcode.split("<br>");
productbarcode = productbarcode.filter(barcode => barcode.includes("'.$langs->trans('BarCode').'"))[0];
productbarcode = productbarcode.slice(productbarcode.indexOf("</b> ")+5);
console.log("Analyze the line "+id+" in inventory, barcodemode="+barcodemode);
warehouse = $("#"+id+"_warehouse").attr(\'data-ref\');
//console.log(warehouse);
productbarcode = $("#"+id+"_product").attr(\'data-barcode\');
//console.log(productbarcode);
productbatchcode = $("#"+id+"_batch").attr(\'data-batch\');
//console.log(productbatchcode);
productbatchcode = $("#"+id+"_batch").text();
if (barcodemode != "barcodeforproduct") {
tabproduct.forEach(product=>{
console.log("product.Batch="+product.Batch+" productbatchcode="+productbatchcode);
if(product.Batch != "" && product.Batch == productbatchcode){
errortab1.push(productbatchcode);
console.log("duplicate batch code found for batch code "+productbatchcode);
duplicatedbatchcode.push(productbatchcode);
}
})
}
@ -658,7 +663,9 @@ if ($object->id > 0) {
tabproduct.push({\'Id\':id,\'Warehouse\':warehouse,\'Barcode\':productbarcode,\'Batch\':productbatchcode,\'Qty\':productinput,\'fetched\':false});
});
console.log("Loop on each record entered in the textarea");
textarray.forEach(function(element,index){
console.log("Process record element="+element+" id="+id);
var verify_batch = false;
var verify_barcode = false;
switch(barcodemode){
@ -673,15 +680,20 @@ if ($object->id > 0) {
verify_batch = barcodeserialforproduct(tabproduct,index,element,barcodeproductqty,selectaddorreplace,"lotserial");
break;
default:
alert("'.$langs->trans("ErrorWrongBarcodemode").' \""+barcodemode+"\"");
throw "'.$langs->trans('ErrorWrongBarcodemode').' \""+barcodemode+"\"";
alert(\''.dol_escape_js($langs->trans("ErrorWrongBarcodemode")).' "\'+barcodemode+\'"\');
throw \''.dol_escape_js($langs->trans('ErrorWrongBarcodemode')).' "\'+barcodemode+\'"\';
}
if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, error */
if (verify_batch == false && verify_barcode == false) { /* If the 2 flags are false, not found error */
errortab2.push(element);
}
if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
} else if (verify_batch == true && verify_barcode == true) { /* If the 2 flags are true, error: we don t know which one to take */
errortab3.push(element);
} else if (verify_batch == true) {
console.log("element="+element);
console.log(duplicatedbatchcode);
if (duplicatedbatchcode.includes(element)) {
errortab1.push(element);
}
}
});
@ -715,41 +727,41 @@ if ($object->id > 0) {
}
}
});
jQuery("#scantoolmessage").text("'.$langs->trans("QtyWasAddedToTheScannedBarcode").'\n");
jQuery("#scantoolmessage").text("'.dol_escape_js($langs->transnoentities("QtyWasAddedToTheScannedBarcode")).'\n");
/* document.forms["formrecord"].submit(); */
} else {
let stringerror = "";
if (Object.keys(errortab1).length > 0) {
stringerror += "<br>'.$langs->transnoentities('ErrorSameBatchNumber').': ";
stringerror += "<br>'.dol_escape_js($langs->transnoentities('ErrorSameBatchNumber')).': ";
errortab1.forEach(element => {
stringerror += (element + ", ")
});
stringerror = stringerror.slice(0, -2); /* Remove last ", " */
}
if (Object.keys(errortab2).length > 0) {
stringerror += "<br>'.$langs->transnoentities('ErrorCantFindCodeInInventory').': ";
stringerror += "<br>'.dol_escape_js($langs->transnoentities('ErrorCantFindCodeInInventory')).': ";
errortab2.forEach(element => {
stringerror += (element + ", ")
});
stringerror = stringerror.slice(0, -2); /* Remove last ", " */
}
if (Object.keys(errortab3).length > 0) {
stringerror += "<br>'.$langs->transnoentities('ErrorCodeScannedIsBothProductAndSerial').': ";
stringerror += "<br>'.dol_escape_js($langs->transnoentities('ErrorCodeScannedIsBothProductAndSerial')).': ";
errortab3.forEach(element => {
stringerror += (element + ", ")
});
stringerror = stringerror.slice(0, -2); /* Remove last ", " */
}
if (Object.keys(errortab4).length > 0) {
stringerror += "<br>'.$langs->transnoentities('ErrorBarcodeNotFoundForProductWarehouse').': ";
stringerror += "<br>'.dol_escape_js($langs->transnoentities('ErrorBarcodeNotFoundForProductWarehouse')).': ";
errortab4.forEach(element => {
stringerror += (element + ", ")
});
stringerror = stringerror.slice(0, -2); /* Remove last ", " */
}
jQuery("#scantoolmessage").text("'.$langs->trans("ErrorOnElementsInventory").'\n" + stringerror);
//alert("'.$langs->trans("ErrorOnElementsInventory").' :\n" + stringerror);
jQuery("#scantoolmessage").html(\''.dol_escape_js($langs->transnoentities("ErrorOnElementsInventory")).'\' + stringerror);
//alert("'.dol_escape_js($langs->trans("ErrorOnElementsInventory")).' :\n" + stringerror);
}
}
@ -827,6 +839,7 @@ if ($object->id > 0) {
print 'jQuery(document).ready(function() {
$("#clearqty").on("click", function() {
console.log("Clear all values");
disablebuttonmakemovementandclose();
jQuery(".realqty").val("");
return false; /* disable submit */
});
@ -945,16 +958,16 @@ if ($object->id > 0) {
}
print '<tr class="oddeven">';
print '<td id="id_'.$obj->rowid.'_warehouse">';
print '<td id="id_'.$obj->rowid.'_warehouse" data-ref="'.dol_escape_htmltag($warehouse_static->ref).'">';
print $warehouse_static->getNomUrl(1);
print '</td>';
print '<td id="id_'.$obj->rowid.'_product">';
print '<td id="id_'.$obj->rowid.'_product" data-ref="'.dol_escape_htmltag($product_static->ref).'" data-barcode="'.dol_escape_htmltag($product_static->barcode).'">';
print $product_static->getNomUrl(1).' - '.$product_static->label;
print '</td>';
if (!empty($conf->productbatch->enabled)) {
print '<td id="id_'.$obj->rowid.'_batch">';
print $obj->batch;
print '<td id="id_'.$obj->rowid.'_batch" data-batch="'.dol_escape_htmltag($obj->batch).'">';
print dol_escape_htmltag($obj->batch);
print '</td>';
}