Merge pull request #23953 from cmfpmatik/dev2023
NEW adding button Send Email on the salary file
This commit is contained in:
commit
3ee441b9a7
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2017-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
* Copyright (C) 2022 Charlene Benke <charlene@patas-monkey.com>
|
||||||
|
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
|
||||||
|
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -129,7 +131,11 @@ if ($action == 'presend') {
|
|||||||
if ($formmail->fromtype === 'user') {
|
if ($formmail->fromtype === 'user') {
|
||||||
$formmail->fromid = $user->id;
|
$formmail->fromid = $user->id;
|
||||||
}
|
}
|
||||||
|
if ($object->element == 'salary' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
|
||||||
|
$formmail->frommail = $conf->global->SINVOICE_EMAIL_SENDER;
|
||||||
|
$formmail->fromname = (!empty($conf->global->INVOICE_EMAIL_SENDER_NAME) ? $conf->global->INVOICE_EMAIL_SENDER_NAME : '');
|
||||||
|
$formmail->fromtype = 'special';
|
||||||
|
}
|
||||||
if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
|
if ($object->element === 'facture' && !empty($conf->global->INVOICE_EMAIL_SENDER)) {
|
||||||
$formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER;
|
$formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER;
|
||||||
$formmail->fromname = (!empty($conf->global->INVOICE_EMAIL_SENDER_NAME) ? $conf->global->INVOICE_EMAIL_SENDER_NAME : '');
|
$formmail->fromname = (!empty($conf->global->INVOICE_EMAIL_SENDER_NAME) ? $conf->global->INVOICE_EMAIL_SENDER_NAME : '');
|
||||||
@ -194,6 +200,10 @@ if ($action == 'presend') {
|
|||||||
$liste['contact'] = $object->getFullName($outputlangs)." <".$object->email.">";
|
$liste['contact'] = $object->getFullName($outputlangs)." <".$object->email.">";
|
||||||
} elseif ($object->element == 'user' || $object->element == 'member') {
|
} elseif ($object->element == 'user' || $object->element == 'member') {
|
||||||
$liste['thirdparty'] = $object->getFullName($outputlangs)." <".$object->email.">";
|
$liste['thirdparty'] = $object->getFullName($outputlangs)." <".$object->email.">";
|
||||||
|
} elseif ($object->element == 'salary') {
|
||||||
|
$fuser = new User($db);
|
||||||
|
$fuser->fetch($object->fk_user);
|
||||||
|
$liste['thirdparty'] = $fuser->getFullName($outputlangs)." <".$fuser->email.">";
|
||||||
} else {
|
} else {
|
||||||
if (!empty($object->socid) && $object->socid > 0 && !is_object($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) {
|
if (!empty($object->socid) && $object->socid > 0 && !is_object($object->thirdparty) && method_exists($object, 'fetch_thirdparty')) {
|
||||||
$object->fetch_thirdparty();
|
$object->fetch_thirdparty();
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
* Copyright (C) 2015 Charlie BENKE <charlie@patas-monkey.com>
|
||||||
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
|
||||||
|
* Copyright (C) 2023 Maxime Nicolas <maxime@oarces.com>
|
||||||
|
* Copyright (C) 2023 Benjamin GREMBI <benjamin@oarces.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -148,6 +150,12 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
|
// Actions to send emails
|
||||||
|
$triggersendname = 'COMPANY_SENTBYMAIL';
|
||||||
|
$paramname = 'id';
|
||||||
|
$mode = 'emailfromthirdparty';
|
||||||
|
$trackid = 'thi'.$object->id;
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Link to a project
|
// Link to a project
|
||||||
@ -451,7 +459,6 @@ if (isModEnabled('project')) $formproject = new FormProjets($db);
|
|||||||
|
|
||||||
$title = $langs->trans('Salary')." - ".$object->ref;
|
$title = $langs->trans('Salary')." - ".$object->ref;
|
||||||
$help_url = "";
|
$help_url = "";
|
||||||
|
|
||||||
llxHeader('', $title, $help_url);
|
llxHeader('', $title, $help_url);
|
||||||
|
|
||||||
|
|
||||||
@ -665,6 +672,7 @@ if ($action == 'create' && $permissiontoadd) {
|
|||||||
var fk_user = $("#fk_user").val()
|
var fk_user = $("#fk_user").val()
|
||||||
var url = "'.DOL_URL_ROOT.'/salaries/ajax/ajaxsalaries.php?fk_user="+fk_user;
|
var url = "'.DOL_URL_ROOT.'/salaries/ajax/ajaxsalaries.php?fk_user="+fk_user;
|
||||||
console.log("We click on link to autofill salary amount url="+url);
|
console.log("We click on link to autofill salary amount url="+url);
|
||||||
|
|
||||||
if (fk_user != -1) {
|
if (fk_user != -1) {
|
||||||
$.get(
|
$.get(
|
||||||
url,
|
url,
|
||||||
@ -704,7 +712,6 @@ if ($action == 'create' && $permissiontoadd) {
|
|||||||
print '</script>';
|
print '</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// View mode
|
// View mode
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
$head = salaries_prepare_head($object);
|
$head = salaries_prepare_head($object);
|
||||||
@ -969,11 +976,8 @@ if ($id > 0) {
|
|||||||
while ($i < $num) {
|
while ($i < $num) {
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|
||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven"><td>';
|
||||||
// Date
|
|
||||||
print '<td>';
|
|
||||||
print '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/salaries/payment_salary/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"), "payment").' '.$objp->rowid.'</a></td>';
|
||||||
// Date
|
|
||||||
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour', 'tzuserrel')."</td>\n";
|
print '<td>'.dol_print_date($db->jdate($objp->dp), 'dayhour', 'tzuserrel')."</td>\n";
|
||||||
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
|
$labeltype = $langs->trans("PaymentType".$objp->type_code) != ("PaymentType".$objp->type_code) ? $langs->trans("PaymentType".$objp->type_code) : $objp->paiement_type;
|
||||||
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
print "<td>".$labeltype.' '.$objp->num_payment."</td>\n";
|
||||||
@ -1046,6 +1050,17 @@ if ($id > 0) {
|
|||||||
|
|
||||||
print '<div class="tabsAction">'."\n";
|
print '<div class="tabsAction">'."\n";
|
||||||
if ($action != 'edit') {
|
if ($action != 'edit') {
|
||||||
|
// Dynamic send mail button
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
|
if (empty($reshook)) {
|
||||||
|
if (empty($user->socid)) {
|
||||||
|
$canSendMail = true;
|
||||||
|
|
||||||
|
print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=presend'.'&token='.newToken().'&mode=init#formmailbeforetitle', '', $canSendMail, $params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Reopen
|
// Reopen
|
||||||
if ($object->paye && $user->rights->salaries->write) {
|
if ($object->paye && $user->rights->salaries->write) {
|
||||||
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
|
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&id='.$object->id, '');
|
||||||
@ -1137,6 +1152,10 @@ if ($id > 0) {
|
|||||||
$trackid = 'salary'.$object->id;
|
$trackid = 'salary'.$object->id;
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||||
|
|
||||||
|
// Hook to add more things on page
|
||||||
|
$parameters = array();
|
||||||
|
$reshook = $hookmanager->executeHooks('salaryCardTabAddMore', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user