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

Conflicts:
	htdocs/projet/card.php
	htdocs/projet/class/project.class.php
	htdocs/projet/list.php
This commit is contained in:
Laurent Destailleur 2016-11-10 11:40:39 +01:00
commit eaa2125373
8 changed files with 62 additions and 47 deletions

View File

@ -527,7 +527,7 @@ class CMailFile
if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail();
if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce); if (! empty($bounce)) $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers, $bounce);
else $res = mail($dest,$this->encodetorfc2822($this->subject),$this->message,$this->headers); else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers);
if (! $res) if (! $res)
{ {
@ -840,7 +840,7 @@ class CMailFile
// Receiver // Receiver
if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc,2).$this->eol2; if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc,2).$this->eol2;
if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc,2).$this->eol2; // Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ?
// Delivery receipt // Delivery receipt
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from,2).$this->eol2; if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from,2).$this->eol2;

View File

@ -489,14 +489,20 @@ class SMTPs
// and send it out "single file" // and send it out "single file"
foreach ( $this->get_RCPT_list() as $_address ) foreach ( $this->get_RCPT_list() as $_address )
{ {
/* /* Note:
* BCC email addresses must be listed in the RCPT TO command list,
* but the BCC header should not be printed under the DATA command.
* http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
*/
/*
* TODO * TODO
* After each 'RCPT TO:' is sent, we need to make sure it was kosher, * After each 'RCPT TO:' is sent, we need to make sure it was kosher,
* if not, the whole message will fail * if not, the whole message will fail
* If any email address fails, we will need to RESET the connection, * If any email address fails, we will need to RESET the connection,
* mark the last address as "bad" and start the address loop over again. * mark the last address as "bad" and start the address loop over again.
* If any address fails, the entire message fails. * If any address fails, the entire message fails.
*/ */
$this->socket_send_str('RCPT TO: <' . $_address . '>', '250'); $this->socket_send_str('RCPT TO: <' . $_address . '>', '250');
} }
@ -1025,7 +1031,7 @@ class SMTPs
/** /**
* Returns an array of addresses for a specific type; TO, CC or BCC * Returns an array of addresses for a specific type; TO, CC or BCC
* *
* @param string $_which Which collection of adresses to return * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc')
* @return string|false Array of emaill address * @return string|false Array of emaill address
*/ */
function get_email_list($_which = null) function get_email_list($_which = null)
@ -1174,9 +1180,17 @@ class SMTPs
if ( $this->getCC() ) if ( $this->getCC() )
$_header .= 'Cc: ' . $this->getCC() . "\r\n"; $_header .= 'Cc: ' . $this->getCC() . "\r\n";
/* Note:
* BCC email addresses must be listed in the RCPT TO command list,
* but the BCC header should not be printed under the DATA command.
* So it is included into the function sendMsg() but not here.
* http://stackoverflow.com/questions/2750211/sending-bcc-emails-using-a-smtp-server
*/
/*
if ( $this->getBCC() ) if ( $this->getBCC() )
$_header .= 'Bcc: ' . $this->getBCC() . "\r\n"; $_header .= 'Bcc: ' . $this->getBCC() . "\r\n";
*/
$host=$this->getHost(); $host=$this->getHost();
$host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@tcp://@i','',$host); // Remove prefix
$host=preg_replace('@ssl://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix

View File

@ -13,7 +13,7 @@ ListOfValidatedPublicMembers=List of validated public members
ErrorThisMemberIsNotPublic=This member is not public ErrorThisMemberIsNotPublic=This member is not public
ErrorMemberIsAlreadyLinkedToThisThirdParty=Another member (name: <b>%s</b>, login: <b>%s</b>) is already linked to a third party <b>%s</b>. Remove this link first because a third party can't be linked to only a member (and vice versa). ErrorMemberIsAlreadyLinkedToThisThirdParty=Another member (name: <b>%s</b>, login: <b>%s</b>) is already linked to a third party <b>%s</b>. Remove this link first because a third party can't be linked to only a member (and vice versa).
ErrorUserPermissionAllowsToLinksToItselfOnly=For security reasons, you must be granted permissions to edit all users to be able to link a member to a user that is not yours. ErrorUserPermissionAllowsToLinksToItselfOnly=For security reasons, you must be granted permissions to edit all users to be able to link a member to a user that is not yours.
ThisIsContentOfYourCard=This is details of your card ThisIsContentOfYourCard=Hi.<br><br>This is a remind of the information we get about you. Feel free to contact us if something looks wrong.<br><br>
CardContent=Content of your member card CardContent=Content of your member card
SetLinkToUser=Link to a Dolibarr user SetLinkToUser=Link to a Dolibarr user
SetLinkToThirdParty=Link to a Dolibarr third party SetLinkToThirdParty=Link to a Dolibarr third party

View File

@ -8,7 +8,7 @@ EditPassword=Edit password
SendNewPassword=Regenerate and send password SendNewPassword=Regenerate and send password
ReinitPassword=Regenerate password ReinitPassword=Regenerate password
PasswordChangedTo=Password changed to: %s PasswordChangedTo=Password changed to: %s
SubjectNewPassword=Your new password for Dolibarr SubjectNewPassword=Your new password for %s
GroupRights=Group permissions GroupRights=Group permissions
UserRights=User permissions UserRights=User permissions
UserGUISetup=User display setup UserGUISetup=User display setup

View File

@ -829,33 +829,12 @@ else
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref
/*
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td></tr>';
*/
// Label
//print '<tr><td>'.$langs->trans("Label").'</td><td>'.$object->title.'</td></tr>';
// Third party
/*
print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td>';
if ($object->thirdparty->id > 0) print $object->thirdparty->getNomUrl(1, 'project');
else print'&nbsp;';
print '</td></tr>';
*/
// Visibility // Visibility
print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("Visibility").'</td><td>';
if ($object->public) print $langs->trans('SharedProject'); if ($object->public) print $langs->trans('SharedProject');
else print $langs->trans('PrivateProject'); else print $langs->trans('PrivateProject');
print '</td></tr>'; print '</td></tr>';
// Statut
//print '<tr><td>'.$langs->trans("Status").'</td><td>'.$object->getLibStatut(4).'</td></tr>';
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES)) if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{ {
// Opportunity status // Opportunity status
@ -879,7 +858,11 @@ else
print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>'; print '<tr><td>'.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").'</td><td>';
print dol_print_date($object->date_start,'day'); print dol_print_date($object->date_start,'day');
$end=dol_print_date($object->date_end,'day'); $end=dol_print_date($object->date_end,'day');
if ($end) print ' - '.$end; if ($end)
{
print ' - '.$end;
if ($object->hasDelay()) print img_warning($langs->trans('Late'));
}
print '</td></tr>'; print '</td></tr>';
// Budget // Budget

View File

@ -241,7 +241,15 @@ class Project extends CommonObject
$this->description = trim($this->description); $this->description = trim($this->description);
if ($this->opp_amount < 0) $this->opp_amount=''; if ($this->opp_amount < 0) $this->opp_amount='';
if ($this->opp_percent < 0) $this->opp_percent=''; if ($this->opp_percent < 0) $this->opp_percent='';
if ($this->date_end && $this->date_end < $this->date_start)
{
$this->error = $langs->trans("ErrorDateEndLowerThanDateStart");
$this->errors[] = $this->error;
$this->db->rollback();
dol_syslog(get_class($this)."::update error -3 " . $this->error, LOG_ERR);
return -3;
}
if (dol_strlen(trim($this->ref)) > 0) if (dol_strlen(trim($this->ref)) > 0)
{ {
$this->db->begin(); $this->db->begin();
@ -1754,12 +1762,12 @@ class Project extends CommonObject
global $conf; global $conf;
if (! ($this->statut == 1)) return false; if (! ($this->statut == 1)) return false;
if (! $this->datee) return false; if (! $this->datee && ! $this->date_end) return false;
$now = dol_now(); $now = dol_now();
return $this->datee < ($now - $conf->projet->warning_delay); return ($this->datee ? $this->datee : $this->date_end) < ($now - $conf->projet->warning_delay);
} }
/** /**

View File

@ -626,7 +626,7 @@ while ($i < min($num,$limit))
$projectstatic->user_author_id = $obj->fk_user_creat; $projectstatic->user_author_id = $obj->fk_user_creat;
$projectstatic->public = $obj->public; $projectstatic->public = $obj->public;
$projectstatic->ref = $obj->ref; $projectstatic->ref = $obj->ref;
$projectstatic->datee = $obj->date_end; $projectstatic->datee = $db->jdate($obj->date_end);
$projectstatic->statut = $obj->fk_statut; $projectstatic->statut = $obj->fk_statut;
$projectstatic->opp_status = $obj->fk_opp_status; $projectstatic->opp_status = $obj->fk_opp_status;

View File

@ -1659,38 +1659,48 @@ class User extends CommonObject
$outputlangs->load("users"); $outputlangs->load("users");
$outputlangs->load("other"); $outputlangs->load("other");
$subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword"); $appli=constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
$subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli);
// Define $urlwithroot // Define $urlwithroot
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root)); //$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
if (! $changelater) if (! $changelater)
{ {
$url = $urlwithroot.'/';
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n"; $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
$mesg.= "\n"; $mesg.= "\n";
$url = $urlwithroot.'/';
$mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $conf->global->MAIN_APPLICATION_TITLE).': '.$url."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n";
$mesg.= "--\n"; $mesg.= "--\n";
$mesg.= $user->getFullName($outputlangs); // Username that make then sending $mesg.= $user->getFullName($outputlangs); // Username that make then sending
dol_syslog(get_class($this)."::send_password changelater is off, url=".$url);
} }
else else
{ {
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password);
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
$mesg.= "\n"; $mesg.= "\n";
$mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n"; $mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n";
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password);
$mesg.= $url."\n\n"; $mesg.= $url."\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n"; $mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n";
dol_syslog(get_class($this)."::send_password url=".$url);
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
} }
$mailfile = new CMailFile( $mailfile = new CMailFile(
$subject, $subject,
$this->email, $this->email,