ajout possibilit d'envoyer la commande client par mail
This commit is contained in:
parent
9a1702065a
commit
47d395d125
@ -1090,6 +1090,20 @@ else
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=builddoc">'.$langs->trans("BuildPDF").'</a>';
|
||||
}
|
||||
|
||||
// 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 '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=presend">'.$langs->trans('Send').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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 '</td></tr></table>';
|
||||
|
||||
/*
|
||||
* 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 '<table class="border" width="100%">';
|
||||
print '<tr '.$bc[$var].'><td>'.$langs->trans('Ref').'</td><td>'.$langs->trans('Date').'</td><td>'.$langs->trans('Action').'</td><td>'.$langs->trans('By').'</td></tr>';
|
||||
print "\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowTask'),'task').' '.$objp->id.'</a></td>';
|
||||
print '<td>'.dolibarr_print_date($objp->da)."</td>\n";
|
||||
print '<td>'.stripslashes($objp->label).'</td>';
|
||||
$authoract = new User($db);
|
||||
$authoract->id = $objp->fk_user_author;
|
||||
$authoract->fetch('');
|
||||
print '<td>'.$authoract->code.'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
*
|
||||
*/
|
||||
if ($_GET['action'] == 'presend')
|
||||
{
|
||||
print '<br>';
|
||||
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
|
||||
{
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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';
|
||||
update llx_const set value='azur' where value='orange' and name = 'PROPALE_ADDON';
|
||||
|
||||
alter table llx_actioncomm add column fk_commande integer after propalrowid;
|
||||
@ -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;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user