Finish work
This commit is contained in:
parent
8a24f2fc91
commit
4705a87548
@ -456,7 +456,7 @@ if (empty($reshook))
|
|||||||
// CONTENT
|
// CONTENT
|
||||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$dateRefusEx = explode(" ",$object->date_refuse);
|
$dateRefusEx = explode(" ",$object->date_refuse);
|
||||||
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $langs), $link);
|
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $link);
|
||||||
|
|
||||||
// Rebuild pdf
|
// Rebuild pdf
|
||||||
/*
|
/*
|
||||||
@ -567,11 +567,11 @@ if (empty($reshook))
|
|||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = $langs->transnoentities("ExpenseReportApproval");
|
$subject = $langs->transnoentities("ExpenseReportApproved");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message = $langs->transnoentities("ExpenseReportApprovalMessage", $destinataire->getFullName($langs), $object->ref, $expediteur->getFullName($langs), '', $langs), $link);
|
$message = $langs->transnoentities("ExpenseReportApprovedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||||
|
|
||||||
// Rebuilt pdf
|
// Rebuilt pdf
|
||||||
/*
|
/*
|
||||||
@ -588,53 +588,52 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
|
|
||||||
if ($mailfile)
|
if ($mailfile)
|
||||||
{
|
{
|
||||||
// SEND
|
// SEND
|
||||||
$result=$mailfile->sendfile();
|
$result=$mailfile->sendfile();
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
|
||||||
setEventMessages($mesg, null, 'mesgs');
|
setEventMessages($mesg, null, 'mesgs');
|
||||||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
if ($mailfile->error)
|
if ($mailfile->error)
|
||||||
{
|
{
|
||||||
$mesg='';
|
$mesg='';
|
||||||
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
$mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo);
|
||||||
$mesg.='<br>'.$mailfile->error;
|
$mesg.='<br>'.$mailfile->error;
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
setEventMessages($mailfile->error,$mailfile->errors,'errors');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings');
|
||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
|
if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user->rights->expensereport->approve)
|
||||||
{
|
{
|
||||||
@ -677,16 +676,27 @@ if (empty($reshook))
|
|||||||
$expediteur->fetch($object->fk_user_refuse);
|
$expediteur->fetch($object->fk_user_refuse);
|
||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = "' ERP - Note de frais refusée";
|
$subject = $langs->transnoentities("ExpenseReportRefused");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être refusée.\n";
|
$message = $langs->transnoentities("ExpenseReportRefusedMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_refuse'], $link);
|
||||||
$message.= "- Refuseur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Motif de refus : {$_POST['detail_refuse']}\n";
|
// Rebuilt pdf
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
/*
|
||||||
$message.= "Bien cordialement,\n' SI";
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
if($resultPDF
|
||||||
|
{
|
||||||
|
// ATTACHMENT
|
||||||
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
@ -779,16 +789,27 @@ if (empty($reshook))
|
|||||||
$expediteur->fetch($object->fk_user_cancel);
|
$expediteur->fetch($object->fk_user_cancel);
|
||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = "' ERP - Note de frais annulée";
|
$subject = $langs->transnoentities("ExpenseReportCanceled");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message.= "Votre note de frais \"{$object->ref}\" vient d'être annulée.\n";
|
$message = $langs->transnoentities("ExpenseReportCanceledMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $_POST['detail_cancel'], $link);
|
||||||
$message.= "- Annuleur : {$expediteur->firstname} {$expediteur->lastname}\n";
|
|
||||||
$message.= "- Motif d'annulation : {$_POST['detail_cancel']}\n";
|
// Rebuilt pdf
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
/*
|
||||||
$message.= "Bien cordialement,\n' SI";
|
$object->setDocModel($user,"");
|
||||||
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
|
|
||||||
|
if($resultPDF
|
||||||
|
{
|
||||||
|
// ATTACHMENT
|
||||||
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
array_push($filename,dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($filedir, $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref)."/".dol_sanitizeFileName($object->ref).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// PREPARE SEND
|
// PREPARE SEND
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
@ -923,8 +944,12 @@ if (empty($reshook))
|
|||||||
$expediteur->fetch($user->id);
|
$expediteur->fetch($user->id);
|
||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = "'ERP - Note de frais payée";
|
$subject = $langs->transnoentities("ExpenseReportPaid");
|
||||||
|
|
||||||
|
// CONTENT
|
||||||
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$message = $langs->transnoentities("ExpenseReportPaidMessage", $object->ref, $destinataire->getFullName($langs), $expediteur->getFullName($langs), $link);
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
$message = "Bonjour {$destinataire->firstname},\n\n";
|
||||||
|
|||||||
@ -24,6 +24,14 @@ ExpenseReportWaitingForApproval=A new expense report has been submitted for appr
|
|||||||
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
ExpenseReportWaitingForApprovalMessage=A new expense report has been submitted and is waiting for approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
||||||
ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval
|
ExpenseReportWaitingForReApproval=An expense report has been submitted for re-approval
|
||||||
ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
ExpenseReportWaitingForReApprovalMessage=An expense report has been submitted and is waiting for re-approval.\nThe %s, you refused to approve the expense report for this reason: %s.\nA new version has been proposed and waiting for your approval.\n - User: %s\n - Period: %s\nClick here to validate: %s
|
||||||
|
ExpenseReportApproved=An expense report was approved
|
||||||
|
ExpenseReportApprovedMessage=The expense report %s was approved.\n - User: %s\n - Approved by: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportRefused=An expense report was refused
|
||||||
|
ExpenseReportRefusedMessage=The expense report %s was refused.\n - User: %s\n - Refused by: %s\n - Motive for refusal: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportCanceled=An expense report was canceled
|
||||||
|
ExpenseReportCanceledMessage=The expense report %s was canceled.\n - User: %s\n - Canceled by: %s\n - Motive for cancellation: %s\nClick here to show the expense report: %s
|
||||||
|
ExpenseReportPaid=An expense report was paid
|
||||||
|
ExpenseReportPaidMessage=The expense report %s was paid.\n - User: %s\n - Paid by: %s\nClick here to show the expense report: %s
|
||||||
TripId=Id expense report
|
TripId=Id expense report
|
||||||
AnyOtherInThisListCanValidate=Person to inform for validation.
|
AnyOtherInThisListCanValidate=Person to inform for validation.
|
||||||
TripSociete=Information company
|
TripSociete=Information company
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user