Merge branch '11.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2020-01-27 01:53:49 +01:00
commit df478dc170
17 changed files with 143 additions and 79 deletions

View File

@ -47,7 +47,7 @@ class BOM extends CommonObject
public $ismultientitymanaged = 1;
/**
* @var int Does bom support extrafields ? 0=No, 1=Yes
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;

View File

@ -1047,7 +1047,7 @@ if ($object->id > 0)
$sql .= " AND f.entity = ".$conf->entity;
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
$sql .= ' f.suspended,';
$sql .= ' f.suspended, f.date_when,';
$sql .= ' s.nom, s.rowid';
$sql .= " ORDER BY f.date_last_gen, f.datec DESC";

View File

@ -63,7 +63,7 @@ $object = new BonPrelevement($db, "");
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard'));
$hookmanager->initHooks(array('directdebitprevcard', 'globalcard', 'directdebitprevlist'));
/*
* Actions
@ -362,10 +362,19 @@ if ($id > 0 || $ref)
$urladd = "&id=".$id;
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
print '<form method="get" action="' . $_SERVER ['PHP_SELF'] . '" name="search_form">' . "\n";
print '<input type="hidden" name="id" value="' . $id . '"/>';
print '<input type="hidden" name="socid" value="' . $socid . '"/>';
if (! empty($page)) {
print '<input type="hidden" name="page" value="' . $page . '"/>';
}
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("Lines"), $page, $_SERVER["PHP_SELF"], $urladd, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit);
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
print '<table class="noborder liste" width="100%" cellspacing="0" cellpadding="4">';
print '<tr class="liste_titre">';
print_liste_field_titre("Lines", $_SERVER["PHP_SELF"], "pl.rowid", '', $urladd);
print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "s.nom", '', $urladd);
@ -375,7 +384,7 @@ if ($id > 0 || $ref)
$total = 0;
while ($i < min($num, $conf->liste_limit))
while ($i < min($num, $limit))
{
$obj = $db->fetch_object($result);
@ -433,6 +442,7 @@ if ($id > 0 || $ref)
print "</table>";
print '</div>';
print '</form>';
$db->free($result);
}

View File

@ -196,6 +196,7 @@ else
print "</form>\n";
print "</div>\n";
print '</form>';
print '<br>';
@ -224,6 +225,11 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
{
$page = 0;
$offset = 0;
}
}
$sql.= $db->plimit($limit+1, $offset);
@ -239,11 +245,12 @@ if ($resql)
if($socid) $param .= '&socid='.urlencode($socid);
if($option) $param .= "&option=".urlencode($option);
if(! empty($page) && $num <= $nbtotalofrecords) $page = 0;
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="page" value="'.$page.'">';
if (! empty($limit)) {
print '<input type="hidden" name="limit" value="' . $limit . '"/>';
}
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);

View File

@ -43,6 +43,9 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjec
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$search_facture = GETPOST('search_facture', 'alpha');
$search_societe = trim(GETPOST('search_societe', 'alpha'));
// Load variable for pagination
$limit = GETPOST('limit', 'int')?GETPOST('limit', 'int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
@ -57,6 +60,26 @@ if (! $sortfield) $sortfield="f.ref";
$massactionbutton = '';
$hookmanager->initHooks(array('withdrawalstodolist'));
/*
* Actions
*/
$parameters = array('socid' => $socid, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
// Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers
{
$search_facture = '';
$search_societe = '';
$search_array_options = array();
}
/*
* View
@ -98,10 +121,8 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS))
$sql.= " AND f.fk_statut = ".Facture::STATUS_VALIDATED;
}
$sql.= " AND pfd.fk_facture = f.rowid";
if (dol_strlen(trim(GETPOST('search_societe', 'alpha'))))
{
$sql.= natural_search("s.nom", 'search_societe');
}
if ($search_facture) $sql.= natural_search("f.ref", $search_facture);
if ($search_societe) $sql.= natural_search("s.nom", $search_societe);
$sql.=$db->order($sortfield, $sortorder);
@ -140,9 +161,7 @@ else
$newcardbutton = '<a href="'.DOL_URL_ROOT.'/compta/prelevement/index.php">'.$langs->trans("Back").'</a>';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" id="searchFormList" name="searchFormList">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
@ -152,6 +171,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit);
print '<table class="liste centpercent">';
@ -164,13 +184,13 @@ print_liste_field_titre('');
print '</tr>';
print '<tr class="liste_titre">';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag(GETPOST('search_facture', 'alpha')).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag(GETPOST('search_societe', 'alpha')).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_facture" size="12" value="'.dol_escape_htmltag($search_facture).'"></td>';
print '<td class="liste_titre"><input type="text" class="flat" name="search_societe" size="18" value="'.dol_escape_htmltag($search_societe).'"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
// Action column
print '<td class="liste_titre" class="middle">';
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
print '<td class="liste_titre maxwidthsearch">';
$searchpicto = $form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';

View File

@ -49,7 +49,7 @@ $confirm = GETPOST('confirm', 'alpha');
// Security check
if ($user->socid) $socid=$user->socid;
$result = restrictedArea($user, 'tax', $id, 'vat', 'charges');
$result = restrictedArea($user, 'tax', '', 'vat', 'charges');
// Get parameters

View File

@ -248,9 +248,17 @@ if ($search_contract) $sql.= " AND c.ref LIKE '%".$db->escape($search_contract).
if ($search_service) $sql.= " AND (p.ref LIKE '%".$db->escape($search_service)."%' OR p.description LIKE '%".$db->escape($search_service)."%' OR cd.description LIKE '%".$db->escape($search_service)."%')";
if ($socid > 0) $sql.= " AND s.rowid = ".$socid;
$filter_dateouvertureprevue=dol_mktime(0, 0, 0, $opouvertureprevuemonth, $opouvertureprevueday, $opouvertureprevueyear);
if ($filter_dateouvertureprevue != '' && $filter_opouvertureprevue == -1) $filter_opouvertureprevue = '=';
$filter_date1=dol_mktime(0, 0, 0, $op1month, $op1day, $op1year);
if ($filter_date1 != '' && $filter_op1 == -1) $filter_op1 = '=';
$filter_date2=dol_mktime(0, 0, 0, $op2month, $op2day, $op2year);
if ($filter_date2 != '' && $filter_op2 == -1) $filter_op2 = '=';
$filter_datecloture=dol_mktime(0, 0, 0, $opcloturemonth, $opclotureday, $opclotureyear);
if ($filter_datecloture != '' && $filter_opcloture == -1) $filter_opcloture = '=';
if (! empty($filter_opouvertureprevue) && $filter_opouvertureprevue != -1 && $filter_dateouvertureprevue != '') $sql.= " AND cd.date_ouverture_prevue ".$filter_opouvertureprevue." '".$db->idate($filter_dateouvertureprevue)."'";
if (! empty($filter_op1) && $filter_op1 != -1 && $filter_date1 != '') $sql.= " AND cd.date_ouverture ".$filter_op1." '".$db->idate($filter_date1)."'";
if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " AND cd.date_fin_validite ".$filter_op2." '".$db->idate($filter_date2)."'";
@ -259,6 +267,8 @@ if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$sql .= $db->order($sortfield, $sortorder);
//print $sql;
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
{

View File

@ -8,7 +8,7 @@ if (empty($keyforselect) || empty($keyforelement) || empty($keyforaliasextra))
}
// Add extra fields
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.')';
$sql="SELECT name, label, type, param, fieldcomputed, fielddefault FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = '".$keyforselect."' AND type != 'separate' AND entity IN (0, ".$conf->entity.') ORDER BY pos ASC';
//print $sql;
$resql=$this->db->query($sql);
if ($resql) // This can fail when class is used on old database (during migration for example)

View File

@ -670,46 +670,47 @@ if (!empty($usemargins) && $user->rights->margins->creer)
var i = 0;
$(data).each(function() {
if (this.id != 'pmpprice' && this.id != 'costprice')
{
i++;
this.price = parseFloat(this.price); // to fix when this.price >0
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
if (this.id == 'pmpprice')
{
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price);
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
{
if (this.price > 0) {
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
//console.log("pmppricevalue="+pmppricevalue);
}
}
}
if (this.id == 'costprice')
{
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
if ('costprice' == defaultbuyprice)
{
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
else if (pmppricevalue > 0) { defaultkey = pmppriceid; defaultprice = pmppricevalue; }
}
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
/* Warning: Lines must be processed in order: best supplier price, then pmpprice line then costprice */
if (this.id != 'pmpprice' && this.id != 'costprice')
{
i++;
this.price = parseFloat(this.price); // to fix when this.price >0
// If margin is calculated on best supplier price, we set it by defaut (but only if value is not 0)
//console.log("id="+this.id+"-price="+this.price+"-"+(this.price > 0));
if (bestpricefound == 0 && this.price > 0) { defaultkey = this.id; defaultprice = this.price; bestpriceid = this.id; bestpricevalue = this.price; bestpricefound=1; } // bestpricefound is used to take the first price > 0
}
if (this.id == 'pmpprice')
{
// If margin is calculated on PMP, we set it by defaut (but only if value is not 0)
console.log("id="+this.id+"-price="+this.price);
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
{
if (this.price > 0) {
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
//console.log("pmppricevalue="+pmppricevalue);
}
}
}
if (this.id == 'costprice')
{
// If margin is calculated on Cost price, we set it by defaut (but only if value is not 0)
console.log("id="+this.id+"-price="+this.price+"-pmppricevalue="+pmppricevalue);
if ('costprice' == defaultbuyprice)
{
if (this.price > 0) { defaultkey = this.id; defaultprice = this.price; costpriceid = this.id; costpricevalue = this.price; }
else if (pmppricevalue > 0) { defaultkey = 'pmpprice'; defaultprice = pmppricevalue; }
}
}
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
$("#fournprice_predef").html(options).show();
if (defaultkey != '')
{
$("#fournprice_predef").val(defaultkey);
$("#fournprice_predef").val(defaultkey);
}
/* At loading, no product are yet selected, so we hide field of buying_price */

View File

@ -1243,34 +1243,34 @@ class EmailCollector extends CommonObject
$objectid = 0;
$objectemail = null;
if ($reg[0] == 'inv')
if ($reg[1] == 'inv')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new Facture($this->db);
}
if ($reg[0] == 'proj')
if ($reg[1] == 'proj')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new Project($this->db);
}
if ($reg[0] == 'con')
if ($reg[1] == 'con')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new Contact($this->db);
}
if ($reg[0] == 'thi')
if ($reg[1] == 'thi')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new Societe($this->db);
}
if ($reg[0] == 'use')
if ($reg[1] == 'use')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new User($this->db);
}
if ($reg[0] == 'tic')
if ($reg[1] == 'tic')
{
$objectid = $reg[1];
$objectid = $reg[2];
$objectemail = new Ticket($this->db);
}

