Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-08-02 20:25:18 +02:00
commit f07f7b1800
56 changed files with 324 additions and 279 deletions

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
* Copyright (C) 2021 Waël Almoman <info@almoman.com>
*
@ -141,6 +141,7 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
} else {
$sql = "SELECT libelle FROM ".MAIN_DB_PREFIX."adherent_type WHERE libelle='".$db->escape($object->label)."'";
$sql .= " WHERE entity IN (".getEntity('member_type').")";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);

View File

@ -120,9 +120,9 @@ $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreat
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate)));
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send)));
$usercancreateorder = $user->rights->commande->creer;
$usercancreateinvoice = $user->rights->facture->creer;
$usercancreatecontract = $user->rights->contrat->creer;
$usercancreateorder = $user->hasRight('commande', 'creer');
$usercancreateinvoice = $user->hasRight('facture', 'creer');
$usercancreatecontract = $user->hasRight('contrat', 'creer');
$usercancreateintervention = $user->hasRight('ficheinter', 'creer');
$usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer'));

View File

@ -85,13 +85,19 @@ class box_birthdays extends ModeleBoxes
if ($user->rights->user->user->lire) {
$tmparray = dol_getdate(dol_now(), true);
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth, u.email, u.statut as status";
$sql = "SELECT u.rowid, u.firstname, u.lastname, u.birth as datea, 'birth' as typea, u.email, u.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.birth', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY DAY(u.birth) ASC";
$sql .= $this->db->plimit($max, 0);
$sql .= ' UNION ';
$sql .= "SELECT u.rowid, u.firstname, u.lastname, u.dateemployment as datea, 'employment' as typea, u.email, u.statut as status";
$sql .= " FROM ".MAIN_DB_PREFIX."user as u";
$sql .= " WHERE u.entity IN (".getEntity('user').")";
$sql .= " AND u.statut = 1";
$sql .= dolSqlDateFilter('u.dateemployment', 0, $tmparray['mon'], 0);
$sql .= " ORDER BY DAY(datea) ASC";
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
$result = $this->db->query($sql);
@ -108,9 +114,13 @@ class box_birthdays extends ModeleBoxes
$userstatic->email = $objp->email;
$userstatic->statut = $objp->status;
$dateb = $this->db->jdate($objp->birth);
$dateb = $this->db->jdate($objp->datea);
$age = date('Y', dol_now()) - date('Y', $dateb);
$picb = '<i class="fas fa-birthday-cake inline-block"></i>';
$pice = '<i class="fas fa-briefcase inline-block"></i>';
$typea = ($objp->typea == 'birth') ? $picb : $pice;
$this->info_box_contents[$line][] = array(
'td' => '',
'text' => $userstatic->getNomUrl(1),
@ -119,7 +129,18 @@ class box_birthdays extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'text' => dol_print_date($dateb, "day", 'tzserver').' - '.$age.' '.$langs->trans('DurationYears')
'text' => dol_print_date($dateb, "day", 'tzserver')
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right nowraponall"',
'text' => $age.' '.$langs->trans('DurationYears')
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'text' => $typea,
'asis' => 1
);
/*$this->info_box_contents[$line][] = array(

View File

@ -6,7 +6,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2019-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
*
* 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
@ -547,10 +547,18 @@ class CMailFile
}
if (!empty($this->addr_cc)) {
$this->message->setCc($this->getArrayAddress($this->addr_cc));
try {
$this->message->setCc($this->getArrayAddress($this->addr_cc));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
if (!empty($this->addr_bcc)) {
$this->message->setBcc($this->getArrayAddress($this->addr_bcc));
try {
$this->message->setBcc($this->getArrayAddress($this->addr_bcc));
} catch (Exception $e) {
$this->errors[] = $e->getMessage();
}
}
//if (! empty($this->errors_to)) $this->message->setErrorsTo($this->getArrayAddress($this->errors_to));
if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) {

View File

@ -119,7 +119,7 @@ class FormTicket
$this->action = 'add';
$this->withcompany = $conf->societe->enabled ? 1 : 0;
$this->withcompany = isModEnabled("societe");
$this->withfromsocid = 0;
$this->withfromcontactid = 0;
//$this->withreadid=0;
@ -169,7 +169,7 @@ class FormTicket
print dol_get_fiche_head(null, 'card', '', 0, '');
}
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.$this->param["returnurl"].'">';
print '<form method="POST" '.($withdolfichehead ? '' : 'style="margin-bottom: 30px;" ').'name="ticket" id="form_create_ticket" enctype="multipart/form-data" action="'.(!empty($this->param["returnurl"]) ? $this->param["returnurl"] : "").'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="'.$this->action.'">';
foreach ($this->param as $key => $value) {
@ -341,10 +341,12 @@ class FormTicket
print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title;
print '</td></tr>';
} else {
if ($this->withreadid > 0) {
if (isset($this->withreadid) && $this->withreadid > 0) {
$subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withreadid.' : '.$this->topic_title.'';
} else {
$subject = GETPOST('subject', 'alpha');
}
print '<input class="text minwidth500" id="subject" name="subject" value="'.(GETPOST('subject', 'alpha') ? GETPOST('subject', 'alpha') : $subject).'" autofocus />';
print '<input class="text minwidth500" id="subject" name="subject" value="'.$subject.'" autofocus />';
print '</td></tr>';
}
}
@ -643,7 +645,7 @@ class FormTicket
print '<br>';
print $form->buttonsSaveCancel((($this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
print $form->buttonsSaveCancel(((isset($this->withreadid) && $this->withreadid > 0) ? "SendResponse" : "CreateTicket"), ($this->withcancel ? "Cancel" : ""));
/*
print '<div class="center">';

View File

@ -14,7 +14,7 @@
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2019-2022 Thibault Foucart <support@ptibogxiv.net>
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
@ -7388,6 +7388,9 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATE__'] = 'Lowest data for planned expiration of service';
$substitutionarray['__CONTRACT_LOWEST_EXPIRATION_DATETIME__'] = 'Lowest date and hour for planned expiration of service';
}
if (!empty($conf->propal->enabled) && (!is_object($object) || $object->element == 'propal')) {
$substitutionarray['__ONLINE_SIGN_URL__'] = 'ToOfferALinkForOnlineSignature';
}
$substitutionarray['__ONLINE_PAYMENT_URL__'] = 'UrlToPayOnlineIfApplicable';
$substitutionarray['__ONLINE_PAYMENT_TEXT_AND_URL__'] = 'TextAndUrlToPayOnlineIfApplicable';
$substitutionarray['__SECUREKEYPAYMENT__'] = 'Security key (if key is not unique per record)';
@ -10423,7 +10426,7 @@ function dolGetButtonAction($label, $html = '', $actionType = 'default', $url =
global $hookmanager, $action, $object, $langs;
//var_dump($params);
if ($params['isDropdown'])
if (!empty($params['isDropdown']))
$class = "dropdown-item";
else {
$class = 'butAction';

View File

@ -84,7 +84,7 @@ function ticket_prepare_head($object)
$head[$h][2] = 'tabTicket';
$h++;
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && $conf->societe->enabled) {
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && empty($user->socid) && isModEnabled("societe")) {
$nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external'));
$head[$h][0] = DOL_URL_ROOT.'/ticket/contact.php?track_id='.$object->track_id;
$head[$h][1] = $langs->trans('ContactsAddresses');

View File

@ -1154,7 +1154,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
if ($user->rights->user->user->lire) {
if ($usemenuhider || empty($leftmenu) || $leftmenu == "users") {
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->rights->user->user->creer || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"), 2, ($user->hasRight("user", "user", "write") || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE), '', 'home');
$newmenu->add("/user/list.php?leftmenu=users", $langs->trans("ListOfUsers"), 2, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/hierarchy.php?leftmenu=users", $langs->trans("HierarchicView"), 2, $user->rights->user->user->lire || $user->admin);
if (isModEnabled('categorie')) {
@ -1162,7 +1162,7 @@ function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu =
$newmenu->add("/categories/index.php?leftmenu=users&type=7", $langs->trans("UsersCategoriesShort"), 2, $user->rights->categorie->lire, '', $mainmenu, 'cat');
}
$newmenu->add("", $langs->trans("Groups"), 1, ($user->rights->user->user->lire || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->write : $user->rights->user->user->creer) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/card.php?leftmenu=users&action=create", $langs->trans("NewGroup"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->hasRight("user", "group_advance", "create") : $user->hasRight("user", "user", "create")) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
$newmenu->add("/user/group/list.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) ? $user->rights->user->group_advance->read : $user->rights->user->user->lire) || $user->admin) && !(isModEnabled('multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE));
}
}

View File

@ -284,8 +284,8 @@ class doc_generic_asset_odt extends ModelePDFAsset
dol_mkdir($conf->asset->dir_temp);
if (!is_writable($conf->asset->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->asset->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->asset->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -183,16 +183,16 @@ class modPhpbarcode extends ModeleBarCode
*/
public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{
global $conf, $filebarcode;
global $conf, $filebarcode, $langs;
dol_mkdir($conf->barcode->dir_temp);
if (!is_writable($conf->barcode->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->barcode->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}
$file = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$file = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
$filebarcode = $file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode

View File

@ -155,16 +155,16 @@ class modTcpdfbarcode extends ModeleBarCode
*/
public function writeBarCode($code, $encoding, $readable = 'Y', $scale = 1, $nooutputiferror = 0)
{
global $conf, $_GET;
global $conf, $langs, $_GET;
dol_mkdir($conf->barcode->dir_temp);
if (!is_writable($conf->barcode->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->barcode->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->barcode->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}
$file = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$file = $conf->barcode->dir_temp . '/barcode_' . $code . '_' . $encoding . '.png';
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) {

View File

@ -274,7 +274,7 @@ class doc_generic_bom_odt extends ModelePDFBom
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -283,11 +283,11 @@ class doc_generic_bom_odt extends ModelePDFBom
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -295,8 +295,8 @@ class doc_generic_bom_odt extends ModelePDFBom
dol_mkdir($conf->bom->dir_temp);
if (!is_writable($conf->bom->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->bom->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->bom->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -280,7 +280,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -289,11 +289,11 @@ class doc_generic_order_odt extends ModelePDFCommandes
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -301,8 +301,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
dol_mkdir($conf->commande->dir_temp);
if (!is_writable($conf->commande->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->commande->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->commande->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -266,7 +266,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -275,11 +275,11 @@ class doc_generic_contract_odt extends ModelePDFContract
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -287,8 +287,8 @@ class doc_generic_contract_odt extends ModelePDFContract
dol_mkdir($conf->contrat->dir_temp);
if (!is_writable($conf->contrat->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->contrat->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->contrat->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -278,7 +278,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -287,11 +287,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -299,8 +299,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
dol_mkdir($conf->expedition->dir_temp);
if (!is_writable($conf->expedition->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->expedition->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->expedition->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -278,7 +278,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -287,11 +287,11 @@ class doc_generic_invoice_odt extends ModelePDFFactures
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
//print "newdir=".$dir;
//print "newfile=".$newfile;
@ -300,8 +300,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
dol_mkdir($conf->facture->dir_temp);
if (!is_writable($conf->facture->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->facture->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->facture->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -268,7 +268,7 @@ class doc_generic_member_odt extends ModelePDFMember
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -277,11 +277,11 @@ class doc_generic_member_odt extends ModelePDFMember
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -289,8 +289,8 @@ class doc_generic_member_odt extends ModelePDFMember
dol_mkdir($conf->adherent->dir_temp);
if (!is_writable($conf->adherent->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->adherent->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->adherent->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -267,7 +267,7 @@ class doc_generic_mo_odt extends ModelePDFMo
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -276,11 +276,11 @@ class doc_generic_mo_odt extends ModelePDFMo
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -288,8 +288,8 @@ class doc_generic_mo_odt extends ModelePDFMo
dol_mkdir($conf->mrp->dir_temp);
if (!is_writable($conf->mrp->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->mrp->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->mrp->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -278,7 +278,7 @@ class doc_generic_product_odt extends ModelePDFProduct
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -287,11 +287,11 @@ class doc_generic_product_odt extends ModelePDFProduct
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -299,8 +299,8 @@ class doc_generic_product_odt extends ModelePDFProduct
dol_mkdir($conf->product->dir_temp);
if (!is_writable($conf->product->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->product->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->product->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -556,7 +556,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -565,11 +565,11 @@ class doc_generic_project_odt extends ModelePDFProjects
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -577,8 +577,8 @@ class doc_generic_project_odt extends ModelePDFProjects
dol_mkdir($conf->project->dir_temp);
if (!is_writable($conf->project->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->project->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->project->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -517,9 +517,9 @@ class doc_generic_task_odt extends ModelePDFTask
$newfiletmp = preg_replace('/\.(ods|odt)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
$file = $dir.'/'.$newfiletmp.'.odt';
$file = $dir . '/' . $newfiletmp . '.odt';
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -527,8 +527,8 @@ class doc_generic_task_odt extends ModelePDFTask
dol_mkdir($conf->project->dir_temp);
if (!is_writable($conf->project->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->project->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->project->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -311,7 +311,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -320,11 +320,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -332,8 +332,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales
dol_mkdir($conf->propal->multidir_temp[$object->entity]);
if (!is_writable($conf->propal->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->propal->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->propal->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -271,7 +271,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -280,11 +280,11 @@ class doc_generic_reception_odt extends ModelePdfReception
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -292,8 +292,8 @@ class doc_generic_reception_odt extends ModelePdfReception
dol_mkdir($conf->reception->dir_temp);
if (!is_writable($conf->reception->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->reception->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->reception->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -256,7 +256,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
if (!empty($conf->global->MAIN_DOC_USE_OBJECT_THIRDPARTY_NAME)) {
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)).'-'.$newfiletmp;
$newfiletmp = dol_sanitizeFileName(dol_string_nospecial($object->name)) . '-' . $newfiletmp;
$newfiletmp = preg_replace('/__+/', '_', $newfiletmp); // Replace repeated _ into one _ (to avoid string with substitution syntax)
}
if (!empty($conf->global->MAIN_DOC_USE_TIMING)) {
@ -264,11 +264,11 @@ class doc_generic_odt extends ModeleThirdPartyDoc
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
$object->builddoc_filename = $filename; // For triggers
//print "newfileformat=".$newfileformat;
//print "newdir=".$dir;
@ -279,8 +279,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc
dol_mkdir($conf->societe->multidir_temp[$object->entity]);
if (!is_writable($conf->societe->multidir_temp[$object->entity])) {
$this->error = "Failed to write in temp directory ".$conf->societe->multidir_temp[$object->entity];
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->societe->multidir_temp[$object->entity]);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -279,7 +279,7 @@ class doc_generic_stock_odt extends ModelePDFStock
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -288,11 +288,11 @@ class doc_generic_stock_odt extends ModelePDFStock
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -300,8 +300,8 @@ class doc_generic_stock_odt extends ModelePDFStock
dol_mkdir($conf->product->dir_temp);
if (!is_writable($conf->product->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->product->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->product->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -262,7 +262,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -271,11 +271,11 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -283,8 +283,8 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
dol_mkdir($conf->fournisseur->commande->dir_temp);
if (!is_writable($conf->fournisseur->commande->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->fournisseur->commande->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->fournisseur->commande->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -297,7 +297,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -306,11 +306,11 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -318,8 +318,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
dol_mkdir($conf->supplier_proposal->dir_temp);
if (!is_writable($conf->supplier_proposal->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->supplier_proposal->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->supplier_proposal->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -266,7 +266,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -275,11 +275,11 @@ class doc_generic_ticket_odt extends ModelePDFTicket
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -287,8 +287,8 @@ class doc_generic_ticket_odt extends ModelePDFTicket
dol_mkdir($conf->ticket->dir_temp);
if (!is_writable($conf->ticket->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->ticket->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->ticket->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -297,7 +297,7 @@ class doc_generic_user_odt extends ModelePDFUser
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -306,11 +306,11 @@ class doc_generic_user_odt extends ModelePDFUser
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -318,8 +318,8 @@ class doc_generic_user_odt extends ModelePDFUser
dol_mkdir($conf->user->dir_temp);
if (!is_writable($conf->user->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->user->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->user->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -281,7 +281,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -290,11 +290,11 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -302,8 +302,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
dol_mkdir($conf->user->dir_temp);
if (!is_writable($conf->user->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->user->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->user->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -115,7 +115,8 @@ class EmailCollector extends CommonObject
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>'Example: My Email collector', 'csslist'=>'tdoverflowmax150'),
'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>60, 'notnull'=>-1, 'csslist'=>'small'),
'host' => array('type'=>'varchar(255)', 'label'=>'EMailHost', 'visible'=>1, 'enabled'=>1, 'position'=>90, 'notnull'=>1, 'searchall'=>1, 'comment'=>"IMAP server", 'help'=>'Example: imap.gmail.com', 'csslist'=>'tdoverflow125'),
'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)'),
'port' => array('type'=>'varchar(10)', 'label'=>'EMailHostPort', 'visible'=>1, 'enabled'=>1, 'position'=>91, 'notnull'=>1, 'searchall'=>0, 'comment'=>"IMAP server port", 'help'=>'Example: 993', 'csslist'=>'tdoverflow125', 'default'=>'993'),
'hostcharset' => array('type'=>'varchar(16)', 'label'=>'HostCharset', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>0, 'searchall'=>0, 'comment'=>"IMAP server charset", 'help'=>'Example: "UTF-8" (May be "US-ASCII" with some Office365)', 'default'=>'UTF-8'),
'login' => array('type'=>'varchar(128)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>101, 'notnull'=>-1, 'index'=>1, 'comment'=>"IMAP login", 'help'=>'Example: myaccount@gmail.com'),
'password' => array('type'=>'password', 'label'=>'Password', 'visible'=>-1, 'enabled'=>1, 'position'=>102, 'notnull'=>-1, 'comment'=>"IMAP password", 'help'=>'WithGMailYouCanCreateADedicatedPassword'),
'source_directory' => array('type'=>'varchar(255)', 'label'=>'MailboxSourceDirectory', 'visible'=>-1, 'enabled'=>1, 'position'=>103, 'notnull'=>1, 'default' => 'Inbox', 'help'=>'Example: INBOX'),
@ -746,7 +747,7 @@ class EmailCollector extends CommonObject
$flags .= '/authuser='.$partofauth[0].'/user='.$partofauth[1];
}
$connectstringserver = '{'.$this->host.':993'.$flags.'}';
$connectstringserver = '{'.$this->host.':'.$this->port.$flags.'}';
return $connectstringserver;
}

View File

@ -64,5 +64,9 @@ ALTER TABLE llx_ticket ADD COLUMN ip varchar(250);
ALTER TABLE llx_societe ADD last_main_doc VARCHAR(255) NULL AFTER model_pdf;
ALTER TABLE llx_emailcollector_emailcollector ADD COLUMN port varchar(10) DEFAULT '993';
ALTER TABLE llx_bank ADD COLUMN position integer DEFAULT 0;
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_product (fk_product);

View File

@ -19,3 +19,4 @@
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_commande (fk_commande);
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_reception (fk_reception);
ALTER TABLE llx_commande_fournisseur_dispatch ADD CONSTRAINT fk_commande_fournisseur_dispatch_fk_reception FOREIGN KEY (fk_reception) REFERENCES llx_reception (rowid);
ALTER TABLE llx_commande_fournisseur_dispatch ADD INDEX idx_commande_fournisseur_dispatch_fk_product (fk_product);

View File

@ -22,6 +22,7 @@ CREATE TABLE llx_emailcollector_emailcollector(
label varchar(255),
description text,
host varchar(255),
port varchar(10) DEFAULT '993',
hostcharset varchar(16) DEFAULT 'UTF-8',
login varchar(128),
password varchar(128),

View File

@ -41,6 +41,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -80,7 +81,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->knowledgemanagement->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->knowledgemanagement->multidir_output[$object->entity]) ? $conf->knowledgemanagement->multidir_output[$object->entity] : $conf->knowledgemanagement->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -44,7 +44,7 @@ $cancel = GETPOST('cancel', 'aZ09');
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordcard'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha');
$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
//$lineid = GETPOST('lineid', 'int');
$lineid = GETPOST('lineid', 'int');
// Initialize technical objects
$object = new KnowledgeRecord($db);

View File

@ -49,7 +49,7 @@ $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("pa
if (empty($page) || $page == -1) {
$page = 0;
} // If $page is not defined, or '' or -1
$offset = $liste_limit * $page;
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (!$sortorder) {

View File

@ -51,6 +51,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'knowledgerecordlist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$mode = GETPOST('mode', 'aZ09');
$id = GETPOST('id', 'int');

View File

@ -2064,6 +2064,7 @@ EmailCollectors=Email collectors
EmailCollectorDescription=Add a scheduled job and a setup page to scan regularly email boxes (using IMAP protocol) and record emails received into your application, at the right place and/or create some records automatically (like leads).
NewEmailCollector=New Email Collector
EMailHost=Host of email IMAP server
EMailHostPort=Port of email IMAP server
MailboxSourceDirectory=Mailbox source directory
MailboxTargetDirectory=Mailbox target directory
EmailcollectorOperations=Operations to do by collector

View File

@ -289,6 +289,7 @@ ErrorInvoiceLoadThirdPartyKey=Third-party key "%s" no set for invoice "%s"
ErrorDeleteLineNotAllowedByObjectStatus=Delete line is not allowed by current object status
ErrorAjaxRequestFailed=Request failed
ErrorThirpdartyOrMemberidIsMandatory=Third party or Member of partnership is mandatory
ErrorFailedToWriteInTempDirectory=Failed to write in temp directory
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.

View File

@ -2413,7 +2413,7 @@ function printDropdownQuickadd()
"title" => "MenuNewMember@members",
"name" => "Adherent@members",
"picto" => "object_member",
"activation" => !empty($conf->adherent->enabled) && $user->rights->adherent->creer, // vs hooking
"activation" => !empty($conf->adherent->enabled) && $user->hasRight("adherent", "write"), // vs hooking
"position" => 5,
),
array(
@ -2421,7 +2421,7 @@ function printDropdownQuickadd()
"title" => "MenuNewThirdParty@companies",
"name" => "ThirdParty@companies",
"picto" => "object_company",
"activation" => !empty($conf->societe->enabled) && $user->rights->societe->creer, // vs hooking
"activation" => !empty($conf->societe->enabled) && $user->hasRight("societe", "write"), // vs hooking
"position" => 10,
),
array(
@ -2429,7 +2429,7 @@ function printDropdownQuickadd()
"title" => "NewContactAddress@companies",
"name" => "Contact@companies",
"picto" => "object_contact",
"activation" => !empty($conf->societe->enabled) && $user->rights->societe->contact->creer, // vs hooking
"activation" => !empty($conf->societe->enabled) && $user->hasRight("societe", "contact", "write"), // vs hooking
"position" => 20,
),
array(
@ -2437,7 +2437,7 @@ function printDropdownQuickadd()
"title" => "NewPropal@propal",
"name" => "Proposal@propal",
"picto" => "object_propal",
"activation" => !empty($conf->propal->enabled) && $user->rights->propale->creer, // vs hooking
"activation" => !empty($conf->propal->enabled) && $user->hasRight("propale", "write"), // vs hooking
"position" => 30,
),
@ -2446,7 +2446,7 @@ function printDropdownQuickadd()
"title" => "NewOrder@orders",
"name" => "Order@orders",
"picto" => "object_order",
"activation" => !empty($conf->commande->enabled) && $user->rights->commande->creer, // vs hooking
"activation" => !empty($conf->commande->enabled) && $user->hasRight("commande", "write"), // vs hooking
"position" => 40,
),
array(
@ -2454,7 +2454,7 @@ function printDropdownQuickadd()
"title" => "NewBill@bills",
"name" => "Bill@bills",
"picto" => "object_bill",
"activation" => isModEnabled('facture') && $user->rights->facture->creer, // vs hooking
"activation" => isModEnabled('facture') && $user->hasRight("facture", "write"), // vs hooking
"position" => 50,
),
array(
@ -2462,7 +2462,7 @@ function printDropdownQuickadd()
"title" => "NewContractSubscription@contracts",
"name" => "Contract@contracts",
"picto" => "object_contract",
"activation" => !empty($conf->contrat->enabled) && $user->rights->contrat->creer, // vs hooking
"activation" => !empty($conf->contrat->enabled) && $user->hasRight("contrat", "write"), // vs hooking
"position" => 60,
),
array(
@ -2470,7 +2470,7 @@ function printDropdownQuickadd()
"title" => "SupplierProposalNew@supplier_proposal",
"name" => "SupplierProposal@supplier_proposal",
"picto" => "supplier_proposal",
"activation" => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->creer, // vs hooking
"activation" => !empty($conf->supplier_proposal->enabled) && $user->hasRight("supplier_invoice", "write"), // vs hooking
"position" => 70,
),
array(
@ -2478,7 +2478,7 @@ function printDropdownQuickadd()
"title" => "NewSupplierOrderShort@orders",
"name" => "SupplierOrder@orders",
"picto" => "supplier_order",
"activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->creer) || (!empty($conf->supplier_order->enabled) && $user->rights->supplier_order->creer), // vs hooking
"activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "write")) || (!empty($conf->supplier_order->enabled) && $user->hasRight("supplier_invoice", "write")), // vs hooking
"position" => 80,
),
array(
@ -2486,7 +2486,7 @@ function printDropdownQuickadd()
"title" => "NewBill@bills",
"name" => "SupplierBill@bills",
"picto" => "supplier_invoice",
"activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->creer) || (!empty($conf->supplier_invoice->enabled) && $user->rights->supplier_invoice->creer), // vs hooking
"activation" => (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "write")) || (!empty($conf->supplier_invoice->enabled) && $user->hasRight("supplier_invoice", "write")), // vs hooking
"position" => 90,
),
array(
@ -2494,7 +2494,7 @@ function printDropdownQuickadd()
"title" => "NewProduct@products",
"name" => "Product@products",
"picto" => "object_product",
"activation" => !empty($conf->product->enabled) && $user->rights->produit->creer, // vs hooking
"activation" => !empty($conf->product->enabled) && $user->hasRight("produit", "write"), // vs hooking
"position" => 100,
),
array(
@ -2502,7 +2502,7 @@ function printDropdownQuickadd()
"title" => "NewService@products",
"name" => "Service@products",
"picto" => "object_service",
"activation" => !empty($conf->service->enabled) && $user->rights->service->creer, // vs hooking
"activation" => !empty($conf->service->enabled) && $user->hasRight("service", "write"), // vs hooking
"position" => 110,
),
array(
@ -2510,7 +2510,7 @@ function printDropdownQuickadd()
"title" => "AddUser@users",
"name" => "User@users",
"picto" => "user",
"activation" => $user->rights->user->user->creer, // vs hooking
"activation" => $user->hasRight("user", "user", "write"), // vs hooking
"position" => 500,
),
),

View File

@ -282,7 +282,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$newfiletmp = preg_replace('/\.od(t|s)/i', '', $newfile);
$newfiletmp = preg_replace('/template_/i', '', $newfiletmp);
$newfiletmp = preg_replace('/modele_/i', '', $newfiletmp);
$newfiletmp = $objectref.'_'.$newfiletmp;
$newfiletmp = $objectref . '_' . $newfiletmp;
//$file=$dir.'/'.$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.odt';
// Get extension (ods or odt)
$newfileformat = substr($newfile, strrpos($newfile, '.') + 1);
@ -291,11 +291,11 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if ($format == '1') {
$format = '%Y%m%d%H%M%S';
}
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
$filename = $newfiletmp . '-' . dol_print_date(dol_now(), $format) . '.' . $newfileformat;
} else {
$filename = $newfiletmp.'.'.$newfileformat;
$filename = $newfiletmp . '.' . $newfileformat;
}
$file = $dir.'/'.$filename;
$file = $dir . '/' . $filename;
//print "newdir=".$dir;
//print "newfile=".$newfile;
//print "file=".$file;
@ -303,8 +303,8 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
dol_mkdir($conf->mymodule->dir_temp);
if (!is_writable($conf->mymodule->dir_temp)) {
$this->error = "Failed to write in temp directory ".$conf->mymodule->dir_temp;
dol_syslog('Error in write_file: '.$this->error, LOG_ERR);
$this->error = $langs->transnoentities("ErrorFailedToWriteInTempDirectory", $conf->mymodule->dir_temp);
dol_syslog('Error in write_file: ' . $this->error, LOG_ERR);
return -1;
}

View File

@ -643,9 +643,6 @@ class Stripe extends CommonObject
if (!empty($conf->global->STRIPE_BANCONTACT)) {
$paymentmethodtypes[] = "bancontact";
}
if (!empty($conf->global->STRIPE_KLARNA)) {
$paymentmethodtypes[] = "klarna";
}
if (!empty($conf->global->STRIPE_IDEAL)) {
$paymentmethodtypes[] = "ideal";
}

View File

@ -56,6 +56,7 @@ $projectid = GETPOST('projectid', 'int');
$cancel = GETPOST('cancel', 'alpha');
$action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('$backtopage', 'alpha');
$contactid = GETPOST('contactid', 'int');
$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
@ -1038,7 +1039,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
print $langs->trans("AssignedTo");
if ($object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
print '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.$object->track_id.'&action=view&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
}
print '</td></tr></table>';
@ -1066,7 +1067,7 @@ if ($action == 'create' || $action == 'presend') {
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('Progression').'</td><td class="left">';
print '</td>';
if ($action != 'progression' && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) {
if ($action != 'progression' && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && !$user->socid) {
print '<td class="right"><a class="editfielda" href="'.$url_page_current.'?action=progression&amp;track_id='.$object->track_id.'">'.img_edit($langs->trans('Modify')).'</a></td>';
}
print '</tr></table>';
@ -1189,7 +1190,7 @@ if ($action == 'create' || $action == 'presend') {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} else {
// Button to edit Properties
if ($object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status < $object::STATUS_NEED_MORE_INFO && $user->rights->ticket->write) {
print ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&action=view&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
}
}
@ -1248,7 +1249,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket status
print '<!-- navbar with status -->';
if (!$user->socid && $user->rights->ticket->write && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
if (!$user->socid && $user->rights->ticket->write && isset($object->fk_status) && $object->fk_status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object);
}
@ -1384,16 +1385,16 @@ if ($action == 'create' || $action == 'presend') {
if (empty($reshook)) {
// Show link to add a message (if read and not closed)
if ($object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
if (isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
print dolGetButtonAction('', $langs->trans('TicketAddMessage'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&mode=init&token='.newToken().'&track_id='.$object->track_id, '');
}
// Link to create an intervention
// socid is needed otherwise fichinter ask it and forgot origin after form submit :\
if (!$object->fk_soc && $user->rights->ficheinter->creer) {
if (!$object->fk_soc && $user->hasRight("ficheinter", "creer")) {
print dolGetButtonAction($langs->trans('UnableToCreateInterIfNoSocid'), $langs->trans('TicketAddIntervention'), 'default', $_SERVER['PHP_SELF']. '#', '', false);
}
if ($object->fk_soc > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
if ($object->fk_soc > 0 && isset($object->fk_status) && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) {
print dolGetButtonAction('', $langs->trans('TicketAddIntervention'), 'default', DOL_URL_ROOT.'/fichinter/card.php?action=create&token='.newToken().'&socid='. $object->fk_soc.'&origin=ticket_ticket&originid='. $object->id, '');
}
@ -1404,17 +1405,17 @@ if ($action == 'create' || $action == 'presend') {
*/
// Close ticket if statut is read
if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
}
// Abadon ticket if statut is read
if ($object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
if (isset($object->fk_status) && $object->fk_status > 0 && $object->fk_status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, '');
}
// Re-open ticket
if (!$user->socid && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED) && !$user->socid) {
if (!$user->socid && (isset($object->fk_status) && ($object->fk_status == Ticket::STATUS_CLOSED || $object->fk_status == Ticket::STATUS_CANCELED)) && !$user->socid) {
print dolGetButtonAction('', $langs->trans('ReOpen'), 'default', $_SERVER["PHP_SELF"].'?action=reopen&token='.newToken().'&track_id='.$object->track_id, '');
}

View File

@ -284,7 +284,7 @@ foreach ($data as $val) {
print '<tr class="oddeven" height="24">';
print '<td class="center"><a href="'.$_SERVER["PHP_SELF"].'?year='.$year.($socid > 0 ? '&socid='.$socid : '').($userid > 0 ? '&userid='.$userid : '').'">'.$year.'</a></td>';
print '<td class="right">'.$val['nb'].'</td>';
print '<td class="right" style="'.(($val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round($val['nb_diff']).'</td>';
print '<td class="right" style="'.((isset($val['nb_diff']) && $val['nb_diff'] >= 0) ? 'color: green;' : 'color: red;').'">'.round(isset($val['nb_diff']) ? $val['nb_diff'] : 0).'</td>';
//print '<td class="right">'.price(price2num($val['total'], 'MT'), 1).'</td>';
//print '<td class="right" style="'.(($val['total_diff'] >= 0) ? 'color: green;':'color: red;').'">'.round($val['total_diff']).'</td>';
//print '<td class="right">'.price(price2num($val['avg'], 'MT'), 1).'</td>';

View File

@ -76,15 +76,15 @@ $dateendvalidity = dol_mktime(0, 0, 0, GETPOST('dateendvaliditymonth', 'int'), G
$dateofbirth = dol_mktime(0, 0, 0, GETPOST('dateofbirthmonth', 'int'), GETPOST('dateofbirthday', 'int'), GETPOST('dateofbirthyear', 'int'));
// Define value to know what current user can do on users
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
$canadduser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$canreaduser = (!empty($user->admin) || $user->hasRight("user", "user", "read"));
$canedituser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$candisableuser = (!empty($user->admin) || $user->hasRight("user", "user", "delete"));
$canreadgroup = $canreaduser;
$caneditgroup = $canedituser;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
$canreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
$caneditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write"));
}
$childids = $user->getAllChildIds(1); // For later, test on salary visibility
@ -92,8 +92,8 @@ $childids = $user->getAllChildIds(1); // For later, test on salary visibility
// Define value to know what current user can do on properties of edited user
if ($id > 0) {
// $user is the current logged user, $id is the user we want to edit
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer) || (($user->id != $id) && $user->rights->user->user->creer));
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password) || (($user->id != $id) && $user->rights->user->user->password));
$caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write")) || (($user->id != $id) && $user->hasRight("user", "user", "write")));
$caneditpassword = ((($user->id == $id) && $user->hasRight("user", "self", "password")) || (($user->id != $id) && $user->hasRight("user", "user", "password")));
}
// Security check
@ -712,7 +712,7 @@ if (empty($reshook)) {
// Actions to build doc
$upload_dir = $conf->user->dir_output;
$permissiontoadd = $user->rights->user->user->creer;
$permissiontoadd = $user->hasRight("user", "user", "write");
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@ -1165,7 +1165,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (!empty($conf->categorie->enabled) && !empty($user->hasRight("categorie", "read"))) {
print '<tr><td>'.$form->editfieldkey('Categories', 'usercats', '', $object, 0).'</td><td>';
$cate_arbo = $form->select_all_categories('user', null, 'parent', null, null, 1);
print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('usercats', $cate_arbo, GETPOST('usercats', 'array'), 0, 0, 'maxwdith300 widthcentpercentminusx', 0, '90%');
@ -1234,9 +1234,9 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(GETPOST('job', 'alphanohtml')).'">';
print '</td></tr>';
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($id, $childids))
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
if ((!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "read")) && in_array($id, $childids))
|| (!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "readall")))
|| (!empty($conf->hrm->enabled) && !empty($user->hasRight("hrm", "employee", "read")))) {
$langs->load("salaries");
// THM
@ -1365,7 +1365,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$title = $langs->trans("User");
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight("user", "user", "read") || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
}
@ -1417,7 +1417,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
@ -1541,8 +1541,8 @@ if ($action == 'create' || $action == 'adduserldap') {
// Sensitive salary/value information
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
|| (!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "readall")))
|| (!empty($conf->hrm->enabled) && !empty($user->hasRight("hrm", "employee", "read")))) {
$langs->load("salaries");
// Salary
@ -1625,7 +1625,7 @@ if ($action == 'create' || $action == 'adduserldap') {
}
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (!empty($conf->categorie->enabled) && !empty($user->hasRight("categorie", "read"))) {
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td>';
print '<td colspan="3">';
print $form->showCategories($object->id, Categorie::TYPE_USER, 1);
@ -1804,7 +1804,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</tr>'."\n";
// API key
if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) {
if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight("api", "apikey", "generate"))) {
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
print '<td>';
if (!empty($object->api_key)) {
@ -2369,7 +2369,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print "</td></tr>\n";
// API key
if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) {
if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight("api", "apikey", "generate"))) {
print '<tr><td>'.$langs->trans("ApiKey").'</td>';
print '<td>';
print '<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.'" autocomplete="off">';
@ -2566,7 +2566,7 @@ if ($action == 'create' || $action == 'adduserldap') {
print '</tr>';
// Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
if (!empty($conf->categorie->enabled) && !empty($user->hasRight("categorie", "read"))) {
print '<tr><td>'.$form->editfieldkey('Categories', 'usercats', '', $object, 0).'</td>';
print '<td>';
print img_picto('', 'category', 'class="pictofixedwidth"');
@ -2711,8 +2711,8 @@ if ($action == 'create' || $action == 'adduserldap') {
// Sensitive salary/value information
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
|| (!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "readall")))
|| (!empty($conf->hrm->enabled) && !empty($user->hasRight("hrm", "employee", "read")))) {
$langs->load("salaries");
// Salary
@ -2803,8 +2803,8 @@ if ($action == 'create' || $action == 'adduserldap') {
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->user->dir_output."/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->user->user->lire;
$delallowed = $user->rights->user->user->creer;
$genallowed = $user->hasRight("user", "user", "read");
$delallowed = $user->hasRight("user", "user", "write");
print $formfile->showdocuments('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', empty($soc->default_lang) ? '' : $soc->default_lang);
$somethingshown = $formfile->numoffiles;

View File

@ -778,7 +778,7 @@ class User extends CommonObject
return $this->rights->$rightsPath->$permlevel1->lire;
}
if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->creer)) {
return $this->rights->$rightsPath->$permlevel1->create;
return $this->rights->$rightsPath->$permlevel1->creer;
}
if ($permlevel2 == 'write' && !empty($this->rights->$rightsPath->$permlevel1->create)) {
return $this->rights->$rightsPath->$permlevel1->create;
@ -797,7 +797,7 @@ class User extends CommonObject
return $this->rights->$rightsPath->lire;
}
if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->creer)) {
return $this->rights->$rightsPath->create;
return $this->rights->$rightsPath->creer;
}
if ($permlevel1 == 'write' && !empty($this->rights->$rightsPath->create)) {
return $this->rights->$rightsPath->create;

View File

@ -41,23 +41,23 @@ $ref = GETPOST('ref', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userdoc'; // To manage different context of search
// Define value to know what current user can do on users
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
$canadduser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$canreaduser = (!empty($user->admin) || $user->hasRight("user", "user", "read"));
$canedituser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$candisableuser = (!empty($user->admin) || $user->hasRight("user", "user", "delete"));
$canreadgroup = $canreaduser;
$caneditgroup = $canedituser;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
$canreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
$caneditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write"));
}
// Define value to know what current user can do on properties of edited user
if ($id) {
// $user est le user qui edite, $id est l'id de l'utilisateur edite
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer));
$caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
|| (($user->id != $id) && $user->rights->user->user->password));
$caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write"))
|| (($user->id != $id) && $user->hasRight("user", "user", "write")));
$caneditpassword = ((($user->id == $id) && $user->hasRight("user", "self", "password"))
|| (($user->id != $id) && $user->hasRight("user", "user", "passsword")));
}
$permissiontoadd = $caneditfield; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles
@ -147,7 +147,7 @@ if ($object->id) {
print dol_get_fiche_head($head, 'document', $langs->trans("User"), -1, 'user');
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight("user", "user", "read") || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -155,7 +155,7 @@ if ($object->id) {
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -32,16 +32,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Defini si peux lire/modifier utilisateurs et permisssions
$canreadperms = ($user->admin || $user->rights->user->user->lire);
$caneditperms = ($user->admin || $user->rights->user->user->creer);
$candisableperms = ($user->admin || $user->rights->user->user->supprimer);
$canreadperms = ($user->admin || $user->hasRight("user", "user", "read"));
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
$candisableperms = ($user->admin || $user->hasRight("user", "user", "delete"));
$feature2 = 'user';
// Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadperms = ($user->admin || $user->rights->user->group_advance->read);
$caneditperms = ($user->admin || $user->rights->user->group_advance->write);
$candisableperms = ($user->admin || $user->rights->user->group_advance->delete);
$canreadperms = ($user->admin || $user->hasRight("user", "group_advance", "read"));
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
$candisableperms = ($user->admin || $user->hasRight("user", "group_advance", "delete"));
$feature2 = 'group_advance';
}
@ -238,7 +238,7 @@ if (empty($reshook)) {
// Actions to build doc
$upload_dir = $conf->user->dir_output.'/usergroups';
$permissiontoadd = $user->rights->user->user->creer;
$permissiontoadd = $user->hasRight("user", "user", "write");
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@ -250,7 +250,7 @@ $title = $object->name.' - '.$langs->trans("Card");
if ($action == 'create') {
$title = $langs->trans("NewGroup");
}
$help_url = "";
llxHeader('', $title, $help_url);
@ -329,7 +329,7 @@ if ($action == 'create') {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
@ -485,8 +485,8 @@ if ($action == 'create') {
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->user->dir_output."/usergroups/".dol_sanitizeFileName($object->ref);
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed = $user->rights->user->user->creer;
$delallowed = $user->rights->user->user->supprimer;
$genallowed = $user->hasRight("user", "user", "write");
$delallowed = $user->hasRight("user", "user", "delete");
$somethingshown = $formfile->showdocuments('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $mysoc->default_lang);

View File

@ -38,10 +38,10 @@ $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choi
$contextpage = GETPOST('optioncss', 'aZ09');
// Defini si peux lire/modifier utilisateurs et permisssions
$caneditperms = ($user->admin || $user->rights->user->user->creer);
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
// Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$caneditperms = ($user->admin || $user->rights->user->group_advance->write);
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
}
// Load variable for pagination
@ -70,7 +70,7 @@ $fieldstosearchall = array(
);
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
if (!$user->rights->user->group_advance->read && !$user->admin) {
if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) {
accessforbidden();
}
}
@ -80,7 +80,7 @@ if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->
accessforbidden();
}
if (!$user->rights->user->user->lire && !$user->admin) {
if (!$user->hasRight("user", "user", "read") && !$user->admin) {
accessforbidden();
}
@ -121,6 +121,7 @@ if (empty($reshook)) {
* View
*/
$title = $langs->trans("ListOfGroups");
$help_url="";
llxHeader('', $title, $help_url);
$sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";

View File

@ -50,15 +50,15 @@ if (!isset($id) || empty($id)) {
}
// Define if user can read permissions
$canreadperms = ($user->admin || $user->rights->user->user->lire);
$canreadperms = ($user->admin || $user->hasRight("user", "user", "read"));
// Define if user can modify group permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer);
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
// Advanced permissions
$advancedpermsactive = false;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$advancedpermsactive = true;
$canreadperms = ($user->admin || ($user->rights->user->group_advance->read && $user->rights->user->group_advance->readperms));
$caneditperms = ($user->admin || $user->rights->user->group_advance->write);
$canreadperms = ($user->admin || ($user->hasRight("user", "group_advance", "read") && $user->hasRight("user", "group_advance", "readperms")));
$caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write"));
}
// Security check
@ -206,7 +206,7 @@ if ($object->id > 0) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -60,9 +60,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$userstatic = new User($db);
// Define value to know what current user can do on users
$canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
$canadduser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
if (!$user->rights->user->user->lire && !$user->admin) {
if (!$user->hasRight("user", "user", "read") && !$user->admin) {
accessforbidden();
}

View File

@ -131,7 +131,7 @@ $arrayfields = array(
'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(!empty($conf->api->enabled) && $user->admin)),
'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))),
'u.salary'=>array('label'=>"Salary", 'checked'=>1, 'position'=>80, 'enabled'=>(!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "readall")))),
'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
@ -174,26 +174,26 @@ if ($mode == 'employee' && !GETPOSTISSET('search_employee')) {
}
// Define value to know what current user can do on users
$permissiontoadd = (!empty($user->admin) || $user->rights->user->user->creer);
$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
$canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
$permissiontoadd = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$canreaduser = (!empty($user->admin) || $user->hasRight("user", "user", "read"));
$canedituser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
$candisableuser = (!empty($user->admin) || $user->hasRight("user", "user", "delete"));
$canreadgroup = $canreaduser;
$caneditgroup = $canedituser;
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
$canreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
$caneditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write"));
}
$error = 0;
// Permission to list
if ($mode == 'employee') {
if (empty($user->rights->salaries->read)) {
if (empty($user->hasRight("salaries", "read"))) {
accessforbidden();
}
} else {
if (empty($user->rights->user->user->lire) && empty($user->admin)) {
if (empty($user->hasRight("user", "user", "read")) && empty($user->admin)) {
accessforbidden();
}
}
@ -441,7 +441,7 @@ if ($search_categ == -2) {
if ($search_warehouse > 0) {
$sql .= " AND u.fk_warehouse = ".((int) $search_warehouse);
}
if ($mode == 'employee' && empty($user->rights->salaries->readall)) {
if ($mode == 'employee' && empty($user->hasRight("salaries", "readall"))) {
$sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")";
}
// Add where from extra fields
@ -658,7 +658,7 @@ $moreforfilter = '';
$moreforfilter.= '</div>';*/
// Filter on categories
if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) {
if (!empty($conf->categorie->enabled) && $user->hasRight("categorie", "read")) {
$moreforfilter .= '<div class="divsearchfield">';
$tmptitle = $langs->trans('Category');
$moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle);
@ -939,9 +939,9 @@ while ($i < $imaxinloop) {
$li = $object->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
$canreadhrmdata = 0;
if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read) && in_array($obj->rowid, $childids))
|| (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->readall))
|| (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read))) {
if ((!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "read")) && in_array($obj->rowid, $childids))
|| (!empty($conf->salaries->enabled) && !empty($user->hasRight("salaries", "readall")))
|| (!empty($conf->hrm->enabled) && !empty($user->hasRight("hrm", "employee", "read")))) {
$canreadhrmdata = 1;
}
$canreadsecretapi = 0;

View File

@ -39,7 +39,7 @@ $object->fetch($id, '', '', 1);
$object->getrights();
// If user is not user read and no permission to read other users, we stop
if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
if (($object->id != $user->id) && (!$user->hasRight("user", "user", "read"))) {
accessforbidden();
}
@ -48,7 +48,7 @@ $socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
@ -67,7 +67,7 @@ if ($reshook < 0) {
}
if (empty($reshook)) {
if ($action == 'update' && $user->rights->user->user->creer && !GETPOST("cancel")) {
if ($action == 'update' && $user->hasRight("user", "user", "write") && !GETPOST("cancel")) {
$db->begin();
$res = $object->update_note(dol_html_entity_decode(GETPOST('note_private', 'restricthtml'), ENT_QUOTES | ENT_HTML5));
@ -99,7 +99,7 @@ if ($id) {
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight("user", "user", "read") || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -107,7 +107,7 @@ if ($id) {
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '<div class="underbanner clearboth"></div>';
@ -138,7 +138,7 @@ if ($id) {
}
print '</tr>';
$editenabled = (($action == 'edit') && !empty($user->rights->user->user->creer));
$editenabled = (($action == 'edit') && !empty($user->hasRight("user", "user", "write")));
// Note
print '<tr><td class="tdtop">'.$langs->trans("Note").'</td>';
@ -171,7 +171,7 @@ if ($id) {
print '<div class="tabsAction">';
if ($user->rights->user->user->creer && $action != 'edit') {
if ($user->hasRight("user", "user", "write") && $action != 'edit') {
print '<a class="butAction" href="note.php?id='.$object->id.'&action=edit&token='.newToken().'">'.$langs->trans('Modify')."</a>";
}

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
$langs->loadLangs(array('companies', 'products', 'admin', 'users', 'languages', 'projects', 'members'));
// Defini si peux lire/modifier permisssions
$canreaduser = ($user->admin || $user->rights->user->user->lire);
$canreaduser = ($user->admin || $user->hasRight("user", "user", "read"));
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
@ -40,8 +40,8 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'use
if ($id) {
// $user est le user qui edite, $id est l'id de l'utilisateur edite
$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
|| (($user->id != $id) && $user->rights->user->user->creer));
$caneditfield = ((($user->id == $id) && $user->hasRight("user", "self", "write"))
|| (($user->id != $id) && $user->hasRight("user", "user", "write")));
}
// Security check
@ -49,7 +49,7 @@ $socid = 0;
if ($user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
if ($user->id <> $id && !$canreaduser) {
@ -231,11 +231,11 @@ if ($action == 'edit') {
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight("user", "user", "read") || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin);
print '<div class="underbanner clearboth"></div>';
@ -346,7 +346,7 @@ if ($action == 'edit') {
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';

View File

@ -50,13 +50,13 @@ if (!isset($id) || empty($id)) {
}
// Define if user can read permissions
$canreaduser = ($user->admin || $user->rights->user->user->lire);
$canreaduser = ($user->admin || $user->hasRight("user", "user", "read"));
// Define if user can modify other users and permissions
$caneditperms = ($user->admin || $user->rights->user->user->creer);
$caneditperms = ($user->admin || $user->hasRight("user", "user", "write"));
// Advanced permissions
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
$canreaduser = ($user->admin || ($user->rights->user->user->lire && $user->rights->user->user_advance->readperms));
$caneditselfperms = ($user->id == $id && $user->rights->user->self_advance->writeperms);
$canreaduser = ($user->admin || ($user->hasRight("user", "user", "read") && $user->hasRight("user", "user_advance", "readperms")));
$caneditselfperms = ($user->id == $id && $user->hasRight("user", "self_advance", "writeperms"));
$caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
}
@ -65,9 +65,9 @@ $socid = 0;
if (isset($user->socid) && $user->socid > 0) {
$socid = $user->socid;
}
$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
$feature2 = (($socid && $user->hasRight("user", "self", "write")) ? '' : 'user');
// A user can always read its own card if not advanced perms enabled, or if he has advanced perms, except for admin
if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms) && empty($user->admin))) {
if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->hasRight("user", "self_advance", "readperms")) && empty($user->admin))) {
accessforbidden();
}
@ -249,7 +249,7 @@ if ($result) {
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight("user", "user", "read") || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -257,7 +257,7 @@ $morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'" cla
$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
$morehtmlref .= '</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
dol_banner_tab($object, 'id', $linkback, $user->hasRight("user", "user", "read") || $user->admin, 'rowid', 'ref', $morehtmlref);
print '<div class="fichecenter">';