Merge branch 'develop' into new_branch_13_11_2018

This commit is contained in:
Laurent Destailleur 2018-11-15 16:23:54 +01:00 committed by GitHub
commit f2fba05475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 229 additions and 67 deletions

View File

@ -232,13 +232,13 @@ print '</td>';
print '</tr>'; print '</tr>';
//EntToEnd //EntToEnd
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("END_TO_END").'</td>'; print '<tr class="pair"><td>'.$langs->trans("END_TO_END").'</td>';
print '<td align="left">'; print '<td align="left">';
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->END_TO_END.'" size="15" ></td>'; print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->END_TO_END.'" size="15" ></td>';
print '</td></tr>'; print '</td></tr>';
//USTRD //USTRD
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("USTRD").'</td>'; print '<tr class="pair"><td>'.$langs->trans("USTRD").'</td>';
print '<td align="left">'; print '<td align="left">';
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->USTRD.'" size="15" ></td>'; print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->USTRD.'" size="15" ></td>';
print '</td></tr>'; print '</td></tr>';

View File

@ -1731,7 +1731,7 @@ function email_admin_prepare_head()
$h = 0; $h = 0;
$head = array(); $head = array();
if ($user->admin && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) if (! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
{ {
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup"); $head[$h][1] = $langs->trans("OutGoingEmailSetup");
@ -1752,7 +1752,7 @@ function email_admin_prepare_head()
$head[$h][2] = 'templates'; $head[$h][2] = 'templates';
$h++; $h++;
if ($conf->global->MAIN_FEATURES_LEVEL >= 1) if ($conf->global->MAIN_FEATURES_LEVEL >= 1 && ! empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates'))
{ {
$head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php"; $head[$h][0] = DOL_URL_ROOT."/admin/mails_senderprofile_list.php";
$head[$h][1] = $langs->trans("EmailSenderProfiles"); $head[$h][1] = $langs->trans("EmailSenderProfiles");

View File

@ -2837,35 +2837,50 @@ function isValidPhone($phone)
* @param string $stringencoding Encoding of string * @param string $stringencoding Encoding of string
* @return int Length of string * @return int Length of string
*/ */
function dol_strlen($string,$stringencoding='UTF-8') function dol_strlen($string, $stringencoding='UTF-8')
{ {
if (function_exists('mb_strlen')) return mb_strlen($string,$stringencoding); if (function_exists('mb_strlen')) return mb_strlen($string,$stringencoding);
else return strlen($string); else return strlen($string);
} }
/** /**
* Make a substring. Works even in mbstring module is not enabled. * Make a substring. Works even if mbstring module is not enabled for better compatibility.
* *
* @param string $string String to scan * @param string $string String to scan
* @param string $start Start position * @param string $start Start position
* @param int $length Length * @param int $length Length (in nb of characters or nb of bytes depending on trunconbytes param)
* @param string $stringencoding Page code used for input string encoding * @param string $stringencoding Page code used for input string encoding
* @param int $trunconbytes 1=Length is max of bytes instead of max of characters
* @return string substring * @return string substring
*/ */
function dol_substr($string,$start,$length,$stringencoding='') function dol_substr($string, $start, $length, $stringencoding='', $trunconbytes=0)
{ {
global $langs; global $langs;
if (empty($stringencoding)) $stringencoding=$langs->charset_output; if (empty($stringencoding)) $stringencoding=$langs->charset_output;
$ret=''; $ret='';
if (function_exists('mb_substr')) if (empty($trunconbytes))
{ {
$ret=mb_substr($string,$start,$length,$stringencoding); if (function_exists('mb_substr'))
{
$ret=mb_substr($string, $start, $length, $stringencoding);
}
else
{
$ret=substr($string, $start, $length);
}
} }
else else
{ {
$ret=substr($string,$start,$length); if (function_exists('mb_strcut'))
{
$ret=mb_strcut($string, $start, $length, $stringencoding);
}
else
{
$ret=substr($string, $start, $length);
}
} }
return $ret; return $ret;
} }
@ -3063,7 +3078,7 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie',
* @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap * @param string $trunc Where to trunc: right, left, middle (size must be a 2 power), wrap
* @param string $stringencoding Tell what is source string encoding * @param string $stringencoding Tell what is source string encoding
* @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation. * @param int $nodot Truncation do not add ... after truncation. So it's an exact truncation.
* @param int $display Trunc is use to display and can be changed for small screen. TODO Remove this param (must be dealt with CSS) * @param int $display Trunc is used to display data and can be changed for small screen. TODO Remove this param (must be dealt with CSS)
* @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise. * @return string Truncated string. WARNING: length is never higher than $size if $nodot is set, but can be 3 chars higher otherwise.
*/ */
function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0) function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8',$nodot=0, $display=0)
@ -6782,26 +6797,27 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id
if ($key == '') return ''; if ($key == '') return '';
// Check in cache // Check in cache
if (isset($cache_codes[$tablename][$key])) // Can be defined to 0 or '' if (isset($cache_codes[$tablename][$key][$fieldid])) // Can be defined to 0 or ''
{ {
return $cache_codes[$tablename][$key]; // Found in cache return $cache_codes[$tablename][$key][$fieldid]; // Found in cache
} }
dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG);
$sql = "SELECT ".$fieldid." as valuetoget"; $sql = "SELECT ".$fieldid." as valuetoget";
$sql.= " FROM ".MAIN_DB_PREFIX.$tablename; $sql.= " FROM ".MAIN_DB_PREFIX.$tablename;
$sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; $sql.= " WHERE ".$fieldkey." = '".$db->escape($key)."'";
if (! empty($entityfilter)) if (! empty($entityfilter))
$sql.= " AND entity IN (" . getEntity($tablename) . ")"; $sql.= " AND entity IN (" . getEntity($tablename) . ")";
dol_syslog('dol_getIdFromCode', LOG_DEBUG);
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if ($obj) $cache_codes[$tablename][$key]=$obj->valuetoget; if ($obj) $cache_codes[$tablename][$key][$fieldid]=$obj->valuetoget;
else $cache_codes[$tablename][$key]=''; else $cache_codes[$tablename][$key][$fieldid]='';
$db->free($resql); $db->free($resql);
return $cache_codes[$tablename][$key]; return $cache_codes[$tablename][$key][$fieldid];
} }
else else
{ {
@ -6889,8 +6905,6 @@ function picto_from_langcode($codelang, $moreatt = '')
if (empty($codelang)) return ''; if (empty($codelang)) return '';
if (empty($codelang)) return '';
if ($codelang == 'auto') if ($codelang == 'auto')
{ {
return '<span class="fa fa-globe"></span>'; return '<span class="fa fa-globe"></span>';
@ -7061,6 +7075,7 @@ function printCommonFooter($zone='private')
if (! empty($conf->use_javascript_ajax)) if (! empty($conf->use_javascript_ajax))
{ {
print '<script type="text/javascript" language="javascript">'."\n"; print '<script type="text/javascript" language="javascript">'."\n";
print 'jQuery(document).ready(function() {'."\n";
if ($zone == 'private' && empty($conf->dol_use_jmobile)) if ($zone == 'private' && empty($conf->dol_use_jmobile))
{ {
@ -7143,6 +7158,8 @@ function printCommonFooter($zone='private')
} }
} }
print '});'."\n";
// Google Analytics // Google Analytics
// TODO Add a hook here // TODO Add a hook here
if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID)) if (! empty($conf->google->enabled) && ! empty($conf->global->MAIN_GOOGLE_AN_ID))

View File

@ -122,7 +122,7 @@ class mod_project_simple extends ModeleNumRefProjects
* @param Project $project Object project * @param Project $project Object project
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
function getNextValue($objsoc,$project) function getNextValue($objsoc, $project)
{ {
global $db,$conf; global $db,$conf;
@ -167,9 +167,9 @@ class mod_project_simple extends ModeleNumRefProjects
* @param Project $project Object project * @param Project $project Object project
* @return string Next not used reference * @return string Next not used reference
*/ */
function project_get_num($objsoc=0,$project='') function project_get_num($objsoc=0, $project='')
{ {
// phpcs:enable // phpcs:enable
return $this->getNextValue($objsoc,$project); return $this->getNextValue($objsoc, $project);
} }
} }

View File

@ -123,7 +123,7 @@ class mod_project_universal extends ModeleNumRefProjects
* @param Project $project Object project * @param Project $project Object project
* @return string Value if OK, 0 if KO * @return string Value if OK, 0 if KO
*/ */
function getNextValue($objsoc,$project) function getNextValue($objsoc, $project)
{ {
global $db,$conf; global $db,$conf;
@ -139,7 +139,7 @@ class mod_project_universal extends ModeleNumRefProjects
} }
$date=empty($project->date_c)?dol_now():$project->date_c; $date=empty($project->date_c)?dol_now():$project->date_c;
$numFinal=get_next_value($db,$mask,'projet','ref','',$objsoc->code_client,$date); $numFinal=get_next_value($db, $mask, 'projet', 'ref', '', (is_object($objsoc) ? $objsoc->code_client : ''), $date);
return $numFinal; return $numFinal;
} }
@ -153,9 +153,9 @@ class mod_project_universal extends ModeleNumRefProjects
* @param Project $project Object project * @param Project $project Object project
* @return string Next not used reference * @return string Next not used reference
*/ */
function project_get_num($objsoc=0,$project='') function project_get_num($objsoc=0, $project='')
{ {
// phpcs:enable // phpcs:enable
return $this->getNextValue($objsoc,$project); return $this->getNextValue($objsoc, $project);
} }
} }

