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

This commit is contained in:
Laurent Destailleur 2022-07-10 19:22:02 +02:00
commit 3d226801ba
4 changed files with 13 additions and 3 deletions

View File

@ -776,7 +776,9 @@ if ($massaction == 'confirm_createbills') { // Create bills from orders.
}
$objecttmp->context['createfromclone'];
$rankedLine = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,

View File

@ -1950,7 +1950,7 @@ class ExtraFields
if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) {
continue;
}
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') {
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && !GETPOSTISSET('options_'.$key) && (! in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst')))) {
//when unticking boolean field, it's not set in POST
continue;
}

View File

@ -239,22 +239,26 @@ class modResource extends DolibarrModules
$this->export_code[$r] = $this->rights_class.'_'.$r;
$this->export_label[$r] = "ResourceSingular"; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_permission[$r] = array(array("resource", "read"));
$this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification");
$this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.rowid'=>'ResourceTypeID', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceTypeLabel', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification");
$this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text');
$this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource");
$keyforselect = 'resource';
$keyforelement = 'resource';
$keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.code = r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
$this->export_sql_end[$r] .= ' WHERE r.entity IN ('.getEntity('resource').')';
// Imports
//--------
$r = 0;

View File

@ -608,6 +608,10 @@ class ProductCombination
$prodcomb2val = new ProductCombination2ValuePair($this->db);
$prodcomb = new ProductCombination($this->db);
$features = array_filter($features, function ($v) {
return !empty($v);
});
foreach ($features as $attr => $attr_val) {
$actual_comp[$attr] = $attr_val;
}