Merge branch '14.0' into 14p42
This commit is contained in:
commit
c61326cdae
@ -2981,7 +2981,11 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// when bank account is empty (means not override by payment mode form a other object, like third-party), try to use default value
|
||||
$fk_account = GETPOSTISSET("fk_account") ? GETPOST("fk_account", 'int') : $fk_account;
|
||||
if ($socid > 0 && $fk_account) { // A company has already been set and it has a default fk_account
|
||||
$fk_account = GETPOSTISSET('fk_account') ? GETPOST("fk_account", 'int') : $fk_account; // The GETPOST is used only if form was posted to avoid to take default value, because in such case, the default must be the one of the company
|
||||
} else { // No company forced
|
||||
$fk_account = GETPOST("fk_account", 'int');
|
||||
}
|
||||
|
||||
if (!empty($soc->id)) {
|
||||
$absolute_discount = $soc->getAvailableDiscounts();
|
||||
|
||||
@ -309,7 +309,11 @@ if ($id) {
|
||||
print img_object($langs->trans("ShowBill"), "bill");
|
||||
print '</a> ';
|
||||
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
|
||||
if ($type == 'bank-transfer') {
|
||||
print '<a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
|
||||
} else {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
|
||||
}
|
||||
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$obj->socid.'">';
|
||||
print img_object($langs->trans("ShowCompany"), "company").' '.$obj->name."</a></td>\n";
|
||||
|
||||
@ -910,7 +910,7 @@ class FormTicket
|
||||
$langs->loadLangs(array('other', 'mails'));
|
||||
|
||||
// Clear temp files. Must be done at beginning, before call of triggers
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
$this->clear_attached_files();
|
||||
}
|
||||
|
||||
@ -943,10 +943,10 @@ class FormTicket
|
||||
$listofmimes = array();
|
||||
$keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined
|
||||
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) {
|
||||
foreach ($this->param['fileinit'] as $file) {
|
||||
$this->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
$formmail->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,6 +291,11 @@ $parameters = [
|
||||
'validpaymentmethod' => &$validpaymentmethod
|
||||
];
|
||||
$reshook = $hookmanager->executeHooks('doValidatePayment', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif ($reshook > 0) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
// Check security token
|
||||
$tmpsource = $source;
|
||||
@ -2026,6 +2031,12 @@ if ($action != 'dopayment') {
|
||||
'object' => $object
|
||||
];
|
||||
$reshook = $hookmanager->executeHooks('doCheckStatus', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif ($reshook > 0) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if ($source == 'order' && $object->billed) {
|
||||
print '<br><br><span class="amountpaymentcomplete size15x">'.$langs->trans("OrderBilled").'</span>';
|
||||
} elseif ($source == 'invoice' && $object->paye) {
|
||||
@ -2047,6 +2058,12 @@ if ($action != 'dopayment') {
|
||||
'paymentmethod' => $paymentmethod
|
||||
];
|
||||
$reshook = $hookmanager->executeHooks('doAddButton', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif ($reshook > 0) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
|
||||
if ((empty($paymentmethod) || $paymentmethod == 'paybox') && !empty($conf->paybox->enabled)) {
|
||||
print '<div class="button buttonpayment" id="div_dopayment_paybox"><span class="fa fa-credit-card"></span> <input class="" type="submit" id="dopayment_paybox" name="dopayment_paybox" value="'.$langs->trans("PayBoxDoPayment").'">';
|
||||
print '<br>';
|
||||
@ -2651,9 +2668,13 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme
|
||||
'dopayment' => GETPOST('dopayment', 'alpha')
|
||||
];
|
||||
$reshook = $hookmanager->executeHooks('doPayment', $parameters, $object, $action);
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
} elseif ($reshook > 0) {
|
||||
print $hookmanager->resPrint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
htmlPrintOnlinePaymentFooter($mysoc, $langs, 1, $suffix, $object);
|
||||
|
||||
llxFooter('', 'public');
|
||||
|
||||
@ -2454,7 +2454,7 @@ class Ticket extends CommonObject
|
||||
$maxheightmini = 72;
|
||||
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
$formmail->trackid = 'tic'.$this->id;
|
||||
$attachedfiles = $formmail->get_attached_files();
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
@ -2576,24 +2576,24 @@ class Ticket extends CommonObject
|
||||
$assigned_user = new User($this->db);
|
||||
$assigned_user->fetch($this->fk_user_assign);
|
||||
if (!empty($assigned_user->email)) {
|
||||
$sendto[] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">";
|
||||
$sendto[$assigned_user->email] = $assigned_user->getFullName($langs)." <".$assigned_user->email.">";
|
||||
} else {
|
||||
$assigned_user_dont_have_email = $assigned_user->getFullName($langs);
|
||||
}
|
||||
}
|
||||
if (empty($sendto)) {
|
||||
if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) {
|
||||
$sendto[] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL;
|
||||
$sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL;
|
||||
} elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
$sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
}
|
||||
|
||||
// Add global email address recipient
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) &&
|
||||
!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)
|
||||
!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)
|
||||
) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
$sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
|
||||
if (!empty($sendto)) {
|
||||
@ -2677,7 +2677,7 @@ class Ticket extends CommonObject
|
||||
|
||||
if ($info_sendto['email'] != '') {
|
||||
if (!empty($info_sendto['email'])) {
|
||||
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
$sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
}
|
||||
|
||||
//Contact type
|
||||
@ -2693,9 +2693,9 @@ class Ticket extends CommonObject
|
||||
$message .= '<br>'.$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : <a href="'.$url_internal_ticket.'">'.$object->track_id.'</a><br>';
|
||||
|
||||
// Add global email address recipient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
$sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2755,7 +2755,7 @@ class Ticket extends CommonObject
|
||||
|
||||
if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) {
|
||||
if (!empty($info_sendto['email'])) {
|
||||
$sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
$sendto[$info_sendto['email']] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">";
|
||||
}
|
||||
|
||||
$recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')';
|
||||
@ -2775,21 +2775,21 @@ class Ticket extends CommonObject
|
||||
$message .= '<br>'.$message_signature;
|
||||
|
||||
if (!empty($object->origin_email)) {
|
||||
$sendto[] = $object->origin_email;
|
||||
$sendto[$object->origin_email] = $object->origin_email;
|
||||
}
|
||||
|
||||
if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) {
|
||||
if ($object->fk_soc > 0 && !array_key_exists($object->origin_email, $sendto)) {
|
||||
$object->socid = $object->fk_soc;
|
||||
$object->fetch_thirdparty();
|
||||
if (!empty($object->thirdparty->email)) {
|
||||
$sendto[] = $object->thirdparty->email;
|
||||
$sendto[$object->thirdparty->email] = $object->thirdparty->email;
|
||||
}
|
||||
}
|
||||
|
||||
// altairis: Add global email address reciepient
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
|
||||
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
|
||||
$sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
$sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user