View File

@ -710,12 +710,12 @@ class EmailCollector extends CommonObject
dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG); dol_syslog("EmailCollector::doCollectOneCollector start", LOG_DEBUG);
$langs->loadLangs(array("project", "companies", "errors"));
$error = 0; $error = 0;
$this->output = ''; $this->output = '';
$this->error=''; $this->error='';
dol_syslog(__METHOD__, LOG_DEBUG);
$now = dol_now(); $now = dol_now();
if (empty($this->host)) if (empty($this->host))
@ -781,7 +781,9 @@ class EmailCollector extends CommonObject
dol_syslog("search string = ".$search); dol_syslog("search string = ".$search);
//var_dump($search); //var_dump($search);
$nbemailprocessed=0; $nbactiondone=0; $nbemailprocessed=0;
$nbemailok=0;
$nbactiondone=0;
$projectstatic=new Project($this->db); $projectstatic=new Project($this->db);
$thirdpartystatic=new Societe($this->db); $thirdpartystatic=new Societe($this->db);
$contactstatic=new Contact($this->db); $contactstatic=new Contact($this->db);
@ -797,7 +799,12 @@ class EmailCollector extends CommonObject
{ {
if ($nbemailprocessed > 100) break; // Do not process more than 100 email per launch if ($nbemailprocessed > 100) break; // Do not process more than 100 email per launch
$nbactiondoneforemail = 0;
$errorforemail = 0;
$errorforactions = 0; $errorforactions = 0;
$thirdpartyfoundby = '';
$contactfoundby = '';
$projectfoundby = '';
$this->db->begin(); $this->db->begin();
@ -830,8 +837,9 @@ class EmailCollector extends CommonObject
$sendtocc=$overview[0]->cc; $sendtocc=$overview[0]->cc;
$sendtobcc=$overview[0]->bcc; $sendtobcc=$overview[0]->bcc;
$date=$overview[0]->udate; $date=$overview[0]->udate;
$msgid=$overview[0]->message_id; $msgid=str_replace(array('<','>'), '', $overview[0]->message_id);
$subject=$overview[0]->subject; $subject=$overview[0]->subject;
//var_dump($msgid);exit;
$reg=array(); $reg=array();
if (preg_match('/^(.*)<(.*)>$/', $fromstring, $reg)) if (preg_match('/^(.*)<(.*)>$/', $fromstring, $reg))
@ -848,9 +856,12 @@ class EmailCollector extends CommonObject
$contactid = 0; $thirdpartyid = 0; $projectid = 0; $contactid = 0; $thirdpartyid = 0; $projectid = 0;
// Analyze TrackId // Analyze TrackId
$trackid = '';
$reg=array(); $reg=array();
if (! empty($headers['X-Dolibarr-TrackId']) && preg_match('/:\s*([a-z]+)([0-9]+)$/', $headers['X-Dolibarr-TrackId'], $reg)) if (! empty($headers['X-Dolibarr-TrackId']) && preg_match('/:\s*([a-z]+)([0-9]+)$/', $headers['X-Dolibarr-TrackId'], $reg))
{ {
$trackid = $reg[0].$reg[1];
$objectid = 0; $objectid = 0;
$objectemail = null; $objectemail = null;
if ($reg[0] == 'inv') if ($reg[0] == 'inv')
@ -888,6 +899,7 @@ class EmailCollector extends CommonObject
if ($fk_element_type == 'facture') $fk_element_type = 'invoice'; if ($fk_element_type == 'facture') $fk_element_type = 'invoice';
$thirdpartyid = $objectemail->fk_soc; $thirdpartyid = $objectemail->fk_soc;
$contactid = $objectemail->fk_socpeople;
$projectid = isset($objectemail->fk_project)?$objectemail->fk_project:$objectemail->fk_projet; $projectid = isset($objectemail->fk_project)?$objectemail->fk_project:$objectemail->fk_projet;
} }
} }
@ -898,6 +910,7 @@ class EmailCollector extends CommonObject
{ {
$result = $projectstatic->fetch($projectid); $result = $projectstatic->fetch($projectid);
if ($result <= 0) $projectstatic->id = 0; if ($result <= 0) $projectstatic->id = 0;
else $projectfoundby = 'Trackid ('.$trackid.')';
} }
// Contact // Contact
$contactstatic->id=0; $contactstatic->id=0;
@ -905,10 +918,12 @@ class EmailCollector extends CommonObject
{ {
$result = $contactstatic->fetch($contactid); $result = $contactstatic->fetch($contactid);
if ($result <= 0) $contactstatic->id = 0; if ($result <= 0) $contactstatic->id = 0;
else $contactfoundby = 'Trackid ('.$trackid.')';
} }
else // Try to find contact using email else // Try to find contact using email
{ {
$contactstatic->fetch(0, null, '', $from); $result = $contactstatic->fetch(0, null, '', $from);
if ($result > 0) $contactfoundby = 'email ('.$from.')';
} }
// Thirdparty // Thirdparty
$thirdpartystatic->id=0; $thirdpartystatic->id=0;
@ -916,15 +931,17 @@ class EmailCollector extends CommonObject
{ {
$result = $thirdpartystatic->fetch($thirdpartyid); $result = $thirdpartystatic->fetch($thirdpartyid);
if ($result <= 0) $thirdpartystatic->id = 0; if ($result <= 0) $thirdpartystatic->id = 0;
else $thirdpartyfoundby = 'Trackid ('.$trackid.')';
} }
else // Try to find thirdparty using email else // Try to find thirdparty using email
{ {
$thirdpartystatic->fetch(0, '', '', '', '', '', '', '', '', '', $from); $result = $thirdpartystatic->fetch(0, '', '', '', '', '', '', '', '', '', $from);
if ($result > 0) $thirdpartyfoundby = 'email ('.$from.')';
} }
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
// Do operationss // Do operations
foreach($this->actions as $operation) foreach($this->actions as $operation)
{ {
if ($errorforactions) break; if ($errorforactions) break;
@ -942,7 +959,7 @@ class EmailCollector extends CommonObject
$actioncomm->code = 'AC_'.$actioncode; $actioncomm->code = 'AC_'.$actioncode;
$actioncomm->label = $langs->trans("EmailReceived").' - '.$langs->trans("From").' '.$from; $actioncomm->label = $langs->trans("EmailReceived").' - '.$langs->trans("From").' '.$from;
$actioncomm->note = $messagetext; $actioncomm->note = $messagetext;
$actioncomm->fk_project = 0; $actioncomm->fk_project = $projectstatic->id;
$actioncomm->datep = $date; $actioncomm->datep = $date;
$actioncomm->datef = $date; $actioncomm->datef = $date;
$actioncomm->percentage = -1; // Not applicable $actioncomm->percentage = -1; // Not applicable
@ -981,42 +998,143 @@ class EmailCollector extends CommonObject
$this->errors = $actioncomm->errors; $this->errors = $actioncomm->errors;
} }
} }
elseif ($operation['type'] == 'aaa') elseif ($operation['type'] == 'project')
{ {
// @TODO Check project not alreayd created using ref_ext=msg_id
$note_private = $langs->trans("ProjectCreatedByEmailCollector", $msgid);
$projecttocreate = new Project($this->db);
if ($thirdpartystatic->id > 0)
{
$projecttocreate->fk_soc = $thirdpartystatic->id;
if ($thirdpartyfoundby) $note_private .= ' - Third party found from '.$thirdpartyfoundby;
}
if ($contactstatic->id > 0)
{
$projecttocreate->contact_id = $contactstatic->id;
if ($contactfoundby) $note_private .= ' - Contact/address found from '.$contactfoundby;
}
$id_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'rowid');
$percent_opp_status = dol_getIdFromCode($this->db, 'PROSP', 'c_lead_status', 'code', 'percent');
$projecttocreate->title = $subject;
$projecttocreate->date_start = $now;
$projecttocreate->opp_status = $id_opp_status;
$projecttocreate->opp_percent = $percent_opp_status;
$projecttocreate->description = ($note_private?$note_private."\n":'').$messagetext;
$projecttocreate->note_private = $note_private;
// Overwrite values with values extracted from source email
$arrayvaluetouse = array();
foreach($arrayvaluetouse as $propertytooverwrite => $valueforproperty)
{
// Example: $propertytooverwrite = 'project.opportunity_status', $valueforproperty = '123' or 'REGEX:BODY:...(.*)...'
}
// Get next project Ref
$defaultref='';
$modele = empty($conf->global->PROJECT_ADDON)?'mod_project_simple':$conf->global->PROJECT_ADDON;
// Search template files
$file=''; $classname=''; $filefound=0;
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
foreach($dirmodels as $reldir)
{
$file=dol_buildpath($reldir."core/modules/project/".$modele.'.php',0);
if (file_exists($file))
{
$filefound=1;
$classname = $modele;
break;
}
}
if ($filefound)
{
$result=dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$defaultref = $modProject->getNextValue(($thirdpartystatic->id > 0 ? $thirdpartystatic : null), $projecttocreate);
}
if (is_numeric($defaultref) && $defaultref <= 0)
{
$errorforactions++;
$this->error = 'Failed to create project: Can\'t get a free project Ref';
}
else
{
$projecttocreate->ref = $defaultref;
// Create project
$result = $projecttocreate->create($user);
if ($result <= 0)
{
$errorforactions++;
$this->error = 'Failed to create project: '.$langs->trans($projecttocreate->error);
$this->errors = $projecttocreate->errors;
}
}
} }
if (! $errorforactions) if (! $errorforactions)
{ {
$nbactiondone++; $nbactiondoneforemail++;
} }
} }
// Move email // Error for email or not ?
if (! $errorforactions && $targetdir) if (! $errorforactions)
{ {
dol_syslog("EmailCollector::doCollectOneCollector move message ".$imapemail." to ".$connectstringtarget, LOG_DEBUG); if ($targetdir)
$res = imap_mail_move($connection, $imapemail, $targetdir, 0); {
if ($res == false) { dol_syslog("EmailCollector::doCollectOneCollector move message ".$imapemail." to ".$connectstringtarget, LOG_DEBUG);
$error++; $res = imap_mail_move($connection, $imapemail, $targetdir, 0);
$this->error = imap_last_error(); if ($res == false) {
dol_syslog(imap_last_error()); $errorforemail++;
$this->error = imap_last_error();
$this->errors[] = $this->error;
dol_syslog(imap_last_error());
}
} }
else
{
dol_syslog("EmailCollector::doCollectOneCollector message ".$imapemail." to ".$connectstringtarget." was set to read", LOG_DEBUG);
}
}
else
{
$errorforemail++;
}
if (! $errorforemail)
{
$nbactiondone += $nbactiondoneforemail;
$nbemailok++;
$this->db->commit();
}
else
{
$error++;
$this->db->rollback();
} }
$nbemailprocessed++; $nbemailprocessed++;
unset($objectemail); unset($objectemail);
$this->db->commit();
} }
$this->output=$langs->trans('XEmailsDoneYActionsDone', $nbemailprocessed, $nbactiondone); $output=$langs->trans('XEmailsDoneYActionsDone', $nbemailprocessed, $nbemailok, $nbactiondone);
} }
else else
{ {
$this->output=$langs->trans('NoNewEmailToProcess'); $output=$langs->trans('NoNewEmailToProcess');
} }
imap_expunge($connection); // To validate any move imap_expunge($connection); // To validate any move
@ -1024,7 +1142,8 @@ class EmailCollector extends CommonObject
imap_close($connection); imap_close($connection);
$this->datelastresult = $now; $this->datelastresult = $now;
$this->lastresult = $this->output; $this->lastresult = $output;
if (! empty($this->errors)) $this->lastresult.= " - ".join(" - ", $this->errors);
$this->codelastresult = ($error ? 'KO' : 'OK'); $this->codelastresult = ($error ? 'KO' : 'OK');
$this->update($user); $this->update($user);

