Expense report - Remove DEPLACEMENT_TO_CLEAN
This commit is contained in:
parent
6e00d7fee3
commit
c21300f0fa
@ -342,11 +342,11 @@ if (empty($reshook))
|
|||||||
$filename=array(); $filedir=array(); $mimetype=array();
|
$filename=array(); $filedir=array(); $mimetype=array();
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = $langs->trans("ExpenseReportWaitingForApproval");
|
$subject = $langs->transnoentities("ExpenseReportWaitingForApproval");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
$message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
|
$message = $langs->transnoentities("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
|
||||||
|
|
||||||
// Rebuild pdf
|
// Rebuild pdf
|
||||||
/*
|
/*
|
||||||
@ -436,81 +436,75 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
if (! empty($conf->global->DEPLACEMENT_TO_CLEAN)) // TODO Translate this so we can remove condition
|
// Send mail
|
||||||
{
|
|
||||||
// Send mail
|
|
||||||
|
|
||||||
// TO
|
// TO
|
||||||
$destinataire = new User($db);
|
$destinataire = new User($db);
|
||||||
$destinataire->fetch($object->fk_user_validator);
|
$destinataire->fetch($object->fk_user_validator);
|
||||||
$emailTo = $destinataire->email;
|
$emailTo = $destinataire->email;
|
||||||
|
|
||||||
if ($emailTo)
|
if ($emailTo)
|
||||||
{
|
{
|
||||||
// FROM
|
// FROM
|
||||||
$expediteur = new User($db);
|
$expediteur = new User($db);
|
||||||
$expediteur->fetch($object->fk_user_author);
|
$expediteur->fetch($object->fk_user_author);
|
||||||
$emailFrom = $expediteur->email;
|
$emailFrom = $expediteur->email;
|
||||||
|
|
||||||
// SUBJECT
|
// SUBJECT
|
||||||
$subject = "' ERP - Note de frais à re-approuver";
|
$subject = $langs->transnoentities("ExpenseReportWaitingForReApproval");
|
||||||
|
|
||||||
// CONTENT
|
// CONTENT
|
||||||
$dateRefusEx = explode(" ",$object->date_refuse);
|
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
|
||||||
|
$dateRefusEx = explode(" ",$object->date_refuse);
|
||||||
|
$message = $langs->transnoentities("ExpenseReportWaitingForReApprovalMessage", $dateRefusEx[0], $object->detail_refuse, $expediteur->getFullName($langs), $langs), $link);
|
||||||
|
|
||||||
$message = "Bonjour {$destinataire->firstname},\n\n";
|
// Rebuild pdf
|
||||||
$message.= "Le {$dateRefusEx[0]} à {$dateRefusEx[1]} vous avez refusé d'approuver la note de frais \"{$object->ref}\". Vous aviez émis le motif suivant : {$object->detail_refuse}\n\n";
|
/*
|
||||||
$message.= "L'auteur vient de modifier la note de frais, veuillez trouver la nouvelle version en pièce jointe.\n";
|
$object->setDocModel($user,"");
|
||||||
$message.= "- Déclarant : {$expediteur->firstname} {$expediteur->lastname}\n";
|
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
||||||
$message.= "- Période : du {$object->date_debut} au {$object->date_fin}\n";
|
|
||||||
$message.= "- Lien : {$dolibarr_main_url_root}/expensereport/card.php?id={$object->id}\n\n";
|
|
||||||
$message.= "Bien cordialement,\n' SI";
|
|
||||||
|
|
||||||
// Génération du pdf avant attachement
|
if($resultPDF)
|
||||||
$object->setDocModel($user,"");
|
{
|
||||||
$resultPDF = expensereport_pdf_create($db,$object,'',"",$langs);
|
// 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_number).".pdf");
|
||||||
|
array_push($mimetype,"application/pdf");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if($resultPDF)
|
// PREPARE SEND
|
||||||
{
|
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
||||||
// 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_number).".pdf");
|
|
||||||
array_push($mimetype,"application/pdf");
|
|
||||||
|
|
||||||
// PREPARE SEND
|
if (! $mailfile->error)
|
||||||
$mailfile = new CMailFile($subject,$emailTo,$emailFrom,$message,$filedir,$mimetype,$filename);
|
{
|
||||||
|
// SEND
|
||||||
if (! $mailfile->error)
|
$result=$mailfile->sendfile();
|
||||||
{
|
if ($result)
|
||||||
// SEND
|
{
|
||||||
$result=$mailfile->sendfile();
|
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||||
if ($result)
|
exit;
|
||||||
{
|
}
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
else
|
||||||
exit;
|
{
|
||||||
}
|
$mesg=$mailfile->error;
|
||||||
else
|
setEventMessages($mesg, null, 'errors');
|
||||||
{
|
}
|
||||||
$mesg=$mailfile->error;
|
// END - Send mail
|
||||||
setEventMessages($mesg, null, 'errors');
|
}
|
||||||
}
|
else
|
||||||
// END - Send mail
|
{
|
||||||
}
|
dol_print_error($db,$resultPDF);
|
||||||
else
|
exit;
|
||||||
{
|
}
|
||||||
dol_print_error($db,$resultPDF);
|
}
|
||||||
exit;
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Approve
|
// Approve
|
||||||
if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->approve)
|
if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $user->rights->expensereport->approve)
|
||||||
|
|||||||
@ -21,7 +21,9 @@ ListToApprove=Waiting for approval
|
|||||||
ExpensesArea=Expense reports area
|
ExpensesArea=Expense reports area
|
||||||
ClassifyRefunded=Classify 'Refunded'
|
ClassifyRefunded=Classify 'Refunded'
|
||||||
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
|
ExpenseReportWaitingForApproval=A new expense report has been submitted for approval
|
||||||
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
|
||||||
|
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
|
||||||
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