2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur
2024-09-14 02:45:04 +02:00
7 changed files with 37 additions and 30 deletions

View File

@@ -185,10 +185,10 @@ if (empty($reshook) && (GETPOST('removedassigned') || GETPOST('removedassigned')
$_SESSION['assignedtouser'] = json_encode($tmpassigneduserids);
$donotclearsession = 1;
if ($action == 'add' && $usercancreate) {
if ($action == 'add') { // Test on permission not required here
$action = 'create';
}
if ($action == 'update' && $usercancreate) {
if ($action == 'update') { // Test on permission not required here
$action = 'edit';
}
@@ -989,6 +989,13 @@ if (empty($reshook) && $action == 'update' && $usercancreate) {
// the notification must be created for every user assigned to the event
foreach ($object->userassigned as $userassigned) {
$actionCommReminder->fk_user = $userassigned['id'];
// We update the event, so we recreate the notification event.
// First we delete all reminders for the user and the type of reminding (all offset dates).
$sqldelete = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_reminder";
$sqldelete .= " WHERE fk_user = ".((int) $actionCommReminder->fk_user)." AND fk_actioncomm = ".((int) $object->id)." AND typeremind = '".$db->escape($remindertype)."'";
$resqldelete = $db->query($sqldelete);
$res = $actionCommReminder->create($user);
if ($res <= 0) {
@@ -1003,13 +1010,14 @@ if (empty($reshook) && $action == 'update' && $usercancreate) {
}
}
if (!$error) {
unset($_SESSION['assignedtouser']);
unset($_SESSION['assignedtoresource']);
if (!$error) {
$db->commit();
} else {
$db->rollback();
$action = 'edit';
}
} else {
setEventMessages($object->error, $object->errors, 'errors');
@@ -1964,6 +1972,7 @@ if ($id > 0) {
$listofuserid = json_decode($_SESSION['assignedtouser'], true);
}
}
$listofcontactid = $object->socpeopleassigned; // Contact assigned
$listofotherid = $object->otherassigned; // Other undefined email (not used yet)

View File

@@ -140,6 +140,7 @@ class ActionCommReminder extends CommonObject
public $fk_email_template;
// END MODULEBUILDER PROPERTIES
/**
* Constructor
*
@@ -147,8 +148,6 @@ class ActionCommReminder extends CommonObject
*/
public function __construct(DoliDB $db)
{
global $conf;
$this->db = $db;
$this->ismultientitymanaged = 0;

View File

@@ -13122,7 +13122,7 @@ function getElementProperties($elementType)
*/
function fetchObjectByElement($element_id, $element_type, $element_ref = '', $useCache = 0, $maxCacheByType = 10)
{
global $db, $globalCacheForGetObjectFromCache;
global $db, $conf;
$ret = 0;
@@ -13144,11 +13144,11 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '', $us
//var_dump($element_prop['module'].' '.$ismodenabled);
if (is_array($element_prop) && (empty($element_prop['module']) || $ismodenabled)) {
if ($useCache === 1
&& !empty($globalCacheForGetObjectFromCache[$element_type])
&& !empty($globalCacheForGetObjectFromCache[$element_type][$element_id])
&& is_object($globalCacheForGetObjectFromCache[$element_type][$element_id])
&& !empty($conf->cache['fetchObjectByElement'][$element_type])
&& !empty($conf->cache['fetchObjectByElement'][$element_type][$element_id])
&& is_object($conf->cache['fetchObjectByElement'][$element_type][$element_id])
) {
return $globalCacheForGetObjectFromCache[$element_type][$element_id];
return $conf->cache['fetchObjectByElement'][$element_type][$element_id];
}
dol_include_once('/'.$element_prop['classpath'].'/'.$element_prop['classfile'].'.class.php');
@@ -13166,16 +13166,16 @@ function fetchObjectByElement($element_id, $element_type, $element_ref = '', $us
}
if ($useCache > 0) {
if (!isset($globalCacheForGetObjectFromCache[$element_type])) {
$globalCacheForGetObjectFromCache[$element_type] = [];
if (!isset($conf->cache['fetchObjectByElement'][$element_type])) {
$conf->cache['fetchObjectByElement'][$element_type] = [];
}
// Manage cache limit
if (! empty($globalCacheForGetObjectFromCache[$element_type]) && is_array($globalCacheForGetObjectFromCache[$element_type]) && count($globalCacheForGetObjectFromCache[$element_type]) >= $maxCacheByType) {
array_shift($globalCacheForGetObjectFromCache[$element_type]);
if (! empty($conf->cache['fetchObjectByElement'][$element_type]) && is_array($conf->cache['fetchObjectByElement'][$element_type]) && count($conf->cache['fetchObjectByElement'][$element_type]) >= $maxCacheByType) {
array_shift($conf->cache['fetchObjectByElement'][$element_type]);
}
$globalCacheForGetObjectFromCache[$element_type][$element_id] = $objecttmp;
$conf->cache['fetchObjectByElement'][$element_type][$element_id] = $objecttmp;
}
return $objecttmp;

View File

@@ -16,7 +16,6 @@
-- BEGIN MODULEBUILDER INDEXES
ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_rowid (rowid);
ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_ref (ref);
ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_status (status);
ALTER TABLE llx_bookcal_availabilities ADD INDEX idx_bookcal_availabilities_type (type);
@@ -27,4 +26,3 @@ ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities
--ALTER TABLE llx_bookcal_availabilities ADD UNIQUE INDEX uk_bookcal_availabilities_fieldxy(fieldx, fieldy);
--ALTER TABLE llx_bookcal_availabilities ADD CONSTRAINT llx_bookcal_availabilities_fk_field FOREIGN KEY (fk_field) REFERENCES llx_bookcal_myotherobject(rowid);

View File

@@ -20,7 +20,7 @@
ALTER TABLE llx_don ADD UNIQUE INDEX idx_don_uk_ref (ref, entity);
ALTER TABLE llx_don ADD INDEX idx_don_fk_soc (fk_soc);
ALTER TABLE llx_don ADD INDEX idx_don_fk_project (fk_project);
ALTER TABLE llx_don ADD INDEX idx_don_fk_project (fk_projet);
ALTER TABLE llx_don ADD INDEX idx_don_fk_user_author (fk_user_author);
ALTER TABLE llx_don ADD INDEX idx_don_fk_user_valid (fk_user_valid);

View File

@@ -252,20 +252,21 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) {
// Address
print '<tr><td class="tdtop">'.$form->editfieldkey('Address', 'address', '', $object, 0).'</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
print '<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
print dol_escape_htmltag($object->address, 0, 1);
print '</textarea>';
print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print '</td></tr>';
// Zip / Town
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>';
// Zip
print '<tr><td>'.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).'</td><td>';
print $formresource->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
print '</td>';
if ($conf->browser->layout == 'phone') {
print '</tr><tr>';
}
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td'.($conf->browser->layout == 'phone' ? ' colspan="3"' : '').'>';
print '</tr>';
// Town
print '<tr>';
print '<td>'.$form->editfieldkey('Town', 'town', '', $object, 0).'</td><td>';
print $formresource->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
print '</td></tr>';
@@ -281,9 +282,9 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) {
// State
if (!getDolGlobalString('SOCIETE_DISABLE_STATE')) {
if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) {
print '<tr><td>'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">';
print '<tr><td>'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
} else {
print '<tr><td>'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td colspan="3" class="maxwidthonsmartphone">';
print '<tr><td>'.$form->editfieldkey('State', 'state_id', '', $object, 0).'</td><td class="maxwidthonsmartphone">';
}
if ($object->country_id) {

View File

@@ -3113,7 +3113,7 @@ if (!GETPOST('hide_websitemenu')) {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=confirmgeneratesitemaps&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'"><span class="fa fa-sitemap"></span></a>';
// Find / replace tool
print '<a href="'.$_SERVER["PHP_SELF"].'?action=replacesite&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"></span></a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=replacesite&token='.newToken().'&website='.urlencode($website->ref).'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'"><span class="fa fa-search"></span></a>';
}
print '</span>';