diff --git a/ChangeLog b/ChangeLog
index aa7d379f5e0..f47d9776587 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,7 @@ For users:
- New: Can delete several files at once in FTP module.
- New: Add box "last contracts".
- New: Works even if Web hosting provider has disabled glob function.
+- New: Can now send supplier order by mail.
- Fix: Format number was wrong for ar_AR language.
- Fix: Can change password if has only permission change password.
- Fix: Project PDF document show the tasks.
diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php
index d807170f0b5..c62d454e6f9 100644
--- a/htdocs/admin/agenda.php
+++ b/htdocs/admin/agenda.php
@@ -51,6 +51,7 @@ $eventstolog=array(
array('id'=>'BILL_SENTBYMAIL', 'test'=>$conf->facture->enabled),
array('id'=>'FICHEINTER_VALIDATE', 'test'=>$conf->ficheinter->enabled),
array('id'=>'ORDER_SUPPLIER_VALIDATE','test'=>$conf->fournisseur->enabled),
+ array('id'=>'ORDER_SUPPLIER_SENTBYMAIL','test'=>$conf->fournisseur->enabled),
array('id'=>'BILL_SUPPLIER_VALIDATE', 'test'=>$conf->fournisseur->enabled),
array('id'=>'BILL_SUPPLIER_PAYED', 'test'=>$conf->fournisseur->enabled),
// array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled),
diff --git a/htdocs/core/class/interfaces.class.php b/htdocs/core/class/interfaces.class.php
index e53c9473736..0e4b52e3290 100644
--- a/htdocs/core/class/interfaces.class.php
+++ b/htdocs/core/class/interfaces.class.php
@@ -60,12 +60,12 @@ class Interfaces
// Check parameters
if (! is_object($object) || ! is_object($conf)) // Error
{
- dol_syslog('interface::run_triggers was called with wrong parameters object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERROR);
+ dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_ERROR);
return -1;
}
if (! is_object($user) || ! is_object($langs)) // Warning
{
- dol_syslog('interface::run_triggers was called with wrong parameters object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
+ dol_syslog('interface::run_triggers was called with wrong parameters action='.$action.' object='.is_object($object).' user='.is_object($user).' langs='.is_object($langs).' conf='.is_object($conf), LOG_WARNING);
}
foreach($conf->triggers_modules as $dir)
@@ -88,7 +88,7 @@ class Interfaces
if (in_array($modName,$modules))
{
$langs->load("errors");
- dol_syslog("Interface::run_triggers ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
+ dol_syslog("Interface::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/"),LOG_ERR);
continue;
}
@@ -108,7 +108,7 @@ class Interfaces
if (! $qualified)
{
- dol_syslog("Interfaces::run_triggers Triggers for file '".$file."' need module to be enabled",LOG_INFO);
+ dol_syslog("Interfaces::run_triggers action=".$action." Triggers for file '".$file."' need module to be enabled",LOG_INFO);
continue;
}
@@ -120,11 +120,11 @@ class Interfaces
// Bypass if workflow module is enabled and if the trigger asked to be disable in such case
if ($conf->workflow->enabled && ! empty($objMod->disabled_if_workflow))
{
- dol_syslog("Interfaces::run_triggers Bypass triggers for file '".$file."'",LOG_INFO);
+ dol_syslog("Interfaces::run_triggers action=".$action." Bypass triggers for file '".$file."'",LOG_INFO);
continue;
}
- dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
+ dol_syslog("Interfaces::run_triggers action=".$action." Launch triggers for file '".$file."'",LOG_INFO);
$modules[$i] = $modName;
//dol_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO);
@@ -151,7 +151,7 @@ class Interfaces
}
else
{
- dol_syslog("Interfaces::run_triggers Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
+ dol_syslog("Interfaces::run_triggers action=".$action." Failed to instantiate trigger for file '".$file."'",LOG_ERROR);
}
}
}
@@ -160,7 +160,7 @@ class Interfaces
if ($nbko)
{
- dol_syslog("Interfaces::run_triggers Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
+ dol_syslog("Interfaces::run_triggers action=".$action." Files found: ".$nbfile.", Files launched: ".$nbtotal.", Done: ".$nbok.", Failed: ".$nbko, LOG_ERR);
return -$nbko;
}
else
diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php
index 88dab2e8300..e7c54204c79 100644
--- a/htdocs/fourn/commande/fiche.php
+++ b/htdocs/fourn/commande/fiche.php
@@ -638,7 +638,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
$commande->actiontypecode=$actiontypecode;
$commande->actionmsg = $actionmsg;
$commande->actionmsg2= $actionmsg2;
- $commande->orderrowid=$commande->id;
+ $commande->supplierorderrowid=$commande->id;
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
@@ -1249,8 +1249,6 @@ if ($id > 0 || ! empty($ref))
{
if ($user->rights->fournisseur->commande->commander)
{
- print ''.$langs->trans("CancelOrder").'';
-
$comref = dol_sanitizeFileName($commande->ref);
$file = $conf->fournisseur->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
if (file_exists($file))
diff --git a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
index ed52327869e..197da4bb31f 100644
--- a/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
+++ b/htdocs/includes/triggers/interface_modAgenda_ActionsAuto.class.php
@@ -324,6 +324,17 @@ class InterfaceActionsAuto
$object->propalrowid=$object->facid=0;
$ok=1;
}
+ elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
+ {
+ dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+ $langs->load("other");
+ $langs->load("bills");
+ $langs->load("agenda");
+ $langs->load("orders");
+ $ok=1;
+
+ // Parameters $object->xxx defined by caller
+ }
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
diff --git a/htdocs/lib/CMailFile.class.php b/htdocs/lib/CMailFile.class.php
index 2bd20a46be0..3eb394a5995 100644
--- a/htdocs/lib/CMailFile.class.php
+++ b/htdocs/lib/CMailFile.class.php
@@ -396,24 +396,25 @@ class CMailFile
{
$this->error="Failed to send mail to HOST=".$server.", PORT=".$conf->global->MAIN_MAIL_SMTP_PORT."
Recipient address '$dest' invalid";
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
+ $res=false;
}
else
{
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true);
$result=$this->smtps->sendMsg();
//print $result;
+
+ if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
+
+ $result=$this->smtps->getErrors();
+ if (empty($this->error) && empty($result)) $res=true;
+ else
+ {
+ if (empty($this->error)) $this->error=$result;
+ dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
+ $res=false;
+ }
}
-
- if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
-
- $result=$this->smtps->getErrors();
- if (empty($this->error) && empty($result)) $res=true;
- else
- {
- if (empty($this->error)) $this->error=$result;
- $res=false;
- }
-
}
else
{