diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 5620d56f60f..cfbe700b84d 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -370,7 +370,7 @@ if ($search_type > 0) {
$sql .= " AND t.rowid=".((int) $search_type);
}
if ($search_filter == 'withoutsubscription') {
- $sql .= " AND (datefin IS NULL OR t.subscription = '0')";
+ $sql .= " AND (datefin IS NULL)";
}
if ($search_filter == 'uptodate') {
$sql .= " AND (datefin >= '".$db->idate($now)."' OR t.subscription = '0')";
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 1f058b3c820..63647e9d308 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -71,6 +71,7 @@ $offsetunit = GETPOST('offsetunittype_duration', 'aZ09');
$remindertype = GETPOST('selectremindertype', 'aZ09');
$modelmail = GETPOST('actioncommsendmodel_mail', 'int');
$complete = GETPOST('complete', 'alpha'); // 'na' must be allowed
+$private = GETPOST('private', 'alphanohtml');
if ($complete == 'na' || $complete == -2) {
$complete = -1;
}
@@ -541,7 +542,15 @@ if (empty($reshook) && $action == 'update') {
$datef = dol_mktime($fulldayevent ? '23' : GETPOST("p2hour", 'int'), $fulldayevent ? '59' : GETPOST("p2min", 'int'), $fulldayevent ? '59' : GETPOST("apsec", 'int'), GETPOST("p2month", 'int'), GETPOST("p2day", 'int'), GETPOST("p2year", 'int'), 'tzuser');
}
- $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
+ if ($object->elementtype == 'ticket') {
+ if ($private) {
+ $object->type_code = 'TICKET_MSG_PRIVATE';
+ } else {
+ $object->type_id = dol_getIdFromCode($db, 'AC_EMAIL', 'c_actioncomm');
+ }
+ } else {
+ $object->type_id = dol_getIdFromCode($db, GETPOST("actioncode", 'aZ09'), 'c_actioncomm');
+ }
$object->label = GETPOST("label", "alphanohtml");
$object->datep = $datep;
$object->datef = $datef;
@@ -1513,7 +1522,7 @@ if ($id > 0) {
if ($backtopage) {
print ' ';
}
- if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
+ if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->code != "TICKET_MSG_PRIVATE") {
print ' ';
}
@@ -1525,7 +1534,7 @@ if ($id > 0) {
print '
'.$langs->trans("Ref").' '.$object->id.' ';
// Type of event
- if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
+ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != "ticket") {
print ''.$langs->trans("Type").' ';
if ($object->type_code != 'AC_OTH_AUTO') {
print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"');
@@ -1538,6 +1547,9 @@ if ($id > 0) {
print ' ';
}
+ // Private
+ if ($object->elementtype == 'ticket') print ''.$langs->trans("PrivateEventMessage").' code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'> ';
+
// Title
print 'global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").' ';
@@ -1994,13 +2006,16 @@ if ($id > 0) {
print '';
// Type
- if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
+ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
print ''.$langs->trans("Type").' ';
print $object->getTypePicto();
print $langs->trans("Action".$object->type_code);
print ' ';
}
+ // Private
+ if ($object->elementtype == 'ticket') print ''.$langs->trans("PrivateEventMessage").' '.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).' ';
+
// Full day event
print ''.$langs->trans("EventOnFullDay").' '.yn($object->fulldayevent ? 1 : 0, 3).' ';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 8da3a9465e4..e5617e5f3b3 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -18,6 +18,7 @@
* Copyright (C) 2020 Open-Dsi
* Copyright (C) 2021 Gauthier VERDOL
* Copyright (C) 2022 Anthony Berton
+ * Copyright (C) 2022 Ferran Marcet
*
* 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
@@ -7530,6 +7531,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__PROJECT_REF__'] = (is_object($object->projet) ? $object->projet->ref : '');
$substitutionarray['__PROJECT_NAME__'] = (is_object($object->projet) ? $object->projet->title : '');
}
+ if (is_object($object) && $object->element == 'project') {
+ $substitutionarray['__PROJECT_NAME__'] = $object->title;
+ }
if (is_object($object) && $object->element == 'shipping') {
$substitutionarray['__SHIPPINGTRACKNUM__'] = $object->tracking_number;
diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php
index 76d2282e9cc..5ce4ab76448 100644
--- a/htdocs/core/tpl/objectline_create.tpl.php
+++ b/htdocs/core/tpl/objectline_create.tpl.php
@@ -788,7 +788,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?>
jQuery.each(data.array_options, function( key, value ) {
- jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
+ jQuery('div[class*="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
});
diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php
index 12c63b2f5bd..c178fa070bc 100644
--- a/htdocs/partnership/partnership_list.php
+++ b/htdocs/partnership/partnership_list.php
@@ -359,7 +359,7 @@ foreach ($search as $key => $val) {
}
if ($managedfor == 'member') {
if ($search_filter == 'withoutsubscription') {
- $sql .= " AND (d.datefin IS NULL OR dty.subscription = 0)";
+ $sql .= " AND (d.datefin IS NULL)";
}
if ($search_filter == 'uptodate') {
$sql .= " AND (d.datefin >= '".$db->idate($now)."' OR dty.subscription = 0)";
diff --git a/htdocs/variants/ajax/get_attribute_values.php b/htdocs/variants/ajax/get_attribute_values.php
index 4500db843e8..827f9513220 100644
--- a/htdocs/variants/ajax/get_attribute_values.php
+++ b/htdocs/variants/ajax/get_attribute_values.php
@@ -73,7 +73,7 @@ if ($prodattr->fetch($id) < 0) {
$prodattrval = new ProductAttributeValue($db);
-$res = $prodattrval->fetchAllByProductAttribute($id);
+$res = $prodattrval->fetchAllByProductAttribute($id, false, 1);
if ($res == -1) {
print json_encode(array(
diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php
index 9d98f9a7f2b..24ddda92293 100644
--- a/htdocs/variants/class/ProductAttributeValue.class.php
+++ b/htdocs/variants/class/ProductAttributeValue.class.php
@@ -260,11 +260,12 @@ class ProductAttributeValue extends CommonObjectLine
/**
* Returns all product attribute values of a product attribute
*
- * @param int $prodattr_id Product attribute id
- * @param bool $only_used Fetch only used attribute values
- * @return ProductAttributeValue[]
+ * @param int $prodattr_id Product attribute id
+ * @param bool $only_used Fetch only used attribute values
+ * @param int $returnonlydata 0: return object, 1: return only data
+ * @return ProductAttributeValue[]
*/
- public function fetchAllByProductAttribute($prodattr_id, $only_used = false)
+ public function fetchAllByProductAttribute($prodattr_id, $only_used = false, $returnonlydata = 0)
{
$return = array();
@@ -291,7 +292,12 @@ class ProductAttributeValue extends CommonObjectLine
$query = $this->db->query($sql);
while ($result = $this->db->fetch_object($query)) {
- $tmp = new ProductAttributeValue($this->db);
+ 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;
diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php
index 646e1773201..9115ec585d8 100644
--- a/htdocs/variants/combinations.php
+++ b/htdocs/variants/combinations.php
@@ -492,7 +492,7 @@ if (!empty($id) || !empty($ref)) {
}
if ($action == 'add') {
- $prodattr_all = $prodattr->fetchAll();
+ $prodattr_all = $prodattr->fetchAll(1);
if (!$selected) {
$selected = $prodattr_all[key($prodattr_all)]->id;
@@ -503,7 +503,6 @@ if (!empty($id) || !empty($ref)) {
foreach ($prodattr_all as $each) {
$prodattr_alljson[$each->id] = $each;
}
-
?>