Merge remote-tracking branch 'doligithub/develop' into develop

This commit is contained in:
lmarcouiller 2020-11-13 10:10:00 +01:00
commit fbdcbc5351
33 changed files with 226 additions and 112 deletions

View File

@ -13,5 +13,5 @@ jobs:
- name: Exakat - name: Exakat
uses: docker://exakat/exakat-ga uses: docker://exakat/exakat-ga
with: with:
ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/WrongNumberOfArguments,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/UselessParenthesis,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UseConstant' ignore_rules: 'Classes/UseInstanceof,Performances/PrePostIncrement,Functions/UndefinedFunctions,Functions/WrongNumberOfArguments,Functions/WrongTypeWithCall,Variables/UndefinedVariable,Classes/DontUnsetProperties,Classes/NonPpp,Classes/StaticMethodsCalledFromObject,Classes/UseClassOperator,Functions/UsesDefaultArguments,Php/NoClassInGlobal,Php/ShouldUseCoalesce,Php/WrongTypeForNativeFunction,Structures/MergeIfThen,Structures/ElseIfElseif,Structures/RepeatedPrint,Structures/SameConditions,Structures/SwitchWithoutDefault,Structures/ShouldMakeTernary,Structures/UselessParenthesis,Structures/UseConstant'
ignore_dirs: '/htdocs/includes,/htdocs/build,/htdocs/dev,/htdocs/doc,/htdocs/scripts,/htdocs/test' ignore_dirs: '/htdocs/includes,/build,/dev,/doc,/scripts,/test'

View File

@ -221,7 +221,9 @@ class PrestaShopWebservice
* Load XML from string. Can throw exception * Load XML from string. Can throw exception
* *
* @param string $response String from a CURL response * @param string $response String from a CURL response
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
protected function parseXML($response) protected function parseXML($response)
{ {
@ -251,6 +253,8 @@ class PrestaShopWebservice
* *
* @param array $options Options * @param array $options Options
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function add($options) public function add($options)
{ {
@ -268,10 +272,10 @@ class PrestaShopWebservice
} else { } else {
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); $this->checkStatusCode($request['status_code']);
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
/** /**
@ -300,7 +304,9 @@ class PrestaShopWebservice
* ?> * ?>
* </code> * </code>
* @param array $options Array representing resource to get. * @param array $options Array representing resource to get.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement|boolean status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function get($options) public function get($options)
{ {
@ -326,9 +332,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given '); throw new PrestaShopWebserviceException('Bad parameters given ');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET'));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
/** /**
@ -336,6 +342,8 @@ class PrestaShopWebservice
* *
* @param array $options Array representing resource for head request. * @param array $options Array representing resource for head request.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function head($options) public function head($options)
{ {
@ -358,8 +366,8 @@ class PrestaShopWebservice
} else { } else {
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return $request['header']; return $request['header'];
} }
/** /**
@ -372,6 +380,8 @@ class PrestaShopWebservice
* *
* @param array $options Array representing resource to edit. * @param array $options Array representing resource to edit.
* @return SimpleXMLElement status_code, response * @return SimpleXMLElement status_code, response
*
* @throw PrestaShopWebserviceException
*/ */
public function edit($options) public function edit($options)
{ {
@ -390,9 +400,9 @@ class PrestaShopWebservice
throw new PrestaShopWebserviceException('Bad parameters given'); throw new PrestaShopWebserviceException('Bad parameters given');
} }
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); $request = $this->executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml));
self::checkStatusCode($request['status_code']); // check the response validity $this->checkStatusCode($request['status_code']); // check the response validity
return self::parseXML($request['response']); return $this->parseXML($request['response']);
} }
} }

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -118,7 +118,7 @@ foreach ($eventstolog as $key => $arr)
print '<td>'.$arr['id'].'</td>'; print '<td>'.$arr['id'].'</td>';
print '<td class="center">'; print '<td class="center">';
$key = 'MAIN_LOGEVENTS_'.$arr['id']; $key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = $conf->global->$key; $value = empty($conf->global->$key) ? '' : $conf->global->$key;
print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>'; print '<input class="oddeven checkforselect" type="checkbox" name="'.$key.'" value="1"'.($value ? ' checked' : '').'>';
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }

View File