View File

@ -55,7 +55,7 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN desc_fourn text after ref_f
ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment; ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment;
ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer; ALTER TABLE llx_stock_mouvement ADD COLUMN fk_project integer;
Alter TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(32); ALTER TABLE llx_c_action_trigger MODIFY COLUMN elementtype varchar(32);
ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search; ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search;

View File

@ -1833,7 +1833,7 @@ EmailCollectorConfirmCollectTitle=Email collect confirmation
EmailCollectorConfirmCollect=Do you want to run the collect for this collector now ? EmailCollectorConfirmCollect=Do you want to run the collect for this collector now ?
NoNewEmailToProcess=No new email (matching filters) to process NoNewEmailToProcess=No new email (matching filters) to process
NothingProcessed=Nothing done NothingProcessed=Nothing done
XEmailsDoneYActionsDone=%s emails analyzed, %s record/actions done by collector XEmailsDoneYActionsDone=%s emails analyzed, %s emails successfuly processed (for %s record/actions done) by collector
RecordEvent=Record event RecordEvent=Record event
CreateLeadAndThirdParty=Create lead (and thirdparty if necessary) CreateLeadAndThirdParty=Create lead (and thirdparty if necessary)
CodeLastResult=Result code of last collect CodeLastResult=Result code of last collect

View File

