summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2020-03-28 14:26:40 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-05-19 18:15:30 +0200
commit7dc24087185bfd12c0f9eb285cf991cda35288d0 (patch)
tree2045a4c94ee6db7d78868e6f54d89eec4f304b38
parentbdb5511e1e5d8fd2800a4cb0766ab1936f5d1950 (diff)
#942 Use both task_id and schedule_id in /schedule/get (web)
-rw-r--r--admin/WebConsole/gestores/gestor_programaciones.php2
-rw-r--r--admin/WebConsole/includes/restfunctions.php8
2 files changed, 6 insertions, 4 deletions
diff --git a/admin/WebConsole/gestores/gestor_programaciones.php b/admin/WebConsole/gestores/gestor_programaciones.php
index 814f98a1..5bd49b7c 100644
--- a/admin/WebConsole/gestores/gestor_programaciones.php
+++ b/admin/WebConsole/gestores/gestor_programaciones.php
@@ -87,7 +87,7 @@ if($pswop!=$op_suspension){
$phoras, $pampm, $pminutos);
$swop=$op_alta;
$schedule = get_schedule($pidentificador);
- $idr = max(array_keys($schedule));
+ $idr = max(array_column($schedule['schedule'], OG_REST_PARAM_ID));
break;
case $op_eliminacion:
$result = delete_schedule($pidprogramacion);
diff --git a/admin/WebConsole/includes/restfunctions.php b/admin/WebConsole/includes/restfunctions.php
index a748ef9a..5c73d7b7 100644
--- a/admin/WebConsole/includes/restfunctions.php
+++ b/admin/WebConsole/includes/restfunctions.php
@@ -30,7 +30,7 @@ define('OG_REST_CMD_RUN_TASK', 'task/run');
define('OG_REST_CMD_CREATE_SCHEDULE', 'schedule/create');
define('OG_REST_CMD_DELETE_SCHEDULE', 'schedule/delete');
define('OG_REST_CMD_UPDATE_SCHEDULE', 'schedule/update');
-define('OG_REST_CMD_SCHEDULE', 'schedule');
+define('OG_REST_CMD_GET_SCHEDULE', 'schedule/get');
define('OG_REST_PARAM_CLIENTS', 'clients');
define('OG_REST_PARAM_ADDR', 'addr');
@@ -619,13 +619,15 @@ function update_schedule($schedule_id, $task_id, $name, $years, $months, $days,
return common_request(OG_REST_CMD_UPDATE_SCHEDULE, POST, $data);
}
-function get_schedule($task_id = null) {
+function get_schedule($task_id = null, $schedule_id = null) {
if (isset($task_id))
$data = array(OG_REST_PARAM_TASK => strval($task_id));
+ else if (isset($schedule_id))
+ $data = array(OG_REST_PARAM_ID => strval($schedule_id));
else
$data = null;
- $result = common_request(OG_REST_CMD_SCHEDULE, POST, $data);
+ $result = common_request(OG_REST_CMD_GET_SCHEDULE, POST, $data);
return $result;
}