/** * Send mail that was prepared by constructor * * @return boolean True if mail sent, false otherwise */ function sendfile() { global $conf; $errorlevel = error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings $res = false; dol_syslog("CSMSFile::sendfile addr_to=" . $this->addr_to, LOG_DEBUG); dol_syslog("CSMSFile::sendfile message=\n" . $this->message); $this->message = stripslashes($this->message); if (!empty($conf->global->MAIN_SMS_DEBUG)) { $this->dump_sms(); } if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) { // Action according to choosed sending method if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') { dol_include_once('/ovh/class/ovhsms.class.php'); $sms = new OvhSms($this->db); $sms->expe = $this->addr_from; $sms->dest = $this->addr_to; $sms->message = $this->message; $sms->deferred = $this->deferred; $sms->priority = $this->priority; $sms->class = $this->class; $res = $sms->SmsSend(); if ($res <= 0) { $this->error = $sms->error; dol_syslog("CSMSFile::sendfile: sms send error=" . $this->error, LOG_ERR); } else { dol_syslog("CSMSFile::sendfile: sms send success with id=" . $res, LOG_DEBUG); //var_dump($res); // 1973128 $this->dump_sms_result($res); } } else { if (!empty($conf->global->MAIN_SMS_SENDMODE)) { $tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE); $classfile = $tmp[0]; $module = empty($tmp[1]) ? $tmp[0] : $tmp[1]; dol_include_once('/' . $module . '/class/' . $classfile . '.class.php'); try { $classname = ucfirst($classfile); $sms = new $classname($this->db); $sms->expe = $this->addr_from; $sms->dest = $this->addr_to; $sms->deferred = $this->deferred; $sms->priority = $this->priority; $sms->class = $this->class; $sms->message = $this->message; $res = $sms->SmsSend(); if ($res <= 0) { $this->error = $sms->error; dol_syslog("CSMSFile::sendfile: sms send error=" . $this->error, LOG_ERR); } else { dol_syslog("CSMSFile::sendfile: sms send success with id=" . $res, LOG_DEBUG); //var_dump($res); // 1973128 $this->dump_sms_result($res); } } catch (Exception $e) { dol_print_error('', 'Error to get list of senders: ' . $e->getMessage()); } } else { // Send mail method not correctly defined // -------------------------------------- return 'Bad value for MAIN_SMS_SENDMODE constant'; } } } else { $this->error = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS'; dol_syslog("CSMSFile::sendfile: " . $this->error, LOG_WARNING); } error_reporting($errorlevel); // Reactive niveau erreur origine return $res; }
/** * Send mail that was prepared by constructor * * @return boolean True if mail sent, false otherwise */ function sendfile() { global $conf; $errorlevel=error_reporting(); error_reporting($errorlevel ^ E_WARNING); // Desactive warnings $res=false; dol_syslog("CSMSFile::sendfile addr_to=".$this->addr_to, LOG_DEBUG); dol_syslog("CSMSFile::sendfile message=\n".$this->message); $this->message=stripslashes($this->message); if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms(); if (empty($conf->global->MAIN_DISABLE_ALL_SMS)) { // Action according to choosed sending method if ($conf->global->MAIN_SMS_SENDMODE == 'ovh') { dol_include_once('/ovh/class/ovhsms.class.php'); $ovhsms=new OvhSms($this->db); //$ovhsms->session=''; //$ovhsms->account=''; $ovhsms->expe=$this->addr_from; $ovhsms->dest=$this->addr_to; $ovhsms->message=$this->message; //$ovhsms->validity=''; $ovhsms->deferred=$this->deferred; $ovhsms->priority=$this->priority; $ovhsms->class=$this->class; $res=$ovhsms->SmsSend(); if ($res <= 0) { $this->error=$ovhsms->error; dol_syslog("CSMSFile::sendfile: sms send error=".$this->error, LOG_ERR); } else { dol_syslog("CSMSFile::sendfile: sms send success with id=".$res, LOG_DEBUG); //var_dump($res); // 1973128 $this->dump_sms_result($res); } } else { // Send mail method not correctly defined // -------------------------------------- return 'Bad value for MAIN_SMS_SENDMODE constant'; } } else { $this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_SMS'; dol_syslog("CSMSFile::sendfile: ".$this->error, LOG_WARNING); } error_reporting($errorlevel); // Reactive niveau erreur origine return $res; }