mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code
This commit is contained in:
parent
2c5809e77b
commit
1f38e54e78
|
|
@ -1158,7 +1158,7 @@ if ($mode == 'marketplace') {
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP)) {
|
|||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
//session_destroy();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class Login
|
|||
// Renew the hash
|
||||
if (empty($tmpuser->api_key) || $reset) {
|
||||
$tmpuser->getrights();
|
||||
if (empty($tmpuser->rights->user->self->creer)) {
|
||||
if (!$tmpuser->hasRight('user', 'self', 'creer')) {
|
||||
if (empty($tmpuser->api_key)) {
|
||||
throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token');
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP)) {
|
|||
$allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP);
|
||||
$ipremote = getUserRemoteIP();
|
||||
if (!in_array($ipremote, $allowedip)) {
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
|
||||
dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP'));
|
||||
print 'APIs are not allowed from the IP '.$ipremote;
|
||||
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
|
||||
//session_destroy();
|
||||
|
|
|
|||
|
|
@ -1525,7 +1525,7 @@ class Asset extends CommonObject
|
|||
if (!empty($conf->global->ASSET_ASSET_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->ASSET_ASSET_ADDON.".php";
|
||||
$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
|
||||
$classname = $conf->global->ASSET_ASSET_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
|
|||
echo '<td class="linkedcol-ref" align="center">'.$objectlink->label.'</td>';
|
||||
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_start, 'day').'</td>';
|
||||
echo '<td class="linkedcol-amount right">';
|
||||
if ($user->rights->asset->read) {
|
||||
if ($user->hasRight('asset', 'read')) {
|
||||
$total = $total + $objectlink->acquisition_value_ht;
|
||||
echo price($objectlink->acquisition_value_ht);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ jQuery(document).ready(function() {
|
|||
print '<input id="fillmanually" type="radio" '.((!GETPOST("selectorforbarcode") || GETPOST("selectorforbarcode") == 'fillmanually') ? 'checked ' : '').'name="selectorforbarcode" value="fillmanually" class="radiobarcodeselect"><label for="fillmanually"> '.$langs->trans("FillBarCodeTypeAndValueManually").'</label>';
|
||||
print '<br>';
|
||||
|
||||
if (!empty($user->rights->produit->lire) || $user->hasRight('service', 'lire')) {
|
||||
if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
|
||||
print '<input id="fillfromproduct" type="radio" '.((GETPOST("selectorforbarcode") == 'fillfromproduct') ? 'checked ' : '').'name="selectorforbarcode" value="fillfromproduct" class="radiobarcodeselect"><label for="fillfromproduct"> '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'</label>';
|
||||
print '<br>';
|
||||
print '<div class="showforproductselector">';
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
|||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">';
|
||||
print '<input type="hidden" name="withtab" value="'.$withtab.'">';
|
||||
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
|
||||
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="' . getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL').'" size="40" />';
|
||||
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ if (is_array($bocks)) {
|
|||
$hash = $auth->getBlockchainHash();
|
||||
|
||||
// Call external authority
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash);
|
||||
$url = getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL') . '/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash);
|
||||
|
||||
$resarray = getURLContent($url, 'GET', '', 1, array(), array(), 2);
|
||||
$res = $resarray['content'];
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ class BlockedLogAuthority
|
|||
|
||||
if (is_array($blocks)) {
|
||||
foreach ($blocks as &$block) {
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
||||
$url = getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL') . '/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
||||
|
||||
$res = getURLContent($url);
|
||||
echo $block->signature.' '.$url.' '.$res['content'].'<br>';
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ if (empty($reshook)) {
|
|||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
|
||||
// Add line
|
||||
if ($action == 'addline' && $user->rights->bom->write) {
|
||||
if ($action == 'addline' && $user->hasRight('bom', 'write')) {
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
$predef = '';
|
||||
|
|
@ -235,7 +235,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Update line
|
||||
if ($action == 'updateline' && $user->rights->bom->write) {
|
||||
if ($action == 'updateline' && $user->hasRight('bom', 'write')) {
|
||||
$langs->load('errors');
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -732,7 +732,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
|||
|
||||
// Create MO
|
||||
if (isModEnabled('mrp')) {
|
||||
if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) {
|
||||
if ($object->status == $object::STATUS_VALIDATED && $user->hasRight('mrp', 'write')) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/mrp/mo_card.php?action=create&fk_bom='.$object->id.'&token='.newToken().'&backtopageforcancel='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'">'.$langs->trans("CreateMO").'</a>'."\n";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -501,7 +501,7 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->hasRight('bom', 'write'));
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -875,7 +875,7 @@ class BOM extends CommonObject
|
|||
if (!empty($conf->global->BOM_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->BOM_ADDON.".php";
|
||||
$file = getDolGlobalString('BOM_ADDON') . ".php";
|
||||
$classname = $conf->global->BOM_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
|
|||
|
|
@ -951,7 +951,7 @@ class Availabilities extends CommonObject
|
|||
if (!empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->BOOKCAL_AVAILABILITIES_ADDON.".php";
|
||||
$file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON') . ".php";
|
||||
$classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ print "</tr>\n";
|
|||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("NbOfBoomarkToShow").'</td><td>';
|
||||
print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="'.$conf->global->BOOKMARKS_SHOW_IN_MENU.'">';
|
||||
print '<input size="3" type="text" name="BOOKMARKS_SHOW_IN_MENU" value="' . getDolGlobalString('BOOKMARKS_SHOW_IN_MENU').'">';
|
||||
print '</td></tr>';
|
||||
print '</table><br><div class="center"><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></div></form>';
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ function printDropdownBookmarksList()
|
|||
|
||||
// Url to go on create new bookmark page
|
||||
$newbtn = '';
|
||||
if (!empty($user->rights->bookmark->creer)) {
|
||||
if ($user->hasRight('bookmark', 'creer')) {
|
||||
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
|
||||
//$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url);
|
||||
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
|
|
@ -127,10 +127,10 @@ function printDropdownBookmarksList()
|
|||
//$searchForm .= '<option>--'.$langs->trans("Bookmarks").'--</option>';
|
||||
$searchForm .= '<option hidden value="listbookmarks" class="optiongrey" selected rel="'.DOL_URL_ROOT.'/bookmarks/list.php">'.$langs->trans('Bookmarks').'</option>';
|
||||
$searchForm .= '<option value="listbookmark" class="optionblue" rel="'.dol_escape_htmltag(DOL_URL_ROOT.'/bookmarks/list.php').'" ';
|
||||
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||
$searchForm .= dol_escape_htmltag($user->rights->bookmark->creer ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
$searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->hasRight('bookmark', 'creer') ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">';
|
||||
$searchForm .= dol_escape_htmltag($user->hasRight('bookmark', 'creer') ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...</option>';
|
||||
// Url to go on create new bookmark page
|
||||
if (!empty($user->rights->bookmark->creer)) {
|
||||
if ($user->hasRight('bookmark', 'creer')) {
|
||||
if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) {
|
||||
$urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url);
|
||||
$searchForm .= '<option value="newbookmark" class="optionblue" rel="'.dol_escape_htmltag($urltoadd).'"';
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ $error = 0;
|
|||
*/
|
||||
|
||||
// Add action
|
||||
if ($action == 'add' && $user->rights->categorie->creer) {
|
||||
if ($action == 'add' && $user->hasRight('categorie', 'creer')) {
|
||||
// Action add a category
|
||||
if ($cancel) {
|
||||
if ($urlfrom) {
|
||||
|
|
@ -167,7 +167,7 @@ if ($action == 'add' && $user->rights->categorie->creer) {
|
|||
}
|
||||
|
||||
// Confirm action
|
||||
if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->creer) {
|
||||
if (($action == 'add' || $action == 'confirmed') && $user->hasRight('categorie', 'creer')) {
|
||||
// Action confirmation of creation category
|
||||
if ($action == 'confirmed') {
|
||||
if ($urlfrom) {
|
||||
|
|
@ -213,7 +213,7 @@ $help_url = 'EN:Module_Categories|FR:Module_Catégories|DE:Modul_Kategorien';
|
|||
|
||||
llxHeader("", $langs->trans("Categories"), $help_url);
|
||||
|
||||
if ($user->rights->categorie->creer) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
// Create or add
|
||||
if ($action == 'create' || GETPOST("addcat") == 'addcat') {
|
||||
dol_set_focus('#label');
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ if ($cancel) {
|
|||
}
|
||||
|
||||
// Action mise a jour d'une categorie
|
||||
if ($action == 'update' && $user->rights->categorie->creer) {
|
||||
if ($action == 'update' && $user->hasRight('categorie', 'creer')) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
$object->label = $label;
|
||||
$object->description = dol_htmlcleanlastbr($description);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css
|
|||
llxHeader('', $title, '', '', 0, 0, $arrayofjs, $arrayofcss);
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($user->rights->categorie->creer)) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCategory'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/categories/card.php?action=create&type='.$type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$type.$moreparam).$moreparam);
|
||||
}
|
||||
|
||||
|
|
@ -210,12 +210,12 @@ foreach ($fulltree as $key => $val) {
|
|||
$entry .= '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.$moreparam.'&backtolist='.urlencode($_SERVER["PHP_SELF"].'?type='.$type).'">'.img_view().'</a>';
|
||||
$entry .= '</td>';
|
||||
$entry .= '<td class="right" width="20px;">';
|
||||
if ($user->rights->categorie->creer) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
$entry .= '<a class="editfielda" href="' . DOL_URL_ROOT . '/categories/edit.php?id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type) . '">' . img_edit() . '</a>';
|
||||
}
|
||||
$entry .= '</td>';
|
||||
$entry .= '<td class="right" width="20px;">';
|
||||
if ($user->rights->categorie->supprimer) {
|
||||
if ($user->hasRight('categorie', 'supprimer')) {
|
||||
$entry .= '<a class="deletefilelink" href="' . DOL_URL_ROOT . '/categories/viewcat.php?action=delete&token=' . newToken() . '&id=' . $val['id'] . '&type=' . $type . $moreparam . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '&backtolist=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $type . $moreparam) . '">' . img_delete() . '</a>';
|
||||
}
|
||||
$entry .= '</td>';
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ if (isset($_FILES['userfile']) && $_FILES['userfile']['size'] > 0 && GETPOST("se
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->rights->categorie->creer) {
|
||||
if ($action == 'confirm_delete' && $_GET["file"] && $confirm == 'yes' && $user->hasRight('categorie', 'creer')) {
|
||||
$object->delete_photo($upload_dir."/".$_GET["file"]);
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ if ($object->id) {
|
|||
*/
|
||||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
if ($action != 'ajout_photo' && $user->rights->categorie->creer) {
|
||||
if ($action != 'ajout_photo' && $user->hasRight('categorie', 'creer')) {
|
||||
if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
print '<a class="butAction hideonsmartphone" href="'.$_SERVER['PHP_SELF'].'?action=ajout_photo&id='.$object->id.'&type='.$type.'">';
|
||||
print $langs->trans("AddPhoto").'</a>';
|
||||
|
|
@ -174,10 +174,10 @@ if ($object->id) {
|
|||
/*
|
||||
* Ajouter une photo
|
||||
*/
|
||||
if ($action == 'ajout_photo' && $user->rights->categorie->creer && !empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($action == 'ajout_photo' && $user->hasRight('categorie', 'creer') && !empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
// Affiche formulaire upload
|
||||
$formfile = new FormFile($db);
|
||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, '', $user->rights->categorie->creer, 50, $object, '', false, '', 0);
|
||||
$formfile->form_attach_new_file($_SERVER['PHP_SELF'].'?id='.$object->id.'&type='.$type, $langs->trans("AddPhoto"), 1, '', $user->hasRight('categorie', 'creer'), 50, $object, '', false, '', 0);
|
||||
}
|
||||
|
||||
// Affiche photos
|
||||
|
|
@ -234,7 +234,7 @@ if ($object->id) {
|
|||
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $obj['photo']) && ($object->imgWidth > $maxWidth || $object->imgHeight > $maxHeight)) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&token='.newToken().'&action=addthumb&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'), 'refresh').' </a>';
|
||||
}
|
||||
if ($user->rights->categorie->creer) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().'&type='.$type.'&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ if ($cancel == $langs->trans("Cancel")) {
|
|||
// validation of addition
|
||||
if ($action == 'vadd' &&
|
||||
$cancel != $langs->trans("Cancel") &&
|
||||
($user->rights->categorie->creer)) {
|
||||
($user->hasRight('categorie', 'creer'))) {
|
||||
$object->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ $cancel != $langs->trans("Cancel") &&
|
|||
// validation of the edition
|
||||
if ($action == 'vedit' &&
|
||||
$cancel != $langs->trans("Cancel") &&
|
||||
($user->rights->categorie->creer)) {
|
||||
($user->hasRight('categorie', 'creer'))) {
|
||||
$object->fetch($id);
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
|
|
|
|||
|
|
@ -128,12 +128,12 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
$tmpobject = new Contact($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'contact';
|
||||
} elseif ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) {
|
||||
} elseif ($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$tmpobject = new Account($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'account';
|
||||
} elseif ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) {
|
||||
} elseif ($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
$tmpobject = new Project($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
|
|
@ -143,7 +143,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
$tmpobject = new User($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
$elementtype = 'user';
|
||||
} elseif ($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) {
|
||||
} elseif ($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/ticket/class/ticket.class.php';
|
||||
$tmpobject = new Ticket($db);
|
||||
$result = $tmpobject->fetch($removeelem);
|
||||
|
|
@ -156,7 +156,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
if ($user->hasRight('categorie', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') {
|
||||
if ($object->delete($user) >= 0) {
|
||||
if ($backtopage) {
|
||||
header("Location: ".$backtopage);
|
||||
|
|
@ -174,12 +174,12 @@ if ($elemid && $action == 'addintocategory' &&
|
|||
(($type == Categorie::TYPE_PRODUCT && ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer'))) ||
|
||||
($type == Categorie::TYPE_CUSTOMER && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_SUPPLIER && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->rights->ticket->write) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) ||
|
||||
($type == Categorie::TYPE_TICKET && $user->hasRight('ticket', 'write')) ||
|
||||
($type == Categorie::TYPE_PROJECT && $user->hasRight('projet', 'creer')) ||
|
||||
($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) ||
|
||||
($type == Categorie::TYPE_CONTACT && $user->hasRight('societe', 'creer')) ||
|
||||
($type == Categorie::TYPE_USER && $user->hasRight('user', 'user', 'creer')) ||
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer)
|
||||
($type == Categorie::TYPE_ACCOUNT && $user->hasRight('banque', 'configurer'))
|
||||
)) {
|
||||
if ($type == Categorie::TYPE_PRODUCT) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
|
|
@ -318,12 +318,12 @@ if ($reshook < 0) {
|
|||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if (empty($reshook)) {
|
||||
if ($user->rights->categorie->creer) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
$socid = ($object->socid ? "&socid=".$object->socid : "");
|
||||
print '<a class="butAction" href="edit.php?id='.$object->id.$socid.'&type='.$type.'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
if ($user->rights->categorie->supprimer) {
|
||||
if ($user->hasRight('categorie', 'supprimer')) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'&type='.$type.'&backtolist='.urlencode($backtolist).'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
|
|
@ -331,7 +331,7 @@ if (empty($reshook)) {
|
|||
print "</div>";
|
||||
|
||||
$newcardbutton = '';
|
||||
if (!empty($user->rights->categorie->creer)) {
|
||||
if ($user->hasRight('categorie', 'creer')) {
|
||||
$link = DOL_URL_ROOT.'/categories/card.php';
|
||||
$link .= '?action=create';
|
||||
$link .= '&type='.$type;
|
||||
|
|
|
|||
|
|
@ -287,11 +287,11 @@ if (empty($reshook)) {
|
|||
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2);
|
||||
} else {
|
||||
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'member'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_DONATION__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'donation'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'contractline'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'member'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_DONATION__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'donation'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'order'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'invoice'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2);
|
||||
}
|
||||
}
|
||||
if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) {
|
||||
|
|
@ -304,25 +304,25 @@ if (empty($reshook)) {
|
|||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
} else {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, 2);
|
||||
}
|
||||
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
} else {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'order'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order'.$obj->source_id, 2);
|
||||
}
|
||||
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
} else {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'invoice'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice'.$obj->source_id, 2);
|
||||
}
|
||||
|
||||
if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2);
|
||||
} else {
|
||||
$substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN.'contractline'.$obj->source_id, 2);
|
||||
$substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2);
|
||||
}
|
||||
}
|
||||
//$substitutionisok=true;
|
||||
|
|
|
|||
|
|
@ -2422,7 +2422,7 @@ if ($action == 'create') {
|
|||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br><span class="hideonsmartphone">'.$langs->trans('ThirdParty').' : </span>'.$soc->getNomUrl(1, 'customer');
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $soc->id > 0) {
|
||||
|
|
|
|||
|
|
@ -1200,7 +1200,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if (!$error) {
|
||||
if (empty($user->rights->margins->creer)) {
|
||||
if (!$user->hasRight('margins', 'creer')) {
|
||||
foreach ($object->lines as &$line) {
|
||||
if ($line->id == GETPOST('lineid', 'int')) {
|
||||
$fournprice = $line->fk_fournprice;
|
||||
|
|
@ -1303,7 +1303,7 @@ if (empty($reshook)) {
|
|||
|
||||
if (
|
||||
GETPOST('generate_deposit', 'alpha') == 'on' && !empty($deposit_percent_from_payment_terms)
|
||||
&& isModEnabled('facture') && !empty($user->rights->facture->creer)
|
||||
&& isModEnabled('facture') && $user->hasRight('facture', 'creer')
|
||||
) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
|
|
@ -2185,7 +2185,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
// It may also break step of creating an order when invoicing must be done from proposals and not from orders
|
||||
$deposit_percent_from_payment_terms = getDictionaryValue('c_payment_term', 'deposit_percent', $object->cond_reglement_id);
|
||||
|
||||
if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && !empty($user->rights->facture->creer)) {
|
||||
if (!empty($deposit_percent_from_payment_terms) && isModEnabled('facture') && $user->hasRight('facture', 'creer')) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
|
|
@ -2397,7 +2397,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$soc->getNomUrl(1, 'customer');
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
|
|
|
|||
|
|
@ -434,7 +434,7 @@ class Commande extends CommonOrder
|
|||
if (!empty($conf->global->COMMANDE_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->COMMANDE_ADDON.".php";
|
||||
$file = getDolGlobalString('COMMANDE_ADDON') . ".php";
|
||||
$classname = $conf->global->COMMANDE_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
@ -490,8 +490,8 @@ class Commande extends CommonOrder
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate)))) {
|
||||
if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'creer'))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'validate')))) {
|
||||
$this->error = 'NotEnoughPermissions';
|
||||
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
|
|
@ -642,8 +642,8 @@ class Commande extends CommonOrder
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate)))) {
|
||||
if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'creer'))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('commande', 'order_advance', 'validate')))) {
|
||||
$this->error = 'Permission denied';
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -2750,16 +2750,16 @@ class Commande extends CommonOrder
|
|||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql .= " c.rowid as cid, c.ref";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.entity IN (".getEntity('commande').")";
|
||||
$sql .= " AND c.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { //restriction
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
@ -3584,7 +3584,7 @@ class Commande extends CommonOrder
|
|||
|
||||
$sql = "SELECT c.rowid, c.date_creation as datec, c.date_commande, c.date_livraison as delivery_date, c.fk_statut, c.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
|
|
@ -3846,7 +3846,7 @@ class Commande extends CommonOrder
|
|||
$url = DOL_URL_ROOT.'/commande/card.php?id='.$this->id;
|
||||
}
|
||||
|
||||
if (!$user->rights->commande->lire) {
|
||||
if (!$user->hasRight('commande', 'lire')) {
|
||||
$option = 'nolink';
|
||||
}
|
||||
|
||||
|
|
@ -4089,7 +4089,7 @@ class Commande extends CommonOrder
|
|||
$sql = "SELECT count(co.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as co";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON co.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = "AND";
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class CommandeStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -148,7 +148,7 @@ class CommandeStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, COUNT(*) as nb, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -172,7 +172,7 @@ class CommandeStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -197,7 +197,7 @@ class CommandeStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(c.date_commande,'%m') as dm, AVG(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -220,7 +220,7 @@ class CommandeStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(c.date_commande,'%Y') as year, COUNT(*) as nb, SUM(c.".$this->field.") as total, AVG(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -246,7 +246,7 @@ class CommandeStats extends Stats
|
|||
$sql .= " FROM ".$this->from;
|
||||
$sql .= " INNER JOIN ".$this->from_line." ON c.rowid = tl.fk_commande";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."product as product ON tl.fk_product = product.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ if ($user->socid > 0) {
|
|||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
if (!$user->rights->facture->creer) {
|
||||
if (!$user->hasRight('facture', 'creer')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -78,16 +78,16 @@ $thirdpartystatic = new Societe($db);
|
|||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
|
||||
$sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND c.fk_soc = s.rowid";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if (GETPOST("search_nom")) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
|
|||
$langs->loadLangs(array('orders', 'bills'));
|
||||
|
||||
|
||||
if (!$user->rights->commande->lire) {
|
||||
if (!$user->hasRight('commande', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ if (isModEnabled('commande')) {
|
|||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
|
|
@ -108,7 +108,7 @@ if (isModEnabled('commande')) {
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ $sql .= ", s.code_client";
|
|||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
|
|
@ -176,7 +176,7 @@ $sql .= " AND c.entity IN (".getEntity('commande').")";
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.tms DESC";
|
||||
|
|
@ -251,7 +251,7 @@ if (isModEnabled('commande')) {
|
|||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
|
|
@ -260,7 +260,7 @@ if (isModEnabled('commande')) {
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.rowid DESC";
|
||||
|
|
@ -340,7 +340,7 @@ if (isModEnabled('commande')) {
|
|||
$sql .= ", s.canvas";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
|
|
@ -349,7 +349,7 @@ if (isModEnabled('commande')) {
|
|||
if ($socid) {
|
||||
$sql .= " AND c.fk_soc = ".((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
$sql .= " ORDER BY c.rowid DESC";
|
||||
|
|
|
|||
|
|
@ -861,7 +861,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
|||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
|
||||
if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
|
|
@ -879,7 +879,7 @@ $sql .= ' AND c.entity IN ('.getEntity('commande').')';
|
|||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($search_ref) {
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = c.fk_projet";
|
|||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON c.fk_user_author = u.rowid';
|
||||
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
|
||||
if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
|
|
@ -445,7 +445,7 @@ if ($search_product_category > 0) {
|
|||
if ($socid > 0) {
|
||||
$sql .= ' AND s.rowid = '.((int) $socid);
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($search_id) {
|
||||
|
|
@ -865,7 +865,7 @@ if ($resql) {
|
|||
$moreforfilter .= '<br>';
|
||||
|
||||
// If the user can view prospects other than his'
|
||||
if ($user->rights->user->user->lire) {
|
||||
if ($user->hasRight('user', 'user', 'lire')) {
|
||||
$langs->load("commercial");
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
|
||||
|
|
@ -873,7 +873,7 @@ if ($resql) {
|
|||
$moreforfilter .= '</div>';
|
||||
}
|
||||
// If the user can view other users
|
||||
if ($user->rights->user->user->lire) {
|
||||
if ($user->hasRight('user', 'user', 'lire')) {
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('LinkedToSpecificUsers');
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ $WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
|
|||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$mode = GETPOSTISSET("mode") ? GETPOST("mode", 'aZ09') : 'customer';
|
||||
if ($mode == 'customer' && !$user->rights->commande->lire) {
|
||||
if ($mode == 'customer' && !$user->hasRight('commande', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->commande->lire)) {
|
||||
if ($mode == 'supplier' && !$user->hasRight('fournisseur', 'commande', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier') {
|
||||
|
|
@ -119,7 +119,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
|
|||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
|
||||
$filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png';
|
||||
|
|
@ -165,7 +165,7 @@ $data = $stats->getAmountByMonthWithPrevYear($endyear, $startyear);
|
|||
//var_dump($data);
|
||||
// $data = array(array('Lib',val1,val2,val3),...)
|
||||
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
|
||||
$filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png';
|
||||
|
|
@ -209,7 +209,7 @@ if (!$mesg) {
|
|||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ $rowids = GETPOST('rowid', 'array');
|
|||
// Conciliation
|
||||
if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', 'alpha'))
|
||||
&& (GETPOST("num_releve", "alpha") || !empty($rowids))
|
||||
&& !empty($user->rights->banque->consolidate)
|
||||
&& $user->hasRight('banque', 'consolidate')
|
||||
&& (!GETPOSTISSET('pageplusone') || (GETPOST('pageplusone') == GETPOST('pageplusoneold')))) {
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -569,7 +569,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
}
|
||||
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'consolidate')) {
|
||||
$newparam = $param;
|
||||
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
|
||||
$buttonreconcile = '<a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliatemanual.'</a>';
|
||||
|
|
@ -579,7 +579,7 @@ if ($id > 0 || !empty($ref)) {
|
|||
|
||||
if ($allowautomaticconciliation) {
|
||||
// If not cash account and can be reconciliate
|
||||
if ($user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'consolidate')) {
|
||||
$newparam = $param;
|
||||
$newparam = preg_replace('/search_conciliated=\d+/i', '', $newparam);
|
||||
$buttonreconcile .= ' <a class="butAction" style="margin-bottom: 5px !important; margin-top: 5px !important" href="'.DOL_URL_ROOT.'/compta/bank/bankentries_list.php?action=reconcile&sortfield=b.datev,b.dateo,b.rowid&sortorder=asc,asc,asc&search_conciliated=0'.$newparam.'">'.$titletoconciliateauto.'</a>';
|
||||
|
|
@ -820,7 +820,7 @@ if ($resql) {
|
|||
}
|
||||
|
||||
// Form to reconcile
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile') {
|
||||
if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') {
|
||||
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
|
||||
$texttoshow = $langs->trans("InputReceiptNumber").': ';
|
||||
$yyyy = dol_substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1).substr($langs->transnoentitiesnoconv("Year"), 0, 1);
|
||||
|
|
@ -1297,7 +1297,7 @@ if ($resql) {
|
|||
$balancecalculated = true;
|
||||
|
||||
// Output a line with start balance
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile') {
|
||||
if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') {
|
||||
$tmpnbfieldbeforebalance = 0;
|
||||
$tmpnbfieldafterbalance = 0;
|
||||
$balancefieldfound = 0;
|
||||
|
|
@ -1647,8 +1647,8 @@ if ($resql) {
|
|||
$companystatic->fetch($companylinked_id);
|
||||
print $companystatic->getNomUrl(1);
|
||||
} elseif ($userlinked_id &&
|
||||
(($type_link == 'payment_salary' && !empty($user->rights->salaries->read))
|
||||
|| ($type_link == 'payment_sc' && !empty($user->rights->tax->charges->lire)))) {
|
||||
(($type_link == 'payment_salary' && $user->hasRight('salaries', 'read'))
|
||||
|| ($type_link == 'payment_sc' && $user->hasRight('tax', 'charges', 'lire')))) {
|
||||
// Get object user from cache or load it
|
||||
if (!empty($conf->cache['user'][$userlinked_id])) {
|
||||
$tmpuser = $conf->cache['user'][$userlinked_id];
|
||||
|
|
@ -1795,7 +1795,7 @@ if ($resql) {
|
|||
print img_edit();
|
||||
print '</a>';
|
||||
} else {
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/compta/bank/line.php?save_lastsearch_values=1&rowid='.$objp->rowid.($object->id > 0 ? '&account='.$object->id : '').'&page='.$page.'">';
|
||||
print img_edit();
|
||||
print '</a>';
|
||||
|
|
@ -1809,7 +1809,7 @@ if ($resql) {
|
|||
print ' '.img_warning($langs->trans("ReconciliationLate"));
|
||||
}
|
||||
}
|
||||
if ($user->rights->banque->modifier) {
|
||||
if ($user->hasRight('banque', 'modifier')) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&rowid='.$objp->rowid.'&page='.$page.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '').'">';
|
||||
print img_delete('', 'class="marginleftonly"');
|
||||
print '</a>';
|
||||
|
|
@ -1854,7 +1854,7 @@ if ($resql) {
|
|||
print '<td class="right"><span class="amount">'.price($totalarray['totalcred']).'</span></td>';
|
||||
} elseif ($i == $posconciliatecol) {
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action == 'reconcile') {
|
||||
if ($user->hasRight('banque', 'consolidate') && $action == 'reconcile') {
|
||||
print '<input class="button" name="confirm_reconcile" type="submit" value="'.$langs->trans("Conciliate").'">';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
|||
$langs->loadLangs(array('banks', 'categories'));
|
||||
|
||||
// Security Check Access Control
|
||||
if (empty($user->rights->banque->lire)) {
|
||||
if (!$user->hasRight('banque', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights->banque->configurer) {
|
||||
if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->hasRight('banque', 'configurer')) {
|
||||
// Delete
|
||||
$object = new Account($db);
|
||||
$object->fetch(GETPOST("id", "int"));
|
||||
|
|
@ -880,12 +880,12 @@ if ($action == 'create') {
|
|||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->banque->configurer) {
|
||||
if ($user->hasRight('banque', 'configurer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
$canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements
|
||||
if ($user->rights->banque->configurer && $canbedeleted) {
|
||||
if ($user->hasRight('banque', 'configurer') && $canbedeleted) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
|
||||
|
|
@ -898,7 +898,7 @@ if ($action == 'create') {
|
|||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if (GETPOST('id', 'int') && $action == 'edit' && $user->rights->banque->configurer) {
|
||||
if (GETPOST('id', 'int') && $action == 'edit' && $user->hasRight('banque', 'configurer')) {
|
||||
print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
|
||||
|
||||
if ($conf->use_javascript_ajax) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ $bankcateg = new BankCateg($db);
|
|||
|
||||
|
||||
// Security Check Access Control
|
||||
if (!$user->rights->banque->configurer) {
|
||||
if (!$user->hasRight('banque', 'configurer')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2342,7 +2342,7 @@ class AccountLine extends CommonObjectLine
|
|||
|
||||
// Check statement field
|
||||
if (!empty($conf->global->BANK_STATEMENT_REGEX_RULE)) {
|
||||
if (!preg_match('/'.$conf->global->BANK_STATEMENT_REGEX_RULE.'/', $this->num_releve)) {
|
||||
if (!preg_match('/' . getDolGlobalString('BANK_STATEMENT_REGEX_RULE').'/', $this->num_releve)) {
|
||||
$this->errors[] = $langs->trans("ErrorBankStatementNameMustFollowRegex", $conf->global->BANK_STATEMENT_REGEX_RULE);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ if ($user->socid) {
|
|||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||
if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
|
||||
if (!$user->hasRight('banque', 'lire') && !$user->hasRight('banque', 'consolidate')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ if ($user->socid) {
|
|||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
|
||||
if (empty($user->rights->banque->lire) && empty($user->rights->banque->consolidate)) {
|
||||
if (!$user->hasRight('banque', 'lire') && !$user->hasRight('banque', 'consolidate')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -99,21 +99,21 @@ if ($cancel) {
|
|||
}
|
||||
|
||||
|
||||
if ($user->rights->banque->consolidate && $action == 'donext') {
|
||||
if ($user->hasRight('banque', 'consolidate') && $action == 'donext') {
|
||||
$al = new AccountLine($db);
|
||||
$al->dateo_next(GETPOST("rowid", 'int'));
|
||||
} elseif ($user->rights->banque->consolidate && $action == 'doprev') {
|
||||
} elseif ($user->hasRight('banque', 'consolidate') && $action == 'doprev') {
|
||||
$al = new AccountLine($db);
|
||||
$al->dateo_previous(GETPOST("rowid", 'int'));
|
||||
} elseif ($user->rights->banque->consolidate && $action == 'dvnext') {
|
||||
} elseif ($user->hasRight('banque', 'consolidate') && $action == 'dvnext') {
|
||||
$al = new AccountLine($db);
|
||||
$al->datev_next(GETPOST("rowid", 'int'));
|
||||
} elseif ($user->rights->banque->consolidate && $action == 'dvprev') {
|
||||
} elseif ($user->hasRight('banque', 'consolidate') && $action == 'dvprev') {
|
||||
$al = new AccountLine($db);
|
||||
$al->datev_previous(GETPOST("rowid", 'int'));
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->banque->modifier) {
|
||||
if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->hasRight('banque', 'modifier')) {
|
||||
$cat1 = GETPOST("cat1", 'int');
|
||||
if (!empty($rowid) && !empty($cat1)) {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class WHERE lineid = ".((int) $rowid)." AND fk_categ = ".((int) $cat1);
|
||||
|
|
@ -125,7 +125,7 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->banque->modifier && $action == "update") {
|
||||
if ($user->hasRight('banque', 'modifier') && $action == "update") {
|
||||
$error = 0;
|
||||
|
||||
$result = $object->fetch($rowid);
|
||||
|
|
@ -232,7 +232,7 @@ if ($user->rights->banque->modifier && $action == "update") {
|
|||
}
|
||||
|
||||
// Reconcile
|
||||
if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == 'setreconcile')) {
|
||||
if ($user->hasRight('banque', 'consolidate') && ($action == 'num_releve' || $action == 'setreconcile')) {
|
||||
$num_rel = trim(GETPOST("num_rel"));
|
||||
$rappro = GETPOST('reconciled') ? 1 : 0;
|
||||
|
||||
|
|
@ -467,7 +467,7 @@ if ($result) {
|
|||
print "<tr><td>".$langs->trans("Type")." / ".$langs->trans("Numero");
|
||||
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
|
||||
print "</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
$form->select_types_paiements($objp->fk_type, "value", '', 2);
|
||||
print '<input type="text" class="flat" name="num_chq" value="'.(empty($objp->num_chq) ? '' : $objp->num_chq).'">';
|
||||
|
|
@ -487,7 +487,7 @@ if ($result) {
|
|||
print "<tr><td>".$langs->trans("CheckTransmitter");
|
||||
print ' <em>('.$langs->trans("ChequeMaker").')</em>';
|
||||
print "</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat minwidth200" name="emetteur" value="'.(empty($objp->emetteur) ? '' : dol_escape_htmltag($objp->emetteur)).'">';
|
||||
print '</td>';
|
||||
|
|
@ -500,7 +500,7 @@ if ($result) {
|
|||
print "<tr><td>".$langs->trans("Bank");
|
||||
print ' <em>('.$langs->trans("ChequeBank").')</em>';
|
||||
print "</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print '<input type="text" class="flat minwidth200" name="banque" value="'.(empty($objp->banque) ? '' : dol_escape_htmltag($objp->banque)).'">';
|
||||
print '</td>';
|
||||
|
|
@ -511,7 +511,7 @@ if ($result) {
|
|||
|
||||
// Date ope
|
||||
print '<tr><td>'.$langs->trans("DateOperation").'</td>';
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print $form->selectDate($db->jdate($objp->do), 'dateo', '', '', '', 'update', 1, 0, $objp->rappro);
|
||||
if (!$objp->rappro) {
|
||||
|
|
@ -531,7 +531,7 @@ if ($result) {
|
|||
|
||||
// Value date
|
||||
print "<tr><td>".$langs->trans("DateValue")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print $form->selectDate($db->jdate($objp->dv), 'datev', '', '', '', 'update', 1, 0, $objp->rappro);
|
||||
if (!$objp->rappro) {
|
||||
|
|
@ -552,7 +552,7 @@ if ($result) {
|
|||
// Description
|
||||
$reg = array();
|
||||
print "<tr><td>".$langs->trans("Label")."</td>";
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print '<input name="label" class="flat minwidth300" '.($objp->rappro ? ' disabled' : '').' value="';
|
||||
if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) {
|
||||
|
|
@ -577,7 +577,7 @@ if ($result) {
|
|||
|
||||
// Amount
|
||||
print "<tr><td>".$langs->trans("Amount")."</td>";
|
||||
if ($user->rights->banque->modifier) {
|
||||
if ($user->hasRight('banque', 'modifier')) {
|
||||
print '<td>';
|
||||
print '<input name="amount" class="flat maxwidth100" '.($objp->rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code);
|
||||
print '</td>';
|
||||
|
|
@ -669,7 +669,7 @@ if ($result) {
|
|||
print '<table class="border centpercent">';
|
||||
|
||||
print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("AccountStatement"), $langs->trans("InputReceiptNumber"))."</td>";
|
||||
if ($user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
if ($objp->rappro) {
|
||||
print '<input name="num_rel_bis" id="num_rel_bis" class="flat" type="text" value="'.$objp->num_releve.'"'.($objp->rappro ? ' disabled' : '').'>';
|
||||
|
|
@ -687,7 +687,7 @@ if ($result) {
|
|||
print '</tr>';
|
||||
|
||||
print '<tr><td><label for="reconciled">'.$langs->trans("BankLineConciliated").'</label></td>';
|
||||
if ($user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'consolidate')) {
|
||||
print '<td>';
|
||||
print '<input type="checkbox" id="reconciled" name="reconciled" class="flat" '.(GETPOSTISSET("reconciled") ? (GETPOST("reconciled") ? ' checked="checked"' : '') : ($objp->rappro ? ' checked="checked"' : '')).'">';
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ $arrayofmassactions = array(
|
|||
if ($permissiontodelete) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
}
|
||||
if (isModEnabled('category') && $user->rights->banque->modifier) {
|
||||
if (isModEnabled('category') && $user->hasRight('banque', 'modifier')) {
|
||||
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
|
||||
}
|
||||
if (in_array($massaction, array('presend', 'predelete','preaffecttag'))) {
|
||||
|
|
@ -375,7 +375,7 @@ print '<input type="hidden" name="mode" value="'.$mode.'">';
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->rights->banque->configurer);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewFinancialAccount'), '', 'fa fa-plus-circle', 'card.php?action=create', '', $user->hasRight('banque', 'configurer'));
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ if (empty($numref)) {
|
|||
print '<td class="right"><span class="amount">'.price(($balancestart[$objp->numr] + $content[$objp->numr]), '', $langs, 1, -1, -1, empty($object->currency_code)?$conf->currency:$object->currency_code).'</span></td>';
|
||||
|
||||
print '<td class="center">';
|
||||
if ($user->rights->banque->consolidate && $action != 'editbankreceipt') {
|
||||
if ($user->hasRight('banque', 'consolidate') && $action != 'editbankreceipt') {
|
||||
print '<a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?account='.$object->id.($page > 0 ? '&page='.$page : '').'&action=editbankreceipt&token='.newToken().'&brref='.urlencode($objp->numr).'">'.img_edit().'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
|
@ -682,7 +682,7 @@ if (empty($numref)) {
|
|||
|
||||
print '<td class="nowrap right">'.price(price2num($total, 'MT'))."</td>\n";
|
||||
|
||||
if ($user->rights->banque->modifier || $user->rights->banque->consolidate) {
|
||||
if ($user->hasRight('banque', 'modifier') || $user->hasRight('banque', 'consolidate')) {
|
||||
print '<td class="center"><a class="editfielda reposition" href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?account='.$object->id.'&num='.$numref).'">';
|
||||
print img_edit();
|
||||
print "</a></td>";
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ $socid = 0;
|
|||
if ($user->socid > 0) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if (!$user->rights->banque->transfer) {
|
||||
if (!$user->hasRight('banque', 'transfer')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action
|
|||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
if ($action == 'add' && !empty($user->rights->banque->transfer)) {
|
||||
if ($action == 'add' && $user->hasRight('banque', 'transfer')) {
|
||||
$langs->load('errors');
|
||||
$i = 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -639,10 +639,10 @@ if ($id) {
|
|||
$editvalue = '';
|
||||
if (isModEnabled('accounting')) {
|
||||
print '<tr><td class="nowrap">';
|
||||
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
||||
print $form->editfieldkey('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
|
||||
print '</td><td>';
|
||||
if ($action == 'editaccountancy_code') {
|
||||
print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->rights->banque->modifier), 'string', '', 0);
|
||||
print $form->editfieldval('AccountAccounting', 'accountancy_code', $object->accountancy_code, $object, (!$alreadyaccounted && $user->hasRight('banque', 'modifier')), 'string', '', 0);
|
||||
} else {
|
||||
$accountingaccount = new AccountingAccount($db);
|
||||
$accountingaccount->fetch('', $object->accountancy_code, 1);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ if ($object->id) {
|
|||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
if ($user->rights->banque->modifier && 0) {
|
||||
if ($user->hasRight('banque', 'modifier') && 0) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ $morehtmlref = '<div class="refidno">';
|
|||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
if ($user->rights->banque->modifier && 0) {
|
||||
if ($user->hasRight('banque', 'modifier') && 0) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ $newcardbutton = '';
|
|||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitleSeparator();
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->modifier);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('MenuNewVariousPayment'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'modifier'));
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_payment', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ if ($user->socid > 0) { // Protection if external user
|
|||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
|
||||
if (!$user->hasRight('cashdesk', 'run') && !$user->hasRight('takepos', 'run')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ if ($user->socid > 0) { // Protection if external user
|
|||
//$socid = $user->socid;
|
||||
accessforbidden();
|
||||
}
|
||||
if (empty($user->rights->cashdesk->run) && empty($user->rights->takepos->run)) {
|
||||
if (!$user->hasRight('cashdesk', 'run') && !$user->hasRight('takepos', 'run')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ if ($year) {
|
|||
print '<span class="opacitymedium">'.$langs->trans("DescTaxAndDividendsArea").'</span><br>';
|
||||
print "<br>";
|
||||
|
||||
if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
|
||||
if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
// Social contributions only
|
||||
print load_fiche_titre($langs->trans("SocialContributions").($year ? ' ('.$langs->trans("Year").' '.$year.')' : ''), '', '');
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
|
|||
}
|
||||
|
||||
// VAT
|
||||
if (isModEnabled('tax') && $user->rights->tax->charges->lire) {
|
||||
if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
print "<br>";
|
||||
|
||||
$tva = new Tva($db);
|
||||
|
|
|
|||
|
|
@ -95,16 +95,16 @@ if ($mode == 'search') {
|
|||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client, s.town, s.datec, s.datea";
|
||||
$sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta ";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.fk_stcomm = st.id AND s.client in (1, 3)";
|
||||
$sql .= " AND s.entity IN (".getEntity('societe').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if (dol_strlen($stcomm)) {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ $permissionnote = $user->rights->deplacement->creer; // Used by the include of a
|
|||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||
|
||||
if ($action == 'validate' && $user->rights->deplacement->creer) {
|
||||
if ($action == 'validate' && $user->hasRight('deplacement', 'creer')) {
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT) {
|
||||
$result = $object->setStatut(1);
|
||||
|
|
@ -73,7 +73,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'classifyrefunded' && $user->hasRight('deplacement', 'creer')) {
|
||||
$object->fetch($id);
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED) {
|
||||
$result = $object->setStatut(Deplacement::STATUS_REFUNDED);
|
||||
|
|
@ -84,7 +84,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) {
|
||||
} elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->hasRight('deplacement', 'supprimer')) {
|
||||
$result = $object->delete($user);
|
||||
if ($result >= 0) {
|
||||
header("Location: index.php");
|
||||
|
|
@ -92,7 +92,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'add' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'add' && $user->hasRight('deplacement', 'creer')) {
|
||||
if (!GETPOST('cancel', 'alpha')) {
|
||||
$error = 0;
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
header("Location: index.php");
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'update' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'update' && $user->hasRight('deplacement', 'creer')) {
|
||||
// Update record
|
||||
if (!GETPOST('cancel', 'alpha')) {
|
||||
$result = $object->fetch($id);
|
||||
|
|
@ -160,14 +160,14 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'classin' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'classin' && $user->hasRight('deplacement', 'creer')) {
|
||||
// Set into a project
|
||||
$object->fetch($id);
|
||||
$result = $object->setProject(GETPOST('projectid', 'int'));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
} elseif ($action == 'setdated' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'setdated' && $user->hasRight('deplacement', 'creer')) {
|
||||
// Set fields
|
||||
$dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int'));
|
||||
$object->fetch($id);
|
||||
|
|
@ -175,7 +175,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) {
|
|||
if ($result < 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
} elseif ($action == 'setkm' && $user->rights->deplacement->creer) {
|
||||
} elseif ($action == 'setkm' && $user->hasRight('deplacement', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('km', GETPOST('km', 'int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY');
|
||||
if ($result < 0) {
|
||||
|
|
@ -276,7 +276,7 @@ if ($action == 'create') {
|
|||
|
||||
print dol_get_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
|
||||
|
||||
if ($action == 'edit' && $user->rights->deplacement->creer) {
|
||||
if ($action == 'edit' && $user->hasRight('deplacement', 'creer')) {
|
||||
//WYSIWYG Editor
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
|
||||
|
|
@ -388,9 +388,9 @@ if ($action == 'create') {
|
|||
|
||||
// Type
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->hasRight('deplacement', 'creer'), 'select:types_fees');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees');
|
||||
print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->hasRight('deplacement', 'creer'), 'select:types_fees');
|
||||
print '</td></tr>';
|
||||
|
||||
// Who
|
||||
|
|
@ -402,16 +402,16 @@ if ($action == 'create') {
|
|||
|
||||
// Date
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->hasRight('deplacement', 'creer'), 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker');
|
||||
print $form->editfieldval("Date", 'dated', $object->date, $object, $user->hasRight('deplacement', 'creer'), 'datepicker');
|
||||
print '</td></tr>';
|
||||
|
||||
// Km/Price
|
||||
print '<tr><td class="tdtop">';
|
||||
print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $user->hasRight('deplacement', 'creer'), 'numeric:6');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6');
|
||||
print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->hasRight('deplacement', 'creer'), 'numeric:6');
|
||||
print "</td></tr>";
|
||||
|
||||
// Where
|
||||
|
|
@ -431,7 +431,7 @@ if ($action == 'create') {
|
|||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Project');
|
||||
print '</td>';
|
||||
if ($action != 'classify' && $user->rights->deplacement->creer) {
|
||||
if ($action != 'classify' && $user->hasRight('deplacement', 'creer')) {
|
||||
print '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?action=classify&token='.newToken().'&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetProject'), 1);
|
||||
print '</a></td>';
|
||||
|
|
@ -469,7 +469,7 @@ if ($action == 'create') {
|
|||
print '<div class="tabsAction">';
|
||||
|
||||
if ($object->statut < Deplacement::STATUS_REFUNDED) { // if not refunded
|
||||
if ($user->rights->deplacement->creer) {
|
||||
if ($user->hasRight('deplacement', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'&id='.$id.'">'.$langs->trans('Modify').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Modify').'</a>';
|
||||
|
|
@ -477,7 +477,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
if ($object->statut == Deplacement::STATUS_DRAFT) { // if draft
|
||||
if ($user->rights->deplacement->creer) {
|
||||
if ($user->hasRight('deplacement', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=validate&id='.$id.'">'.$langs->trans('Validate').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('Validate').'</a>';
|
||||
|
|
@ -485,7 +485,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
if ($object->statut == Deplacement::STATUS_VALIDATED) { // if validated
|
||||
if ($user->rights->deplacement->creer) {
|
||||
if ($user->hasRight('deplacement', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=classifyrefunded&token='.newToken().'&id='.$id.'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans('ClassifyRefunded').'</a>';
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ $totalnb = 0;
|
|||
$sql = "SELECT count(d.rowid) as nb, sum(d.km) as km, d.type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql .= " WHERE d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) {
|
||||
$sql .= ' AND d.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
|
||||
}
|
||||
$sql .= " GROUP BY d.type";
|
||||
|
|
@ -151,15 +151,15 @@ $langs->load("boxes");
|
|||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, d.rowid, d.dated as date, d.tms as dm, d.km, d.fk_statut";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE u.rowid = d.fk_user";
|
||||
$sql .= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) {
|
||||
$sql .= ' AND d.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " AND d.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -97,15 +97,15 @@ $sql .= " u.lastname, u.firstname"; // Qui
|
|||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."deplacement as d";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON d.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE d.fk_user = u.rowid";
|
||||
$sql .= " AND d.entity = ".$conf->entity;
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) {
|
||||
$sql .= ' AND d.fk_user IN ('.$db->sanitize(join(',', $childids)).')';
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR d.fk_soc IS NULL) ";
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ $result = restrictedArea($user, 'deplacement', $id, '');
|
|||
$childids = $user->getAllChildIds();
|
||||
$childids[] = $user->id;
|
||||
if ($userid > 0) {
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous) && !in_array($userid, $childids)) {
|
||||
if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous') && !in_array($userid, $childids)) {
|
||||
accessforbidden();
|
||||
exit;
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ dol_mkdir($dir);
|
|||
$useridtofilter = $userid; // Filter from parameters
|
||||
if (empty($useridtofilter)) {
|
||||
$useridtofilter = $childids;
|
||||
if (!empty($user->rights->deplacement->readall) || !empty($user->rights->deplacement->lire_tous)) {
|
||||
if ($user->hasRight('deplacement', 'readall') || $user->hasRight('deplacement', 'lire_tous')) {
|
||||
$useridtofilter = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ if (!$mesg) {
|
|||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
|
|
@ -248,7 +248,7 @@ print '</td></tr>';
|
|||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
$include = '';
|
||||
if (empty($user->rights->deplacement->readall) && empty($user->rights->deplacement->lire_tous)) {
|
||||
if (!$user->hasRight('deplacement', 'readall') && !$user->hasRight('deplacement', 'lire_tous')) {
|
||||
$include = 'hierarchy';
|
||||
}
|
||||
print img_picto('', 'user', 'class="pictofixedwidth"');
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Delete
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->supprimer) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('facture', 'supprimer')) {
|
||||
$object->delete($user);
|
||||
|
||||
header("Location: ".DOL_URL_ROOT.'/compta/facture/invoicetemplate_list.php');
|
||||
|
|
@ -820,7 +820,7 @@ if (empty($reshook)) {
|
|||
$typeinvoice = Facture::TYPE_STANDARD;
|
||||
|
||||
// Check price is not lower than minimum (check is done only for standard or replacement invoices)
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($typeinvoice == Facture::TYPE_STANDARD || $typeinvoice == Facture::TYPE_REPLACEMENT) && $price_min && ((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100) < (float) price2num($price_min)))) {
|
||||
if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('produit', 'ignore_price_min_advance')) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)) && (($typeinvoice == Facture::TYPE_STANDARD || $typeinvoice == Facture::TYPE_REPLACEMENT) && $price_min && ((float) price2num($pu_ht) * (1 - (float) $remise_percent / 100) < (float) price2num($price_min)))) {
|
||||
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3657,7 +3657,7 @@ if ($action == 'create') {
|
|||
}
|
||||
else
|
||||
{
|
||||
$("#model").val("'.$conf->global->FACTURE_ADDON_PDF.'");
|
||||
$("#model").val("' . getDolGlobalString('FACTURE_ADDON_PDF').'");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -4398,7 +4398,7 @@ if ($action == 'create') {
|
|||
}
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':'.$conf->global->THIRDPARTY_REF_INPUT_SIZE : ''), '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string'.(isset($conf->global->THIRDPARTY_REF_INPUT_SIZE) ? ':' . getDolGlobalString('THIRDPARTY_REF_INPUT_SIZE') : ''), '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'customer');
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
|
||||
|
|
|
|||
|
|
@ -3196,10 +3196,10 @@ class Facture extends CommonInvoice
|
|||
$this->error = $langs->trans("ErrorObjectMustHaveLinesToBeValidated", $this->ref);
|
||||
return -1;
|
||||
}
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->creer))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->facture->invoice_advance->validate))) {
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('facture', 'creer'))
|
||||
|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('facture', 'invoice_advance', 'validate'))) {
|
||||
$this->error = 'Permission denied';
|
||||
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS=' . getDolGlobalString('MAIN_USE_ADVANCED_PERMS'), LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
|
|
@ -4583,7 +4583,7 @@ class Facture extends CommonInvoice
|
|||
}
|
||||
|
||||
if (!empty($addon)) {
|
||||
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
|
||||
dol_syslog("Call getNextNumRef with ".$addonConstName." = " . getDolGlobalString('FACTURE_ADDON').", thirdparty=".$soc->name.", type=".$soc->typent_code.", mode=".$mode, LOG_DEBUG);
|
||||
|
||||
$mybool = false;
|
||||
|
||||
|
|
@ -4715,16 +4715,16 @@ class Facture extends CommonInvoice
|
|||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.client,";
|
||||
$sql .= " f.rowid as fid, f.ref as ref, f.datef as df";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", sc.fk_soc, sc.fk_user";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= " AND f.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { //restriction
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
@ -4914,7 +4914,7 @@ class Facture extends CommonInvoice
|
|||
|
||||
$sql = "SELECT f.rowid, f.date_lim_reglement as datefin, f.fk_statut as status, f.total_ht";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON f.fk_soc = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = " AND";
|
||||
|
|
@ -5163,7 +5163,7 @@ class Facture extends CommonInvoice
|
|||
$sql = "SELECT count(f.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
|
||||
$clause = "AND";
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class FactureStats extends Stats
|
|||
|
||||
$this->where = " f.fk_statut >= 0";
|
||||
$this->where .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$this->where .= " AND f.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($mode == 'customer') {
|
||||
|
|
@ -136,7 +136,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(f.datef,'%m') as dm, COUNT(*) as nb";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -162,7 +162,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(f.datef,'%Y') as dm, COUNT(*), SUM(c.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -187,7 +187,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -213,7 +213,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -236,7 +236,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -260,7 +260,7 @@ class FactureStats extends Stats
|
|||
|
||||
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
|
||||
$sql .= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
@ -288,7 +288,7 @@ class FactureStats extends Stats
|
|||
$startYear = $endYear - $numberYears;
|
||||
$sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
if (empty($user->rights->societe->client->voir) && !$this->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$this->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= $this->join;
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ $sqlfields = $sql; // $sql fields to remove for count total
|
|||
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
// Add table from hooks
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ if ($action == 'makepayment_confirm' && $user->hasRight('facture', 'paiement'))
|
|||
} elseif ($massaction == 'withdrawrequest') {
|
||||
$langs->load("withdrawals");
|
||||
|
||||
if (!$user->rights->prelevement->bons->creer) {
|
||||
if (!$user->hasRight('prelevement', 'bons', 'creer')) {
|
||||
$error++;
|
||||
setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors');
|
||||
} else {
|
||||
|
|
@ -643,7 +643,7 @@ if (!empty($search_fac_rec_source_title)) {
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
|
||||
if ($search_sale > 0 || (!$user->hasRight('societe', 'client', 'voir') && !$socid)) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
|
|
@ -657,7 +657,7 @@ $sql .= $hookmanager->resPrint;
|
|||
|
||||
$sql .= ' WHERE f.fk_soc = s.rowid';
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
|
|
@ -1187,11 +1187,11 @@ if ($resql) {
|
|||
if ($user->hasRight('facture', 'paiement')) {
|
||||
$arrayofmassactions['makepayment'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakePaymentAndClassifyPayed");
|
||||
}
|
||||
if (isModEnabled('prelevement') && !empty($user->rights->prelevement->bons->creer)) {
|
||||
if (isModEnabled('prelevement') && $user->hasRight('prelevement', 'bons', 'creer')) {
|
||||
$langs->load("withdrawals");
|
||||
$arrayofmassactions['withdrawrequest'] = img_picto('', 'payment', 'class="pictofixedwidth"').$langs->trans("MakeWithdrawRequest");
|
||||
}
|
||||
if (!empty($user->rights->facture->supprimer)) {
|
||||
if ($user->hasRight('facture', 'supprimer')) {
|
||||
if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) {
|
||||
$arrayofmassactions['predeletedraft'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Deletedraft");
|
||||
} elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ $hookmanager->initHooks(array('directdebitcard', 'globalcard'));
|
|||
|
||||
if ($type == 'bank-transfer') {
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture', 'fk_soc', $fieldid, $isdraft);
|
||||
if (empty($user->rights->fournisseur->facture->lire)) {
|
||||
if (!$user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $mode = GETPOST("mode") ? GETPOST("mode") : 'customer';
|
|||
if ($mode == 'customer' && !$user->hasRight('facture', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($mode == 'supplier' && empty($user->rights->fournisseur->facture->lire)) {
|
||||
if ($mode == 'supplier' && !$user->hasRight('fournisseur', 'facture', 'lire')) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
|
@ -193,7 +193,7 @@ if (!$mesg) {
|
|||
|
||||
$data = $stats->getAverageByMonthWithPrevYear($endyear, $startyear);
|
||||
|
||||
if (empty($user->rights->societe->client->voir) || $user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
|
||||
$filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
if ($mode == 'customer') {
|
||||
$fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png';
|
||||
|
|
|
|||
|
|
@ -142,12 +142,12 @@ if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) {
|
|||
$sql .= ", sum(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays, ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
@ -292,12 +292,12 @@ if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO
|
|||
$sql .= ", SUM(pf.amount) as am";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = ff.fk_soc";
|
||||
$sql .= " AND ff.entity = ".$conf->entity;
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
@ -499,7 +499,7 @@ if (isModEnabled('don') && $user->hasRight('don', 'lire')) {
|
|||
/**
|
||||
* Social contributions to pay
|
||||
*/
|
||||
if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) {
|
||||
if (isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) {
|
||||
if (!$socid) {
|
||||
$chargestatic = new ChargeSociales($db);
|
||||
|
||||
|
|
@ -602,7 +602,7 @@ if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("comm
|
|||
$sql .= ", c.rowid, c.ref, c.facture, c.fk_statut as status, c.total_ht, c.total_tva, c.total_ttc,";
|
||||
$sql .= " cc.rowid as country_id, cc.code as country_code";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s LEFT JOIN ".MAIN_DB_PREFIX."c_country as cc ON cc.rowid = s.fk_pays";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
|
||||
|
|
@ -610,7 +610,7 @@ if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("comm
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON el.fk_target = f.rowid AND el.targettype = 'facture'";
|
||||
$sql .= " WHERE c.fk_soc = s.rowid";
|
||||
$sql .= " AND c.entity = ".$conf->entity;
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ if (!empty($mode)) {
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?localTaxType='.$ltt.'&mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->rights->tax->charges->creer);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', $url, '', $user->hasRight('tax', 'charges', 'creer'));
|
||||
|
||||
print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy');
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ $arrayofpaymentmodetomanage = explode(',', getDolGlobalString('BANK_PAYMENT_MODE
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setdate' && $user->rights->banque->cheque) {
|
||||
if ($action == 'setdate' && $user->hasRight('banque', 'cheque')) {
|
||||
$result = $object->fetch(GETPOST('id', 'int'));
|
||||
if ($result > 0) {
|
||||
$date = dol_mktime(0, 0, 0, GETPOST('datecreate_month', 'int'), GETPOST('datecreate_day', 'int'), GETPOST('datecreate_year', 'int'));
|
||||
|
|
@ -113,7 +113,7 @@ if ($action == 'setdate' && $user->rights->banque->cheque) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setrefext' && $user->rights->banque->cheque) {
|
||||
if ($action == 'setrefext' && $user->hasRight('banque', 'cheque')) {
|
||||
$result = $object->fetch(GETPOST('id', 'int'));
|
||||
if ($result > 0) {
|
||||
$ref_ext = GETPOST('ref_ext');
|
||||
|
|
@ -127,7 +127,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setref' && $user->rights->banque->cheque) {
|
||||
if ($action == 'setref' && $user->hasRight('banque', 'cheque')) {
|
||||
$result = $object->fetch(GETPOST('id', 'int'));
|
||||
if ($result > 0) {
|
||||
$ref = GETPOST('ref');
|
||||
|
|
@ -141,7 +141,7 @@ if ($action == 'setref' && $user->rights->banque->cheque) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->banque->cheque) {
|
||||
if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->hasRight('banque', 'cheque')) {
|
||||
if (GETPOSTISARRAY('toRemise')) {
|
||||
$object->type = $type;
|
||||
$arrayofid = GETPOST('toRemise', 'array:int');
|
||||
|
|
@ -175,7 +175,7 @@ if ($action == 'create' && GETPOST("accountid", "int") > 0 && $user->rights->ban
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'remove' && $id > 0 && GETPOST("lineid", 'int') > 0 && $user->rights->banque->cheque) {
|
||||
if ($action == 'remove' && $id > 0 && GETPOST("lineid", 'int') > 0 && $user->hasRight('banque', 'cheque')) {
|
||||
$object->id = $id;
|
||||
$result = $object->removeCheck(GETPOST("lineid", "int"));
|
||||
if ($result === 0) {
|
||||
|
|
@ -186,7 +186,7 @@ if ($action == 'remove' && $id > 0 && GETPOST("lineid", 'int') > 0 && $user->rig
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->cheque) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('banque', 'cheque')) {
|
||||
$object->id = $id;
|
||||
$result = $object->delete();
|
||||
if ($result == 0) {
|
||||
|
|
@ -197,7 +197,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->banque->cheque) {
|
||||
if ($action == 'confirm_validate' && $confirm == 'yes' && $user->hasRight('banque', 'cheque')) {
|
||||
$result = $object->fetch($id);
|
||||
$result = $object->validate($user);
|
||||
if ($result >= 0) {
|
||||
|
|
@ -221,7 +221,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->banque-
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->banque->cheque) {
|
||||
if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->hasRight('banque', 'cheque')) {
|
||||
$reject_date = dol_mktime(0, 0, 0, GETPOST('rejectdate_month'), GETPOST('rejectdate_day'), GETPOST('rejectdate_year'));
|
||||
$rejected_check = GETPOST('bankid', 'int');
|
||||
|
||||
|
|
@ -238,7 +238,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'builddoc' && $user->rights->banque->cheque) {
|
||||
if ($action == 'builddoc' && $user->hasRight('banque', 'cheque')) {
|
||||
$result = $object->fetch($id);
|
||||
|
||||
// Save last template used to generate document
|
||||
|
|
@ -262,7 +262,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) {
|
|||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc'));
|
||||
exit;
|
||||
}
|
||||
} elseif ($action == 'remove_file' && $user->rights->banque->cheque) {
|
||||
} elseif ($action == 'remove_file' && $user->hasRight('banque', 'cheque')) {
|
||||
// Remove file in doc form
|
||||
if ($object->fetch($id) > 0) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
|
@ -582,7 +582,7 @@ if ($action == 'new') {
|
|||
print '</div>';
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->rights->banque->cheque) {
|
||||
if ($user->hasRight('banque', 'cheque')) {
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('NewCheckDepositOn', $account_label).'">';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans('NewCheckDepositOn', $account_label).'</a>';
|
||||
|
|
@ -794,11 +794,11 @@ if ($action == 'new') {
|
|||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->socid == 0 && !empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) {
|
||||
if ($user->socid == 0 && !empty($object->id) && $object->statut == 0 && $user->hasRight('banque', 'cheque')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=valide&token='.newToken().'&sortfield='.$sortfield.'&sortorder='.$sortorder.'">'.$langs->trans('Validate').'</a>';
|
||||
}
|
||||
|
||||
if ($user->socid == 0 && !empty($object->id) && $user->rights->banque->cheque) {
|
||||
if ($user->socid == 0 && !empty($object->id) && $user->hasRight('banque', 'cheque')) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete);
|
||||
}
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ class RemiseCheque extends CommonObject
|
|||
if (!empty($conf->global->CHEQUERECEIPTS_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->CHEQUERECEIPTS_ADDON.".php";
|
||||
$file = getDolGlobalString('CHEQUERECEIPTS_ADDON') . ".php";
|
||||
$classname = $conf->global->CHEQUERECEIPTS_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
@ -427,8 +427,8 @@ class RemiseCheque extends CommonObject
|
|||
|
||||
// For compatibility
|
||||
if (!$mybool) {
|
||||
$file = $conf->global->CHEQUERECEIPTS_ADDON.".php";
|
||||
$classname = "mod_chequereceipt_".$conf->global->CHEQUERECEIPTS_ADDON;
|
||||
$file = getDolGlobalString('CHEQUERECEIPTS_ADDON') . ".php";
|
||||
$classname = "mod_chequereceipt_" . getDolGlobalString('CHEQUERECEIPTS_ADDON');
|
||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||
|
|
@ -819,7 +819,7 @@ class RemiseCheque extends CommonObject
|
|||
public function set_date($user, $date)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($user->rights->banque->cheque) {
|
||||
if ($user->hasRight('banque', 'cheque')) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " SET date_bordereau = ".($date ? "'".$this->db->idate($date)."'" : 'null');
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
|
@ -849,7 +849,7 @@ class RemiseCheque extends CommonObject
|
|||
public function set_number($user, $ref)
|
||||
{
|
||||
// phpcs:enable
|
||||
if ($user->rights->banque->cheque) {
|
||||
if ($user->hasRight('banque', 'cheque')) {
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql .= " SET ref = '".$this->db->escape($ref)."'";
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ if ($resql) {
|
|||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->rights->banque->cheque);
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('NewCheckDeposit'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('banque', 'cheque'));
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
if ($optioncss != '') {
|
||||
|
|
|
|||
|
|
@ -1123,7 +1123,7 @@ class Paiement extends CommonObject
|
|||
if (!empty($conf->global->PAYMENT_ADDON)) {
|
||||
$mybool = false;
|
||||
|
||||
$file = $conf->global->PAYMENT_ADDON.".php";
|
||||
$file = getDolGlobalString('PAYMENT_ADDON') . ".php";
|
||||
$classname = $conf->global->PAYMENT_ADDON;
|
||||
|
||||
// Include file with class
|
||||
|
|
@ -1140,8 +1140,8 @@ class Paiement extends CommonObject
|
|||
|
||||
// For compatibility
|
||||
if (!$mybool) {
|
||||
$file = $conf->global->PAYMENT_ADDON.".php";
|
||||
$classname = "mod_payment_".$conf->global->PAYMENT_ADDON;
|
||||
$file = getDolGlobalString('PAYMENT_ADDON') . ".php";
|
||||
$classname = "mod_payment_" . getDolGlobalString('PAYMENT_ADDON');
|
||||
$classname = preg_replace('/\-.*$/', '', $classname);
|
||||
// Include file with class
|
||||
foreach ($conf->file->dol_document_root as $dirroot) {
|
||||
|
|
|
|||
|
|
@ -205,11 +205,11 @@ if (GETPOST("orphelins", "alpha")) {
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
}
|
||||
$sql .= " WHERE p.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid > 0) {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ if ($user->socid > 0) {
|
|||
}
|
||||
|
||||
$dir = $conf->facture->dir_output.'/payments';
|
||||
if (empty($user->rights->societe->client->voir) || $socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') || $socid) {
|
||||
$dir .= '/private/'.$user->id; // If user has no permission to see all, output dir is specific to user
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
|||
*/
|
||||
|
||||
if ($action == '') {
|
||||
if ($user->rights->tax->charges->supprimer) {
|
||||
if ($user->hasRight('tax', 'charges', 'supprimer')) {
|
||||
if (!$disable_delete) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ if ($id > 0) {
|
|||
*/
|
||||
|
||||
// Delete payment
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->charges->supprimer) {
|
||||
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('tax', 'charges', 'supprimer')) {
|
||||
$db->begin();
|
||||
|
||||
$result = $object->delete($user);
|
||||
|
|
@ -295,7 +295,7 @@ if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
|
|||
*/
|
||||
|
||||
if ($action == '') {
|
||||
if ($user->rights->tax->charges->supprimer) {
|
||||
if ($user->hasRight('tax', 'charges', 'supprimer')) {
|
||||
if (!$disable_delete) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', 1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ $sql .= " pfd.date_demande, pfd.amount,";
|
|||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= ", ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
|
|
@ -119,7 +119,7 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
|
|||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.fk_facture_fourn = f.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ if ($id > 0 || $ref) {
|
|||
print $formconfirm;
|
||||
|
||||
|
||||
if (empty($object->date_trans) && (($user->rights->prelevement->bons->send && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->send && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
|
||||
if (empty($object->date_trans) && (($user->hasRight('prelevement', 'bons', 'send') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'send') && $object->type == 'bank-transfer')) && $action == 'settransmitted') {
|
||||
print '<form method="post" name="userfile" action="card.php?id='.$object->id.'" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="infotrans">';
|
||||
|
|
@ -385,7 +385,7 @@ if ($id > 0 || $ref) {
|
|||
print '<br>';
|
||||
}
|
||||
|
||||
if (!empty($object->date_trans) && empty($object->date_credit) && (($user->rights->prelevement->bons->credit && $object->type != 'bank-transfer') || ($user->rights->paymentbybanktransfer->debit && $object->type == 'bank-transfer')) && $action == 'setcredited') {
|
||||
if (!empty($object->date_trans) && empty($object->date_credit) && (($user->hasRight('prelevement', 'bons', 'credit') && $object->type != 'bank-transfer') || ($user->hasRight('paymentbybanktransfer', 'debit') && $object->type == 'bank-transfer')) && $action == 'setcredited') {
|
||||
$btnLabel = ($object->type == 'bank-transfer') ? $langs->trans("ClassDebited") : $langs->trans("ClassCredited");
|
||||
print '<form name="infocredit" method="post" action="card.php?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
|
|
@ -410,16 +410,16 @@ if ($id > 0 || $ref) {
|
|||
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) {
|
||||
if (empty($object->date_trans)) {
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->send);
|
||||
else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->send);
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'send'));
|
||||
else print dolGetButtonAction($langs->trans("SetToStatusSent"), '', 'default', 'card.php?action=settransmitted&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'send'));
|
||||
}
|
||||
if (!empty($object->date_trans) && empty($object->date_credit)) {
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->debit);
|
||||
else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->credit);
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("ClassDebited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'debit'));
|
||||
else print dolGetButtonAction($langs->trans("ClassCredited"), '', 'default', 'card.php?action=setcredited&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'credit'));
|
||||
}
|
||||
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->paymentbybanktransfer->create);
|
||||
else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->rights->prelevement->bons->creer);
|
||||
if ($object->type == 'bank-transfer') print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->hasRight('paymentbybanktransfer', 'create'));
|
||||
else print dolGetButtonAction($langs->trans("Delete"), '', 'delete', 'card.php?action=delete&token='.newToken().'&id='.$object->id, '', $user->hasRight('prelevement', 'bons', 'creer'));
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,12 +138,12 @@ if ($type != 'bank-transfer') {
|
|||
}
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.rowid = f.fk_soc";
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ $sql .= " pfd.date_demande, pfd.amount,";
|
|||
$sql .= " s.nom as name, s.email, s.rowid as socid, s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."societe as s";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " , ".MAIN_DB_PREFIX."prelevement_demande as pfd";
|
||||
|
|
@ -119,7 +119,7 @@ if (empty($conf->global->WITHDRAWAL_ALLOW_ANY_INVOICE_STATUS)) {
|
|||
$sql .= " AND pfd.traite = 0";
|
||||
$sql .= " AND pfd.ext_payment_id IS NULL";
|
||||
$sql .= " AND pfd.fk_facture = f.rowid";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($socid) {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ if ($id) {
|
|||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($action == 'rejet' && $user->rights->prelevement->bons->credit) {
|
||||
if ($action == 'rejet' && $user->hasRight('prelevement', 'bons', 'credit')) {
|
||||
$soc = new Societe($db);
|
||||
$soc->fetch($lipre->socid);
|
||||
|
||||
|
|
@ -255,7 +255,7 @@ if ($id) {
|
|||
if ($action == '') {
|
||||
if ($bon->statut == BonPrelevement::STATUS_CREDITED) {
|
||||
if ($lipre->statut == 2) {
|
||||
if ($user->rights->prelevement->bons->credit) {
|
||||
if ($user->hasRight('prelevement', 'bons', 'credit')) {
|
||||
print '<a class="butActionDelete" href="line.php?action=rejet&type='.$type.'&id='.$lipre->id.'">'.$langs->trans("StandingOrderReject").'</a>';
|
||||
} else {
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans("StandingOrderReject").'</a>';
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ if (empty($reshook)) {
|
|||
$result = $object->setPaid($user);
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'reopen' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
if ($object->paye) {
|
||||
$result = $object->setUnpaid($user);
|
||||
if ($result > 0) {
|
||||
|
|
@ -506,8 +506,8 @@ if ($id > 0) {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
|
||||
// Employee
|
||||
if ($action != 'editfk_user') {
|
||||
|
|
@ -518,7 +518,7 @@ if ($id > 0) {
|
|||
$morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1);
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1);
|
||||
$morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->hasRight('salaries', 'write'), 'string', '', 0, 1);
|
||||
if ($object->fk_user > 0) {
|
||||
$userstatic = new User($db);
|
||||
$result = $userstatic->fetch($object->fk_user);
|
||||
|
|
@ -631,7 +631,7 @@ if ($id > 0) {
|
|||
print '<table class="centpercent nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('DefaultBankAccount');
|
||||
print '<td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
|
||||
if ($action != 'editbankaccount' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -786,32 +786,32 @@ if ($id > 0) {
|
|||
print '<div class="tabsAction">'."\n";
|
||||
|
||||
// Reopen
|
||||
if ($object->paye && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen").'</a></div>';
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($object->paye == 0 && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye == 0 && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
// Emit payment
|
||||
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement_charge.php?id='.$object->id.'&action=create&token='.newToken().'">'.$langs->trans("DoPayment")."</a></div>";
|
||||
}
|
||||
|
||||
// Classify 'paid'
|
||||
if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye == 0 && round($resteapayer) <= 0 && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=paid&token='.newToken().'">'.$langs->trans("ClassifyPaid").'</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->tax->charges->creer) {
|
||||
if ($user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=clone&token='.newToken().'">'.$langs->trans("ToClone")."</a></div>";
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->tax->charges->supprimer && empty($totalpaid)) {
|
||||
if ($user->hasRight('tax', 'charges', 'supprimer') && empty($totalpaid)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ $permissiontoadd = $user->rights->tax->charges->creer; // Used by the include of
|
|||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0) {
|
||||
|
|
@ -119,8 +119,8 @@ if ($object->id) {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ $result = restrictedArea($user, 'tax', $object->id, 'chargesociales', 'charges')
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('libelle', GETPOST('lib'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0) {
|
||||
|
|
@ -88,8 +88,8 @@ print dol_get_fiche_head($head, 'info', $langs->trans("SocialContribution"), -1,
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ if ($id > 0 || !empty($ref)) {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
if (isModEnabled('project')) {
|
||||
$langs->load("projects");
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ if (empty($reshook)) {
|
|||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0) {
|
||||
|
|
@ -121,7 +121,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'setdatev' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setdatev' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$object->datev = $datev;
|
||||
$result = $object->update($user);
|
||||
|
|
@ -133,7 +133,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// payment mode
|
||||
if ($action == 'setmode' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setmode' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -142,7 +142,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Bank account
|
||||
if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setbankaccount' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
if ($result < 0) {
|
||||
|
|
@ -151,12 +151,12 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Classify paid
|
||||
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') {
|
||||
if ($action == 'confirm_paid' && $user->hasRight('tax', 'charges', 'creer') && $confirm == 'yes') {
|
||||
$object->fetch($id);
|
||||
$result = $object->setPaid($user);
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'reopen' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye) {
|
||||
$result = $object->setUnpaid($user);
|
||||
|
|
@ -295,7 +295,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$amount = price2num(GETPOST('amount', 'alpha'), 'MT');
|
||||
|
||||
if (empty($amount)) {
|
||||
|
|
@ -321,7 +321,7 @@ if (empty($reshook)) {
|
|||
$action = '';
|
||||
}
|
||||
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->charges->creer)) {
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->hasRight('tax', 'charges', 'creer'))) {
|
||||
$db->begin();
|
||||
|
||||
$originalId = $id;
|
||||
|
|
@ -576,8 +576,8 @@ if ($id > 0) {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
// Project
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
|
|
@ -602,9 +602,9 @@ if ($id > 0) {
|
|||
print '</td></tr>';*/
|
||||
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")), 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
||||
print $form->editfieldkey($form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")), 'datev', $object->datev, $object, $user->hasRight('tax', 'charges', 'creer'), 'day');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval("PeriodEndDate", 'datev', $object->datev, $object, $user->rights->tax->charges->creer, 'day');
|
||||
print $form->editfieldval("PeriodEndDate", 'datev', $object->datev, $object, $user->hasRight('tax', 'charges', 'creer'), 'day');
|
||||
//print dol_print_date($object->datev,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
|
|
@ -637,7 +637,7 @@ if ($id > 0) {
|
|||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('BankAccount');
|
||||
print '<td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->tax->charges->creer) {
|
||||
if ($action != 'editbankaccount' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
|
|
@ -784,17 +784,17 @@ if ($id > 0) {
|
|||
|
||||
if ($action != 'edit') {
|
||||
// Reopen
|
||||
if ($object->paye && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&action=reopen&token='.newToken().'">'.$langs->trans("ReOpen")."</a></div>";
|
||||
}
|
||||
|
||||
// Edit
|
||||
if ($object->paye == 0 && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye == 0 && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans("Modify")."</a></div>";
|
||||
}
|
||||
|
||||
// Emit payment
|
||||
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer) {
|
||||
if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/paiement_vat.php?id='.$object->id.'&action=create&token='.newToken().'">'.$langs->trans("DoPayment").'</a></div>';
|
||||
}
|
||||
|
||||
|
|
@ -804,16 +804,16 @@ if ($id > 0) {
|
|||
(round($resteapayer) <= 0 && $object->amount > 0)
|
||||
|| (round($resteapayer) >= 0 && $object->amount < 0)
|
||||
)
|
||||
&& $user->rights->tax->charges->creer) {
|
||||
&& $user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&token='.newToken().'&action=paid">'.$langs->trans("ClassifyPaid")."</a></div>";
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->tax->charges->creer) {
|
||||
if ($user->hasRight('tax', 'charges', 'creer')) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/compta/tva/card.php?id='.$object->id.'&token='.newToken().'&action=clone">'.$langs->trans("ToClone")."</a></div>";
|
||||
}
|
||||
|
||||
if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaid)) {
|
||||
if ($user->hasRight('tax', 'charges', 'supprimer') && empty($totalpaid)) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete&token='.newToken().'">'.$langs->trans("Delete").'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.(dol_escape_htmltag($langs->trans("DisabledBecausePayments"))).'">'.$langs->trans("Delete").'</a></div>';
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ if ($object->id) {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ $result = restrictedArea($user, 'tax', '', 'tva', 'charges');
|
|||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'setlib' && $user->rights->tax->charges->creer) {
|
||||
if ($action == 'setlib' && $user->hasRight('tax', 'charges', 'creer')) {
|
||||
$object->fetch($id);
|
||||
$result = $object->setValueFrom('label', GETPOST('lib', 'alpha'), '', '', 'text', '', $user, 'TAX_MODIFY');
|
||||
if ($result < 0) {
|
||||
|
|
@ -74,8 +74,8 @@ print dol_get_fiche_head($head, 'info', $langs->trans("VATPayment"), -1, 'paymen
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Label of social contribution
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->rights->tax->charges->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("Label", 'lib', $object->label, $object, $user->hasRight('tax', 'charges', 'creer'), 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= '</div>';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/tva/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
// -----------------------------------------
|
||||
|
||||
// Confirm deleting contact
|
||||
if ($user->rights->societe->contact->supprimer) {
|
||||
if ($user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage ? '&backtopage='.$backtopage : ''), $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ if (!empty($this->control->tpl['action_delete'])) {
|
|||
|
||||
if (empty($user->socid)) {
|
||||
print '<div class="tabsAction">';
|
||||
if ($user->rights->societe->contact->creer) {
|
||||
if ($user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=edit&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ if (empty($user->socid)) {
|
|||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=create_user&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->supprimer) {
|
||||
if ($user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&action=delete&token='.newToken().'&canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
// Update extrafields
|
||||
if ($action == 'update_extras' && !empty($user->rights->societe->contact->creer)) {
|
||||
if ($action == 'update_extras' && $user->hasRight('societe', 'contact', 'creer')) {
|
||||
$object->oldcopy = dol_clone($object, 2);
|
||||
|
||||
// Fill array 'array_options' with data from update form
|
||||
|
|
@ -593,7 +593,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
// -----------------------------------------
|
||||
|
||||
// Confirm deleting contact
|
||||
if ($user->rights->societe->contact->supprimer) {
|
||||
if ($user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
if ($action == 'delete') {
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage ? '&backtopage='.$backtopage : ''), $langs->trans("DeleteContact"), $langs->trans("ConfirmDeleteContact"), "confirm_delete", '', 0, 1);
|
||||
}
|
||||
|
|
@ -617,7 +617,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
$head = contact_prepare_head($object);
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer) {
|
||||
if ($user->hasRight('societe', 'contact', 'creer')) {
|
||||
if ($action == 'create') {
|
||||
/*
|
||||
* Fiche en mode creation
|
||||
|
|
@ -1529,7 +1529,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
}
|
||||
}
|
||||
|
||||
if ($user->rights->societe->contact->creer) {
|
||||
if ($user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
|
|
@ -1543,8 +1543,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->societe->contact->supprimer) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($backtopage ? '&backtopage='.urlencode($backtopage) : ''), 'delete', $user->rights->societe->contact->supprimer);
|
||||
if ($user->hasRight('societe', 'contact', 'supprimer')) {
|
||||
print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken().($backtopage ? '&backtopage='.urlencode($backtopage) : ''), 'delete', $user->hasRight('societe', 'contact', 'supprimer'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,7 +416,7 @@ class Contact extends CommonObject
|
|||
|
||||
$sql = "SELECT count(sp.rowid) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
|
||||
|
|
@ -754,11 +754,11 @@ class Contact extends CommonObject
|
|||
global $conf;
|
||||
$dn = '';
|
||||
if ($mode == 0) {
|
||||
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN;
|
||||
$dn = getDolGlobalString('LDAP_KEY_CONTACTS') . "=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')]."," . getDolGlobalString('LDAP_CONTACT_DN');
|
||||
} elseif ($mode == 1) {
|
||||
$dn = $conf->global->LDAP_CONTACT_DN;
|
||||
} elseif ($mode == 2) {
|
||||
$dn = $conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS];
|
||||
$dn = getDolGlobalString('LDAP_KEY_CONTACTS') . "=".$info[getDolGlobalString('LDAP_KEY_CONTACTS')];
|
||||
}
|
||||
return $dn;
|
||||
}
|
||||
|
|
@ -785,13 +785,13 @@ class Contact extends CommonObject
|
|||
|
||||
// Fields
|
||||
if ($this->fullname && !empty($conf->global->LDAP_CONTACT_FIELD_FULLNAME)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_FULLNAME] = $this->fullname;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_FULLNAME')] = $this->fullname;
|
||||
}
|
||||
if ($this->lastname && !empty($conf->global->LDAP_CONTACT_FIELD_NAME)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_NAME] = $this->lastname;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_NAME')] = $this->lastname;
|
||||
}
|
||||
if ($this->firstname && !empty($conf->global->LDAP_CONTACT_FIELD_FIRSTNAME)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME] = $this->firstname;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_FIRSTNAME')] = $this->firstname;
|
||||
}
|
||||
|
||||
if ($this->poste) {
|
||||
|
|
@ -801,7 +801,7 @@ class Contact extends CommonObject
|
|||
$soc = new Societe($this->db);
|
||||
$soc->fetch($this->socid);
|
||||
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_COMPANY] = $soc->name;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_COMPANY')] = $soc->name;
|
||||
if ($soc->client == 1) {
|
||||
$info["businessCategory"] = "Customers";
|
||||
}
|
||||
|
|
@ -813,34 +813,34 @@ class Contact extends CommonObject
|
|||
}
|
||||
}
|
||||
if ($this->address && !empty($conf->global->LDAP_CONTACT_FIELD_ADDRESS)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_ADDRESS] = $this->address;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_ADDRESS')] = $this->address;
|
||||
}
|
||||
if ($this->zip && !empty($conf->global->LDAP_CONTACT_FIELD_ZIP)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_ZIP] = $this->zip;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_ZIP')] = $this->zip;
|
||||
}
|
||||
if ($this->town && !empty($conf->global->LDAP_CONTACT_FIELD_TOWN)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_TOWN] = $this->town;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_TOWN')] = $this->town;
|
||||
}
|
||||
if ($this->country_code && !empty($conf->global->LDAP_CONTACT_FIELD_COUNTRY)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_COUNTRY] = $this->country_code;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_COUNTRY')] = $this->country_code;
|
||||
}
|
||||
if ($this->phone_pro && !empty($conf->global->LDAP_CONTACT_FIELD_PHONE)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_PHONE] = $this->phone_pro;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_PHONE')] = $this->phone_pro;
|
||||
}
|
||||
if ($this->phone_perso && !empty($conf->global->LDAP_CONTACT_FIELD_HOMEPHONE)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE] = $this->phone_perso;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_HOMEPHONE')] = $this->phone_perso;
|
||||
}
|
||||
if ($this->phone_mobile && !empty($conf->global->LDAP_CONTACT_FIELD_MOBILE)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_MOBILE] = $this->phone_mobile;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_MOBILE')] = $this->phone_mobile;
|
||||
}
|
||||
if ($this->fax && !empty($conf->global->LDAP_CONTACT_FIELD_FAX)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_FAX] = $this->fax;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_FAX')] = $this->fax;
|
||||
}
|
||||
if ($this->note_private && !empty($conf->global->LDAP_CONTACT_FIELD_DESCRIPTION)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_private, 2);
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_DESCRIPTION')] = dol_string_nohtmltag($this->note_private, 2);
|
||||
}
|
||||
if ($this->email && !empty($conf->global->LDAP_CONTACT_FIELD_MAIL)) {
|
||||
$info[$conf->global->LDAP_CONTACT_FIELD_MAIL] = $this->email;
|
||||
$info[getDolGlobalString('LDAP_CONTACT_FIELD_MAIL')] = $this->email;
|
||||
}
|
||||
|
||||
if (getDolGlobalString('LDAP_SERVER_TYPE') == 'egroupware') {
|
||||
|
|
|
|||
|
|
@ -175,10 +175,10 @@ if (isModEnabled('ficheinter') && $user->hasRight('ficheinter', 'lire')) {
|
|||
|
||||
if ($object->thirdparty->fournisseur) {
|
||||
$thirdTypeArray['supplier'] = $langs->trans("supplier");
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
|
||||
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
|
||||
}
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
|
||||
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire'))) {
|
||||
$elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ if (isset($extrafields->attributes[$object->table_element]['label']) && is_array
|
|||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
|
||||
}
|
||||
|
||||
|
|
@ -503,7 +503,7 @@ $parameters = array();
|
|||
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' WHERE p.entity IN ('.getEntity('contact').')';
|
||||
if (empty($user->rights->societe->client->voir) && !$socid) { //restriction
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$socid) { //restriction
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR p.fk_soc IS NULL)";
|
||||
}
|
||||
if (!empty($userid)) { // propre au commercial
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ if ($action != 'edit') {
|
|||
if ($user->socid == 0) {
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->contact->creer) {
|
||||
if ($user->hasRight('societe', 'contact', 'creer')) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify').'</a>';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ if (!$error && $massaction == 'confirm_presend') {
|
|||
if ($fromtype === 'user') {
|
||||
$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
|
||||
} elseif ($fromtype === 'company') {
|
||||
$from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
$from = getDolGlobalString('MAIN_INFO_SOCIETE_NOM') . ' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
|
||||
} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp = explode(',', $user->email_aliases);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
|
|
@ -429,25 +429,25 @@ if (!$error && $massaction == 'confirm_presend') {
|
|||
|
||||
$sendtobcc = GETPOST('sendtoccc');
|
||||
if ($objectclass == 'Propal') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO')));
|
||||
}
|
||||
if ($objectclass == 'Commande') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO')));
|
||||
}
|
||||
if ($objectclass == 'Facture') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO')));
|
||||
}
|
||||
if ($objectclass == 'Supplier_Proposal') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO')));
|
||||
}
|
||||
if ($objectclass == 'CommandeFournisseur') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO')));
|
||||
}
|
||||
if ($objectclass == 'FactureFournisseur') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO')));
|
||||
}
|
||||
if ($objectclass == 'Project') {
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc ? ", " : "").$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO));
|
||||
$sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO')));
|
||||
}
|
||||
|
||||
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
|
||||
|
|
@ -1739,8 +1739,8 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf
|
|||
|
||||
$defaultref = '';
|
||||
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . ".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON') . '.php';
|
||||
$modTask = new $obj;
|
||||
$defaultref = $modTask->getNextValue(0, $clone_task);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
// Filename to print must be provided into 'file' parameter
|
||||
|
||||
// Print file
|
||||
if ($action == 'print_file' && $user->rights->printing->read) {
|
||||
if ($action == 'print_file' && $user->hasRight('printing', 'read')) {
|
||||
$langs->load("printing");
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/modules_printing.php';
|
||||
$objectprint = new PrintingDriver($db);
|
||||
|
|
|
|||
|
|
@ -277,11 +277,11 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
|||
$reg = array();
|
||||
$fromtype = GETPOST('fromtype', 'alpha');
|
||||
if ($fromtype === 'robot') {
|
||||
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
|
||||
$from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>';
|
||||
} elseif ($fromtype === 'user') {
|
||||
$from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
|
||||
} elseif ($fromtype === 'company') {
|
||||
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
|
||||
$from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
|
||||
} elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
|
||||
$tmp = explode(',', $user->email_aliases);
|
||||
$from = trim($tmp[($reg[1] - 1)]);
|
||||
|
|
@ -322,7 +322,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
|||
// Autocomplete the $sendtobcc
|
||||
// $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
|
||||
if (!empty($autocopy)) {
|
||||
$sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "").$conf->global->$autocopy));
|
||||
$sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)));
|
||||
}
|
||||
|
||||
$deliveryreceipt = GETPOST('deliveryreceipt');
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ if (empty($conf->bookmark->enabled)) {
|
|||
}
|
||||
|
||||
$newcardbutton = '';
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
|
||||
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', $user->hasRight('bookmark', 'creer'));
|
||||
|
||||
// Url to list bookmark
|
||||
$bookmarkList .= '<br>';
|
||||
|
|
|
|||
|
|
@ -985,19 +985,19 @@ class CMailFile
|
|||
$res = true;
|
||||
$from = $this->smtps->getFrom('org');
|
||||
if ($res && !$from) {
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - Sender address '$from' invalid";
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport)." - Sender address '$from' invalid";
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
$res = false;
|
||||
}
|
||||
$dest = $this->smtps->getTo();
|
||||
if ($res && !$dest) {
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - Recipient address '$dest' invalid";
|
||||
$this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport)." - Recipient address '$dest' invalid";
|
||||
dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR);
|
||||
$res = false;
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
dol_syslog("CMailFile::sendfile: sendMsg, HOST=".$server.", PORT=".$conf->global->$keyforsmtpport, LOG_DEBUG);
|
||||
dol_syslog("CMailFile::sendfile: sendMsg, HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport), LOG_DEBUG);
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
$this->smtps->setDebug(true);
|
||||
|
|
@ -1037,7 +1037,7 @@ class CMailFile
|
|||
if (empty($this->error)) {
|
||||
$this->error = $result;
|
||||
}
|
||||
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport." - ".$this->error, LOG_ERR);
|
||||
dol_syslog("CMailFile::sendfile: mail end error with smtps lib to HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport)." - ".$this->error, LOG_ERR);
|
||||
$res = false;
|
||||
|
||||
if (!empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
|
|
@ -1161,7 +1161,7 @@ class CMailFile
|
|||
$this->mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($this->logger));
|
||||
}
|
||||
|
||||
dol_syslog("CMailFile::sendfile: mailer->send, HOST=".$server.", PORT=".$conf->global->$keyforsmtpport, LOG_DEBUG);
|
||||
dol_syslog("CMailFile::sendfile: mailer->send, HOST=".$server.", PORT=" . getDolGlobalString($keyforsmtpport), LOG_DEBUG);
|
||||
|
||||
// send mail
|
||||
$failedRecipients = array();
|
||||
|
|
|
|||
|
|
@ -2139,12 +2139,12 @@ abstract class CommonObject
|
|||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".$this->db->prefix()."societe as s"; // If we need to link to societe to limit select to socid
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if ($restrictiononfksoc && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
}
|
||||
if ($fieldid == 'rowid') {
|
||||
|
|
@ -2152,10 +2152,10 @@ abstract class CommonObject
|
|||
} else {
|
||||
$sql .= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
}
|
||||
if ($restrictiononfksoc == 1 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($restrictiononfksoc == 2 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc == 2 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id).' OR te.fk_soc IS NULL)';
|
||||
}
|
||||
if (!empty($filter)) {
|
||||
|
|
@ -2167,7 +2167,7 @@ abstract class CommonObject
|
|||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= " AND te.".$tmparray[0]." = ".($tmparray[1] == "societe" ? "s" : "parenttable").".rowid"; // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
|
|
@ -2209,12 +2209,12 @@ abstract class CommonObject
|
|||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ", ".$this->db->prefix()."societe as s"; // If we need to link to societe to limit select to socid
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 2 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if ($restrictiononfksoc && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " LEFT JOIN ".$this->db->prefix()."societe_commerciaux as sc ON ".$aliastablesociete.".rowid = sc.fk_soc";
|
||||
}
|
||||
if ($fieldid == 'rowid') {
|
||||
|
|
@ -2222,10 +2222,10 @@ abstract class CommonObject
|
|||
} else {
|
||||
$sql .= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists)
|
||||
}
|
||||
if ($restrictiononfksoc == 1 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc == 1 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||
}
|
||||
if ($restrictiononfksoc == 2 && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
if ($restrictiononfksoc == 2 && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= " AND (sc.fk_user = ".((int) $user->id).' OR te.fk_soc IS NULL)';
|
||||
}
|
||||
if (!empty($filter)) {
|
||||
|
|
@ -2237,7 +2237,7 @@ abstract class CommonObject
|
|||
if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) {
|
||||
$tmparray = explode('@', $this->ismultientitymanaged);
|
||||
$sql .= " AND te.".$tmparray[0]." = ".($tmparray[1] == "societe" ? "s" : "parenttable").".rowid"; // If we need to link to this table to limit select to entity
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && empty($user->rights->societe->client->voir) && !$socid) {
|
||||
} elseif ($restrictiononfksoc == 1 && $this->element != 'societe' && !$user->hasRight('societe', 'client', 'voir') && !$socid) {
|
||||
$sql .= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
|
|
@ -8674,10 +8674,10 @@ abstract class CommonObject
|
|||
if ($element == 'facturerec') {
|
||||
$element = 'facture';
|
||||
} elseif ($element == 'invoice_supplier_rec') {
|
||||
return empty($user->rights->fournisseur->facture) ? null : $user->rights->fournisseur->facture;
|
||||
} elseif ($module && !empty($user->rights->$module->$element)) {
|
||||
return !$user->hasRight('fournisseur', 'facture') ? null : $user->hasRight('fournisseur', 'facture');
|
||||
} elseif ($module && $user->hasRight($module, $element)) {
|
||||
// for modules built with ModuleBuilder
|
||||
return $user->rights->$module->$element;
|
||||
return $user->hasRight($module, $element);
|
||||
}
|
||||
|
||||
return $user->rights->$element;
|
||||
|
|
|
|||
|
|
@ -1446,7 +1446,7 @@ class Form
|
|||
if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) {
|
||||
$sql .= " LEFT JOIN " . $this->db->prefix() . "c_country as dictp ON dictp.rowid = s.fk_pays";
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
|
||||
}
|
||||
$sql .= " WHERE s.entity IN (" . getEntity('societe') . ")";
|
||||
|
|
@ -1458,7 +1458,7 @@ class Form
|
|||
// if not, by testSqlAndScriptInject() only.
|
||||
$sql .= " AND (" . $filter . ")";
|
||||
}
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
|
||||
}
|
||||
if (!empty($conf->global->COMPANY_HIDE_INACTIVE_IN_COMBOBOX)) {
|
||||
|
|
@ -3162,7 +3162,7 @@ class Form
|
|||
$opt .= ' pbq="' . $objp->price_by_qty_rowid . '" data-pbq="' . $objp->price_by_qty_rowid . '" data-pbqup="' . $objp->price_by_qty_unitprice . '" data-pbqbase="' . $objp->price_by_qty_price_base_type . '" data-pbqqty="' . $objp->price_by_qty_quantity . '" data-pbqpercent="' . $objp->price_by_qty_remise_percent . '"';
|
||||
}
|
||||
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
if (!empty($user->rights->stock->lire)) {
|
||||
if ($user->hasRight('stock', 'lire')) {
|
||||
if ($objp->stock > 0) {
|
||||
$opt .= ' class="product_line_stock_ok"';
|
||||
} elseif ($objp->stock <= 0) {
|
||||
|
|
@ -3319,7 +3319,7 @@ class Form
|
|||
}
|
||||
|
||||
if (isModEnabled('stock') && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
if (!empty($user->rights->stock->lire)) {
|
||||
if ($user->hasRight('stock', 'lire')) {
|
||||
$opt .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
|
|
@ -3745,7 +3745,7 @@ class Form
|
|||
if (isModEnabled('stock') && $showstockinlist && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) {
|
||||
$novirtualstock = ($showstockinlist == 2);
|
||||
|
||||
if (!empty($user->rights->stock->lire)) {
|
||||
if ($user->hasRight('stock', 'lire')) {
|
||||
$outvallabel .= ' - ' . $langs->trans("Stock") . ': ' . price(price2num($objp->stock, 'MS'));
|
||||
|
||||
if ($objp->stock > 0) {
|
||||
|
|
@ -8159,7 +8159,7 @@ class Form
|
|||
$sql .= " INNER JOIN " . $this->db->prefix() . $tmparray[1] . " as parenttable ON parenttable.rowid = t." . $tmparray[0];
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= ", " . $this->db->prefix() . "societe_commerciaux as sc";
|
||||
}
|
||||
}
|
||||
|
|
@ -8193,7 +8193,7 @@ class Form
|
|||
}
|
||||
}
|
||||
if ($objecttmp->ismultientitymanaged === 'fk_soc@societe') {
|
||||
if (empty($user->rights->societe->client->voir) && !$user->socid) {
|
||||
if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
|
||||
$sql .= " AND t.rowid = sc.fk_soc AND sc.fk_user = " . ((int) $user->id);
|
||||
}
|
||||
}
|
||||
|
|
@ -10338,7 +10338,7 @@ class Form
|
|||
}
|
||||
|
||||
if (empty($projectsListId)) {
|
||||
if (empty($usertofilter->rights->projet->all->lire)) {
|
||||
if (!$usertofilter->hasRight('projet', 'all', 'lire')) {
|
||||
$projectstatic = new Project($this->db);
|
||||
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($usertofilter, 0, 1);
|
||||
}
|
||||
|
|
@ -10386,7 +10386,7 @@ class Form
|
|||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($usertofilter->rights->societe->lire)) {
|
||||
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$usertofilter->hasRight('societe', 'lire')) {
|
||||
// Do nothing
|
||||
} else {
|
||||
if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class FormAdmin
|
|||
global $conf, $langs;
|
||||
|
||||
if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) {
|
||||
$filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1;
|
||||
$filter[getDolGlobalString('MAIN_DEFAULT_LANGUAGE_FILTER')] = 1;
|
||||
}
|
||||
|
||||
$langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly);
|
||||
|
|
|
|||
|
|
@ -1259,7 +1259,7 @@ class FormFile
|
|||
if ($user->hasRight('produit', 'creer') && $object->type == Product::TYPE_PRODUCT) {
|
||||
$permtoeditline = 1;
|
||||
}
|
||||
if ($user->rights->service->creer && $object->type == Product::TYPE_SERVICE) {
|
||||
if ($user->hasRight('service', 'creer') && $object->type == Product::TYPE_SERVICE) {
|
||||
$permtoeditline = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user