mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge branch '17.0' of git@github.com:Dolibarr/dolibarr.git into 18.0
This commit is contained in:
commit
8d254e341b
|
|
@ -1589,6 +1589,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"));
|
||||
|
|
@ -1601,7 +1602,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>';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -293,8 +293,6 @@ class Proposals extends DolibarrApi
|
|||
*/
|
||||
public function getLines($id, $sqlfilters = '')
|
||||
{
|
||||
$filters = "";
|
||||
|
||||
if (!DolibarrApiAccess::$user->hasRight('propal', 'lire')) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
|
@ -308,6 +306,7 @@ class Proposals extends DolibarrApi
|
|||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$sql = '';
|
||||
if (!empty($sqlfilters)) {
|
||||
$errormessage = '';
|
||||
$sql = forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user