Merge develop
This commit is contained in:
parent
ba452e6d33
commit
27c32560c6
@ -57,7 +57,6 @@ NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT
|
||||
NEW: add option to define a default warehouse at user level
|
||||
NEW: add option to include products without alert in replenish
|
||||
NEW: add order by lastname and firstname by default in get sales representatives
|
||||
NEW: add param to not show links when output tags
|
||||
NEW: add PDF document templates for warehouses (list of stock)
|
||||
NEW: add a prospect status for the contact with managment of custom icon
|
||||
NEW: add public note on products ; this also partially fix the #14342
|
||||
@ -80,7 +79,7 @@ NEW: appearance tab in TakePOS with more visual parameters
|
||||
NEW: better currency rate editor
|
||||
NEW: can build vendor invoice from vendor orders
|
||||
NEW: can change a product in lines of a recurring invoice or contract
|
||||
NEW: can change size of logo on PDF documents
|
||||
NEW: can set the size of the logo on PDF documents
|
||||
NEW: can change VAT rate of all lines of a draft object in one step
|
||||
NEW: can define date range of validity of a login during creation
|
||||
NEW: can disable, from edit page, the whole web site
|
||||
@ -189,7 +188,7 @@ NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER)
|
||||
NEW: Add some fields to link website page to an other object
|
||||
NEW: fill ECM src object fields in dol_add_file_process
|
||||
NEW: conf to allow to show the full tree in warehouse popup
|
||||
NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
|
||||
NEW: can use parameter ?THEME_DARKMODEENABLED=2 for a preview of theme in dark mode
|
||||
NEW: can force the antivirus from conf file or autoprepend ini setup
|
||||
NEW: can add event to log into blockedlog module with a constant
|
||||
NEW: add property cssview when declaring fields of an object
|
||||
@ -208,6 +207,7 @@ NEW: add a message in error_log after detection of SQL or script injection
|
||||
NEW: add validation of MX domain for emails
|
||||
NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') )
|
||||
NEW: Graphics can be horizontal bars
|
||||
NEW: add param to not show links when output tags
|
||||
|
||||
APIs
|
||||
NEW: API get contacts list of a given order
|
||||
|
||||
@ -46,7 +46,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks'));
|
||||
$langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
|
||||
@ -549,16 +549,17 @@ if (!empty($conf->multicompany->enabled) && is_object($mc))
|
||||
print '<br>';
|
||||
|
||||
$listofchoices = array(
|
||||
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'),
|
||||
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'),
|
||||
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'),
|
||||
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'),
|
||||
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'),
|
||||
'selectsocialcontributions'=>array('label'=>'SocialContributions'),
|
||||
'selectvariouspayment'=>array('label'=>'VariousPayment'),
|
||||
'selectloanspayment'=>array('label'=>'PaymentLoan'),
|
||||
'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills', 'enabled' => !empty($conf->facture->enabled)),
|
||||
'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills', 'enabled' => !empty($conf->supplier_invoice->enabled)),
|
||||
'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips', 'enabled' => !empty($conf->expensereport->enabled)),
|
||||
'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation', 'enabled' => !empty($conf->don->enabled)),
|
||||
'selectsocialcontributions'=>array('label'=>'SocialContributions', 'enabled' => !empty($conf->tax->enabled)),
|
||||
'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries', 'enabled' => !empty($conf->salaries->enabled)),
|
||||
'selectvariouspayment'=>array('label'=>'VariousPayment', 'enabled' => !empty($conf->banque->enabled)),
|
||||
'selectloanspayment'=>array('label'=>'PaymentLoan', 'enabled' => !empty($conf->loan->enabled)),
|
||||
);
|
||||
foreach ($listofchoices as $choice => $val) {
|
||||
if (empty($val['enabled'])) continue; // list not qualified
|
||||
$checked = (((!GETPOSTISSET('search') && $action != 'searchfiles') || GETPOST($choice)) ? ' checked="checked"' : '');
|
||||
print '<div class="paddingleft inline-block marginrightonly"><input type="checkbox" id="'.$choice.'" name="'.$choice.'" value="1"'.$checked.'> <label for="'.$choice.'">'.$langs->trans($val['label']).'</label></div>';
|
||||
}
|
||||
|
||||
@ -493,9 +493,10 @@ class Account extends CommonObject
|
||||
* @param string $banque Bank of cheque writer
|
||||
* @param string $accountancycode When we record a free bank entry, we must provide accounting account if accountancy module is on.
|
||||
* @param int $datev Date value
|
||||
* @param string $num_releve Label of bank receipt for reconciliation
|
||||
* @return int Rowid of added entry, <0 if KO
|
||||
*/
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null)
|
||||
public function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null, $num_releve = '')
|
||||
{
|
||||
// Deprecation warning
|
||||
if (is_numeric($oper)) {
|
||||
@ -555,6 +556,7 @@ class Account extends CommonObject
|
||||
$accline->fk_account = $this->rowid;
|
||||
$accline->fk_type = $oper;
|
||||
$accline->numero_compte = $accountancycode;
|
||||
$accline->num_releve = $num_releve;
|
||||
|
||||
if ($num_chq) {
|
||||
$accline->num_chq = $num_chq;
|
||||
@ -1886,6 +1888,7 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", emetteur,banque";
|
||||
$sql .= ", rappro";
|
||||
$sql .= ", numero_compte";
|
||||
$sql .= ", num_releve";
|
||||
$sql .= ") VALUES (";
|
||||
$sql .= "'".$this->db->idate($this->datec)."'";
|
||||
$sql .= ", '".$this->db->idate($this->dateo)."'";
|
||||
@ -1900,6 +1903,7 @@ class AccountLine extends CommonObject
|
||||
$sql .= ", ".($this->bank_chq ? "'".$this->db->escape($this->bank_chq)."'" : "null");
|
||||
$sql .= ", ".(int) $this->rappro;
|
||||
$sql .= ", ".($this->numero_compte ? "'".$this->db->escape($this->numero_compte)."'" : "''");
|
||||
$sql .= ", ".($this->num_releve ? "'".$this->db->escape($this->num_releve)."'" : "null");
|
||||
$sql .= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::insert", LOG_DEBUG);
|
||||
|
||||
@ -466,20 +466,23 @@ class BankAccounts extends DolibarrApi
|
||||
/**
|
||||
* Add a line to an account
|
||||
*
|
||||
* @param int $id ID of account
|
||||
* @param int $date Payment date (timestamp) {@from body} {@type timestamp}
|
||||
* @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
|
||||
* @param string $label Label {@from body}
|
||||
* @param float $amount Amount (may be 0) {@from body}
|
||||
* @param int $category Category
|
||||
* @param string $cheque_number Cheque numberl {@from body}
|
||||
* @param string $cheque_writer Name of cheque writer {@from body}
|
||||
* @param string $cheque_bank Bank of cheque writer {@from body}
|
||||
* @param int $id ID of account
|
||||
* @param int $date Payment date (timestamp) {@from body} {@type timestamp}
|
||||
* @param string $type Payment mode (TYP,VIR,PRE,LIQ,VAD,CB,CHQ...) {@from body}
|
||||
* @param string $label Label {@from body}
|
||||
* @param float $amount Amount (may be 0) {@from body}
|
||||
* @param int $category Category
|
||||
* @param string $cheque_number Cheque numero {@from body}
|
||||
* @param string $cheque_writer Name of cheque writer {@from body}
|
||||
* @param string $cheque_bank Bank of cheque writer {@from body}
|
||||
* @param string $accountancycode Accountancy code {@from body}
|
||||
* @param int $datev Payment date value (timestamp) {@from body} {@type timestamp}
|
||||
* @param string $num_releve Bank statement numero {@from body}
|
||||
* @return int ID of line
|
||||
*
|
||||
* @url POST {id}/lines
|
||||
*/
|
||||
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '')
|
||||
public function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '', $accountancycode = '', $datev = null, $num_releve = '')
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->banque->modifier) {
|
||||
throw new RestException(401);
|
||||
@ -499,7 +502,8 @@ class BankAccounts extends DolibarrApi
|
||||
$cheque_number,
|
||||
$category,
|
||||
DolibarrApiAccess::$user,
|
||||
$cheque_writer, $cheque_bank
|
||||
$cheque_writer, $cheque_bank, $accountancycode,
|
||||
$datev, $num_releve
|
||||
);
|
||||
if ($result < 0) {
|
||||
throw new RestException(503, 'Error when adding line to account: '.$account->error);
|
||||
|
||||
@ -710,10 +710,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
// Price
|
||||
print '<td class="right">'.price($sign * $objp->total_ttc).'</td>';
|
||||
|
||||
// Received or paid back
|
||||
// Received + already paid
|
||||
print '<td class="right">'.price($sign * $paiement);
|
||||
if ($creditnotes) print '+'.price($creditnotes);
|
||||
if ($deposits) print '+'.price($deposits);
|
||||
if ($creditnotes) print '<span class="opacitymedium">+'.price($creditnotes).'</span>';
|
||||
if ($deposits) print '<span class="opacitymedium">+'.price($deposits).'</span>';
|
||||
print '</td>';
|
||||
|
||||
// Remain to take or to pay back
|
||||
|
||||
@ -374,8 +374,7 @@ if (empty($reshook))
|
||||
$action = 'create';
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'classin' && $user->rights->contrat->creer)
|
||||
{
|
||||
} elseif ($action == 'classin' && $user->rights->contrat->creer) {
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
}
|
||||
|
||||
|
||||
@ -137,10 +137,13 @@ class box_fournisseurs extends ModeleBoxes
|
||||
$line++;
|
||||
}
|
||||
|
||||
if ($num == 0) $this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center opacitymedium"',
|
||||
'text'=>$langs->trans("NoRecordedSuppliers"),
|
||||
);
|
||||
if ($num == 0) {
|
||||
$langs->load("suppliers");
|
||||
$this->info_box_contents[$line][0] = array(
|
||||
'td' => 'class="center opacitymedium"',
|
||||
'text'=>$langs->trans("NoRecordedSuppliers"),
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
} else {
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* 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
|
||||
@ -950,15 +950,14 @@ class CMailFile
|
||||
* Read a file on disk and return encoded content for emails (mode = 'mail')
|
||||
*
|
||||
* @param string $sourcefile Path to file to encode
|
||||
* @return int <0 if KO, encoded string if OK
|
||||
* @return int|string <0 if KO, encoded string if OK
|
||||
*/
|
||||
private function _encode_file($sourcefile)
|
||||
{
|
||||
// phpcs:enable
|
||||
$newsourcefile = dol_osencode($sourcefile);
|
||||
|
||||
if (is_readable($newsourcefile))
|
||||
{
|
||||
if (is_readable($newsourcefile)) {
|
||||
$contents = file_get_contents($newsourcefile); // Need PHP 4.3
|
||||
$encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047
|
||||
return $encoded;
|
||||
@ -983,27 +982,24 @@ class CMailFile
|
||||
// phpcs:enable
|
||||
global $conf, $dolibarr_main_data_root;
|
||||
|
||||
if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir
|
||||
{
|
||||
if (@is_writeable($dolibarr_main_data_root)) { // Avoid fatal error on fopen with open_basedir
|
||||
$outputfile = $dolibarr_main_data_root."/dolibarr_mail.log";
|
||||
$fp = fopen($outputfile, "w");
|
||||
|
||||
if ($this->sendmode == 'mail')
|
||||
{
|
||||
if ($this->sendmode == 'mail') {
|
||||
fputs($fp, $this->headers);
|
||||
fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log
|
||||
fputs($fp, $this->message);
|
||||
} elseif ($this->sendmode == 'smtps')
|
||||
{
|
||||
} elseif ($this->sendmode == 'smtps') {
|
||||
fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on
|
||||
} elseif ($this->sendmode == 'swiftmailer')
|
||||
{
|
||||
} elseif ($this->sendmode == 'swiftmailer') {
|
||||
fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
if (!empty($conf->global->MAIN_UMASK))
|
||||
if (!empty($conf->global->MAIN_UMASK)) {
|
||||
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1016,8 +1012,7 @@ class CMailFile
|
||||
*/
|
||||
public function checkIfHTML($msg)
|
||||
{
|
||||
if (!preg_match('/^[\s\t]*<html/i', $msg))
|
||||
{
|
||||
if (!preg_match('/^[\s\t]*<html/i', $msg)) {
|
||||
$out = "<html><head><title></title>";
|
||||
if (!empty($this->styleCSS)) $out .= $this->styleCSS;
|
||||
$out .= "</head><body";
|
||||
@ -1039,19 +1034,16 @@ class CMailFile
|
||||
*/
|
||||
public function buildCSS()
|
||||
{
|
||||
if (!empty($this->css))
|
||||
{
|
||||
if (!empty($this->css)) {
|
||||
// Style CSS
|
||||
$this->styleCSS = '<style type="text/css">';
|
||||
$this->styleCSS .= 'body {';
|
||||
|
||||
if ($this->css['bgcolor'])
|
||||
{
|
||||
if ($this->css['bgcolor']) {
|
||||
$this->styleCSS .= ' background-color: '.$this->css['bgcolor'].';';
|
||||
$this->bodyCSS .= ' bgcolor="'.$this->css['bgcolor'].'"';
|
||||
}
|
||||
if ($this->css['bgimage'])
|
||||
{
|
||||
if ($this->css['bgimage']) {
|
||||
// TODO recuperer cid
|
||||
$this->styleCSS .= ' background-image: url("cid:'.$this->css['bgimage_cid'].'");';
|
||||
}
|
||||
|
||||
@ -6853,6 +6853,7 @@ abstract class CommonObject
|
||||
break;
|
||||
}
|
||||
|
||||
// Output value of the current field
|
||||
if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate')
|
||||
{
|
||||
$extrafields_collapse_num = '';
|
||||
|
||||
@ -116,7 +116,12 @@ class FormMail extends Form
|
||||
*/
|
||||
public $withto; // Show recipient emails
|
||||
|
||||
public $withtofree; // Show free text for recipient emails
|
||||
/**
|
||||
* @var int|string 0 = Do not Show free text for recipient emails
|
||||
* 1 = Show free text for recipient emails
|
||||
* or a free email
|
||||
*/
|
||||
public $withtofree;
|
||||
public $withtocc;
|
||||
public $withtoccc;
|
||||
public $withtopic;
|
||||
@ -354,14 +359,15 @@ class FormMail extends Form
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
$formfile = new Formfile($this->db);
|
||||
|
||||
if (!is_object($form)) $form = new Form($this->db);
|
||||
if (!is_object($form)) {
|
||||
$form = new Form($this->db);
|
||||
}
|
||||
|
||||
// Load translation files required by the page
|
||||
$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('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
$this->clear_attached_files();
|
||||
}
|
||||
|
||||
@ -375,8 +381,7 @@ class FormMail extends Form
|
||||
);
|
||||
$reshook = $hookmanager->executeHooks('getFormMail', $parameters, $this);
|
||||
|
||||
if (!empty($reshook))
|
||||
{
|
||||
if (!empty($reshook)) {
|
||||
return $hookmanager->resPrint;
|
||||
} else {
|
||||
$out = '';
|
||||
@ -387,8 +392,7 @@ class FormMail extends Form
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels'];
|
||||
if (!empty($newlang))
|
||||
{
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->load('other');
|
||||
@ -396,11 +400,9 @@ class FormMail extends Form
|
||||
|
||||
// Get message template for $this->param["models"] into c_email_templates
|
||||
$arraydefaultmessage = -1;
|
||||
if ($this->param['models'] != 'none')
|
||||
{
|
||||
if ($this->param['models'] != 'none') {
|
||||
$model_id = 0;
|
||||
if (array_key_exists('models_id', $this->param))
|
||||
{
|
||||
if (array_key_exists('models_id', $this->param)) {
|
||||
$model_id = $this->param["models_id"];
|
||||
}
|
||||
|
||||
@ -413,25 +415,27 @@ class FormMail extends Form
|
||||
$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']))
|
||||
{
|
||||
foreach ($this->param['fileinit'] as $file)
|
||||
{
|
||||
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
|
||||
if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) {
|
||||
foreach ($this->param['fileinit'] as $file) {
|
||||
$this->add_attached_files($file, basename($file), dol_mimetype($file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
if (!empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
|
||||
if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
|
||||
$listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
|
||||
}
|
||||
if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
|
||||
$listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
|
||||
}
|
||||
if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
|
||||
$listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
|
||||
}
|
||||
|
||||
|
||||
$out .= "\n".'<!-- Begin form mail type='.$this->param["models"].' --><div id="mailformdiv"></div>'."\n";
|
||||
if ($this->withform == 1)
|
||||
{
|
||||
if ($this->withform == 1) {
|
||||
$out .= '<form method="POST" name="mailform" id="mailform" enctype="multipart/form-data" action="'.$this->param["returnurl"].'#formmail">'."\n";
|
||||
|
||||
$out .= '<a id="formmail" name="formmail"></a>';
|
||||
@ -439,16 +443,13 @@ class FormMail extends Form
|
||||
$out .= '<input type="hidden" name="token" value="'.newToken().'" />';
|
||||
$out .= '<input type="hidden" name="trackid" value="'.$this->trackid.'" />';
|
||||
}
|
||||
if (!empty($this->withfrom))
|
||||
{
|
||||
if (!empty($this->withfromreadonly))
|
||||
{
|
||||
if (!empty($this->withfrom)) {
|
||||
if (!empty($this->withfromreadonly)) {
|
||||
$out .= '<input type="hidden" id="fromname" name="fromname" value="'.$this->fromname.'" />';
|
||||
$out .= '<input type="hidden" id="frommail" name="frommail" value="'.$this->frommail.'" />';
|
||||
}
|
||||
}
|
||||
foreach ($this->param as $key=>$value)
|
||||
{
|
||||
foreach ($this->param as $key=>$value) {
|
||||
if (is_array($value)) {
|
||||
$out .= "<!-- param key=".$key." is array, we do not output input filed for it -->\n";
|
||||
} else {
|
||||
@ -457,17 +458,14 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
$modelmail_array = array();
|
||||
if ($this->param['models'] != 'none')
|
||||
{
|
||||
if ($this->param['models'] != 'none') {
|
||||
$result = $this->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs);
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
if ($result < 0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
}
|
||||
$langs->trans("members");
|
||||
foreach ($this->lines_model as $line)
|
||||
{
|
||||
foreach ($this->lines_model as $line) {
|
||||
$reg = array();
|
||||
if (preg_match('/\((.*)\)/', $line->label, $reg)) {
|
||||
$labeltouse = $langs->trans($reg[1]); // langs->trans when label is __(xxx)__
|
||||
@ -483,8 +481,7 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// Zone to select email template
|
||||
if (count($modelmail_array) > 0)
|
||||
{
|
||||
if (count($modelmail_array) > 0) {
|
||||
// If list of template is filled
|
||||
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
$out .= '<span class="opacitymedium">'.$langs->trans('SelectMailModel').':</span> ';
|
||||
@ -498,8 +495,7 @@ class FormMail extends Form
|
||||
'propal_send', 'order_send', 'facture_send',
|
||||
'shipping_send', 'fichinter_send', 'supplier_proposal_send', 'order_supplier_send',
|
||||
'invoice_supplier_send', 'thirdparty', 'contract', 'user', 'recruitmentcandidature_send', 'all'
|
||||
)))
|
||||
{
|
||||
))) {
|
||||
// If list of template is empty
|
||||
$out .= '<div class="center" style="padding: 0px 0 12px 0">'."\n";
|
||||
$out .= $langs->trans('SelectMailModel').': <select name="modelmailselected" disabled="disabled"><option value="none">'.$langs->trans("NoTemplateDefined").'</option></select>'; // Do not put 'disabled' on 'option' tag, it is already on 'select' and it makes chrome crazy.
|
||||
@ -518,12 +514,10 @@ class FormMail extends Form
|
||||
// Substitution array/string
|
||||
$helpforsubstitution = '';
|
||||
if (is_array($this->substit) && count($this->substit)) $helpforsubstitution .= $langs->trans('AvailableVariables').' :<br>'."\n";
|
||||
foreach ($this->substit as $key => $val)
|
||||
{
|
||||
foreach ($this->substit as $key => $val) {
|
||||
$helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'<br>';
|
||||
}
|
||||
if (!empty($this->withsubstit)) // Unset or set ->withsubstit=0 to disable this.
|
||||
{
|
||||
if (!empty($this->withsubstit)) { // Unset or set ->withsubstit=0 to disable this.
|
||||
$out .= '<tr><td colspan="2" class="right">';
|
||||
//$out.='<div class="floatright">';
|
||||
if (is_numeric($this->withsubstit)) $out .= $form->textwithpicto($langs->trans("EMailTestSubstitutionReplacedByGenericValues"), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltip'); // Old usage
|
||||
@ -538,10 +532,8 @@ class FormMail extends Form
|
||||
var_dump($this->fromname);*/
|
||||
|
||||
// From
|
||||
if (!empty($this->withfrom))
|
||||
{
|
||||
if (!empty($this->withfromreadonly))
|
||||
{
|
||||
if (!empty($this->withfrom)) {
|
||||
if (!empty($this->withfromreadonly)) {
|
||||
$out .= '<tr><td class="fieldrequired minwidth200">'.$langs->trans("MailFrom").'</td><td>';
|
||||
|
||||
// $this->fromtype is the default value to use to select sender
|
||||
@ -551,16 +543,13 @@ class FormMail extends Form
|
||||
&& !preg_match('/user_aliases/', $this->fromtype)
|
||||
&& !preg_match('/global_aliases/', $this->fromtype)
|
||||
&& !preg_match('/senderprofile/', $this->fromtype)
|
||||
)
|
||||
{
|
||||
) {
|
||||
// Use this->fromname and this->frommail or error if not defined
|
||||
$out .= $this->fromname;
|
||||
if ($this->frommail)
|
||||
{
|
||||
if ($this->frommail) {
|
||||
$out .= ' <'.$this->frommail.'>';
|
||||
} else {
|
||||
if ($this->fromtype)
|
||||
{
|
||||
if ($this->fromtype) {
|
||||
$langs->load('errors');
|
||||
$out .= '<span class="warning"> <'.$langs->trans('ErrorNoMailDefinedForThisUser').'> </span>';
|
||||
}
|
||||
@ -569,8 +558,7 @@ class FormMail extends Form
|
||||
$liste = array();
|
||||
|
||||
// Add user email
|
||||
if (empty($user->email))
|
||||
{
|
||||
if (empty($user->email)) {
|
||||
$langs->load('errors');
|
||||
$liste['user'] = $user->getFullName($langs).' <'.$langs->trans('ErrorNoMailDefinedForThisUser').'>';
|
||||
} else {
|
||||
@ -584,13 +572,10 @@ class FormMail extends Form
|
||||
$listaliases = array('user_aliases'=>$user->email_aliases, 'global_aliases'=>$conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
|
||||
|
||||
// Also add robot email
|
||||
if (!empty($this->fromalsorobot))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM != $conf->global->MAIN_INFO_SOCIETE_MAIL)
|
||||
{
|
||||
if (!empty($this->fromalsorobot)) {
|
||||
if (!empty($conf->global->MAIN_MAIL_EMAIL_FROM) && $conf->global->MAIN_MAIL_EMAIL_FROM != $conf->global->MAIN_INFO_SOCIETE_MAIL) {
|
||||
$liste['robot'] = $conf->global->MAIN_MAIL_EMAIL_FROM;
|
||||
if ($this->frommail)
|
||||
{
|
||||
if ($this->frommail) {
|
||||
$liste['robot'] .= ' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
|
||||
}
|
||||
}
|
||||
@ -601,31 +586,27 @@ class FormMail extends Form
|
||||
$sql .= ' WHERE active = 1 AND (private = 0 OR private = '.$user->id.')';
|
||||
$sql .= ' ORDER BY position';
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj)
|
||||
{
|
||||
if ($obj) {
|
||||
$listaliases['senderprofile_'.$obj->rowid] = $obj->label.' <'.$obj->email.'>';
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
} else dol_print_error($this->db);
|
||||
} else {
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
foreach ($listaliases as $typealias => $listalias)
|
||||
{
|
||||
foreach ($listaliases as $typealias => $listalias) {
|
||||
$posalias = 0;
|
||||
$listaliasarray = explode(',', $listalias);
|
||||
foreach ($listaliasarray as $listaliasval)
|
||||
{
|
||||
foreach ($listaliasarray as $listaliasval) {
|
||||
$posalias++;
|
||||
$listaliasval = trim($listaliasval);
|
||||
if ($listaliasval)
|
||||
{
|
||||
if ($listaliasval) {
|
||||
$listaliasval = preg_replace('/</', '<', $listaliasval);
|
||||
$listaliasval = preg_replace('/>/', '>', $listaliasval);
|
||||
if (!preg_match('/</', $listaliasval)) $listaliasval = '<'.$listaliasval.'>';
|
||||
@ -637,8 +618,7 @@ class FormMail extends Form
|
||||
// Set the default "From"
|
||||
$defaultfrom = '';
|
||||
$reshook = $hookmanager->executeHooks('getDefaultFromEmail', $parameters, $this);
|
||||
if (empty($reshook))
|
||||
{
|
||||
if (empty($reshook)) {
|
||||
$defaultfrom = $this->fromtype;
|
||||
}
|
||||
if (!empty($hookmanager->resArray['defaultfrom'])) $defaultfrom = $hookmanager->resArray['defaultfrom'];
|
||||
@ -665,19 +645,15 @@ class FormMail extends Form
|
||||
if ($this->withtofree) $out .= $form->textwithpicto($langs->trans("MailTo"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||
else $out .= $langs->trans("MailTo");
|
||||
$out .= '</td><td>';
|
||||
if ($this->withtoreadonly)
|
||||
{
|
||||
if (!empty($this->toname) && !empty($this->tomail))
|
||||
{
|
||||
if ($this->withtoreadonly) {
|
||||
if (!empty($this->toname) && !empty($this->tomail)) {
|
||||
$out .= '<input type="hidden" id="toname" name="toname" value="'.$this->toname.'" />';
|
||||
$out .= '<input type="hidden" id="tomail" name="tomail" value="'.$this->tomail.'" />';
|
||||
if ($this->totype == 'thirdparty')
|
||||
{
|
||||
if ($this->totype == 'thirdparty') {
|
||||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->toid);
|
||||
$out .= $soc->getNomUrl(1);
|
||||
} elseif ($this->totype == 'contact')
|
||||
{
|
||||
} elseif ($this->totype == 'contact') {
|
||||
$contact = new Contact($this->db);
|
||||
$contact->fetch($this->toid);
|
||||
$out .= $contact->getNomUrl(1);
|
||||
@ -685,8 +661,7 @@ class FormMail extends Form
|
||||
$out .= $this->toname;
|
||||
}
|
||||
$out .= ' <'.$this->tomail.'>';
|
||||
if ($this->withtofree)
|
||||
{
|
||||
if ($this->withtofree) {
|
||||
$out .= '<br>'.$langs->trans("and").' <input class="minwidth200" id="sendto" name="sendto" value="'.(!is_array($this->withto) && !is_numeric($this->withto) ? (GETPOSTISSET("sendto") ? GETPOST("sendto") : $this->withto) : "").'" />';
|
||||
}
|
||||
} else {
|
||||
@ -695,25 +670,21 @@ class FormMail extends Form
|
||||
}
|
||||
} else {
|
||||
// The free input of email
|
||||
if (!empty($this->withtofree))
|
||||
{
|
||||
if (!empty($this->withtofree)) {
|
||||
$out .= '<input class="minwidth200" id="sendto" name="sendto" value="'.(($this->withtofree && !is_numeric($this->withtofree)) ? $this->withtofree : (!is_array($this->withto) && !is_numeric($this->withto) ? (GETPOSTISSET("sendto") ? GETPOST("sendto") : $this->withto) : "")).'" />';
|
||||
}
|
||||
// The select combo
|
||||
if (!empty($this->withto) && is_array($this->withto))
|
||||
{
|
||||
if (!empty($this->withto) && is_array($this->withto)) {
|
||||
if (!empty($this->withtofree)) $out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withto;
|
||||
foreach ($tmparray as $key => $val)
|
||||
{
|
||||
foreach ($tmparray as $key => $val) {
|
||||
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
|
||||
$withtoselected = GETPOST("receiver", 'array'); // Array of selected value
|
||||
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
|
||||
{
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
|
||||
$withtoselected = array_keys($tmparray);
|
||||
}
|
||||
$out .= $form->multiselectarray("receiver", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
|
||||
@ -723,21 +694,18 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// To User
|
||||
if (!empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
|
||||
{
|
||||
if (!empty($this->withtouser) && is_array($this->withtouser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
|
||||
$out .= '<tr><td>';
|
||||
$out .= $langs->trans("MailToUsers");
|
||||
$out .= '</td><td>';
|
||||
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withtouser;
|
||||
foreach ($tmparray as $key => $val)
|
||||
{
|
||||
foreach ($tmparray as $key => $val) {
|
||||
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$withtoselected = GETPOST("receiveruser", 'array'); // Array of selected value
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
|
||||
{
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
|
||||
$withtoselected = array_keys($tmparray);
|
||||
}
|
||||
$out .= $form->multiselectarray("receiveruser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
|
||||
@ -745,8 +713,7 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// With option one email per recipient
|
||||
if (!empty($this->withoptiononeemailperrecipient))
|
||||
{
|
||||
if (!empty($this->withoptiononeemailperrecipient)) {
|
||||
$out .= '<tr><td class="minwidth200">';
|
||||
$out .= $langs->trans("GroupEmails");
|
||||
$out .= '</td><td>';
|
||||
@ -760,23 +727,19 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// CC
|
||||
if (!empty($this->withtocc) || is_array($this->withtocc))
|
||||
{
|
||||
if (!empty($this->withtocc) || is_array($this->withtocc)) {
|
||||
$out .= '<tr><td>';
|
||||
$out .= $form->textwithpicto($langs->trans("MailCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients"));
|
||||
$out .= '</td><td>';
|
||||
if ($this->withtoccreadonly)
|
||||
{
|
||||
if ($this->withtoccreadonly) {
|
||||
$out .= (!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : "";
|
||||
} else {
|
||||
$out .= '<input class="minwidth200" id="sendtocc" name="sendtocc" value="'.(GETPOST("sendtocc", "alpha") ? GETPOST("sendtocc", "alpha") : ((!is_array($this->withtocc) && !is_numeric($this->withtocc)) ? $this->withtocc : '')).'" />';
|
||||
if (!empty($this->withtocc) && is_array($this->withtocc))
|
||||
{
|
||||
if (!empty($this->withtocc) && is_array($this->withtocc)) {
|
||||
$out .= " ".$langs->trans("and")."/".$langs->trans("or")." ";
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withtocc;
|
||||
foreach ($tmparray as $key => $val)
|
||||
{
|
||||
foreach ($tmparray as $key => $val) {
|
||||
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value
|
||||
@ -787,21 +750,18 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// To User cc
|
||||
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
|
||||
{
|
||||
if (!empty($this->withtoccuser) && is_array($this->withtoccuser) && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
|
||||
$out .= '<tr><td>';
|
||||
$out .= $langs->trans("MailToCCUsers");
|
||||
$out .= '</td><td>';
|
||||
|
||||
// multiselect array convert html entities into options tags, even if we dont want this, so we encode them a second time
|
||||
$tmparray = $this->withtoccuser;
|
||||
foreach ($tmparray as $key => $val)
|
||||
{
|
||||
foreach ($tmparray as $key => $val) {
|
||||
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true);
|
||||
}
|
||||
$withtoselected = GETPOST("receiverccuser", 'array'); // Array of selected value
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend')
|
||||
{
|
||||
if (empty($withtoselected) && count($tmparray) == 1 && GETPOST('action', 'aZ09') == 'presend') {
|
||||
$withtoselected = array_keys($tmparray);
|
||||
}
|
||||
$out .= $form->multiselectarray("receiverccuser", $tmparray, $withtoselected, null, null, 'inline-block minwidth500', null, "");
|
||||
@ -814,10 +774,8 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// Replyto
|
||||
if (!empty($this->withreplyto))
|
||||
{
|
||||
if ($this->withreplytoreadonly)
|
||||
{
|
||||
if (!empty($this->withreplyto)) {
|
||||
if ($this->withreplytoreadonly) {
|
||||
$out .= '<input type="hidden" id="replyname" name="replyname" value="'.$this->replytoname.'" />';
|
||||
$out .= '<input type="hidden" id="replymail" name="replymail" value="'.$this->replytomail.'" />';
|
||||
$out .= "<tr><td>".$langs->trans("MailReply")."</td><td>".$this->replytoname.($this->replytomail ? (" <".$this->replytomail.">") : "");
|
||||
@ -841,41 +799,32 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// Attached files
|
||||
if (!empty($this->withfile))
|
||||
{
|
||||
if (!empty($this->withfile)) {
|
||||
$out .= '<tr>';
|
||||
$out .= '<td>'.$langs->trans("MailFile").'</td>';
|
||||
|
||||
$out .= '<td>';
|
||||
|
||||
if ($this->withmaindocfile) // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
|
||||
{
|
||||
if (GETPOSTISSET('sendmail'))
|
||||
{
|
||||
if ($this->withmaindocfile) { // withmaindocfile is set to 1 or -1 to show the checkbox (-1 = checked or 1 = not checked)
|
||||
if (GETPOSTISSET('sendmail')) {
|
||||
$this->withmaindocfile = (GETPOST('addmaindocfile', 'alpha') ? -1 : 1);
|
||||
}
|
||||
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
|
||||
elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0)
|
||||
{
|
||||
} elseif (is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
|
||||
// If a template was selected, we use setup of template to define if join file checkbox is selected or not.
|
||||
$this->withmaindocfile = ($arraydefaultmessage->joinfiles ? -1 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($this->withmaindocfile))
|
||||
{
|
||||
if ($this->withmaindocfile == 1)
|
||||
{
|
||||
if (!empty($this->withmaindocfile)) {
|
||||
if ($this->withmaindocfile == 1) {
|
||||
$out .= '<input type="checkbox" name="addmaindocfile" value="1" />';
|
||||
}
|
||||
if ($this->withmaindocfile == -1)
|
||||
{
|
||||
if ($this->withmaindocfile == -1) {
|
||||
$out .= '<input type="checkbox" name="addmaindocfile" value="1" checked="checked" />';
|
||||
}
|
||||
$out .= ' '.$langs->trans("JoinMainDoc").'.<br>';
|
||||
}
|
||||
|
||||
if (is_numeric($this->withfile))
|
||||
{
|
||||
if (is_numeric($this->withfile)) {
|
||||
// TODO Trick to have param removedfile containing nb of file to delete. But this does not works without javascript
|
||||
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
|
||||
$out .= '<script type="text/javascript" language="javascript">';
|
||||
@ -885,28 +834,23 @@ class FormMail extends Form
|
||||
$out .= ' });';
|
||||
$out .= '})';
|
||||
$out .= '</script>'."\n";
|
||||
if (count($listofpaths))
|
||||
{
|
||||
foreach ($listofpaths as $key => $val)
|
||||
{
|
||||
if (count($listofpaths)) {
|
||||
foreach ($listofpaths as $key => $val) {
|
||||
$out .= '<div id="attachfile_'.$key.'">';
|
||||
// Preview of attachment
|
||||
preg_match('#^(/)(\w+)(/)(.+)$#', substr($val, (strlen(DOL_DATA_ROOT) - strlen($val))), $formfile_params);
|
||||
$out .= img_mime($listofnames[$key]).' '.$listofnames[$key];
|
||||
$out .= $formfile->showPreview(array(), $formfile_params[2], $formfile_params[4]);
|
||||
if (!$this->withfilereadonly)
|
||||
{
|
||||
if (!$this->withfilereadonly) {
|
||||
$out .= ' <input type="image" style="border: 0px;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/delete.png" value="'.($key + 1).'" class="removedfile" id="removedfile_'.$key.'" name="removedfile_'.$key.'" />';
|
||||
//$out.= ' <a href="'.$_SERVER["PHP_SELF"].'?removedfile='.($key+1).' id="removedfile_'.$key.'">'.img_delete($langs->trans("Delete").'</a>';
|
||||
}
|
||||
$out .= '<br></div>';
|
||||
}
|
||||
} elseif (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox
|
||||
{
|
||||
} elseif (empty($this->withmaindocfile)) { // Do not show message if we asked to show the checkbox
|
||||
$out .= $langs->trans("NoAttachedFiles").'<br>';
|
||||
}
|
||||
if ($this->withfile == 2) // Can add other files
|
||||
{
|
||||
if ($this->withfile == 2) { // Can add other files
|
||||
if (!empty($conf->global->FROM_MAIL_USE_INPUT_FILE_MULTIPLE)) $out .= '<input type="file" class="flat" id="addedfile" name="addedfile[]" value="'.$langs->trans("Upload").'" multiple />';
|
||||
else $out .= '<input type="file" class="flat" id="addedfile" name="addedfile" value="'.$langs->trans("Upload").'" />';
|
||||
$out .= ' ';
|
||||
@ -920,11 +864,9 @@ class FormMail extends Form
|
||||
}
|
||||
|
||||
// Message
|
||||
if (!empty($this->withbody))
|
||||
{
|
||||
if (!empty($this->withbody)) {
|
||||
$defaultmessage = GETPOST('message', 'restricthtml');
|
||||
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1')
|
||||
{
|
||||
if (!GETPOST('modelselected', 'alpha') || GETPOST('modelmailselected') != '-1') {
|
||||
if ($arraydefaultmessage && $arraydefaultmessage->content) {
|
||||
$defaultmessage = $arraydefaultmessage->content;
|
||||
} elseif (!is_numeric($this->withbody)) {
|
||||
@ -934,25 +876,29 @@ class FormMail extends Form
|
||||
|
||||
// Complete substitution array with the url to make online payment
|
||||
$paymenturl = ''; $validpaymentmethod = array();
|
||||
if (empty($this->substit['__REF__']))
|
||||
{
|
||||
if (empty($this->substit['__REF__'])) {
|
||||
$paymenturl = '';
|
||||
} else {
|
||||
// Set the online payment url link into __ONLINE_PAYMENT_URL__ key
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
||||
$langs->loadLangs(array('paypal', 'other'));
|
||||
$typeforonlinepayment = 'free';
|
||||
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') $typeforonlinepayment = 'order'; // TODO use detection on something else than template
|
||||
if ($this->param["models"] == 'invoice' || $this->param["models"] == 'facture_send') $typeforonlinepayment = 'invoice'; // TODO use detection on something else than template
|
||||
if ($this->param["models"] == 'member') $typeforonlinepayment = 'member'; // TODO use detection on something else than template
|
||||
if ($this->param["models"] == 'order' || $this->param["models"] == 'order_send') {
|
||||
$typeforonlinepayment = 'order'; // TODO use detection on something else than template
|
||||
}
|
||||
if ($this->param["models"] == 'invoice' || $this->param["models"] == 'facture_send') {
|
||||
$typeforonlinepayment = 'invoice'; // TODO use detection on something else than template
|
||||
}
|
||||
if ($this->param["models"] == 'member') {
|
||||
$typeforonlinepayment = 'member'; // TODO use detection on something else than template
|
||||
}
|
||||
$url = getOnlinePaymentUrl(0, $typeforonlinepayment, $this->substit['__REF__']);
|
||||
$paymenturl = $url;
|
||||
|
||||
$validpaymentmethod = getValidOnlinePaymentMethods('');
|
||||
}
|
||||
|
||||
if (count($validpaymentmethod) > 0 && $paymenturl)
|
||||
{
|
||||
if (count($validpaymentmethod) > 0 && $paymenturl) {
|
||||
$langs->load('other');
|
||||
$this->substit['__ONLINE_PAYMENT_TEXT_AND_URL__'] = str_replace('\n', "\n", $langs->transnoentities("PredefinedMailContentLink", $paymenturl));
|
||||
$this->substit['__ONLINE_PAYMENT_URL__'] = $paymenturl;
|
||||
@ -966,10 +912,8 @@ class FormMail extends Form
|
||||
// Add lines substitution key from each line
|
||||
$lines = '';
|
||||
$defaultlines = $arraydefaultmessage->content_lines;
|
||||
if (isset($defaultlines))
|
||||
{
|
||||
foreach ($this->substit_lines as $substit_line)
|
||||
{
|
||||
if (isset($defaultlines)) {
|
||||
foreach ($this->substit_lines as $substit_line) {
|
||||
$lines .= make_substitutions($defaultlines, $substit_line)."\n";
|
||||
}
|
||||
}
|
||||
@ -1003,8 +947,9 @@ class FormMail extends Form
|
||||
}
|
||||
}
|
||||
|
||||
if (GETPOSTISSET("message") && !$_POST['modelselected']) $defaultmessage = $_POST["message"];
|
||||
else {
|
||||
if (GETPOSTISSET("message") && !$_POST['modelselected']) {
|
||||
$defaultmessage = $_POST["message"];
|
||||
} else {
|
||||
$defaultmessage = make_substitutions($defaultmessage, $this->substit);
|
||||
// Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty)
|
||||
$defaultmessage = preg_replace("/^(<br>)+/", "", $defaultmessage);
|
||||
@ -1016,17 +961,17 @@ class FormMail extends Form
|
||||
$out .= $form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody');
|
||||
$out .= '</td>';
|
||||
$out .= '<td>';
|
||||
if ($this->withbodyreadonly)
|
||||
{
|
||||
if ($this->withbodyreadonly) {
|
||||
$out .= nl2br($defaultmessage);
|
||||
$out .= '<input type="hidden" id="message" name="message" value="'.$defaultmessage.'" />';
|
||||
} else {
|
||||
if (!isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
|
||||
if (!isset($this->ckeditortoolbar)) {
|
||||
$this->ckeditortoolbar = 'dolibarr_notes';
|
||||
}
|
||||
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
if ($this->withfckeditor == -1)
|
||||
{
|
||||
if ($this->withfckeditor == -1) {
|
||||
if (!empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $this->withfckeditor = 1;
|
||||
else $this->withfckeditor = 0;
|
||||
}
|
||||
@ -1039,29 +984,27 @@ class FormMail extends Form
|
||||
|
||||
$out .= '</table>'."\n";
|
||||
|
||||
if ($this->withform == 1 || $this->withform == -1)
|
||||
{
|
||||
if ($this->withform == 1 || $this->withform == -1) {
|
||||
$out .= '<br><div class="center">';
|
||||
$out .= '<input class="button" type="submit" id="sendmail" name="sendmail" value="'.$langs->trans("SendMail").'"';
|
||||
// Add a javascript test to avoid to forget to submit file before sending email
|
||||
if ($this->withfile == 2 && $conf->use_javascript_ajax)
|
||||
{
|
||||
if ($this->withfile == 2 && $conf->use_javascript_ajax) {
|
||||
$out .= ' onClick="if (document.mailform.addedfile.value != \'\') { alert(\''.dol_escape_js($langs->trans("FileWasNotUploaded")).'\'); return false; } else { return true; }"';
|
||||
}
|
||||
$out .= ' />';
|
||||
if ($this->withcancel)
|
||||
{
|
||||
if ($this->withcancel) {
|
||||
$out .= ' ';
|
||||
$out .= '<input class="button button-cancel" type="submit" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'" />';
|
||||
}
|
||||
$out .= '</div>'."\n";
|
||||
}
|
||||
|
||||
if ($this->withform == 1) $out .= '</form>'."\n";
|
||||
if ($this->withform == 1) {
|
||||
$out .= '</form>'."\n";
|
||||
}
|
||||
|
||||
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
|
||||
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
|
||||
$out .= '<script type="text/javascript" language="javascript">';
|
||||
$out .= 'jQuery(document).ready(function () {';
|
||||
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
|
||||
|
||||
@ -4615,7 +4615,7 @@ function print_fleche_navigation($page, $file, $options = '', $nextpage = 0, $be
|
||||
}
|
||||
if ((int) $limit > 0 && empty($hideselectlimit))
|
||||
{
|
||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000';
|
||||
$pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000,25000:25000';
|
||||
//$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported
|
||||
//$pagesizechoices.=',2:2';
|
||||
if (!empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
|
||||
|
||||
@ -81,7 +81,7 @@ function shipping_prepare_head($object)
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
|
||||
$upload_dir = $conf->commande->dir_output."/".dol_sanitizeFileName($object->ref);
|
||||
$upload_dir = $conf->expedition->dir_output."/sending/".dol_sanitizeFileName($object->ref);
|
||||
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
|
||||
$nbLinks = Link::count($db, $object->element, $object->id);
|
||||
$head[$h][0] = DOL_URL_ROOT.'/expedition/document.php?id='.$object->id;
|
||||
|
||||
@ -62,7 +62,11 @@ if ($absolute_discount > 0) {
|
||||
$text .= ' ('.$addabsolutediscount.')';
|
||||
}
|
||||
|
||||
print '<div class="inline-block clearboth">'.$text.'</div>';
|
||||
if ($isNewObject) {
|
||||
print '<br>'.$text;
|
||||
} else {
|
||||
print '<div class="inline-block clearboth">'.$text.'</div>';
|
||||
}
|
||||
} else {
|
||||
// Discount available of type fixed amount (not credit note)
|
||||
$more = '('.$addabsolutediscount.')';
|
||||
@ -85,7 +89,11 @@ if ($absolute_creditnote > 0) {
|
||||
$text .= '('.$addabsolutediscount.')';
|
||||
}
|
||||
|
||||
print '<div class="inline-block clearboth">'.$text.'</div>';
|
||||
if ($isNewObject) {
|
||||
print '<br>'.$text;
|
||||
} else {
|
||||
print '<div class="inline-block clearboth">'.$text.'</div>';
|
||||
}
|
||||
} else { // We can add a credit note on a down payment or standard invoice or situation invoice
|
||||
// There is credit notes discounts available
|
||||
$more = $isInvoice && !$isNewObject ? ' ('.$viewabsolutediscount.')' : '';
|
||||
|
||||
@ -80,7 +80,9 @@ if ($action == 'addcontact' && $user->rights->expedition->creer)
|
||||
{
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
|
||||
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
|
||||
@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills'));
|
||||
$langs->loadLangs(array("sendings", "deliveries", 'companies', 'bills', 'products'));
|
||||
|
||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
|
||||
|
||||
@ -340,7 +340,7 @@ if ($resql)
|
||||
|
||||
if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category);
|
||||
if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus);
|
||||
if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status);
|
||||
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers'));
|
||||
$langs->loadLangs(array("orders", "sendings", 'deliveries', 'companies', 'compta', 'bills', 'projects', 'suppliers', 'products'));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$massaction = GETPOST('massaction', 'alpha');
|
||||
|
||||
@ -475,7 +475,7 @@ class PaymentLoan extends CommonObject
|
||||
// Insert payment into llx_bank
|
||||
$bank_line_id = $acc->addline(
|
||||
$this->datep,
|
||||
$this->fk_typepayment, // Payment mode ID or code ("CHQ or VIR for example")
|
||||
$this->paymenttype, // Payment mode ID or code ("CHQ or VIR for example")
|
||||
$label,
|
||||
$total,
|
||||
$this->num_payment,
|
||||
|
||||
@ -152,7 +152,7 @@ if ($action == 'add_payment')
|
||||
|
||||
// Create a line of payments
|
||||
$payment = new PaymentLoan($db);
|
||||
$payment->chid = $chid;
|
||||
$payment->chid = $chid;
|
||||
$payment->datep = $datepaid;
|
||||
$payment->label = $loan->label;
|
||||
$payment->amount_capital = $pay_amount_capital;
|
||||
@ -176,7 +176,7 @@ if ($action == 'add_payment')
|
||||
|
||||
if (!$error)
|
||||
{
|
||||
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', GETPOST('accountid', 'int'), '', '');
|
||||
$result = $payment->addPaymentToBank($user, $chid, 'payment_loan', '(LoanPayment)', $payment->fk_bank, '', '');
|
||||
if (!$result > 0)
|
||||
{
|
||||
setEventMessages($payment->error, $payment->errors, 'errors');
|
||||
|
||||
@ -67,11 +67,6 @@ if ($id > 0 || !empty($ref))
|
||||
$objectsrc = new CommandeFournisseur($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
}
|
||||
if ($typeobject == 'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
|
||||
{
|
||||
$objectsrc = new Propal($db);
|
||||
$objectsrc->fetch($object->$typeobject->id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +78,9 @@ if ($action == 'addcontact' && $user->rights->reception->creer)
|
||||
{
|
||||
if ($result > 0 && $id > 0)
|
||||
{
|
||||
$result = $objectsrc->add_contact(GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'), $_POST["type"], $_POST["source"]);
|
||||
$contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
|
||||
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
|
||||
$result = $objectsrc->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
|
||||
}
|
||||
|
||||
if ($result >= 0)
|
||||
|
||||
@ -505,7 +505,7 @@ if ($resql)
|
||||
if ($search_town) $param .= "&search_town=".urlencode($search_town);
|
||||
if ($search_zip) $param .= "&search_zip=".urlencode($search_zip);
|
||||
if ($search_state) $param .= "&search_state=".urlencode($search_state);
|
||||
if ($search_status) $param .= "&search_status=".urlencode($search_status);
|
||||
if ($search_status != '') $param .= "&search_status=".urlencode($search_status);
|
||||
if ($search_country) $param .= "&search_country=".urlencode($search_country);
|
||||
if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty);
|
||||
if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
|
||||
|
||||
@ -25,7 +25,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?>
|
||||
.info-box.info-box-sm {
|
||||
min-height: 80px;
|
||||
margin-bottom: 10px;
|
||||
/* background: #fff; */
|
||||
/* background: #fff; */
|
||||
}
|
||||
.opened-dash-board-wrap .info-box.info-box-sm {
|
||||
border-radius: 0 0 0 20px;
|
||||
|
||||
@ -345,7 +345,7 @@ if ($catid > 0) $sql .= " AND cu.fk_categorie = ".((int) $catid);
|
||||
if ($catid == -2) $sql .= " AND cu.fk_categorie IS NULL";
|
||||
if ($search_categ > 0) $sql .= " AND cu.fk_categorie = ".$db->escape($search_categ);
|
||||
if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL";
|
||||
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
|
||||
if ($mode == 'employee' && empty($user->rights->salaries->readall)) $sql .= " AND u.fk_user IN (".join(',', $childids).")";
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
|
||||
@ -153,7 +153,7 @@ if ($resql) {
|
||||
if ($targettype == 'contacts') {
|
||||
$oldcid = $obj->cid;
|
||||
}
|
||||
$oldlang = $obj->lang;
|
||||
$oldlang = $obj->default_lang;
|
||||
$oldtarget = (empty($obj->cfirstname) && empty($obj->clastname)) ? $obj->name : ($obj->clastname." ".$obj->cfirstname);
|
||||
$message = '';
|
||||
$total = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user