diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 05c8866bab0..0de26af413e 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -1090,6 +1090,20 @@ else
{
print ''.$langs->trans("BuildPDF").'';
}
+
+ // Send
+ if ($commande->statut == 1)
+ {
+ if ($user->rights->commande->envoyer)
+ {
+ $comref = sanitize_string($commande->ref);
+ $file = $conf->commande->dir_output . '/'.$comref.'/'.$comref.'.pdf';
+ if (file_exists($file))
+ {
+ print ''.$langs->trans('Send').'';
+ }
+ }
+ }
// Ship
if ($conf->expedition->enabled && $commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer)
@@ -1234,6 +1248,90 @@ else
dolibarr_print_error($db);
}
print '';
+
+ /*
+ * Liste des actions propres à la commande
+ */
+ $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ;
+ $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a';
+ $sql .= ' WHERE a.fk_commande = '.$commande->id ;
+ if ($socidp) $sql .= ' AND a.fk_soc = '.$socidp;
+ $resql = $db->query($sql);
+ if ($resql)
+ {
+ $num = $db->num_rows($resql);
+ if ($num)
+ {
+ print_titre($langs->trans('ActionsOnOrder'));
+ $i = 0;
+ $total = 0;
+ $var=true;
+
+ print '
';
+ print '| '.$langs->trans('Ref').' | '.$langs->trans('Date').' | '.$langs->trans('Action').' | '.$langs->trans('By').' |
';
+ print "\n";
+
+ while ($i < $num)
+ {
+ $objp = $db->fetch_object($resql);
+ $var=!$var;
+ print '';
+ print '| '.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.' | ';
+ print ''.dolibarr_print_date($objp->da)." | \n";
+ print ''.stripslashes($objp->label).' | ';
+ $authoract = new User($db);
+ $authoract->id = $objp->fk_user_author;
+ $authoract->fetch('');
+ print ''.$authoract->code.' | ';
+ print "
\n";
+ $i++;
+ }
+ print '
';
+ }
+ }
+ else
+ {
+ dolibarr_print_error($db);
+ }
+
+
+ /*
+ * Action presend
+ *
+ */
+ if ($_GET['action'] == 'presend')
+ {
+ print '
';
+ print_titre($langs->trans('SendOrderByMail'));
+
+ $liste[0]=" ";
+ foreach ($societe->contact_email_array() as $key=>$value)
+ {
+ $liste[$key]=$value;
+ }
+
+ // Créé l'objet formulaire mail
+ include_once('../html.formmail.class.php');
+ $formmail = new FormMail($db);
+ $formmail->fromname = $user->fullname;
+ $formmail->frommail = $user->email;
+ $formmail->withfrom=1;
+ $formmail->withto=$liste;
+ $formmail->withcc=1;
+ $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__');
+ $formmail->withfile=1;
+ $formmail->withbody=1;
+ // Tableau des substitutions
+ $formmail->substit['__ORDERREF__']=$commande->ref;
+ // Tableau des paramètres complémentaires
+ $formmail->param['action']='send';
+ $formmail->param['models']='order_send';
+ $formmail->param['orderid']=$commande->id;
+ $formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
+
+ $formmail->show_form();
+ }
+
}
else
{
diff --git a/htdocs/html.formmail.class.php b/htdocs/html.formmail.class.php
index b8f226b8e2e..7b8aa366d60 100644
--- a/htdocs/html.formmail.class.php
+++ b/htdocs/html.formmail.class.php
@@ -216,6 +216,7 @@ class FormMail
if ($this->param["models"]=='facture_send') { $defaultmessage="Veuillez trouver ci-joint la facture __FACREF__\n\nCordialement\n\n"; }
if ($this->param["models"]=='facture_relance') { $defaultmessage="Nous apportons à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\nCordialement\n\n"; }
if ($this->param["models"]=='propal_send') { $defaultmessage="Veuillez trouver ci-joint la proposition commerciale __PROPREF__\n\nCordialement\n\n"; }
+ if ($this->param["models"]=='order_send') { $defaultmessage="Veuillez trouver ci-joint la commande __ORDERREF__\n\nCordialement\n\n"; }
$defaultmessage=$this->make_substitutions($defaultmessage);
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index c8e88f591c7..7bfa66faf16 100755
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -60,6 +60,7 @@ OnProcessOrders=On process orders
RefCustomer=Ref. customer
RefCdeClient=Ref. customer order
RefCdeClientShort=Ref. cust. order
+SendPropalByMail=Send order by mail
# Sources
OrderSource0=Commercial proposal
OrderSource1=Internet
diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang
index 474d8c82dda..223cbfacd3f 100755
--- a/htdocs/langs/fr_FR/orders.lang
+++ b/htdocs/langs/fr_FR/orders.lang
@@ -60,6 +60,7 @@ OnProcessOrders=Commandes en cours de traitement
RefCustomer=Réf. client
RefCdeClient=Réf. commande client
RefCdeClientShort=Réf. com. client
+SendOrderByMail=Envoi commande par mail
# Sources
OrderSource0=Proposition commerciale
OrderSource1=Internet
diff --git a/mysql/migration/2.0.0-2.1.0.sql b/mysql/migration/2.0.0-2.1.0.sql
index c20ba5ef8ea..fe0ea49eb54 100644
--- a/mysql/migration/2.0.0-2.1.0.sql
+++ b/mysql/migration/2.0.0-2.1.0.sql
@@ -161,4 +161,6 @@ delete from llx_document_model where nom='azur' and type='order';
update llx_const set value='neptune' where value='pluton' and name = 'FACTURE_ADDON';
-update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON';
\ No newline at end of file
+update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON';
+
+alter table llx_actioncomm add column fk_commande integer after propalrowid;
\ No newline at end of file
diff --git a/mysql/tables/llx_actioncomm.sql b/mysql/tables/llx_actioncomm.sql
index 921b69d3736..17b811440ad 100644
--- a/mysql/tables/llx_actioncomm.sql
+++ b/mysql/tables/llx_actioncomm.sql
@@ -40,6 +40,7 @@ create table llx_actioncomm
percent smallint NOT NULL default 0,
note text,
propalrowid integer,
+ fk_commande integer,
fk_facture integer
)type=innodb;