@ -25,6 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("install", "other", "admin")); $langs->loadLangs(array("install", "other", "admin"));
@ -52,7 +53,7 @@ print load_fiche_titre($langs->trans("Security"), '', 'title_setup');
print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>'; print '<span class="opacitymedium">'.$langs->trans("YouMayFindSecurityAdviceHere", 'hhttps://wiki.dolibarr.org/index.php/Security_information').'</span> (<a href="'.$_SERVER["PHP_SELF"].'">'.$langs->trans("Reload").'</a>)<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("PHPSetup"), '', ''); print load_fiche_titre($langs->trans("PHPSetup"), '', 'folder');
// Get version of PHP // Get version of PHP
$phpversion = version_php(); $phpversion = version_php();
@ -77,7 +78,7 @@ else {
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("ConfigFile"), '', ''); print load_fiche_titre($langs->trans("ConfigFile"), '', 'folder');
print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod; print '<strong>'.$langs->trans("dolibarr_main_prod").'</strong>: '.$dolibarr_main_prod;
if (empty($dolibarr_main_prod)) { if (empty($dolibarr_main_prod)) {
@ -94,7 +95,7 @@ print '<br>';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("Permissions"), '', ''); print load_fiche_titre($langs->trans("Permissions"), '', 'folder');
print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: '; print '<strong>'.$langs->trans("PermissionsOnFilesInWebRoot").'</strong>: ';
// TODO Check permission are read only except for custom dir // TODO Check permission are read only except for custom dir
@ -109,7 +110,7 @@ print '<br>';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("DolibarrModules"), '', ''); print load_fiche_titre($langs->trans("Modules"), '', 'folder');
// Module log // Module log
print '<strong>'.$langs->trans("Syslog").'</strong>: '; print '<strong>'.$langs->trans("Syslog").'</strong>: ';
@ -133,10 +134,12 @@ print '<br>';
print '<br>'; print '<br>';
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', ''); print load_fiche_titre($langs->trans("Menu").' '.$langs->trans("SecuritySetup"), '', 'folder');
//print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: '; //print '<strong>'.$langs->trans("PasswordEncryption").'</strong>: ';
print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.$conf->global->MAIN_SECURITY_HASH_ALGO." &nbsp; (Recommanded value: 'password_hash')<br>"; print '<strong>MAIN_SECURITY_HASH_ALGO</strong> = '.(empty($conf->global->MAIN_SECURITY_HASH_ALGO) ? 'unset' : '')." &nbsp; ";
print '<span class="opacitymedium"> &nbsp; If unset: \'md5\'</span> ';
print '<span class="opacitymedium"> - Recommanded value: \'password_hash\'</span><br>';
print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>'; print '<strong>MAIN_SECURITY_SALT</strong> = '.$conf->global->MAIN_SECURITY_SALT.'<br>';
print '<br>'; print '<br>';
// TODO // TODO
@ -153,10 +156,20 @@ print '<br>';
print '<br>'; print '<br>';
print '<strong>'.$langs->trans("SecurityAudit").'</strong>: '; $securityevent = new Events($db);
// TODO Disabled or enabled ? $eventstolog = $securityevent->eventstolog;
print '<br>';
print '<strong>'.$langs->trans("LogEvents").'</strong>: ';
// Loop on each event type
foreach ($eventstolog as $key => $arr)
{
if ($arr['id'])
{
$key = 'MAIN_LOGEVENTS_'.$arr['id'];
$value = empty($conf->global->$key) ? '' : $conf->global->$key;
if ($value) print $key.', ';
}
}

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -42,6 +43,8 @@ $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$label = GETPOST('label', 'alpha');
$scandir = GETPOST('scandir', 'alpha');
$type = 'user'; $type = 'user';

View File

@ -6976,34 +6976,37 @@ abstract class CommonObject
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
$out .= ' $out .= '
<script> <script>
jQuery(document).ready(function() { jQuery(document).ready(function() {
function showOptions(child_list, parent_list) function showOptions(child_list, parent_list, orig_select)
{ {
var val = $("select[name=\""+parent_list+"\"]").val(); var val = $("select[name=\""+parent_list+"\"]").val();
var parentVal = parent_list + ":" + val; var parentVal = parent_list + ":" + val;
if(val > 0) { if(val > 0) {
$("select[name=\""+child_list+"\"] option[parent]").hide(); var options = orig_select.find("option[parent=\""+parentVal+"\"]").clone();
$("select[name=\""+child_list+"\"] option[parent=\""+parentVal+"\"]").show(); $("select[name=\""+child_list+"\"] option[parent]").remove();
} else { $("select[name=\""+child_list+"\"]").append(options);
$("select[name=\""+child_list+"\"] option").show(); } else {
} var options = orig_select.find("option[parent]").clone();
} $("select[name=\""+child_list+"\"] option[parent]").remove();
function setListDependencies() { $("select[name=\""+child_list+"\"]").append(options);
jQuery("select option[parent]").parent().each(function() {
var child_list = $(this).attr("name");
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
showOptions(child_list, parent_list);
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});
} }
}
function setListDependencies() {
jQuery("select option[parent]").parent().each(function() {
var orig_select = {};
var child_list = $(this).attr("name");
orig_select[child_list] = $(this).clone();
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list, orig_select[child_list]);
});
});
}
setListDependencies(); setListDependencies();
}); });
</script>'."\n"; </script>'."\n";
} }

