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

This commit is contained in:
Laurent Destailleur 2022-10-15 13:57:23 +02:00
commit ccaa23121e
8 changed files with 39 additions and 15 deletions

View File

@ -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')";

View File

@ -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 '<input type="hidden" name="backtopage" value="'.($backtopage != '1' ? $backtopage : dol_htmlentities($_SERVER["HTTP_REFERER"])).'">';
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->code != "TICKET_MSG_PRIVATE") {
print '<input type="hidden" name="actioncode" value="'.$object->type_code.'">';
}
@ -1525,7 +1534,7 @@ if ($id > 0) {
print '<tr><td class="titlefieldcreate">'.$langs->trans("Ref").'</td><td colspan="3">'.$object->id.'</td></tr>';
// Type of event
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != "ticket") {
print '<tr><td class="fieldrequired">'.$langs->trans("Type").'</td><td colspan="3">';
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 '</td></tr>';
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td>'.$langs->trans("PrivateEventMessage").'</td><td colspan="3"><input type="checkbox" id="private" name="private" '.(($object->code == 'TICKET_MSG_PRIVATE') ? ' checked' : '').'></td></tr>';
// Title
print '<tr><td'.(empty($conf->global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").'</td><td colspan="3"><input type="text" name="label" class="soixantepercent" value="'.$object->label.'"></td></tr>';
@ -1994,13 +2006,16 @@ if ($id > 0) {
print '<table class="border tableforfield" width="100%">';
// Type
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) {
if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != 'ticket') {
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td>';
print $object->getTypePicto();
print $langs->trans("Action".$object->type_code);
print '</td></tr>';
}
// Private
if ($object->elementtype == 'ticket') print '<tr><td class="titlefield">'.$langs->trans("PrivateEventMessage").'</td><td>'.yn(($object->code == 'TICKET_MSG_PRIVATE') ? 1 : 0, 3).'</td></tr>';
// Full day event
print '<tr><td class="titlefield">'.$langs->trans("EventOnFullDay").'</td><td>'.yn($object->fulldayevent ? 1 : 0, 3).'</td></tr>';

View File

@ -18,6 +18,7 @@
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
* 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
@ -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;

View File

@ -788,7 +788,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) {
<?php
if (!empty($conf->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);
});
<?php
} ?>

View File

@ -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)";

View File

@ -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(

View File

@ -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;

View File

@ -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;
}
?>
<script type="text/javascript">