#!C:\perl\bin -w -I./t
# PROGRAM modul : EDIREX5.pm  
# auther : LPO , M&F Hlinsko, Palackeho 1295, f.o. 
# GNU : garante jusqu a non changee  file.
# L'Original est depose chez auther
# Date de commence de creation  : 21.11.2002
# La dernier change             : 01.12.2003
#***************************************************
# Copyright : version 0.78  Milivoj Ivkovic mi@alma.ch or ivkovic@bluewin.ch
# 
# set par for calling sli:_alert
sub sli_alert {

  my ($smtpip,$smtpport);
  my ($authjm,$authpass);

  if ($param{'SendErrorEmail'} ne 1) { return; }
  if ($param{'SMTP_server'} eq '') { &Hlaska("Neni nakonfigurovan SMTP server, info email neodesilam!"); return; }
  if (!defined ($param{'Email_ERROR_TO'}) or ($param{'Email_ERROR_TO'} eq '')) { &Hlaska("Neni nakonfigurovan prijemce zprav! email neodesilam!"); return; }

  ($smtpip,$smtpport)=split(/\:/,$param{'SMTP_server'});
  if(!defined($smtpport)) { $smtpport='25'; }
  if(defined $param{'Email_authid'} ) { $authjm=$param{'Email_authid'} } else { $authjm=''; }
  if(defined $param{'Email_authpwd'} ) { $authpass=$param{'Email_authpwd'} } else { $authpass=''; }
  if(($authjm eq'' ) or ( $authpass eq '' )) {
    $ret1 = system ("$EDIREX_HOME\\Perl\\bin\\mailsend-go.exe -smtp $smtpip -port $smtpport -f $param{'Email_FROM'} -t $param{'Email_ERROR_TO'} -sub \"EDIREX error: $Chyba\" -M \"V klientu Teledin EDIREX vznikla chyba:\n\n$Chyba\n\nPokud neznate reseni, volejte support Teledin.\"");
  } else {
    $ret1 = system ("$EDIREX_HOME\\Perl\\bin\\mailsend-go.exe -smtp $smtpip -port $smtpport -f $param{'Email_FROM'} -t $param{'Email_ERROR_TO'} -sub \"EDIREX error: $Chyba\" -M \"V klientu Teledin EDIREX vznikla chyba:\n\n$Chyba\n\nPokud neznate reseni, volejte support Teledin.\" -starttls -auth -user $authjm -pass $authpass");
  }
  if($ret1) { &Hlaska("! Problem pri zasilani info e-mailu, ret=$ret1"); }
}

#************************************
sub waruj_na_doline
{
 use Win32::NetSend;

 my $varovani="EDIREX chyba: $Chyba \n";

   if ($param{'SendErrorPopup'} eq 1){
     my $posel = Win32::NetSend->new();
     if ( $param{'PopupComp1'} ne "" ){ $posel->Send(to => "$param{'PopupComp1'}",message => $varovani); }
     if ( $param{'PopupComp2'} ne "" ){ $posel->Send(to => "$param{'PopupComp2'}",message => $varovani); }
     if ( $param{'PopupComp3'} ne "" ){ $posel->Send(to => "$param{'PopupComp3'}",message => $varovani); }
   };
}# end of waruj na doline 
#*******************
;
1;