Small typos
This commit is contained in:
parent
34b0f36b72
commit
ea91623e49
17
odoo2carddav
17
odoo2carddav
|
@ -27,7 +27,7 @@ my $conf = {
|
|||
password => undef,
|
||||
database => undef,
|
||||
filters => [
|
||||
["is_compagny", "=", "False"]
|
||||
["is_company", "=", "False"]
|
||||
]
|
||||
},
|
||||
dav => {
|
||||
|
@ -167,6 +167,7 @@ sub prompt_pass {
|
|||
|
||||
my %odoo_uuid = ();
|
||||
my $contact_count = 0;
|
||||
print "Querying Odoo API for contacts\n";
|
||||
foreach my $contact_id (@{$odoo->search('res.partner', $conf->{odoo}->{filters})}){
|
||||
my $contact = $odoo->read('res.partner', [ $contact_id ])->[0];
|
||||
|
||||
|
@ -202,9 +203,11 @@ _EOV
|
|||
open VCARD, ">$conf->{path}->{workdir}/$uuid.vcf";
|
||||
print VCARD $vcard;
|
||||
close VCARD;
|
||||
$countact_count++;
|
||||
$contact_count++;
|
||||
}
|
||||
|
||||
my $dav_success = 0;
|
||||
my $dav_error = 0;
|
||||
if (defined $conf->{dav}->{url}){
|
||||
my $d = HTTP::DAV->new();
|
||||
$d->credentials(
|
||||
|
@ -237,10 +240,8 @@ if (defined $conf->{dav}->{url}){
|
|||
}
|
||||
|
||||
print "Uploading vcards to webdav server $conf->{dav}->{url}\n";
|
||||
my $dav_success = 0;
|
||||
my $dav_error = 0;
|
||||
foreach my $vcf (glob("$conf->{path}->{workdir}/*.vcf")){
|
||||
if ($d->put( -local => "$vcf" ) == 0){
|
||||
if ($d->put( -local => "$vcf" ) == 1){
|
||||
$dav_success++;
|
||||
} else {
|
||||
print "An error occured while uploading $vcf : " . $d->message . "\n";
|
||||
|
@ -255,5 +256,7 @@ if (not $conf->{path}->{keep_vcards}){
|
|||
}
|
||||
|
||||
print "$contact_count contacts found in Odoo\n";
|
||||
print "$dav_success contacts successfuly uploaded to $conf->{dav}->{url}\n";
|
||||
print "$dav_error contacts failed while uploading to $conf->{dav}->{url}\n";
|
||||
if (defined $conf->{dav}->{url}){
|
||||
print "$dav_success contacts successfuly uploaded to $conf->{dav}->{url}\n";
|
||||
print "$dav_error contacts failed while uploading to $conf->{dav}->{url}\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue