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

develop
This commit is contained in:
Laurent Destailleur 2024-11-10 18:28:05 +01:00
commit 7e8fff6cb0
2 changed files with 22 additions and 28 deletions

View file

@ -130,7 +130,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforend
if ($duration_unit == 's') {
return $time + (int) ($duration_value);
}
if ($duration_unit == 'i') {
if ($duration_unit == 'i' || $duration_unit == 'mn' || $duration_unit == 'min') {
return $time + (int) (60 * $duration_value);
}
if ($duration_unit == 'h') {
@ -341,7 +341,7 @@ function convertDurationtoHour($duration_value, $duration_unit)
if ($duration_unit == 's') {
$result = $duration_value / 3600;
}
if ($duration_unit == 'i') {
if ($duration_unit == 'i' || $duration_unit == 'mn' || $duration_unit == 'min') {
$result = $duration_value / 60;
}
if ($duration_unit == 'h') {

View file

@ -297,43 +297,37 @@ class ProductAttributeValue extends CommonObjectLine
{
$return = array();
$sql = "SELECT ";
if ($only_used) {
$sql .= "DISTINCT ";
}
$sql .= "v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v ";
if ($only_used) {
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ON c2v.fk_prod_attr_val = v.rowid ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child ";
}
$sql = "SELECT v.fk_product_attribute, v.rowid, v.ref, v.value FROM " . MAIN_DB_PREFIX . "product_attribute_value v ";
$sql .= "WHERE v.fk_product_attribute = " . ((int) $prodattr_id);
if ($only_used) {
$sql .= " AND c2v.rowid IS NOT NULL AND p.tosell = 1";
$sql .= " AND EXISTS (SELECT c2v.fk_prod_attr_val ";
$sql .= "FROM " . MAIN_DB_PREFIX . "product_attribute_combination2val c2v ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product_attribute_combination c ON c.rowid = c2v.fk_prod_combination ";
$sql .= "LEFT JOIN " . MAIN_DB_PREFIX . "product p ON p.rowid = c.fk_product_child";
$sql .= " WHERE c2v.rowid IS NOT NULL AND p.tosell = 1 AND c2v.fk_prod_attr_val = v.rowid)";
}
$sql .= " ORDER BY v.position ASC";
$query = $this->db->query($sql);
while ($result = $this->db->fetch_object($query)) {
if (empty($returnonlydata)) {
$tmp = new ProductAttributeValue($this->db);
} else {
$tmp = new stdClass();
if ($query) {
while ($result = $this->db->fetch_object($query)) {
if (empty($returnonlydata)) {
$tmp = new ProductAttributeValue($this->db);
} else {
$tmp = new stdClass();
}
$tmp->fk_product_attribute = $result->fk_product_attribute;
$tmp->id = $result->rowid;
$tmp->ref = $result->ref;
$tmp->value = $result->value;
$return[] = $tmp;
}
$tmp->fk_product_attribute = $result->fk_product_attribute;
$tmp->id = $result->rowid;
$tmp->ref = $result->ref;
$tmp->value = $result->value;
$return[] = $tmp;
}
return $return;