Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
This commit is contained in:
commit
d02c615f40
26 changed files with 257 additions and 116 deletions
|
|
@ -1182,7 +1182,7 @@ class Adherent extends CommonObject
|
|||
|
||||
if ($result >= 0) {
|
||||
$result = $luser->setPassword($user, $this->pass, 0, 0, 1);
|
||||
if (is_numeric($result) && $result < 0) {
|
||||
if (is_int($result) && $result < 0) {
|
||||
$this->error = $luser->error;
|
||||
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -1590,6 +1590,7 @@ if ($object->id > 0) {
|
|||
|
||||
if (isModEnabled('facture') && $object->status == 1) {
|
||||
if (empty($user->rights->facture->creer)) {
|
||||
$langs->load("bills");
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NotAllowed")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
} else {
|
||||
$langs->loadLangs(array("orders", "bills"));
|
||||
|
|
@ -1602,7 +1603,7 @@ if ($object->id > 0) {
|
|||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("NoOrdersToInvoice")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("AddBill").'</a></div>';
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" title="'.dol_escape_js($langs->trans("ThirdPartyMustBeEditAsCustomer")).'" href="#">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -156,11 +156,11 @@ if (empty($reshook)) {
|
|||
|
||||
if ($result > 0) {
|
||||
$result2 = $nuser->setPassword($user, GETPOST("password"), 0, 0, 1); // Do not use GETPOST(alpha)
|
||||
if ($result2) {
|
||||
$db->commit();
|
||||
} else {
|
||||
if (is_int($result2) && $result2 < 0) {
|
||||
$error = $nuser->error; $errors = $nuser->errors;
|
||||
$db->rollback();
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
} else {
|
||||
$error = $nuser->error; $errors = $nuser->errors;
|
||||
|
|
|
|||
|
|
@ -350,25 +350,23 @@ if (preg_match('/^set(\w+)$/', $action, $reg) && GETPOST('id', 'int') > 0 && !em
|
|||
if ($action == "update_extras" && GETPOST('id', 'int') > 0 && !empty($permissiontoadd)) {
|
||||
$object->fetch(GETPOST('id', 'int'));
|
||||
|
||||
$attributekey = GETPOST('attribute', 'alpha');
|
||||
$attributekeylong = 'options_'.$attributekey;
|
||||
$error = 0;
|
||||
|
||||
if (GETPOSTISSET($attributekeylong.'day') && GETPOSTISSET($attributekeylong.'month') && GETPOSTISSET($attributekeylong.'year')) {
|
||||
// This is properties of a date
|
||||
$object->array_options['options_'.$attributekey] = dol_mktime(GETPOST($attributekeylong.'hour', 'int'), GETPOST($attributekeylong.'min', 'int'), GETPOST($attributekeylong.'sec', 'int'), GETPOST($attributekeylong.'month', 'int'), GETPOST($attributekeylong.'day', 'int'), GETPOST($attributekeylong.'year', 'int'));
|
||||
//var_dump(dol_print_date($object->array_options['options_'.$attributekey]));exit;
|
||||
} else {
|
||||
$object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, 'alpha');
|
||||
}
|
||||
|
||||
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
$action = 'view';
|
||||
} else {
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
setEventMessages($extrafields->error, $object->errors, 'errors');
|
||||
$action = 'edit_extras';
|
||||
} else {
|
||||
$result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user);
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
|
||||
$action = 'view';
|
||||
} else {
|
||||
$error++;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = 'edit_extras';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -565,8 +565,8 @@ if (!$error && $massaction == 'confirm_presend') {
|
|||
$resaction .= '<div class="error">'.$mailfile->error.'</div>';
|
||||
} else {
|
||||
$result = $mailfile->sendfile();
|
||||
if ($result) {
|
||||
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'<br>'; // Must not contain "
|
||||
if ($result > 0) {
|
||||
$resaction .= $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($mailfile->addr_from, 2), $mailfile->getValidAddress($mailfile->addr_to, 2)).'<br>'; // Must not contain "
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ class HookManager
|
|||
$actionclassinstance->error = 0;
|
||||
$actionclassinstance->errors = array();
|
||||
|
||||
if (getDolGlobalInt('MAIN_DEBUG_HOOK')) {
|
||||
if (getDolGlobalInt('MAIN_HOOK_DEBUG')) {
|
||||
// This his too much verbose, enabled if const enabled only
|
||||
dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".get_class($actionclassinstance).'->'.$method.", context=".$context.", module=".$module.", action=".$action.((is_object($object) && property_exists($object, 'id')) ? ', object id='.$object->id : '').((is_object($object) && property_exists($object, 'element')) ? ', object element='.$object->element : ''), LOG_DEBUG);
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ class HookManager
|
|||
continue;
|
||||
}
|
||||
|
||||
if (getDolGlobalInt('MAIN_DEBUG_HOOK')) {
|
||||
if (getDolGlobalInt('MAIN_HOOK_DEBUG')) {
|
||||
dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ class FormOther
|
|||
public function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
$return = '<select class="flat" name="'.$htmlname.'" '.($disabled ? 'disabled' : '').'>';
|
||||
$return = '<select class="flat maxwidth75" name="'.$htmlname.'" '.($disabled ? 'disabled' : '').'>';
|
||||
if ($showempty) {
|
||||
$return .= '<option value="-1"'.(($selected == -1 || $selected == '') ? ' selected' : '').'> </option>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ class FormProjets
|
|||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus);
|
||||
$out .= $comboenhancement;
|
||||
$morecss .= ' minwidth150';
|
||||
$morecss .= ' minwidth150imp';
|
||||
}
|
||||
|
||||
if (empty($option_only)) {
|
||||
|
|
|
|||
|
|
@ -190,7 +190,8 @@ interface Database
|
|||
public function escape($stringtoencode);
|
||||
|
||||
/**
|
||||
* Escape a string to insert data into a like
|
||||
* Escape a string to insert data into a like.
|
||||
* Can be used this way: LIKE '%".dbhandler->escapeforlike(dbhandler->escape(...))."%'
|
||||
*
|
||||
* @param string $stringtoencode String to escape
|
||||
* @return string String escaped
|
||||
|
|
|
|||
|
|
@ -238,9 +238,10 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
|
|||
$request = curl_getinfo($ch, CURLINFO_HEADER_OUT); // Reading of request must be done after sending request
|
||||
|
||||
dol_syslog("getURLContent request=".$request);
|
||||
if (!empty($conf->global->MAIN_GETURLCONTENT_OUTPUT_RESPONSE)) {
|
||||
if (getDolGlobalInt('MAIN_CURL_DEBUG')) {
|
||||
// This may contains binary data, so we dont output reponse by default.
|
||||
dol_syslog("getURLContent response =".$response);
|
||||
dol_syslog("getURLContent request=".$request, LOG_DEBUG, 0, '_curl');
|
||||
dol_syslog("getURLContent response =".$response, LOG_DEBUG, 0, '_curl');
|
||||
}
|
||||
dol_syslog("getURLContent response size=".strlen($response)); // This may contains binary data, so we dont output it
|
||||
|
||||
|
|
|
|||
|
|
@ -1298,8 +1298,8 @@ class ExpenseReport extends CommonObject
|
|||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql .= " fk_statut = ".self::STATUS_VALIDATED.",";
|
||||
$sql .= " date_valid='".$this->db->idate($this->date_valid)."',";
|
||||
$sql .= " fk_user_valid = ".$user->id;
|
||||
$sql .= " date_valid = '".$this->db->idate($this->date_valid)."',";
|
||||
$sql .= " fk_user_valid = ".((int) $user->id);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
|
@ -1322,7 +1322,7 @@ class ExpenseReport extends CommonObject
|
|||
|
||||
// Now we rename also files into index
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'expensereport/".$this->db->escape($this->newref)."'";
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expensereport/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
|
||||
$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'expensereport/".$this->db->escape($this->ref)."' AND entity = ".((int) $this->entity);
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
$error++; $this->error = $this->db->lasterror();
|
||||
|
|
@ -1331,15 +1331,15 @@ class ExpenseReport extends CommonObject
|
|||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->expensereport->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
|
||||
$dirsource = $conf->expensereport->multidir_output[$this->entity].'/'.$oldref;
|
||||
$dirdest = $conf->expensereport->multidir_output[$this->entity].'/'.$newref;
|
||||
if (!$error && file_exists($dirsource)) {
|
||||
dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest)) {
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles = dol_dir_list($conf->expensereport->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
$listoffiles = dol_dir_list($dirdest, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach ($listoffiles as $fileentry) {
|
||||
$dirsource = $fileentry['name'];
|
||||
$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
|
||||
|
|
|
|||
|
|
@ -1378,6 +1378,7 @@ if (empty($reshook)) {
|
|||
);
|
||||
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,3 +95,5 @@ NewPartnershipRequest=New partnership request
|
|||
NewPartnershipRequestDesc=This form allows you to request to be part of one of our partnership program. If you need help to fill this form, please contact by email <b>%s</b>.
|
||||
ThisUrlMustContainsAtLeastOneLinkToWebsite=This page must contains at least one link to one of the following domain: %s
|
||||
|
||||
IPOfApplicant=IP of applicant
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ class MyObject extends CommonObject
|
|||
} elseif (strpos($value, '%') === false) {
|
||||
$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
|
||||
} else {
|
||||
$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
|
||||
$sqlwhere[] = $key." LIKE '%".$this->db->escapeforlike($this->db->escape($value))."%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -925,6 +925,9 @@ class MyObject extends CommonObject
|
|||
if (property_exists($this, 'label')) {
|
||||
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
|
||||
}
|
||||
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
|
||||
$return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
|
||||
}
|
||||
if (property_exists($this, 'amount')) {
|
||||
$return .= '<br>';
|
||||
$return .= '<span class="info-box-label amount">'.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).'</span>';
|
||||
|
|
|
|||
|
|
@ -700,6 +700,20 @@ while ($i < $imaxinloop) {
|
|||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
/*
|
||||
$object->thirdparty = null;
|
||||
if ($obj->fk_soc > 0) {
|
||||
if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
|
||||
$companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
|
||||
} else {
|
||||
$companyobj = new Societe($db);
|
||||
$companyobj->fetch($obj->fk_soc);
|
||||
$conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
|
||||
}
|
||||
|
||||
$object->thirdparty = $companyobj;
|
||||
}*/
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
|
||||
|
|
@ -713,6 +727,7 @@ while ($i < $imaxinloop) {
|
|||
$selected = 1;
|
||||
}
|
||||
}
|
||||
//print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => $selected));
|
||||
print $object->getKanbanView('', array('selected' => $selected));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -120,12 +120,12 @@ class Partnership extends CommonObject
|
|||
'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
|
||||
'date_partnership_start' => array('type'=>'date', 'label'=>'DatePartnershipStart', 'enabled'=>'1', 'position'=>52, 'notnull'=>1, 'visible'=>1,),
|
||||
'date_partnership_end' => array('type'=>'date', 'label'=>'DatePartnershipEnd', 'enabled'=>'1', 'position'=>53, 'notnull'=>0, 'visible'=>1,),
|
||||
'url_to_check' => array('type'=>'url', 'label'=>'UrlToCheck', 'enabled'=>'1', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax150'),
|
||||
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'1', 'position'=>71, 'notnull'=>0, 'visible'=>-2, 'default'=>'0',),
|
||||
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'1', 'position'=>72, 'notnull'=>0, 'visible'=>-2,),
|
||||
'url_to_check' => array('type'=>'url', 'label'=>'UrlToCheck', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>70, 'notnull'=>0, 'visible'=>-1, 'csslist'=>'tdoverflowmax150'),
|
||||
'count_last_url_check_error' => array('type'=>'integer', 'label'=>'CountLastUrlCheckError', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>71, 'notnull'=>0, 'visible'=>-4, 'default'=>'0',),
|
||||
'last_check_backlink' => array('type'=>'datetime', 'label'=>'LastCheckBacklink', 'enabled'=>'getDolGlobalString("PARTNERSHIP_BACKLINKS_TO_CHECK")', 'position'=>72, 'notnull'=>0, 'visible'=>-4,),
|
||||
'reason_decline_or_cancel' => array('type'=>'text', 'label'=>'ReasonDeclineOrCancel', 'enabled'=>'1', 'position'=>73, 'notnull'=>0, 'visible'=>-2,),
|
||||
'ip' => array('type'=>'ip', 'label'=>'Ip', 'enabled'=>'1', 'position'=>74, 'notnull'=>0, 'visible'=>-2,),
|
||||
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Accepted', '2'=>'Refused', '8'=>'Suspended', '9'=>'Terminated'),),
|
||||
'ip' => array('type'=>'ip', 'label'=>'IPOfApplicant', 'enabled'=>'1', 'position'=>74, 'notnull'=>0, 'visible'=>-2,),
|
||||
'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>2, 'default'=>'0', 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '2'=>'Approved', '3'=>'Refused', '9'=>'Terminated'),),
|
||||
);
|
||||
public $rowid;
|
||||
public $ref;
|
||||
|
|
@ -1309,8 +1309,6 @@ class Partnership extends CommonObject
|
|||
*/
|
||||
public function doScheduledJob()
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
|
||||
|
||||
$error = 0;
|
||||
|
|
@ -1319,7 +1317,7 @@ class Partnership extends CommonObject
|
|||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$now = dol_now();
|
||||
//$now = dol_now();
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
|
|
@ -1352,6 +1350,9 @@ class Partnership extends CommonObject
|
|||
if (property_exists($this, 'label')) {
|
||||
$return .= ' <div class="inline-block opacitymedium valignmiddle tdoverflowmax100">'.$this->label.'</div>';
|
||||
}
|
||||
if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) {
|
||||
$return .= '<br><div class="info-box-ref tdoverflowmax150">'.$this->thirdparty->getNomUrl(1).'</div>';
|
||||
}
|
||||
if (method_exists($this, 'getLibStatut')) {
|
||||
$return .= '<br><div class="info-box-status margintoponly">'.$this->getLibStatut(3).'</div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class PartnershipUtils
|
|||
$partnershipsprocessed[$object->id] = $object->ref;
|
||||
|
||||
// Send an email to inform member
|
||||
$labeltemplate = '(SendingEmailOnPartnershipCanceled)';
|
||||
$labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_AUTO_CANCEL', 'SendingEmailOnPartnershipCanceled').')';
|
||||
|
||||
dol_syslog("Now we will send an email to member id=".$object->fk_member." with label ".$labeltemplate);
|
||||
|
||||
|
|
@ -175,16 +175,59 @@ class PartnershipUtils
|
|||
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
|
||||
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
|
||||
// We are in the case of autocancellation subscription because of missing backlink
|
||||
$fk_partner = $object->fk_member;
|
||||
|
||||
$adherent = new Adherent($this->db);
|
||||
$adherent->fetch($object->fk_member);
|
||||
$to = $adherent->email;
|
||||
$sendto = $adherent->email;
|
||||
|
||||
$trackid = 'par'.$object->id;
|
||||
$sendcontext = 'standard';
|
||||
|
||||
$cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
|
||||
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result || $cmail->error) {
|
||||
|
||||
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
|
||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||
$this->errors[] = $cmail->error;
|
||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||
} else {
|
||||
// Initialisation of datas of object to call trigger
|
||||
if (is_object($object)) {
|
||||
$actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$attachedfiles = array();
|
||||
|
||||
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
|
||||
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
|
||||
if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) {
|
||||
$object->actionmsg2 = $subject; // Short text
|
||||
}
|
||||
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
if (is_array($attachedfiles) && count($attachedfiles) > 0) {
|
||||
$object->attachedfiles = $attachedfiles;
|
||||
}
|
||||
|
||||
$object->email_from = $from;
|
||||
$object->email_subject = $subject;
|
||||
$object->email_to = $sendto;
|
||||
$object->email_subject = $subject;
|
||||
|
||||
$triggersendname = 'PARTNERSHIP_SENTBYMAIL';
|
||||
// Call of triggers (you should have set $triggersendname to execute trigger)
|
||||
if (!empty($triggersendname)) {
|
||||
$result = $object->call_trigger($triggersendname, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// End call of triggers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -215,16 +258,19 @@ class PartnershipUtils
|
|||
*
|
||||
* CAN BE A CRON TASK
|
||||
*
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
* @param int $maxpercall Max per call
|
||||
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
public function doWarningOfPartnershipIfDolibarrBacklinkNotfound()
|
||||
public function doWarningOfPartnershipIfDolibarrBacklinkNotfound($maxpercall = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
|
||||
$managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR');
|
||||
|
||||
$partnership = new Partnership($this->db);
|
||||
$MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL) ? 10 : $conf->global->PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL); // Limit to 10 per call
|
||||
if (empty($maxpercall)) {
|
||||
$maxpercall = getDolGlobalInt('PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL', 10);
|
||||
}
|
||||
|
||||
$langs->loadLangs(array("partnership", "member"));
|
||||
|
||||
|
|
@ -236,23 +282,23 @@ class PartnershipUtils
|
|||
$emailnotfound = '';
|
||||
$websitenotfound = '';
|
||||
|
||||
$gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
|
||||
/*$gracedelay = getDolGlobalInt('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL');
|
||||
if ($gracedelay < 1) {
|
||||
$this->error = 'BadValueForDelayBeforeCancelCheckSetup';
|
||||
return -1;
|
||||
}
|
||||
}*/
|
||||
|
||||
$fk_partner = ($managedfor == 'member') ? 'fk_member' : 'fk_soc';
|
||||
|
||||
dol_syslog(get_class($this)."::doWarningOfPartnershipIfDolibarrBacklinkNotfound Warning of partnership");
|
||||
|
||||
$now = dol_now();
|
||||
$datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd');
|
||||
//$datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd');
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "SELECT p.rowid, p.status, p.".$fk_partner;
|
||||
$sql .= ", p.last_check_backlink";
|
||||
$sql .= ", p.url_to_check, p.last_check_backlink";
|
||||
$sql .= ', partner.url, partner.email';
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."partnership as p";
|
||||
if ($managedfor == 'member') {
|
||||
|
|
@ -276,10 +322,12 @@ class PartnershipUtils
|
|||
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($obj) {
|
||||
if (!empty($partnershipsprocessed[$obj->rowid])) continue;
|
||||
if (!empty($partnershipsprocessed[$obj->rowid])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($somethingdoneonpartnership >= $MAXPERCALL) {
|
||||
dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING);
|
||||
if ($somethingdoneonpartnership >= $maxpercall) {
|
||||
dol_syslog("We reach the limit of ".$maxpercall." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -294,7 +342,7 @@ class PartnershipUtils
|
|||
$fk_partner = $object->fk_soc;
|
||||
}
|
||||
|
||||
$website = $obj->url;
|
||||
$website = (empty($obj->url_to_check) ? $obj->url : $obj->url_to_check);
|
||||
|
||||
if (empty($website)) {
|
||||
$websitenotfound .= ($websitenotfound ? ', ' : '').'Website not found for id="'.$fk_partner.'"'."\n";
|
||||
|
|
@ -305,51 +353,101 @@ class PartnershipUtils
|
|||
if (!$backlinkfound) {
|
||||
$tmpcount = $object->count_last_url_check_error + 1;
|
||||
|
||||
if ($tmpcount > 2 && $tmpcount <= 4) { // Send Warning Email
|
||||
if (!empty($obj->email)) {
|
||||
$emailnotfound .= ($emailnotfound ? ', ' : '').'Email not found for id="'.$fk_partner.'"'."\n";
|
||||
} else {
|
||||
$labeltemplate = '(SendingEmailOnPartnershipWillSoonBeCanceled)';
|
||||
$nbminbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MIN_BACKLINK_ERROR_FOR_CANCEL', 3);
|
||||
$nbmaxbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MAX_BACKLINK_ERROR_FOR_CANCEL', $nbminbacklinkerrorforcancel + 2);
|
||||
|
||||
dol_syslog("Now we will send an email to partner id=".$fk_partner." with label ".$labeltemplate);
|
||||
// If $nbminbacklinkerrorforemail = 0, no autoemail
|
||||
if ($nbminbacklinkerrorforcancel > 0) {
|
||||
if ($tmpcount > $nbminbacklinkerrorforcancel && $tmpcount <= $nbmaxbacklinkerrorforcancel) { // Send Warning Email
|
||||
if (!empty($obj->email)) {
|
||||
$emailnotfound .= ($emailnotfound ? ', ' : '').'Email not found for id="'.$fk_partner.'"'."\n";
|
||||
} else {
|
||||
// Example: 'SendingEmailOnPartnershipWillSoonBeCanceled'
|
||||
$labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_NO_LINK', 'SendingEmailOnPartnershipWillSoonBeCanceled').')';
|
||||
|
||||
// Send deployment email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
dol_syslog("Now we will send an email to partner id=".$fk_partner." with label ".$labeltemplate);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->loadLangs(array('main', 'member', 'partnership'));
|
||||
}
|
||||
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
|
||||
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
|
||||
$to = $obj->email;
|
||||
|
||||
$cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1);
|
||||
$result = $cmail->sendfile();
|
||||
if (!$result || $cmail->error) {
|
||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||
$this->errors[] = $cmail->error;
|
||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||
// Send deployment email
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$formmail = new FormMail($this->db);
|
||||
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
|
||||
if (!empty($newlang)) {
|
||||
$outputlangs = new Translate("", $conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
$outputlangs->loadLangs(array('main', 'member', 'partnership'));
|
||||
}
|
||||
|
||||
$arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
|
||||
|
||||
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
|
||||
complete_substitutions_array($substitutionarray, $outputlangs, $object);
|
||||
|
||||
$subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
|
||||
$msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
|
||||
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
|
||||
$sendto = $obj->email;
|
||||
|
||||
$trackid = 'par'.$object->id;
|
||||
$sendcontext = 'standard';
|
||||
|
||||
$cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
|
||||
|
||||
$result = $cmail->sendfile();
|
||||
|
||||
if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
|
||||
$erroremail .= ($erroremail ? ', ' : '').$cmail->error;
|
||||
$this->errors[] = $cmail->error;
|
||||
if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
|
||||
} else {
|
||||
// Initialisation of datas of object to call trigger
|
||||
if (is_object($object)) {
|
||||
$actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
|
||||
$attachedfiles = array();
|
||||
|
||||
if ($managedfor != 'member') {
|
||||
$object->socid = $fk_partner; // To link to a company
|
||||
}
|
||||
$object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
|
||||
$object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
|
||||
$object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
|
||||
if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) {
|
||||
$object->actionmsg2 = $subject; // Short text
|
||||
}
|
||||
|
||||
$object->trackid = $trackid;
|
||||
$object->fk_element = $object->id;
|
||||
$object->elementtype = $object->element;
|
||||
if (is_array($attachedfiles) && count($attachedfiles) > 0) {
|
||||
$object->attachedfiles = $attachedfiles;
|
||||
}
|
||||
|
||||
$object->email_from = $from;
|
||||
$object->email_subject = $subject;
|
||||
$object->email_to = $sendto;
|
||||
$object->email_subject = $subject;
|
||||
|
||||
$triggersendname = 'PARTNERSHIP_SENTBYMAIL';
|
||||
// Call of triggers (you should have set $triggersendname to execute trigger)
|
||||
if (!empty($triggersendname)) {
|
||||
$result = $object->call_trigger($triggersendname, $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
// End call of triggers
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($tmpcount > $nbmaxbacklinkerrorforcancel) { // Cancel Partnership
|
||||
$object->status = $object::STATUS_CANCELED;
|
||||
$object->reason_decline_or_cancel = $langs->trans('BacklinkNotFoundOnPartnerWebsite');
|
||||
}
|
||||
} elseif ($tmpcount > 4) { // Cancel Partnership
|
||||
$object->status = $object::STATUS_CANCELED;
|
||||
$object->reason_decline_or_cancel = $langs->trans('BacklinkNotFoundOnPartnerWebsite');
|
||||
}
|
||||
|
||||
$object->count_last_url_check_error = $tmpcount;
|
||||
|
|
@ -360,7 +458,7 @@ class PartnershipUtils
|
|||
|
||||
$partnershipsprocessed[$object->id] = $object->ref;
|
||||
|
||||
$object->last_check_backlink = $this->db->idate($now);
|
||||
$object->last_check_backlink = $now;
|
||||
|
||||
$object->update($user);
|
||||
}
|
||||
|
|
@ -394,7 +492,7 @@ class PartnershipUtils
|
|||
*/
|
||||
private function checkDolibarrBacklink($website = null)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
global $conf;
|
||||
|
||||
$found = 0;
|
||||
$error = 0;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
|
||||
|
|
@ -286,6 +287,7 @@ if (empty($reshook)) {
|
|||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
|
|
@ -863,13 +865,26 @@ while ($i < $imaxinloop) {
|
|||
// Store properties in $object
|
||||
$object->setVarsFromFetchObj($obj);
|
||||
|
||||
$object->thirdparty = null;
|
||||
if ($obj->fk_soc > 0) {
|
||||
if (!empty($conf->cache['thirdparty'][$obj->fk_soc])) {
|
||||
$companyobj = $conf->cache['thirdparty'][$obj->fk_soc];
|
||||
} else {
|
||||
$companyobj = new Societe($db);
|
||||
$companyobj->fetch($obj->fk_soc);
|
||||
$conf->cache['thirdparty'][$obj->fk_soc] = $companyobj;
|
||||
}
|
||||
|
||||
$object->thirdparty = $companyobj;
|
||||
}
|
||||
|
||||
if ($mode == 'kanban') {
|
||||
if ($i == 0) {
|
||||
print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
|
||||
print '<div class="box-flex-container kanban">';
|
||||
}
|
||||
// Output Kanban
|
||||
print $object->getKanbanView('', array('selected' => in_array($object->id, $arrayofselected)));
|
||||
print $object->getKanbanView('', array('thirdparty'=>$object->thirdparty, 'selected' => in_array($object->id, $arrayofselected)));
|
||||
if ($i == ($imaxinloop - 1)) {
|
||||
print '</div>';
|
||||
print '</td></tr>';
|
||||
|
|
|
|||
|
|
@ -729,6 +729,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
|
||||
print dol_get_fiche_head('');
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$defaultref = '';
|
||||
|
|
@ -755,7 +756,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
|
||||
// Label
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td>';
|
||||
print '<input type="text" name="label" autofocus class="minwidth500 maxwidthonsmartphone" value="'.$label.'">';
|
||||
print '<input type="text" name="label" autofocus class="minwidth500" value="'.$label.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
|
|
@ -774,12 +775,12 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
print '<tr><td>'.$langs->trans("AffectedTo").'</td><td>';
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
if (is_array($contactsofproject) && count($contactsofproject)) {
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
} else {
|
||||
if ((isset($projectid) && $projectid > 0) || $object->id > 0) {
|
||||
print '<span class="opacitymedium">'.$langs->trans("NoUserAssignedToTheProject").'</span>';
|
||||
} else {
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth500 widthcentpercentminusx');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
|
@ -819,7 +820,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) {
|
||||
$nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT;
|
||||
}
|
||||
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows);
|
||||
$doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows, '90%');
|
||||
print $doleditor->Create();
|
||||
|
||||
print '</td></tr>';
|
||||
|
|
@ -839,6 +840,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third
|
|||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
|
|
|||
|
|
@ -1790,7 +1790,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
|
|||
if ($projectstatic->public) {
|
||||
$contactsofproject = array();
|
||||
}
|
||||
print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
||||
print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'minwidth150imp maxwidth200');
|
||||
} else {
|
||||
if ($nboftasks) {
|
||||
print img_error($langs->trans('FirstAddRessourceToAllocateTime')) . ' ' . $langs->trans('FirstAddRessourceToAllocateTime');
|
||||
|
|
|
|||
|
|
@ -59,3 +59,5 @@ if (!GETPOST('transkey', 'alphanohtml') && !GETPOST('transphrase', 'alphanohtml'
|
|||
print dol_escape_htmltag($langs->trans(GETPOST('transkey', 'alphanohtml')));
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
if (!empty($user->rights->salaries->read) && $object->fk_user > 0 && in_array($object->fk_user, $childids)) {
|
||||
$canread = 1;
|
||||
}
|
||||
|
||||
if (!$canread) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -351,7 +351,7 @@ if (empty($reshook)) {
|
|||
if (GETPOST('password', 'none')) {
|
||||
$resPass = $object->setPassword($user, GETPOST('password', 'none'));
|
||||
}
|
||||
if ($resPass < 0) {
|
||||
if (is_int($resPass) && $resPass < 0) {
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
@ -664,7 +664,7 @@ if (empty($reshook)) {
|
|||
$object->oldcopy = clone $object;
|
||||
|
||||
$ret = $object->setPassword($user, GETPOST("password", "none"));
|
||||
if ($ret < 0) {
|
||||
if (is_int($ret) && $ret < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
|
@ -679,7 +679,7 @@ if (empty($reshook)) {
|
|||
$object->fetch($id);
|
||||
|
||||
$newpassword = $object->setPassword($user, ''); // This will generate a new password
|
||||
if ($newpassword < 0) {
|
||||
if (is_int($newpassword) && $newpassword < 0) {
|
||||
// Echec
|
||||
setEventMessages($langs->trans("ErrorFailedToSetNewPassword"), null, 'errors');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1772,7 +1772,7 @@ class User extends CommonObject
|
|||
if ($result > 0) {
|
||||
if (!empty($this->pass)) { // If a clear password was received (this situation should not happen anymore now), we use it to save it into database
|
||||
$newpass = $this->setPassword($user, $this->pass);
|
||||
if (is_numeric($newpass) && $newpass < 0) {
|
||||
if (is_int($newpass) && $newpass < 0) {
|
||||
$result = -2;
|
||||
}
|
||||
} elseif (!empty($this->pass_crypted)) { // If a crypted password is already known, we save it directly into database because the previous create did not save it.
|
||||
|
|
@ -2047,7 +2047,7 @@ class User extends CommonObject
|
|||
if ($this->pass != $this->pass_indatabase && !dol_verifyHash($this->pass, $this->pass_indatabase_crypted)) {
|
||||
// If a new value for password is set and different than the one crypted into database
|
||||
$result = $this->setPassword($user, $this->pass, 0, $notrigger, $nosyncmemberpass, 0, 1);
|
||||
if (is_numeric($result) && $result < 0) {
|
||||
if (is_int($result) && $result < 0) {
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
|
@ -2339,7 +2339,7 @@ class User extends CommonObject
|
|||
|
||||
if ($result >= 0) {
|
||||
$result = $adh->setPassword($user, $this->pass, (empty($conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1), 1); // Cryptage non gere dans module adherent
|
||||
if (is_numeric($result) && $result < 0) {
|
||||
if (is_int($result) && $result < 0) {
|
||||
$this->error = $adh->error;
|
||||
dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR);
|
||||
$error++;
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ if (empty($reshook)) {
|
|||
$message .= $messagewarning;
|
||||
} else {
|
||||
$newpassword = $edituser->setPassword($user, '', 1);
|
||||
if (is_numeric($newpassword) && $newpassword < 0) {
|
||||
if (is_int($newpassword) && $newpassword < 0) {
|
||||
// Technical failure
|
||||
$message = '<div class="error">'.$langs->trans("ErrorFailedToChangePassword").'</div>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -709,7 +709,7 @@ function setUserPassword($authentication, $shortuser)
|
|||
$res = $userstat->fetch('', $shortuser['login']);
|
||||
if ($res) {
|
||||
$res = $userstat->setPassword($userstat, $shortuser['password']);
|
||||
if (is_numeric($res) && $res < 0) {
|
||||
if (is_int($res) && $res < 0) {
|
||||
$error++;
|
||||
$errorcode = 'NOT_MODIFIED'; $errorlabel = 'Error when changing password';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue