commit
6059eaac3b
@ -195,6 +195,7 @@ if ($conf->use_javascript_ajax) {
|
||||
|
||||
$SommeA = 0;
|
||||
$SommeB = 0;
|
||||
|
||||
$SommeC = 0;
|
||||
$SommeD = 0;
|
||||
$total = 0;
|
||||
@ -218,7 +219,7 @@ if ($conf->use_javascript_ajax) {
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD));
|
||||
$dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA));
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php';
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
|
||||
$dolgraph = new DolGraph();
|
||||
@ -492,6 +493,8 @@ print '</tr>';
|
||||
print "</table>\n";
|
||||
print "</div>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
print $resultboxes['boxlistb'];
|
||||
|
||||
print '</div>'."\n";
|
||||
|
||||
1
htdocs/conf/.gitignore
vendored
1
htdocs/conf/.gitignore
vendored
@ -5,3 +5,4 @@
|
||||
/conf.php.pgsql
|
||||
/conf.php.sqlite
|
||||
/conf.php.utf8
|
||||
/conf.php.nov*
|
||||
|
||||
@ -41,6 +41,8 @@ class box_graph_invoices_permonth extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -41,6 +41,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
|
||||
/**
|
||||
* Class to manage the box
|
||||
*/
|
||||
class box_nb_ticket_last_x_days extends ModeleBoxes
|
||||
class box_graph_nb_ticket_last_x_days extends ModeleBoxes
|
||||
{
|
||||
|
||||
public $boxcode = "box_nb_ticket_last_x_days";
|
||||
@ -36,14 +36,12 @@ class box_nb_ticket_last_x_days extends ModeleBoxes
|
||||
public $boxlabel;
|
||||
public $depends = array("ticket");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
|
||||
public $param;
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param DoliDB $db Database handler
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
|
||||
/**
|
||||
* Class to manage the box
|
||||
*/
|
||||
class box_nb_tickets_type extends ModeleBoxes
|
||||
class box_graph_nb_tickets_type extends ModeleBoxes
|
||||
{
|
||||
|
||||
public $boxcode = "box_nb_tickets_type";
|
||||
@ -36,14 +36,13 @@ class box_nb_tickets_type extends ModeleBoxes
|
||||
public $boxlabel;
|
||||
public $depends = array("ticket");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
|
||||
public $param;
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param DoliDB $db Database handler
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
|
||||
/**
|
||||
* Class to manage the box
|
||||
*/
|
||||
class box_new_vs_close_ticket extends ModeleBoxes
|
||||
class box_graph_new_vs_close_ticket extends ModeleBoxes
|
||||
{
|
||||
|
||||
public $boxcode = "box_nb_tickets_type";
|
||||
@ -36,14 +36,13 @@ class box_new_vs_close_ticket extends ModeleBoxes
|
||||
public $boxlabel;
|
||||
public $depends = array("ticket");
|
||||
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
|
||||
public $param;
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param DoliDB $db Database handler
|
||||
|
||||
@ -41,6 +41,8 @@ class box_graph_orders_permonth extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -41,6 +41,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -44,6 +44,8 @@ class box_graph_product_distribution extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -41,6 +41,8 @@ class box_graph_propales_permonth extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
||||
@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
|
||||
/**
|
||||
* Class to manage the box
|
||||
*/
|
||||
class box_ticket_by_severity extends ModeleBoxes
|
||||
class box_graph_ticket_by_severity extends ModeleBoxes
|
||||
{
|
||||
|
||||
public $boxcode = "box_ticket_by_severity";
|
||||
@ -45,6 +45,9 @@ class box_ticket_by_severity extends ModeleBoxes
|
||||
public $info_box_head = array();
|
||||
public $info_box_contents = array();
|
||||
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param DoliDB $db Database handler
|
||||
|
||||
@ -109,6 +109,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box
|
||||
*/
|
||||
public $note;
|
||||
|
||||
/**
|
||||
* @var string Widget type ('graph' means the widget is a graph widget)
|
||||
*/
|
||||
public $widgettype = '';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -1150,7 +1150,7 @@ class FormOther
|
||||
if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title
|
||||
{
|
||||
jQuery.ajax({
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=0&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=1&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.',
|
||||
async: false
|
||||
});
|
||||
// We force reload to be sure to get all boxes into list
|
||||
|
||||
@ -620,8 +620,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
|
||||
}
|
||||
}
|
||||
} elseif (in_array($feature, $checksoc)) { // We check feature = checksoc
|
||||
if ($user->socid > 0) {
|
||||
// If external user: Check permission for external users
|
||||
// If external user: Check permission for external users
|
||||
if ($user->socid > 0 && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) {
|
||||
if ($user->socid <> $objectid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class modEventOrganization extends DolibarrModules
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'triggers' => 0,
|
||||
'triggers' => 1,
|
||||
// Set this to 1 if module has its own login method file (core/login)
|
||||
'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
|
||||
@ -64,7 +64,7 @@ class modProductBatch extends DolibarrModules
|
||||
// Data directories to create when module is enabled.
|
||||
$this->dirs = array();
|
||||
|
||||
// Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module.
|
||||
// Config pages. Put here list of php page, stored into /product/admin/ directory, to setup the module.
|
||||
$this->config_page_url = array("product_lot_extrafields.php@product");
|
||||
|
||||
// Dependencies
|
||||
|
||||
@ -1557,8 +1557,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE))
|
||||
{
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) {
|
||||
$this->cols['subprice']['status'] = true;
|
||||
}
|
||||
|
||||
@ -1612,8 +1611,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
'border-left' => true, // add left line separator
|
||||
);
|
||||
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN))
|
||||
{
|
||||
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) {
|
||||
$this->cols['totalexcltax']['status'] = true;
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Florian Henry <florian.henry@scopen.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php
|
||||
* \ingroup eventorganization
|
||||
* \brief Trigger file for Event Organization module
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class of triggered functions for agenda module
|
||||
*/
|
||||
class InterfaceEventOrganization extends DolibarrTriggers
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||
$this->family = "eventorganization";
|
||||
$this->description = "Triggers of this module to manage event organization triggers action";
|
||||
// 'development', 'experimental', 'dolibarr' or version
|
||||
$this->version = self::VERSION_DOLIBARR;
|
||||
$this->picto = 'action';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function called when a Dolibarrr business event is done.
|
||||
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
|
||||
*
|
||||
* Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database:
|
||||
* $object->actiontypecode (translation action code: AC_OTH, ...)
|
||||
* $object->actionmsg (note, long text)
|
||||
* $object->actionmsg2 (label, short text)
|
||||
* $object->sendtoid (id of contact or array of ids of contacts)
|
||||
* $object->socid (id of thirdparty)
|
||||
* $object->fk_project
|
||||
* $object->fk_element (ID of object to link action event to)
|
||||
* $object->elementtype (->element of object to link action to)
|
||||
* $object->module (if defined, elementtype in llx_actioncomm will be elementtype@module)
|
||||
*
|
||||
* @param string $action Event action code ('CONTRACT_MODIFY', 'RECRUITMENTCANDIDATURE_MODIFIY', ...)
|
||||
* @param Object $object Object
|
||||
* @param User $user Object user
|
||||
* @param Translate $langs Object langs
|
||||
* @param conf $conf Object conf
|
||||
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
|
||||
*/
|
||||
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||
{
|
||||
if (empty($conf->eventorganization->enabled)) {
|
||||
return 0; // Module not active, we do nothing
|
||||
}
|
||||
|
||||
$error=0;
|
||||
|
||||
// Actions
|
||||
if ($action == 'PROJECT_VALIDATE') {
|
||||
if (!empty($conf->global->EVENTORGANIZATION_TASK_LABEL) && !empty($object->usage_organize_event)) {
|
||||
$taskToDo = explode("\n", $conf->global->EVENTORGANIZATION_TASK_LABEL);
|
||||
if (is_array($taskToDo) && count($taskToDo)>0) {
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("eventorganization"));
|
||||
|
||||
$this->db->begin();
|
||||
foreach ($taskToDo as $taskLabel) {
|
||||
$task = new Task($this->db);
|
||||
$task->label = $taskLabel;
|
||||
$task->fk_project = $object->id;
|
||||
$defaultref = '';
|
||||
$obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON;
|
||||
if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) {
|
||||
require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php';
|
||||
$modTask = new $obj;
|
||||
$defaultref = $modTask->getNextValue($object->thirdparty, null);
|
||||
}
|
||||
if (is_numeric($defaultref) && $defaultref <= 0) {
|
||||
$defaultref = '';
|
||||
}
|
||||
$task->ref = $defaultref;
|
||||
$task->date_start = $object->date_start;
|
||||
$task->date_end = $object->date_end;
|
||||
$result = $task->create($user);
|
||||
if ($result < 0) {
|
||||
$this->errors=array_merge($this->errors, $task->errors);
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($error)) {
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
dol_syslog("InterfaceEventOrganization.class.php: ".implode(',', $this->errors), LOG_ERR);
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -510,7 +510,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer) {
|
||||
// Classify Billed
|
||||
$result = $object->setStatut(2);
|
||||
$result = $object->setStatut(Fichinter::STATUS_BILLED);
|
||||
if ($result > 0) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
@ -519,7 +519,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) {
|
||||
// Classify unbilled
|
||||
$result = $object->setStatut(1);
|
||||
$result = $object->setStatut(Fichinter::STATUS_VALIDATED);
|
||||
if ($result > 0) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
@ -528,7 +528,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
} elseif ($action == 'classifydone' && $user->rights->ficheinter->creer) {
|
||||
// Classify Done
|
||||
$result = $object->setStatut(3);
|
||||
$result = $object->setStatut(Fichinter::STATUS_CLOSED);
|
||||
if ($result > 0) {
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
|
||||
@ -1367,7 +1367,7 @@ BillsNumberingModule=Invoices and credit notes numbering model
|
||||
BillsPDFModules=Invoice documents models
|
||||
BillsPDFModulesAccordindToInvoiceType=Invoice documents models according to invoice type
|
||||
PaymentsPDFModules=Payment documents models
|
||||
ForceInvoiceDate=Force invoice date to validation date
|
||||
ForceInvoiceDate=Force invoice date to validation date (forcing is possible only the first time an invoice is validated)
|
||||
SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined on the invoice
|
||||
SuggestPaymentByRIBOnAccount=Suggest payment by withdrawal on account
|
||||
SuggestPaymentByChequeToAddress=Suggest payment by check to
|
||||
|
||||
@ -14,7 +14,7 @@ SuppliersCategoriesArea=Vendors tags/categories area
|
||||
CustomersCategoriesArea=Customers tags/categories area
|
||||
MembersCategoriesArea=Members tags/categories area
|
||||
ContactsCategoriesArea=Contacts tags/categories area
|
||||
AccountsCategoriesArea=Accounts tags/categories area
|
||||
AccountsCategoriesArea=Bank accounts tags/categories area
|
||||
ProjectsCategoriesArea=Projects tags/categories area
|
||||
UsersCategoriesArea=Users tags/categories area
|
||||
SubCats=Sub-categories
|
||||
|
||||
@ -77,6 +77,12 @@ class mymodulewidget1 extends ModeleBoxes
|
||||
*/
|
||||
public $info_box_contents = array();
|
||||
|
||||
/**
|
||||
* @var string Widget type ('graph' means the widget is a graph widget)
|
||||
*/
|
||||
public $widgettype = 'graph';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
||||
@ -248,7 +248,8 @@ class Mo extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if ($this->fk_product > 0) {
|
||||
// Check that product is not a kit/virtual product
|
||||
if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) and $this->fk_product > 0) {
|
||||
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
$tmpproduct = new Product($this->db);
|
||||
$tmpproduct->fetch($this->fk_product);
|
||||
@ -260,7 +261,6 @@ class Mo extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// Check that product is not a kit/virtual product
|
||||
if (!$error) {
|
||||
$idcreated = $this->createCommon($user, $notrigger);
|
||||
if ($idcreated <= 0) {
|
||||
|
||||
@ -1363,12 +1363,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
||||
// Accountancy_code_buy
|
||||
print '<tr><td>'.$langs->trans("ProductAccountancyBuyCode").'</td>';
|
||||
print '<td>';
|
||||
if ($type == 0) {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT);
|
||||
} else {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
if ($type == 0) {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT);
|
||||
} else {
|
||||
$accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT);
|
||||
}
|
||||
print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy_code_buy_intra
|
||||
|
||||
@ -61,6 +61,7 @@ $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday",
|
||||
$datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int'));
|
||||
$dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int'));
|
||||
$label = GETPOST('label');
|
||||
$fk_user = GETPOST('userid', 'int');
|
||||
|
||||
// Security check
|
||||
$socid = GETPOST("socid", "int");
|
||||
@ -107,7 +108,17 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == '
|
||||
$result = $object->set_paid($user);
|
||||
}
|
||||
|
||||
// Reopen
|
||||
if ($action == 'setfk_user' && $user->rights->salaries->write) {
|
||||
$result = $object->fetch($id);
|
||||
if ($result > 0) {
|
||||
$object->fk_user = $fk_user;
|
||||
$object->update($user);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'reopen' && $user->rights->salaries->write) {
|
||||
$result = $object->fetch($id);
|
||||
if ($object->paye) {
|
||||
@ -421,7 +432,7 @@ if ($action == 'create') {
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Employee
|
||||
print '<tr><td>';
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
$noactive = 0; // We keep active and unactive users
|
||||
print img_picto('', 'user', 'class="paddingrighonly"').$form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive);
|
||||
@ -448,7 +459,7 @@ if ($action == 'create') {
|
||||
// Amount
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).'</td><td>';
|
||||
print '<input name="amount" id="amount" class="minwidth100" value="'.GETPOST("amount").'">';
|
||||
print '<input name="amount" id="amount" class="minwidth75 maxwidth100" value="'.GETPOST("amount").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project
|
||||
@ -461,7 +472,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
// Comments
|
||||
print '<tr class="hide_if_no_auto_create_payment">';
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
|
||||
print '<td class="tdtop"><textarea name="note" wrap="soft" cols="60" rows="'.ROWS_3.'">'.GETPOST('note', 'restricthtml').'</textarea></td>';
|
||||
print '</tr>';
|
||||
@ -593,10 +604,37 @@ if ($id) {
|
||||
$morehtmlref .= '</form>';
|
||||
}
|
||||
|
||||
// Employee
|
||||
$userstatic = new User($db);
|
||||
$userstatic->fetch($object->fk_user);
|
||||
$morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1);
|
||||
//Employee
|
||||
if ($action != 'editfk_user') {
|
||||
if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) {
|
||||
$userstatic = new User($db);
|
||||
$result = $userstatic->fetch($object->fk_user);
|
||||
if ($result > 0) {
|
||||
$morehtmlref .= '<br>' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1);
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '<br>' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1);
|
||||
|
||||
if (!empty($object->fk_user)) {
|
||||
$userstatic = new User($db);
|
||||
$result = $userstatic->fetch($object->fk_user);
|
||||
if ($result > 0) {
|
||||
$morehtmlref .= $userstatic->getNomUrl(1);
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$morehtmlref .= '<br>'.$langs->trans('Employee').' : ';
|
||||
$morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref .= '<input type="hidden" name="action" value="setfk_user">';
|
||||
$morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$morehtmlref .= $form->select_dolusers($object->fk_user, 'userid', 1);
|
||||
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref .= '</form>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (!empty($conf->projet->enabled)) {
|
||||
@ -674,7 +712,7 @@ if ($id) {
|
||||
print '</td></tr>';*/
|
||||
|
||||
if ($action == 'edit') {
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . $object->amount . '"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">' . $langs->trans("Amount") . '</td><td><input name="amount" size="10" value="' . price($object->amount) . '"></td></tr>';
|
||||
} else {
|
||||
print '<tr><td>' . $langs->trans("Amount") . '</td><td>' . price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . '</td></tr>';
|
||||
}
|
||||
|
||||
@ -62,8 +62,8 @@ class SalariesStats extends Stats
|
||||
$this->from = MAIN_DB_PREFIX.$object->table_element;
|
||||
$this->field = 'amount';
|
||||
|
||||
$this->where .= " entity = ".$conf->entity;
|
||||
if ($this->socid) {
|
||||
$this->where = " entity = ".$conf->entity;
|
||||
if ($this->socid > 0) {
|
||||
$this->where .= " AND fk_soc = ".$this->socid;
|
||||
}
|
||||
if (is_array($this->userid) && count($this->userid) > 0) {
|
||||
@ -83,8 +83,8 @@ class SalariesStats extends Stats
|
||||
{
|
||||
$sql = "SELECT YEAR(datep) as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
//$sql .= " WHERE ".$this->where;
|
||||
|
||||
return $this->_getNbByYear($sql);
|
||||
}
|
||||
@ -102,12 +102,12 @@ class SalariesStats extends Stats
|
||||
$sql = "SELECT MONTH(datep) as dm, count(*)";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= " WHERE YEAR(datep) = ".$year;
|
||||
//$sql .= " AND ".$this->where;
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res = $this->_getNbByMonth($year, $sql, $format);
|
||||
//var_dump($res);print '<br>';
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@ -124,12 +124,11 @@ class SalariesStats extends Stats
|
||||
$sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'";
|
||||
//$sql .= " AND ".$this->where;
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
$res = $this->_getAmountByMonth($year, $sql, $format);
|
||||
//var_dump($res);print '<br>';
|
||||
|
||||
return $res;
|
||||
}
|
||||
@ -145,7 +144,7 @@ class SalariesStats extends Stats
|
||||
$sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")";
|
||||
$sql .= " FROM ".$this->from;
|
||||
$sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'";
|
||||
//$sql .= " AND ".$this->where;
|
||||
$sql .= " AND ".$this->where;
|
||||
$sql .= " GROUP BY dm";
|
||||
$sql .= $this->db->order('dm', 'DESC');
|
||||
|
||||
@ -161,7 +160,7 @@ class SalariesStats extends Stats
|
||||
{
|
||||
$sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql .= " FROM ".$this->from;
|
||||
//$sql .= " WHERE ".$this->where;
|
||||
$sql .= " WHERE ".$this->where;
|
||||
$sql .= " GROUP BY year";
|
||||
$sql .= $this->db->order('year', 'DESC');
|
||||
|
||||
|
||||
@ -33,10 +33,12 @@ $langs->loadLangs(array("salaries", "companies", "bills"));
|
||||
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
|
||||
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
|
||||
|
||||
$userid = GETPOST('userid', 'int'); if ($userid < 0) {
|
||||
$userid = GETPOST('userid', 'int');
|
||||
if ($userid < 0) {
|
||||
$userid = 0;
|
||||
}
|
||||
$socid = GETPOST('socid', 'int'); if ($socid < 0) {
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if ($socid < 0) {
|
||||
$socid = 0;
|
||||
}
|
||||
$id = GETPOST('id', 'int');
|
||||
@ -201,8 +203,8 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
// User
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '<tr><td>'.$langs->trans("Employee").'</td><td>';
|
||||
print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300');
|
||||
print '</td></tr>';
|
||||
// Year
|
||||
print '<tr><td>'.$langs->trans("Year").'</td><td>';
|
||||
|
||||
@ -80,7 +80,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
|
||||
$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int');
|
||||
if ($user->socid) {
|
||||
if ($user->socid && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
if (empty($socid) && $action == 'view') {
|
||||
|
||||
@ -2060,6 +2060,19 @@ if ($action == 'exportsite') {
|
||||
|
||||
// Regenerate site
|
||||
if ($action == 'regeneratesite') {
|
||||
// Check symlink to medias and restore it if ko. Recreate also dir of website if not found.
|
||||
$pathtomedias = DOL_DATA_ROOT.'/medias';
|
||||
$pathtomediasinwebsite = $pathofwebsite.'/medias';
|
||||
if (!is_link(dol_osencode($pathtomediasinwebsite))) {
|
||||
dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite);
|
||||
dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists
|
||||
$result = symlink($pathtomedias, $pathtomediasinwebsite);
|
||||
if (!$result) {
|
||||
setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors');
|
||||
$action = 'preview';
|
||||
}
|
||||
}
|
||||
|
||||
$result = $object->rebuildWebSiteFiles();
|
||||
if ($result > 0) {
|
||||
setEventMessages($langs->trans("PagesRegenerated", $result), null, 'mesgs');
|
||||
@ -2077,7 +2090,7 @@ if ($action == 'importsiteconfirm') {
|
||||
$action = 'importsite';
|
||||
} else {
|
||||
if (!empty($_FILES) || GETPOSTISSET('templateuserfile')) {
|
||||
// Check symlink to medias and restore it if ko
|
||||
// Check symlink to medias and restore it if ko. Recreate also dir of website if not found.
|
||||
$pathtomedias = DOL_DATA_ROOT.'/medias';
|
||||
$pathtomediasinwebsite = $pathofwebsite.'/medias';
|
||||
if (!is_link(dol_osencode($pathtomediasinwebsite))) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user