View File

@ -1221,7 +1221,6 @@ class FormFile
// Size // Size
$sizetoshow = dol_print_size($file['size'], 1, 1); $sizetoshow = dol_print_size($file['size'], 1, 1);
$sizetoshowbytes = dol_print_size($file['size'], 0, 1); $sizetoshowbytes = dol_print_size($file['size'], 0, 1);
print '<td class="right nowraponall">'; print '<td class="right nowraponall">';
if ($sizetoshow == $sizetoshowbytes) print $sizetoshow; if ($sizetoshow == $sizetoshowbytes) print $sizetoshow;
else { else {
@ -1659,8 +1658,21 @@ class FormFile
print $this->showPreview($file, $modulepart, $file['relativename']); print $this->showPreview($file, $modulepart, $file['relativename']);
print "</td>\n"; print "</td>\n";
print '<td class="right">'.dol_print_size($file['size'], 1, 1).'</td>';
// Size
$sizetoshow = dol_print_size($file['size'], 1, 1);
$sizetoshowbytes = dol_print_size($file['size'], 0, 1);
print '<td class="right nowraponall">';
if ($sizetoshow == $sizetoshowbytes) print $sizetoshow;
else {
print $form->textwithpicto($sizetoshow, $sizetoshowbytes, -1);
}
print '</td>';
// Date
print '<td class="center">'.dol_print_date($file['date'], "dayhour").'</td>'; print '<td class="center">'.dol_print_date($file['date'], "dayhour").'</td>';
// Share link
print '<td class="right">'; print '<td class="right">';
if ($file['share']) { if ($file['share']) {
// Define $urlwithroot // Define $urlwithroot

View File

@ -137,7 +137,7 @@ function user_prepare_head($object)
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)) || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))
|| (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) || (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall))
|| (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->read_all)) || (!empty($conf->holiday->enabled) && !empty($user->rights->holiday->read) && ($user->id == $object->id || $user->rights->holiday->readall))
) { ) {
// Bank // Bank
$head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/user/bank.php?id='.$object->id;

View File

@ -1800,7 +1800,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read); $newmenu->add("/holiday/list.php?search_statut=5&mainmenu=hrm&leftmenu=hrm", $langs->trans("RefuseCP"), 2, $user->rights->holiday->read);
} }
$newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read); $newmenu->add("/holiday/define_holiday.php?mainmenu=hrm&action=request", $langs->trans("MenuConfCP"), 1, $user->rights->holiday->read);
$newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->read_all); $newmenu->add("/holiday/month_report.php?mainmenu=hrm&leftmenu=holiday", $langs->trans("MenuReportMonth"), 1, $user->rights->holiday->readall);
$newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday); $newmenu->add("/holiday/view_log.php?mainmenu=hrm&leftmenu=holiday&action=request", $langs->trans("MenuLogCP"), 1, $user->rights->holiday->define_holiday);
} }

View File

@ -322,6 +322,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetAutoPageBreak(1, 0); $pdf->SetAutoPageBreak(1, 0);
$heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part
if ($heightforinfotot > 220) $heightforinfotot = 220;
$heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6; if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) $heightforfooter += 6;

View File