View File

@ -84,16 +84,17 @@ if ($idprod > 0)
}
}
// Add price for costprice
$price=$producttmp->cost_price;
$prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
// After best supplier prices and before costprice
if(!empty($conf->stock->enabled))
{
// Add price for pmp
$price=$producttmp->pmp;
$prices[] = array("id" => 'pmpprice', "price" => price2num($price), "label" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
}
// Add price for costprice (at end)
$price=$producttmp->cost_price;
$prices[] = array("id" => 'costprice', "price" => price2num($price), "label" => $langs->trans("CostPrice").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency), "title" => $langs->trans("PMPValueShort").': '.price($price, 0, $langs, 0, 0, -1, $conf->currency)); // For price field, we must use price2num(), for label or title, price()
}
echo json_encode($prices);

View File

@ -115,6 +115,7 @@ $boxstatFromHook = '';
// Load translation files required by page
$langs->loadLangs(array('commercial', 'bills', 'orders', 'contracts'));
// Load global statistics of objects
if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
{
$object = new stdClass();
@ -201,7 +202,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'contacts',
'members',
'products',
'services',
'services',
'proposals',
'orders',
'invoices',
@ -212,7 +213,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
'askprice',
'projects',
'expensereports',
'holiday',
'holidays',
'donations'
);
// Dashboard Icon lines
@ -348,9 +349,8 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS))
/*
* Dolibarr Working Board with weather
*/
// Dolibarr Working Board with weather
if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$showweather = (empty($conf->global->MAIN_DISABLE_METEO) || $conf->global->MAIN_DISABLE_METEO == 2) ? 1 : 0;
@ -701,6 +701,7 @@ if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
$openedDashBoard .= ' <span class="info-box-icon bg-infoxbox-'.$groupKeyLowerCase.'">'."\n";
$openedDashBoard .= ' <i class="fa fa-dol-'.$groupKeyLowerCase.'"></i>'."\n";
// Show the span for the total of record
if (!empty($groupElement['globalStats'])) {
$globalStatInTopOpenedDashBoard[] = $globalStatsKey;
$openedDashBoard .= ' <span class="info-box-icon-text" title="'.$groupElement['globalStats']['text'].'">'.$nbTotal.'</span>'."\n";

View File

@ -489,6 +489,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
'MAIN_MODULE_SYSLOG'=>'newboxdefonly',
'MAIN_MODULE_SOCIETE'=>'newboxdefonly',
'MAIN_MODULE_SERVICE'=>'newboxdefonly',
'MAIN_MODULE_TAKEPOS'=>'newboxdefonly',
'MAIN_MODULE_USER'=>'newboxdefonly', //This one must be always done and only into last targeted version)
'MAIN_MODULE_VARIANTS'=>'newboxdefonly',
'MAIN_MODULE_WEBSITE'=>'newboxdefonly',
@ -4746,8 +4747,19 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo
$mod->init($reloadmode);
}
}
elseif ($moduletoreload == 'MAIN_MODULE_TAKEPOS') // Permission has changed into 10.0
{
dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Takepos module");
$res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modTakePos.class.php';
if ($res) {
$mod = new modTakePos($db);
$mod->remove('noboxes'); // We need to remove because menu entries has changed
$mod->init($reloadmode);
}
}
else
{
$reg = array();
$tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg);
if (!empty($reg[1]))
{

View File

@ -48,7 +48,7 @@ class MyObject extends CommonObject
public $ismultientitymanaged = 0;
/**
* @var int Does myobject support extrafields ? 0=No, 1=Yes
* @var int Does object support extrafields ? 0=No, 1=Yes
*/
public $isextrafieldmanaged = 1;

View File

@ -164,7 +164,7 @@ class StockMovements extends DolibarrApi
*
* @param int $product_id Id product id {@min 1} {@from body} {@required true}
* @param int $warehouse_id Id warehouse {@min 1} {@from body} {@required true}
* @param float $qty Qty to add (Use negative value for a stock decrease) {@min 0} {@message qty must be higher than 0} {@from body} {@required true}
* @param float $qty Qty to add (Use negative value for a stock decrease) {@from body} {@required true}
* @param string $lot Lot {@from body}
* @param string $movementcode Movement code {@example INV123} {@from body}
* @param string $movementlabel Movement label {@example Inventory number 123} {@from body}

View File

@ -965,6 +965,7 @@ else
if (!empty($conf->fournisseur->enabled) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; }
$object->name = GETPOST('name', 'alpha');
$object->name_alias = GETPOST('name_alias', 'alpha');
$object->firstname = GETPOST('firstname', 'alpha');
$object->particulier = $private;
$object->prefix_comm = GETPOST('prefix_comm', 'alpha');

View File

@ -2753,7 +2753,8 @@ class Ticket extends CommonObject
$conf->global->MAIN_MAIL_AUTOCOPY_TO = '';
}
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1);
$trackid = "tic".$this->id;
$mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid);
if ($mailfile->error) {
setEventMessages($mailfile->error, null, 'errors');
} else {