mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Merge branch 'develop' into patch-8
This commit is contained in:
@@ -2095,7 +2095,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if (Adherent::STATUS_VALIDATED == $object->status) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -674,7 +674,7 @@ class AdherentType extends CommonObject
|
||||
* Return the array of all amounts per membership type id
|
||||
*
|
||||
* @param int $status Filter on status of type
|
||||
* @return array<int,string> Array of membership type
|
||||
* @return array<int,float> Array of membership type
|
||||
*/
|
||||
public function amountByType($status = null)
|
||||
{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2022 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2024 Jon Bendtsen <jon.bendtsen.github@jonb.dk>
|
||||
/* Copyright (C) 2016 Xebax Christy <xebax@wanadoo.fr>
|
||||
* Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2017-2025 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2017 Neil Orley <neil.orley@oeris.fr>
|
||||
* Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2018-2022 Thibault FOUCART <support@ptibogxiv.net>
|
||||
* Copyright (C) 2024 Jon Bendtsen <jon.bendtsen.github@jonb.dk>
|
||||
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
* Copyright (C) 2025 Charlene Benke <charlene@patas-monkey.com>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -1056,7 +1056,8 @@ class Setup extends DolibarrApi
|
||||
|
||||
$sql = "SELECT rowid, code, label, affect, delay, newbymonth, fk_country";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_holiday_types as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_holiday_types').")";
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
if ($fk_country) {
|
||||
$sql .= " AND (t.fk_country = ".((int) $fk_country);
|
||||
$sql .= " OR t.fk_country is null)";
|
||||
@@ -1135,7 +1136,8 @@ class Setup extends DolibarrApi
|
||||
|
||||
$sql = "SELECT id, code, dayrule, day, month, year, fk_country, code as label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."c_hrm_public_holiday as t";
|
||||
$sql .= " WHERE t.active = ".((int) $active);
|
||||
$sql .= " WHERE t.entity IN (".getEntity('c_hrm_public_holiday').")";
|
||||
$sql .= " AND t.active = ".((int) $active);
|
||||
if ($fk_country) {
|
||||
$sql .= " AND (t.fk_country = ".((int) $fk_country);
|
||||
$sql .= " OR t.fk_country is null)";
|
||||
|
||||
@@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -48,7 +48,11 @@ require '../../main.inc.php';
|
||||
|
||||
$id = GETPOSTINT('id');
|
||||
$element = GETPOST('element', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$action = GETPOST('action', 'aZ09'); // Can be DOC_PREVIEW or DOC_DOWNLOAD
|
||||
|
||||
if (! in_array($action, array('DOC_PREVIEW', 'DOC_DOWNLOAD'))) {
|
||||
accessforbidden('Bad value for action. Must be DOC_PREVIEW or DOC_DOWNLOAD');
|
||||
}
|
||||
|
||||
if ($element === 'facture') {
|
||||
restrictedArea($user, 'facture', $id, '', '', 'fk_soc', 'rowid', 0);
|
||||
@@ -74,6 +78,14 @@ if ($element === 'facture') { // Test on permission done in top of page
|
||||
|
||||
$facture = new Facture($db);
|
||||
if ($facture->fetch($id) > 0) {
|
||||
// Increase counter by 1
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET pos_print_counter = pos_print_counter + 1";
|
||||
$sql .= " WHERE rowid = ".((int) $facture->id);
|
||||
$db->query($sql);
|
||||
|
||||
//$facture->pos_print_counter += 1;
|
||||
//$facture->update($user, 1); // We disable trigger here because we already call the trigger $action = DOC_PREVIEW or DOC_DOWNLOAD just after
|
||||
|
||||
$facture->call_trigger($action, $user);
|
||||
}
|
||||
|
||||
|
||||
@@ -468,7 +468,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
/*if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}*/
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
/**
|
||||
* \file htdocs/categories/edit.php
|
||||
* \ingroup category
|
||||
* \brief Page d'edition de categorie produit
|
||||
* \brief Page to edit a category
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
@@ -54,7 +54,7 @@ $dol_openinpopup = GETPOST('dol_openinpopup', 'aZ');
|
||||
$socid = GETPOSTINT('socid');
|
||||
$label = (string) GETPOST('label', 'alphanohtml');
|
||||
$description = (string) GETPOST('description', 'restricthtml');
|
||||
$color = preg_replace('/^#/', '', preg_replace('/[^0-9a-f#]/i', '', (string) GETPOST('color', 'alphanohtml')));
|
||||
$color = preg_replace('/[^0-9a-f]/i', '', (string) GETPOST('color', 'alphanohtml'));
|
||||
$position = GETPOSTINT('position');
|
||||
$visible = GETPOSTINT('visible');
|
||||
$parent = GETPOSTINT('parent');
|
||||
@@ -91,6 +91,7 @@ $error = 0;
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters = array('id' => $id, 'ref' => $ref, 'cancel' => $cancel, 'backtopage' => $backtopage, 'socid' => $socid, 'label' => $label, 'description' => $description, 'color' => $color, 'position' => $position, 'visible' => $visible, 'parent' => $parent);
|
||||
// Note that $action and $object may be modified by some hooks
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action);
|
||||
|
||||
@@ -3578,7 +3578,7 @@ if ($action == 'create') {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status == Propal::STATUS_VALIDATED || $object->status == Propal::STATUS_SIGNED || getDolGlobalString('PROPOSAL_SENDBYEMAIL_FOR_ALL_STATUS')) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '', $usercansend);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '', $usercansend);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6604,14 +6604,14 @@ if ($action == 'create') {
|
||||
if (($object->status == Facture::STATUS_VALIDATED || $object->status == Facture::STATUS_CLOSED) || getDolGlobalString('FACTURE_SENDBYEMAIL_FOR_ALL_STATUS')) {
|
||||
if ($objectidnext) {
|
||||
$params['attr']['title'] = $langs->trans("DisabledBecauseReplacedInvoice");
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params);
|
||||
} else {
|
||||
if ($usercansend) {
|
||||
unset($params['attr']['title']);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=presend&mode=init#formmailbeforetitle', '', true, $params);
|
||||
} else {
|
||||
unset($params['attr']['title']);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6751,12 +6751,6 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
||||
unset($params['attr']['title']);
|
||||
print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
// Clone as predefined / Create template
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $object->status == 0 && $usercancreate) {
|
||||
if (!$objectidnext && count($object->lines) > 0) {
|
||||
@@ -6765,6 +6759,12 @@ if ($action == 'create') {
|
||||
}
|
||||
}
|
||||
|
||||
// Clone
|
||||
if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_PROFORMA) && $usercancreate) {
|
||||
unset($params['attr']['title']);
|
||||
print dolGetButtonAction($langs->trans('ToClone'), '', 'clone', $_SERVER['PHP_SELF'].'?facid='.$object->id.'&action=clone&object=invoice&token='.newToken(), '', true, $params);
|
||||
}
|
||||
|
||||
// Remove situation from cycle
|
||||
if (in_array($object->status, array(Facture::STATUS_CLOSED, Facture::STATUS_VALIDATED))
|
||||
&& $object->isSituationInvoice()
|
||||
|
||||
@@ -1538,10 +1538,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
if (empty($user->socid)) {
|
||||
if (!empty($object->email)) {
|
||||
$langs->load("mails");
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
} else {
|
||||
$langs->load("mails");
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2253,9 +2253,9 @@ if ($action == 'create') {
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status == $object::STATUS_VALIDATED) {
|
||||
if ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('contrat', 'creer'))) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle', '', true, $params);
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false, $params);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,13 +20,12 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/actions_printing.inc.php
|
||||
* \brief Code for actions print_file to print file with calling trigger
|
||||
* \ingroup core
|
||||
* \brief Code for actions print_file to print file (with calling trigger) when using the Direct Print feature.
|
||||
* The relative filename to print must be provided into GETPOST('file', 'alpha') parameter
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $db, $user, $conf, $langs must be defined
|
||||
// Filename to print must be provided into 'file' parameter
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
@@ -36,6 +35,7 @@
|
||||
*
|
||||
* @var string $action
|
||||
*/
|
||||
|
||||
// Print file
|
||||
if ($action == 'print_file' && $user->hasRight('printing', 'read')) {
|
||||
$langs->load("printing");
|
||||
@@ -44,7 +44,6 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) {
|
||||
$list = $objectprint->listDrivers($db, 10);
|
||||
$dirmodels = array_merge(array('/core/modules/printing/'), (array) $conf->modules_parts['printing']);
|
||||
if (!empty($list)) {
|
||||
$errorprint = 0;
|
||||
$printerfound = 0;
|
||||
foreach ($list as $driver) {
|
||||
foreach ($dirmodels as $dir) {
|
||||
@@ -80,7 +79,26 @@ if ($action == 'print_file' && $user->hasRight('printing', 'read')) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
$ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir);
|
||||
// Case of printing an invoice
|
||||
$filetoprint = GETPOST('file', 'alpha'); //Example FAYYMM-123/FAYYMM-123-xxx.pdf
|
||||
if ($module == 'facture') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$refinvoice = preg_replace('/[\\\/].*$/', '', $filetoprint);
|
||||
$tmpinvoice = new Facture($db);
|
||||
$tmpinvoice->fetch(0, $refinvoice);
|
||||
if ($tmpinvoice->id > 0) {
|
||||
// Increase counter by 1
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET pos_print_counter = pos_print_counter + 1";
|
||||
$sql .= " WHERE rowid = ".((int) $tmpinvoice->id);
|
||||
$db->query($sql);
|
||||
|
||||
//$tmpinvoice->pos_print_counter += 1;
|
||||
//$tmpinvoice->update($user, 1); // We disable trigger here because we already call the trigger $action = DOC_PREVIEW or DOC_DOWNLOAD just after
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$ret = $printer->printFile($filetoprint, $module, $subdir);
|
||||
if ($ret > 0) {
|
||||
//print '<pre>'.print_r($printer->errors, true).'</pre>';
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
|
||||
@@ -453,6 +453,13 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO
|
||||
|
||||
// Call of triggers (you should have set $triggersendname to execute trigger.
|
||||
if (!empty($triggersendname)) {
|
||||
if ($triggersendname == 'BILL_SENTBYMAIL' && $object instanceof Facture) {
|
||||
// If sending email for invoice, we increase the counter of invoices sent by email
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET email_sent_counter = email_sent_counter + 1";
|
||||
$sql .= " WHERE rowid = ".((int) $object->id);
|
||||
$db->query($sql);
|
||||
}
|
||||
|
||||
$result = $object->call_trigger($triggersendname, $user); // @phan-suppress-current-line PhanPossiblyUndeclaredGlobalVariable
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
|
||||
@@ -14072,7 +14072,7 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
|
||||
*
|
||||
* @param string $label Label or tooltip of button if $text is provided. Also used as tooltip in title attribute. Can be escaped HTML content or full simple text.
|
||||
* @param string $text Optional : short label on button. Can be escaped HTML content or full simple text.
|
||||
* @param string $actionType 'default', 'danger', 'email', 'clone', 'cancel', 'delete', ...
|
||||
* @param string $actionType 'default', 'edit', 'danger', 'email', 'clone', 'cancel', 'delete', ...
|
||||
* @param string|array<int,array{lang:string,enabled:bool,perm:bool|int,label:string,url:string,urlroot?:string,isDropDown?:int<0,1>}> $url Url for link or array of subbutton description
|
||||
* Example when an array is used:
|
||||
* $arrayforbutaction = array(
|
||||
@@ -14182,13 +14182,18 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
}
|
||||
|
||||
// Here, $url is a simple link
|
||||
|
||||
if (!empty($params['isDropdown']) || !empty($params['isDropDown'])) { // Use the dropdown-item style (not for action button)
|
||||
$class = "dropdown-item";
|
||||
} else {
|
||||
$class = 'butAction';
|
||||
if ($actionType == 'danger' || $actionType == 'delete') {
|
||||
$class = 'butActionDelete';
|
||||
if ($actionType == 'edit') {
|
||||
$class = 'butAction butActionEdit';
|
||||
} elseif ($actionType == 'email') {
|
||||
$class = 'butAction butActionEmail';
|
||||
} elseif ($actionType == 'clone') {
|
||||
$class = 'butAction butActionClone';
|
||||
} elseif ($actionType == 'danger' || $actionType == 'delete') {
|
||||
$class = 'butAction butActionDelete';
|
||||
if (!empty($url) && strpos($url, 'token=') === false) {
|
||||
$url .= '&token=' . newToken();
|
||||
}
|
||||
@@ -14322,7 +14327,7 @@ function dolGetButtonAction($label, $text = '', $actionType = 'default', $url =
|
||||
* using `dolPrintHTMLForAttributeUrl()`. All other attributes are escaped using
|
||||
* `dolPrintHTMLForAttribute()`.
|
||||
*
|
||||
* ⚠️ Note: Disabling escaping (via `$unescapedAttr`) is **not recommended** unless you
|
||||
* Note: Disabling escaping (via `$unescapedAttr`) is **not recommended** unless you
|
||||
* fully trust the input data, as it may lead to XSS vulnerabilities.
|
||||
*
|
||||
* Example:
|
||||
|
||||
@@ -419,7 +419,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_VALIDATE') {
|
||||
} elseif ($action == 'BILL_VALIDATE' && $object instanceof Facture) {
|
||||
'@phan-var-force Facture $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -436,7 +436,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_UNVALIDATE') {
|
||||
} elseif ($action == 'BILL_UNVALIDATE' && $object instanceof Facture) {
|
||||
'@phan-var-force Facture $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -453,7 +453,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SENTBYMAIL') {
|
||||
} elseif ($action == 'BILL_SENTBYMAIL' && $object instanceof Facture) {
|
||||
'@phan-var-force Facture $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -471,7 +471,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_PAYED') {
|
||||
} elseif ($action == 'BILL_PAYED' && $object instanceof Facture) {
|
||||
'@phan-var-force Facture $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -489,7 +489,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_CANCEL') {
|
||||
} elseif ($action == 'BILL_CANCEL' && $object instanceof Facture) {
|
||||
'@phan-var-force Facture $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -506,7 +506,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'FICHINTER_CREATE') {
|
||||
} elseif ($action == 'FICHINTER_CREATE' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -525,7 +525,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = array();
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_VALIDATE') {
|
||||
} elseif ($action == 'FICHINTER_VALIDATE' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -544,7 +544,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = array();
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_MODIFY') {
|
||||
} elseif ($action == 'FICHINTER_MODIFY' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -563,7 +563,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = array();
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_SENTBYMAIL') {
|
||||
} elseif ($action == 'FICHINTER_SENTBYMAIL' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -581,7 +581,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_BILLED') {
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_BILLED' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -598,7 +598,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED') {
|
||||
} elseif ($action == 'FICHINTER_CLASSIFY_UNBILLED' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -615,7 +615,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'FICHINTER_CLOSE') {
|
||||
} elseif ($action == 'FICHINTER_CLOSE' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -634,7 +634,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = array();
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'FICHINTER_DELETE') {
|
||||
} elseif ($action == 'FICHINTER_DELETE' && $object instanceof Fichinter) {
|
||||
'@phan-var-force Fichinter $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "interventions"));
|
||||
@@ -653,7 +653,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->sendtoid = array();
|
||||
$object->fk_element = 0;
|
||||
$object->elementtype = '';
|
||||
} elseif ($action == 'SHIPPING_VALIDATE') {
|
||||
} elseif ($action == 'SHIPPING_VALIDATE' && $object instanceof Expedition) {
|
||||
'@phan-var-force Expedition $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "sendings"));
|
||||
@@ -671,7 +671,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'SHIPPING_SENTBYMAIL') {
|
||||
} elseif ($action == 'SHIPPING_SENTBYMAIL' && $object instanceof Expedition) {
|
||||
'@phan-var-force Expedition $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "sendings"));
|
||||
@@ -689,7 +689,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'RECEPTION_VALIDATE') {
|
||||
} elseif ($action == 'RECEPTION_VALIDATE' && $object instanceof Reception) {
|
||||
'@phan-var-force Reception $object';
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
@@ -708,7 +708,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'RECEPTION_SENTBYMAIL') {
|
||||
} elseif ($action == 'RECEPTION_SENTBYMAIL' && $object instanceof Reception) {
|
||||
'@phan-var-force Reception $object';
|
||||
$langs->load("agenda");
|
||||
$langs->load("other");
|
||||
@@ -727,7 +727,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE') {
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_VALIDATE' && $object instanceof SupplierProposal) {
|
||||
'@phan-var-force SupplierProposal $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
@@ -744,7 +744,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL') {
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_SENTBYMAIL' && $object instanceof SupplierProposal) {
|
||||
'@phan-var-force SupplierProposal $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
@@ -762,7 +762,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED') {
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_SIGNED' && $object instanceof SupplierProposal) {
|
||||
'@phan-var-force SupplierProposal $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
@@ -779,7 +779,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED') {
|
||||
} elseif ($action == 'PROPOSAL_SUPPLIER_CLOSE_REFUSED' && $object instanceof SupplierProposal) {
|
||||
'@phan-var-force SupplierProposal $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "propal"));
|
||||
@@ -796,7 +796,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CREATE') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CREATE' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -813,7 +813,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_VALIDATE' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -830,7 +830,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_APPROVE') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_APPROVE' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -847,7 +847,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_REFUSE') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_REFUSE' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders", "main"));
|
||||
@@ -869,7 +869,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CANCEL') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CANCEL' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders", "main"));
|
||||
@@ -891,7 +891,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SUBMIT') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SUBMIT' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -913,7 +913,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_RECEIVE') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_RECEIVE' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -930,7 +930,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
@@ -948,7 +948,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED') {
|
||||
} elseif ($action == 'ORDER_SUPPLIER_CLASSIFY_BILLED' && $object instanceof CommandeFournisseur) {
|
||||
'@phan-var-force CommandeFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
@@ -965,7 +965,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_CREATE') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_CREATE' && $object instanceof FactureFournisseur) {
|
||||
'@phan-var-force FactureFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "orders"));
|
||||
@@ -982,7 +982,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_VALIDATE') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_VALIDATE' && $object instanceof FactureFournisseur) {
|
||||
'@phan-var-force FactureFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -999,7 +999,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_UNVALIDATE') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_UNVALIDATE' && $object instanceof FactureFournisseur) {
|
||||
'@phan-var-force FactureFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -1016,7 +1016,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL' && $object instanceof FactureFournisseur) {
|
||||
'@phan-var-force FactureFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills", "orders"));
|
||||
@@ -1034,7 +1034,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_PAYED') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_PAYED' && $object instanceof FactureFournisseur) {
|
||||
'@phan-var-force FactureFournisseur $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
@@ -1051,7 +1051,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'BILL_SUPPLIER_CANCELED') {
|
||||
} elseif ($action == 'BILL_SUPPLIER_CANCELED' && $object instanceof FactureFournisseur) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "bills"));
|
||||
|
||||
@@ -1067,7 +1067,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'MEMBER_VALIDATE') {
|
||||
} elseif ($action == 'MEMBER_VALIDATE' && $object instanceof Adherent) {
|
||||
'@phan-var-force Adherent $object';
|
||||
// Members
|
||||
// Load translation files required by the page
|
||||
@@ -1087,7 +1087,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'MEMBER_MODIFY') {
|
||||
} elseif ($action == 'MEMBER_MODIFY' && $object instanceof Adherent) {
|
||||
'@phan-var-force Adherent $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1106,7 +1106,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE') {
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_CREATE' && $object instanceof Subscription) {
|
||||
'@phan-var-force Subscription $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1138,7 +1138,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
if (isset($object->fk_soc) && $object->fk_soc > 0) {
|
||||
$object->socid = $object->fk_soc;
|
||||
}
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY') {
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_MODIFY' && $object instanceof Subscription) {
|
||||
'@phan-var-force Subscription $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1169,7 +1169,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
if (isset($object->fk_soc) && $object->fk_soc > 0) {
|
||||
$object->socid = $object->fk_soc;
|
||||
}
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE') {
|
||||
} elseif ($action == 'MEMBER_SUBSCRIPTION_DELETE' && $object instanceof Subscription) {
|
||||
'@phan-var-force Subscription $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1201,7 +1201,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
if (isset($object->fk_soc) && $object->fk_soc > 0) {
|
||||
$object->socid = $object->fk_soc;
|
||||
}
|
||||
} elseif ($action == 'MEMBER_RESILIATE') {
|
||||
} elseif ($action == 'MEMBER_RESILIATE' && $object instanceof Adherent) {
|
||||
'@phan-var-force Adherent $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1220,7 +1220,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'MEMBER_DELETE') {
|
||||
} elseif ($action == 'MEMBER_DELETE' && $object instanceof Adherent) {
|
||||
'@phan-var-force Adherent $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1239,7 +1239,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'MEMBER_EXCLUDE') {
|
||||
} elseif ($action == 'MEMBER_EXCLUDE' && $object instanceof Adherent) {
|
||||
'@phan-var-force Adherent $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "members"));
|
||||
@@ -1258,7 +1258,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_CREATE') {
|
||||
} elseif ($action == 'PROJECT_CREATE' && $object instanceof Project) {
|
||||
'@phan-var-force Project $object';
|
||||
// Projects
|
||||
// Load translation files required by the page
|
||||
@@ -1277,7 +1277,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_VALIDATE') {
|
||||
} elseif ($action == 'PROJECT_VALIDATE' && $object instanceof Project) {
|
||||
'@phan-var-force Project $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1295,7 +1295,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_MODIFY') {
|
||||
} elseif ($action == 'PROJECT_MODIFY' && $object instanceof Project) {
|
||||
'@phan-var-force Project $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1317,7 +1317,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_SENTBYMAIL') {
|
||||
} elseif ($action == 'PROJECT_SENTBYMAIL' && $object instanceof Project) {
|
||||
'@phan-var-force Project $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1335,7 +1335,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
|
||||
// Parameters $object->sendtoid defined by caller
|
||||
//$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_DELETE') {
|
||||
} elseif ($action == 'PROJECT_DELETE' && $object instanceof Project) {
|
||||
'@phan-var-force Project $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1346,7 +1346,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
$object->actionmsg = $langs->transnoentities("ProjectDeletedInDolibarr", $object->ref);
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'PROJECT_CLOSE') {
|
||||
} elseif ($action == 'PROJECT_CLOSE' && $object instanceof Project) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -1362,7 +1362,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'TASK_CREATE') {
|
||||
} elseif ($action == 'TASK_CREATE' && $object instanceof Task) {
|
||||
'@phan-var-force Task $object';
|
||||
// Project tasks
|
||||
// Load translation files required by the page
|
||||
@@ -1381,7 +1381,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'TASK_MODIFY') {
|
||||
} elseif ($action == 'TASK_MODIFY' && $object instanceof Task) {
|
||||
'@phan-var-force Task $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1399,7 +1399,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'TASK_DELETE') {
|
||||
} elseif ($action == 'TASK_DELETE' && $object instanceof Task) {
|
||||
'@phan-var-force Task $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
@@ -1417,7 +1417,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
|
||||
}
|
||||
|
||||
$object->sendtoid = array();
|
||||
} elseif ($action == 'TICKET_ASSIGNED') {
|
||||
} elseif ($action == 'TICKET_ASSIGNED' && $object instanceof Ticket) {
|
||||
'@phan-var-force Ticket $object';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("agenda", "other", "projects"));
|
||||
|
||||
@@ -693,7 +693,7 @@ if ($action == 'create') {
|
||||
}
|
||||
if ($user->hasRight('expedition', 'delivery', 'supprimer') && $action != 'presend') {
|
||||
if ($object->status == Delivery::STATUS_VALIDATED && $action != 'presend' && $expedition->status == Expedition::STATUS_VALIDATED) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||
}
|
||||
if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION')) {
|
||||
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&expid='.$object->origin_id.'&action=delete&token='.newToken().'&backtopage='.urlencode(DOL_URL_ROOT.'/expedition/card.php?id='.$object->origin_id), '');
|
||||
|
||||
@@ -610,7 +610,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.$withProjectUrl.'&action=edit&token='.newToken(), '', $permissiontoadd);
|
||||
|
||||
@@ -669,7 +669,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.(is_object($confOrBooth) && !empty($confOrBooth->id) ? '&conforboothid='.$confOrBooth->id : '').(!empty($projectstatic->id) ? '&fk_project='.$projectstatic->id : '').'&action=edit&token='.newToken(), '', $permissiontoadd);
|
||||
|
||||
|
||||
@@ -3726,9 +3726,9 @@ if ($action == 'create' && $usercancreate) {
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status > 0) {
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('expedition', 'shipping_advance', 'send')) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?action=presend&token=' . newToken() . '&id=' . $object->id . '&mode=init#formmailbeforetitle', '');
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER['PHP_SELF'] . '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER['PHP_SELF'] . '#', '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2808,7 +2808,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'editline') {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status > ExpenseReport::STATUS_DRAFT) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1897,9 +1897,9 @@ if ($action == 'create') {
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status > Fichinter::STATUS_DRAFT) {
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || $user->hasRight('ficheinter', 'ficheinter_advance', 'send')) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2654,7 +2654,7 @@ if ($action == 'create') {
|
||||
if (empty($user->socid)) {
|
||||
if (in_array($object->status, array(CommandeFournisseur::STATUS_ACCEPTED, 3, 4, 5)) || getDolGlobalString('SUPPLIER_ORDER_SENDBYEMAIL_FOR_ALL_STATUS')) {
|
||||
if ($usercanorder) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4214,9 +4214,9 @@ if ($action == 'create') {
|
||||
if (empty($user->socid)) {
|
||||
if (($object->status == FactureFournisseur::STATUS_VALIDATED || $object->status == FactureFournisseur::STATUS_CLOSED)) {
|
||||
if ($usercansend) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,9 +369,9 @@ if ($result > 0) {
|
||||
if ($user->socid == 0 && $action != 'presend') {
|
||||
$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight("fournisseur", "supplier_invoice_advance", "send")));
|
||||
if ($usercansend) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -466,7 +466,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -481,7 +481,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
//if (empty($user->socid)) {
|
||||
//print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle');
|
||||
//print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle');
|
||||
//}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -46,6 +46,8 @@ SuppliersCategoryShort=Vendors tag/category
|
||||
CustomersCategoryShort=Customers tag/category
|
||||
ProductsCategoryShort=Products tag/category
|
||||
MembersCategoryShort=Members tag/category
|
||||
UsersCategoryShort=Users tag/category
|
||||
ProjectsCategoryShort=Projects tag/category
|
||||
SuppliersCategoriesShort=Vendors tags/categories
|
||||
CustomersCategoriesShort=Customers tags/categories
|
||||
ProspectsCategoriesShort=Prospects tags/categories
|
||||
|
||||
@@ -3680,7 +3680,9 @@ if (!function_exists("llxFooter")) {
|
||||
print '<script src="'.DOL_URL_ROOT.'/core/js/lib_foot.js.php?lang='.$langs->defaultlang . '&' . $ext .'"></script>'."\n";
|
||||
}
|
||||
|
||||
// JS wrapper to add log when clicking on download or preview
|
||||
// JS wrapper to add an unalterable log when clicking on Download or Preview
|
||||
// This is done on customer invoices only.
|
||||
// This add a log and increase the pos_print_counter too (done by block-add.php).
|
||||
if (isModEnabled('blockedlog') && is_object($object) && !empty($object->id) && $object->id > 0) {
|
||||
if (in_array($object->element, array('facture')) && $object->statut > 0) { // Restrict for the moment to element 'facture'
|
||||
print "\n<!-- JS CODE TO ENABLE log when making a download or a preview of a document -->\n";
|
||||
@@ -3691,9 +3693,9 @@ if (!function_exists("llxFooter")) {
|
||||
console.log("Call /blockedlog/ajax/block-add on a.documentpreview");
|
||||
$.post('<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
|
||||
, {
|
||||
id:<?php echo $object->id; ?>
|
||||
, element:'<?php echo dol_escape_js($object->element) ?>'
|
||||
, action:'DOC_PREVIEW'
|
||||
id: <?php echo $object->id; ?>
|
||||
, element: '<?php echo dol_escape_js($object->element) ?>'
|
||||
, action: 'DOC_PREVIEW'
|
||||
, token: '<?php echo currentToken(); ?>'
|
||||
}
|
||||
);
|
||||
@@ -3702,9 +3704,9 @@ if (!function_exists("llxFooter")) {
|
||||
console.log("Call /blockedlog/ajax/block-add a.documentdownload");
|
||||
$.post('<?php echo DOL_URL_ROOT."/blockedlog/ajax/block-add.php" ?>'
|
||||
, {
|
||||
id:<?php echo $object->id; ?>
|
||||
, element:'<?php echo dol_escape_js($object->element) ?>'
|
||||
, action:'DOC_DOWNLOAD'
|
||||
id: <?php echo $object->id; ?>
|
||||
, element: '<?php echo dol_escape_js($object->element) ?>'
|
||||
, action: 'DOC_DOWNLOAD'
|
||||
, token: '<?php echo currentToken(); ?>'
|
||||
}
|
||||
);
|
||||
|
||||
@@ -536,7 +536,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -552,7 +552,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
|
||||
|
||||
@@ -3107,7 +3107,7 @@ if ($action != 'create' && $action != 'edit') {
|
||||
}
|
||||
|
||||
//Send
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init&token=' . newToken() . '#formmailbeforetitle');
|
||||
|
||||
if (!isset($hookmanager->resArray['no_button_copy']) || $hookmanager->resArray['no_button_copy'] != 1) {
|
||||
if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
|
||||
|
||||
@@ -398,7 +398,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -1018,7 +1018,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -1666,7 +1666,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status != Project::STATUS_CLOSED) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend&token='.newToken().'&id='.$object->id.'&mode=init#formmailbeforetitle', '');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
@@ -47,14 +54,6 @@ if (isModEnabled('category')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('projects', 'companies', 'commercial'));
|
||||
if (isModEnabled('eventorganization') && $conf->eventorganization->enabled) {
|
||||
@@ -124,6 +123,15 @@ $search_price_registration = GETPOST("search_price_registration", 'alpha');
|
||||
$search_price_booth = GETPOST("search_price_booth", 'alpha');
|
||||
$search_login = GETPOST('search_login', 'alpha');
|
||||
$search_import_key = GETPOST('search_import_key', 'alpha');
|
||||
|
||||
$searchCategoryUserOperator = 0;
|
||||
if (GETPOSTISSET('formfilteraction')) {
|
||||
$searchCategoryUserOperator = GETPOSTINT('search_category_user_operator');
|
||||
} elseif (getDolGlobalString('MAIN_SEARCH_CAT_USER_OR_BY_DEFAULT')) {
|
||||
$searchCategoryUserOperator = getDolGlobalString('MAIN_SEARCH_CAT_USER_OR_BY_DEFAULT');
|
||||
}
|
||||
$searchCategoryUserList = GETPOST('search_category_user_list', 'array:int');
|
||||
|
||||
$searchCategoryCustomerOperator = 0;
|
||||
if (GETPOSTISSET('formfilteraction')) {
|
||||
$searchCategoryCustomerOperator = GETPOSTINT('search_category_customer_operator');
|
||||
@@ -131,6 +139,7 @@ if (GETPOSTISSET('formfilteraction')) {
|
||||
$searchCategoryCustomerOperator = getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT');
|
||||
}
|
||||
$searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array:int');
|
||||
|
||||
$search_omitChildren = 0;
|
||||
if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
|
||||
$search_omitChildren = GETPOST('search_omitChildren', 'alpha') == 'on' ? 1 : 0;
|
||||
@@ -187,9 +196,11 @@ $search_date_modif_endday = GETPOSTINT('search_date_modif_endday');
|
||||
$search_date_modif_end = GETPOSTDATE('search_date_modif_end', 'end'); // Use tzserver
|
||||
|
||||
$search_category_array = array();
|
||||
$search_category_user_array = array();
|
||||
|
||||
if (isModEnabled('category')) {
|
||||
$search_category_array = GETPOST("search_category_".Categorie::TYPE_PROJECT."_list", "array");
|
||||
$search_category_user_array = GETPOST("search_category_".Categorie::TYPE_USER."_list", "array");
|
||||
}
|
||||
|
||||
if (GETPOSTISARRAY('search_status') || GETPOST('search_status_multiselect')) {
|
||||
@@ -473,6 +484,7 @@ if (empty($reshook)) {
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
$search_category_array = array();
|
||||
$search_category_user_array = array();
|
||||
}
|
||||
|
||||
|
||||
@@ -806,7 +818,38 @@ if (getDolGlobalInt('PROJECT_ENABLE_SUB_PROJECT')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Search for tag/category ($searchCategoryProjectList is an array of ID)
|
||||
// Search for tag/category of User ($searchCategoryUserList is an array of ID)
|
||||
$searchCategoryUserSqlList = $search_category_user_array;
|
||||
$searchCategoryUserOperator = 0;
|
||||
if (!empty($searchCategoryUserList)) {
|
||||
$searchCategoryUserSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryUserList as $searchCategoryUser) {
|
||||
if (intval($searchCategoryUser) == -2) {
|
||||
$searchCategoryUserSqlList[] = "NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user)";
|
||||
} elseif (intval($searchCategoryUser) > 0) {
|
||||
if ($searchCategoryUserOperator == 0) {
|
||||
$searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_User AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryUserOperator == 1) {
|
||||
if (!empty($searchCategoryUserSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryUserSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryUserSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryUserSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search for tag/category or Project ($searchCategoryProjectList is an array of ID)
|
||||
$searchCategoryProjectList = $search_category_array;
|
||||
$searchCategoryProjectOperator = 0;
|
||||
if (!empty($searchCategoryProjectList)) {
|
||||
@@ -836,6 +879,9 @@ if (!empty($searchCategoryProjectList)) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search for tag/category of Customer Third party ($searchCategoryCustomerList is an array of ID)
|
||||
/*
|
||||
$searchCategoryCustomerSqlList = array();
|
||||
if ($searchCategoryCustomerOperator == 1) {
|
||||
$existsCategoryCustomerList = array();
|
||||
@@ -880,6 +926,8 @@ if ($searchCategoryCustomerOperator == 1) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
@@ -1086,11 +1134,21 @@ if ($search_date_modif_endday) {
|
||||
if ($search_date_modif_end) {
|
||||
$param .= '&search_date_modif_end=' . urlencode((string) $search_date_modif_end);
|
||||
}
|
||||
if (!empty($search_category_user_array)) {
|
||||
foreach ($search_category_user_array as $tmpval) {
|
||||
$param .= '&search_categegory_user_list[]='.urlencode($tmpval);
|
||||
}
|
||||
}
|
||||
if (!empty($search_category_array)) {
|
||||
foreach ($search_category_array as $tmpval) {
|
||||
$param .= '&search_categegory_project_list[]='.urlencode($tmpval);
|
||||
}
|
||||
}
|
||||
if (!empty($searchCategoryCustomerList)) {
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
$param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
|
||||
}
|
||||
}
|
||||
if ($search_id != '') {
|
||||
$param .= '&search_id='.urlencode($search_id);
|
||||
}
|
||||
@@ -1172,9 +1230,6 @@ if ($search_login) {
|
||||
if ($search_import_key) {
|
||||
$param .= '&search_import_key='.urlencode($search_import_key);
|
||||
}
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
$param .= "&search_category_customer_list[]=".urlencode($searchCategoryCustomer);
|
||||
}
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
|
||||
@@ -1281,6 +1336,14 @@ if (!$user->hasRight('user', 'user', 'lire')) {
|
||||
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_project_user ? $search_project_user : '', 'search_project_user', $tmptitle, null, 0, $includeonly, '', '0', 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx');
|
||||
$moreforfilter .= '</div>';
|
||||
|
||||
// Filter on user categories
|
||||
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
|
||||
$langs->load("categories");
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_USER, $search_category_user_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("UsersCategoryShort"));
|
||||
}
|
||||
|
||||
|
||||
$moreforfilter .= '<div class="divsearchfield">';
|
||||
$tmptitle = $langs->trans('ProjectsWithThisContact');
|
||||
$moreforfilter .= img_picto($tmptitle, 'contact', 'class="pictofixedwidth"').$form->select_contact(0, $search_project_contact ? $search_project_contact : '', 'search_project_contact', $tmptitle, '', '', 0, 'maxwidth300 widthcentpercentminusx');
|
||||
@@ -1296,16 +1359,16 @@ if ($user->hasRight('user', 'user', 'lire')) {
|
||||
$moreforfilter .= '</div>';
|
||||
}
|
||||
|
||||
// Filter on categories
|
||||
// Filter on project categories
|
||||
if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp minwidth300 widthcentpercentminusx');
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth200imp minwidth200 widthcentpercentminusx', -1, 1, 1, $langs->trans("ProjectsCategoryShort"));
|
||||
}
|
||||
|
||||
// Filter on customer categories
|
||||
if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST') && isModEnabled("category") && $user->hasRight('categorie', 'lire')) {
|
||||
$formcategory = new FormCategory($db);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth300', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
|
||||
$moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_CUSTOMER, $searchCategoryCustomerList, 'minwidth200imp minwidth200 widthcentpercentminusx', $searchCategoryCustomerList ? $searchCategoryCustomerList : 0);
|
||||
}
|
||||
|
||||
// alert on late date
|
||||
|
||||
@@ -555,7 +555,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -403,7 +403,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -2073,9 +2073,9 @@ if ($action == 'create') {
|
||||
if (empty($user->socid)) {
|
||||
if ($object->status == SupplierProposal::STATUS_VALIDATED || $object->status == SupplierProposal::STATUS_SIGNED) {
|
||||
if ($usercansend) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER["PHP_SELF"], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init'], true).'#formmailbeforetitle', '');
|
||||
} else {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', '#', '', false);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', '#', '', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,9 +111,12 @@ if ($facid > 0 && !GETPOST('specimen')) {
|
||||
}
|
||||
print '<body>';
|
||||
|
||||
|
||||
// Record entry in blocked logs each time we print a receipt
|
||||
//
|
||||
// This will also increase the counter of printings of the receipt
|
||||
// DOL_DOCUMENT_ROOT.'/blockedlog/ajax/block-add.php?id='.$object->id.'&element='.$object->element.'&action=DOC_PREVIEW&token='.newToken();
|
||||
|
||||
print "
|
||||
<script>
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
@@ -247,9 +247,7 @@ span.butActionNewRefused>span.fa, span.butActionNewRefused>span.fa:hover
|
||||
|
||||
.butActionDelete, .butActionDelete:link, .butActionDelete:visited, .butActionDelete:hover, .butActionDelete:active, .buttonDelete {
|
||||
background: var(--butactiondeletebg);
|
||||
/* border: 1px solid #633; */
|
||||
color: #633;
|
||||
/* vertical-align: middle; */
|
||||
color: #633 !important;
|
||||
}
|
||||
|
||||
.butActionDelete:hover {
|
||||
|
||||
@@ -302,9 +302,10 @@ a.top-menu-dropdown-link {
|
||||
text-align: start;
|
||||
}
|
||||
|
||||
|
||||
.dropdown-menu > .user-body {
|
||||
padding: 15px;
|
||||
}
|
||||
.dropdown-menu > .user-body, .dropdown-body{
|
||||
/* padding: 15px; */
|
||||
border-bottom: 1px solid #f4f4f4;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
white-space: normal;
|
||||
|
||||
@@ -1980,6 +1980,7 @@ select.flat.selectlimit {
|
||||
.amountpaymentcomplete {
|
||||
color: var(--amountpaymentcomplete);
|
||||
font-weight: bold;
|
||||
font-size: 1.7em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.amountpaymentcompletenoresize {
|
||||
@@ -1989,6 +1990,7 @@ select.flat.selectlimit {
|
||||
.amountremaintopay {
|
||||
color: var(--amountremaintopaycolor);
|
||||
font-weight: bold;
|
||||
font-size: 1.7em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.amountremaintopaynoresize {
|
||||
@@ -1997,6 +1999,7 @@ select.flat.selectlimit {
|
||||
}
|
||||
.amountremaintopayback {
|
||||
font-weight: bold;
|
||||
font-size: 1.7em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.amountremaintopaybacknoresize {
|
||||
@@ -2005,7 +2008,7 @@ select.flat.selectlimit {
|
||||
.amountpaymentneutral {
|
||||
color: var(--amountremaintopaybackcolor);
|
||||
font-weight: bold;
|
||||
font-size: 1.4em;
|
||||
font-size: 1.7em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.amountpaymentneutralnoresize {
|
||||
@@ -2233,7 +2236,7 @@ tr.nobottom td {
|
||||
.maxwidth40 { max-width: 40px; }
|
||||
.maxwidth50 { max-width: 50px; }
|
||||
.maxwidth75 { max-width: 75px; }
|
||||
.maxwidthdate { max-width: 105px; }
|
||||
.maxwidthdate { max-width: 90px; }
|
||||
.maxwidth100 { max-width: 100px; }
|
||||
.maxwidth125 { max-width: 125px; }
|
||||
.maxwidth150 { max-width: 150px; }
|
||||
@@ -4246,7 +4249,7 @@ div.divButAction {
|
||||
margin-bottom: 1.4em;
|
||||
}
|
||||
div.tabsAction {
|
||||
margin: 20px 0em 20px 0em;
|
||||
margin: 30px 0em 30px 0em;
|
||||
padding: 0em 0em;
|
||||
text-align: right;
|
||||
}
|
||||
@@ -4557,7 +4560,7 @@ table.nointerlines tr:not(:last-child) td {
|
||||
|
||||
/* Management of border radius */
|
||||
<?php $borderradius = getDolGlobalString('THEME_ELDY_USEBORDERONTABLE') ? getDolGlobalInt('THEME_ELDY_BORDER_RADIUS', 6) : 0; ?>
|
||||
table.noborder:not(.cal_month, .paymenttable) {
|
||||
table.noborder:not(.cal_month, .paymenttable, .margintable) {
|
||||
border-radius: <?php echo $borderradius; ?>px;
|
||||
}
|
||||
table.noborder.cal_month {
|
||||
|
||||
@@ -1491,7 +1491,7 @@ if ($action == 'create' || $action == 'presend') {
|
||||
if (empty($reshook)) {
|
||||
// Email
|
||||
if (isset($object->status) && $object->status < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', '');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?action=presend_addmessage&send_email=1&private_message=0&mode=init&token='.newToken().'&track_id='.$object->track_id.'#formmailbeforetitle', '');
|
||||
}
|
||||
|
||||
// Show link to add a message (if read and not closed)
|
||||
|
||||
@@ -2177,7 +2177,7 @@ if ($action == 'create' || $action == 'adduserldap') {
|
||||
$langs->load("mails");
|
||||
$params['attr']['title'] = $langs->trans('NoEMail');
|
||||
}
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init']) . '#formmailbeforetitle', '', $canSendMail, $params);
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', dolBuildUrl($_SERVER['PHP_SELF'], ['id' => $object->id, 'action' => 'presend', 'mode' => 'init']) . '#formmailbeforetitle', '', $canSendMail, $params);
|
||||
}
|
||||
|
||||
if ($permissiontoedit && (!isModEnabled('multicompany') || !$user->entity || ($object->entity == $conf->entity) || (getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $object->entity == 1))) {
|
||||
|
||||
@@ -150,452 +150,531 @@ $title = $object->name." - ".$langs->trans('Permissions');
|
||||
$help_url = '';
|
||||
llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-user page-group_perms');
|
||||
|
||||
if ($object->id > 0) {
|
||||
$head = group_prepare_head($object);
|
||||
$title = $langs->trans("Group");
|
||||
print dol_get_fiche_head($head, 'rights', $title, -1, 'group');
|
||||
if ($object->id <= 0) {
|
||||
accessforbidden('Group not found');
|
||||
}
|
||||
|
||||
// Charge les modules soumis a permissions
|
||||
$modules = array();
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
$head = group_prepare_head($object);
|
||||
$title = $langs->trans("Group");
|
||||
print dol_get_fiche_head($head, 'rights', $title, -1, 'group');
|
||||
|
||||
$db->begin();
|
||||
// Charge les modules soumis a permissions
|
||||
$modules = array();
|
||||
$modulesdir = dolGetModulesDirs();
|
||||
|
||||
foreach ($modulesdir as $dir) {
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
$db->begin();
|
||||
|
||||
if ($modName) {
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
'@phan-var-force DolibarrModules $objMod';
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
|
||||
foreach ($objMod->langfiles as $domain) {
|
||||
$langs->load($domain);
|
||||
}
|
||||
}
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class) {
|
||||
$ret = $objMod->insert_permissions(0, $entity);
|
||||
$modules[$objMod->rights_class] = $objMod;
|
||||
foreach ($modulesdir as $dir) {
|
||||
$handle = @opendir(dol_osencode($dir));
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
|
||||
if ($modName) {
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
'@phan-var-force DolibarrModules $objMod';
|
||||
/** @var DolibarrModules $objMod */
|
||||
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
|
||||
foreach ($objMod->langfiles as $domain) {
|
||||
$langs->load($domain);
|
||||
}
|
||||
}
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class) {
|
||||
$objMod->insert_permissions(0, $entity);
|
||||
$modules[$objMod->rights_class] = $objMod;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->commit();
|
||||
$db->commit();
|
||||
|
||||
// Read permissions of group
|
||||
$permsgroupbyentity = array();
|
||||
// Read permissions of group
|
||||
$permsgroupbyentity = array();
|
||||
|
||||
$sql = "SELECT DISTINCT r.id, r.libelle, r.module, gr.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr";
|
||||
$sql .= " WHERE gr.fk_id = r.id";
|
||||
$sql .= " AND gr.entity = ".((int) $entity);
|
||||
$sql .= " AND gr.fk_usergroup = ".((int) $object->id);
|
||||
$sql = "SELECT DISTINCT r.id, r.libelle, r.module, r.perms, r.subperms, r.module_position, r.family, r.family_position, gr.entity";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."usergroup_rights as gr";
|
||||
$sql .= " WHERE gr.fk_id = r.id";
|
||||
$sql .= " AND gr.entity = ".((int) $entity);
|
||||
$sql .= " AND gr.fk_usergroup = ".((int) $object->id);
|
||||
|
||||
dol_syslog("get user perms", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
if (!isset($permsgroupbyentity[$obj->entity])) {
|
||||
$permsgroupbyentity[$obj->entity] = array();
|
||||
}
|
||||
array_push($permsgroupbyentity[$obj->entity], $obj->id);
|
||||
$i++;
|
||||
dol_syslog("get user perms", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
if (!isset($permsgroupbyentity[$obj->entity])) {
|
||||
$permsgroupbyentity[$obj->entity] = array();
|
||||
}
|
||||
$db->free($result);
|
||||
array_push($permsgroupbyentity[$obj->entity], $obj->id);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
/*
|
||||
* Part to add/remove permissions
|
||||
*/
|
||||
|
||||
$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->hasRight("user", "user", "read") || $user->admin);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
|
||||
print '<td class="valeur">'.dol_escape_htmltag($object->name);
|
||||
if (empty($object->entity)) {
|
||||
print img_picto($langs->trans("GlobalGroup"), 'superadmin');
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$mc->getInfo($object->entity);
|
||||
print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
|
||||
print '<td class="valeur">'.dol_escape_htmltag($mc->label);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
unset($object->fields['nom']); // Name already displayed in banner
|
||||
unset($object->fields['color']);
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = '';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
print '<tr><td>'.$langs->trans("ColorGroup").'</td>';
|
||||
print '<td>';
|
||||
print $formother->showColor($object->color, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
|
||||
if ($user->admin) {
|
||||
$s = $langs->trans("WarningOnlyPermissionOfActivatedModules")." ".$langs->trans("YouCanEnableModulesFrom");
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$s .= '<br>';
|
||||
$s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
|
||||
$s .= $langs->trans("YouAreUsingTheAdvancedPermissionsMode");
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
$s .= '<br>';
|
||||
$s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
|
||||
$s .= $langs->trans("YouAreUsingTheSimplePermissionsMode");
|
||||
}
|
||||
|
||||
/*
|
||||
* Part to add/remove permissions
|
||||
*/
|
||||
|
||||
$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->hasRight("user", "user", "read") || $user->admin);
|
||||
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent tableforfield">';
|
||||
|
||||
// Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner)
|
||||
if (isModEnabled('multicompany')) {
|
||||
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
|
||||
print '<td class="valeur">'.dol_escape_htmltag($object->name);
|
||||
if (empty($object->entity)) {
|
||||
print img_picto($langs->trans("GlobalGroup"), 'superadmin');
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
// Multicompany
|
||||
if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
|
||||
$mc->getInfo($object->entity);
|
||||
print "<tr>".'<td class="titlefield">'.$langs->trans("Entity").'</td>';
|
||||
print '<td class="valeur">'.dol_escape_htmltag($mc->label);
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
unset($object->fields['nom']); // Name already displayed in banner
|
||||
unset($object->fields['color']);
|
||||
|
||||
// Common attributes
|
||||
$keyforbreak = '';
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
|
||||
|
||||
print '<tr><td>'.$langs->trans("ColorGroup").'</td>';
|
||||
print '<td>';
|
||||
print $formother->showColor($object->color, '');
|
||||
print '</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div>';
|
||||
print info_admin($s);
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
if ($user->admin) {
|
||||
$s = $langs->trans("WarningOnlyPermissionOfActivatedModules")." ".$langs->trans("YouCanEnableModulesFrom");
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$s .= '<br>';
|
||||
$s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
|
||||
$s .= $langs->trans("YouAreUsingTheAdvancedPermissionsMode");
|
||||
} else {
|
||||
$s .= '<br>';
|
||||
$s .= img_picto($langs->trans('InfoAdmin'), 'info-circle').' ';
|
||||
$s .= $langs->trans("YouAreUsingTheSimplePermissionsMode");
|
||||
print "\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td></td>';
|
||||
print '<td class="right nowrap" colspan="2">';
|
||||
print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
|
||||
print ' | ';
|
||||
print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
// Get list of all permissions
|
||||
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault, r.family, r.family_position";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // We ignore permission "tous les tiers". Why ?
|
||||
$sql .= " AND r.entity = ".((int) $entity);
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
}
|
||||
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$familyinfo = array(
|
||||
'hr' => array('position' => '001', 'label' => $langs->trans("ModuleFamilyHr")),
|
||||
'crm' => array('position' => '006', 'label' => $langs->trans("ModuleFamilyCrm")),
|
||||
'srm' => array('position' => '007', 'label' => $langs->trans("ModuleFamilySrm")),
|
||||
'financial' => array('position' => '009', 'label' => $langs->trans("ModuleFamilyFinancial")),
|
||||
'products' => array('position' => '012', 'label' => $langs->trans("ModuleFamilyProducts")),
|
||||
'projects' => array('position' => '015', 'label' => $langs->trans("ModuleFamilyProjects")),
|
||||
'ecm' => array('position' => '018', 'label' => $langs->trans("ModuleFamilyECM")),
|
||||
'technic' => array('position' => '021', 'label' => $langs->trans("ModuleFamilyTechnic")),
|
||||
'portal' => array('position' => '040', 'label' => $langs->trans("ModuleFamilyPortal")),
|
||||
'interface' => array('position' => '050', 'label' => $langs->trans("ModuleFamilyInterface")),
|
||||
'base' => array('position' => '060', 'label' => $langs->trans("ModuleFamilyBase")),
|
||||
'other' => array('position' => '100', 'label' => $langs->trans("ModuleFamilyOther")),
|
||||
);
|
||||
|
||||
$arrayofpermission = array();
|
||||
$cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
|
||||
$cookietohidegrouparray = explode(',', $cookietohidegroup);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
//var_dump($cookietohidegrouparray);
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
if (empty($obj->family)) {
|
||||
$obj->family = 'other';
|
||||
}
|
||||
print info_admin($s);
|
||||
|
||||
print '<br>';
|
||||
if (empty($obj->family_position)) {
|
||||
$obj->family_position = $familyinfo[$obj->family]['position'];
|
||||
if ($obj->module_position < 100000) {
|
||||
$obj->module_position = intval($obj->module_position) + 100000;
|
||||
} else {
|
||||
$obj->module_position = intval($obj->module_position);
|
||||
}
|
||||
}
|
||||
|
||||
$obj->position = $obj->family_position.'_'.$obj->module_position.'_'.$obj->id;
|
||||
|
||||
$arrayofpermission[$i] = $obj;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
$arrayofpermission = dol_sort_array($arrayofpermission, 'position');
|
||||
|
||||
$j = 0;
|
||||
$oldmod = '';
|
||||
|
||||
foreach ($arrayofpermission as $i => $obj) {
|
||||
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
|
||||
if (empty($modules[$obj->module])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
// Special cases
|
||||
if (isModEnabled("reception")) {
|
||||
// The 2 permission in fournisseur modules has been replaced by permissions into reception module
|
||||
if ($obj->module == 'fournisseur' && $obj->perms == 'commande' && $obj->subperms == 'receptionner') {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
if ($obj->module == 'fournisseur' && $obj->perms == 'commande_advance' && $obj->subperms == 'check') {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."</a>";
|
||||
$objMod = $modules[$obj->module];
|
||||
|
||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||
$ishidden = 1;
|
||||
} else {
|
||||
$ishidden = 0;
|
||||
}
|
||||
$isexpanded = ! $ishidden;
|
||||
//var_dump("isexpanded=".$isexpanded);
|
||||
|
||||
$permsgroupbyentitypluszero = array();
|
||||
if (!empty($permsgroupbyentity[0])) {
|
||||
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
|
||||
}
|
||||
if (!empty($permsgroupbyentity[$entity])) {
|
||||
$permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
|
||||
}
|
||||
//var_dump($permsgroupbyentitypluszero);
|
||||
|
||||
// Break found, it's a new module to catch
|
||||
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
||||
$oldmod = $obj->module;
|
||||
|
||||
$j++;
|
||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||
$ishidden = 1;
|
||||
} else {
|
||||
$ishidden = 0;
|
||||
}
|
||||
$isexpanded = ! $ishidden;
|
||||
//var_dump('$obj->module='.$obj->module.' isexpanded='.$isexpanded);
|
||||
|
||||
// Break detected, we get objMod
|
||||
$objMod = $modules[$obj->module];
|
||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||
|
||||
// Show break line
|
||||
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"></a>';
|
||||
print '</td>';
|
||||
|
||||
// Permission and tick (2 columns)
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
|
||||
print ' / ';
|
||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
}
|
||||
// Description of permission (2 columns)
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
||||
print img_picto('', 'folder', 'class="marginright"');
|
||||
print '</div>';
|
||||
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
||||
print img_picto('', 'folder-open', 'class="marginright"');
|
||||
print '</div>';
|
||||
print '</td>'; //Add picto + / - when open en closed
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$permlabel = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && ($langs->trans("PermissionAdvanced".$obj->id) != "PermissionAdvanced".$obj->id) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != "Permission".$obj->id) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
|
||||
|
||||
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
|
||||
print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
|
||||
|
||||
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print '</td>';
|
||||
|
||||
// Permission and tick (2 columns)
|
||||
if (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
|
||||
print '<!-- permsgroupbyentitypluszero -->';
|
||||
if (in_array($obj->id, $permsgroupbyentitypluszero)) {
|
||||
// Own permission by group
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_remove($langs->trans("Remove"));
|
||||
print img_picto($langs->trans("Remove"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="center nowrap">';
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td>';
|
||||
} else {
|
||||
// Do not own permission
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_add($langs->trans("Add"));
|
||||
print img_picto($langs->trans("Add"), 'switch_off');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
} else {
|
||||
// Do not own permission
|
||||
print '<!-- do not own permission -->';
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_add($langs->trans("Add"));
|
||||
print img_picto($langs->trans("Add"), 'switch_off');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// Description of permission (1 or 2 columns)
|
||||
print '<td>';
|
||||
print $permlabel;
|
||||
$idtouse = $obj->id;
|
||||
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
||||
$idtouse = 122;
|
||||
}
|
||||
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
||||
}
|
||||
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
||||
}
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
if (preg_match('/_advance$/', $obj->perms)) {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Permission id
|
||||
if ($user->admin) {
|
||||
print '<td class="right">';
|
||||
$htmltext = $langs->trans("ID").': '.$obj->id;
|
||||
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
||||
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="center" width="24"></td>';
|
||||
print '<td class="right nowrap" colspan="2">';
|
||||
print '<a class="showallperms" title="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("ShowAllPerms")).'" href="#">'.img_picto('', 'folder-open', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("ExpandAll").'</span></a>';
|
||||
print ' | ';
|
||||
print '<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" alt="'.dol_escape_htmltag($langs->trans("HideAllPerms")).'" href="#">'.img_picto('', 'folder', 'class="paddingright"').'<span class="hideonsmartphone">'.$langs->trans("UndoExpandAll").'</span></a>';
|
||||
print '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r";
|
||||
$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous"
|
||||
$sql .= " AND r.entity = ".((int) $entity);
|
||||
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
|
||||
}
|
||||
$sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$j = 0;
|
||||
$oldmod = '';
|
||||
|
||||
$cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
|
||||
$cookietohidegrouparray = explode(',', $cookietohidegroup);
|
||||
|
||||
while ($i < $num) {
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// If line is for a module that does not exist anymore (absent of includes/module), we ignore it
|
||||
if (empty($modules[$obj->module])) {
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
$objMod = $modules[$obj->module];
|
||||
|
||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||
$ishidden = 1;
|
||||
} else {
|
||||
$ishidden = 0;
|
||||
}
|
||||
$isexpanded = ! $ishidden;
|
||||
|
||||
// Break found, it's a new module to catch
|
||||
if (isset($obj->module) && ($oldmod != $obj->module)) {
|
||||
$oldmod = $obj->module;
|
||||
|
||||
$j++;
|
||||
if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
|
||||
$ishidden = GETPOSTINT('forbreakperms_'.$obj->module);
|
||||
} elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
|
||||
$ishidden = 1;
|
||||
} else {
|
||||
$ishidden = 0;
|
||||
}
|
||||
$isexpanded = ! $ishidden;
|
||||
// Break detected, we get objMod
|
||||
$objMod = $modules[$obj->module];
|
||||
$picto = ($objMod->picto ? $objMod->picto : 'generic');
|
||||
|
||||
// Show break line
|
||||
print '<tr class="oddeven trforbreakperms trforbreaknobg" data-hide-perms="'.$obj->module.'" data-j="'.$j.'">';
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone tdoverflowmax200 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'" title="'.dol_escape_htmltag($objMod->getName()).'">';
|
||||
print '<input type="hidden" name="forbreakperms_'.$obj->module.'" id="idforbreakperms_'.$obj->module.'" css="cssforfieldishiden" data-j="'.$j.'" value="'.($isexpanded ? '0' : "1").'">';
|
||||
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"></a>';
|
||||
print '</td>';
|
||||
|
||||
// Permission and tick (2 columns)
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="tdforbreakperms tdforbreakpermsifnotempty center width50 nowraponall" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '<span class="permtohide_'.dol_escape_htmltag($obj->module).'" '.(!$isexpanded ? ' style="display:none"' : '').'>';
|
||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."</a>";
|
||||
print ' / ';
|
||||
print '<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."</a>";
|
||||
print '</span>';
|
||||
print '</td>';
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
}
|
||||
// Description of permission (2 columns)
|
||||
print '<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'"></td>';
|
||||
print '<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).'">';
|
||||
print '<div class="switchfolderperms inline-block marginrightonly folderperms_'.dol_escape_htmltag($obj->module).'"'.($isexpanded ? ' style="display:none;"' : '').'>';
|
||||
print img_picto('', 'folder', 'class="marginright"');
|
||||
print '</div>';
|
||||
print '<div class="switchfolderperms inline-block marginrightonly folderopenperms_'.dol_escape_htmltag($obj->module).'"'.(!$isexpanded ? ' style="display:none;"' : '').'>';
|
||||
print img_picto('', 'folder-open', 'class="marginright"');
|
||||
print '</div>';
|
||||
print '</td>'; //Add picto + / - when open en closed
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
|
||||
$permlabel = (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && ($langs->trans("PermissionAdvanced".$obj->id) != "PermissionAdvanced".$obj->id) ? $langs->trans("PermissionAdvanced".$obj->id) : (($langs->trans("Permission".$obj->id) != "Permission".$obj->id) ? $langs->trans("Permission".$obj->id) : $langs->trans($obj->label)));
|
||||
|
||||
print '<!-- '.$obj->module.'->'.$obj->perms.($obj->subperms ? '->'.$obj->subperms : '').' -->'."\n";
|
||||
print '<tr class="oddeven trtohide_'.$obj->module.'"'.(!$isexpanded ? ' style="display:none"' : '').'>';
|
||||
|
||||
|
||||
// Picto and label of module
|
||||
print '<td class="maxwidthonsmartphone">';
|
||||
print '</td>';
|
||||
|
||||
// Permission and tick (2 columns)
|
||||
if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
|
||||
if (in_array($obj->id, $permsgroupbyentity[$entity])) {
|
||||
// Own permission by group
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_remove($langs->trans("Remove"));
|
||||
print img_picto($langs->trans("Remove"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td class="center nowrap">';
|
||||
print img_picto($langs->trans("Active"), 'tick');
|
||||
print '</td>';
|
||||
} else {
|
||||
// Do not own permission
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_add($langs->trans("Add"));
|
||||
print img_picto($langs->trans("Add"), 'switch_off');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td></td>';
|
||||
}
|
||||
} else {
|
||||
// Do not own permission
|
||||
if ($permissiontoedit) {
|
||||
print '<td class="center nowrap">';
|
||||
print '<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=addrights&token='.newToken().'&entity='.$entity.'&rights='.$obj->id.'&confirm=yes&updatedmodulename='.$obj->module.'">';
|
||||
//print img_edit_add($langs->trans("Add"));
|
||||
print img_picto($langs->trans("Add"), 'switch_off');
|
||||
print '</a></td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
// Description of permission (1 column)
|
||||
print '<td>';
|
||||
print $permlabel;
|
||||
$idtouse = $obj->id;
|
||||
if (in_array($idtouse, array(121, 122, 125, 126))) { // Force message for the 3 permission on third parties
|
||||
$idtouse = 122;
|
||||
}
|
||||
if ($langs->trans("Permission".$idtouse.'b') != "Permission".$idtouse.'b') {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$idtouse.'b').'</span>';
|
||||
}
|
||||
if ($langs->trans("Permission".$obj->id.'c') != "Permission".$obj->id.'c') {
|
||||
print '<br><span class="opacitymedium">'.$langs->trans("Permission".$obj->id.'c').'</span>';
|
||||
}
|
||||
if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
|
||||
if (preg_match('/_advance$/', $obj->perms)) {
|
||||
print ' <span class="opacitymedium">('.$langs->trans("AdvancedModeOnly").')</span>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Permission id
|
||||
if ($user->admin) {
|
||||
print '<td class="right">';
|
||||
$htmltext = $langs->trans("ID").': '.$obj->id;
|
||||
$htmltext .= '<br>'.$langs->trans("Permission").': user->hasRight(\''.dol_escape_htmltag($obj->module).'\', \''.dol_escape_htmltag($obj->perms).'\''.($obj->subperms ? ', \''.dol_escape_htmltag($obj->subperms).'\'' : '').')';
|
||||
print $form->textwithpicto('', $htmltext, 1, 'help', 'inline-block marginrightonly');
|
||||
//print '<span class="opacitymedium">'.$obj->id.'</span>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td></td>';
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<script>';
|
||||
print '$(".tdforbreakperms:not(.alink)").on("click", function(){
|
||||
console.log("Click on tdforbreakperms");
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
j = $(this).data("j");
|
||||
if ($("#idforbreakperms_"+moduletohide).val() == 1) {
|
||||
console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines");
|
||||
$(".trtohide_"+moduletohide).show();
|
||||
$(".permtoshow_"+moduletohide).hide();
|
||||
$(".permtohide_"+moduletohide).show();
|
||||
$(".folderperms_"+moduletohide).hide();
|
||||
$(".folderopenperms_"+moduletohide).show();
|
||||
$("#idforbreakperms_"+moduletohide).val("0");
|
||||
} else if (! $(this).hasClass("tdforbreakpermsifnotempty")) {
|
||||
console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines");
|
||||
$(".trtohide_"+moduletohide).hide();
|
||||
$(".folderopenperms_"+moduletohide).hide();
|
||||
$(".folderperms_"+moduletohide).show();
|
||||
$(".permtoshow_"+moduletohide).show();
|
||||
$(".permtohide_"+moduletohide).hide();
|
||||
$("#idforbreakperms_"+moduletohide).val("1");
|
||||
}
|
||||
|
||||
// Now rebuild the value for cookie
|
||||
var hideuserperm="";
|
||||
$(".trforbreakperms").each(function(index) {
|
||||
//console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
|
||||
if ($("input[data-j="+(index+1)+"]").val() == 1) {
|
||||
hideuserperm=hideuserperm+","+(index+1);
|
||||
}
|
||||
});
|
||||
// set cookie by js
|
||||
date = new Date(); date.setTime(date.getTime()+(30*86400000));
|
||||
if (hideuserperm) {
|
||||
console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
|
||||
} else {
|
||||
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
|
||||
}
|
||||
});';
|
||||
print "\n";
|
||||
|
||||
// Button expand / collapse all
|
||||
print '$(".showallperms").on("click", function(){
|
||||
console.log("Click on showallperms");
|
||||
|
||||
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
|
||||
$(".tdforbreakperms").each( function(){
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
//console.log(moduletohide);
|
||||
if ($("#idforbreakperms_"+moduletohide).val() != 0) {
|
||||
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(".hideallperms").on("click", function(){
|
||||
console.log("Click on hideallperms");
|
||||
|
||||
$(".tdforbreakperms").each( function(){
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
//console.log(moduletohide);
|
||||
if ($("#idforbreakperms_"+moduletohide).val() != 1) {
|
||||
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
|
||||
}
|
||||
})
|
||||
});';
|
||||
print "\n";
|
||||
print '</script>';
|
||||
|
||||
print '<style>';
|
||||
print '.switchfolderperms{
|
||||
cursor: pointer;
|
||||
}';
|
||||
print '</style>';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '<script>';
|
||||
print '$(".tdforbreakperms:not(.alink)").on("click", function(){
|
||||
console.log("Click on tdforbreakperms");
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
j = $(this).data("j");
|
||||
if ($("#idforbreakperms_"+moduletohide).val() == 1) {
|
||||
console.log("idforbreakperms_"+moduletohide+" has value hidden=1, so we show all lines");
|
||||
$(".trtohide_"+moduletohide).show();
|
||||
$(".permtoshow_"+moduletohide).hide();
|
||||
$(".permtohide_"+moduletohide).show();
|
||||
$(".folderperms_"+moduletohide).hide();
|
||||
$(".folderopenperms_"+moduletohide).show();
|
||||
$("#idforbreakperms_"+moduletohide).val("0");
|
||||
} else if (! $(this).hasClass("tdforbreakpermsifnotempty")) {
|
||||
console.log("idforbreakperms_"+moduletohide+" has value hidden=0, so we hide all lines");
|
||||
$(".trtohide_"+moduletohide).hide();
|
||||
$(".folderopenperms_"+moduletohide).hide();
|
||||
$(".folderperms_"+moduletohide).show();
|
||||
$(".permtoshow_"+moduletohide).show();
|
||||
$(".permtohide_"+moduletohide).hide();
|
||||
$("#idforbreakperms_"+moduletohide).val("1");
|
||||
}
|
||||
|
||||
// Now rebuild the value for cookie
|
||||
var hideuserperm="";
|
||||
$(".trforbreakperms").each(function(index) {
|
||||
//console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
|
||||
if ($("input[data-j="+(index+1)+"]").val() == 1) {
|
||||
hideuserperm=hideuserperm+","+(index+1);
|
||||
}
|
||||
});
|
||||
// set cookie by js
|
||||
date = new Date(); date.setTime(date.getTime()+(30*86400000));
|
||||
if (hideuserperm) {
|
||||
console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
|
||||
} else {
|
||||
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
|
||||
}
|
||||
});';
|
||||
print "\n";
|
||||
|
||||
// Button expand / collapse all
|
||||
print '$(".showallperms").on("click", function(){
|
||||
console.log("Click on showallperms");
|
||||
|
||||
console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
|
||||
document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
|
||||
$(".tdforbreakperms").each( function(){
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
//console.log(moduletohide);
|
||||
if ($("#idforbreakperms_"+moduletohide).val() != 0) {
|
||||
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$(".hideallperms").on("click", function(){
|
||||
console.log("Click on hideallperms");
|
||||
|
||||
$(".tdforbreakperms").each( function(){
|
||||
moduletohide = $(this).data("hide-perms");
|
||||
//console.log(moduletohide);
|
||||
if ($("#idforbreakperms_"+moduletohide).val() != 1) {
|
||||
$(this).trigger("click"); // emulate the click, so the cooki will be resaved
|
||||
}
|
||||
})
|
||||
});';
|
||||
print "\n";
|
||||
print '</script>';
|
||||
|
||||
print '<style>';
|
||||
print '.switchfolderperms{
|
||||
cursor: pointer;
|
||||
}';
|
||||
print '</style>';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('insertExtraFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) {
|
||||
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
}
|
||||
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -473,7 +473,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
/*if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
|
||||
}*/
|
||||
|
||||
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
|
||||
|
||||
@@ -489,7 +489,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
/*// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Back to draft
|
||||
|
||||
@@ -411,7 +411,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if (empty($reshook)) {
|
||||
// Send
|
||||
if (empty($user->socid)) {
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
print dolGetButtonAction('', $langs->trans('SendMail'), 'email', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
|
||||
}
|
||||
|
||||
// Modify
|
||||
|
||||
Reference in New Issue
Block a user