@ -140,14 +140,14 @@ class modHoliday extends DolibarrModules
$r = 0; $r = 0;
$this->rights[$r][0] = 20001; // Permission id (must not be already used) $this->rights[$r][0] = 20001; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read your own leave requests'; // Permission label $this->rights[$r][1] = 'Read leave requests (yours and your subordinates)'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++; $r++;
$this->rights[$r][0] = 20002; // Permission id (must not be already used) $this->rights[$r][0] = 20002; // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/modify your own leave requests'; // Permission label $this->rights[$r][1] = 'Create/modify leave requests'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
@ -170,7 +170,7 @@ class modHoliday extends DolibarrModules
$this->rights[$r][0] = 20004; // Permission id (must not be already used) $this->rights[$r][0] = 20004; // Permission id (must not be already used)
$this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label $this->rights[$r][1] = 'Read leave requests for everybody'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1) $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'read_all'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][4] = 'readall'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++; $r++;
@ -201,7 +201,7 @@ class modHoliday extends DolibarrModules
$this->export_code[$r] = 'leaverequest_'.$r; $this->export_code[$r] = 'leaverequest_'.$r;
$this->export_label[$r] = 'ListeCP'; $this->export_label[$r] = 'ListeCP';
$this->export_icon[$r] = 'holiday'; $this->export_icon[$r] = 'holiday';
$this->export_permission[$r] = array(array("holiday", "read_all")); $this->export_permission[$r] = array(array("holiday", "readall"));
$this->export_fields_array[$r] = array( $this->export_fields_array[$r] = array(
'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID', 'd.rowid'=>"LeaveId", 'd.fk_type'=>'TypeOfLeaveId', 't.code'=>'TypeOfLeaveCode', 't.label'=>'TypeOfLeaveLabel', 'd.fk_user'=>'UserID',
'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP', 'u.lastname'=>'Lastname', 'u.firstname'=>'Firstname', 'u.login'=>"Login", 'd.date_debut'=>'DateStart', 'd.date_fin'=>'DateEnd', 'd.halfday'=>'HalfDay', 'none.num_open_days'=>'NbUseDaysCP',

View File

@ -246,9 +246,9 @@ class modResource extends DolibarrModules
$this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'resource as r';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_type_resource as c ON c.rowid=r.fk_code_type_resource';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'resource_extrafields as extra ON extra.fk_object = r.rowid';
$this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')'; $this->export_sql_end[$r] .= ' AND r.entity IN ('.getEntity('resource').')';

View File

@ -101,7 +101,7 @@ class modSalaries extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 511; $this->rights[$r][0] = 511;
$this->rights[$r][1] = 'Read payments of employee salaries'; $this->rights[$r][1] = 'Read payments of employee salaries (yours and your subordinates)';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
$this->rights[$r][4] = 'read'; $this->rights[$r][4] = 'read';
@ -125,6 +125,13 @@ class modSalaries extends DolibarrModules
$r++; $r++;
$this->rights[$r][0] = 517; $this->rights[$r][0] = 517;
$this->rights[$r][1] = 'Read payments of salariests of every employee';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'readall';
$r++;
$this->rights[$r][0] = 519;
$this->rights[$r][1] = 'Export payments of employee salaries'; $this->rights[$r][1] = 'Export payments of employee salaries';
$this->rights[$r][2] = 'r'; $this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0; $this->rights[$r][3] = 0;
@ -132,6 +139,7 @@ class modSalaries extends DolibarrModules
$this->rights[$r][5] = ''; $this->rights[$r][5] = '';
// Menus // Menus
//------- //-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager. $this->menu = 1; // This module add menu entries. They are coded into menu manager.

View File

@ -255,13 +255,16 @@ class modUser extends DolibarrModules
'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user',
'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member"
); );
$keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
if (empty($conf->adherent->enabled)) if (empty($conf->adherent->enabled))
{ {
unset($this->export_fields_array[$r]['u.fk_member']); unset($this->export_fields_array[$r]['u.fk_member']);
unset($this->export_entities_array[$r]['u.fk_member']); unset($this->export_entities_array[$r]['u.fk_member']);
} }
$this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extra ON u.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')'; $this->export_sql_end[$r] .= ' WHERE u.entity IN ('.getEntity('user').')';
// Imports // Imports

View File

@ -145,7 +145,7 @@ if ($permission)
$newcardbutton = ''; $newcardbutton = '';
if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer) if (!empty($object->socid) && $object->socid > 1 && $user->rights->societe->creer)
{ {
$newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$object->socid.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>'; $newcardbutton .= '<a href="'.DOL_URL_ROOT.'/contact/card.php?socid='.$selectedCompany.'&action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id).'" title="'.$langs->trans('NewContact').'"><span class="fa fa-plus-circle valignmiddle paddingleft"></span></a>';
} }
print $newcardbutton; print $newcardbutton;
?> ?>

View File

@ -77,6 +77,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
{ {
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
// Do not log events when trigger is for creating event (infinite loop)
if (preg_match('/^ACTION_/', $action)) {
return 0;
}
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
//var_dump($action.' - '.$conf->global->$key);exit; //var_dump($action.' - '.$conf->global->$key);exit;

View File

@ -73,7 +73,7 @@ if (($id > 0) || $ref)
// Check current user can read this leave request // Check current user can read this leave request
$canread = 0; $canread = 0;
if (!empty($user->rights->holiday->read_all)) $canread = 1; if (!empty($user->rights->holiday->readall)) $canread = 1;
if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($object->fk_user, $childids)) $canread = 1;
if (!$canread) if (!$canread)
{ {

View File

@ -2116,7 +2116,7 @@ class Holiday extends CommonObject
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
$sql .= " WHERE h.statut > 1"; $sql .= " WHERE h.statut > 1";
$sql .= " AND h.entity IN (".getEntity('holiday').")"; $sql .= " AND h.entity IN (".getEntity('holiday').")";
if (empty($user->rights->expensereport->read_all)) if (empty($user->rights->expensereport->readall))
{ {
$userchildids = $user->getAllChildIds(1); $userchildids = $user->getAllChildIds(1);
$sql .= " AND (h.fk_user IN (".join(',', $userchildids).")"; $sql .= " AND (h.fk_user IN (".join(',', $userchildids).")";

View File

@ -206,7 +206,7 @@ $filters = '';
// Filter on array of ids of all childs // Filter on array of ids of all childs
$userchilds = array(); $userchilds = array();
if (empty($user->rights->holiday->read_all)) if (empty($user->rights->holiday->readall))
{ {
$userchilds = $user->getAllChildIds(1); $userchilds = $user->getAllChildIds(1);
$filters .= ' AND u.rowid IN ('.join(', ', $userchilds).')'; $filters .= ' AND u.rowid IN ('.join(', ', $userchilds).')';
@ -293,7 +293,7 @@ if (count($typeleaves) == 0)
foreach ($listUsers as $users) foreach ($listUsers as $users)
{ {
// If user has not permission to edit/read all, we must see only subordinates // If user has not permission to edit/read all, we must see only subordinates
if (empty($user->rights->holiday->read_all)) if (empty($user->rights->holiday->readall))
{ {
if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it. if (($users['rowid'] != $user->id) && (!in_array($users['rowid'], $userchilds))) continue; // This user is not into hierarchy of current user, we hide it.
} }

View File

@ -70,7 +70,7 @@ if ($id > 0)
{ {
$canread = 0; $canread = 0;
if ($id == $user->id) $canread = 1; if ($id == $user->id) $canread = 1;
if (!empty($user->rights->holiday->read_all)) $canread = 1; if (!empty($user->rights->holiday->readall)) $canread = 1;
if (!empty($user->rights->holiday->read) && in_array($id, $childids)) $canread = 1; if (!empty($user->rights->holiday->read) && in_array($id, $childids)) $canread = 1;
if (!$canread) if (!$canread)
{ {
@ -318,7 +318,7 @@ if (!empty($search_status) && $search_status != -1) {
$sql .= " AND cp.statut = '".$db->escape($search_status)."'\n"; $sql .= " AND cp.statut = '".$db->escape($search_status)."'\n";
} }
if (empty($user->rights->holiday->read_all)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')'; if (empty($user->rights->holiday->readall)) $sql .= ' AND cp.fk_user IN ('.join(',', $childids).')';
if ($id > 0) $sql .= " AND cp.fk_user IN (".$id.")"; if ($id > 0) $sql .= " AND cp.fk_user IN (".$id.")";
// Add where from extra fields // Add where from extra fields
@ -469,7 +469,7 @@ if ($resql)
$include = ''; $include = '';
if (empty($user->rights->holiday->read_all)) $include = 'hierarchyme'; // Can see only its hierarchyl if (empty($user->rights->holiday->readall)) $include = 'hierarchyme'; // Can see only its hierarchyl
print '<div class="div-table-responsive">'; print '<div class="div-table-responsive">';
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n"; print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
@ -507,7 +507,7 @@ if ($resql)
// Approver // Approver
if (!empty($arrayfields['cp.fk_validator']['checked'])) if (!empty($arrayfields['cp.fk_validator']['checked']))
{ {
if ($user->rights->holiday->read_all) if ($user->rights->holiday->readall)
{ {
print '<td class="liste_titre maxwidthonsmartphone left">'; print '<td class="liste_titre maxwidthonsmartphone left">';
$validator = new UserGroup($db); $validator = new UserGroup($db);
@ -631,7 +631,7 @@ if ($resql)
// If we ask a dedicated card and not allow to see it, we force on user. // If we ask a dedicated card and not allow to see it, we force on user.
if ($id && empty($user->rights->holiday->read_all) && !in_array($id, $childids)) { if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) {
$langs->load("errors"); $langs->load("errors");
print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>'; print '<tr class="oddeven opacitymediuem"><td colspan="10">'.$langs->trans("NotEnoughPermissions").'</td></tr>';
$result = 0; $result = 0;

View File

@ -69,7 +69,7 @@ if (!$sortfield) $sortfield = "cpl.rowid";
if (!$sortorder) $sortorder = "DESC"; if (!$sortorder) $sortorder = "DESC";
// Si l'utilisateur n'a pas le droit de lire cette page // Si l'utilisateur n'a pas le droit de lire cette page
if (!$user->rights->holiday->read_all) accessforbidden(); if (!$user->rights->holiday->readall) accessforbidden();
// Load translation files required by the page // Load translation files required by the page
$langs->load('users'); $langs->load('users');

View File

@ -180,7 +180,7 @@ if (!empty($conf->holiday->enabled) && $user->rights->holiday->read)
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = x.fk_user"; $sql .= " WHERE u.rowid = x.fk_user";
$sql .= " AND x.entity = ".$conf->entity; $sql .= " AND x.entity = ".$conf->entity;
if (empty($user->rights->holiday->read_all)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')'; if (empty($user->rights->holiday->readall)) $sql .= ' AND x.fk_user IN ('.join(',', $childids).')';
//if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; //if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND x.fk_soc = s. rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
//if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid; //if (!empty($socid)) $sql.= " AND x.fk_soc = ".$socid;
$sql .= $db->order("x.tms", "DESC"); $sql .= $db->order("x.tms", "DESC");

View File

@ -59,6 +59,10 @@ ALTER TABLE llx_mrp_mo_extrafields ADD INDEX idx_mrp_mo_fk_object(fk_object);
-- For v13 -- For v13
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (111,11, '0','0','No Sales Tax',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (112,11, '4','0','Sales Tax 4%',1);
insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (113,11, '6','0','Sales Tax 6%',1);
ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0; ALTER TABLE llx_bom_bom ADD COLUMN bomtype integer DEFAULT 0;
UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets'; UPDATE llx_emailcollector_emailcollector SET ref = 'Collect_Ticket_Requests' WHERE ref = 'Collect_Ticket_Requets';
@ -362,6 +366,8 @@ ALTER TABLE llx_facturedet ADD COLUMN ref_ext varchar(255) AFTER multicurrency_t
ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL; ALTER TABLE llx_c_ticket_category ADD COLUMN fk_parent integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL; ALTER TABLE llx_c_ticket_category ADD COLUMN force_severity varchar(32) NULL;
ALTER TABLE llx_c_ticket_severity CHANGE color color VARCHAR(10) NULL;
ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL; ALTER TABLE llx_expensereport ADD COLUMN fk_user_creat integer NULL;
ALTER TABLE llx_expensereport_ik ADD COLUMN ikoffset double DEFAULT 0 NOT NULL; ALTER TABLE llx_expensereport_ik ADD COLUMN ikoffset double DEFAULT 0 NOT NULL;
@ -406,6 +412,7 @@ ALTER TABLE llx_projet_task_time MODIFY COLUMN datec datetime;
DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'); DELETE FROM llx_user_rights WHERE fk_id IN (SELECT id FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous');
DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous'; DELETE FROM llx_rights_def where module = 'holiday' and perms = 'lire_tous';
UPDATE llx_rights_def set perms = 'readall' WHERE perms = 'read_all' and module = 'holiday';
CREATE TABLE llx_c_product_nature ( CREATE TABLE llx_c_product_nature (
rowid integer AUTO_INCREMENT PRIMARY KEY, rowid integer AUTO_INCREMENT PRIMARY KEY,

View File

@ -22,7 +22,7 @@ create table llx_c_ticket_severity
code varchar(32) NOT NULL, code varchar(32) NOT NULL,
pos varchar(32) NOT NULL, pos varchar(32) NOT NULL,
label varchar(128) NOT NULL, label varchar(128) NOT NULL,
color varchar(10) NOT NULL, color varchar(10) NULL,
active integer DEFAULT 1, active integer DEFAULT 1,
use_default integer DEFAULT 1, use_default integer DEFAULT 1,
description varchar(255) description varchar(255)

View File

@ -836,10 +836,11 @@ Permission402=Create/modify discounts
Permission403=Validate discounts Permission403=Validate discounts
Permission404=Delete discounts Permission404=Delete discounts
Permission430=Use Debug Bar Permission430=Use Debug Bar
Permission511=Read payments of salaries Permission511=Read payments of salaries (yours and subordinates)
Permission512=Create/modify payments of salaries Permission512=Create/modify payments of salaries
Permission514=Delete payments of salaries Permission514=Delete payments of salaries
Permission517=Export salaries Permission517=Read payments of salaries of everybody
Permission519=Export salaries
Permission520=Read Loans Permission520=Read Loans
Permission522=Create/modify loans Permission522=Create/modify loans
Permission524=Delete loans Permission524=Delete loans

View File

@ -1471,7 +1471,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&amp;action=deletelin&amp;token='.newToken().'&amp;lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; print '<a class="reposition paddingleft" href="'.$_SERVER["PHP_SELF"].'?id='.$task_time->fk_task.'&amp;action=deleteline&amp;token='.newToken().'&amp;lineid='.$task_time->rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">';
print img_delete('default', 'class="pictodelete paddingleft"'); print img_delete('default', 'class="pictodelete paddingleft"');
print '</a>'; print '</a>';

View File

@ -31,11 +31,6 @@ if (!empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT.'/account
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("compta", "salaries", "bills", "hrm")); $langs->loadLangs(array("compta", "salaries", "bills", "hrm"));
// Security check
$socid = GETPOST("socid", "int");
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$search_ref = GETPOST('search_ref', 'int'); $search_ref = GETPOST('search_ref', 'int');
$search_user = GETPOST('search_user', 'alpha'); $search_user = GETPOST('search_user', 'alpha');
@ -71,6 +66,13 @@ if (!GETPOST('typeid', 'int'))
$typeid = GETPOST('typeid', 'int'); $typeid = GETPOST('typeid', 'int');
} }
$childids = $user->getAllChildIds(1);
// Security check
$socid = GETPOST("socid", "int");
if ($user->socid) $socid = $user->socid;
$result = restrictedArea($user, 'salaries', '', '', '');
/* /*
@ -112,6 +114,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.ro
$sql .= " ".MAIN_DB_PREFIX."user as u"; $sql .= " ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.rowid = s.fk_user"; $sql .= " WHERE u.rowid = s.fk_user";
$sql .= " AND s.entity = ".$conf->entity; $sql .= " AND s.entity = ".$conf->entity;
if (empty($user->rights->salaries->readall)) $sql .= " AND s.fk_user IN (".join(',', $childids).")";
// Search criteria // Search criteria
if ($search_ref) $sql .= " AND s.rowid=".$search_ref; if ($search_ref) $sql .= " AND s.rowid=".$search_ref;

View File

@ -41,7 +41,7 @@ if (!empty($_REQUEST['CASHDESK_ID_THIRDPARTY'.$terminal.'_id']))
// Security check // Security check
if (!$user->admin) accessforbidden(); if (!$user->admin) accessforbidden();
$langs->loadLangs(array("admin", "cashdesk", "printing")); $langs->loadLangs(array("admin", "cashdesk", "printing", "receiptprinter"));
global $db; global $db;
@ -255,7 +255,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TA
foreach ($printer->listprinterstemplates as $key => $value) { foreach ($printer->listprinterstemplates as $key => $value) {
$templates[$value['rowid']] = $value['name']; $templates[$value['rowid']] = $value['name'];
} }
print '<tr class="oddeven"><td>'.$langs->trans("MainTemplateToUse").'</td>'; print '<tr class="oddeven"><td>'.$langs->trans("MainTemplateToUse").' (<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php?mode=template">'.$langs->trans("SetupReceiptTemplate").'</a>)</td>';
print '<td>'; print '<td>';
print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1); print $form->selectarray('TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal, $templates, (empty($conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}) ? '0' : $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_INVOICES'.$terminal}), 1);
print '</td></tr>'; print '</td></tr>';

View File

@ -672,7 +672,7 @@ if ($action == "updatereduction")
if ($action == "order" and $placeid != 0) if ($action == "order" and $placeid != 0)
{ {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") {
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
$printer = new dolReceiptPrinter($db); $printer = new dolReceiptPrinter($db);
} }
@ -703,10 +703,13 @@ if ($action == "order" and $placeid != 0)
$order_receipt_printer1 .= '</td></tr>'; $order_receipt_printer1 .= '</td></tr>';
} }
} }
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer $invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter = 1; $printer->orderprinter = 1;
echo "<script>";
echo "var orderprinter1esc='";
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1 $ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER1_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 1
echo "';</script>";
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='1' and fk_facture=".$invoice->id; // Set as printed
$db->query($sql); $db->query($sql);
@ -731,10 +734,13 @@ if ($action == "order" and $placeid != 0)
$order_receipt_printer2 .= '</td></tr>'; $order_receipt_printer2 .= '</td></tr>';
} }
} }
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer $invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter = 2; $printer->orderprinter = 2;
echo "<script>";
echo "var orderprinter2esc='";
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2 $ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER2_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 2
echo "';</script>";
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='2' and fk_facture=".$invoice->id; // Set as printed
$db->query($sql); $db->query($sql);
@ -759,10 +765,13 @@ if ($action == "order" and $placeid != 0)
$order_receipt_printer3 .= '</td></tr>'; $order_receipt_printer3 .= '</td></tr>';
} }
} }
if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" && $linestoprint > 0) { if (($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter" || $conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") && $linestoprint > 0) {
$invoice->fetch($placeid); //Reload object before send to printer $invoice->fetch($placeid); //Reload object before send to printer
$printer->orderprinter = 3; $printer->orderprinter = 3;
echo "<script>";
echo "var orderprinter3esc='";
$ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 3 $ret = $printer->sendToPrinter($invoice, $conf->global->{'TAKEPOS_TEMPLATE_TO_USE_FOR_ORDERS'.$_SESSION["takeposterminal"]}, $conf->global->{'TAKEPOS_ORDER_PRINTER3_TO_USE'.$_SESSION["takeposterminal"]}); // PRINT TO PRINTER 3
echo "';</script>";
} }
$sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed $sql = "UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='4' where special_code='3' and fk_facture=".$invoice->id; // Set as printed
$db->query($sql); $db->query($sql);
@ -841,25 +850,59 @@ $(document).ready(function() {
<?php <?php
if ($action == "order" and $order_receipt_printer1 != "") { if ($action == "order" and $order_receipt_printer1 != "") {
?> if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){
$.ajax({ ?>
type: "POST", $.ajax({
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print', type: "POST",
data: '<?php url: '<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php',
print $headerorder.$order_receipt_printer1.$footerorder; ?>' data: 'invoice='+orderprinter1esc
}); });
<?php <?php
}
else {
?>
$.ajax({
type: "POST",
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
data: '<?php
print $headerorder.$order_receipt_printer1.$footerorder; ?>'
});
<?php
}
} }
if ($action == "order" and $order_receipt_printer2 != "") { if ($action == "order" and $order_receipt_printer2 != "") {
?> if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){
$.ajax({ ?>
type: "POST", $.ajax({
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print2', type: "POST",
data: '<?php url: '<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=2',
print $headerorder.$order_receipt_printer2.$footerorder; ?>' data: 'invoice='+orderprinter2esc
}); });
<?php <?php
}
else {
?>
$.ajax({
type: "POST",
url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print2',
data: '<?php
print $headerorder.$order_receipt_printer2.$footerorder; ?>'
});
<?php
}
}
if ($action == "order" and $order_receipt_printer3 != "") {
if (filter_var($conf->global->TAKEPOS_PRINT_SERVER, FILTER_VALIDATE_URL) == true){
?>
$.ajax({
type: "POST",
url: '<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>/printer/index.php?printer=3',
data: 'invoice='+orderprinter3esc
});
<?php
}
} }
// Set focus to search field // Set focus to search field

View File

@ -387,7 +387,7 @@ if ($result) {
$i++; $i++;
} }
$db->free(); $db->free($result);
} else { } else {
print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans('NoUnreadTicketsFound').'</td></tr>'; print '<tr><td colspan="6" class="opacitymedium">'.$langs->trans('NoUnreadTicketsFound').'</td></tr>';
} }

View File

@ -388,7 +388,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
* Last holidays * Last holidays
*/ */
if (!empty($conf->holiday->enabled) && if (!empty($conf->holiday->enabled) &&
($user->rights->holiday->read_all || ($user->rights->holiday->read && $object->id == $user->id)) ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))
) )
{ {
$holiday = new Holiday($db); $holiday = new Holiday($db);
@ -396,7 +396,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
$sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday"; $sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
$sql .= " FROM ".MAIN_DB_PREFIX."holiday as h"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as h";
$sql .= " WHERE h.fk_user = ".$object->id; $sql .= " WHERE h.fk_user = ".$object->id;
$sql .= " AND h.entity = ".$conf->entity; $sql .= " AND h.entity IN (".getEntity('holiday').")";
$sql .= " ORDER BY h.date_debut DESC"; $sql .= " ORDER BY h.date_debut DESC";
$resql = $db->query($sql); $resql = $db->query($sql);