@ -244,6 +244,9 @@ YourPasswordHasBeenReset=Your password has been reset successfully
ApplicantIpAddress=IP address of applicant ApplicantIpAddress=IP address of applicant
SMSSentTo=SMS sent to %s SMSSentTo=SMS sent to %s
MissingIds=Missing ids MissingIds=Missing ids
ThirdPartyCreatedByEmailCollector=Third party created by email collector from email ID %s
ContactCreatedByEmailCollector=Contact/address created by email collector from email ID %s
ProjectCreatedByEmailCollector=Project created by email collector from email ID %s
##### Export ##### ##### Export #####
ExportsArea=Exports area ExportsArea=Exports area

View File

@ -179,6 +179,10 @@ class Project extends CommonObject
$now=dol_now(); $now=dol_now();
// Clean parameters
$this->note_private = dol_substr($this->note_private, 0, 65535);
$this->note_public = dol_substr($this->note_public, 0, 65535);
// Check parameters // Check parameters
if (!trim($this->ref)) if (!trim($this->ref))
{ {
@ -193,6 +197,7 @@ class Project extends CommonObject
return -1; return -1;
} }
// Create project
$this->db->begin(); $this->db->begin();
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet ("; $sql = "INSERT INTO " . MAIN_DB_PREFIX . "projet (";
@ -211,6 +216,8 @@ class Project extends CommonObject
$sql.= ", opp_amount"; $sql.= ", opp_amount";
$sql.= ", budget_amount"; $sql.= ", budget_amount";
$sql.= ", bill_time"; $sql.= ", bill_time";
$sql.= ", note_private";
$sql.= ", note_public";
$sql.= ", entity"; $sql.= ", entity";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= "'" . $this->db->escape($this->ref) . "'"; $sql.= "'" . $this->db->escape($this->ref) . "'";
@ -228,6 +235,8 @@ class Project extends CommonObject
$sql.= ", " . (strcmp($this->opp_amount,'') ? price2num($this->opp_amount) : 'null'); $sql.= ", " . (strcmp($this->opp_amount,'') ? price2num($this->opp_amount) : 'null');
$sql.= ", " . (strcmp($this->budget_amount,'') ? price2num($this->budget_amount) : 'null'); $sql.= ", " . (strcmp($this->budget_amount,'') ? price2num($this->budget_amount) : 'null');
$sql.= ", " . ($this->bill_time ? 1 : 0); $sql.= ", " . ($this->bill_time ? 1 : 0);
$sql.= ", ".($this->note_private ? "'".$this->db->escape($this->note_private)."'" : 'null');
$sql.= ", ".($this->note_public ? "'".$this->db->escape($this->note_public)."'" : 'null');
$sql.= ", ".$conf->entity; $sql.= ", ".$conf->entity;
$sql.= ")"; $sql.= ")";

View File

@ -261,15 +261,18 @@ print '<div class="div-table-responsive">';
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
if ($caneditperms && empty($objMod->rights_admin_allowed) || empty($object->admin)) if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin))
{ {
print '<td align="center" class="nowrap">'; if ($caneditperms)
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>"; {
print '/'; print '<td align="center" class="nowrap">';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("None")."</a>"; print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("All")."</a>";
print '</td>'; print '/';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module=allmodules">'.$langs->trans("None")."</a>";
print '</td>';
}
print '<td align="center" width="24">&nbsp;</td>';
} }
print '<td align="center" width="24">&nbsp;</td>';
print '<td>'.$langs->trans("Permissions").'</td>'; print '<td>'.$langs->trans("Permissions").'</td>';
print '</tr>'."\n"; print '</tr>'."\n";
@ -310,21 +313,31 @@ if ($result)
print '<tr class="oddeven trforbreak">'; print '<tr class="oddeven trforbreak">';
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName(); print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName();
print '<a name="'.$objMod->getName().'"></a></td>'; print '<a name="'.$objMod->getName().'"></a></td>';
print '<td align="center" class="nowrap">'; if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin))
if ($caneditperms && empty($objMod->rights_admin_allowed) || empty($object->admin))
{ {
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("All")."</a>"; if ($caneditperms)
print '/'; {
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("None")."</a>"; print '<td align="center" class="nowrap">';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=addrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("All")."</a>";
print '/';
print '<a class="reposition" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delrights&amp;entity='.$entity.'&amp;module='.$obj->module.'">'.$langs->trans("None")."</a>";
print '</td>';
}
}
else
{
if ($caneditperms)
{
print '<td></td>';
}
} }
print '</td>';
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
print '</tr>'."\n"; print '</tr>'."\n";
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
// Picto and label of permission // Picto and label of module
print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName().'</td>'; print '<td class="maxwidthonsmartphone tdoverflowonsmartphone">'.img_object('',$picto,'class="pictoobjectwidth"').' '.$objMod->getName().'</td>';
// Permission and tick // Permission and tick
@ -383,6 +396,7 @@ if ($result)
print '<td>&nbsp</td>'; print '<td>&nbsp</td>';
} }
// Label
$permlabel=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle))); $permlabel=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$langs->trans($obj->libelle)));
print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>'; print '<td class="maxwidthonsmartphone">'.$permlabel.'</td>';

View File

@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php';
$langs->loadLangs(array("admin","other","website")); $langs->loadLangs(array("admin","other","website"));
if (! $user->admin) accessforbidden(); if (! $user->rights->website->read) accessforbidden();
if (! ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))) if (! ((GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER)) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)))
{ {