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;
|
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;
|
$email_from = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$errors_to = $_POST["errorstomail"];
|
$errors_to = $_POST["errorstomail"];
|
||||||
$sendto = $_POST["sendto"];
|
$sendto = $_POST["sendto"];
|
||||||
$subject = $_POST['subject'];
|
$subject = $_POST['subject'];
|
||||||
$body = $_POST['message'];
|
$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'];
|
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
|
||||||
$mimetype[0] = $_FILES['addedfile']['type'];
|
$listofnames[] = $_FILES['addedfile']['name'];
|
||||||
$filename[0] = $_FILES['addedfile']['name'];
|
$listofmimes[] = $_FILES['addedfile']['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $sendto)
|
if (! $sendto)
|
||||||
{
|
{
|
||||||
@ -91,7 +133,7 @@ if ($_POST["action"] == 'send' && ! $_POST["cancel"])
|
|||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
$mailfile = new CMailFile($subject,$sendto,$email_from,$body,
|
||||||
$filepath,$mimetype,$filename,
|
$listofpaths,$listofmimes,$listofnames,
|
||||||
'', '', 0, $msgishtml,$errors_to);
|
'', '', 0, $msgishtml,$errors_to);
|
||||||
|
|
||||||
$result=$mailfile->sendfile();
|
$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=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 '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
@ -224,37 +266,44 @@ else
|
|||||||
|
|
||||||
// Affichage formulaire de TEST
|
// Affichage formulaire de TEST
|
||||||
if ($_GET["action"] == 'test')
|
if ($_GET["action"] == 'test')
|
||||||
{
|
{
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans("DoTestSend"));
|
print_titre($langs->trans("DoTestSend"));
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// Cree l'objet formulaire mail
|
||||||
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
include_once(DOL_DOCUMENT_ROOT."/html.formmail.class.php");
|
||||||
$formmail = new FormMail($db);
|
$formmail = new FormMail($db);
|
||||||
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->fromname = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
$formmail->frommail = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||||
$formmail->withsubstit=0;
|
$formmail->withsubstit=0;
|
||||||
$formmail->withfrom=1;
|
$formmail->withfrom=1;
|
||||||
$formmail->witherrorsto=1;
|
$formmail->witherrorsto=1;
|
||||||
$formmail->withto=$user->email?$user->email:1;
|
$formmail->withto=$user->email?$user->email:1;
|
||||||
$formmail->withtocc=1;
|
$formmail->withtocc=1;
|
||||||
$formmail->withtopic=$langs->trans("Test");
|
$formmail->withtopic=$langs->trans("Test");
|
||||||
$formmail->withtopicreadonly=0;
|
$formmail->withtopicreadonly=0;
|
||||||
$formmail->withfile=1;
|
$formmail->withfile=2;
|
||||||
$formmail->withbody=$langs->trans("Test");
|
$formmail->withbody=$langs->trans("Test");
|
||||||
$formmail->withbodyreadonly=0;
|
$formmail->withbodyreadonly=0;
|
||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
// Tableau des substitutions
|
$formmail->withdeliveryreceipt=1;
|
||||||
$formmail->substit=$substitutionarrayfortest;
|
// Tableau des substitutions
|
||||||
// Tableau des parametres complementaires du post
|
$formmail->substit=$substitutionarrayfortest;
|
||||||
$formmail->param["action"]="send";
|
// Tableau des parametres complementaires du post
|
||||||
$formmail->param["models"]="body";
|
$formmail->param["action"]="send";
|
||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["models"]="body";
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
$formmail->param["mailid"]=$mil->id;
|
||||||
|
$formmail->param["returnurl"]=DOL_URL_ROOT."/admin/mails.php";
|
||||||
$formmail->show_form();
|
|
||||||
|
// Init list of files
|
||||||
print '<br>';
|
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->withbody=0;
|
||||||
$formmail->withbodyreadonly=1;
|
$formmail->withbodyreadonly=1;
|
||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
|
$formmail->withdeliveryreceipt=0;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->substit=$substitutionarrayfortest;
|
$formmail->substit=$substitutionarrayfortest;
|
||||||
// Tableau des paramètres complémentaires du post
|
// Tableau des paramètres complémentaires du post
|
||||||
@ -624,6 +625,12 @@ else
|
|||||||
$formmail->param["mailid"]=$mil->id;
|
$formmail->param["mailid"]=$mil->id;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/comm/mailing/fiche.php?id=".$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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -292,17 +292,54 @@ if ($_REQUEST['action'] == 'setstatut' && $user->rights->propale->cloturer)
|
|||||||
{
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_GET['propalid']);
|
$propal->fetch($_GET['propalid']);
|
||||||
// prevent browser refresh from closing proposal several times
|
// prevent browser refresh from closing proposal several times
|
||||||
if ($propal->statut==1) {
|
if ($propal->statut==1)
|
||||||
$propal->cloture($user, $_REQUEST['statut'], $_REQUEST['note']);
|
{
|
||||||
}
|
$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');
|
$langs->load('mails');
|
||||||
|
|
||||||
@ -1571,145 +1608,150 @@ if ($_GET['propalid'] > 0)
|
|||||||
/*
|
/*
|
||||||
* Boutons Actions
|
* Boutons Actions
|
||||||
*/
|
*/
|
||||||
print '<div class="tabsAction">';
|
if ($_GET['action'] != 'presend')
|
||||||
|
|
||||||
if ($_GET['action'] != 'statut' && $_GET['action'] <> 'editline')
|
|
||||||
{
|
{
|
||||||
|
print '<div class="tabsAction">';
|
||||||
// Valid
|
|
||||||
if ($propal->statut == 0 && $propal->total_ttc > 0 && $user->rights->propale->valider)
|
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 '<a class="butAction" ';
|
||||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmValidateProp').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'validate\')"';
|
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
|
print '</div>';
|
||||||
if ($propal->statut == 1 && $user->rights->propale->creer)
|
print "<br>\n";
|
||||||
{
|
|
||||||
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>';
|
if ($_GET['action'] != 'presend')
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
$propal->loadOrders();
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
$coms = $propal->commandes;
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
if (sizeof($coms) > 0)
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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; }
|
$propal->loadOrders();
|
||||||
print_titre($langs->trans('RelatedOrders'));
|
$coms = $propal->commandes;
|
||||||
print '<table class="noborder" width="100%">';
|
if (sizeof($coms) > 0)
|
||||||
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;
|
if ($somethingshown) { print '<br>'; $somethingshown=1; }
|
||||||
print '<tr '.$bc[$var].'><td>';
|
print_titre($langs->trans('RelatedOrders'));
|
||||||
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 '<table class="noborder" width="100%">';
|
||||||
print '<td align="center">'.dolibarr_print_date($coms[$i]->date,'day').'</td>';
|
print '<tr class="liste_titre">';
|
||||||
print '<td align="right">'.price($coms[$i]->total_ttc).'</td>';
|
print '<td>'.$langs->trans("Ref").'</td>';
|
||||||
print '<td align="right">'.$coms[$i]->getLibStatut(3).'</td>';
|
print '<td align="center">'.$langs->trans("Date").'</td>';
|
||||||
print "</tr>\n";
|
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
|
* Action presend
|
||||||
@ -1717,6 +1759,9 @@ if ($_GET['propalid'] > 0)
|
|||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'presend')
|
if ($_GET['action'] == 'presend')
|
||||||
{
|
{
|
||||||
|
$ref = sanitize_string($propal->ref);
|
||||||
|
$file = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendPropalByMail'));
|
print_titre($langs->trans('SendPropalByMail'));
|
||||||
|
|
||||||
@ -1748,6 +1793,13 @@ if ($_GET['propalid'] > 0)
|
|||||||
$formmail->param['propalid']=$propal->id;
|
$formmail->param['propalid']=$propal->id;
|
||||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/comm/propal.php?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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -525,7 +525,7 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
|
|||||||
|
|
||||||
// Sauvegarde le dernier modele choisi pour generer un document
|
// Sauvegarde le dernier modele choisi pour generer un document
|
||||||
$commande = new Commande($db, 0, $_REQUEST['id']);
|
$commande = new Commande($db, 0, $_REQUEST['id']);
|
||||||
$commande->fetch($_REQUEST['id']);
|
$result=$commande->fetch($_REQUEST['id']);
|
||||||
if ($_REQUEST['model'])
|
if ($_REQUEST['model'])
|
||||||
{
|
{
|
||||||
$commande->setDocModel($user, $_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');
|
$langs->load('mails');
|
||||||
|
|
||||||
$commande= new Commande($db);
|
$commande= new Commande($db);
|
||||||
if ( $commande->fetch($_POST['orderid']) )
|
$result=$commande->fetch($_POST['orderid']);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
$orderref = sanitize_string($commande->ref);
|
$ref = sanitize_string($commande->ref);
|
||||||
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
if (is_readable($file))
|
||||||
{
|
{
|
||||||
@ -627,19 +663,23 @@ if ($_POST['action'] == 'send')
|
|||||||
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
$actionmsg2=$langs->transnoentities('Action'.$actiontypecode);
|
||||||
}
|
}
|
||||||
|
|
||||||
$filepath[0] = $file;
|
// Get list of attached files
|
||||||
$filename[0] = $commande->ref.'.pdf';
|
$listofpaths=array();
|
||||||
$mimetype[0] = 'application/pdf';
|
$listofnames=array();
|
||||||
if ($_FILES['addedfile']['tmp_name'])
|
$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'];
|
$listofpaths[] = $_FILES['addedfile']['tmp_name'];
|
||||||
$filename[1] = $_FILES['addedfile']['name'];
|
$listofnames[] = $_FILES['addedfile']['name'];
|
||||||
$mimetype[1] = $_FILES['addedfile']['type'];
|
$listofmimes[] = $_FILES['addedfile']['type'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Envoi de la commande
|
// Send mail
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/CMailFile.class.php');
|
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)
|
if ($mailfile->error)
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
$mesg='<div class="error">'.$mailfile->error.'</div>';
|
||||||
@ -699,6 +739,7 @@ if ($_POST['action'] == 'send')
|
|||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
$mesg='<div class="error">'.$langs->trans('ErrorMailRecipientIsEmpty').' !</div>';
|
||||||
|
$_GET["action"]='presend';
|
||||||
dolibarr_syslog('Recipient email is empty');
|
dolibarr_syslog('Recipient email is empty');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1679,207 +1720,213 @@ else
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
|
if ($_GET['action'] != 'presend')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
if ($user->societe_id == 0 && $_GET['action'] <> 'editline')
|
||||||
|
|
||||||
// Valid
|
|
||||||
if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
|
|
||||||
{
|
{
|
||||||
print '<a class="butAction" ';
|
print '<div class="tabsAction">';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
|
||||||
{
|
// Valid
|
||||||
// on verifie si la commande est en numerotation provisoire
|
if ($commande->statut == 0 && $commande->total_ttc >= 0 && $numlines > 0 && $user->rights->commande->valider)
|
||||||
$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 '<a class="butAction" ';
|
print '<a class="butAction" ';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||||
{
|
{
|
||||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_close&confirm=yes';
|
// on verifie si la commande est en numerotation provisoire
|
||||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCloseOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'close\')"';
|
$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
|
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>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Edit
|
||||||
// Annuler commande
|
if ($commande->statut == 1)
|
||||||
if ($commande->statut == 1)
|
{
|
||||||
{
|
if ($user->rights->commande->creer)
|
||||||
$nb_expedition = $commande->nb_expedition();
|
{
|
||||||
if ($user->rights->commande->annuler && $nb_expedition == 0)
|
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" ';
|
print '<a class="butActionDelete" ';
|
||||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
if ($conf->use_javascript_ajax && $conf->global->MAIN_CONFIRM_AJAX)
|
||||||
{
|
{
|
||||||
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_cancel&confirm=yes';
|
$url = $_SERVER["PHP_SELF"].'?id='.$commande->id.'&action=confirm_delete&confirm=yes';
|
||||||
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmCancelOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'cancel\')"';
|
print 'href="#" onClick="dialogConfirm(\''.$url.'\',\''.$langs->trans('ConfirmDeleteOrder').'\',\''.$langs->trans("Yes").'\',\''.$langs->trans("No").'\',\'delete\')"';
|
||||||
}
|
}
|
||||||
else
|
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>';
|
||||||
}
|
}
|
||||||
|
print '<br>';
|
||||||
// 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 '<table width="100%"><tr><td width="50%" valign="top">';
|
if ($_GET['action'] != 'presend')
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($result);
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
if ($num)
|
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>';
|
$num = $db->num_rows($result);
|
||||||
print_titre($langs->trans('RelatedBills'));
|
if ($num)
|
||||||
$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);
|
print '<br>';
|
||||||
$var=!$var;
|
print_titre($langs->trans('RelatedBills'));
|
||||||
print '<tr '.$bc[$var].'>';
|
$i = 0; $total = 0;
|
||||||
print '<td><a href="../compta/facture.php?facid='.$objp->rowid.'">'.img_object($langs->trans('ShowBill'),'bill').' '.$objp->facnumber.'</a></td>';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<td align="center">'.dolibarr_print_date($objp->df,'day').'</td>';
|
print '<tr class="liste_titre"><td>'.$langs->trans('Ref')."</td>";
|
||||||
print '<td align="right">'.$objp->total_ttc.'</td></tr>';
|
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||||
$i++;
|
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')
|
if ($_GET['action'] == 'presend')
|
||||||
{
|
{
|
||||||
$orderref = sanitize_string($commande->ref);
|
$ref = sanitize_string($commande->ref);
|
||||||
$file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf';
|
$file = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
print_titre($langs->trans('SendOrderByMail'));
|
print_titre($langs->trans('SendOrderByMail'));
|
||||||
@ -1920,7 +1951,7 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cree l'objet formulaire mail
|
// 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 = new FormMail($db);
|
||||||
$formmail->fromtype = 'user';
|
$formmail->fromtype = 'user';
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
@ -1933,6 +1964,7 @@ else
|
|||||||
$formmail->withfile=1;
|
$formmail->withfile=1;
|
||||||
$formmail->withbody=1;
|
$formmail->withbody=1;
|
||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
|
$formmail->withcancel=1;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->substit['__ORDERREF__']=$commande->ref;
|
$formmail->substit['__ORDERREF__']=$commande->ref;
|
||||||
// Tableau des parametres complementaires
|
// Tableau des parametres complementaires
|
||||||
@ -1941,8 +1973,16 @@ else
|
|||||||
$formmail->param['orderid']=$commande->id;
|
$formmail->param['orderid']=$commande->id;
|
||||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/commande/fiche.php?id='.$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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
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');
|
$langs->load('mails');
|
||||||
|
|
||||||
$fac = new Facture($db,'',$_POST['facid']);
|
$fac = new Facture($db,'',$_POST['facid']);
|
||||||
if ( $fac->fetch($_POST['facid']) )
|
$result=$fac->fetch($_POST['facid']);
|
||||||
|
if ($result)
|
||||||
{
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$ref = sanitize_string($fac->ref);
|
||||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
if (is_readable($file))
|
if (is_readable($file))
|
||||||
{
|
{
|
||||||
@ -2684,257 +2720,210 @@ else
|
|||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Boutons actions
|
* Boutons actions
|
||||||
*/
|
*/
|
||||||
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
if ($_GET['action'] != 'prerelance' && $_GET['action'] != 'presend')
|
||||||
{
|
{
|
||||||
print '<div class="tabsAction">';
|
if ($user->societe_id == 0 && $_GET['action'] <> 'valid' && $_GET['action'] <> 'editline')
|
||||||
|
|
||||||
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
|
|
||||||
if ($fac->statut == 1)
|
|
||||||
{
|
{
|
||||||
// On vérifie si les lignes de factures ont été exportées en compta et/ou ventilées
|
print '<div class="tabsAction">';
|
||||||
$ventilExportCompta = $fac->getVentilExportCompta();
|
|
||||||
|
// Editer une facture déjà validée, sans paiement effectué et pas exporté en compta
|
||||||
if ($conf->global->FACTURE_ENABLE_EDITDELETE && $user->rights->facture->modifier
|
if ($fac->statut == 1)
|
||||||
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
// 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
|
||||||
// Récurrente
|
&& ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0))
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
print '<font class="butActionRefused" title="'.$langs->trans("DisabledBecauseRemainderToPayIsZero").'">'.$langs->trans('DoPayment').'</font>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?facid='.$fac->id.'&action=modif">'.$langs->trans('Modify').'</a>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPayment').'</a>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Récurrente
|
||||||
// Emettre remboursement ou Convertir en reduc
|
if (! $conf->global->FACTURE_DISABLE_RECUR && $fac->type == 0)
|
||||||
if ($fac->type == 2)
|
|
||||||
{
|
|
||||||
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 (! $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>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Envoyer
|
||||||
// Classer 'payé'
|
if (($fac->statut == 1 || $fac->statut == 2) && $user->rights->facture->envoyer)
|
||||||
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)
|
if ($facidnext)
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused">'.$langs->trans('ClassifyCanceled').'</span>';
|
print '<span class="butActionRefused" alt="'.$langs->trans("DisabledBecauseReplacedInvoice").'">'.$langs->trans('SendByMail').'</span>';
|
||||||
}
|
}
|
||||||
else
|
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>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Envoyer une relance
|
||||||
// Supprimer
|
if (($fac->statut == 1 || $fac->statut == 2) && $resteapayer > 0 && $user->rights->facture->envoyer)
|
||||||
if ($fac->is_erasable() && $user->rights->facture->supprimer && $_GET['action'] != 'delete')
|
|
||||||
{
|
|
||||||
if ($facidnext)
|
|
||||||
{
|
{
|
||||||
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>';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// Emettre remboursement ou Convertir en reduc
|
||||||
print '</div>';
|
if ($fac->type == 2)
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement)
|
||||||
$var=!$var;
|
{
|
||||||
print '<tr '.$bc[$var].'>';
|
print '<a class="butAction" href="paiement.php?facid='.$fac->id.'&action=create">'.$langs->trans('DoPaymentBack').'</a>';
|
||||||
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>';
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->creer && $fac->getSommePaiement() == 0)
|
||||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
{
|
||||||
print '</tr>';
|
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$fac->id.'&action=converttoreduc">'.$langs->trans('ConvertToReduc').'</a>';
|
||||||
$total = $total + $objp->total_ht;
|
}
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
print '<tr class="liste_total">';
|
|
||||||
print '<td align="left">'.$langs->trans('TotalHT').'</td>';
|
// Classer 'payé'
|
||||||
print '<td> </td>';
|
if ($fac->statut == 1 && $fac->paye == 0 && $user->rights->facture->paiement &&
|
||||||
print '<td> </td>';
|
(($fac->type != 2 && $resteapayer <= 0) || ($fac->type == 2 && $resteapayer >= 0)) )
|
||||||
print '<td align="right">'.price($total).'</td></tr>';
|
{
|
||||||
print '</table>';
|
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);
|
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||||
}
|
print '<a name="builddoc"></a>'; // ancre
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Commandes rattachées
|
* Documents générés
|
||||||
*/
|
*/
|
||||||
if($conf->commande->enabled)
|
$filename=sanitize_string($fac->ref);
|
||||||
{
|
$filedir=$conf->facture->dir_output . '/' . sanitize_string($fac->ref);
|
||||||
$sql = 'SELECT '.$db->pdate('c.date_commande').' as date_commande, c.total_ht, c.ref, c.ref_client, c.rowid as id';
|
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$fac->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;
|
$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);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
if ($num)
|
if ($num)
|
||||||
{
|
{
|
||||||
$langs->load("orders");
|
|
||||||
|
|
||||||
$i = 0; $total = 0;
|
$i = 0; $total = 0;
|
||||||
if ($somethingshown) print '<br>';
|
if ($somethingshown) print '<br>';
|
||||||
$somethingshown=1;
|
$somethingshown=1;
|
||||||
print_titre($langs->trans('RelatedOrders'));
|
print_titre($langs->trans('RelatedCommercialProposals'));
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td width="150">'.$langs->trans('Ref').'</td>';
|
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="center">'.$langs->trans('Date').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
print '<td align="right">'.$langs->trans('AmountHT').'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$var=true;
|
|
||||||
|
$var=True;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<tr '.$bc[$var].'><td>';
|
print '<tr '.$bc[$var].'>';
|
||||||
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><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>'.$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 '<td align="right">'.price($objp->total_ht).'</td>';
|
||||||
print "</tr>\n";
|
print '</tr>';
|
||||||
$total = $total + $objp->total_ht;
|
$total = $total + $objp->total_ht;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -2950,27 +2939,80 @@ else
|
|||||||
{
|
{
|
||||||
dolibarr_print_error($db);
|
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
|
* Affiche formulaire mail
|
||||||
*/
|
*/
|
||||||
if ($_GET['action'] == 'presend')
|
if ($_GET['action'] == 'presend')
|
||||||
{
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$ref = sanitize_string($fac->ref);
|
||||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
// Construit PDF si non existant
|
// Construit PDF si non existant
|
||||||
if (! is_readable($file))
|
if (! is_readable($file))
|
||||||
@ -3021,6 +3063,13 @@ else
|
|||||||
$formmail->param['facid']=$fac->id;
|
$formmail->param['facid']=$fac->id;
|
||||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/compta/facture.php?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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -3028,8 +3077,8 @@ else
|
|||||||
|
|
||||||
if ($_GET['action'] == 'prerelance')
|
if ($_GET['action'] == 'prerelance')
|
||||||
{
|
{
|
||||||
$facref = sanitize_string($fac->ref);
|
$ref = sanitize_string($fac->ref);
|
||||||
$file = $conf->facture->dir_output . '/' . $facref . '/' . $facref . '.pdf';
|
$file = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
|
||||||
|
|
||||||
// Construit PDF si non existant
|
// Construit PDF si non existant
|
||||||
if (! is_readable($file))
|
if (! is_readable($file))
|
||||||
@ -3068,6 +3117,7 @@ else
|
|||||||
$formmail->withfile=1;
|
$formmail->withfile=1;
|
||||||
$formmail->withbody=1;
|
$formmail->withbody=1;
|
||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
|
$formmail->withcancel=1;
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->substit['__FACREF__']=$fac->ref;
|
$formmail->substit['__FACREF__']=$fac->ref;
|
||||||
// Tableau des paramètres complémentaires
|
// Tableau des paramètres complémentaires
|
||||||
@ -3076,6 +3126,13 @@ else
|
|||||||
$formmail->param['facid']=$fac->id;
|
$formmail->param['facid']=$fac->id;
|
||||||
$formmail->param['returnurl']=DOL_URL_ROOT.'/compta/facture.php?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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class Conf
|
|||||||
* Autres parametres globaux de configurations
|
* Autres parametres globaux de configurations
|
||||||
*/
|
*/
|
||||||
$this->users->dir_output=DOL_DATA_ROOT."/users";
|
$this->users->dir_output=DOL_DATA_ROOT."/users";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Autorisation globale d'uploader (necessaire pour desactiver dans la demo)
|
* Autorisation globale d'uploader (necessaire pour desactiver dans la demo)
|
||||||
* conf->upload peut etre ecrasee dans main.inc.php (selon user)
|
* 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->proprietes=1 ou chaine ou tableau de valeurs
|
||||||
\remarks $formmail->show_form() affiche le formulaire
|
\remarks $formmail->show_form() affiche le formulaire
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FormMail
|
class FormMail
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
@ -49,7 +48,7 @@ class FormMail
|
|||||||
var $withto;
|
var $withto;
|
||||||
var $withtocc;
|
var $withtocc;
|
||||||
var $withtopic;
|
var $withtopic;
|
||||||
var $withfile;
|
var $withfile; // 0=No attaches files, 1=Show attached files, 2=Can add new attached files
|
||||||
var $withbody;
|
var $withbody;
|
||||||
|
|
||||||
var $withfromreadonly;
|
var $withfromreadonly;
|
||||||
@ -95,9 +94,51 @@ class FormMail
|
|||||||
return 1;
|
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()
|
function show_form()
|
||||||
{
|
{
|
||||||
@ -106,6 +147,15 @@ class FormMail
|
|||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
$langs->load("mails");
|
$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);
|
$form=new Form($DB);
|
||||||
|
|
||||||
print "\n<!-- Debut form mail -->\n";
|
print "\n<!-- Debut form mail -->\n";
|
||||||
@ -294,13 +344,32 @@ class FormMail
|
|||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si fichier joint
|
// Attached files
|
||||||
if ($this->withfile)
|
if ($this->withfile)
|
||||||
{
|
{
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print "<td width=\"180\">".$langs->trans("MailFile")."</td>";
|
print '<td width="180">'.$langs->trans("MailFile")."</td>";
|
||||||
print "<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";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ MailCC=Copy to
|
|||||||
MailCCC=Cached copy to
|
MailCCC=Cached copy to
|
||||||
MailTopic=EMail topic
|
MailTopic=EMail topic
|
||||||
MailText=Message
|
MailText=Message
|
||||||
MailFile=Attach a file
|
MailFile=Attached files
|
||||||
MailMessage=EMail body
|
MailMessage=EMail body
|
||||||
ListOfEMailings=List of emailings
|
ListOfEMailings=List of emailings
|
||||||
NewMailing=New emailing
|
NewMailing=New emailing
|
||||||
@ -54,6 +54,8 @@ RemoveRecipient=Remove recipient
|
|||||||
CommonSubstitutions=Common substitutions
|
CommonSubstitutions=Common substitutions
|
||||||
YouCanAddYourOwnPredefindedListHere=To create your email selector module, see htdocs/includes/modules/mailings/README.
|
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
|
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
|
# Libelle des modules de liste de destinataires mailing
|
||||||
MailingModuleDescContactCompanies=Unique contacts of all third parties
|
MailingModuleDescContactCompanies=Unique contacts of all third parties
|
||||||
|
|||||||
@ -1,90 +1,90 @@
|
|||||||
# Dolibarr language file - es_ES - mails
|
# Dolibarr language file - es_ES - mails
|
||||||
Mailing=Mailing
|
Mailing=Mailing
|
||||||
EMailing=Mailing
|
EMailing=Mailing
|
||||||
Mailings=Mailings
|
Mailings=Mailings
|
||||||
EMailings=Mailings
|
EMailings=Mailings
|
||||||
MailCard=Ficha mailing
|
MailCard=Ficha mailing
|
||||||
MailTargets=Destinatarios
|
MailTargets=Destinatarios
|
||||||
MailRecipients=Dsetinatarios
|
MailRecipients=Dsetinatarios
|
||||||
MailRecipient=Destinatario
|
MailRecipient=Destinatario
|
||||||
MailTitle=Titulo
|
MailTitle=Titulo
|
||||||
MailFrom=Remitente
|
MailFrom=Remitente
|
||||||
MailErrorsTo=Errores a
|
MailErrorsTo=Errores a
|
||||||
MailReply=Responder a
|
MailReply=Responder a
|
||||||
MailTo=Destinatario(s)
|
MailTo=Destinatario(s)
|
||||||
MailCC=Copia a
|
MailCC=Copia a
|
||||||
MailTopic=Asunto del e-mail
|
MailTopic=Asunto del e-mail
|
||||||
MailText=Mensaje
|
MailText=Mensaje
|
||||||
MailFile=Adjuntar un archivo
|
MailFile=Archivo
|
||||||
MailMessage=Mensaje del e-mail
|
MailMessage=Mensaje del e-mail
|
||||||
ListOfEMailings=Listado de mailings
|
ListOfEMailings=Listado de mailings
|
||||||
NewMailing=Nuevo mailing
|
NewMailing=Nuevo mailing
|
||||||
EditMailing=Editar mailing
|
EditMailing=Editar mailing
|
||||||
DeleteMailing=Eliminar mailing
|
DeleteMailing=Eliminar mailing
|
||||||
DeleteAMailing=Eliminar un mailing
|
DeleteAMailing=Eliminar un mailing
|
||||||
PreviewMailing=Previsualizar un mailing
|
PreviewMailing=Previsualizar un mailing
|
||||||
PrepareMailing=Preparar mailing
|
PrepareMailing=Preparar mailing
|
||||||
CreateMailing=Crear mailing
|
CreateMailing=Crear mailing
|
||||||
MailingDesc=Esta página le permite enviar e-mails a un grupo de personas.
|
MailingDesc=Esta página le permite enviar e-mails a un grupo de personas.
|
||||||
MailingResult=Resultado del envío de e-mails
|
MailingResult=Resultado del envío de e-mails
|
||||||
TestMailing=Probar mailing
|
TestMailing=Probar mailing
|
||||||
ValidMailing=Validar mailing
|
ValidMailing=Validar mailing
|
||||||
ApproveMailing=Aprobar mailing
|
ApproveMailing=Aprobar mailing
|
||||||
MailingStatusDraft=Borrador
|
MailingStatusDraft=Borrador
|
||||||
MailingStatusValidated=Validado
|
MailingStatusValidated=Validado
|
||||||
MailingStatusApproved=Aprovado
|
MailingStatusApproved=Aprovado
|
||||||
MailingStatusSent=Enviado
|
MailingStatusSent=Enviado
|
||||||
MailingStatusSentPartialy=Enviado parcialmente
|
MailingStatusSentPartialy=Enviado parcialmente
|
||||||
MailingStatusSentCompletely=Enviado completamente
|
MailingStatusSentCompletely=Enviado completamente
|
||||||
MailingStatusError=Error
|
MailingStatusError=Error
|
||||||
MailingStatusNotSent=No enviado
|
MailingStatusNotSent=No enviado
|
||||||
MailSuccessfulySent=E-mail enviado correctamente (de %s a %s)
|
MailSuccessfulySent=E-mail enviado correctamente (de %s a %s)
|
||||||
ErrorMailRecipientIsEmpty=La dirección del destinatario está vacía
|
ErrorMailRecipientIsEmpty=La dirección del destinatario está vacía
|
||||||
WarningNoEMailsAdded=Ningún nuevo e-mail a añadir a la lista destinatarios.
|
WarningNoEMailsAdded=Ningún nuevo e-mail a añadir a la lista destinatarios.
|
||||||
ConfirmValidMailing=¿Confirma la validación del mailing?
|
ConfirmValidMailing=¿Confirma la validación del mailing?
|
||||||
ConfirmDeleteMailing=¿Confirma la eliminación del mailing?
|
ConfirmDeleteMailing=¿Confirma la eliminación del mailing?
|
||||||
NbOfRecipients=Número de destinatarios
|
NbOfRecipients=Número de destinatarios
|
||||||
NbOfUniqueEMails=Nº de e-mails únicos
|
NbOfUniqueEMails=Nº de e-mails únicos
|
||||||
NbOfEMails=Nº de E-mails
|
NbOfEMails=Nº de E-mails
|
||||||
TotalNbOfDistinctRecipients=Número de destinatarios únicos
|
TotalNbOfDistinctRecipients=Número de destinatarios únicos
|
||||||
NoTargetYet=Ningún destinatario definido
|
NoTargetYet=Ningún destinatario definido
|
||||||
AddRecipients=Añadir destinatarios
|
AddRecipients=Añadir destinatarios
|
||||||
RemoveRecipient=Eliminar destinatario
|
RemoveRecipient=Eliminar destinatario
|
||||||
CommonSubstitutions=Substituciones comunes
|
CommonSubstitutions=Substituciones comunes
|
||||||
YouCanAddYourOwnPredefindedListHere=Para crear su módulo de selección e-mails, vea htdocs/includes/modules/mailings/README.
|
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
|
EMailTestSubstitutionReplacedByGenericValues=En modo prueba, las variables de sustitución son sustituidas por valores genéricos
|
||||||
|
|
||||||
# Libelle des modules de liste de destinataires mailing
|
# Libelle des modules de liste de destinataires mailing
|
||||||
|
|
||||||
MailingModuleDescContactCompanies=Contactos de terceros (clientes potenciales, clientes, proveedores...)
|
MailingModuleDescContactCompanies=Contactos de terceros (clientes potenciales, clientes, proveedores...)
|
||||||
MailingModuleDescDolibarrUsers=Usuarios de Dolibarr que tienen e-mail
|
MailingModuleDescDolibarrUsers=Usuarios de Dolibarr que tienen e-mail
|
||||||
MailingModuleDescFundationMembers=Miembros que tienen e-mail
|
MailingModuleDescFundationMembers=Miembros que tienen e-mail
|
||||||
|
|
||||||
|
|
||||||
RecipientSelectionModules=Módulos de selección de los destinatarios
|
RecipientSelectionModules=Módulos de selección de los destinatarios
|
||||||
MailSelectedRecipients=Destinatarios seleccionados
|
MailSelectedRecipients=Destinatarios seleccionados
|
||||||
MailingArea=Area mailings
|
MailingArea=Area mailings
|
||||||
LastMailings=Los %s últimos mailings
|
LastMailings=Los %s últimos mailings
|
||||||
TargetsStatistics=Estadísticas destinatarios
|
TargetsStatistics=Estadísticas destinatarios
|
||||||
NbOfCompaniesContacts=Contactos únicos de empresas
|
NbOfCompaniesContacts=Contactos únicos de empresas
|
||||||
MailNoChangePossible=Destinatarios de un mailing validado no modificables
|
MailNoChangePossible=Destinatarios de un mailing validado no modificables
|
||||||
SearchAMailing=Buscar un mailing
|
SearchAMailing=Buscar un mailing
|
||||||
SendMailing=Enviar mailing
|
SendMailing=Enviar mailing
|
||||||
SendMail=Enviar e-mail
|
SendMail=Enviar e-mail
|
||||||
SentBy=Enviado por
|
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:
|
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
|
TargetsReset=Vaciar lista
|
||||||
ToClearAllRecipientsClickHere=Para vaciar la lista de los destinatarios de este mailing, haga click en el botón
|
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
|
ToAddRecipientsChooseHere=Para añadir destinatarios, escoja los que figuran en las listas a continuación
|
||||||
NbOfEMailingsReceived=Mailings en masa recibidos
|
NbOfEMailingsReceived=Mailings en masa recibidos
|
||||||
IdRecord=ID registro
|
IdRecord=ID registro
|
||||||
DeliveryReceipt=Acuso de recibo
|
DeliveryReceipt=Acuso de recibo
|
||||||
|
|
||||||
# Module Notifications
|
# Module Notifications
|
||||||
|
|
||||||
Notifications=Notificaciones
|
Notifications=Notificaciones
|
||||||
NoNotificationsWillBeSent=Ninguna notificación por e-mail está prevista para este evento y empresa
|
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
|
ANotificationsWillBeSent=1 notificación va a ser enviada por e-mail
|
||||||
SomeNotificationsWillBeSent=%s notificaciones van a ser enviadas por e-mail
|
SomeNotificationsWillBeSent=%s notificaciones van a ser enviadas por e-mail
|
||||||
AddNewNotification=Activar una nueva solicitud de notificación
|
AddNewNotification=Activar una nueva solicitud de notificación
|
||||||
ListOfActiveNotifications=Lista de las solicitudes de notificaciones activas
|
ListOfActiveNotifications=Lista de las solicitudes de notificaciones activas
|
||||||
|
|||||||
@ -16,7 +16,7 @@ MailCC=Copie
|
|||||||
MailCCC=Copie cachée à
|
MailCCC=Copie cachée à
|
||||||
MailTopic=Sujet du mail
|
MailTopic=Sujet du mail
|
||||||
MailText=Message
|
MailText=Message
|
||||||
MailFile=Joindre un fichier
|
MailFile=Fichiers joints
|
||||||
MailMessage=Message du mail
|
MailMessage=Message du mail
|
||||||
ListOfEMailings=Liste des mailings
|
ListOfEMailings=Liste des mailings
|
||||||
NewMailing=Nouveau mailing
|
NewMailing=Nouveau mailing
|
||||||
@ -54,6 +54,8 @@ RemoveRecipient=Supprime destinataire
|
|||||||
CommonSubstitutions=Substitutions communes
|
CommonSubstitutions=Substitutions communes
|
||||||
YouCanAddYourOwnPredefindedListHere=Pour créer votre module sélection mails, voir htdocs/includes/modules/mailings/README.
|
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
|
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
|
# Libelle des modules de liste de destinataires mailing
|
||||||
MailingModuleDescContactCompanies=Contacts des tiers (prospects, clients, fournisseurs...)
|
MailingModuleDescContactCompanies=Contacts des tiers (prospects, clients, fournisseurs...)
|
||||||
|
|||||||
@ -404,10 +404,11 @@ if ($user->admin)
|
|||||||
$user->rights->user->self->password=1;
|
$user->rights->user->self->password=1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Overwrite configs global par configs perso
|
* Overwrite configs global par configs perso
|
||||||
* ------------------------------------------
|
* ------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
// Set liste_limite
|
||||||
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0
|
if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) // Can be 0
|
||||||
{
|
{
|
||||||
$conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
|
$conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
|
||||||
|
|||||||
@ -474,14 +474,14 @@ if ($_GET["facid"] > 0)
|
|||||||
// Envoyer
|
// Envoyer
|
||||||
if ($fac->statut == 1 && $user->rights->facture->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
|
// Envoyer une relance
|
||||||
/*
|
/*
|
||||||
if ($fac->statut == 1 && price($resteapayer) > 0 && $user->rights->facture->envoyer)
|
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["facid"]=$fac->id;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/telephonie/client/facture.php?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();
|
$formmail->show_form();
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
@ -700,7 +706,13 @@ if ($_GET["facid"] > 0)
|
|||||||
$formmail->param["facid"]=$fac->id;
|
$formmail->param["facid"]=$fac->id;
|
||||||
$formmail->param["returnurl"]=DOL_URL_ROOT."/compta/facture.php?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>';
|
print '<br>';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user