New: Add list of attached files in email forms
This commit is contained in:
parent
9e54139305
commit
0a655c9370
@ -56,24 +56,66 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||
exit;
|
||||
}
|
||||
|
||||
// Action envoi test mailing
|
||||
if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
||||
{
|
||||
$filepath = array();
|
||||
$mimetype = array();
|
||||
$filename = array();
|
||||
|
||||
/*
|
||||
* Add file
|
||||
*/
|
||||
if ($_POST['addfile'])
|
||||
{
|
||||
// Set tmp user directory
|
||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
||||
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php');
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Echec transfert (fichier dépassant la limite ?)
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||
// print_r($_FILES);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_GET["action"]='test';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
|
||||
{
|
||||
$email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$errors_to = $_POST["errorstomail"];
|
||||
$sendto = $_POST["sendto"];
|
||||
$subject = $_POST['subject'];
|
||||
$body = $_POST['message'];
|
||||
if ($_FILES['addedfile']['tmp_name'])
|
||||
|
||||
// Get list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
$filepath[0] = $_FILES['addedfile']['tmp_name'];
|
||||
$mimetype[0] = $_FILES['addedfile']['type'];
|
||||
$filename[0] = $_FILES['addedfile']['name'];
|
||||
}
|
||||
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
|
||||
$listofnames[] = $_FILES['addedfile']['name'];
|
||||
$listofmimes[] = $_FILES['addedfile']['type'];
|
||||
}
|
||||
|
||||
if (! $sendto)
|
||||
{
|
||||
@ -91,7 +133,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
||||
$filepath,$mimetype,$filename,
|
||||
$listofpaths,$listofmimes,$listofnames,
|
||||
'', '', 0, $msgishtml,$errors_to);
|
||||
|
||||
$result=$mailfile->sendfile();
|
||||
@ -197,7 +239,7 @@ else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
|
||||
}
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test">'.$langs->trans("DoTestSend").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&mode=init">'.$langs->trans("DoTestSend").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
|
||||
@ -224,37 +266,44 @@ else
|
||||
|
||||
// Affichage formulaire de TEST
|
||||
if ($_GET["action"] == 'test')
|
||||
{
|
||||
print '<br>';
|
||||
print_titre($langs->trans("DoTestSend"));
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=$user->email?$user->email:1;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtopic=$langs->trans("Test");
|
||||
$formmail->withtopicreadonly=0;
|
||||
$formmail->withfile=1;
|
||||
$formmail->withbody=$langs->trans("Test");
|
||||
$formmail->withbodyreadonly=0;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param["action"]="send";
|
||||
$formmail->param["models"]="body";
|
||||
$formmail->param["mailid"]=$mil->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
{
|
||||
print '<br>';
|
||||
print_titre($langs->trans("DoTestSend"));
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
$formmail->withsubstit=0;
|
||||
$formmail->withfrom=1;
|
||||
$formmail->witherrorsto=1;
|
||||
$formmail->withto=$user->email?$user->email:1;
|
||||
$formmail->withtocc=1;
|
||||
$formmail->withtopic=$langs->trans("Test");
|
||||
$formmail->withtopicreadonly=0;
|
||||
$formmail->withfile=2;
|
||||
$formmail->withbody=$langs->trans("Test");
|
||||
$formmail->withbodyreadonly=0;
|
||||
$formmail->withcancel=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
// Tableau des parametres complementaires du post
|
||||
$formmail->param["action"]="send";
|
||||
$formmail->param["models"]="body";
|
||||
$formmail->param["mailid"]=$mil->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -616,6 +616,7 @@ else
|
||||
$formmail->withbody=0;
|
||||
$formmail->withbodyreadonly=1;
|
||||
$formmail->withcancel=1;
|
||||
$formmail->withdeliveryreceipt=0;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit=$substitutionarrayfortest;
|
||||
// Tableau des paramètres complémentaires du post
|
||||
@ -624,6 +625,12 @@ else
|
||||
$formmail->param["mailid"]=$mil->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$mil->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -292,17 +292,54 @@ if ($_REQUEST['action'] == 'setstatut' && $user->rights->propale->cloturer)
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($propal->statut==1) {
|
||||
$propal->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
|
||||
}
|
||||
// prevent browser refresh from closing proposal several times
|
||||
if ($propal->statut==1)
|
||||
{
|
||||
$propal->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add file
|
||||
*/
|
||||
if ($_POST['addfile'])
|
||||
{
|
||||
// Set tmp user directory
|
||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
||||
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php');
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Echec transfert (fichier dépassant la limite ?)
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||
// print_r($_FILES);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_GET["action"]='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Envoi de la propale par mail
|
||||
* Send mail
|
||||
*/
|
||||
if ($_POST['action'] == 'send')
|
||||
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
@ -1571,145 +1608,150 @@ if ($_GET['propalid'] > 0)
|
||||
/*
|
||||
* Boutons Actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($_GET['action'] != 'statut' && $_GET['action'] <> 'editline')
|
||||
if ($_GET['action'] != 'presend')
|
||||
{
|
||||
|
||||
// Valid
|
||||
if ($propal->statut == 0 && $propal->total_ttc > 0 && $user->rights->propale->valider)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($_GET['action'] != 'statut' && $_GET['action'] <> 'editline')
|
||||
{
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
|
||||
// Valid
|
||||
if ($propal->statut == 0 && $propal->total_ttc > 0 && $user->rights->propale->valider)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_validate&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_validate&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=validate"';
|
||||
}
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
else
|
||||
|
||||
// Edit
|
||||
if ($propal->statut == 1 && $user->rights->propale->creer)
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=validate"';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
|
||||
// Send
|
||||
if ($propal->statut == 1 && $user->rights->propale->envoyer)
|
||||
{
|
||||
$propref = sanitize_string($propal->ref);
|
||||
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
||||
if (file_exists($file))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($propal->statut == 1 && $user->rights->propale->cloturer)
|
||||
{
|
||||
print '<div id="confirm_close" style="display:none">';
|
||||
print $form_close."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
print 'href="#" onClick="dialogInfo($(\'confirm_close\').innerHTML)"'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=statut"';
|
||||
}
|
||||
print '>'.$langs->trans('Close').'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($propal->statut == 0 && $user->rights->propale->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_delete&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=delete"';
|
||||
}
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($propal->statut == 1 && $user->rights->propale->creer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($propal->statut == 1 && $user->rights->propale->envoyer)
|
||||
{
|
||||
$propref = sanitize_string($propal->ref);
|
||||
$file = $conf->propal->dir_output . '/'.$propref.'/'.$propref.'.pdf';
|
||||
if (file_exists($file))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=presend">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($propal->statut == 1 && $user->rights->propale->cloturer)
|
||||
{
|
||||
print '<div id="confirm_close" style="display:none">';
|
||||
print $form_close."\n";
|
||||
print '</div>'."\n";
|
||||
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
print 'href="#" onClick="dialogInfo($(\'confirm_close\').innerHTML)"'."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=statut"';
|
||||
}
|
||||
print '>'.$langs->trans('Close').'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($propal->statut == 0 && $user->rights->propale->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=confirm_delete&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?propalid='.$propal->id.'&action=delete"';
|
||||
}
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filename=sanitize_string($propal->ref);
|
||||
$filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref);
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
|
||||
$genallowed=$user->rights->propale->creer;
|
||||
$delallowed=$user->rights->propale->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
|
||||
|
||||
|
||||
/*
|
||||
* Commandes rattachees
|
||||
*/
|
||||
if($conf->commande->enabled)
|
||||
if ($_GET['action'] != 'presend')
|
||||
{
|
||||
$propal->loadOrders();
|
||||
$coms = $propal->commandes;
|
||||
if (sizeof($coms) > 0)
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filename=sanitize_string($propal->ref);
|
||||
$filedir=$conf->propal->dir_output . "/" . sanitize_string($propal->ref);
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?propalid=".$propal->id;
|
||||
$genallowed=$user->rights->propale->creer;
|
||||
$delallowed=$user->rights->propale->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
$somethingshown=$formfile->show_documents('propal',$filename,$filedir,$urlsource,$genallowed,$delallowed,$propal->modelpdf);
|
||||
|
||||
|
||||
/*
|
||||
* Commandes rattachees
|
||||
*/
|
||||
if($conf->commande->enabled)
|
||||
{
|
||||
if ($somethingshown) { print '<br>'; $somethingshown=1; }
|
||||
print_titre($langs->trans('RelatedOrders'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
for ($i = 0 ; $i < sizeof($coms) ; $i++)
|
||||
$propal->loadOrders();
|
||||
$coms = $propal->commandes;
|
||||
if (sizeof($coms) > 0)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$coms[$i]->id.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."</a></td>\n";
|
||||
print '<td align="center">'.dolibarr_print_date($coms[$i]->date,'day').'</td>';
|
||||
print '<td align="right">'.price($coms[$i]->total_ttc).'</td>';
|
||||
print '<td align="right">'.$coms[$i]->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
if ($somethingshown) { print '<br>'; $somethingshown=1; }
|
||||
print_titre($langs->trans('RelatedOrders'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
for ($i = 0 ; $i < sizeof($coms) ; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$coms[$i]->id.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."</a></td>\n";
|
||||
print '<td align="center">'.dolibarr_print_date($coms[$i]->date,'day').'</td>';
|
||||
print '<td align="right">'.price($coms[$i]->total_ttc).'</td>';
|
||||
print '<td align="right">'.$coms[$i]->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($propal,'propal',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($propal,'propal',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Action presend
|
||||
@ -1717,6 +1759,9 @@ if ($_GET['propalid'] > 0)
|
||||
*/
|
||||
if ($_GET['action'] == 'presend')
|
||||
{
|
||||
$ref = sanitize_string($propal->ref);
|
||||
$file = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
print '<br>';
|
||||
print_titre($langs->trans('SendPropalByMail'));
|
||||
|
||||
@ -1748,6 +1793,13 @@ if ($_GET['propalid'] > 0)
|
||||
$formmail->param['propalid']=$propal->id;
|
||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,$propal->ref.'.pdf','application/pdf');
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -525,7 +525,7 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
|
||||
|
||||
// Sauvegarde le dernier modele choisi pour generer un document
|
||||
$commande = new Commande($db, 0, $_REQUEST['id']);
|
||||
$commande->fetch($_REQUEST['id']);
|
||||
$result=$commande->fetch($_REQUEST['id']);
|
||||
if ($_REQUEST['model'])
|
||||
{
|
||||
$commande->setDocModel($user, $_REQUEST['model']);
|
||||
@ -565,17 +565,53 @@ if ($_REQUEST['action'] == 'remove_file')
|
||||
}
|
||||
|
||||
/*
|
||||
* Envoi de la commande par mail
|
||||
* Add file
|
||||
*/
|
||||
if ($_POST['action'] == 'send')
|
||||
if ($_POST['addfile'])
|
||||
{
|
||||
// Set tmp user directory
|
||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
||||
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php');
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Echec transfert (fichier dépassant la limite ?)
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||
// print_r($_FILES);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_GET["action"]='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['cancel'])
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
$commande= new Commande($db);
|
||||
if ( $commande->fetch($_POST['orderid']) )
|
||||
$result=$commande->fetch($_POST['orderid']);
|
||||
if ($result)
|
||||
{
|
||||
$orderref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
||||
$ref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
if (is_readable($file))
|
||||
{
|
||||
@ -627,19 +663,23 @@ if ($_POST['action'] == 'send')
|
||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||
}
|
||||
|
||||
$filepath[0] = $file;
|
||||
$filename[0] = $commande->ref.'.pdf';
|
||||
$mimetype[0] = 'application/pdf';
|
||||
if ($_FILES['addedfile']['tmp_name'])
|
||||
// Get list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
$filepath[1] = $_FILES['addedfile']['tmp_name'];
|
||||
$filename[1] = $_FILES['addedfile']['name'];
|
||||
$mimetype[1] = $_FILES['addedfile']['type'];
|
||||
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
|
||||
$listofnames[] = $_FILES['addedfile']['name'];
|
||||
$listofmimes[] = $_FILES['addedfile']['type'];
|
||||
}
|
||||
|
||||
// Envoi de la commande
|
||||
|
||||
// Send mail
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,'',$deliveryreceipt);
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$listofpaths,$listofmimes,$listofnames,$sendtocc,'',$deliveryreceipt);
|
||||
if ($mailfile->error)
|
||||
{
|
||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
||||
@ -699,6 +739,7 @@ if ($_POST['action'] == 'send')
|
||||
{
|
||||
$langs->load("other");
|
||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||
$_GET["action"]='presend';
|
||||
dolibarr_syslog('Recipient email is empty');
|
||||
}
|
||||
}
|
||||
@ -1679,207 +1720,213 @@ else
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
|
||||
if ($_GET['action'] != 'presend')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Valid
|
||||
if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
|
||||
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
|
||||
{
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
// on verifie si la commande est en numerotation provisoire
|
||||
$ref = substr($commande->ref, 1, 4);
|
||||
if ($ref == 'PROV')
|
||||
{
|
||||
$num = $commande->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$num = $commande->ref;
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_validate&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateOrder',$num).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=validate"';
|
||||
}
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($commande->statut == 1)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($commande->statut > 0)
|
||||
{
|
||||
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('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ship
|
||||
if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer
|
||||
&& $commande->getNbOfProductsLines() > 0)
|
||||
{
|
||||
|
||||
// Chargement des permissions
|
||||
$error = $user->load_entrepots();
|
||||
if (sizeof($user->entrepots) === 1)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$_GET['id'].'&action=create&commande_id='.$_GET["id"].'&entrepot_id='.$user->entrepots[0]['id'].'">';
|
||||
print $langs->trans('ShipProduct').'</a>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$_GET['id'].'">'.$langs->trans('ShipProduct').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Cloturer
|
||||
if ($commande->statut == 1 || $commande->statut == 2)
|
||||
{
|
||||
if ($user->rights->commande->cloturer)
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Valid
|
||||
if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
|
||||
{
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_close&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCloseOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'close\')"';
|
||||
// on verifie si la commande est en numerotation provisoire
|
||||
$ref = substr($commande->ref, 1, 4);
|
||||
if ($ref == 'PROV')
|
||||
{
|
||||
$num = $commande->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$num = $commande->ref;
|
||||
}
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_validate&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateOrder',$num).'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=close"';
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=validate"';
|
||||
}
|
||||
print '>'.$langs->trans('Close').'</a>';
|
||||
print '>'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Annuler commande
|
||||
if ($commande->statut == 1)
|
||||
{
|
||||
$nb_expedition = $commande->nb_expedition();
|
||||
if ($user->rights->commande->annuler && $nb_expedition == 0)
|
||||
|
||||
// Edit
|
||||
if ($commande->statut == 1)
|
||||
{
|
||||
if ($user->rights->commande->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$commande->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($commande->statut > 0)
|
||||
{
|
||||
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="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ship
|
||||
if ($commande->statut > 0 && $commande->statut < 3 && $user->rights->expedition->creer
|
||||
&& $commande->getNbOfProductsLines() > 0)
|
||||
{
|
||||
|
||||
// Chargement des permissions
|
||||
$error = $user->load_entrepots();
|
||||
if (sizeof($user->entrepots) === 1)
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/fiche.php?id='.$_GET['id'].'&action=create&commande_id='.$_GET["id"].'&entrepot_id='.$user->entrepots[0]['id'].'">';
|
||||
print $langs->trans('ShipProduct').'</a>';
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/commande.php?id='.$_GET['id'].'">'.$langs->trans('ShipProduct').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Cloturer
|
||||
if ($commande->statut == 1 || $commande->statut == 2)
|
||||
{
|
||||
if ($user->rights->commande->cloturer)
|
||||
{
|
||||
print '<a class="butAction" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_close&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCloseOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'close\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=close"';
|
||||
}
|
||||
print '>'.$langs->trans('Close').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Annuler commande
|
||||
if ($commande->statut == 1)
|
||||
{
|
||||
$nb_expedition = $commande->nb_expedition();
|
||||
if ($user->rights->commande->annuler && $nb_expedition == 0)
|
||||
{
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_cancel&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCancelOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'cancel\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=cancel"';
|
||||
}
|
||||
print '>'.$langs->trans('CancelOrder').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer commande
|
||||
if ($commande->statut == 0 && $user->rights->commande->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_cancel&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCancelOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'cancel\')"';
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_delete&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=cancel"';
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=delete"';
|
||||
}
|
||||
print '>'.$langs->trans('CancelOrder').'</a>';
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Supprimer commande
|
||||
if ($commande->statut == 0 && $user->rights->commande->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" ';
|
||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||
{
|
||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_delete&confirm=yes';
|
||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||
}
|
||||
else
|
||||
{
|
||||
print 'href="'.$_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=delete"';
|
||||
}
|
||||
print '>'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*
|
||||
*/
|
||||
$comref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref.'/'.$comref.'.pdf';
|
||||
$filedir = $conf->commande->dir_output . '/' . $comref;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
|
||||
$genallowed=$user->rights->commande->creer;
|
||||
$delallowed=$user->rights->commande->supprimer;
|
||||
|
||||
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
*/
|
||||
$sql = 'SELECT f.rowid,f.facnumber, f.total_ttc, '.$db->pdate('f.datef').' as df';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'co_fa as cf';
|
||||
$sql .= ' WHERE f.rowid = cf.fk_facture AND cf.fk_commande = '. $commande->id;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
|
||||
if ($_GET['action'] != 'presend')
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
if ($num)
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*
|
||||
*/
|
||||
$comref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref.'/'.$comref.'.pdf';
|
||||
$filedir = $conf->commande->dir_output . '/' . $comref;
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$commande->id;
|
||||
$genallowed=$user->rights->commande->creer;
|
||||
$delallowed=$user->rights->commande->supprimer;
|
||||
|
||||
$somethingshown=$formfile->show_documents('commande',$comref,$filedir,$urlsource,$genallowed,$delallowed,$commande->modelpdf);
|
||||
|
||||
/*
|
||||
* Liste des factures
|
||||
*/
|
||||
$sql = 'SELECT f.rowid,f.facnumber, f.total_ttc, '.$db->pdate('f.datef').' as df';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'co_fa as cf';
|
||||
$sql .= ' WHERE f.rowid = cf.fk_facture AND cf.fk_commande = '. $commande->id;
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
print '<br>';
|
||||
print_titre($langs->trans('RelatedBills'));
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans('Ref')."</td>";
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Price').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
$num = $db->num_rows($result);
|
||||
if ($num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="../compta/facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber.'</a></td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->df,'day').'</td>';
|
||||
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
|
||||
$i++;
|
||||
print '<br>';
|
||||
print_titre($langs->trans('RelatedBills'));
|
||||
$i = 0; $total = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans('Ref')."</td>";
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Price').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="../compta/facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber.'</a></td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->df,'day').'</td>';
|
||||
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($commande,'order',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($commande,'order',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -1888,24 +1935,8 @@ else
|
||||
*/
|
||||
if ($_GET['action'] == 'presend')
|
||||
{
|
||||
$orderref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
dolibarr_print_error($db,$result);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
$ref = sanitize_string($commande->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
print '<br>';
|
||||
print_titre($langs->trans('SendOrderByMail'));
|
||||
@ -1920,7 +1951,7 @@ else
|
||||
}
|
||||
|
||||
// Cree l'objet formulaire mail
|
||||
include_once('../html.formmail.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php');
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->fromtype = 'user';
|
||||
$formmail->fromid = $user->id;
|
||||
@ -1933,6 +1964,7 @@ else
|
||||
$formmail->withfile=1;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__ORDERREF__']=$commande->ref;
|
||||
// Tableau des parametres complementaires
|
||||
@ -1941,8 +1973,16 @@ else
|
||||
$formmail->param['orderid']=$commande->id;
|
||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,$ref.'.pdf','application/pdf');
|
||||
}
|
||||
|
||||
// Show form
|
||||
$formmail->show_form();
|
||||
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -950,17 +950,53 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
|
||||
}
|
||||
|
||||
/*
|
||||
* Action envoi de mail
|
||||
* Add file
|
||||
*/
|
||||
if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['cancel'])
|
||||
if ($_POST['addfile'])
|
||||
{
|
||||
// Set tmp user directory
|
||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||
$upload_dir = $conf->users->dir_tmp.'/temp/';
|
||||
|
||||
if (! empty($_FILES['addedfile']['tmp_name']))
|
||||
{
|
||||
if (! is_dir($upload_dir)) create_exdir($upload_dir);
|
||||
|
||||
if (is_dir($upload_dir))
|
||||
{
|
||||
if (dol_move_uploaded_file($_FILES['addedfile']['tmp_name'], $upload_dir . "/" . $_FILES['addedfile']['name'],0) > 0)
|
||||
{
|
||||
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
|
||||
//print_r($_FILES);
|
||||
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formmail.class.php');
|
||||
$formmail = new FormMail($db);
|
||||
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Echec transfert (fichier dépassant la limite ?)
|
||||
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
|
||||
// print_r($_FILES);
|
||||
}
|
||||
}
|
||||
}
|
||||
$_GET["action"]='presend';
|
||||
}
|
||||
|
||||
/*
|
||||
* Send mail
|
||||
*/
|
||||
if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['addfile'] && ! $_POST['cancel'])
|
||||
{
|
||||
$langs->load('mails');
|
||||
|
||||
$fac = new Facture($db,'',$_POST['facid']);
|
||||
if ( $fac->fetch($_POST['facid']) )
|
||||
$result=$fac->fetch($_POST['facid']);
|
||||
if ($result)
|
||||
{
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
||||
$ref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
if (is_readable($file))
|
||||
{
|
||||
@ -2684,257 +2720,210 @@ else
|
||||
print "</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
|
||||
if ($fac->statut == 1)
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
if ($_GET['action'] != 'prerelance' && $_GET['action'] != 'presend')
|
||||
{
|
||||
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
||||
{
|
||||
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
|
||||
$ventilExportCompta = $fac->getVentilExportCompta();
|
||||
|
||||
if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier
|
||||
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
|
||||
if ($fac->statut == 1)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Récurrente
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0)
|
||||
{
|
||||
if (! $facidnext)
|
||||
{
|
||||
print '<a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Valider
|
||||
if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
|
||||
{
|
||||
if ($user->rights->facture->valider)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=valid">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Envoyer
|
||||
if (($fac->statut == 1 || $fac->statut == 2) && $user->rights->facture->envoyer)
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendByMail').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=presend">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Envoyer une relance
|
||||
if (($fac->statut == 1 || $fac->statut == 2) && $resteapayer > 0 && $user->rights->facture->envoyer)
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendRemindByMail').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=prerelance">'.$langs->trans('SendRemindByMail').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Emettre paiement
|
||||
if ($fac->type != 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<font class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</font>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($resteapayer == 0)
|
||||
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
|
||||
$ventilExportCompta = $fac->getVentilExportCompta();
|
||||
|
||||
if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier
|
||||
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
||||
{
|
||||
print '<font class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</font>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPayment').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Emettre remboursement ou Convertir en reduc
|
||||
if ($fac->type == 2)
|
||||
{
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
|
||||
// Récurrente
|
||||
if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a>';
|
||||
if (! $facidnext)
|
||||
{
|
||||
print '<a class="butAction" href="facture/fiche-rec.php?facid='.$fac->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInvoice").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
|
||||
|
||||
// Valider
|
||||
if ($fac->statut == 0 && $num_lignes > 0 && (($fac->type < 2 && $fac->total_ttc >= 0) || ($fac->type == 2 && $fac->total_ttc <= 0)))
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
if ($user->rights->facture->valider)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=valid">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Classer 'payé'
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement &&
|
||||
(($fac->type != 2 && $resteapayer <= 0) || ($fac->type == 2 && $resteapayer >= 0)) )
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayed').'</a>';
|
||||
}
|
||||
|
||||
// Classer 'fermée' (possible si validée et pas encore classée payée)
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0
|
||||
&& $user->rights->facture->paiement)
|
||||
{
|
||||
if ($totalpaye > 0 || $totalavoir > 0)
|
||||
{
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayedPartially').'</a>';
|
||||
}
|
||||
else
|
||||
|
||||
// Envoyer
|
||||
if (($fac->statut == 1 || $fac->statut == 2) && $user->rights->facture->envoyer)
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<a class="butActionRefused">'.$langs->trans('ClassifyCanceled').'</span>';
|
||||
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendByMail').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=presend&mode=init">'.$langs->trans('SendByMail').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
if ($facidnext)
|
||||
|
||||
// Envoyer une relance
|
||||
if (($fac->statut == 1 || $fac->statut == 2) && $resteapayer > 0 && $user->rights->facture->envoyer)
|
||||
{
|
||||
print '<span class="butActionDeleteRefused">'.$langs->trans('Delete').'</span>';
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendRemindByMail').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=prerelance&mode=init">'.$langs->trans('SendRemindByMail').'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
// Emettre paiement
|
||||
if ($fac->type != 2 && $fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<font class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('DoPayment').'</font>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($resteapayer == 0)
|
||||
{
|
||||
print '<font class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</font>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPayment').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents générés
|
||||
*/
|
||||
$filename=sanitize_string($fac->ref);
|
||||
$filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->facture->creer;
|
||||
$delallowed=$user->rights->facture->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<br>';
|
||||
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
|
||||
|
||||
/*
|
||||
* Propales rattachées
|
||||
*/
|
||||
$sql = 'SELECT '.$db->pdate('p.datep').' as dp, p.total_ht, p.ref, p.ref_client, p.rowid as propalid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propal as p';
|
||||
$sql .= ", ".MAIN_DB_PREFIX."fa_pr as fp";
|
||||
$sql .= " WHERE fp.fk_propal = p.rowid AND fp.fk_facture = ".$fac->id;
|
||||
|
||||
dolibarr_syslog("facture.php: sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$i = 0; $total = 0;
|
||||
if ($somethingshown) print '<br>';
|
||||
$somethingshown=1;
|
||||
print_titre($langs->trans('RelatedCommercialProposals'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="150">'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('RefCustomer').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
|
||||
// Emettre remboursement ou Convertir en reduc
|
||||
if ($fac->type == 2)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="propal.php?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref.'</a></td>';
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dp,'day').'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print '</tr>';
|
||||
$total = $total + $objp->total_ht;
|
||||
$i++;
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||
{
|
||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a>';
|
||||
}
|
||||
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||
}
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="left">'.$langs->trans('TotalHT').'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total).'</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
// Classer 'payé'
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement &&
|
||||
(($fac->type != 2 && $resteapayer <= 0) || ($fac->type == 2 && $resteapayer >= 0)) )
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayed').'</a>';
|
||||
}
|
||||
|
||||
// Classer 'fermée' (possible si validée et pas encore classée payée)
|
||||
if ($fac->statut == 1 && $fac->paye == 0 && $resteapayer > 0
|
||||
&& $user->rights->facture->paiement)
|
||||
{
|
||||
if ($totalpaye > 0 || $totalavoir > 0)
|
||||
{
|
||||
// If one payment or one credit note was linked to this invoice
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=payed">'.$langs->trans('ClassifyPayedPartially').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<a class="butActionRefused">'.$langs->trans('ClassifyCanceled').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=canceled">'.$langs->trans('ClassifyCanceled').'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Supprimer
|
||||
if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
||||
{
|
||||
if ($facidnext)
|
||||
{
|
||||
print '<span class="butActionDeleteRefused">'.$langs->trans('Delete').'</span>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
if ($_GET['action'] != 'prerelance' && $_GET['action'] != 'presend')
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Commandes rattachées
|
||||
*/
|
||||
if($conf->commande->enabled)
|
||||
{
|
||||
$sql = 'SELECT '.$db->pdate('c.date_commande').' as date_commande, c.total_ht, c.ref, c.ref_client, c.rowid as id';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'co_fa as co_fa WHERE co_fa.fk_commande = c.rowid AND co_fa.fk_facture = '.$fac->id;
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
/*
|
||||
* Documents générés
|
||||
*/
|
||||
$filename=sanitize_string($fac->ref);
|
||||
$filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->id;
|
||||
$genallowed=$user->rights->facture->creer;
|
||||
$delallowed=$user->rights->facture->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
print '<br>';
|
||||
$somethingshown=$formfile->show_documents('facture',$filename,$filedir,$urlsource,$genallowed,$delallowed,$fac->modelpdf);
|
||||
|
||||
/*
|
||||
* Propales rattachées
|
||||
*/
|
||||
$sql = 'SELECT '.$db->pdate('p.datep').' as dp, p.total_ht, p.ref, p.ref_client, p.rowid as propalid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'propal as p';
|
||||
$sql .= ", ".MAIN_DB_PREFIX."fa_pr as fp";
|
||||
$sql .= " WHERE fp.fk_propal = p.rowid AND fp.fk_facture = ".$fac->id;
|
||||
|
||||
dolibarr_syslog("facture.php: sql=".$sql);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$i = 0; $total = 0;
|
||||
if ($somethingshown) print '<br>';
|
||||
$somethingshown=1;
|
||||
print_titre($langs->trans('RelatedOrders'));
|
||||
print_titre($langs->trans('RelatedCommercialProposals'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="150">'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('RefCustomerOrderShort').'</td>';
|
||||
print '<td>'.$langs->trans('RefCustomer').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowOrder'), 'order').' '.$objp->ref."</a></td>\n";
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td><a href="propal.php?propalid='.$objp->propalid.'">'.img_object($langs->trans('ShowPropal'),'propal').' '.$objp->ref.'</a></td>';
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->date_commande,'day').'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->dp,'day').'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print "</tr>\n";
|
||||
print '</tr>';
|
||||
$total = $total + $objp->total_ht;
|
||||
$i++;
|
||||
}
|
||||
@ -2950,27 +2939,80 @@ else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Commandes rattachées
|
||||
*/
|
||||
if($conf->commande->enabled)
|
||||
{
|
||||
$sql = 'SELECT '.$db->pdate('c.date_commande').' as date_commande, c.total_ht, c.ref, c.ref_client, c.rowid as id';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande as c, '.MAIN_DB_PREFIX.'co_fa as co_fa WHERE co_fa.fk_commande = c.rowid AND co_fa.fk_facture = '.$fac->id;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$langs->load("orders");
|
||||
|
||||
$i = 0; $total = 0;
|
||||
if ($somethingshown) print '<br>';
|
||||
$somethingshown=1;
|
||||
print_titre($langs->trans('RelatedOrders'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="150">'.$langs->trans('Ref').'</td>';
|
||||
print '<td>'.$langs->trans('RefCustomerOrderShort').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$objp->id.'">'.img_object($langs->trans('ShowOrder'), 'order').' '.$objp->ref."</a></td>\n";
|
||||
print '<td>'.$objp->ref_client.'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date($objp->date_commande,'day').'</td>';
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
print "</tr>\n";
|
||||
$total = $total + $objp->total_ht;
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td align="left">'.$langs->trans('TotalHT').'</td>';
|
||||
print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '<td align="right">'.price($total).'</td></tr>';
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dolibarr_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($fac,'invoice',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
print '<br>';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($fac,'invoice',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
|
||||
|
||||
/*
|
||||
* Affiche formulaire mail
|
||||
*/
|
||||
if ($_GET['action'] == 'presend')
|
||||
{
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
||||
$ref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
@ -3021,6 +3063,13 @@ else
|
||||
$formmail->param['facid']=$fac->id;
|
||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,$ref.'.pdf','application/pdf');
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
@ -3028,8 +3077,8 @@ else
|
||||
|
||||
if ($_GET['action'] == 'prerelance')
|
||||
{
|
||||
$facref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
||||
$ref = sanitize_string($fac->ref);
|
||||
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
@ -3068,6 +3117,7 @@ else
|
||||
$formmail->withfile=1;
|
||||
$formmail->withbody=1;
|
||||
$formmail->withdeliveryreceipt=1;
|
||||
$formmail->withcancel=1;
|
||||
// Tableau des substitutions
|
||||
$formmail->substit['__FACREF__']=$fac->ref;
|
||||
// Tableau des paramètres complémentaires
|
||||
@ -3076,6 +3126,13 @@ else
|
||||
$formmail->param['facid']=$fac->id;
|
||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/compta/facture.php?facid='.$fac->id;
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
$formmail->add_attached_files($file,$ref.'.pdf','application/pdf');
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
|
||||
@ -141,7 +141,7 @@ class Conf
|
||||
* Autres parametres globaux de configurations
|
||||
*/
|
||||
$this->users->dir_output=DOL_DATA_ROOT."/users";
|
||||
|
||||
|
||||
/*
|
||||
* Autorisation globale d'uploader (necessaire pour desactiver dans la demo)
|
||||
* conf->upload peut etre ecrasee dans main.inc.php (selon user)
|
||||
|
||||
@ -436,69 +436,6 @@ class FormFile
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Show list of documents in a directory
|
||||
* \param upload_dir Dir to scan
|
||||
* \param object Object on which document is linked to
|
||||
* \param modulepart Value for modulepart used by download wrapper
|
||||
* \return int <0 if KO, nb of files shown if OK
|
||||
*/
|
||||
function list_of_documents2($upload_dir,$object,$modulepart)
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
global $bc;
|
||||
|
||||
// List of documents
|
||||
$errorlevel=error_reporting();
|
||||
error_reporting(0);
|
||||
$handle=opendir($upload_dir);
|
||||
error_reporting($errorlevel);
|
||||
|
||||
// Affiche liste des documents existant
|
||||
print_titre($langs->trans("AttachedFiles"));
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Document').'</td>';
|
||||
print '<td align="right">'.$langs->trans('Size').'</td>';
|
||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
|
||||
if ($handle)
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (!is_dir($dir.$file)
|
||||
&& $file != '.'
|
||||
&& $file != '..'
|
||||
&& $file != 'CVS'
|
||||
&& ! eregi('\.meta$',$file)
|
||||
)
|
||||
{
|
||||
// Define relative path used to store the file
|
||||
$morepath=$object->ref.'/';
|
||||
if ($modulepart == 'facture_fournisseur') $morepath=get_exdir($object->id,2).$morepath;
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td>';
|
||||
print img_mime($file).' ';
|
||||
print '<a href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&file='.urlencode($morepath.$file).'">'.$file.'</a>';
|
||||
print "</td>\n";
|
||||
print '<td align="right">'.filesize($upload_dir.'/'.$file). ' '.$langs->trans('bytes').'</td>';
|
||||
print '<td align="center">'.dolibarr_print_date(filemtime($upload_dir.'/'.$file),'dayhour').'</td>';
|
||||
print '<td align="center">';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&urlfile='.urlencode($file).'">'.img_delete($langs->trans('Delete')).'</a>';
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@ -32,7 +32,6 @@ require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php");
|
||||
\remarks $formmail->proprietes=1 ou chaine ou tableau de valeurs
|
||||
\remarks $formmail->show_form() affiche le formulaire
|
||||
*/
|
||||
|
||||
class FormMail
|
||||
{
|
||||
var $db;
|
||||
@ -49,7 +48,7 @@ class FormMail
|
||||
var $withto;
|
||||
var $withtocc;
|
||||
var $withtopic;
|
||||
var $withfile;
|
||||
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
var $withbody;
|
||||
|
||||
var $withfromreadonly;
|
||||
@ -95,9 +94,51 @@ class FormMail
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear list of attached files (store in SECTION array)
|
||||
*/
|
||||
function clear_attached_files()
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
$conf->users->dir_tmp=DOL_DATA_ROOT."/users/".$user->id;
|
||||
$upload_dir = $conf->users->dir_tmp.'/temp';
|
||||
if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir);
|
||||
|
||||
unset($_SESSION["listofpaths"]);
|
||||
unset($_SESSION["listofnames"]);
|
||||
unset($_SESSION["listofmimes"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a file into the list of attached files (stored in SECTION array)
|
||||
*
|
||||
* @param unknown_type $path
|
||||
* @param unknown_type $file
|
||||
* @param unknown_type $type
|
||||
*/
|
||||
function add_attached_files($path,$file,$type)
|
||||
{
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||
if (! in_array($file,$listofnames))
|
||||
{
|
||||
$listofpaths[]=$path;
|
||||
$listofnames[]=$file;
|
||||
$listofmimes[]=$type;
|
||||
$_SESSION["listofpaths"]=join(';',$listofpaths);
|
||||
$_SESSION["listofnames"]=join(';',$listofnames);
|
||||
$_SESSION["listofmimes"]=join(';',$listofmimes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propriétés
|
||||
/**
|
||||
* \brief Affiche la partie de formulaire pour saisie d'un mail en fonction des propriétés
|
||||
* \remarks this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||
*/
|
||||
function show_form()
|
||||
{
|
||||
@ -106,6 +147,15 @@ class FormMail
|
||||
$langs->load("other");
|
||||
$langs->load("mails");
|
||||
|
||||
// Define list of attached files
|
||||
$listofpaths=array();
|
||||
$listofnames=array();
|
||||
$listofmimes=array();
|
||||
if (! empty($_SESSION["listofpaths"])) $listofpaths=split(';',$_SESSION["listofpaths"]);
|
||||
if (! empty($_SESSION["listofnames"])) $listofnames=split(';',$_SESSION["listofnames"]);
|
||||
if (! empty($_SESSION["listofmimes"])) $listofmimes=split(';',$_SESSION["listofmimes"]);
|
||||
|
||||
|
||||
$form=new Form($DB);
|
||||
|
||||
print "\n<!-- Debut form mail -->\n";
|
||||
@ -294,13 +344,32 @@ class FormMail
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Si fichier joint
|
||||
// Attached files
|
||||
if ($this->withfile)
|
||||
{
|
||||
print "<tr>";
|
||||
print "<td width=\"180\">".$langs->trans("MailFile")."</td>";
|
||||
print '<td width="180">'.$langs->trans("MailFile")."</td>";
|
||||
print "<td>";
|
||||
print "<input type=\"file\" class=\"flat\" name=\"addedfile\" value=\"".$langs->trans("Upload")."\"/>";
|
||||
//print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
if (sizeof($listofpaths))
|
||||
{
|
||||
foreach($listofpaths as $key => $val)
|
||||
{
|
||||
print img_mime($listofnames[$key]).' '.$listofnames[$key].'<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
if ($this->withfile == 2) // Can add other files
|
||||
{
|
||||
//print '<td><td align="right">';
|
||||
print "<input type=\"file\" class=\"flat\" name=\"addedfile\" value=\"".$langs->trans("Upload")."\"/>";
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="addfile" value="'.$langs->trans("MailingAddFile").'">';
|
||||
//print '</td></tr></table>';
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ MailCC=Copy to
|
||||
MailCCC=Cached copy to
|
||||
MailTopic=EMail topic
|
||||
MailText=Message
|
||||
MailFile=Attach a file
|
||||
MailFile=Attached files
|
||||
MailMessage=EMail body
|
||||
ListOfEMailings=List of emailings
|
||||
NewMailing=New emailing
|
||||
@ -54,6 +54,8 @@ RemoveRecipient=Remove recipient
|
||||
CommonSubstitutions=Common substitutions
|
||||
YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/includes/modules/mailings/README.
|
||||
EMailTestSubstitutionReplacedByGenericValues=When using test mode, substitutions variables are replaced by generic values
|
||||
MailingAddFile=Attach this file
|
||||
NoAttachedFiles=No attached files
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
MailingModuleDescContactCompanies=Unique contacts of all third parties
|
||||
|
||||
@ -1,90 +1,90 @@
|
||||
# Dolibarr language file - es_ES - mails
|
||||
Mailing=Mailing
|
||||
EMailing=Mailing
|
||||
Mailings=Mailings
|
||||
EMailings=Mailings
|
||||
MailCard=Ficha mailing
|
||||
MailTargets=Destinatarios
|
||||
MailRecipients=Dsetinatarios
|
||||
MailRecipient=Destinatario
|
||||
MailTitle=Titulo
|
||||
MailFrom=Remitente
|
||||
MailErrorsTo=Errores a
|
||||
MailReply=Responder a
|
||||
MailTo=Destinatario(s)
|
||||
MailCC=Copia a
|
||||
MailTopic=Asunto del e-mail
|
||||
MailText=Mensaje
|
||||
MailFile=Adjuntar un archivo
|
||||
MailMessage=Mensaje del e-mail
|
||||
ListOfEMailings=Listado de mailings
|
||||
NewMailing=Nuevo mailing
|
||||
EditMailing=Editar mailing
|
||||
DeleteMailing=Eliminar mailing
|
||||
DeleteAMailing=Eliminar un mailing
|
||||
PreviewMailing=Previsualizar un mailing
|
||||
PrepareMailing=Preparar mailing
|
||||
CreateMailing=Crear mailing
|
||||
MailingDesc=Esta página le permite enviar e-mails a un grupo de personas.
|
||||
MailingResult=Resultado del envío de e-mails
|
||||
TestMailing=Probar mailing
|
||||
ValidMailing=Validar mailing
|
||||
ApproveMailing=Aprobar mailing
|
||||
MailingStatusDraft=Borrador
|
||||
MailingStatusValidated=Validado
|
||||
MailingStatusApproved=Aprovado
|
||||
MailingStatusSent=Enviado
|
||||
MailingStatusSentPartialy=Enviado parcialmente
|
||||
MailingStatusSentCompletely=Enviado completamente
|
||||
MailingStatusError=Error
|
||||
MailingStatusNotSent=No enviado
|
||||
MailSuccessfulySent=E-mail enviado correctamente (de %s a %s)
|
||||
ErrorMailRecipientIsEmpty=La dirección del destinatario está vacía
|
||||
WarningNoEMailsAdded=Ningún nuevo e-mail a añadir a la lista destinatarios.
|
||||
ConfirmValidMailing=¿Confirma la validación del mailing?
|
||||
ConfirmDeleteMailing=¿Confirma la eliminación del mailing?
|
||||
NbOfRecipients=Número de destinatarios
|
||||
NbOfUniqueEMails=Nº de e-mails únicos
|
||||
NbOfEMails=Nº de E-mails
|
||||
TotalNbOfDistinctRecipients=Número de destinatarios únicos
|
||||
NoTargetYet=Ningún destinatario definido
|
||||
AddRecipients=Añadir destinatarios
|
||||
RemoveRecipient=Eliminar destinatario
|
||||
CommonSubstitutions=Substituciones comunes
|
||||
YouCanAddYourOwnPredefindedListHere=Para crear su módulo de selección e-mails, vea htdocs/includes/modules/mailings/README.
|
||||
EMailTestSubstitutionReplacedByGenericValues=En modo prueba, las variables de sustitución son sustituidas por valores genéricos
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
|
||||
MailingModuleDescContactCompanies=Contactos de terceros (clientes potenciales, clientes, proveedores...)
|
||||
MailingModuleDescDolibarrUsers=Usuarios de Dolibarr que tienen e-mail
|
||||
MailingModuleDescFundationMembers=Miembros que tienen e-mail
|
||||
|
||||
|
||||
RecipientSelectionModules=Módulos de selección de los destinatarios
|
||||
MailSelectedRecipients=Destinatarios seleccionados
|
||||
MailingArea=Area mailings
|
||||
LastMailings=Los %s últimos mailings
|
||||
TargetsStatistics=Estadísticas destinatarios
|
||||
NbOfCompaniesContacts=Contactos únicos de empresas
|
||||
MailNoChangePossible=Destinatarios de un mailing validado no modificables
|
||||
SearchAMailing=Buscar un mailing
|
||||
SendMailing=Enviar mailing
|
||||
SendMail=Enviar e-mail
|
||||
SentBy=Enviado por
|
||||
MailingNeedCommand=Por razones de seguridad, el envío de un mailing en masa puede realizarse en línea de comandos. Pida a su administrador que lance el comando siguiente para para enviar la correspondencia a a todos los destinatarios:
|
||||
TargetsReset=Vaciar lista
|
||||
ToClearAllRecipientsClickHere=Para vaciar la lista de los destinatarios de este mailing, haga click en el botón
|
||||
ToAddRecipientsChooseHere=Para añadir destinatarios, escoja los que figuran en las listas a continuación
|
||||
NbOfEMailingsReceived=Mailings en masa recibidos
|
||||
IdRecord=ID registro
|
||||
DeliveryReceipt=Acuso de recibo
|
||||
|
||||
# Module Notifications
|
||||
|
||||
Notifications=Notificaciones
|
||||
NoNotificationsWillBeSent=Ninguna notificación por e-mail está prevista para este evento y empresa
|
||||
ANotificationsWillBeSent=1 notificación va a ser enviada por e-mail
|
||||
SomeNotificationsWillBeSent=%s notificaciones van a ser enviadas por e-mail
|
||||
AddNewNotification=Activar una nueva solicitud de notificación
|
||||
ListOfActiveNotifications=Lista de las solicitudes de notificaciones activas
|
||||
# Dolibarr language file - es_ES - mails
|
||||
Mailing=Mailing
|
||||
EMailing=Mailing
|
||||
Mailings=Mailings
|
||||
EMailings=Mailings
|
||||
MailCard=Ficha mailing
|
||||
MailTargets=Destinatarios
|
||||
MailRecipients=Dsetinatarios
|
||||
MailRecipient=Destinatario
|
||||
MailTitle=Titulo
|
||||
MailFrom=Remitente
|
||||
MailErrorsTo=Errores a
|
||||
MailReply=Responder a
|
||||
MailTo=Destinatario(s)
|
||||
MailCC=Copia a
|
||||
MailTopic=Asunto del e-mail
|
||||
MailText=Mensaje
|
||||
MailFile=Archivo
|
||||
MailMessage=Mensaje del e-mail
|
||||
ListOfEMailings=Listado de mailings
|
||||
NewMailing=Nuevo mailing
|
||||
EditMailing=Editar mailing
|
||||
DeleteMailing=Eliminar mailing
|
||||
DeleteAMailing=Eliminar un mailing
|
||||
PreviewMailing=Previsualizar un mailing
|
||||
PrepareMailing=Preparar mailing
|
||||
CreateMailing=Crear mailing
|
||||
MailingDesc=Esta página le permite enviar e-mails a un grupo de personas.
|
||||
MailingResult=Resultado del envío de e-mails
|
||||
TestMailing=Probar mailing
|
||||
ValidMailing=Validar mailing
|
||||
ApproveMailing=Aprobar mailing
|
||||
MailingStatusDraft=Borrador
|
||||
MailingStatusValidated=Validado
|
||||
MailingStatusApproved=Aprovado
|
||||
MailingStatusSent=Enviado
|
||||
MailingStatusSentPartialy=Enviado parcialmente
|
||||
MailingStatusSentCompletely=Enviado completamente
|
||||
MailingStatusError=Error
|
||||
MailingStatusNotSent=No enviado
|
||||
MailSuccessfulySent=E-mail enviado correctamente (de %s a %s)
|
||||
ErrorMailRecipientIsEmpty=La dirección del destinatario está vacía
|
||||
WarningNoEMailsAdded=Ningún nuevo e-mail a añadir a la lista destinatarios.
|
||||
ConfirmValidMailing=¿Confirma la validación del mailing?
|
||||
ConfirmDeleteMailing=¿Confirma la eliminación del mailing?
|
||||
NbOfRecipients=Número de destinatarios
|
||||
NbOfUniqueEMails=Nº de e-mails únicos
|
||||
NbOfEMails=Nº de E-mails
|
||||
TotalNbOfDistinctRecipients=Número de destinatarios únicos
|
||||
NoTargetYet=Ningún destinatario definido
|
||||
AddRecipients=Añadir destinatarios
|
||||
RemoveRecipient=Eliminar destinatario
|
||||
CommonSubstitutions=Substituciones comunes
|
||||
YouCanAddYourOwnPredefindedListHere=Para crear su módulo de selección e-mails, vea htdocs/includes/modules/mailings/README.
|
||||
EMailTestSubstitutionReplacedByGenericValues=En modo prueba, las variables de sustitución son sustituidas por valores genéricos
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
|
||||
MailingModuleDescContactCompanies=Contactos de terceros (clientes potenciales, clientes, proveedores...)
|
||||
MailingModuleDescDolibarrUsers=Usuarios de Dolibarr que tienen e-mail
|
||||
MailingModuleDescFundationMembers=Miembros que tienen e-mail
|
||||
|
||||
|
||||
RecipientSelectionModules=Módulos de selección de los destinatarios
|
||||
MailSelectedRecipients=Destinatarios seleccionados
|
||||
MailingArea=Area mailings
|
||||
LastMailings=Los %s últimos mailings
|
||||
TargetsStatistics=Estadísticas destinatarios
|
||||
NbOfCompaniesContacts=Contactos únicos de empresas
|
||||
MailNoChangePossible=Destinatarios de un mailing validado no modificables
|
||||
SearchAMailing=Buscar un mailing
|
||||
SendMailing=Enviar mailing
|
||||
SendMail=Enviar e-mail
|
||||
SentBy=Enviado por
|
||||
MailingNeedCommand=Por razones de seguridad, el envío de un mailing en masa puede realizarse en línea de comandos. Pida a su administrador que lance el comando siguiente para para enviar la correspondencia a a todos los destinatarios:
|
||||
TargetsReset=Vaciar lista
|
||||
ToClearAllRecipientsClickHere=Para vaciar la lista de los destinatarios de este mailing, haga click en el botón
|
||||
ToAddRecipientsChooseHere=Para añadir destinatarios, escoja los que figuran en las listas a continuación
|
||||
NbOfEMailingsReceived=Mailings en masa recibidos
|
||||
IdRecord=ID registro
|
||||
DeliveryReceipt=Acuso de recibo
|
||||
|
||||
# Module Notifications
|
||||
|
||||
Notifications=Notificaciones
|
||||
NoNotificationsWillBeSent=Ninguna notificación por e-mail está prevista para este evento y empresa
|
||||
ANotificationsWillBeSent=1 notificación va a ser enviada por e-mail
|
||||
SomeNotificationsWillBeSent=%s notificaciones van a ser enviadas por e-mail
|
||||
AddNewNotification=Activar una nueva solicitud de notificación
|
||||
ListOfActiveNotifications=Lista de las solicitudes de notificaciones activas
|
||||
|
||||
@ -16,7 +16,7 @@ MailCC=Copie
|
||||
MailCCC=Copie cachée à
|
||||
MailTopic=Sujet du mail
|
||||
MailText=Message
|
||||
MailFile=Joindre un fichier
|
||||
MailFile=Fichiers joints
|
||||
MailMessage=Message du mail
|
||||
ListOfEMailings=Liste des mailings
|
||||
NewMailing=Nouveau mailing
|
||||
@ -54,6 +54,8 @@ RemoveRecipient=Supprime destinataire
|
||||
CommonSubstitutions=Substitutions communes
|
||||
YouCanAddYourOwnPredefindedListHere=Pour créer votre module sélection mails, voir htdocs/includes/modules/mailings/README.
|
||||
EMailTestSubstitutionReplacedByGenericValues=En mode test, les variables de substitution sont remplacées par des valeurs génériques
|
||||
MailingAddFile=Joindre ce fichier
|
||||
NoAttachedFiles=Aucun fichier joint
|
||||
|
||||
# Libelle des modules de liste de destinataires mailing
|
||||
MailingModuleDescContactCompanies=Contacts des tiers (prospects, clients, fournisseurs...)
|
||||
|
||||
@ -404,10 +404,11 @@ if ($user->admin)
|
||||
$user->rights->user->self->password=1;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Overwrite configs global par configs perso
|
||||
* ------------------------------------------
|
||||
*/
|
||||
// Set liste_limite
|
||||
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0
|
||||
{
|
||||
$conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
|
||||
|
||||
@ -474,14 +474,14 @@ if ($_GET["facid"] > 0)
|
||||
// Envoyer
|
||||
if ($fac->statut == 1 && $user->rights->facture->envoyer)
|
||||
{
|
||||
print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&action=presend\">".$langs->trans("Send")."</a>\n";
|
||||
print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&action=presend&mode=init\">".$langs->trans("Send")."</a>\n";
|
||||
}
|
||||
|
||||
// Envoyer une relance
|
||||
/*
|
||||
if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer)
|
||||
{
|
||||
print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&action=prerelance\">".$langs->trans("SendRemind")."</a>\n";
|
||||
print " <a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?facid=$fac->id&action=prerelance&mode=init\">".$langs->trans("SendRemind")."</a>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
@ -665,6 +665,12 @@ if ($_GET["facid"] > 0)
|
||||
$formmail->param["facid"]=$fac->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/telephonie/client/facture.php?facid=$fac->id";
|
||||
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
@ -700,7 +706,13 @@ if ($_GET["facid"] > 0)
|
||||
$formmail->param["facid"]=$fac->id;
|
||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/compta/facture.php?facid=$fac->id";
|
||||
|
||||
$formmail->show_form();
|
||||
// Init list of files
|
||||
if (! empty($_REQUEST["mode"]) && $_REQUEST["mode"]=='init')
|
||||
{
|
||||
$formmail->clear_attached_files();
|
||||
}
|
||||
|
||||
$formmail->show_form();
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user