diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php
index e9836c4efbf..642dca887b2 100644
--- a/htdocs/accountancy/bookkeeping/list.php
+++ b/htdocs/accountancy/bookkeeping/list.php
@@ -700,6 +700,17 @@ if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements
// Export files then exit
$accountancyexport = new AccountancyExport($db);
+ $notexportlettering = GETPOST('notexportlettering', 'alpha');
+
+ if (!empty($notexportlettering)) {
+ if (is_array($object->lines)) {
+ foreach ($object->lines as $k => $movement) {
+ unset($object->lines[$k]->lettering_code);
+ unset($object->lines[$k]->date_lettering);
+ }
+ }
+ }
+
$mimetype = $accountancyexport->getMimeType($formatexportset);
top_httphead($mimetype, 1);
@@ -802,6 +813,19 @@ $formconfirm = '';
if ($action == 'export_file') {
$form_question = array();
+ if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
+ // If 1, we check by default.
+ $checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
+ $form_question['notexportlettering'] = array(
+ 'name' => 'notexportlettering',
+ 'type' => 'checkbox',
+ 'label' => $langs->trans('NotExportLettering'),
+ 'value' => $checked,
+ );
+
+ $form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
+ }
+
// If 1 or not set, we check by default.
$checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
$form_question['notifiedexportdate'] = array(
@@ -811,7 +835,7 @@ if ($action == 'export_file') {
'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
);
- $form_question['separator'] = array('name'=>'separator', 'type'=>'separator');
+ $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
// If 0 or not set, we NOT check by default.
@@ -823,10 +847,10 @@ if ($action == 'export_file') {
'value' => $checked,
);
- $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
+ $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
}
- $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 300, 600);
+ $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 350, 600);
}
//if ($action == 'delbookkeepingyear') {
diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php
index 857cd12115e..5749518e2b9 100644
--- a/htdocs/accountancy/class/lettering.class.php
+++ b/htdocs/accountancy/class/lettering.class.php
@@ -592,7 +592,7 @@ class Lettering extends BookKeeping
$sql .= " WHERE bpn.entity IN (" . getEntity('accountancy') . ")";
$sql .= " AND bpn.doc_type = 'bank'";
$sql .= " AND bpn.fk_doc IN (" . $this->db->sanitize(implode(',', $bank_ids)) . ")";
- $sql .= " AND bpn ON bpn.piece_num = ab.piece_num";
+ $sql .= " AND bpn.piece_num = ab.piece_num";
$sql .= " ) OR ";
}
$sql .= " EXISTS (";
diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php
index f3049206389..dd729872f13 100644
--- a/htdocs/accountancy/journal/bankjournal.php
+++ b/htdocs/accountancy/journal/bankjournal.php
@@ -1032,9 +1032,9 @@ if (empty($action) || $action == 'view') {
$salarystatic = new Salary($db);
$variousstatic = new PaymentVarious($db);
- llxHeader('', $langs->trans("FinanceJournal"));
+ llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType4"));
- $nom = $langs->trans("FinanceJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
+ $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$builddate = dol_now();
//$description = $langs->trans("DescFinanceJournal") . '
';
$description = $langs->trans("DescJournalOnlyBindedVisible").'
';
diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php
index d38e49c390e..599e5394399 100644
--- a/htdocs/accountancy/journal/expensereportsjournal.php
+++ b/htdocs/accountancy/journal/expensereportsjournal.php
@@ -496,14 +496,14 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
- llxHeader('', $langs->trans("ExpenseReportsJournal"));
+ llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType5"));
- $nom = $langs->trans("ExpenseReportsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
+ $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$nomlink = '';
$periodlink = '';
$exportlink = '';
$builddate = dol_now();
- $description .= $langs->trans("DescJournalOnlyBindedVisible").'
';
+ $description = $langs->trans("DescJournalOnlyBindedVisible").'
';
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);
diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php
index 0f721a67db7..a0b0bed97fa 100644
--- a/htdocs/accountancy/journal/purchasesjournal.php
+++ b/htdocs/accountancy/journal/purchasesjournal.php
@@ -756,9 +756,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
}
if (empty($action) || $action == 'view') {
- llxHeader('', $langs->trans("PurchasesJournal"));
+ llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType3"));
- $nom = $langs->trans("PurchasesJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
+ $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$nomlink = '';
$periodlink = '';
$exportlink = '';
diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php
index 4894e7b660f..461fc327686 100644
--- a/htdocs/accountancy/journal/sellsjournal.php
+++ b/htdocs/accountancy/journal/sellsjournal.php
@@ -699,9 +699,9 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
if (empty($action) || $action == 'view') {
- llxHeader('', $langs->trans("SellsJournal"));
+ llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType2"));
- $nom = $langs->trans("SellsJournal").' | '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
+ $nom = $langs->trans("GenerationOfAccountingEntries").' - '.$accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
$nomlink = '';
$periodlink = '';
$exportlink = '';
diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php
index 13ccba0d762..e9e9cabd984 100644
--- a/htdocs/accountancy/journal/variousjournal.php
+++ b/htdocs/accountancy/journal/variousjournal.php
@@ -165,22 +165,18 @@ if ($reload) {
$form = new Form($db);
if ($object->nature == 2) {
- $title = $langs->trans("SellsJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1';
} elseif ($object->nature == 3) {
- $title = $langs->trans("PurchasesJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 4) {
- $title = $langs->trans("FinanceJournal");
$some_mandatory_steps_of_setup_were_not_done = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1'
|| empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "" || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "" || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1';
} elseif ($object->nature == 5) {
- $title = $langs->trans("ExpenseReportsJournal");
$some_mandatory_steps_of_setup_were_not_done = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
$account_accounting_not_defined = empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1';
} else {
@@ -189,8 +185,9 @@ if ($object->nature == 2) {
$account_accounting_not_defined = false;
}
+llxHeader('', $langs->trans("GenerationOfAccountingEntries").' - '.$langs->trans("AccountingJournalType1"));
-$nom = $title . ' | ' . $object->getNomUrl(0, 1, 1, '', 1);
+$nom = $langs->trans("GenerationOfAccountingEntries") . ' - ' . $object->getNomUrl(0, 1, 1, '', 1);
$nomlink = '';
$periodlink = '';
$exportlink = '';
@@ -213,8 +210,6 @@ $period .= ' - ' . $langs->trans("JournalizationInLedgerStatus") . ' ' . $form-
$varlink = 'id_journal=' . $id_journal;
-llxHeader('', $title);
-
journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink);
if ($object->nature == 4) { // Bank journal
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index 228ff397607..aa14ba6e696 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1306,8 +1306,17 @@ class ActionComm extends CommonObject
dol_syslog(get_class()."::getActions", LOG_DEBUG);
+ require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($db);
+ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+ $hookmanager->initHooks(array('agendadao'));
+
$sql = "SELECT a.id";
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
+ // Fields from hook
+ $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
+ $reshook = $hookmanager->executeHooks('getActionsListFrom', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
$sql .= " WHERE a.entity IN (".getEntity('agenda').")";
if (!empty($socid)) {
$sql .= " AND a.fk_soc = ".((int) $socid);
@@ -1326,6 +1335,10 @@ class ActionComm extends CommonObject
if (!empty($filter)) {
$sql .= $filter;
}
+ // Fields where hook
+ $parameters = array('sql' => &$sql, 'socid' => $socid, 'fk_element' => $fk_element, 'elementtype' => $elementtype);
+ $reshook = $hookmanager->executeHooks('getActionsListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
if ($sortorder && $sortfield) {
$sql .= $this->db->order($sortfield, $sortorder);
}
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 183ee457c32..4a4a02e87c4 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -136,7 +136,7 @@ class Facture extends CommonInvoice
/**
* @var int Date expected for delivery
* @deprecated
- * @see delivery_date
+ * @see $delivery_date
*/
public $date_livraison;
@@ -148,7 +148,7 @@ class Facture extends CommonInvoice
/**
* @var string customer ref
* @deprecated
- * @see ref_customer
+ * @see $ref_customer
*/
public $ref_client;
@@ -5421,12 +5421,13 @@ class Facture extends CommonInvoice
* Send reminders by emails for ivoices that are due
* CAN BE A CRON TASK
*
- * @param int $nbdays Delay after due date (or before if delay is negative)
- * @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ...
- * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send')
- * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
+ * @param int $nbdays Delay after due date (or before if delay is negative)
+ * @param string $paymentmode '' or 'all' by default (no filter), or 'LIQ', 'CHQ', CB', ...
+ * @param int|string $template Name (or id) of email template (Must be a template of type 'facture_send')
+ * @param string $forcerecipient Force email of recipient (for example to send the email to an accountant supervisor instead of the customer)
+ * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
*/
- public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '')
+ public function sendEmailsRemindersOnInvoiceDueDate($nbdays = 0, $paymentmode = 'all', $template = '', $forcerecipient = '')
{
global $conf, $langs, $user;
@@ -5469,11 +5470,11 @@ class Facture extends CommonInvoice
$sql .= " WHERE f.paye = 0";
$sql .= " AND f.fk_statut = ".self::STATUS_VALIDATED;
$sql .= " AND f.date_lim_reglement = '".$this->db->idate($tmpidate, 'gmt')."'";
- $sql .= " AND f.entity IN (".getEntity('facture').")";
+ $sql .= " AND f.entity IN (".getEntity('facture', 0).")"; // One batch process only one company (no sharing)
if (!empty($paymentmode) && $paymentmode != 'all') {
$sql .= " AND f.fk_mode_reglement = cp.id AND cp.code = '".$this->db->escape($paymentmode)."'";
}
- // TODO Add filter to check there is no payment started
+ // TODO Add a filter to check there is no payment started yet
$sql .= $this->db->order("date_lim_reglement", "ASC");
$resql = $this->db->query($sql);
@@ -5527,30 +5528,37 @@ class Facture extends CommonInvoice
// Recipient
$to = array();
- $res = $tmpinvoice->fetch_thirdparty();
- $recipient = $tmpinvoice->thirdparty;
- if ($res > 0) {
- $tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
- if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
- foreach ($tmparraycontact as $data_email) {
- if (!empty($data_email['email'])) {
- $to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
+ if ($forcerecipient) { // If a recipient was forced
+ $to = array($forcerecipient);
+ } else {
+ $res = $tmpinvoice->fetch_thirdparty();
+ $recipient = $tmpinvoice->thirdparty;
+ if ($res > 0) {
+ $tmparraycontact = $tmpinvoice->liste_contact(-1, 'external', 0, 'BILLING');
+ if (is_array($tmparraycontact) && count($tmparraycontact) > 0) {
+ foreach ($tmparraycontact as $data_email) {
+ if (!empty($data_email['email'])) {
+ $to[] = $tmpinvoice->thirdparty->contact_get_property($data_email['id'], 'email');
+ }
}
}
- }
- if (empty($to) && !empty($recipient->email)) {
- $to[] = $recipient->email;
+ if (empty($to) && !empty($recipient->email)) {
+ $to[] = $recipient->email;
+ } else {
+ $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
+ $error++;
+ }
} else {
- $errormesg = "Failed to send remind to thirdparty id=".$tmpinvoice->socid.". No email defined for user.";
+ $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
$error++;
}
- } else {
- $errormesg = "Failed to load recipient with thirdparty id=".$tmpinvoice->socid;
- $error++;
}
// Sender
- $from = $conf->global->MAIN_MAIL_EMAIL_FROM;
+ $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM');
+ if (!empty($arraymessage->email_from)) { // If a sender is defined into template, we use it in priority
+ $from = $arraymessage->email_from;
+ }
if (empty($from)) {
$errormesg = "Failed to get sender into global setup MAIN_MAIL_EMAIL_FROM";
$error++;
@@ -5560,6 +5568,9 @@ class Facture extends CommonInvoice
$this->db->begin();
$to = implode(',', $to);
+ if (!empty($arraymessage->email_to)) { // If a recipient is defined into template, we add it
+ $to = $to.','.$arraymessage->email_to;
+ }
// Errors Recipient
$errors_to = $conf->global->MAIN_MAIL_ERRORS_TO;
@@ -5567,8 +5578,18 @@ class Facture extends CommonInvoice
$trackid = 'inv'.$tmpinvoice->id;
$sendcontext = 'standard';
+ $email_tocc = '';
+ if (!empty($arraymessage->email_tocc)) { // If a CC is defined into template, we use it
+ $email_tocc = $arraymessage->email_tocc;
+ }
+
+ $email_tobcc = '';
+ if (!empty($arraymessage->email_tobcc)) { // If a BCC is defined into template, we use it
+ $email_tobcc = $arraymessage->email_tobcc;
+ }
+
// Mail Creation
- $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), '', "", 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
+ $cMailFile = new CMailFile($sendTopic, $to, $from, $sendContent, array(), array(), array(), $email_tocc, $email_tobcc, 0, 1, $errors_to, '', $trackid, '', $sendcontext, '');
// Sending Mail
if ($cMailFile->sendfile()) {
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 9809554c37f..5664c2e3f54 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -143,6 +143,13 @@ if (empty($reshook)) {
$result = $object->makeStripeSepaRequest($user, GETPOST('did', 'int'), 'direct-debit', 'facture');
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
+ } else {
+ // We refresh object data
+ $ret = $object->fetch($id, $ref);
+ $isdraft = (($object->statut == FactureFournisseur::STATUS_DRAFT) ? 1 : 0);
+ if ($ret > 0) {
+ $object->fetch_thirdparty();
+ }
}
}
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 2a185b362be..6fa218d4970 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -1572,7 +1572,7 @@ abstract class CommonInvoice extends CommonObject
$this->errors[] = "Remain to pay is null for the invoice " . $this->id . " " . $this->ref . ". Why is the invoice not classified 'Paid' ?";
}
- $sql = "INSERT INTO '.MAIN_DB_PREFIX.'prelevement_demande(";
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."prelevement_demande(";
$sql .= "fk_facture, ";
$sql .= " amount, date_demande, fk_user_demande, ext_payment_id, ext_payment_site, sourcetype, entity)";
$sql .= " VALUES (".$this->id;
diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php
index b6a9140cf58..609458ce839 100644
--- a/htdocs/core/class/html.formcron.class.php
+++ b/htdocs/core/class/html.formcron.class.php
@@ -96,6 +96,9 @@ class FormCron extends Form
$out .= '';
}
+ if (empty($readonly)) {
+ $out .= ajax_combobox($htmlname);
+ }
return $out;
}
diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php
index 41cf2482f9a..aa2ee4b3e6a 100644
--- a/htdocs/core/class/html.formmail.class.php
+++ b/htdocs/core/class/html.formmail.class.php
@@ -1305,9 +1305,9 @@ class FormMail extends Form
$languagetosearchmain = '';
}
- $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang";
+ $sql = "SELECT rowid, module, label, type_template, topic, joinfiles, content, content_lines, lang, email_from, email_to, email_tocc, email_tobcc";
$sql .= " FROM ".$dbs->prefix().'c_email_templates';
- $sql .= " WHERE (type_template='".$dbs->escape($type_template)."' OR type_template='all')";
+ $sql .= " WHERE (type_template = '".$dbs->escape($type_template)."' OR type_template = 'all')";
$sql .= " AND entity IN (".getEntity('c_email_templates').")";
$sql .= " AND (private = 0 OR fk_user = ".((int) $user->id).")"; // Get all public or private owned
if ($active >= 0) {
@@ -1728,6 +1728,11 @@ class ModelMail
public $lang;
public $joinfiles;
+ public $email_from;
+ public $email_to;
+ public $email_tocc;
+ public $email_tobcc;
+
/**
* @var string Module the template is dedicated for
*/
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index 43264ac3d98..3d0cb72e7c9 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -1489,6 +1489,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql = '';
if (isModEnabled('agenda')) {
+ require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
+ $hookmanager = new HookManager($db);
+ // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+ $hookmanager->initHooks(array('agendadao'));
+
// Recherche histo sur actioncomm
if (is_object($objcon) && $objcon->id > 0) {
$sql = "SELECT DISTINCT a.id, a.label as label,";
@@ -1528,6 +1533,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
}
}
+ // Fields from hook
+ $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
+ $reshook = $hookmanager->executeHooks('showActionsDoneListSelect', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
+
$sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id";
@@ -1539,6 +1549,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
$sql .= " AND r.element_type = '".$db->escape($objcon->table_element)."' AND r.fk_element = ".((int) $objcon->id);
}
+ // Fields from hook
+ $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon);
+ $reshook = $hookmanager->executeHooks('showActionsDoneListFrom', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
+
if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur'))) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid";
} elseif (is_object($filterobj) && get_class($filterobj) == 'Dolresource') {
@@ -1639,6 +1654,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
addOtherFilterSQL($sql, $donetodo, $now, $filters);
+ // Fields from hook
+ $parameters = array('sql' => &$sql, 'filterobj' => $filterobj, 'objcon' => $objcon, 'module' => $module);
+ $reshook = $hookmanager->executeHooks('showActionsDoneListWhere', $parameters); // Note that $action and $object may have been modified by hook
+ if (!empty($hookmanager->resPrint)) $sql.= $hookmanager->resPrint;
+
if (is_array($actioncode)) {
foreach ($actioncode as $code) {
$sql2 = addMailingEventTypeSQL($code, $objcon, $filterobj);
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 6d2841a08b2..b5ec311b0c5 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1159,29 +1159,43 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
}
/**
- * Create a clone of instance of object (new instance with same value for properties)
- * With native = 0: Property that are reference are also new object (full isolation clone). This means $this->db of new object may not be valid.
+ * Create a clone of instance of object (new instance with same value for each properties)
+ * With native = 0: Property that are reference are different memory area in the new object (full isolation clone). This means $this->db of new object may not be valid.
* With native = 1: Use PHP clone. Property that are reference are same pointer. This means $this->db of new object is still valid but point to same this->db than original object.
+ * With native = 2: Property that are reference are different memory area in the new object (full isolation clone). Only scalar and array values are cloned. This means $this->db of new object is not valid.
*
* @param object $object Object to clone
- * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method+destroy non scalar or array properties (recommended)
+ * @param int $native 0=Full isolation method, 1=Native PHP method, 2=Full isolation method keeping only scalar and array properties (recommended)
* @return object Clone object
* @see https://php.net/manual/language.oop5.cloning.php
*/
function dol_clone($object, $native = 0)
{
if ($native == 0) {
+ // deprecated method, use the method with native = 2 instead
$tmpsavdb = null;
if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') {
$tmpsavdb = $object->db;
unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection')
}
- $myclone = unserialize(serialize($object)); // serialize then unserialize is hack to be sure to have a new object for all fields
+ $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields
if (!empty($tmpsavdb)) {
$object->db = $tmpsavdb;
}
+ } elseif ($native == 2) {
+ // recommended method to have a full isolated cloned object
+ $myclone = new stdClass();
+ $tmparray = get_object_vars($object); // return only public properties
+
+ if (is_array($tmparray)) {
+ foreach ($tmparray as $propertykey => $propertyval) {
+ if (is_scalar($propertyval) || is_array($propertyval)) {
+ $myclone->$propertykey = $propertyval;
+ }
+ }
+ }
} else {
$myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep the reference (refering to the same target/variable)
}
@@ -5657,8 +5671,8 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0,
* @param integer $form Type of format, HTML or not (not by default)
* @param Translate|string $outlangs Object langs for output. '' use default lang. 'none' use international separators.
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
- * @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
- * @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
+ * @param int $rounding MINIMUM number of decimal to show. 0=no change, -1=we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
+ * @param int|string $forcerounding Force the MAXIMUM of decimal to forcerounding decimal (-1=no change, 'MU' or 'MT' or numeric to round to MU or MT or to a given number of decimal)
* @param string $currency_code To add currency symbol (''=add nothing, 'auto'=Use default currency, 'XXX'=add currency symbols for XXX currency)
* @return string String with formated amount
*
@@ -5729,8 +5743,14 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
}
// If force rounding
- if ($forcerounding >= 0) {
- $nbdecimal = $forcerounding;
+ if ((string) $forcerounding != '-1') {
+ if ($forcerounding == 'MU') {
+ $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_UNIT;
+ } else if ($forcerounding == 'MT') {
+ $nbdecimal = $conf->global->MAIN_MAX_DECIMALS_TOT;
+ } elseif ($forcerounding >= 0) {
+ $nbdecimal = $forcerounding;
+ }
}
// Format number
diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
index dddd01a602d..2ff2313c998 100644
--- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php
+++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
@@ -102,7 +102,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$texte .= '';
$texte .= '';
$texte .= '';
- $texte .= '
| '; + $texte .= ''; + + $texte .= ' |
| ';
+ $texte .= " \n"; + + $texthelp = $langs->trans("RemoveSpecialWordsHelp"); + $texttitle = $langs->trans("RemoveSpecialWords"); + + $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); + $texte .= " \n"; + $texte .= ''; $texte .= ' |