Thank you for your feedback!
About your suggestion. Now, when an overlapping booking take place, the error/warning message lists the elements that already exist and it produces overlapping. This list of elements are links to their nodes.
With this in mind. You can click over this list of links to go to the nodes, then edit or delete them (if user has enough privilegies) and finally try to save the new booking.
Perhaps is not the best and confortable way, but for now... It works.
If you have some suggestion about how could be the best way that it would easy for users... For my side, I will think about how improve it!
In my case, I have Drupal core 10.2.6 and Rules module 8.x-3.0-alpha8 , and when it try to update de Drupal core to 10.3.0 version I get the following error:
The website encountered an unexpected error. Try again later.
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "user_role" plugin does not exist. Valid plugin IDs for Drupal\rules\Core\ConditionManager are: rules_node_is_promoted, rules_entity_is_of_type, rules_node_is_of_type, rules_entity_has_field, rules_user_has_role, rules_data_is_empty, rules_data_comparison, rules_path_has_alias, rules_entity_field_access, rules_node_is_published, rules_path_alias_exists, rules_list_contains, rules_node_is_sticky, rules_text_comparison, rules_list_count_is, rules_user_is_blocked, rules_entity_is_of_bundle, rules_entity_is_new in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
I'm sorry,
Could you specify the steps about how I can create? I don't achieve to find the options on the view.
intersarsi → created an issue.
intersarsi → created an issue.
Thanks @urvashi_vora for your feedback!
I have published a new release: 1.0.1 →
Thanks @urvashi_vora and @subhashuyadav for your feedback!
I executed the command:
phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml,twig ./web/modules/contrib/cool_calendar_extras/
and I have fixed some other issues → .
I have published a new release: 1.0.1 →
I recently installed the module with this configuration and it works for me:
Drupal 10.0.9
Smart Date 4.0.2
Multiple Fields Remove Button 8.x-2.2
Thank you @sakthi_dev !
I have applied this patch → and now it works fine.
- I have installed with composer: composer require cweagans/composer-patches
- I have created a path file "smart_date-acces-check-3366667.patch"
- I have copied it into the Drupal root directory.
- I have edited the composer.json file this the follow content:
- I have executed: composer update drupal/smart_date
"extra": {
"drupal-scaffold": {
intersarsi → created an issue.
Hi!
The module doesn't create a type of content for you.
You can enable the reminders for each type of content that you have.
For example, if you create a "room reservation" type of content, into the Drupal configuration section "/admin/config/regional/cool_calendar_extras" you will find a "room reservation" tab and here you can enable a check (the type of content must have a smart date field).
The user don't have the ability to set if he wants to recieve the remminder (only administrators).
It is a functionality on the type of content level, no for each node that user creates.
When cron's executes, it checks which nodes have a current date.
It sends an email for each node, it doesn't group all user remminders into a same email.
I will take a look the Easy Email module. It works with Drupal 10?
Thank you!
Hi,
I have developed a module that it checks overlapping reservations.
I hope it would be useful and you can take some idea.
Hi,
I have developed a module that it provides a block where it appears a legend with a list of terms of taxonomy with the colors for each term of taxonomy.
You can customize/override the twig template for your convinence.
I hope it would be useful and you can take some idea.
Regards
Thank you gisle!
Thank you for reviewing the module.
I'm agree with you, this is not the best refined and secure way.
However, there are two aspects that any administrator/developer have to to keep in mind:
Perhaps offering the option to configure a SSH tunnel it would improve the security. But at this moment I don't know if it is possible using the Drupal API and PHP.
I will thinking about. Any contribution will be welcome to make the module more secure.
intersarsi → created an issue.
Thank you gisle!
I will try open a request to contact to him for remove and start again.
I'm referring to Stivex Calendar Extras →
And the Drupal GitLab repository.
Where I can find the site moderator? I'm not able to find him.
Thank you cilefen!
As you suggested me, I has been thinking that adding indexes in some columns could be the best solution, but could not be the best way because I consider that alter the Drupal database structure is not a clean solution. If somebody tries to install the module where it has this code, also they should know which indexes are necessari to work fine.
I have taken an alternative way. I split the query with small queries, where each query retrieves me a part of the solution.
$query = $this->entityTypeManager->getStorage('node')->getQuery();
$query->accessCheck(FALSE);
$query->condition('status', 1);
$query->condition('type', $node_bundle);
...
//Array where I save the result
$nodes_id = array();
//For each recurrence I make a query
foreach($recurrences as $recurrence){
//Clone base query
$sub_query = clone $query;
//Get the timestamp start and end
$date_start = $recurrence['value'];
$date_end = $recurrence['end_value'];
//Create AND condition
$andGroup = $sub_query->andConditionGroup();
$andGroup->condition($smart_date_field_name . '.end_value', $date_start, '>');
$andGroup->condition($smart_date_field_name . '.value', $date_end, '<');
//Add the condition into the query
$sub_query->condition($andGroup);
//Show the query
//dpm($sub_query->__toString());
//Execute the query and save the results into the array
$nodes_id = array_merge($nodes_id, $sub_query->execute());
}
//Load the node objects from ids
$nodes = $this->entityTypeManager->getStorage('node')->loadMultiple($nodes_id);
return $nodes;
Perhaps is not the most elegant way, but it seems that this solution works.
intersarsi → created an issue.
Thank you!
The code below seems to work to check if it exists overlapped events:
$query = $this->entityTypeManager->getStorage('node')->getQuery();
$query->condition(...);
$recurrences = smart_date_recur_generate_rows($smart_date_field_value, $node_entity_type, $node_bundle, $smart_date_field_name, $month_limit);
$orGroup = $query->orConditionGroup();
foreach($recurrences as $recurrence){
$date_start = $recurrence['value'];
$date_end = $recurrence['end_value'];
$andGroup = $query->andConditionGroup();
$andGroup->condition($smart_date_field_name . '.end_value', $date_start, '>');
$andGroup->condition($smart_date_field_name . '.value', $date_end, '<');
$orGroup->condition($andGroup);
}
$query->condition($orGroup);
$nodes_id = $query->execute(); //overlapped events/nodes
In other hand, you commented that every time that I execute smart_date_recur_generate_rows() function it creates/generates a new rule entity that I have to delete when I have finished my validation.
Do you mean that the rule is saved into a database table? I have searched into the database table "smart_date_rule". Is here where it will be set/saved? I'm not able to find here.
Firstable, thank you for the suggested module, although not fits for our requeriments. We are using FullCalendar module.
I'm sorry, I'm not able to understand what you are trying to suggest me.
For example, I have an entity with a smart_date field filled with the information that shows the "smart_date_field.png" capture.
The result is that I have an event for each day (five "Prova" events), as it shows on "smart_date_calendar.png" capture.
When I save that node (that it contains the smart_date field) I do a validation to check if in these five days already exists other events (same day and time).
To get it I added a constraint on the entity using the hook "hook_entity_type_alter".
Into the constraint I'm trying to generate a query that retrieves me all events that already exists into that dates:
- If it retrives 0 elements, this it means it doesn't exist overlapped events, and it pass the constraint.
- If it retrives more than 0 elements, this it means that exists at least one overlap event, and don't pass the constraint.
When I validate, I get the value of the smart_date field with:
$node_dates = $node->get('field_reserva_sala_data_i_hora')->getValue();
With the instruction above I can retrieve only the first timestamp ocurrence with "field_reserva_sala_data_i_hora.value" and "field_reserva_sala_data_i_hora.end_value".
This it means that the loop iterates only one time, as a result, only one query condition has been added.
How I can get the other 4 ocurrences?
To get something like this:
WHERE
...
(
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_end_value" > '1678102200') and
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_value" < '1678105800')
)
OR
(
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_end_value" > '1688380200') and
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_value" < '1688383800')
)
OR
(
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_end_value" > '1691058600') and
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_value" < '1691062200')
)
OR
(
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_end_value" > '1693737000') and
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_value" < '1693740600')
)
OR
(
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_end_value" > '1696329000') and
("node__field_reserva_sala_data_i_hora"."field_reserva_sala_data_i_hora_value" < '1696332600')
)
...
intersarsi → created an issue.
Now it works with 5.x-dev.
Thanks!
intersarsi → created an issue.