Merge remote-tracking branch 'upstream/develop' into mycompanysocialnetworks
This commit is contained in:
commit
cd87ee8f92
@ -343,7 +343,7 @@ class Notify
|
||||
$sql = '';
|
||||
|
||||
// Check notification per third party
|
||||
if ($object->socid > 0)
|
||||
if (!empty($object->socid) && $object->socid > 0)
|
||||
{
|
||||
$sql .= "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
|
||||
$sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
|
||||
@ -576,7 +576,7 @@ class Notify
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".$object->socid);
|
||||
dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".(empty($object->socid) ? '' : $object->socid));
|
||||
}
|
||||
} else {
|
||||
$error++;
|
||||
|
||||
@ -122,7 +122,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport
|
||||
global $db, $conf;
|
||||
|
||||
// For backward compatibility and restore old behavior to get ref of expense report
|
||||
if ($conf->global->EXPENSEREPORT_USE_OLD_NUMBERING_RULE)
|
||||
if (!empty($conf->global->EXPENSEREPORT_USE_OLD_NUMBERING_RULE))
|
||||
{
|
||||
$fuser = null;
|
||||
if ($object->fk_user_author > 0)
|
||||
|
||||
@ -217,7 +217,7 @@ class modReception extends DolibarrModules
|
||||
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'reception as c';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'reception_extrafields as extra ON c.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'societe as s';
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid';
|
||||
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON s.fk_pays = co.rowid,';
|
||||
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch as ed';
|
||||
@ -231,7 +231,7 @@ class modReception extends DolibarrModules
|
||||
}
|
||||
$this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = ed.fk_reception AND ed.fk_commandefourndet = cd.rowid';
|
||||
$this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('reception').')';
|
||||
if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
if (empty($user->rights->societe->client->voir)) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -80,12 +80,16 @@ class ExpenseReport extends CommonObject
|
||||
*/
|
||||
public $fk_statut;
|
||||
|
||||
public $vat_src_code;
|
||||
|
||||
public $fk_c_paiement;
|
||||
public $paid;
|
||||
|
||||
public $user_author_infos;
|
||||
public $user_validator_infos;
|
||||
|
||||
public $rule_warning_message;
|
||||
|
||||
// ACTIONS
|
||||
|
||||
// Create
|
||||
@ -539,7 +543,7 @@ class ExpenseReport extends CommonObject
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$sql = "SELECT d.rowid, d.ref, d.note_public, d.note_private,"; // DEFAULT
|
||||
$sql = "SELECT d.rowid, d.entity, d.ref, d.note_public, d.note_private,"; // DEFAULT
|
||||
$sql .= " d.detail_refuse, d.detail_cancel, d.fk_user_refuse, d.fk_user_cancel,"; // ACTIONS
|
||||
$sql .= " d.date_refuse, d.date_cancel,"; // ACTIONS
|
||||
$sql .= " d.total_ht, d.total_ttc, d.total_tva,"; // TOTAUX (int)
|
||||
@ -561,6 +565,9 @@ class ExpenseReport extends CommonObject
|
||||
{
|
||||
$this->id = $obj->rowid;
|
||||
$this->ref = $obj->ref;
|
||||
|
||||
$this->entity = $obj->entity;
|
||||
|
||||
$this->total_ht = $obj->total_ht;
|
||||
$this->total_tva = $obj->total_tva;
|
||||
$this->total_ttc = $obj->total_ttc;
|
||||
@ -802,6 +809,7 @@ class ExpenseReport extends CommonObject
|
||||
$this->id = 0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->specimen = 1;
|
||||
$this->entity = 1;
|
||||
$this->date_create = $now;
|
||||
$this->date_debut = $now;
|
||||
$this->date_fin = $now;
|
||||
@ -2637,7 +2645,7 @@ class ExpenseReportLine
|
||||
}
|
||||
|
||||
/**
|
||||
* insert
|
||||
* Insert a line of expense report
|
||||
*
|
||||
* @param int $notrigger 1=No trigger
|
||||
* @param bool $fromaddline false=keep default behavior, true=exclude the update_price() of parent object
|
||||
@ -2649,11 +2657,11 @@ class ExpenseReportLine
|
||||
|
||||
$error = 0;
|
||||
|
||||
dol_syslog("ExpenseReportLine::Insert rang=".$this->rang, LOG_DEBUG);
|
||||
dol_syslog("ExpenseReportLine::Insert", LOG_DEBUG);
|
||||
|
||||
// Clean parameters
|
||||
$this->comments = trim($this->comments);
|
||||
if (!$this->value_unit_HT) $this->value_unit_HT = 0;
|
||||
if (empty($this->value_unit)) $this->value_unit = 0;
|
||||
$this->qty = price2num($this->qty);
|
||||
$this->vatrate = price2num($this->vatrate);
|
||||
if (empty($this->fk_c_exp_tax_cat)) $this->fk_c_exp_tax_cat = 0;
|
||||
@ -2665,9 +2673,9 @@ class ExpenseReportLine
|
||||
$sql .= ' tva_tx, vat_src_code, comments, qty, value_unit, total_ht, total_tva, total_ttc, date, rule_warning_message, fk_c_exp_tax_cat, fk_ecm_files)';
|
||||
$sql .= " VALUES (".$this->db->escape($this->fk_expensereport).",";
|
||||
$sql .= " ".$this->db->escape($this->fk_c_type_fees).",";
|
||||
$sql .= " ".$this->db->escape($this->fk_project > 0 ? $this->fk_project : ($this->fk_projet > 0 ? $this->fk_projet : 'null')).",";
|
||||
$sql .= " ".$this->db->escape((!empty($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : ((!empty($this->fk_projet) && $this->fk_projet > 0) ? $this->fk_projet : 'null')).",";
|
||||
$sql .= " ".$this->db->escape($this->vatrate).",";
|
||||
$sql .= " '".$this->db->escape($this->vat_src_code)."',";
|
||||
$sql .= " '".$this->db->escape(empty($this->vat_src_code) ? '' : $this->vat_src_code)."',";
|
||||
$sql .= " '".$this->db->escape($this->comments)."',";
|
||||
$sql .= " ".$this->db->escape($this->qty).",";
|
||||
$sql .= " ".$this->db->escape($this->value_unit).",";
|
||||
@ -2675,7 +2683,7 @@ class ExpenseReportLine
|
||||
$sql .= " ".$this->db->escape($this->total_tva).",";
|
||||
$sql .= " ".$this->db->escape($this->total_ttc).",";
|
||||
$sql .= " '".$this->db->idate($this->date)."',";
|
||||
$sql .= " '".$this->db->escape($this->rule_warning_message)."',";
|
||||
$sql .= " ".(empty($this->rule_warning_message) ? 'null' : "'".$this->db->escape($this->rule_warning_message)."'").",";
|
||||
$sql .= " ".$this->db->escape($this->fk_c_exp_tax_cat).",";
|
||||
$sql .= " ".($this->fk_ecm_files > 0 ? $this->fk_ecm_files : 'null');
|
||||
$sql .= ")";
|
||||
|
||||
@ -64,91 +64,99 @@ if (GETPOST('dol_use_jmobile', 'alpha') || !empty($_SESSION['dol_use_jmobile']))
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Validate new password
|
||||
if ($action == 'validatenewpassword' && $username && $passwordhash)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $_GET["username"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
|
||||
} else {
|
||||
if (dol_verifyHash($edituser->pass_temp, $passwordhash))
|
||||
{
|
||||
// Clear session
|
||||
unset($_SESSION['dol_login']);
|
||||
$_SESSION['dol_loginmesg'] = $langs->trans('NewPasswordValidated'); // Save message for the session page
|
||||
|
||||
$newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0);
|
||||
dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
|
||||
header("Location: ".DOL_URL_ROOT.'/');
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
|
||||
}
|
||||
}
|
||||
$parameters = array('username' => $username);
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
$message = $hookmanager->error;
|
||||
}
|
||||
// Action modif mot de passe
|
||||
if ($action == 'buildnewpassword' && $username)
|
||||
{
|
||||
$sessionkey = 'dol_antispam_value';
|
||||
$ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
|
||||
|
||||
// Verify code
|
||||
if (!$ok)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
|
||||
} else {
|
||||
$isanemail = preg_match('/@/', $username);
|
||||
if (empty($reshook)) {
|
||||
// Validate new password
|
||||
if ($action == 'validatenewpassword' && $username && $passwordhash)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $_GET["username"]);
|
||||
if ($result < 0)
|
||||
{
|
||||
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
|
||||
} else {
|
||||
if (dol_verifyHash($edituser->pass_temp, $passwordhash))
|
||||
{
|
||||
// Clear session
|
||||
unset($_SESSION['dol_login']);
|
||||
$_SESSION['dol_loginmesg'] = $langs->trans('NewPasswordValidated'); // Save message for the session page
|
||||
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $username, '', 1);
|
||||
if ($result == 0 && $isanemail)
|
||||
{
|
||||
$result = $edituser->fetch('', '', '', 1, -1, $username);
|
||||
}
|
||||
$newpassword = $edituser->setPassword($user, $edituser->pass_temp, 0);
|
||||
dol_syslog("passwordforgotten.php new password for user->id=".$edituser->id." validated in database");
|
||||
header("Location: ".DOL_URL_ROOT.'/');
|
||||
exit;
|
||||
} else {
|
||||
$langs->load("errors");
|
||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Action modif mot de passe
|
||||
if ($action == 'buildnewpassword' && $username)
|
||||
{
|
||||
$sessionkey = 'dol_antispam_value';
|
||||
$ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
|
||||
|
||||
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
||||
{
|
||||
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
|
||||
if (!$isanemail) {
|
||||
$message .= $langs->trans("IfLoginExistPasswordRequestSent");
|
||||
} else {
|
||||
$message .= $langs->trans("IfEmailExistPasswordRequestSent");
|
||||
}
|
||||
$message .= '</div>';
|
||||
$username = '';
|
||||
} else {
|
||||
if (!$edituser->email)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
|
||||
} else {
|
||||
$newpassword = $edituser->setPassword($user, '', 1);
|
||||
if ($newpassword < 0)
|
||||
{
|
||||
// Failed
|
||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
|
||||
} else {
|
||||
// Success
|
||||
if ($edituser->send_password($user, $newpassword, 1) > 0)
|
||||
{
|
||||
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
|
||||
if (!$isanemail) {
|
||||
$message .= $langs->trans("IfLoginExistPasswordRequestSent");
|
||||
} else {
|
||||
$message .= $langs->trans("IfEmailExistPasswordRequestSent");
|
||||
}
|
||||
//$message .= $langs->trans("PasswordChangeRequestSent", $edituser->login, dolObfuscateEmail($edituser->email));
|
||||
$message .= '</div>';
|
||||
$username = '';
|
||||
} else {
|
||||
$message .= '<div class="error">'.$edituser->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Verify code
|
||||
if (!$ok)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans("ErrorBadValueForCode").'</div>';
|
||||
} else {
|
||||
$isanemail = preg_match('/@/', $username);
|
||||
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $username, '', 1);
|
||||
if ($result == 0 && $isanemail)
|
||||
{
|
||||
$result = $edituser->fetch('', '', '', 1, -1, $username);
|
||||
}
|
||||
|
||||
if ($result <= 0 && $edituser->error == 'USERNOTFOUND')
|
||||
{
|
||||
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
|
||||
if (!$isanemail) {
|
||||
$message .= $langs->trans("IfLoginExistPasswordRequestSent");
|
||||
} else {
|
||||
$message .= $langs->trans("IfEmailExistPasswordRequestSent");
|
||||
}
|
||||
$message .= '</div>';
|
||||
$username = '';
|
||||
} else {
|
||||
if (!$edituser->email)
|
||||
{
|
||||
$message = '<div class="error">'.$langs->trans("ErrorLoginHasNoEmail").'</div>';
|
||||
} else {
|
||||
$newpassword = $edituser->setPassword($user, '', 1);
|
||||
if ($newpassword < 0)
|
||||
{
|
||||
// Failed
|
||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
|
||||
} else {
|
||||
// Success
|
||||
if ($edituser->send_password($user, $newpassword, 1) > 0)
|
||||
{
|
||||
$message = '<div class="warning paddingtopbottom'.(empty($conf->global->MAIN_LOGIN_BACKGROUND) ? '' : ' backgroundsemitransparent').'">';
|
||||
if (!$isanemail) {
|
||||
$message .= $langs->trans("IfLoginExistPasswordRequestSent");
|
||||
} else {
|
||||
$message .= $langs->trans("IfEmailExistPasswordRequestSent");
|
||||
}
|
||||
//$message .= $langs->trans("PasswordChangeRequestSent", $edituser->login, dolObfuscateEmail($edituser->email));
|
||||
$message .= '</div>';
|
||||
$username = '';
|
||||
} else {
|
||||
$message .= '<div class="error">'.$edituser->error.'</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -244,7 +244,7 @@ class CategorieTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testCategorieUpdate
|
||||
*
|
||||
* @param Category $localobject Category
|
||||
* @param Categorie $localobject Category
|
||||
* @return int
|
||||
|
||||
* @depends testCategorieFetch
|
||||
@ -269,7 +269,7 @@ class CategorieTest extends PHPUnit\Framework\TestCase
|
||||
/**
|
||||
* testCategorieOther
|
||||
*
|
||||
* @param Category $localobject Category
|
||||
* @param Categorie $localobject Category
|
||||
* @return int
|
||||
*
|
||||
* @depends testCategorieUpdate
|
||||
|
||||
Loading…
Reference in New Issue
Block a user