mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 02:10:32 +00:00
98_todoist.pm: bugfix title with space
git-svn-id: https://svn.fhem.de/fhem/trunk@27666 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
6c7885b065
commit
5d948d898b
@ -17,7 +17,13 @@ eval "use Date::Parse;1" or $missingModule .= "Date::Parse ";
|
|||||||
|
|
||||||
#######################
|
#######################
|
||||||
# Global variables
|
# Global variables
|
||||||
|
<<<<<<< .mine
|
||||||
|
my $version = "1.3.25";
|
||||||
|
||||||| .r26953
|
||||||
|
my $version = "1.3.15";
|
||||||
|
=======
|
||||||
my $version = "1.3.24";
|
my $version = "1.3.24";
|
||||||
|
>>>>>>> .r27665
|
||||||
my $apiUrl = "https://api.todoist.com/sync/v9/";
|
my $apiUrl = "https://api.todoist.com/sync/v9/";
|
||||||
|
|
||||||
my $srandUsed;
|
my $srandUsed;
|
||||||
@ -386,8 +392,15 @@ sub todoist_UpdateTask($$$) {
|
|||||||
my $tid;
|
my $tid;
|
||||||
|
|
||||||
## get Task-ID
|
## get Task-ID
|
||||||
|
<<<<<<< .mine
|
||||||
$tid = @$a[0];
|
$tid = @$a[0];
|
||||||
|
|
||||||
|
||||||| .r26953
|
||||||
|
my $tid = @$a[0];
|
||||||
|
=======
|
||||||
|
$tid = @$a[0];
|
||||||
|
>>>>>>> .r27665
|
||||||
|
|
||||||
## check if ID is todoist ID (ID:.*) or title (TITLE:.*)
|
## check if ID is todoist ID (ID:.*) or title (TITLE:.*)
|
||||||
my @temp=split(":",$tid);
|
my @temp=split(":",$tid);
|
||||||
|
|
||||||
@ -400,13 +413,28 @@ sub todoist_UpdateTask($$$) {
|
|||||||
## use task content
|
## use task content
|
||||||
elsif (@temp && $temp[0] =~ /title/i) {
|
elsif (@temp && $temp[0] =~ /title/i) {
|
||||||
$title = encode_utf8($temp[1]);
|
$title = encode_utf8($temp[1]);
|
||||||
|
<<<<<<< .mine
|
||||||
|
my $nTitle = $title;
|
||||||
|
$nTitle =~ s/ /_/g;
|
||||||
|
$taskId = $hash->{helper}{"TITLES"}{$nTitle} if ($hash->{helper}{"TITLES"});
|
||||||
|
}
|
||||||
|
elsif (defined($h->{"title"}) || defined($h->{"TITLE"}) || defined($h->{"Title"})) {
|
||||||
|
Log3 $name, 5, "todoist ($name): Debug: ".Dumper($h);
|
||||||
|
$title = $h->{"title"} if ($h->{"title"});
|
||||||
|
||||||| .r26953
|
||||||
|
$title = $h->{"title"} if ($h->{"title"});
|
||||||
|
=======
|
||||||
$taskId = $hash->{helper}{"TITLES"}{$title} if ($hash->{helper}{"TITLES"});
|
$taskId = $hash->{helper}{"TITLES"}{$title} if ($hash->{helper}{"TITLES"});
|
||||||
}
|
}
|
||||||
elsif (defined($h->{"title"}) || defined($h->{"TITLE"}) || defined($h->{"Title"})) {
|
elsif (defined($h->{"title"}) || defined($h->{"TITLE"}) || defined($h->{"Title"})) {
|
||||||
$title = $h->{"title"} if ($h->{"title"});
|
$title = $h->{"title"} if ($h->{"title"});
|
||||||
|
>>>>>>> .r27665
|
||||||
$title = $h->{"TITLE"} if ($h->{"TITLE"});
|
$title = $h->{"TITLE"} if ($h->{"TITLE"});
|
||||||
$title = $h->{"Title"} if ($h->{"Title"});
|
$title = $h->{"Title"} if ($h->{"Title"});
|
||||||
$taskId = $hash->{helper}{"TITLES"}{$title} if ($hash->{helper}{"TITLES"});
|
my $nTitle = $title;
|
||||||
|
$nTitle =~ s/ /_/g;
|
||||||
|
Log3 $name, 5, "todoist ($name): Debug: ".$nTitle;
|
||||||
|
$taskId = $hash->{helper}{"TITLES"}{$nTitle} if ($hash->{helper}{"TITLES"});
|
||||||
}
|
}
|
||||||
## use Task-Number
|
## use Task-Number
|
||||||
else {
|
else {
|
||||||
@ -1215,10 +1243,14 @@ sub todoist_GetTasksCallback($$$){
|
|||||||
readingsBulkUpdate($hash, $prefix.$t,$title);
|
readingsBulkUpdate($hash, $prefix.$t,$title);
|
||||||
readingsBulkUpdate($hash, $prefix.$t."_ID",$taskID) if (AttrVal($name,"hideId",0)!=1);
|
readingsBulkUpdate($hash, $prefix.$t."_ID",$taskID) if (AttrVal($name,"hideId",0)!=1);
|
||||||
|
|
||||||
|
# convert title
|
||||||
|
my $nTitle = $title;
|
||||||
|
$nTitle=~s/ /_/g;
|
||||||
|
|
||||||
## a few helper for ID and revision
|
## a few helper for ID and revision
|
||||||
$hash->{helper}{"IDS"}{"Task_".$i}=$taskID; # todoist Task-ID
|
$hash->{helper}{"IDS"}{"Task_".$i}=$taskID; # todoist Task-ID
|
||||||
$hash->{helper}{"TITLE"}{$taskID}=$title; # Task title (content)
|
$hash->{helper}{"TITLE"}{$taskID}=$title; # Task title (content)
|
||||||
$hash->{helper}{"TITLES"}{$title}=$taskID; # Task title (content)
|
$hash->{helper}{"TITLES"}{$nTitle}=$taskID; # Task title (content)
|
||||||
$hash->{helper}{"WID"}{$taskID}=$i; # FHEM Task-ID
|
$hash->{helper}{"WID"}{$taskID}=$i; # FHEM Task-ID
|
||||||
$hash->{helper}{"parent_id"}{$taskID}=$task->{parent_id}; # parent_id of item
|
$hash->{helper}{"parent_id"}{$taskID}=$task->{parent_id}; # parent_id of item
|
||||||
$hash->{helper}{"section_id"}{$taskID}=$task->{section_id}; # section_id of item
|
$hash->{helper}{"section_id"}{$taskID}=$task->{section_id}; # section_id of item
|
||||||
|
Loading…
x
Reference in New Issue
Block a user