Skip to content

Commit

Permalink
Renamed the function to use the camel case syntax and implemented `$d…
Browse files Browse the repository at this point in the history
…b->plimit`;
  • Loading branch information
Elisée Chemin committed Nov 5, 2024
1 parent 80a26b6 commit 9395733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion htdocs/comm/action/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@
}

//call to get_busy_resource_during in resource.lib.php
$busyResources = get_busy_resource_during($eventDateStart, $eventDateEnd, $assigned_ressources);
$busyResources = getBusyResourcesInPeriod($eventDateStart, $eventDateEnd, $assigned_ressources);

/// === false because it can return an empty array
if ($busyResources === false) {
Expand Down
6 changes: 3 additions & 3 deletions htdocs/core/lib/resource.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ function resource_admin_prepare_head()
* @param $resource_ids array
* @return array|bool
*/
function get_busy_resource_during(string $dateStart, string $dateEnd, $resource_ids = array())
function getBusyResourcesInPeriod(string $dateStart, string $dateEnd, $resource_ids = array())
{
// MODIFIED CODE FROM htdocs/resource/element_resources.php
global $db;

$SELECT_LIMIT = $db->sanitize($db->escape(getDolGlobalString("RESOURCE_SELECT_LIMIT", 100)));
$SELECT_LIMIT = $db->plimit(getDolGlobalInt("RESOURCE_SELECT_LIMIT", 100));
if (!$db) {
// false to mimic what getRows returns
return false;
Expand Down Expand Up @@ -190,7 +190,7 @@ function get_busy_resource_during(string $dateStart, string $dateEnd, $resource_

// event date start before ac.datep and event date end after ac.datep2
$sql .= " OR (ac.datep >= '".$db->idate($dateStart). "' AND (ac.datep2 IS NOT NULL AND ac.datep2 <= '".$db->idate($dateEnd)."'))";
$sql .= ") LIMIT " . $SELECT_LIMIT;
$sql .= ") " . $SELECT_LIMIT;

$result = $db->getRows($sql);
$db->free();
Expand Down

0 comments on commit 9395733

Please sign in to comment.